diff --git a/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/QmsPermissionConstant.java b/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/QmsPermissionConstant.java index 8ea6100..ee8342e 100644 --- a/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/QmsPermissionConstant.java +++ b/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/QmsPermissionConstant.java @@ -17,7 +17,8 @@ public interface QmsPermissionConstant { String TARGET_TYPE_CUSTOM = "custom"; //======================各业务模块权限常量============================= - //报告发起权限 - String REPORT_DOCUMENT_TYPE_START = "report_document_type_start"; + + String REPORT_DOCUMENT_TYPE_START = "report_document_type_start"; //报告发起权限 + String SAMPLE_WAREHOUSE_ADMIN = "sample_warehouse_admin"; //样品库管理员 } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/BusinessSampleDispatchController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/BusinessSampleDispatchController.java index 262fdcf..4cf8a37 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/BusinessSampleDispatchController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/BusinessSampleDispatchController.java @@ -1,12 +1,16 @@ package com.zt.plat.module.qms.business.bus.controller.admin; import com.alibaba.fastjson.JSONObject; -import com.zt.plat.module.qms.business.bus.controller.vo.BusinessSampleDispatchPageReqVO; -import com.zt.plat.module.qms.business.bus.controller.vo.BusinessSampleDispatchRespVO; -import com.zt.plat.module.qms.business.bus.controller.vo.BusinessSampleDispatchSaveReqVO; +import com.zt.plat.module.qms.business.bus.controller.vo.*; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSampleDispatchDetailDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO; +import com.zt.plat.module.qms.business.bus.service.BusinessSampleDispatchDetailService; import com.zt.plat.module.qms.business.bus.service.BusinessSubSampleService; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationPageReqVO; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationRespVO; +import com.zt.plat.module.qms.business.config.service.ConfigWarehouseLocationService; import com.zt.plat.module.qms.enums.QmsCommonConstant; +import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -46,7 +50,9 @@ public class BusinessSampleDispatchController implements BusinessControllerMarke @Resource private BusinessSampleDispatchService businessSampleDispatchService; + @Resource private BusinessSampleDispatchDetailService businessSampleDispatchDetailService; @Resource private BusinessSubSampleService businessSubSampleService; + @Resource private ConfigWarehouseLocationService configWarehouseLocationService; @PostMapping("/createTempData") @Operation(summary = "创建临时数据") @@ -68,7 +74,7 @@ public class BusinessSampleDispatchController implements BusinessControllerMarke @PostMapping("/addOrRemoveSample") @Operation(summary = "增加或移除样品") public CommonResult addOrRemoveSample(@Valid @RequestBody BusinessSampleDispatchSaveReqVO updateReqVO) { - businessSampleDispatchService.addOrRemoveSample(updateReqVO); + businessSampleDispatchService.addOrRemoveSample(updateReqVO, true); return success(true); } @@ -77,10 +83,26 @@ public class BusinessSampleDispatchController implements BusinessControllerMarke public CommonResult addBySampleReturnCode(@RequestBody JSONObject param) { String id = param.getString("id"); String sampleReturnCode = param.getString("sampleReturnCode"); + String warehouseCode = param.getString("warehouseCode"); + if(ObjectUtils.isEmpty(warehouseCode)){ + return CommonResult.error(BUSINESS_SUB_SAMPLE_NOT_EXISTS.getCode(), "请选择仓库,再扫描样品!"); + } BusinessSubSampleDO businessSubSampleDO = businessSubSampleService.getBySampleReturnCode(sampleReturnCode); if(businessSubSampleDO == null) return CommonResult.error(BUSINESS_SUB_SAMPLE_NOT_EXISTS.getCode(), "未查询到此样品!"); - //判断样品状态 + //判断样品状态、库位 +// String sampleWarehouseCode = businessSubSampleDO.getWarehouseCode(); //todo 判断库位 + ConfigWarehouseLocationPageReqVO warehouseReqVO = new ConfigWarehouseLocationPageReqVO(); + warehouseReqVO.setId(businessSubSampleDO.getConfigWarehouseLocationInfomationId()); + PageResult warehousePage = configWarehouseLocationService.getConfigWarehouseLocationPage(warehouseReqVO); + if(warehousePage.getTotal() == 0){ + return CommonResult.error(BUSINESS_SUB_SAMPLE_NOT_EXISTS.getCode(), "未查询到样品所在仓库,请检查样品码是否正确!"); + } + ConfigWarehouseLocationRespVO warehouse = warehousePage.getList().get(0); + if(!warehouseCode.equals(warehouse.getWarehouseCode())){ + return CommonResult.error(BUSINESS_SUB_SAMPLE_NOT_EXISTS.getCode(), "此样品所在仓库为:"+warehouse.getWarehouseName()+",请检查样品码是否正确!"); + } + String returnStatus = businessSubSampleDO.getReturnStatus(); if(!QmsCommonConstant.COMPLETED.equals(returnStatus)){ return CommonResult.error(BUSINESS_SUB_SAMPLE_NOT_EXISTS.getCode(), "样品状态为:"+returnStatus+",不能调拨!"); @@ -89,14 +111,19 @@ public class BusinessSampleDispatchController implements BusinessControllerMarke if("1".equals(dispatchStatus)){ return CommonResult.error(BUSINESS_SUB_SAMPLE_NOT_EXISTS.getCode(), "样品已被调拨:请归还后再调拨!"); } - //todo 重复校验 - + BusinessSampleDispatchDetailPageReqVO reqVO = new BusinessSampleDispatchDetailPageReqVO(); + reqVO.setParentId(Long.valueOf(id)); + reqVO.setSampleReturnCode(sampleReturnCode); + PageResult pageDetailList = businessSampleDispatchDetailService.getBusinessSampleDispatchDetailPage(reqVO); + if(pageDetailList.getTotal() > 0){ + return CommonResult.error(BUSINESS_SUB_SAMPLE_NOT_EXISTS.getCode(), "次样品已添加,请勿重复添加!"); + } List sampleIds = new ArrayList<>(); sampleIds.add(businessSubSampleDO.getId()); BusinessSampleDispatchSaveReqVO updateReqVO = new BusinessSampleDispatchSaveReqVO(); updateReqVO.setId(Long.valueOf(id)); updateReqVO.setAddSubSampleIds(sampleIds); - businessSampleDispatchService.addOrRemoveSample(updateReqVO); + businessSampleDispatchService.addOrRemoveSample(updateReqVO, false); return success(true); } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSampleDispatchService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSampleDispatchService.java index d06739a..f801f8f 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSampleDispatchService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSampleDispatchService.java @@ -19,7 +19,7 @@ import com.zt.plat.framework.common.pojo.PageResult; public interface BusinessSampleDispatchService { //增加样品 - void addOrRemoveSample(@Valid BusinessSampleDispatchSaveReqVO paramVo); + void addOrRemoveSample(@Valid BusinessSampleDispatchSaveReqVO paramVo, boolean updateCancelFlag); //发起流程 CommonResult createProcessInstance(BusinessSampleDispatchSaveReqVO paramVo); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSampleDispatchServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSampleDispatchServiceImpl.java index 6fcd0e7..5c6c706 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSampleDispatchServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSampleDispatchServiceImpl.java @@ -60,7 +60,7 @@ public class BusinessSampleDispatchServiceImpl implements BusinessSampleDispatch @Override @Transactional(rollbackFor = Exception.class) - public void addOrRemoveSample(BusinessSampleDispatchSaveReqVO paramVo) { + public void addOrRemoveSample(BusinessSampleDispatchSaveReqVO paramVo, boolean updateCancelFlag) { Long id = paramVo.getId(); List addSubSampleIds = paramVo.getAddSubSampleIds(); List removeDetailIds = paramVo.getRemoveDetailIds(); @@ -84,14 +84,13 @@ public class BusinessSampleDispatchServiceImpl implements BusinessSampleDispatch } if(!insertList.isEmpty()){ businessSampleDispatchDetailService.insertBatch(insertList); - if("-1".equals(entity.getCancelStatus())){ + if(updateCancelFlag && "-1".equals(entity.getCancelStatus())){ //如果有新增,修改临时数据状态 entity.setCancelStatus("0"); businessSampleDispatchMapper.updateById(entity); } } } - } @Override diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSubSampleServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSubSampleServiceImpl.java index e52428a..0a18ab0 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSubSampleServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSubSampleServiceImpl.java @@ -329,7 +329,7 @@ public class BusinessSubSampleServiceImpl implements BusinessSubSampleService { @Transactional(rollbackFor = Exception.class) public Integer execTakeOff(JSONObject reqVo) { String actionWay = reqVo.getString("actionWay"); - String warehouseLocationCode = reqVo.getString("warehouseLocationCode"); + String warehouseLocationCode = reqVo.getString("locationCode"); String sampleReturnCode = reqVo.getString("sampleReturnCodes"); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); String loginUserName = SecurityFrameworkUtils.getLoginUserNickname(); @@ -351,7 +351,7 @@ public class BusinessSubSampleServiceImpl implements BusinessSubSampleService { ConfigWarehouseLocationDO locationDO = configWarehouseLocationService.getLocationByCode(warehouseLocationCode, QmsWarehouseLocationConstant.WAREHOUSE_TYPE_SAMPLE); if(locationDO == null) throw exception(CONFIG_WAREHOUSE_LOCATION_NOT_EXISTS); - queryWrapper.eq(BusinessSubSampleDO::getConfigWarehouseLocationInfomationId, warehouseLocationCode); + queryWrapper.eq(BusinessSubSampleDO::getConfigWarehouseLocationInfomationId, locationDO.getId()); }else{ throw exception0(BUSINESS_SUB_SAMPLE_NOT_EXISTS.getCode(), "actionWay参数错误!"); } @@ -418,8 +418,10 @@ public class BusinessSubSampleServiceImpl implements BusinessSubSampleService { String warehouseLocationCode = reqVo.getString("warehouseLocationCode"); String sampleReturnCode = reqVo.getString("sampleReturnCode"); if(ObjectUtils.isEmpty(targetLocation)) - throw exception0(BUSINESS_SUB_SAMPLE_NOT_EXISTS.getCode(), "缺少目标库位参数!"); + throw exception0(BUSINESS_SUB_SAMPLE_NOT_EXISTS.getCode(), "缺少“变更后库位”参数!"); ConfigWarehouseLocationDO targetLocationDO = configWarehouseLocationService.getLocationByCode(targetLocation, QmsWarehouseLocationConstant.WAREHOUSE_TYPE_SAMPLE); + if(targetLocationDO == null) + throw exception0(BUSINESS_SUB_SAMPLE_NOT_EXISTS.getCode(), "“变更后库位”不存在,请检查编码是否正确!"); //查询要操作的样品 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(BusinessSubSampleDO::getSampleFlowNodeKey, QmsCommonConstant.FLOW_SAMPLE_STORAGE); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigWarehouseLocationController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigWarehouseLocationController.java index 53b4614..fbba672 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigWarehouseLocationController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigWarehouseLocationController.java @@ -1,8 +1,16 @@ package com.zt.plat.module.qms.business.config.controller.admin; +import com.zt.plat.framework.security.core.LoginUser; +import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigPermissionRespVO; import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationPageReqVO; import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationRespVO; import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationSaveReqVO; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigPermissionDO; +import com.zt.plat.module.qms.business.config.service.ConfigPermissionService; +import com.zt.plat.module.qms.enums.QmsPermissionConstant; +import com.zt.plat.module.qms.enums.QmsWarehouseLocationConstant; +import com.zt.plat.module.system.api.permission.PermissionApi; import org.springframework.web.bind.annotation.*; import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -40,8 +48,16 @@ import com.zt.plat.module.qms.business.config.service.ConfigWarehouseLocationSer public class ConfigWarehouseLocationController implements BusinessControllerMarker { - @Resource - private ConfigWarehouseLocationService configWarehouseLocationService; + @Resource private ConfigWarehouseLocationService configWarehouseLocationService; + @Resource private ConfigPermissionService configPermissionService; + @Resource private PermissionApi permissionApi; + + @PostMapping("/save") + @Operation(summary = "创建存放位置") +// @PreAuthorize("@ss.hasPermission('qms:config-warehouse-location:create')") + public CommonResult save(@Valid @RequestBody ConfigWarehouseLocationSaveReqVO createReqVO) { + return success(configWarehouseLocationService.save(createReqVO)); + } @PostMapping("/create") @Operation(summary = "创建存放位置") @@ -82,15 +98,35 @@ public class ConfigWarehouseLocationController implements BusinessControllerMark // @PreAuthorize("@ss.hasPermission('qms:config-warehouse-location:query')") public CommonResult getConfigWarehouseLocation(@RequestParam("id") Long id) { ConfigWarehouseLocationDO configWarehouseLocation = configWarehouseLocationService.getConfigWarehouseLocation(id); - return success(BeanUtils.toBean(configWarehouseLocation, ConfigWarehouseLocationRespVO.class)); + List permissionList = configPermissionService.getPermissionList(id, QmsPermissionConstant.SAMPLE_WAREHOUSE_ADMIN, ""); + List permissionRespVOList= BeanUtils.toBean(permissionList, ConfigPermissionRespVO.class); + ConfigWarehouseLocationRespVO vo = BeanUtils.toBean(configWarehouseLocation, ConfigWarehouseLocationRespVO.class); + vo.setPermissionList(permissionRespVOList); + return success(vo); } @GetMapping("/page") @Operation(summary = "获得存放位置分页") // @PreAuthorize("@ss.hasPermission('qms:config-warehouse-location:query')") public CommonResult> getConfigWarehouseLocationPage(@Valid ConfigWarehouseLocationPageReqVO pageReqVO) { - PageResult pageResult = configWarehouseLocationService.getConfigWarehouseLocationPage(pageReqVO); - return success(BeanUtils.toBean(pageResult, ConfigWarehouseLocationRespVO.class)); + PageResult pageResult = configWarehouseLocationService.getConfigWarehouseLocationPage(pageReqVO); + return success(pageResult); + } + + @GetMapping("/selectListWithPermission") + @Operation(summary = "安权限查询报告类型") + public CommonResult> selectListWithPermission(@Valid ConfigWarehouseLocationPageReqVO pageReqVO) { + pageReqVO.setPermissionFilterFlag("1"); + pageReqVO.setSrcPermissionType(QmsPermissionConstant.SAMPLE_WAREHOUSE_ADMIN); + pageReqVO.setDataType(QmsWarehouseLocationConstant.DATA_TYPE_WAREHOUSE); + //查询权限 + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + Long userId = loginUser.getId(); + CommonResult> roleRet = permissionApi.getUserRoleIdListByUserId(userId); + Set roleIds = roleRet.getData(); + pageReqVO.setRoleIds(roleIds); + List list = configWarehouseLocationService.selectListWithPermission(pageReqVO); + return success(BeanUtils.toBean(list, ConfigWarehouseLocationRespVO.class)); } @GetMapping("/export-excel") @@ -100,10 +136,9 @@ public class ConfigWarehouseLocationController implements BusinessControllerMark public void exportConfigWarehouseLocationExcel(@Valid ConfigWarehouseLocationPageReqVO pageReqVO, HttpServletResponse response) throws IOException { pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = configWarehouseLocationService.getConfigWarehouseLocationPage(pageReqVO).getList(); + List list = configWarehouseLocationService.getConfigWarehouseLocationPage(pageReqVO).getList(); // 导出 Excel - ExcelUtils.write(response, "存放位置.xls", "数据", ConfigWarehouseLocationRespVO.class, - BeanUtils.toBean(list, ConfigWarehouseLocationRespVO.class)); + ExcelUtils.write(response, "存放位置.xls", "数据", ConfigWarehouseLocationRespVO.class, list); } } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigWarehouseLocationPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigWarehouseLocationPageReqVO.java index 635a7e0..106af70 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigWarehouseLocationPageReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigWarehouseLocationPageReqVO.java @@ -6,6 +6,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import com.zt.plat.framework.common.pojo.PageParam; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; +import java.util.Set; import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -13,6 +14,9 @@ import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH @Data public class ConfigWarehouseLocationPageReqVO extends PageParam { + @Schema(description = "ID", example = "31498") + private Long id; + @Schema(description = "父ID", example = "31498") private Long parentId; @@ -52,4 +56,14 @@ public class ConfigWarehouseLocationPageReqVO extends PageParam { @Schema(description = "标签打印模板key") private String printTemplate; + + //===================扩展属性===================== + @Schema(description = "查询时进行权限过滤") + private String permissionFilterFlag; + + @Schema(description = "查询用-权限角色") + private Set roleIds; + + @Schema(description = "查询用-源权限类型") + private String srcPermissionType; } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigWarehouseLocationRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigWarehouseLocationRespVO.java index da88519..5c70c43 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigWarehouseLocationRespVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigWarehouseLocationRespVO.java @@ -4,6 +4,8 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.time.LocalDateTime; +import java.util.List; + import com.alibaba.excel.annotation.*; @Schema(description = "管理后台 - 存放位置 Response VO") @@ -66,4 +68,14 @@ public class ConfigWarehouseLocationRespVO { @Schema(description = "标签打印模板key") @ExcelProperty("标签打印模板key") private String printTemplate; + + //===========扩展字段======================= + @Schema(description = "权限列表") + List permissionList; + + @Schema(description = "仓库名称") + String warehouseName; + + @Schema(description = "仓库编码") + String warehouseCode; } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigWarehouseLocationSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigWarehouseLocationSaveReqVO.java index 3127529..b6e8cd0 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigWarehouseLocationSaveReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigWarehouseLocationSaveReqVO.java @@ -4,6 +4,8 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import jakarta.validation.constraints.*; +import java.util.List; + @Schema(description = "管理后台 - 存放位置新增/修改 Request VO") @Data public class ConfigWarehouseLocationSaveReqVO { @@ -51,4 +53,7 @@ public class ConfigWarehouseLocationSaveReqVO { @Schema(description = "标签打印模板key") private String printTemplate; + //===========扩展字段======================= + @Schema(description = "权限列表") + List permissionList; } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigWarehouseLocationMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigWarehouseLocationMapper.java index ef85e56..9dabfdd 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigWarehouseLocationMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigWarehouseLocationMapper.java @@ -3,9 +3,16 @@ package com.zt.plat.module.qms.business.config.dal.mapper; import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; +import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSampleDispatchDetailDO; import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationPageReqVO; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationRespVO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigWarehouseLocationDO; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigWarehouseLocationParDO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 存放位置 Mapper @@ -15,9 +22,16 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ConfigWarehouseLocationMapper extends BaseMapperX { - default PageResult selectPage(ConfigWarehouseLocationPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() + default PageResult selectPage(ConfigWarehouseLocationPageReqVO reqVO) { + + MPJLambdaWrapperX wrapper = new MPJLambdaWrapperX<>(); + //仓库 + wrapper.leftJoin(ConfigWarehouseLocationParDO.class, ConfigWarehouseLocationParDO::getId, ConfigWarehouseLocationDO::getParentId); + wrapper.selectAll(ConfigWarehouseLocationDO.class) + .selectAs(ConfigWarehouseLocationParDO::getName, ConfigWarehouseLocationRespVO::getWarehouseName) + .selectAs(ConfigWarehouseLocationParDO::getCode, ConfigWarehouseLocationRespVO::getWarehouseCode) .eqIfPresent(ConfigWarehouseLocationDO::getWarehouseType, reqVO.getWarehouseType()) + .eqIfPresent(ConfigWarehouseLocationDO::getId, reqVO.getId()) .eqIfPresent(ConfigWarehouseLocationDO::getParentId, reqVO.getParentId()) .likeIfPresent(ConfigWarehouseLocationDO::getName, reqVO.getName()) .eqIfPresent(ConfigWarehouseLocationDO::getCode, reqVO.getCode()) @@ -29,7 +43,10 @@ public interface ConfigWarehouseLocationMapper extends BaseMapperX selectListWithPermission(@Param("param") ConfigWarehouseLocationPageReqVO param); } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigWarehouseLocationService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigWarehouseLocationService.java index 71f440a..ceeda49 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigWarehouseLocationService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigWarehouseLocationService.java @@ -18,6 +18,9 @@ public interface ConfigWarehouseLocationService { ConfigWarehouseLocationDO getLocationByCode(String code, String warehouseType); + //保存数据 + ConfigWarehouseLocationRespVO save(@Valid ConfigWarehouseLocationSaveReqVO reqVO); + /** * 创建存放位置 * @@ -61,6 +64,7 @@ public interface ConfigWarehouseLocationService { * @param pageReqVO 分页查询 * @return 存放位置分页 */ - PageResult getConfigWarehouseLocationPage(ConfigWarehouseLocationPageReqVO pageReqVO); + PageResult getConfigWarehouseLocationPage(ConfigWarehouseLocationPageReqVO pageReqVO); + List selectListWithPermission(ConfigWarehouseLocationPageReqVO pageReqVO); } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigWarehouseLocationServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigWarehouseLocationServiceImpl.java index e8f1d90..235beca 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigWarehouseLocationServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigWarehouseLocationServiceImpl.java @@ -2,9 +2,11 @@ package com.zt.plat.module.qms.business.config.service; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigPermissionSaveReqVO; import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationPageReqVO; import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationRespVO; import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationSaveReqVO; +import com.zt.plat.module.qms.enums.QmsPermissionConstant; import com.zt.plat.module.qms.enums.QmsWarehouseLocationConstant; import org.springframework.stereotype.Service; import jakarta.annotation.Resource; @@ -19,7 +21,6 @@ import com.zt.plat.framework.common.util.object.BeanUtils; import com.zt.plat.module.qms.business.config.dal.mapper.ConfigWarehouseLocationMapper; import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; -import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList; import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*; /** @@ -31,11 +32,30 @@ import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*; @Validated public class ConfigWarehouseLocationServiceImpl implements ConfigWarehouseLocationService { - + @Resource private ConfigPermissionService configPermissionService; @Resource private ConfigWarehouseLocationMapper configWarehouseLocationMapper; + @Override + public ConfigWarehouseLocationRespVO save(ConfigWarehouseLocationSaveReqVO reqVo) { + Long id = reqVo.getId(); + //处理权限 + List primissionList = reqVo.getPermissionList(); + if(id == null){ + ConfigWarehouseLocationDO entity = BeanUtils.toBean(reqVo, ConfigWarehouseLocationDO.class); + configWarehouseLocationMapper.insert(entity); + id = entity.getId(); + reqVo.setId( id); + } + for(ConfigPermissionSaveReqVO permission : primissionList){ + permission.setSourceId( id); + permission.setSourceType(QmsPermissionConstant.SAMPLE_WAREHOUSE_ADMIN); + } + configPermissionService.savePermissionListWithAutoDelete(primissionList, id, QmsPermissionConstant.SAMPLE_WAREHOUSE_ADMIN, null); + return BeanUtils.toBean(reqVo, ConfigWarehouseLocationRespVO.class); + } + @Override public ConfigWarehouseLocationDO getLocationByCode(String code, String warehouseType) { LambdaQueryWrapper query = new LambdaQueryWrapper<>(); @@ -104,8 +124,12 @@ public class ConfigWarehouseLocationServiceImpl implements ConfigWarehouseLocati } @Override - public PageResult getConfigWarehouseLocationPage(ConfigWarehouseLocationPageReqVO pageReqVO) { + public PageResult getConfigWarehouseLocationPage(ConfigWarehouseLocationPageReqVO pageReqVO) { return configWarehouseLocationMapper.selectPage(pageReqVO); } + @Override + public List selectListWithPermission(ConfigWarehouseLocationPageReqVO pageReqVO) { + return configWarehouseLocationMapper.selectListWithPermission(pageReqVO); + } } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java index e185723..0eb4bcc 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java @@ -193,7 +193,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService r.put(colPrefix + "01", "方法检出限"); lastObjFlag = true; if(colIndex % colCountOneSample == 0){ - addTitleToRowList(rowAssist, t, dataLength, emptyRowCount, rowList, fieldList); + addTitleToRowList(fixedCol, rowAssist, t, dataLength, emptyRowCount, rowList, fieldList); if("1".equals(hasRange)) addRangeToRowList(rowAssist, r, dataLength, emptyRowCount, rowList); t = new JSONObject(); @@ -211,7 +211,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService colIndex++; } if(lastObjFlag){ - addTitleToRowList(rowAssist, t, dataLength, emptyRowCount, rowList, fieldList); + addTitleToRowList(fixedCol, rowAssist, t, dataLength, emptyRowCount, rowList, fieldList); if("1".equals(hasRange)) addRangeToRowList(rowAssist, r, dataLength, emptyRowCount, rowList); } @@ -293,20 +293,40 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService * @param * * */ - private void addTitleToRowList(Integer rowAssist, JSONObject t, Integer dataLength, Integer emptyRowCount, - List rowList, List fieldList){ + private void addTitleToRowList(JSONArray fixedCol, Integer rowAssist, JSONObject t, Integer dataLength, Integer emptyRowCount, List rowList, List fieldList){ int rowIndex = (1 + dataLength + emptyRowCount) * (rowAssist - 1) + 1; //(标题 + 数据行 + 空行) //处理固定列 int index = 1; String colKey = ""; - for(ConfigReportFieldDO fieldDO : fieldList){ - String fieldName = fieldDO.getFieldName(); - String fieldType = fieldDO.getFieldType(); - if(FIELD_DYNAMIC.equals(fieldType)) - continue; - colKey = parseNumToString(index, 2); - t.put(colPrefix + colKey, fieldName); - index++; + for(int i=0;i + + \ No newline at end of file