lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/CutterController.java
@@ -1,5 +1,7 @@ package org.jeecg.modules.dnc.controller; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -13,6 +15,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.List; @Slf4j @Api(tags = "åå ·ä¿¡æ¯") @@ -35,6 +38,25 @@ } /** * æ¥è¯¢åå ·List * @param cutter * @return */ @AutoLog(value = "åå ·ä¿¡æ¯-æ¥è¯¢åå ·List") @ApiOperation(value = "åå ·ä¿¡æ¯-æ¥è¯¢åå ·List", notes = "åå ·ä¿¡æ¯-æ¥è¯¢åå ·List") @GetMapping("/getList") public Result<?> getList( Cutter cutter){ QueryWrapper<Cutter> queryWrapper = new QueryWrapper<>(); queryWrapper.eq(StrUtil.isNotEmpty(cutter.getDocId()),"doc_id",cutter.getDocId()); queryWrapper.like(StrUtil.isNotEmpty(cutter.getCutterName()),"cutter_name",cutter.getCutterName()); queryWrapper.like(StrUtil.isNotEmpty(cutter.getCutterType()),"cutter_type",cutter.getCutterType()); queryWrapper.like(StrUtil.isNotEmpty(cutter.getCutterSpacing()),"cutter_spacing",cutter.getCutterSpacing()); queryWrapper.orderByDesc("create_time"); List<Cutter> list = service.list(queryWrapper); return Result.OK(list); } /** * æ°å¢åå ·ä¿¡æ¯ * @param cutter * @return lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/GuideCardBatchController.java
@@ -12,6 +12,7 @@ import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.modules.dnc.entity.GuideCardBatch; import org.jeecg.modules.dnc.service.IGuideCardBatchService; import org.jeecg.modules.dncFlow.vo.GuideCardBatchFlowTaskVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; @@ -139,6 +140,28 @@ } /** * å起确认æµç¨ * @param id * @return */ @ApiOperation(value="ncæä»¶å¯¹åºæ°æ§ç¨åºå 工确认表-å起确认æµç¨", notes="ncæä»¶å¯¹åºæ°æ§ç¨åºå 工确认表-å起确认æµç¨") @GetMapping(value = "/startGuideCardBatch") public Result<?> startGuideCardBatch(String id){ return guideCardBatchService.startGuideCardBatch(id); } /** * æµç¨èç¹å®¡æ ¸ * @param guideCardBatchFlowTaskVo * @return */ @ApiOperation(value="ncæä»¶å¯¹åºæ°æ§ç¨åºå 工确认表-æµç¨èç¹å®¡æ ¸", notes="ncæä»¶å¯¹åºæ°æ§ç¨åºå 工确认表-æµç¨èç¹å®¡æ ¸") @PostMapping(value = "/auditGuideCardBatch") public Result<?> auditGuideCardBatch(@RequestBody GuideCardBatchFlowTaskVo guideCardBatchFlowTaskVo){ return guideCardBatchService.auditGuideCardBatch(guideCardBatchFlowTaskVo); } /** * 导åºexcel * * @param request lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/GuideCardBatch.java
@@ -9,6 +9,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import org.jeecg.common.aspect.annotation.Dict; import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.format.annotation.DateTimeFormat; @@ -104,6 +105,7 @@ /**ç¼å人*/ @Excel(name = "ç¼å人", width = 15) @ApiModelProperty(value = "ç¼å人") @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname") private String compiler; /**ç¼åæ¥æ*/ @Excel(name = "ç¼åæ¥æ", width = 15, format = "yyyy-MM-dd") @@ -114,6 +116,7 @@ /**æ ¡å¯¹äºº*/ @Excel(name = "æ ¡å¯¹äºº", width = 15) @ApiModelProperty(value = "æ ¡å¯¹äºº") @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname") private String proofreader; /**æ ¡å¯¹æ¥æ*/ @Excel(name = "æ ¡å¯¹æ¥æ", width = 15, format = "yyyy-MM-dd") @@ -124,6 +127,7 @@ /**æä½è */ @Excel(name = "æä½è ", width = 15) @ApiModelProperty(value = "æä½è ") @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname") private String operator; /**馿£æ¥æ*/ @Excel(name = "馿£æ¥æ", width = 15, format = "yyyy-MM-dd") @@ -131,9 +135,14 @@ @DateTimeFormat(pattern="yyyy-MM-dd") @ApiModelProperty(value = "馿£æ¥æ") private Date inspectionTime; /**馿£æè§*/ @Excel(name = "馿£æè§", width = 15) @ApiModelProperty(value = "馿£æè§") private String inspectionOpinion; /**审æ¹äºº*/ @Excel(name = "审æ¹äºº", width = 15) @ApiModelProperty(value = "审æ¹äºº") @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname") private String approver; /**å®¡æ¹æ¥æ*/ @Excel(name = "å®¡æ¹æ¥æ", width = 15, format = "yyyy-MM-dd") @@ -143,6 +152,7 @@ private Date approverTime; /**å建人*/ @ApiModelProperty(value = "å建人") @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname") private String createBy; /**åå»ºæ¥æ*/ @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IGuideCardBatchService.java
@@ -1,7 +1,9 @@ package org.jeecg.modules.dnc.service; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.dnc.entity.GuideCardBatch; import org.jeecg.modules.dncFlow.vo.GuideCardBatchFlowTaskVo; /** * @Description: ncæä»¶å¯¹åºæ°æ§ç¨åºå 工确认表 @@ -24,4 +26,18 @@ * @return */ boolean importGuideCardBatch(String docId,String attributionId,Integer attributionType); /** * å起确认æµç¨ * @param id * @return */ Result<?> startGuideCardBatch(String id); /** * æµç¨èç¹å®¡æ ¸ * @param guideCardBatchFlowTaskVo * @return */ Result<?> auditGuideCardBatch(GuideCardBatchFlowTaskVo guideCardBatchFlowTaskVo); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/GuideCardBatchServiceImpl.java
@@ -1,21 +1,39 @@ package org.jeecg.modules.dnc.service.impl; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.shiro.SecurityUtils; import org.flowable.engine.TaskService; import org.flowable.task.api.Task; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.DateUtils; import org.jeecg.modules.dnc.constant.DocAttributionTypeEnum; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.dnc.mapper.GuideCardBatchMapper; import org.jeecg.modules.dnc.response.ActivitiCode; import org.jeecg.modules.dnc.response.CommonCode; import org.jeecg.modules.dnc.response.UcenterCode; import org.jeecg.modules.dnc.service.*; import org.jeecg.modules.dnc.utils.ValidateUtil; import org.jeecg.modules.dncFlow.constant.GuideCardBatchEnum; import org.jeecg.modules.dncFlow.entity.DispatchFile; import org.jeecg.modules.dncFlow.vo.GuideCardBatchFlowTaskVo; import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService; import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; import org.jeecg.modules.flowable.apithird.service.FlowCommonService; import org.jeecg.modules.flowable.service.IFlowDefinitionService; import org.jeecg.modules.flowable.service.IFlowTaskService; import org.jeecg.modules.system.service.ISysDictService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; import java.util.Date; import java.util.List; import javax.annotation.Resource; import java.util.*; /** * @Description: ncæä»¶å¯¹åºæ°æ§ç¨åºå 工确认表 @@ -23,17 +41,14 @@ * @Date: 2025-05-27 * @Version: V1.0 */ @Service public class GuideCardBatchServiceImpl extends ServiceImpl<GuideCardBatchMapper, GuideCardBatch> implements IGuideCardBatchService { @Service("IGuideCardBatchService") public class GuideCardBatchServiceImpl extends ServiceImpl<GuideCardBatchMapper, GuideCardBatch> implements IGuideCardBatchService , FlowCallBackServiceI { @Autowired private ISysDictService sysDictService; @Autowired private IDocInfoService docInfoService; @Autowired private IDocRelativeService docRelativeService; @Autowired private IPartsInfoService partsInfoService; @@ -46,6 +61,17 @@ @Autowired private IDeviceTypeService deviceTypeService; @Resource private FlowCommonService flowCommonService; @Resource private IFlowDefinitionService flowDefinitionService; @Autowired private IFlowTaskService flowTaskService; @Autowired private TaskService taskService; @Autowired private IFlowMyBusinessService flowMyBusinessService; /** * çææµæ°´å· @@ -143,4 +169,179 @@ guideCardBatch.setCreateTime(new Date()); return this.save(guideCardBatch); } /** * å起确认æµç¨ * @param id * @return */ @Override @Transactional(rollbackFor = Exception.class) public Result<?> startGuideCardBatch(String id){ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); //è·åç¨åºå 工确认表 GuideCardBatch guideCardBatch=this.getById(id); if (guideCardBatch==null) { return Result.ok("æªæ¾å°å¯¹åºçç¨åºå 工确认表"); } //å¡«å æ°æ® guideCardBatch.setCompiler(user.getUsername()); guideCardBatch.setCompilerTime(new Date()); guideCardBatch.setFlowStatus(GuideCardBatchEnum.VERIFY.getCode()); this.updateById(guideCardBatch); System.out.println("ç¨åºå 工确认表 确认æµç¨ï¼" + guideCardBatch.getId()); flowCommonService.initActBusiness("æµæ°´å·ï¼"+guideCardBatch.getSerialNumber()+" ç¨åºå 工确认表è¿è¡ç¡®è®¤æµç¨", guideCardBatch.getId(), "IGuideCardBatchService", "nc_guide_card_batch", null); Map<String, Object> variables = new HashMap<>(); variables.put("dataId", guideCardBatch.getId()); variables.put("organization", "ç¨æ·"+user.getRealname()+"åèµ·æµç¨"); variables.put("comment", "ç¨æ·"+user.getRealname()+"åèµ·æµç¨"); variables.put("proofreading",true); Result result= flowDefinitionService.startProcessInstanceByKey("nc_guide_card_batch", variables); if (!result.isSuccess()) { guideCardBatch.setCompiler(null); guideCardBatch.setCompilerTime(null); this.updateById(guideCardBatch); } return result; } /** * æµç¨èç¹å®¡æ ¸ * @param guideCardBatchFlowTaskVo * @return */ @Override @Transactional(rollbackFor = Exception.class) public Result<?> auditGuideCardBatch(GuideCardBatchFlowTaskVo guideCardBatchFlowTaskVo){ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); try { // åæ°æ ¡éª if (!ValidateUtil.validateString(guideCardBatchFlowTaskVo.getTaskId()) || !ValidateUtil.validateString(guideCardBatchFlowTaskVo.getDataId())) { return Result.error(CommonCode.INVALID_PARAM.toString()); } String userId = user.getId(); guideCardBatchFlowTaskVo.setAssignee(user.getUsername()); if (!ValidateUtil.validateString(userId)) { return Result.error(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST.toString()); } // æ°æ®æ¥è¯¢ GuideCardBatch guideCardBatch = this.getById(guideCardBatchFlowTaskVo.getDataId()); if (guideCardBatch == null) { return Result.error(CommonCode.INVALID_PARAM.toString()); } DocInfo docInfo = docInfoService.getById(guideCardBatch.getDocId()); if (docInfo == null) { return Result.error(ActivitiCode.ACT_DOC_ERROR.toString()); } // 2. æ¥è¯¢æµç¨ä¸å¡è®°å½ï¼å¤çç©ºç»æï¼ List<FlowMyBusiness> businessList = flowMyBusinessService.list( new QueryWrapper<FlowMyBusiness>() .eq("process_instance_id", guideCardBatchFlowTaskVo.getInstanceId()) ); if (businessList.isEmpty()) { return Result.error("æµç¨è®°å½ä¸åå¨"); } FlowMyBusiness flowMyBusiness = businessList.get(0); // 3. æ ¡éªç¨æ·æ¯å¦ä¸ºåéå¤ç人 List<String> todoUsers = JSON.parseArray(flowMyBusiness.getTodoUsers(), String.class); if (todoUsers == null || !todoUsers.contains(user.getUsername())) { return Result.error("ç¨æ·æ ææä½æ¤ä»»å¡"); } // 4. 认é¢ä»»å¡ï¼å¤ç已被认é¢çæ åµï¼ String taskId = flowMyBusiness.getTaskId(); Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); if (task == null) { return Result.error("ä»»å¡ä¸å卿已宿"); } if (task.getAssignee() != null && !task.getAssignee().equals(user.getUsername())) { return Result.error("ä»»å¡å·²è¢«ä»äººè®¤é¢"); } taskService.claim(taskId, user.getUsername()); // 设置æµç¨åé Map<String, Object> values = new HashMap<>(); values.put("dataId", guideCardBatch.getId()); values.put("assignee", userId); values.put("comment", guideCardBatchFlowTaskVo.getComment()); values.put("organization", guideCardBatchFlowTaskVo.getComment()); if (guideCardBatchFlowTaskVo.getCheckType() != null) { values.put("checkType", guideCardBatchFlowTaskVo.getCheckType()); } if (guideCardBatchFlowTaskVo.getConfirmType() != null) { values.put("confirmType", guideCardBatchFlowTaskVo.getConfirmType()); } if (guideCardBatchFlowTaskVo.getApproveType() != null) { values.put("approveType", guideCardBatchFlowTaskVo.getApproveType()); } guideCardBatchFlowTaskVo.setValues(values); // 宿æµç¨ä»»å¡ Result result = flowTaskService.complete(guideCardBatchFlowTaskVo); if (result.isSuccess()) { if (guideCardBatchFlowTaskVo.getCheckType() != null) { if (guideCardBatchFlowTaskVo.getCheckType()){ guideCardBatch.setFlowStatus(GuideCardBatchEnum.CONFIRM.getCode()); guideCardBatch.setProofreader(user.getUsername()); guideCardBatch.setProofreaderTime(new Date()); }else { guideCardBatch.setFlowStatus(GuideCardBatchEnum.PREPARE.getCode()); } } if (guideCardBatchFlowTaskVo.getConfirmType() != null) { if (guideCardBatchFlowTaskVo.getConfirmType()){ guideCardBatch.setFlowStatus(GuideCardBatchEnum.APPROVE.getCode()); guideCardBatch.setOperator(user.getUsername()); guideCardBatch.setInspectionTime(new Date()); guideCardBatch.setInspectionOpinion(guideCardBatchFlowTaskVo.getInspectionOpinion()); }else { guideCardBatch.setFlowStatus(GuideCardBatchEnum.PREPARE.getCode()); } } if (guideCardBatchFlowTaskVo.getApproveType() != null) { if (guideCardBatchFlowTaskVo.getApproveType()){ guideCardBatch.setFlowStatus(GuideCardBatchEnum.COMPLETE.getCode()); guideCardBatch.setApprover(user.getUsername()); guideCardBatch.setApproverTime(new Date()); }else { guideCardBatch.setFlowStatus(GuideCardBatchEnum.PREPARE.getCode()); } } this.updateById(guideCardBatch); } else { return result; } return Result.OK("æä½æå"); } catch (Exception e) { // 设置äºå¡åæ» TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return Result.error("æä½å¤±è´¥ï¼" + e.getMessage()); } } @Override public void afterFlowHandle(FlowMyBusiness business) { business.getTaskNameId();//æ¥ä¸æ¥å®¡æ¹çèç¹ business.getValues();//åç«¯ä¼ è¿æ¥çåæ° business.getActStatus(); } @Override public Object getBusinessDataById(String dataId) { return this.getById(dataId); } @Override public Map<String, Object> flowValuesOfTask(String taskNameId, Map<String, Object> values) { return null; } @Override public List<String> flowCandidateUsernamesOfTask(String taskNameId, Map<String, Object> values) { //ä¸å¡æ¯å¦å¹²é¢æµç¨ï¼ä¸å¡å¹²é¢ï¼æµç¨å¹²é¢ï¼æå®äººåè¿è¡å¤ç return null; } } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java
@@ -540,10 +540,10 @@ List<DeviceType> deviceTypeList = deviceTypeService.getDeviceTypeByAttribution(processIds, DocAttributionTypeEnum.PROCESS.getCode(),treeInfoRequest.getDeviceManagementName(),treeInfoRequest.getDeviceManagementCode()); if (deviceTypeList != null && !deviceTypeList.isEmpty()) { List<String> deviceManagementIds=deviceTypeList.stream().map(DeviceType::getId).collect(Collectors.toList()); List<String> deviceTypeIds=deviceTypeList.stream().map(DeviceType::getId).collect(Collectors.toList()); DocInfoQueryRequest docQuery = new DocInfoQueryRequest(); BeanUtil.copyProperties(treeInfoRequest,docQuery); docQuery.setAttributionIds(String.join(",",deviceManagementIds)); docQuery.setAttributionIds(String.join(",",deviceTypeIds)); docQuery.setDocClassCode("NC"); docQuery.setAttributionType(DocAttributionTypeEnum.PROCESS.getCode()); docInfos=docInfoService.findListByDocQuery(docQuery); @@ -554,6 +554,10 @@ treeInfoRequest.setProcessIds(id); List<DocInfo> docInfoList = workStepService.getByWorkStepNCFile(treeInfoRequest); docInfos.addAll(docInfoList); }else { treeInfoRequest.setProcessIds(processIds); List<DocInfo> docInfoList = workStepService.getByWorkStepNCFile(treeInfoRequest); docInfos.addAll(docInfoList); } return docInfos; } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java
@@ -469,10 +469,10 @@ List<DeviceType> deviceTypeList = deviceTypeService.getDeviceTypeByAttribution(workStepIds, DocAttributionTypeEnum.WORKSITE.getCode(),treeInfoRequest.getDeviceManagementName(),treeInfoRequest.getDeviceManagementCode()); if (deviceTypeList != null && !deviceTypeList.isEmpty()) { List<String> deviceManagementIds=deviceTypeList.stream().map(DeviceType::getDeviceManagementId).collect(Collectors.toList()); List<String> deviceTypeIds=deviceTypeList.stream().map(DeviceType::getId).collect(Collectors.toList()); DocInfoQueryRequest docQuery = new DocInfoQueryRequest(); BeanUtil.copyProperties(treeInfoRequest,docQuery); docQuery.setAttributionIds(String.join(",",deviceManagementIds)); docQuery.setAttributionIds(String.join(",",deviceTypeIds)); docQuery.setDocClassCode("NC"); docQuery.setAttributionType(DocAttributionTypeEnum.WORKSITE.getCode()); docInfos=docInfoService.findListByDocQuery(docQuery); lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/constant/DispatchFileEnum.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,36 @@ package org.jeecg.modules.dncFlow.constant; public enum DispatchFileEnum { COMPLETE("1", "ç¼å¶"), VERIFY("2", "æ ¡å¯¹"), APPROVE("3", "æ¹å"); private String code; private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } DispatchFileEnum() { } DispatchFileEnum(String code, String name) { this.code = code; this.name = name; } } lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/constant/GuideCardBatchEnum.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,41 @@ package org.jeecg.modules.dncFlow.constant; public enum GuideCardBatchEnum { PREPARE("1", "ç¼å¶"), VERIFY("2", "æ ¡å¯¹"), CONFIRM("3", "æä½ç¡®è®¤"), APPROVE("4", "审æ¹"), COMPLETE("5", "宿"); private String code; private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } GuideCardBatchEnum() { } GuideCardBatchEnum(String code, String name) { this.code = code; this.name = name; } } lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/vo/GuideCardBatchFlowTaskVo.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,38 @@ package org.jeecg.modules.dncFlow.vo; import io.swagger.annotations.ApiModel; import lombok.Data; import org.jeecg.modules.flowable.domain.vo.FlowTaskVo; @Data @ApiModel("ç¨åºå å·¥ç¡®è®¤è¡¨å·¥ä½æµä»»å¡ç¸å ³--请æ±åæ°") public class GuideCardBatchFlowTaskVo extends FlowTaskVo { /** * taskIds */ private String taskIds; /** * æ ¡å¯¹ç±»å * true:æ ¡å¯¹éè¿ * false:æ ¡å¯¹ä¸éè¿ */ private Boolean checkType; /** * 确认类å * true:确认éè¿ * false:确认ä¸éè¿ */ private Boolean confirmType; /** * 审æ¹ç±»å * true:审æ¹éè¿ * false:审æ¹ä¸éè¿ */ private Boolean approveType; /**馿£æè§*/ private String inspectionOpinion; }