From a859a7a3646b1d934f9a8cf672f203eb71a72c15 Mon Sep 17 00:00:00 2001 From: wangchao Date: Mon, 23 Nov 2020 13:19:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?mybatis=20sql=E8=BF=87=E6=BB=A4=E5=99=A8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/FieldMetaObjectHandler.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java index a5ea6a1a37..8dbb4881f5 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java @@ -25,7 +25,9 @@ import org.apache.ibatis.reflection.MetaObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import javax.swing.text.html.Option; import java.util.Date; +import java.util.Optional; /** * 公共字段,自动填充值 @@ -80,15 +82,16 @@ public class FieldMetaObjectHandler implements MetaObjectHandler { } public Object getCreatedByFieldValue(MetaObject metaObject) { - Object value = loginUserUtil.getLoginUserId(); - if (value == null) { + Object value = null; + if (metaObject.hasGetter(FieldConstant.CREATED_BY_HUMP)) { value = metaObject.getValue(FieldConstant.CREATED_BY_HUMP); } if (value == null) { - value = Constant.APP_USER_FLAG; + + value = Optional.ofNullable(loginUserUtil.getLoginUserId()).orElse(Constant.APP_USER_FLAG); } - } + return value; } @@ -115,15 +118,15 @@ public class FieldMetaObjectHandler implements MetaObjectHandler { } public Object getUpdatedByFieldValue(MetaObject metaObject) { - Object value = loginUserUtil.getLoginUserId(); - if (value == null) { + Object value = null; + if (metaObject.hasGetter(FieldConstant.UPDATED_BY_HUMP)) { value = metaObject.getValue(FieldConstant.UPDATED_BY_HUMP); } if (value == null) { - value = Constant.APP_USER_FLAG; + value = Optional.ofNullable(loginUserUtil.getLoginUserId()).orElse(Constant.APP_USER_FLAG); } - } + return value; } From 9e085cc604e17547dc96e2416cbfe60f9137d8fd Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 23 Nov 2020 13:47:59 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feign=E8=B0=83=E7=94=A8=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/IssueServiceImpl.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 64e1268adc..64c1d9361b 100644 --- a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -129,6 +129,9 @@ public class IssueServiceImpl implements IssueService { @Override public VotingTrendResultDTO votingTrend(IssueIdFormDTO issueId) { Result votingTrendResultDTOResult = govIssueFeignClient.votingTrend(issueId); + if (!votingTrendResultDTOResult.success()){ + throw new RenException("查询议题表决折线图失败"); + } return votingTrendResultDTOResult.getData(); } @@ -172,7 +175,11 @@ public class IssueServiceImpl implements IssueService { GridIdFormDTO gridIdFormDTO = new GridIdFormDTO(); gridIdFormDTO.setGridId(gridId.getGridId()); gridIdFormDTO.setUserId(tokenDto.getUserId()); - CheckJoinTeamResultDTO check = resiGroupFeignClient.checkjointeam(gridIdFormDTO).getData(); + Result checkJoinTeam = resiGroupFeignClient.checkjointeam(gridIdFormDTO); + if (!checkJoinTeam.success()){ + throw new RenException("查询校验用户是否加入小组失败"); + } + CheckJoinTeamResultDTO check = checkJoinTeam.getData(); //未加入小组 if (check.getVoteAuthorization()==false){ voteResultDTOResult.setVoteFlag(false); @@ -180,7 +187,11 @@ public class IssueServiceImpl implements IssueService { voteResultDTOResult.setOppositionCount(NumConstant.ZERO); voteResultDTOResult.setSupportCount(NumConstant.ZERO); }else { - voteResultDTOResult = govIssueFeignClient.voteCount(issueId).getData(); + Result voteResult = govIssueFeignClient.voteCount(issueId); + if (!voteResult.success()){ + throw new RenException("查询表决中议题详情——支持、反对数失败"); + } + voteResultDTOResult = voteResult.getData(); voteResultDTOResult.setVoteAuthorization(check.getVoteAuthorization()); } return voteResultDTOResult; From 79e4db6e264046fea17272e8316fb5db8817aa8c Mon Sep 17 00:00:00 2001 From: wangchao Date: Mon, 23 Nov 2020 14:01:15 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BA=8C=E6=AC=A1=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E6=96=B0=E5=A2=9Eapplication=5Fhistory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/IssueServiceImpl.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 6cc96a4dd5..2bc157531b 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -345,6 +345,7 @@ public class IssueServiceImpl extends BaseServiceImpl imp applicationParam.put(ModuleConstants.FIELD_JAVA_TOPIC_ID, param.getTopicId()); List applicationList = applicationService.list(applicationParam); List applyIds = new LinkedList<>(); + boolean ifRepeat = false; //没有历史提交记录 if (CollectionUtils.isEmpty(applicationList)) { //审核开关开启 @@ -358,6 +359,7 @@ public class IssueServiceImpl extends BaseServiceImpl imp } } else { //重新提交 或 工作端审核议题 更新application + if(!isStaffAudition) ifRepeat = true; if (applicationList.size() > NumConstant.ONE) logger.error("com.epmet.service.impl.IssueServiceImpl.topicShiftedToIssueV2,查出多条转移提提交记录,话题Id:{}", param.getTopicId()); @@ -376,19 +378,21 @@ public class IssueServiceImpl extends BaseServiceImpl imp applyIds.add(apply.getId()); }); + + if(!ifRepeat) { //新增history applyIds.forEach(id -> { - IssueApplicationHistoryDTO history = new IssueApplicationHistoryDTO(); - history.setActionType(defaultStatusUnderAuditing); - history.setCreatedTime(param.getCreatedTime()); - history.setCustomerId(param.getCustomerId()); - history.setIssueApplicationId(id); - history.setReason(isStaffAudition ? param.getAudition().getReason() : null); - history.setStaffName(isStaffAudition ? param.getAudition().getStaffName() : null); + IssueApplicationHistoryDTO history = new IssueApplicationHistoryDTO(); + history.setActionType(defaultStatusUnderAuditing); + history.setCreatedTime(param.getCreatedTime()); + history.setCustomerId(param.getCustomerId()); + history.setIssueApplicationId(id); + history.setReason(isStaffAudition ? param.getAudition().getReason() : null); + history.setStaffName(isStaffAudition ? param.getAudition().getStaffName() : null); - historyService.save(history); - if(!ifOpen){ + historyService.save(history); + if (!ifOpen) { IssueApplicationHistoryDTO repeatApplyRecord = new IssueApplicationHistoryDTO(); repeatApplyRecord.setActionType(ModuleConstants.ISSUE_APPLICATION_STATUS_UNDER_AUDITING); repeatApplyRecord.setCreatedTime(param.getCreatedTime()); @@ -399,6 +403,7 @@ public class IssueServiceImpl extends BaseServiceImpl imp } }); + } result.setIssueApplicationId(applyIds.iterator().next());