diff --git a/src/main/java/com/cm/inspection/controller/apis/check/CheckController.java b/src/main/java/com/cm/inspection/controller/apis/check/CheckController.java index bb23115..7d78b12 100644 --- a/src/main/java/com/cm/inspection/controller/apis/check/CheckController.java +++ b/src/main/java/com/cm/inspection/controller/apis/check/CheckController.java @@ -13,14 +13,13 @@ import com.cm.common.result.ErrorResult; import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultList; import com.cm.inspection.pojo.dtos.check.CheckDTO; +import com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO; import com.cm.inspection.pojo.vos.check.CheckVO; import com.cm.inspection.service.check.ICheckService; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import javax.swing.text.ParagraphView; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -51,9 +50,27 @@ public class CheckController extends AbstractController { throw new ParamsException("检查项列表为空"); } } + checkVO.setCheckType(1); return checkService.saveCheck(checkVO); } + @ApiOperation(value = "新增检查表", notes = "新增检查表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "checkId", value = "checkId", paramType = "path") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @PostMapping("saverecheck/{checkId}") + @CheckRequestBodyAnnotation + public SuccessResult saveReCheck(@PathVariable("checkId") String checkId, @RequestBody CheckVO checkVO) throws Exception { + if (checkVO.getIsCoordination() == 1) { + if (checkVO.getHiddenDangerReports().isEmpty()) { + throw new ParamsException("检查项列表为空"); + } + } + checkVO.setCheckType(1); + return checkService.saveReCheck(checkId, checkVO); + } + @ApiOperation(value = "删除检查表(id列表)", notes = "删除检查表(id列表)接口") @ApiImplicitParams({ @ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3") @@ -98,8 +115,6 @@ public class CheckController extends AbstractController { @ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"), @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"), @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"), - @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"), - @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String") }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listpagecheck") @@ -117,19 +132,41 @@ public class CheckController extends AbstractController { } @ApiOperation(value = "我的复查项列表", notes = "我的复查项列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"), + @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"), + @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"), + }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) - @GetMapping("listrecheckofmine") - public List listReCheckOfMine() { + @GetMapping("listpagerecheckofmine") + public SuccessResultList> listPageReCheckOfMine(ListPage page) { Map params = requestParams(); - return checkService.listReCheckOfMine(params); + page.setParams(params); + return checkService.listPageReCheckOfMine(page); } @ApiOperation(value = "我的领导检查列表", notes = "我的领导检查列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"), + @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"), + @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"), + }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) - @GetMapping("listleadercheckofmine") - public List listLeaderCheckOfMine() { + @GetMapping("listpageleadercheckofmine") + public SuccessResultList> listPageLeaderCheckOfMine(ListPage page) { Map params = requestParams(); - return checkService.listLeaderCheckOfMine(params); + page.setParams(params); + return checkService.listPageLeaderCheckOfMine(page); + } + + @ApiOperation(value = "未通过的检查项列表(通过检查ID)", notes = "未通过的检查项列表(通过检查ID)接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "checkId", value = "检查ID", paramType = "path"), + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("listcheckitemunpassbycheckid/{checkId}") + public List listCheckItemUnPassByCheckId(@PathVariable("checkId") String checkId) { + return checkService.listCheckItemUnPassByCheckId(checkId); } } \ No newline at end of file diff --git a/src/main/java/com/cm/inspection/controller/app/apis/check/CheckAppController.java b/src/main/java/com/cm/inspection/controller/app/apis/check/CheckAppController.java index e786e64..40afe3b 100644 --- a/src/main/java/com/cm/inspection/controller/app/apis/check/CheckAppController.java +++ b/src/main/java/com/cm/inspection/controller/app/apis/check/CheckAppController.java @@ -17,8 +17,6 @@ import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import javax.servlet.jsp.tagext.PageData; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -50,9 +48,28 @@ public class CheckAppController extends AbstractController { throw new ParamsException("检查项列表为空"); } } + checkVO.setCheckType(1); return checkService.saveCheckByToken(token, checkVO); } + @ApiOperation(value = "新增复查表", notes = "新增复查表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "token", value = "token", paramType = "header"), + @ApiImplicitParam(name = "checkId", value = "checkId", paramType = "path") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @PostMapping("saverecheck/{checkId}") + @CheckRequestBodyAnnotation + public SuccessResult saveReCheck(@RequestHeader("token") String token, @PathVariable("checkId") String checkId, @RequestBody CheckVO checkVO) throws Exception { + if (checkVO.getIsCoordination() == 1) { + if (checkVO.getHiddenDangerReports().isEmpty()) { + throw new ParamsException("检查项列表为空"); + } + } + checkVO.setCheckType(2); + return checkService.saveReCheckByToken(token, checkId, checkVO); + } + @ApiOperation(value = "删除检查表(id列表)", notes = "删除检查表(id列表)接口") @ApiImplicitParams({ @ApiImplicitParam(name = "token", value = "token", paramType = "header"), @@ -138,9 +155,10 @@ public class CheckAppController extends AbstractController { }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listrecheckofmine") - public List listReCheckOfMine(@RequestHeader("token") String token) { + public SuccessResultList> listReCheckOfMine(@RequestHeader("token") String token, ListPage page) { Map params = requestParams(); - return checkService.listReCheckOfMine(token, params); + page.setParams(params); + return checkService.listPageReCheckOfMine(token, page); } @ApiOperation(value = "我的领导检查列表", notes = "我的领导检查列表接口") @@ -149,9 +167,10 @@ public class CheckAppController extends AbstractController { }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listleadercheckofmine") - public List listLeaderCheckOfMine(@RequestHeader("token") String token) { + public SuccessResultList> listLeaderCheckOfMine(@RequestHeader("token") String token, ListPage page) { Map params = requestParams(); - return checkService.listLeaderCheckOfMine(token, params); + page.setParams(params); + return checkService.listPageLeaderCheckOfMine(token, page); } } \ No newline at end of file diff --git a/src/main/java/com/cm/inspection/dao/hiddendangerreport/IHiddenDangerReportDao.java b/src/main/java/com/cm/inspection/dao/hiddendangerreport/IHiddenDangerReportDao.java index 02a7867..4502496 100644 --- a/src/main/java/com/cm/inspection/dao/hiddendangerreport/IHiddenDangerReportDao.java +++ b/src/main/java/com/cm/inspection/dao/hiddendangerreport/IHiddenDangerReportDao.java @@ -5,6 +5,7 @@ import com.cm.common.exception.SaveException; import com.cm.common.exception.SearchException; import com.cm.common.exception.UpdateException; import com.cm.common.result.SuccessResultList; +import com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO; import com.cm.inspection.pojo.dtos.hiddendangerreport.HiddenDangerReportDTO; import org.springframework.stereotype.Repository; @@ -62,5 +63,13 @@ public interface IHiddenDangerReportDao { * @throws SearchException */ List listHiddenDangerReport(Map params) throws SearchException; - + + /** + * 未通过的检查项列表(通过检查ID) + * + * @param params + * @return + * @throws SearchException + */ + List listCheckItemUnPass(Map params) throws SearchException; } diff --git a/src/main/java/com/cm/inspection/pojo/dtos/industrycheckitem/IndustryCheckItemDTO.java b/src/main/java/com/cm/inspection/pojo/dtos/industrycheckitem/IndustryCheckItemDTO.java index b323f2d..03b0fd4 100644 --- a/src/main/java/com/cm/inspection/pojo/dtos/industrycheckitem/IndustryCheckItemDTO.java +++ b/src/main/java/com/cm/inspection/pojo/dtos/industrycheckitem/IndustryCheckItemDTO.java @@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; /** - * * @ClassName: IndustryCheckItemDTO * @Description: 行业检查项 * @Author: WenG @@ -36,6 +35,7 @@ public class IndustryCheckItemDTO { public void setIndustryCheckItemId(String industryCheckItemId) { this.industryCheckItemId = industryCheckItemId; } + public String getIndustryId() { return industryId == null ? "" : industryId; } @@ -51,6 +51,7 @@ public class IndustryCheckItemDTO { public void setIndustryIdDictionaryName(String industryIdDictionaryName) { this.industryIdDictionaryName = industryIdDictionaryName; } + public String getCheckItemId() { return checkItemId == null ? "" : checkItemId; } diff --git a/src/main/java/com/cm/inspection/pojo/vos/check/CheckVO.java b/src/main/java/com/cm/inspection/pojo/vos/check/CheckVO.java index ec283f0..faae47b 100644 --- a/src/main/java/com/cm/inspection/pojo/vos/check/CheckVO.java +++ b/src/main/java/com/cm/inspection/pojo/vos/check/CheckVO.java @@ -24,13 +24,11 @@ public class CheckVO { @ApiModelProperty(name = "enterpriseId", value = "企业ID") private String enterpriseId; @ApiModelProperty(name = "checkType", value = "检查类型") - @CheckNumberAnnotation(name = "检查类型") private Integer checkType; @ApiModelProperty(name = "isCoordination", value = "是否配合") @CheckNumberAnnotation(name = "是否配合") private Integer isCoordination; @ApiModelProperty(name = "isComplete", value = "是否完成") - @CheckNumberAnnotation(name = "是否完成") private Integer isComplete; @ApiModelProperty(name = "checkItems", value = "检查项") private List hiddenDangerReports; diff --git a/src/main/java/com/cm/inspection/service/check/ICheckService.java b/src/main/java/com/cm/inspection/service/check/ICheckService.java index 31f47ec..e064ff7 100644 --- a/src/main/java/com/cm/inspection/service/check/ICheckService.java +++ b/src/main/java/com/cm/inspection/service/check/ICheckService.java @@ -8,6 +8,7 @@ import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; import com.cm.inspection.pojo.dtos.check.CheckDTO; +import com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO; import com.cm.inspection.pojo.vos.check.CheckVO; import java.util.List; @@ -41,6 +42,25 @@ public interface ICheckService { */ SuccessResult saveCheckByToken(String token, CheckVO checkVO) throws Exception; + /** + * 新增复查表 + * @param checkId + * @param checkVO + * @return + * @throws Exception + */ + SuccessResult saveReCheck(String checkId, CheckVO checkVO) throws Exception; + + /** + * 新增复查表(APP) + * @param token + * @param checkId + * @param checkVO + * @return + * @throws Exception + */ + SuccessResult saveReCheckByToken(String token, String checkId, CheckVO checkVO) throws Exception; + /** * 删除检查表 * @@ -129,40 +149,48 @@ public interface ICheckService { /** * 我的复查项列表 * - * @param params + * @param page * @return * @throws SearchException */ - List listReCheckOfMine(Map params) throws SearchException; + SuccessResultList> listPageReCheckOfMine(ListPage page) throws SearchException; /** * 我的复查项列表 * * @param token - * @param params + * @param page * @return * @throws SearchException */ - List listReCheckOfMine(String token, Map params) throws SearchException; + SuccessResultList> listPageReCheckOfMine(String token, ListPage page) throws SearchException; /** * 我的领导检查列表 * - * @param params + * @param page * @return * @throws SearchException */ - List listLeaderCheckOfMine(Map params) throws SearchException; + SuccessResultList> listPageLeaderCheckOfMine(ListPage page) throws SearchException; /** * 我的领导检查列表 * * @param token - * @param params + * @param page * @return * @throws SearchException */ - List listLeaderCheckOfMine(String token, Map params) throws SearchException; + SuccessResultList> listPageLeaderCheckOfMine(String token, ListPage page) throws SearchException; + /** + * 未通过的检查项列表(通过检查ID) + * + * @param checkId + * @return + * @throws SearchException + */ + List listCheckItemUnPassByCheckId(String checkId) throws SearchException; } diff --git a/src/main/java/com/cm/inspection/service/check/impl/CheckServiceImpl.java b/src/main/java/com/cm/inspection/service/check/impl/CheckServiceImpl.java index f9a423d..81e26f5 100644 --- a/src/main/java/com/cm/inspection/service/check/impl/CheckServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/check/impl/CheckServiceImpl.java @@ -1,6 +1,7 @@ package com.cm.inspection.service.check.impl; import com.cm.common.exception.RemoveException; +import com.cm.common.exception.SaveException; import com.cm.common.exception.SearchException; import com.cm.common.pojo.ListPage; import com.cm.common.result.SuccessResult; @@ -11,6 +12,7 @@ import com.cm.common.utils.UUIDUtil; import com.cm.inspection.dao.check.ICheckDao; import com.cm.inspection.enums.HiddenDangerCheckResultEnum; import com.cm.inspection.pojo.dtos.check.CheckDTO; +import com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO; import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO; import com.cm.inspection.pojo.vos.check.CheckVO; import com.cm.inspection.pojo.vos.hiddendangerreport.HiddenDangerReportVO; @@ -62,6 +64,18 @@ public class CheckServiceImpl extends BaseService implements ICheckService { return new SuccessResult(); } + @Override + public SuccessResult saveReCheck(String checkId, CheckVO checkVO) throws Exception { + saveReCheckInfo(null, checkId, checkVO); + return new SuccessResult(); + } + + @Override + public SuccessResult saveReCheckByToken(String token, String checkId, CheckVO checkVO) throws Exception { + saveReCheckInfo(token, checkId, checkVO); + return new SuccessResult(); + } + /** * 新增检查表 * @@ -79,51 +93,117 @@ public class CheckServiceImpl extends BaseService implements ICheckService { String businessKey = String.format("check:%s", checkId); params.put("reporter", userId); processService.startProcess(IProcessService.CHECK_SELF_PROCESS, businessKey, params); - Task task = processService.getTaskByAssigneeAndBusinessKey(userId, businessKey); - params.clear(); + completeCheck(token, checkVO, checkId, userId, task, isCoordination); + } + + /** + * 新增复查表 + * + * @param token + * @param checkId + * @param checkVO + */ + private void saveReCheckInfo(String token, String checkId, CheckVO checkVO) throws Exception { + Integer isCoordination = checkVO.getIsCoordination(); + String userId = getUserId(token); + Task task = processService.getTaskByAssigneeAndVariableKeyAndValue(userId, "lastCheckId", checkId); + if (task == null) { + throw new SaveException("任务不存在"); + } + String newCheckId = UUIDUtil.getUUID(); + Map params = HashMapUtil.beanToMap(checkVO); + saveCheckWithId(newCheckId, token, params); + LOG.debug("复查流程处理"); + completeCheck(token, checkVO, checkId, userId, task, isCoordination); + } + + /** + * 完成检查(复查)任务 + * + * @param checkVO + * @param checkId + * @param task + * @param userId + * @param isCoordination + * @throws Exception + */ + private void completeCheck(String token, CheckVO checkVO, String checkId, String userId, Task task, int isCoordination) throws Exception { + Map params = getHashMap(2); params.put("isCoordination", isCoordination); if (isCoordination == 1) { - LOG.debug("1.isCoordination: 1, 配合"); - List hiddenDangerReports = checkVO.getHiddenDangerReports(); - int isAllPass = 1; - for (HiddenDangerReportVO hiddenDangerReportVO : hiddenDangerReports) { - hiddenDangerReportVO.setCheckId(checkId); - hiddenDangerReportService.saveHiddenDangerReportInfo(token, hiddenDangerReportVO); - if (HiddenDangerCheckResultEnum.PASS.getValue() != hiddenDangerReportVO.getCheckResult()) { - isAllPass = 0; - } - } - LOG.debug("2.isAllPass: {}", isAllPass); - params.put("isAllPass", isAllPass); - if (isAllPass == 0) { - LOG.debug("3.检查项没有完全通过,需要复查"); - params.put("reReporter", userId); - processService.setTaskVariableByTaskId(task.getId(), "isReport", 1); - LOG.debug("4.标记上一次的检查项"); - processService.setTaskVariableByTaskId(task.getId(), "lastCheckId", checkId); - } else { - LOG.debug("3.全部通过,更新当前检查状态"); - CheckVO updateCheckVO = new CheckVO(); - updateCheckVO.setIsComplete(1); - updateCheck(checkId, updateCheckVO); - } + saveHiddenDangerReport(token, checkVO, checkId, userId, task, params); } else { - LOG.debug("1.isCoordination:2, 不配合"); - // 查询上级领导,如果上级领导为空,指向自己,如果有多个网格员角色取最高level的上级领导 - List gridPersonnelDTOs = gridPersonnelService.listGridPersonnelByUserIdAndIsGridOperator(userId, 1); - if (gridPersonnelDTOs.isEmpty()) { - params.put("leader", userId); - } else { - params.put("leader", gridPersonnelDTOs.get(0).getUserId().split("\\|")[0]); - } - processService.setTaskVariableByTaskId(task.getId(), "isLeader", 1); - LOG.debug("2.标记上一次的检查项"); - processService.setTaskVariableByTaskId(task.getId(), "lastCheckId", checkId); + setLeaderCheck(userId, checkId, task, params); } processService.saveTaskCompleteByTaskId(task.getId(), params); } + /** + * 保存隐患上报详情 + * + * @param checkVO + * @param checkId + * @param task + * @param params + * @throws Exception + */ + private void saveHiddenDangerReport(String token, CheckVO checkVO, String checkId, String userId, Task task, Map params) throws Exception { + LOG.debug("1.isCoordination:1,配合处理"); + List hiddenDangerReports = checkVO.getHiddenDangerReports(); + int isAllPass = 1; + for (HiddenDangerReportVO hiddenDangerReportVO : hiddenDangerReports) { + hiddenDangerReportVO.setCheckId(checkId); + hiddenDangerReportService.saveHiddenDangerReportInfo(token, hiddenDangerReportVO); + if (HiddenDangerCheckResultEnum.PASS.getValue() != hiddenDangerReportVO.getCheckResult()) { + isAllPass = 0; + } + } + LOG.debug("2.isAllPass: {}", isAllPass); + params.put("isAllPass", isAllPass); + if (isAllPass == 0) { + LOG.debug("3.检查项没有完全通过,需要复查"); + params.put("reReporter", userId); + processService.setTaskVariableByTaskId(task.getId(), "isReport", 1); + LOG.debug("4.标记上一次的检查项"); + processService.setTaskVariableByTaskId(task.getId(), "lastCheckId", checkId); + } else { + LOG.debug("3.全部通过,更新当前检查业务状态和流程业务状态"); + CheckVO updateCheckVO = new CheckVO(); + updateCheckVO.setIsComplete(1); + updateCheck(checkId, updateCheckVO); + String businessCheckId = task.getBusinessKey().split(":")[1]; + if (!StringUtils.equals(checkId, businessCheckId)) { + updateCheck(businessCheckId, updateCheckVO); + } + } + } + + /** + * 设置领导审核 + * + * @param userId + * @param checkId + * @param task + * @param params + */ + private void setLeaderCheck(String userId, String checkId, Task task, Map params) { + LOG.debug("1.isCoordination:2, 不配合"); + // 查询上级领导,如果上级领导为空,指向自己,如果有多个网格员角色取最高level的上级领导 + List gridPersonnelDTOs = gridPersonnelService.listGridPersonnelByUserIdAndIsGridOperator(userId, 1); + if (gridPersonnelDTOs.isEmpty()) { + params.put("leader", userId); + } else { + params.put("leader", gridPersonnelDTOs.get(0).getUserId().split("\\|")[0]); + } + processService.setTaskVariableByTaskId(task.getId(), "isLeader", 1); + // 删除之上报相关属性 + processService.removeTaskVariableByTaskId(task.getId(), "isReport"); + processService.removeTaskVariableByTaskId(task.getId(), "reReporter"); + LOG.debug("2.标记上一次的检查项"); + processService.setTaskVariableByTaskId(task.getId(), "lastCheckId", checkId); + } + /** * 保存检查项 * @@ -235,40 +315,45 @@ public class CheckServiceImpl extends BaseService implements ICheckService { } @Override - public List listReCheckOfMine(Map params) throws SearchException { - return listReCheckOfMine(null, params); + public SuccessResultList> listPageReCheckOfMine(ListPage page) throws SearchException { + return listPageReCheckOfMine(null, page); } @Override - public List listLeaderCheckOfMine(Map params) throws SearchException { - return listLeaderCheckOfMine(null, params); + public SuccessResultList> listPageLeaderCheckOfMine(ListPage page) throws SearchException { + return listPageLeaderCheckOfMine(null, page); } @Override - public List listLeaderCheckOfMine(String token, Map params) { + public SuccessResultList> listPageLeaderCheckOfMine(String token, ListPage page) { List checkIds = listLastCheckId(getUserId(token), "isLeader"); if (checkIds.isEmpty()) { - return new ArrayList<>(); + return new SuccessResultList(new ArrayList<>(), 1, 0L); } - params.put("checkIds", checkIds); - return listCheck(params); + page.getParams().put("checkIds", checkIds); + return listPageCheck(page); + } + + @Override + public List listCheckItemUnPassByCheckId(String checkId) throws SearchException { + return hiddenDangerReportService.listCheckItemUnPassByCheckId(checkId); } /** * 我的待复查列表 * * @param token - * @param params + * @param page * @return */ @Override - public List listReCheckOfMine(String token, Map params) { + public SuccessResultList> listPageReCheckOfMine(String token, ListPage page) { List checkIds = listLastCheckId(getUserId(token), "isReport"); if (checkIds.isEmpty()) { - return new ArrayList<>(); + return new SuccessResultList(new ArrayList<>(), 1, 0L); } - params.put("checkIds", checkIds); - return listCheck(params); + page.getParams().put("checkIds", checkIds); + return listPageCheck(page); } /** diff --git a/src/main/java/com/cm/inspection/service/hiddendangerreport/IHiddenDangerReportService.java b/src/main/java/com/cm/inspection/service/hiddendangerreport/IHiddenDangerReportService.java index 60cf76d..0bc51bc 100644 --- a/src/main/java/com/cm/inspection/service/hiddendangerreport/IHiddenDangerReportService.java +++ b/src/main/java/com/cm/inspection/service/hiddendangerreport/IHiddenDangerReportService.java @@ -7,6 +7,7 @@ import com.cm.common.pojo.ListPage; import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; +import com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO; import com.cm.inspection.pojo.dtos.hiddendangerreport.HiddenDangerReportDTO; import com.cm.inspection.pojo.vos.hiddendangerreport.HiddenDangerReportVO; @@ -117,4 +118,12 @@ public interface IHiddenDangerReportService { */ SuccessResultList> listPageHiddenDangerReport(ListPage page) throws SearchException; + /** + * 未通过的检查项列表(通过检查ID) + * + * @param checkId + * @return + * @throws SearchException + */ + List listCheckItemUnPassByCheckId(String checkId) throws SearchException; } diff --git a/src/main/java/com/cm/inspection/service/hiddendangerreport/impl/HiddenDangerReportServiceImpl.java b/src/main/java/com/cm/inspection/service/hiddendangerreport/impl/HiddenDangerReportServiceImpl.java index 4cddf1a..2ec5ef9 100644 --- a/src/main/java/com/cm/inspection/service/hiddendangerreport/impl/HiddenDangerReportServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/hiddendangerreport/impl/HiddenDangerReportServiceImpl.java @@ -9,6 +9,7 @@ import com.cm.common.result.SuccessResultList; import com.cm.common.utils.HashMapUtil; import com.cm.common.utils.UUIDUtil; import com.cm.inspection.dao.hiddendangerreport.IHiddenDangerReportDao; +import com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO; import com.cm.inspection.pojo.dtos.hiddendangerreport.HiddenDangerReportDTO; import com.cm.inspection.pojo.vos.hiddendangerreport.HiddenDangerReportVO; import com.cm.inspection.service.BaseService; @@ -143,4 +144,11 @@ public class HiddenDangerReportServiceImpl extends BaseService implements IHidde return new SuccessResultList<>(hiddenDangerReportDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); } + @Override + public List listCheckItemUnPassByCheckId(String checkId) throws SearchException { + Map params = getHashMap(1); + params.put("checkId", checkId); + return hiddenDangerReportDao.listCheckItemUnPass(params); + } + } diff --git a/src/main/java/com/cm/inspection/service/process/IProcessService.java b/src/main/java/com/cm/inspection/service/process/IProcessService.java index b02f642..e359f74 100644 --- a/src/main/java/com/cm/inspection/service/process/IProcessService.java +++ b/src/main/java/com/cm/inspection/service/process/IProcessService.java @@ -51,6 +51,15 @@ public interface IProcessService { */ List listTaskByAssignee(String assignee); + /** + * 任务列表(通过执行人和变量Key) + * + * @param assignee + * @param key + * @return + */ + List listTaskByAssigneeAndVariablesKey(String assignee, String key); + /** * 获取任务(通过业务主键) * @@ -95,6 +104,16 @@ public interface IProcessService { */ Task getTaskByAssigneeAndProcessId(String assignee, String processId); + /** + * 获取任务(通过执行人和变量名) + * + * @param assignee + * @param key + * @param value + * @return + */ + Task getTaskByAssigneeAndVariableKeyAndValue(String assignee, String key, Object value); + /** * 设置任务变量 * @@ -121,14 +140,31 @@ public interface IProcessService { Map getTaskVariablesByTaskId(String taskId); /** - * 获取任务变量 + * 获取任务变量(通过键、值) * * @param taskId * @param key + * @param value * @return */ Object getTaskVariableByTaskId(String taskId, String key); + /** + * 删除任务变量 + * + * @param taskId + * @param keys + */ + void removeTaskVariablesByTaskId(String taskId, List keys); + + /** + * 删除任务变量 + * + * @param taskId + * @param key + */ + void removeTaskVariableByTaskId(String taskId, String key); + /** * 完成案件(通过taskId) * diff --git a/src/main/java/com/cm/inspection/service/process/impl/ProcessServiceImpl.java b/src/main/java/com/cm/inspection/service/process/impl/ProcessServiceImpl.java index 651ffdb..5a0f930 100644 --- a/src/main/java/com/cm/inspection/service/process/impl/ProcessServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/process/impl/ProcessServiceImpl.java @@ -7,6 +7,7 @@ import org.activiti.engine.history.HistoricTaskInstance; import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.task.Task; import org.activiti.engine.task.TaskQuery; +import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -57,6 +58,20 @@ public class ProcessServiceImpl implements IProcessService { return taskList == null ? new ArrayList<>(0) : taskList; } + @Override + public List listTaskByAssigneeAndVariablesKey(String assignee, String key) { + List taskList = listTaskByAssignee(assignee); + for (int i = 0; i < taskList.size(); i++) { + Task task = taskList.get(i); + Object value = taskService.getVariable(task.getId(), key); + if (value == null) { + taskList.remove(i); + i--; + } + } + return taskList; + } + @Override public Task getTaskByBusinessKey(List listTask, String businessKey) { if (listTask == null) { @@ -101,6 +116,18 @@ public class ProcessServiceImpl implements IProcessService { return getTaskByProcessId(taskList, processId); } + @Override + public Task getTaskByAssigneeAndVariableKeyAndValue(String assignee, String key, Object value) { + List taskList = listTaskByAssignee(assignee); + for (Task task : taskList) { + Object valueObj = taskService.getVariable(task.getId(), key); + if (!ObjectUtils.notEqual(value, valueObj)) { + return task; + } + } + return null; + } + @Override public void setTaskVariablesByTaskId(String taskId, Map variables) { taskService.setVariables(taskId, variables); @@ -121,6 +148,16 @@ public class ProcessServiceImpl implements IProcessService { return taskService.getVariable(taskId, key); } + @Override + public void removeTaskVariablesByTaskId(String taskId, List keys) { + taskService.removeVariables(taskId, keys); + } + + @Override + public void removeTaskVariableByTaskId(String taskId, String key) { + taskService.removeVariable(taskId, key); + } + @Override public void saveTaskCompleteByTaskId(String taskId, Map params) { taskService.complete(taskId, params); diff --git a/src/main/resources/mybatis/mapper/check/check-mapper.xml b/src/main/resources/mybatis/mapper/check/check-mapper.xml index 3c1c464..572eab4 100644 --- a/src/main/resources/mybatis/mapper/check/check-mapper.xml +++ b/src/main/resources/mybatis/mapper/check/check-mapper.xml @@ -95,12 +95,19 @@ \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/enterprise/enterprise-mapper.xml b/src/main/resources/mybatis/mapper/enterprise/enterprise-mapper.xml index ffc43f2..0a9b6bf 100644 --- a/src/main/resources/mybatis/mapper/enterprise/enterprise-mapper.xml +++ b/src/main/resources/mybatis/mapper/enterprise/enterprise-mapper.xml @@ -154,15 +154,23 @@ SELECT t1.name, t1.type, + dt1.dictionary_name type_dictionary_name, t1.area1, + dt4.dictionary_name area1_dictionary_name, t1.area2, + dt5.dictionary_name area2_dictionary_name, t1.area3, + dt6.dictionary_name area3_dictionary_name, t1.area4, + dt7.dictionary_name area4_dictionary_name, t1.area5, + dt8.dictionary_name area5_dictionary_name, t1.address, t1.industry, + dt2.dictionary_name industry_dictionary_name, t1.engaged_count, t1.risk_operation, + dt3.dictionary_name risk_operation_dictionary_name, t1.master, t1.phone, t1.factory_gate, @@ -170,6 +178,54 @@ t1.enterprise_id FROM gen_enterprise t1 + LEFT JOIN + data_dictionary dt1 + ON + dt1.dictionary_id = t1.type + AND + dt1.is_delete = 0 + LEFT JOIN + data_dictionary dt2 + ON + dt2.dictionary_id = t1.industry + AND + dt2.is_delete = 0 + LEFT JOIN + data_dictionary dt3 + ON + dt3.dictionary_id = t1.risk_operation + AND + dt3.is_delete = 0 + LEFT JOIN + data_dictionary dt4 + ON + dt4.dictionary_id = t1.area1 + AND + dt4.is_delete = 0 + LEFT JOIN + data_dictionary dt5 + ON + dt5.dictionary_id = t1.area2 + AND + dt5.is_delete = 0 + LEFT JOIN + data_dictionary dt6 + ON + dt6.dictionary_id = t1.area3 + AND + dt6.is_delete = 0 + LEFT JOIN + data_dictionary dt7 + ON + dt7.dictionary_id = t1.area4 + AND + dt7.is_delete = 0 + LEFT JOIN + data_dictionary dt8 + ON + dt8.dictionary_id = t1.area5 + AND + dt8.is_delete = 0 WHERE t1.is_delete = 0 diff --git a/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml b/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml index 893d7de..5f18fda 100644 --- a/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml +++ b/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml @@ -124,6 +124,11 @@ jt1.industry industry_join_by_enterprise_id, jt1.engaged_count engaged_count_join_by_enterprise_id, jt1.risk_operation risk_operation_join_by_enterprise_id, + dt1.dictionary_name area1_dictionary_name, + dt2.dictionary_name area2_dictionary_name, + dt3.dictionary_name area3_dictionary_name, + dt4.dictionary_name area4_dictionary_name, + dt5.dictionary_name area5_dictionary_name, t1.enterprise_of_grid_operator_id FROM gen_enterprise_of_grid_operator t1 @@ -133,6 +138,36 @@ t1.enterprise_id = jt1.enterprise_id AND jt1.is_delete = 0 + LEFT JOIN + data_dictionary dt1 + ON + dt1.dictionary_id = jt1.area1 + AND + dt1.is_delete = 0 + LEFT JOIN + data_dictionary dt2 + ON + dt2.dictionary_id = jt1.area2 + AND + dt2.is_delete = 0 + LEFT JOIN + data_dictionary dt3 + ON + dt3.dictionary_id = jt1.area3 + AND + dt3.is_delete = 0 + LEFT JOIN + data_dictionary dt4 + ON + dt4.dictionary_id = jt1.area4 + AND + dt4.is_delete = 0 + LEFT JOIN + data_dictionary dt5 + ON + dt5.dictionary_id = jt1.area5 + AND + dt5.is_delete = 0 WHERE t1.is_delete = 0 @@ -158,6 +193,10 @@ AND t1.user_id = #{userId} + + AND + jt1.type = #{type} + AND jt1.area1 = #{area1} @@ -292,6 +331,10 @@ AND t1.name LIKE CONCAT('%', #{keywords}, '%') + + AND + t1.type = #{type} + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/hiddendangerreport/hiddendangerreport-mapper.xml b/src/main/resources/mybatis/mapper/hiddendangerreport/hiddendangerreport-mapper.xml index c524ca2..f5ec1ec 100644 --- a/src/main/resources/mybatis/mapper/hiddendangerreport/hiddendangerreport-mapper.xml +++ b/src/main/resources/mybatis/mapper/hiddendangerreport/hiddendangerreport-mapper.xml @@ -17,6 +17,13 @@ + + + + + + + INSERT INTO gen_hidden_danger_report( @@ -166,18 +173,31 @@ #{hiddenDangerReportIds[${index}]} - GROUP BY - t1.check_id, - t1.check_item_id, + + + + \ No newline at end of file diff --git a/src/main/resources/static/route/check/list-check-admin.html b/src/main/resources/static/route/check/list-check-admin.html index 85b9ee9..1efd3eb 100644 --- a/src/main/resources/static/route/check/list-check-admin.html +++ b/src/main/resources/static/route/check/list-check-admin.html @@ -45,7 +45,6 @@ - - - + +
+
+ +
+
+ + + + + + + + \ No newline at end of file