From 2e8b29b00f3537703bb22bd9e202bfd98600842c Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Fri, 24 Apr 2020 17:45:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=AF=8F=E6=9C=88=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E6=A0=A1=E9=AA=8C=EF=BC=8C=E5=A4=84=E7=90=86=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../enterprise/EnterpriseAppController.java | 5 +- .../service/check/ICheckService.java | 10 ++++ .../service/check/impl/CheckServiceImpl.java | 47 ++++++++++++++++++- .../enterprise/IEnterpriseService.java | 11 +++++ .../impl/EnterpriseServiceImpl.java | 18 +++++++ .../mybatis/mapper/check/check-mapper.xml | 4 ++ .../mapper/checkitem/checkitem-mapper.xml | 2 +- .../route/check/list-check-history-mine.html | 27 +++++++++++ .../static/route/check/list-check.html | 8 ++++ .../static/route/check/save-check.html | 12 ++++- .../static/route/check/save-recheck-mine.html | 12 ++++- .../route/check/save-taskcheck-mine.html | 12 ++++- .../route/checkitem/list-checkitem.html | 1 + .../checkitemoption/save-checkitemoption.html | 2 +- .../update-checkitemoption.html | 2 +- 15 files changed, 161 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/cm/inspection/controller/app/apis/enterprise/EnterpriseAppController.java b/src/main/java/com/cm/inspection/controller/app/apis/enterprise/EnterpriseAppController.java index dd93746..78255d3 100644 --- a/src/main/java/com/cm/inspection/controller/app/apis/enterprise/EnterpriseAppController.java +++ b/src/main/java/com/cm/inspection/controller/app/apis/enterprise/EnterpriseAppController.java @@ -8,6 +8,7 @@ import com.cm.common.exception.SearchException; import com.cm.common.pojo.ListPage; import com.cm.common.result.ErrorResult; import com.cm.common.result.SuccessResult; +import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO; import com.cm.inspection.pojo.vos.enterprise.EnterpriseVO; @@ -42,8 +43,8 @@ public class EnterpriseAppController extends AbstractController { @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @PostMapping("saveenterprise") @CheckRequestBodyAnnotation - public SuccessResult saveEnterprise(@RequestHeader("token") String token, @RequestBody EnterpriseVO enterpriseVO) throws Exception { - return enterpriseService.saveEnterpriseByToken(token, enterpriseVO); + public SuccessResultData saveEnterprise(@RequestHeader("token") String token, @RequestBody EnterpriseVO enterpriseVO) throws Exception { + return enterpriseService.saveEnterpriseByTokenReturnId(token, enterpriseVO); } @ApiOperation(value = "删除企业(id列表)", notes = "删除企业(id列表)接口") 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 8d75e1c..aa0bbdc 100644 --- a/src/main/java/com/cm/inspection/service/check/ICheckService.java +++ b/src/main/java/com/cm/inspection/service/check/ICheckService.java @@ -44,6 +44,16 @@ public interface ICheckService { */ SuccessResult saveCheckByToken(String token, CheckVO checkVO) throws Exception; + /** + * 新增检查表(APP) + * + * @param token + * @param checkVO + * @return + * @throws Exception + */ + SuccessResultData saveCheckByTokenReturnId(String token, CheckVO checkVO) throws Exception; + /** * 新增复查表 * 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 770c068..e696fbc 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 @@ -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.common.token.app.AppTokenManager; +import com.cm.common.token.app.entity.AppToken; import com.cm.common.utils.DateUtil; import com.cm.common.utils.HashMapUtil; import com.cm.common.utils.UUIDUtil; @@ -89,6 +90,11 @@ public class CheckServiceImpl extends BaseService implements ICheckService { return new SuccessResult(); } + @Override + public SuccessResultData saveCheckByTokenReturnId(String token, CheckVO checkVO) throws Exception { + return new SuccessResultData<>(saveCheckInfoReturnId(token, checkVO)); + } + @Override public SuccessResult saveReCheck(String checkId, CheckVO checkVO) throws Exception { saveReCheckInfo(null, checkId, checkVO); @@ -140,9 +146,24 @@ public class CheckServiceImpl extends BaseService implements ICheckService { * @throws Exception */ private void saveCheckInfo(String token, CheckVO checkVO) throws Exception { + saveCheckInfoReturnId(token, checkVO); + } + + /** + * 新增检查表 + * + * @param token + * @param checkVO + * @return 新增ID + * @throws Exception + */ + private String saveCheckInfoReturnId(String token, CheckVO checkVO) throws Exception { + if (isEnterpriseCheckedForCurrentMonth(token, checkVO.getEnterpriseId())) { + throw new SaveException("本月已经检查过该企业,无需重复检查"); + } + String checkId = UUIDUtil.getUUID(); checkVO.setIsComplete(0); Integer isCoordination = checkVO.getIsCoordination(); - String checkId = UUIDUtil.getUUID(); Map params = HashMapUtil.beanToMap(checkVO); saveCheckWithId(checkId, token, params); LOG.debug("开启流程"); @@ -158,6 +179,30 @@ public class CheckServiceImpl extends BaseService implements ICheckService { taskCheckVO.setIsHandled(1); taskCheckService.updateTaskCheckByToken(token, checkVO.getTaskCheckId(), taskCheckVO); } + return checkId; + } + + /** + * 当月企业是否检查 + * + * @param enterpriseId + * @return + */ + private boolean isEnterpriseCheckedForCurrentMonth(String token, String enterpriseId) { + Map params = getHashMap(2); + params.put("enterpriseId", enterpriseId); + params.put("checkMonth", DateTime.now().toString(DateTimeFormat.forPattern("yyyy-MM"))); + params.put("checkType", 1); + if (StringUtils.isBlank(token)) { + params.put("creator", securityComponent.getCurrentUser().getUserId()); + } else { + params.put("creator", AppTokenManager.getInstance().getToken(token).getAppTokenUser().getId()); + } + Integer countCheck = checkDao.countCheck(params); + if (countCheck > 0) { + return true; + } + return false; } /** diff --git a/src/main/java/com/cm/inspection/service/enterprise/IEnterpriseService.java b/src/main/java/com/cm/inspection/service/enterprise/IEnterpriseService.java index 72e647b..41da7a1 100644 --- a/src/main/java/com/cm/inspection/service/enterprise/IEnterpriseService.java +++ b/src/main/java/com/cm/inspection/service/enterprise/IEnterpriseService.java @@ -42,6 +42,16 @@ public interface IEnterpriseService { */ SuccessResult saveEnterpriseByToken(String token, EnterpriseVO enterpriseVO) throws Exception; + /** + * 新增企业(APP) + * + * @param token + * @param enterpriseVO + * @return 返回ID + * @throws SearchException + */ + SuccessResultData saveEnterpriseByTokenReturnId(String token, EnterpriseVO enterpriseVO) throws Exception; + /** * 删除企业 * @@ -155,4 +165,5 @@ public interface IEnterpriseService { * @throws SearchException */ SuccessResultData> countEnterpriseByNature(Map params) throws SearchException; + } diff --git a/src/main/java/com/cm/inspection/service/enterprise/impl/EnterpriseServiceImpl.java b/src/main/java/com/cm/inspection/service/enterprise/impl/EnterpriseServiceImpl.java index 2d2d481..d2d73dc 100644 --- a/src/main/java/com/cm/inspection/service/enterprise/impl/EnterpriseServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/enterprise/impl/EnterpriseServiceImpl.java @@ -57,6 +57,11 @@ public class EnterpriseServiceImpl extends BaseService implements IEnterpriseSer return new SuccessResult(); } + @Override + public SuccessResultData saveEnterpriseByTokenReturnId(String token, EnterpriseVO enterpriseVO) throws Exception { + return new SuccessResultData<>(saveEnterpriseInfoReturnId(token, enterpriseVO)); + } + /** * 新增企业 * @@ -65,6 +70,18 @@ public class EnterpriseServiceImpl extends BaseService implements IEnterpriseSer * @throws Exception */ private void saveEnterpriseInfo(String token, EnterpriseVO enterpriseVO) throws Exception { + saveEnterpriseInfoReturnId(token, enterpriseVO); + } + + /** + * 新增企业 + * + * @param token + * @param enterpriseVO + * @return 返回ID + * @throws Exception + */ + private String saveEnterpriseInfoReturnId(String token, EnterpriseVO enterpriseVO) throws Exception { String enterpriseId = UUIDUtil.getUUID(); Map params = HashMapUtil.beanToMap(enterpriseVO); params.put("enterpriseId", enterpriseId); @@ -80,6 +97,7 @@ public class EnterpriseServiceImpl extends BaseService implements IEnterpriseSer enterpriseOfGridOperatorVO.setEnterpriseId(enterpriseId); enterpriseOfGridOperatorVO.setUserId(params.get("creator").toString()); enterpriseOfGridOperatorService.saveEnterpriseOfGridOperatorByToken(token, enterpriseOfGridOperatorVO); + return enterpriseId; } @Override diff --git a/src/main/resources/mybatis/mapper/check/check-mapper.xml b/src/main/resources/mybatis/mapper/check/check-mapper.xml index d01266b..9635d45 100644 --- a/src/main/resources/mybatis/mapper/check/check-mapper.xml +++ b/src/main/resources/mybatis/mapper/check/check-mapper.xml @@ -306,6 +306,10 @@ gen_check WHERE is_delete = 0 + + AND + enterprise_id = #{enterpriseId} + AND creator = #{creator} diff --git a/src/main/resources/mybatis/mapper/checkitem/checkitem-mapper.xml b/src/main/resources/mybatis/mapper/checkitem/checkitem-mapper.xml index ff6229e..64a5c90 100644 --- a/src/main/resources/mybatis/mapper/checkitem/checkitem-mapper.xml +++ b/src/main/resources/mybatis/mapper/checkitem/checkitem-mapper.xml @@ -41,7 +41,7 @@ #{name}, #{summary}, #{icon}, - #{iconPress} + #{iconPress}, #{creator}, #{gmtCreate}, #{modifier}, diff --git a/src/main/resources/static/route/check/list-check-history-mine.html b/src/main/resources/static/route/check/list-check-history-mine.html index 026c3c6..7ef2f93 100644 --- a/src/main/resources/static/route/check/list-check-history-mine.html +++ b/src/main/resources/static/route/check/list-check-history-mine.html @@ -39,6 +39,27 @@ {{# } }} +
+ +
+
+ +
+
+ +
@@ -228,6 +249,9 @@ }, {field: 'updateCheckMine', width: 110, title: '检查结果', fixed:'right', align:'center', templet: function(row) { + if(row.isCoordination != 1) { + return '不配合'; + } return ''; } }, @@ -251,6 +275,9 @@ keywords: $('#keywords').val(), type: $('#type').val(), industry: $('#industry').val(), + checkType: $('#checkType').val(), + isCoordination: $('#isCoordination').val(), + isComplete: $('#isComplete').val() }, page: { curr: currentPage diff --git a/src/main/resources/static/route/check/list-check.html b/src/main/resources/static/route/check/list-check.html index 50fda44..d0a932c 100644 --- a/src/main/resources/static/route/check/list-check.html +++ b/src/main/resources/static/route/check/list-check.html @@ -38,6 +38,13 @@ {{# } }} +
+ +
+
-
+