From 09f6961f036b98aa79cd75dbdef0e0207e7768a6 Mon Sep 17 00:00:00 2001 From: WenG <450292408@qq.com> Date: Fri, 9 Oct 2020 09:17:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cm/inspection/InspectionApplication.java | 32 ++++++++++++++++++- .../apis/check/CheckController.java | 8 ++--- .../inspection/pojo/dtos/check/CheckDTO.java | 10 ++++++ .../mybatis/mapper/check/check-mapper.xml | 9 ++++++ 4 files changed, 54 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/cm/inspection/InspectionApplication.java b/src/main/java/com/cm/inspection/InspectionApplication.java index 1845741..6256009 100644 --- a/src/main/java/com/cm/inspection/InspectionApplication.java +++ b/src/main/java/com/cm/inspection/InspectionApplication.java @@ -1,7 +1,13 @@ package com.cm.inspection; +import com.cm.common.constants.ISystemConstant; +import com.cm.common.plugin.oauth.service.user.IUserService; +import com.cm.inspection.pojo.dtos.check.CheckDTO; +import com.cm.inspection.service.check.ICheckService; import org.activiti.engine.*; import org.activiti.engine.runtime.ProcessInstance; +import org.joda.time.DateTime; +import org.joda.time.format.DateTimeFormat; import org.mybatis.spring.annotation.MapperScan; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; @@ -9,6 +15,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; import springfox.documentation.swagger2.annotations.EnableSwagger2; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * 隐患排查系统 * @@ -20,8 +30,28 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @MapperScan({"com.cm.**.dao"}) public class InspectionApplication { + @Autowired + private ICheckService checkService; + @Autowired + private IUserService userService; + public static void main(String[] args) { - SpringApplication.run(InspectionApplication.class, args); + SpringApplication.run(InspectionApplication.class, args); + } + + /** + * 钉钉超时消息 + */ + public void sendDingDingTimeoutMessage() { + DateTime currentDateTime = DateTime.now(); + String currentDate = currentDateTime.toString(DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD)); + // 获取截止到当前时间,没有完成的案件 + Map params = new HashMap<>(16); + params.put("currentDate", currentDate); + params.put("isComplete", 0); + List checkDTOs = checkService.listCheckSimple(params); + // 找出超时的未完成案件 + } } 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 635a07d..b75acd9 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 @@ -47,7 +47,7 @@ public class CheckController extends AbstractController { @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @PostMapping("savecheck") @CheckRequestBodyAnnotation - public SuccessResult saveCheck(@RequestBody CheckVO checkVO) throws Exception { + public synchronized SuccessResult saveCheck(@RequestBody CheckVO checkVO) throws Exception { if (checkVO.getIsCoordination() == 1) { if (checkVO.getHiddenDangerReports().isEmpty()) { throw new ParamsException("检查项列表为空"); @@ -64,7 +64,7 @@ public class CheckController extends AbstractController { @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @PostMapping("saverecheck/{checkId}") @CheckRequestBodyAnnotation - public SuccessResult saveReCheck(@PathVariable("checkId") String checkId, @RequestBody CheckVO checkVO) throws Exception { + public synchronized SuccessResult saveReCheck(@PathVariable("checkId") String checkId, @RequestBody CheckVO checkVO) throws Exception { if (checkVO.getIsCoordination() == 1) { if (checkVO.getHiddenDangerReports().isEmpty()) { throw new ParamsException("检查项列表为空"); @@ -81,7 +81,7 @@ public class CheckController extends AbstractController { @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @PostMapping("saveinspect/{checkId}") @CheckRequestBodyAnnotation - public SuccessResult saveInspect(@PathVariable("checkId") String checkId, @RequestBody InspectVO inspectVO) throws Exception { + public synchronized SuccessResult saveInspect(@PathVariable("checkId") String checkId, @RequestBody InspectVO inspectVO) throws Exception { return checkService.saveInspect(checkId, inspectVO); } @@ -102,7 +102,7 @@ public class CheckController extends AbstractController { @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @PutMapping("updatecheck/{checkId}") @CheckRequestBodyAnnotation - public SuccessResult updateCheck(@PathVariable("checkId") String checkId, @RequestBody CheckVO checkVO) throws Exception { + public synchronized SuccessResult updateCheck(@PathVariable("checkId") String checkId, @RequestBody CheckVO checkVO) throws Exception { return checkService.updateCheck(checkId, checkVO); } diff --git a/src/main/java/com/cm/inspection/pojo/dtos/check/CheckDTO.java b/src/main/java/com/cm/inspection/pojo/dtos/check/CheckDTO.java index e3b6a69..2b43451 100644 --- a/src/main/java/com/cm/inspection/pojo/dtos/check/CheckDTO.java +++ b/src/main/java/com/cm/inspection/pojo/dtos/check/CheckDTO.java @@ -87,6 +87,8 @@ public class CheckDTO implements Serializable { private String checkLat; @ApiModelProperty(name = "gmtCreate", value = "时间") private String gmtCreate; + @ApiModelProperty(name = "creator", value = "创建人") + private String creator; @ApiModelProperty(name = "checkItems", value = "检查列表") private List checkItems; @@ -355,6 +357,14 @@ public class CheckDTO implements Serializable { this.gmtCreate = gmtCreate; } + public String getCreator() { + return creator == null ? "" : creator.trim(); + } + + public void setCreator(String creator) { + this.creator = creator; + } + public List getCheckItems() { if (checkItems == null) { return new ArrayList<>(); diff --git a/src/main/resources/mybatis/mapper/check/check-mapper.xml b/src/main/resources/mybatis/mapper/check/check-mapper.xml index d4f25c1..fe2d445 100644 --- a/src/main/resources/mybatis/mapper/check/check-mapper.xml +++ b/src/main/resources/mybatis/mapper/check/check-mapper.xml @@ -37,6 +37,7 @@ + @@ -445,6 +446,14 @@ #{checkIdList[${index}]} + + AND + LEFT(gmt_create, 10) #{currentDate} + + + AND + is_complete = #{isComplete} + AND creator IN