This commit is contained in:
2022-09-02 16:21:20 +08:00
parent 0fb22fa625
commit c0ce68f5b2
77 changed files with 1020 additions and 264 deletions

View File

@@ -58,7 +58,7 @@ public class InspectionSheetController {
@ApiImplicitParam(name = "batchNumber", value = "批次号", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "id", value = "检验单号", paramType = "query", dataTypeClass = Integer.class)
})
// @PreAuthorize("@ex.hasAuthority('code:inspectionSheet:page')")
@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:page')")
public Result<PageData<InspectionSheetDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<InspectionSheetDTO> page = inspectionSheetService.page(params);
@@ -67,7 +67,7 @@ public class InspectionSheetController {
@GetMapping("{id}")
@ApiOperation("信息")
// @PreAuthorize("@ex.hasAuthority('code:inspectionSheet:info')")
@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:info')")
public Result<InspectionSheetDTO> get(@PathVariable("id") Long id){
InspectionSheetDTO data = inspectionSheetService.get(id);
@@ -76,8 +76,8 @@ public class InspectionSheetController {
@PostMapping
@ApiOperation("保存")
// @LogOperation("保存")
// @PreAuthorize("@ex.hasAuthority('code:inspectionSheet:save')")
@LogOperation("保存")
@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:save')")
public Result<Long> save(@RequestBody InspectionSheetDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@@ -89,8 +89,8 @@ public class InspectionSheetController {
@PutMapping
@ApiOperation("修改")
// @LogOperation("修改")
// @PreAuthorize("@ex.hasAuthority('code:inspectionSheet:update')")
@LogOperation("修改")
@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:update')")
public Result<Long> update(@RequestBody InspectionSheetDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@@ -102,8 +102,8 @@ public class InspectionSheetController {
@DeleteMapping
@ApiOperation("删除")
// @LogOperation("删除")
// @PreAuthorize("@ex.hasAuthority('code:inspectionSheet:delete')")
@LogOperation("删除")
@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:delete')")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
@@ -115,8 +115,8 @@ public class InspectionSheetController {
@GetMapping("export")
@ApiOperation("导出")
// @LogOperation("导出")
// @PreAuthorize("@ex.hasAuthority('code:inspectionSheet:export')")
@LogOperation("导出")
@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<InspectionSheetDTO> list = inspectionSheetService.list(params);

View File

@@ -0,0 +1,7 @@
-- 菜单初始SQL
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1564803881757933569, 1067246875800000035, '检验单 表', 'processInspection/inspectionSheet', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1564803881757933570, 1564803881757933569, '查看', NULL, 'processInspection:inspectionSheet:page,processInspection:inspectionSheet:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1564803881757933571, 1564803881757933569, '新增', NULL, 'processInspection:inspectionSheet:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1564803881757933572, 1564803881757933569, '修改', NULL, 'processInspection:inspectionSheet:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1564803881757933573, 1564803881757933569, '删除', NULL, 'processInspection:inspectionSheet:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1564803881757933574, 1564803881757933569, '导出', NULL, 'processInspection:inspectionSheet:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());

View File

@@ -3,6 +3,14 @@ package com.cnbm.processInspection.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.basic.entity.Machine;
import com.cnbm.basic.entity.Product;
import com.cnbm.basic.entity.Shift;
import com.cnbm.basic.entity.WorkingProcedure;
import com.cnbm.basic.service.impl.MachineServiceImpl;
import com.cnbm.basic.service.impl.ProductServiceImpl;
import com.cnbm.basic.service.impl.ShiftServiceImpl;
import com.cnbm.basic.service.impl.WorkingProcedureServiceImpl;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
@@ -27,17 +35,34 @@ import java.util.Map;
*/
@Service
public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetMapper, InspectionSheet, InspectionSheetDTO> implements IInspectionSheetService {
@Autowired
private InspectionSheetMapper mapper;
private ProductServiceImpl productService;
@Autowired
private WorkingProcedureServiceImpl workingProcedureService;
@Autowired
private MachineServiceImpl machineService;
@Autowired
private ShiftServiceImpl shiftService;
@Override
public QueryWrapper<InspectionSheet> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
Long id = (Long)params.get("id");
String inspectionSite = (String)params.get("inspectionSite");
String orderNumber = (String)params.get("orderNumber");
String batchNumber = (String)params.get("batchNumber");
QueryWrapper<InspectionSheet> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.like(ObjectUtils.isNotNull(id), "id", id);
wrapper.like(StringUtils.isNotBlank(inspectionSite), "inspection_stage", inspectionSite);
wrapper.like(StringUtils.isNotBlank(orderNumber), "order_number", orderNumber);
wrapper.like(StringUtils.isNotBlank(batchNumber), "batch_number", batchNumber);
wrapper.eq(ObjectUtils.isNotNull(params.get("productId")), "product_id", params.get("productId"));
wrapper.eq(ObjectUtils.isNotNull(params.get("workingProcedureId")), "working_procedure_id", params.get("workingProcedureId"));
wrapper.eq(ObjectUtils.isNotNull(params.get("machineId")), "machine_id", params.get("machineId"));
return wrapper;
}
@@ -47,7 +72,40 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
getPage(params, "id", true),
getWrapper(params)
);
return getPageData(page, InspectionSheetDTO.class);
PageData<InspectionSheetDTO> inspectionSheetDTOPageData = getPageData(page, InspectionSheetDTO.class);
if(!inspectionSheetDTOPageData.getList().isEmpty()){
for(InspectionSheetDTO dto:inspectionSheetDTOPageData.getList()){
Product product = productService.selectById(dto.getProductId());
WorkingProcedure workingProcedure = workingProcedureService.selectById(dto.getWorkingProcedureId());
Machine machine = machineService.selectById(dto.getMachineId());
Shift shift = shiftService.selectById(dto.getShiftId());
String productName = null;
String workingProcedureName = null;
String machineName = null;
String shiftName = null;
if (product!=null){
productName = product.getName();
}
if (workingProcedure!=null){
workingProcedureName = workingProcedure.getName();
}
if (machine!=null){
machineName = machine.getName();
}
if (shift!=null){
shiftName = shift.getName();
}
dto.setProductName(productName);
dto.setWorkingProcedureName(workingProcedureName);
dto.setMachineName(machineName);
dto.setShiftName(shiftName);
}
}
return inspectionSheetDTOPageData;
}
@Override
@@ -77,6 +135,9 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
deleteBatchIds(Arrays.asList(ids));
}
@Autowired
private InspectionSheetMapper mapper;
@Override
@Transactional(rollbackFor = Exception.class)
public List<InspectionSheetDTO> list(Map<String, Object> params) {