From bd7685fb998985e9364a9536355d4c7a62912c0d Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Tue, 10 Nov 2020 10:11:24 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=BE=BD=E7=AB=A0=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/BadgeAuditFormDTO.java | 3 + .../java/com/epmet/dto/form/BadgeFormDTO.java | 5 ++ .../com/epmet/dto/form/EditBadgeFormDTO.java | 1 + .../com/epmet/controller/BadgeController.java | 5 ++ .../epmet/service/impl/BadgeServiceImpl.java | 71 ++++++++++++++----- 5 files changed, 68 insertions(+), 17 deletions(-) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeAuditFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeAuditFormDTO.java index f7d3deac7d..c3748fe49f 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeAuditFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeAuditFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.form; import lombok.Data; import lombok.NoArgsConstructor; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -14,7 +15,9 @@ import java.io.Serializable; @Data public class BadgeAuditFormDTO implements Serializable { private static final long serialVersionUID = 2209535364555130964L; + @NotBlank(message = "申请记录Id不能为空") private String recordId; + @NotBlank(message = "审核结果不能为空") private String auditStatus; private String auditRemark; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeFormDTO.java index 5a40b86f0f..66384607cf 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeFormDTO.java @@ -2,6 +2,7 @@ package com.epmet.dto.form; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -12,6 +13,9 @@ import java.io.Serializable; @Data public class BadgeFormDTO implements Serializable { private static final long serialVersionUID = 9156247659994638103L; + public interface ManageGroup {} + public interface AuditGroup {} + @NotBlank(message = "徽章id不能为空", groups = {ManageGroup.class}) private String badgeId; /** * 页码 @@ -24,5 +28,6 @@ public class BadgeFormDTO implements Serializable { /** * 网格Id */ + @NotBlank(message = "网格id不能为空", groups = {AuditGroup.class}) private String gridId; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditBadgeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditBadgeFormDTO.java index e11d2e107c..7b8cc1fb4a 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditBadgeFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditBadgeFormDTO.java @@ -16,6 +16,7 @@ import java.util.List; @Data public class EditBadgeFormDTO implements Serializable { private static final long serialVersionUID = 1578890423002035200L; + @NotBlank(message = "徽章ID不能为空") private String badgeId; /** * 徽章名称 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java index c284939571..cabe4b0a98 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java @@ -68,6 +68,7 @@ public class BadgeController { */ @PostMapping("detail") public Result detail(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, BadgeFormDTO.ManageGroup.class); BadgeDetailResultDTO result = badgeService.detail(tokenDto, formDTO); return new Result().ok(result); } @@ -97,6 +98,7 @@ public class BadgeController { */ @PostMapping("delete") public Result delete(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, BadgeFormDTO.ManageGroup.class); badgeService.deleteBadge(tokenDto, formDTO); return new Result(); } @@ -116,6 +118,7 @@ public class BadgeController { */ @PostMapping("auditinglist") public Result> auditingList(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, BadgeFormDTO.AuditGroup.class); List result = badgeService.auditingList(tokenDto, formDTO); return new Result>().ok(result); } @@ -130,6 +133,7 @@ public class BadgeController { */ @PostMapping("auditrecord") public Result> auditRecord(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, BadgeFormDTO.AuditGroup.class); List result = badgeService.auditRecord(tokenDto, formDTO); return new Result>().ok(result); } @@ -144,6 +148,7 @@ public class BadgeController { */ @PostMapping("audit") public Result audit(@LoginUser TokenDto tokenDto, @RequestBody BadgeAuditFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); badgeService.audit(tokenDto, formDTO); return new Result(); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java index b66faf5095..b7f21c0845 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java @@ -17,6 +17,7 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; @@ -25,9 +26,11 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; import com.epmet.constant.BadgeConstant; import com.epmet.constant.BadgeMessageConstant; import com.epmet.constant.UserConstant; @@ -42,9 +45,11 @@ import com.epmet.dto.result.BadgeDetailResultDTO; import com.epmet.dto.result.BadgeListResultDTO; import com.epmet.entity.BadgeCertificationConfigEntity; import com.epmet.entity.BadgeEntity; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.MessageFeignClient; import com.epmet.redis.UserBadgeRedis; import com.epmet.service.*; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -60,6 +65,7 @@ import java.util.*; * @since v1.0.0 2020-11-03 */ @Service +@Slf4j public class BadgeServiceImpl extends BaseServiceImpl implements BadgeService { @Autowired @@ -74,6 +80,9 @@ public class BadgeServiceImpl extends BaseServiceImpl imp private ResiUserBadgeService resiUserBadgeService; @Autowired private MessageFeignClient messageFeignClient; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + @Override @@ -322,6 +331,11 @@ public class BadgeServiceImpl extends BaseServiceImpl imp */ @Override public void audit(TokenDto tokenDto, BadgeAuditFormDTO formDTO) { + if(BadgeConstant.REJECTED.equals(formDTO.getAuditStatus())) { + if (StringUtils.isEmpty(formDTO.getAuditRemark())) { + throw new ValidateException(EpmetErrorCode.CUSTOMER_VALIDATE_ERROR.getCode(), "驳回理由不能为空"); + } + } UserBadgeCertificateRecordDTO dto = userBadgeCertificateRecordService.get(formDTO.getRecordId()); BadgeDetailResultDTO detail = baseDao.selectDetail(dto.getCustomerId(), dto.getBadgeId()); dto.setAuditStatus(formDTO.getAuditStatus()); @@ -329,48 +343,71 @@ public class BadgeServiceImpl extends BaseServiceImpl imp dto.setStaffId(tokenDto.getUserId()); dto.setIsLast(BadgeConstant.YES); dto.setAuditTime(new Date()); - userBadgeCertificateRecordService.update(dto); - ResiUserBadgeDTO resiUserBadgeDTO = new ResiUserBadgeDTO(); - resiUserBadgeDTO.setCustomerId(dto.getCustomerId()); - resiUserBadgeDTO.setBadgeId(dto.getBadgeId()); - resiUserBadgeDTO.setGridId(dto.getGridId()); - resiUserBadgeDTO.setUserId(dto.getUserId()); - resiUserBadgeDTO.setIsOpened(NumConstant.ZERO); - resiUserBadgeDTO.setCertificationAutidStatus(dto.getAuditStatus()); - resiUserBadgeService.save(resiUserBadgeDTO); - List msgList = new ArrayList<>(); + List wxmpMsgList = new ArrayList<>(); if(BadgeConstant.APPROVED.equals(formDTO.getAuditStatus())) { + + ResiUserBadgeDTO resiUserBadgeDTO = new ResiUserBadgeDTO(); + resiUserBadgeDTO.setCustomerId(dto.getCustomerId()); + resiUserBadgeDTO.setBadgeId(dto.getBadgeId()); + resiUserBadgeDTO.setGridId(dto.getGridId()); + resiUserBadgeDTO.setUserId(dto.getUserId()); + resiUserBadgeDTO.setIsOpened(NumConstant.ONE); + resiUserBadgeDTO.setCertificationAutidStatus(dto.getAuditStatus()); + resiUserBadgeService.save(resiUserBadgeDTO); //更新Redis - OpenedOrClosedFormDTO openedOrClosedFormDTO = new OpenedOrClosedFormDTO(); - openedOrClosedFormDTO.setCustomerId(dto.getCustomerId()); - openedOrClosedFormDTO.setUserId(dto.getUserId()); - openedOrClosedFormDTO.setBadgeId(dto.getBadgeId()); - userBadgeService.openedOrClosed(openedOrClosedFormDTO); + badgeRedis.pushOrRemoveUserBadge4List(dto.getUserId(),dto.getBadgeId(),dto.getCustomerId()); //通知 + String msg = String.format(BadgeMessageConstant.APPROVED_MSG, detail.getBadgeName()); UserMessageFormDTO messageFormDTO = new UserMessageFormDTO(); messageFormDTO.setCustomerId(dto.getCustomerId()); messageFormDTO.setApp(UserConstant.APP_RESI); messageFormDTO.setGridId(dto.getGridId()); messageFormDTO.setUserId(dto.getUserId()); messageFormDTO.setTitle(BadgeMessageConstant.TITLE); - messageFormDTO.setMessageContent(String.format(BadgeMessageConstant.APPROVED_MSG, detail.getBadgeName())); + messageFormDTO.setMessageContent(msg); messageFormDTO.setReadFlag(Constant.UNREAD); + //微信消息 + WxSubscribeMessageFormDTO wxmp = new WxSubscribeMessageFormDTO(); + wxmp.setCustomerId(dto.getCustomerId()); + wxmp.setClientType(UserConstant.APP_RESI); + wxmp.setUserId(dto.getUserId()); + wxmp.setBehaviorType("徽章消息"); + wxmp.setMessageContent(msg); + wxmp.setMessageTime(new Date()); + wxmp.setGridId(dto.getGridId()); + wxmpMsgList.add(wxmp); } else { //通知 + String msg = String.format(BadgeMessageConstant.REJECTED_MSG, detail.getBadgeName(), formDTO.getAuditRemark()); UserMessageFormDTO messageFormDTO = new UserMessageFormDTO(); messageFormDTO.setCustomerId(dto.getCustomerId()); messageFormDTO.setApp(UserConstant.APP_RESI); messageFormDTO.setGridId(dto.getGridId()); messageFormDTO.setUserId(dto.getUserId()); messageFormDTO.setTitle(BadgeMessageConstant.TITLE); - messageFormDTO.setMessageContent(String.format(BadgeMessageConstant.REJECTED_MSG, detail.getBadgeName(), formDTO.getAuditRemark())); + messageFormDTO.setMessageContent(msg); messageFormDTO.setReadFlag(Constant.UNREAD); msgList.add(messageFormDTO); + //微信消息 + WxSubscribeMessageFormDTO wxmp = new WxSubscribeMessageFormDTO(); + wxmp.setCustomerId(dto.getCustomerId()); + wxmp.setClientType(UserConstant.APP_RESI); + wxmp.setUserId(dto.getUserId()); + wxmp.setBehaviorType("徽章消息"); + wxmp.setMessageContent(msg); + wxmp.setMessageTime(new Date()); + wxmp.setGridId(dto.getGridId()); + wxmpMsgList.add(wxmp); } messageFeignClient.saveUserMessageList(msgList); + log.info("徽章消息,开始推送微信订阅消息"); + Result result = epmetMessageOpenFeignClient.sendWxSubscribeMessage(wxmpMsgList); + if (!result.success()) { + log.error("徽章消息,发送微信订阅消息失败" + JSON.toJSONString(result)); + } } @Override From 50230da5669408f211da9e23cf5bb163853ee27f Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 10 Nov 2020 11:19:55 +0800 Subject: [PATCH 2/9] issue --- .../epmet/dto/form/MyPartIssuesFormDTO.java | 25 +++++++++++++ .../dto/result/MyPartIssuesResultDTO.java | 37 +++++++++++++++++++ .../resi-mine/resi-mine-server/pom.xml | 5 +++ .../person/controller/IssueController.java | 37 +++++++++++++++++++ .../modules/person/service/IssueService.java | 22 +++++++++++ .../person/service/impl/IssueServiceImpl.java | 32 ++++++++++++++++ 6 files changed, 158 insertions(+) create mode 100644 epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/MyPartIssuesFormDTO.java create mode 100644 epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/MyPartIssuesResultDTO.java create mode 100644 epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/controller/IssueController.java create mode 100644 epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/service/IssueService.java create mode 100644 epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/service/impl/IssueServiceImpl.java diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/MyPartIssuesFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/MyPartIssuesFormDTO.java new file mode 100644 index 0000000000..249e3e62a2 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/MyPartIssuesFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/10 10:04 上午 + */ +@Data +public class MyPartIssuesFormDTO implements Serializable { + + private static final long serialVersionUID = 265005061427415836L; + + public interface MyPartIssues{} + + /** + * 用户ID + */ + @NotBlank(message = "userId不能为空",groups = MyPartIssues.class) + private String userId; + +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/MyPartIssuesResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/MyPartIssuesResultDTO.java new file mode 100644 index 0000000000..0f1b6b7d8b --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/MyPartIssuesResultDTO.java @@ -0,0 +1,37 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/10 9:50 上午 + */ +@Data +public class MyPartIssuesResultDTO implements Serializable { + + private static final long serialVersionUID = 2081387920547808112L; + + private String issueId; + + /** + * 建议 + */ + private String suggestion; + + /** + * 议题标题 + */ + private String issueTitle; + + /** + * 转议题时间 + */ + private Long shiftIssueTime; + + /** + * 发表网格名称 + */ + private String topicReleaseGridName; +} diff --git a/epmet-module/resi-mine/resi-mine-server/pom.xml b/epmet-module/resi-mine/resi-mine-server/pom.xml index 96597e773c..503a34030f 100644 --- a/epmet-module/resi-mine/resi-mine-server/pom.xml +++ b/epmet-module/resi-mine/resi-mine-server/pom.xml @@ -96,6 +96,11 @@ 2.0.0 compile + + com.epmet + gov-issue-client + 2.0.0 + diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/controller/IssueController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/controller/IssueController.java new file mode 100644 index 0000000000..5723725dfa --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/controller/IssueController.java @@ -0,0 +1,37 @@ +package com.epmet.modules.person.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.MyPartIssuesResultDTO; +import com.epmet.modules.person.service.IssueService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @Author zxc + * @DateTime 2020/11/10 9:37 上午 + */ +@RestController +@RequestMapping("issue") +public class IssueController { + + @Autowired + private IssueService issueService; + + /** + * @Description 个人中心-我参与的议题列表 + * @Param tokenDto + * @author zxc + * @date 2020/11/10 10:01 上午 + */ + @PostMapping("my-part-issues") + public Result> myPartIssues(@LoginUser TokenDto tokenDto){ + return new Result>().ok(issueService.myPartIssues(tokenDto)); + } + +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/service/IssueService.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/service/IssueService.java new file mode 100644 index 0000000000..4d2758c707 --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/service/IssueService.java @@ -0,0 +1,22 @@ +package com.epmet.modules.person.service; + +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.result.MyPartIssuesResultDTO; + +import java.util.List; + +/** + * @Author zxc + * @DateTime 2020/11/10 9:59 上午 + */ +public interface IssueService { + + /** + * @Description 个人中心-我参与的议题列表 + * @Param tokenDto + * @author zxc + * @date 2020/11/10 10:01 上午 + */ + List myPartIssues(TokenDto tokenDto); + +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/service/impl/IssueServiceImpl.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/service/impl/IssueServiceImpl.java new file mode 100644 index 0000000000..386556e96e --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/service/impl/IssueServiceImpl.java @@ -0,0 +1,32 @@ +package com.epmet.modules.person.service.impl; + +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.form.MyPartIssuesFormDTO; +import com.epmet.dto.result.MyPartIssuesResultDTO; +import com.epmet.modules.person.service.IssueService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Author zxc + * @DateTime 2020/11/10 10:00 上午 + */ +@Service +@Slf4j +public class IssueServiceImpl implements IssueService { + + /** + * @Description 个人中心-我参与的议题列表 + * @Param tokenDto + * @author zxc + * @date 2020/11/10 10:01 上午 + */ + @Override + public List myPartIssues(TokenDto tokenDto) { + MyPartIssuesFormDTO form = new MyPartIssuesFormDTO(); + form.setUserId(tokenDto.getUserId()); + return null; + } +} From 82cf902db85a8530894efeec30e3d27f20ed9928 Mon Sep 17 00:00:00 2001 From: wangchao Date: Tue, 10 Nov 2020 13:26:33 +0800 Subject: [PATCH 3/9] =?UTF-8?q?redis=20pipelined=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=8F=96=E5=80=BC=E5=8A=A0=E4=B8=8A=E8=A7=A3=E6=9E=90=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/controller/BadgeController.java | 14 -------------- .../java/com/epmet/redis/UserBadgeRedis.java | 17 +++++++++++++++-- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java index cabe4b0a98..faaf9c3d04 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java @@ -152,18 +152,4 @@ public class BadgeController { badgeService.audit(tokenDto, formDTO); return new Result(); } - - @Autowired - private UserBadgeRedis redis; - @PostMapping("compensation-mechanism") - public Result compensationMechanism(@RequestParam("userId")String userId,@RequestParam("customerId")String customerId,@RequestParam("b1")String b1, - @RequestParam("b2")String b2){ - redis.pushOrRemoveUserBadge4List(userId,b1,customerId); - redis.pushOrRemoveUserBadge4List(userId,b1,customerId); - redis.pushOrRemoveUserBadge4List(userId,b1,customerId); - redis.pushOrRemoveUserBadge4List(userId,b2,customerId); - redis.batchClearUserBadgeCache(customerId); - redis.obtainUserBadge2List(userId,customerId); - return new Result(); - } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java index 759ae00192..72a912f393 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java @@ -18,12 +18,11 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.data.redis.connection.RedisConnection; -import org.springframework.data.redis.connection.StringRedisConnection; import org.springframework.data.redis.core.RedisCallback; import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.lang.Nullable; import org.springframework.stereotype.Component; -import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.Set; @@ -189,5 +188,19 @@ public class UserBadgeRedis { } + public List pipelinedReturnKeys(String customerId){ + List list = redisTemplate.executePipelined(new RedisCallback>() { + @Nullable + @Override + public List doInRedis(RedisConnection connection) throws DataAccessException { + connection.openPipeline(); + Set keys = connection.keys(redisTemplate.getKeySerializer().serialize(UserRedisKeys.getResiUserBadgeKey(customerId, null))); + return null; + } + },redisTemplate.getKeySerializer()); + + return list; + } + } From f86e6bb09c979aa951fceefce4ce3c62a0e074ad Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 10 Nov 2020 13:26:57 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E5=BE=BD=E7=AB=A0=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E6=B7=BB=E5=8A=A0=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/service/impl/UserBadgeServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java index 74a1ddaddd..531b6fea47 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java @@ -268,6 +268,7 @@ public class UserBadgeServiceImpl implements UserBadgeService { if (CollectionUtils.isEmpty(userBadgeListResultDTOS)){ throw new RenException("客户徽章缓存初始化未查到数据"); } + userBadgeRedis.batchClearUserBadgeCache(customerId); userBadgeRedis.setCustomerBadge(userBadgeListResultDTOS, customerId); } From a32606c1a4b0edeffafb5ccdd6280c20e9c9dc0b Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 10 Nov 2020 14:06:57 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=BE=BD=E7=AB=A0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/result/BadgeAuditRecordResultDTO.java | 5 +++++ .../java/com/epmet/dto/result/BadgeAuditingResultDTO.java | 5 +++++ .../epmet-user-server/src/main/resources/mapper/BadgeDao.xml | 2 ++ 3 files changed, 12 insertions(+) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditRecordResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditRecordResultDTO.java index 363441ad46..c37b11dcd0 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditRecordResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditRecordResultDTO.java @@ -40,4 +40,9 @@ public class BadgeAuditRecordResultDTO implements Serializable { * 用户名 */ private String auditStatus; + + /** + * 用户头像 + */ + private String userAvatar; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditingResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditingResultDTO.java index bbf6381d82..8d57267eac 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditingResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditingResultDTO.java @@ -40,4 +40,9 @@ public class BadgeAuditingResultDTO implements Serializable { */ private Long createTime; + /** + * 用户头像 + */ + private String userAvatar; + } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml index e482f95095..4c9240dc29 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml @@ -147,6 +147,7 @@ badge.BADGE_ICON, ubcr.USER_ID, ubi.REAL_NAME AS "userName", + ubi.HEAD_IMG_URL AS userAvatar, unix_timestamp(ubcr.CREATED_TIME) AS "createTime" FROM user_badge_certificate_record ubcr @@ -181,6 +182,7 @@ ubcr.USER_ID, ubcr.AUDIT_STATUS, ubi.REAL_NAME AS "userName", + ubi.HEAD_IMG_URL AS userAvatar, unix_timestamp(ubcr.CREATED_TIME) AS "createTime" FROM user_badge_certificate_record ubcr From b938e5e0c39e6941b10ee03c927a4b95c738dfc6 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 10 Nov 2020 14:24:43 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E5=BE=BD=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/service/impl/BadgeServiceImpl.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java index b7f21c0845..00b3e3bfb2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java @@ -299,7 +299,6 @@ public class BadgeServiceImpl extends BaseServiceImpl imp public List auditingList(TokenDto tokenDto, BadgeFormDTO formDTO) { int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); List list = baseDao.selectAuditingList(tokenDto.getCustomerId(), pageIndex, formDTO.getPageSize(), formDTO.getGridId()); - list.forEach(item -> item.setCreateTime(item.getCreateTime()/NumConstant.SIXTY)); return list; } @@ -316,7 +315,6 @@ public class BadgeServiceImpl extends BaseServiceImpl imp public List auditRecord(TokenDto tokenDto, BadgeFormDTO formDTO) { int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); List list = baseDao.selectAuditRecord(tokenDto.getCustomerId(), pageIndex, formDTO.getPageSize(), formDTO.getGridId()); - list.forEach(item -> item.setCreateTime(item.getCreateTime()/NumConstant.SIXTY)); return list; } From 61b9ac47d9630216a75fcd187408aeec24a2d711 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 10 Nov 2020 14:47:33 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E5=BE=BD=E7=AB=A0=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/CertificationDetailFormDTO.java | 4 ++-- .../src/main/java/com/epmet/dao/UserBadgeDao.java | 2 +- .../java/com/epmet/service/impl/UserBadgeServiceImpl.java | 8 ++++---- .../src/main/resources/mapper/UserBadgeDao.xml | 7 ++++++- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationDetailFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationDetailFormDTO.java index 1eea42f575..9618efac5d 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationDetailFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationDetailFormDTO.java @@ -23,7 +23,7 @@ public class CertificationDetailFormDTO implements Serializable { private String badgeId; /** - * 客户ID + * 审核记录ID */ - private String userId; + private String recordId; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java index c979c06d0a..082b0051cb 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java @@ -86,7 +86,7 @@ public interface UserBadgeDao { * @author zxc * @date 2020/11/4 4:09 下午 */ - CertificationDetailResultDTO selectBadgeAuthRecord(@Param("userId")String userId, @Param("badgeId")String badgeId); + CertificationDetailResultDTO selectBadgeAuthRecord(@Param("userId")String userId, @Param("badgeId")String badgeId,@Param("recordId")String recordId); /** * @Description 个人中心-查询徽章要显示的认证信息字段 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java index 531b6fea47..7999e694b6 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java @@ -212,7 +212,7 @@ public class UserBadgeServiceImpl implements UserBadgeService { /** * @Description 个人中心-获取徽章认证页面详情 - * 先判断 userId存在不,不存在从tokenDto获取【工作端和居民端合用一个接口】 + * 先判断 recordId存在不,不存在是居民端,反之,工作端【工作端和居民端合用一个接口】 * @Param tokenDto * @Param certificationDetailFormDTO * @author zxc @@ -220,10 +220,10 @@ public class UserBadgeServiceImpl implements UserBadgeService { */ @Override public CertificationDetailResultDTO certificationDetail(TokenDto tokenDto, CertificationDetailFormDTO certificationDetailFormDTO) { - if (StringUtils.isEmpty(certificationDetailFormDTO.getUserId())){ - certificationDetailFormDTO.setUserId(tokenDto.getUserId()); + if (StringUtils.isNotBlank(certificationDetailFormDTO.getRecordId())){ + return userBadgeDao.selectBadgeAuthRecord(null, certificationDetailFormDTO.getBadgeId(),certificationDetailFormDTO.getRecordId()); } - return userBadgeDao.selectBadgeAuthRecord(certificationDetailFormDTO.getUserId(), certificationDetailFormDTO.getBadgeId()); + return userBadgeDao.selectBadgeAuthRecord(tokenDto.getUserId(), certificationDetailFormDTO.getBadgeId(),certificationDetailFormDTO.getRecordId()); } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml index 7e46626d18..1ce902f6d2 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml @@ -107,7 +107,12 @@ DEL_FLAG = 0 AND IS_LAST = 'yes' AND BADGE_ID = #{badgeId} - AND USER_ID = #{userId} + + AND USER_ID = #{userId} + + + AND ID = #{recordId} + From 8f3878c9ac837c35092b8b533bb4e5003ee2407c Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 10 Nov 2020 15:11:01 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E5=BE=BD=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/UserBadgeDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml index 1ce902f6d2..f7186b1424 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml @@ -105,10 +105,10 @@ user_badge_certificate_record WHERE DEL_FLAG = 0 - AND IS_LAST = 'yes' AND BADGE_ID = #{badgeId} AND USER_ID = #{userId} + AND IS_LAST = 'yes' AND ID = #{recordId} From c21527473372bee031908eb0217d05ebe1ee9173 Mon Sep 17 00:00:00 2001 From: liushaowen <565850092@qq.com> Date: Tue, 10 Nov 2020 15:26:56 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E5=B1=85=E6=B0=91=E7=AB=AF-=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E5=BB=BA=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/UserAdviceDTO.java | 7 +- .../epmet/dto/form/SubmitAdviceFormDTO.java | 51 ++++++++++ .../controller/UserAdviceController.java | 16 +++ .../java/com/epmet/dao/UserAdviceDao.java | 3 + .../com/epmet/service/UserAdviceService.java | 11 +++ .../service/impl/UserAdviceServiceImpl.java | 99 ++++++++++++++++++- .../main/resources/mapper/UserAdviceDao.xml | 45 +++++++++ 7 files changed, 228 insertions(+), 4 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SubmitAdviceFormDTO.java diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceDTO.java index 77e6494ee6..0cea243f87 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceDTO.java @@ -98,6 +98,11 @@ public class UserAdviceDTO implements Serializable { */ private String adviceType; + /** + * 问题时间 + */ + private Date adviceTime; + /** * 回复内容 */ @@ -153,4 +158,4 @@ public class UserAdviceDTO implements Serializable { */ private Date updatedTime; -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SubmitAdviceFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SubmitAdviceFormDTO.java new file mode 100644 index 0000000000..b4dae41cbd --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SubmitAdviceFormDTO.java @@ -0,0 +1,51 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @description: + * @author: liushaowen + * @date: 2020/11/10 10:42 + */ +@Data +public class SubmitAdviceFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + @NotBlank(message = "客户id不能为空") + private String customerId; + + /** + * 网格id + */ + @NotBlank(message = "网格id不能为空") + private String gridId; + + /** + * 建议内容 + */ + @NotBlank(message = "建议内容不能为空") + private String adviceContent; + + /** + * 电话号码可为空 存*,不为空需校验 + */ + private String phone; + + /** + * 问题类型,可为空 存*,gov为政府问题,software为软件问题 + */ + + private String adviceType; + + /** + * 建议图片 + */ + private List imgList; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java index 0886a6a824..170b9188e5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java @@ -30,6 +30,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.UserAdviceDTO; import com.epmet.dto.form.AdviceListFormDTO; import com.epmet.dto.form.ReplyAdviceFormDTO; +import com.epmet.dto.form.SubmitAdviceFormDTO; import com.epmet.dto.result.AdviceDetailResultDTO; import com.epmet.dto.result.AdviceListResultDTO; import com.epmet.dto.result.MyAdviceListResultDTO; @@ -42,6 +43,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; +import java.util.regex.Pattern; /** @@ -170,4 +172,18 @@ public class UserAdviceController { } return new Result>().ok(userAdviceService.myAdviceList(pageSize,pageNo,loginUserUtil.getLoginUserId())); } + + @PostMapping("submitadvice") + public Result submitAdvice(@RequestBody SubmitAdviceFormDTO dto){ + ValidatorUtils.validateEntity(dto); + if (StringUtils.isNotBlank(dto.getPhone())){ + if (!Pattern.matches("^1[3456789]\\d{9}$",dto.getPhone())){ + throw new RenException("手机号格式错误"); + } + }else { + dto.setPhone("*"); + } + userAdviceService.submitAdvice(dto,loginUserUtil.getLoginUserId()); + return new Result(); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserAdviceDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserAdviceDao.java index 087b91f225..3fd6a4f205 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserAdviceDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserAdviceDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.UserAdviceDTO; import com.epmet.dto.result.MyAdviceListResultDTO; import com.epmet.entity.UserAdviceEntity; import org.apache.ibatis.annotations.Mapper; @@ -41,4 +42,6 @@ public interface UserAdviceDao extends BaseDao { List myAdviceList(@Param("pageSize") int pageSize, @Param("pageNo") int pageNo, @Param("userId") String loginUserId); + + int saveUserAdvice(UserAdviceDTO dto); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceService.java index 35a5e840ce..4bfc5d5307 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceService.java @@ -22,6 +22,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.dto.UserAdviceDTO; import com.epmet.dto.form.AdviceListFormDTO; import com.epmet.dto.form.ReplyAdviceFormDTO; +import com.epmet.dto.form.SubmitAdviceFormDTO; import com.epmet.dto.result.AdviceDetailResultDTO; import com.epmet.dto.result.AdviceListResultDTO; import com.epmet.dto.result.MyAdviceListResultDTO; @@ -136,4 +137,14 @@ public interface UserAdviceService extends BaseService { * @Date 2020/11/9 17:39 */ List myAdviceList(int pageSize, int pageNo, String loginUserId); + + /** + * @Description 居民端-回复建议 + * @param dto + * @param loginUserId + * @return void + * @Author liushaowen + * @Date 2020/11/10 10:57 + */ + void submitAdvice(SubmitAdviceFormDTO dto, String loginUserId); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java index 8973026d33..59038e0d91 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java @@ -37,17 +37,22 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.UserAdviceConstant; import com.epmet.dao.UserAdviceDao; +import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dto.CustomerDTO; import com.epmet.dto.UserAdviceDTO; import com.epmet.dto.form.AdviceListFormDTO; import com.epmet.dto.form.ReplyAdviceFormDTO; -import com.epmet.dto.result.AdviceDetailResultDTO; -import com.epmet.dto.result.AdviceListResultDTO; -import com.epmet.dto.result.MyAdviceListResultDTO; +import com.epmet.dto.form.SubmitAdviceFormDTO; +import com.epmet.dto.form.UserResiInfoFormDTO; +import com.epmet.dto.result.*; import com.epmet.entity.UserAdviceEntity; import com.epmet.entity.UserAdviceImgEntity; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.redis.UserAdviceRedis; import com.epmet.service.UserAdviceImgService; import com.epmet.service.UserAdviceService; +import com.epmet.service.UserResiInfoService; import io.jsonwebtoken.lang.Collections; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; @@ -76,6 +81,15 @@ public class UserAdviceServiceImpl extends BaseServiceImpl customerInfo = operCrmOpenFeignClient.getCustomerInfo(customerDTO); + if (customerInfo.success()){ + userAdviceDTO.setCustomerName(customerInfo.getData().getCustomerName()); + }else { + logger.error("customerId:{},获取customerName失败",dto.getCustomerId()); + } + //获取gridName,agencyId + Result gridInfoResultDTOResult = govOrgOpenFeignClient.queryGridInfo(dto.getGridId()); + if (gridInfoResultDTOResult.success()){ + userAdviceDTO.setGridName(gridInfoResultDTOResult.getData().getGridName()); + userAdviceDTO.setAgencyId(gridInfoResultDTOResult.getData().getParentAgencyId()); + //获取agencyName + Result agencyById = govOrgOpenFeignClient.getAgencyById(gridInfoResultDTOResult.getData().getParentAgencyId()); + if (agencyById.success()){ + userAdviceDTO.setAgencyName(agencyById.getData().getAllParentName()); + }else { + logger.error("agencyId:{},获取组织详情失败",gridInfoResultDTOResult.getData().getParentAgencyId()); + } + }else { + logger.error("gridId:{},获取网格详情失败",dto.getGridId()); + } + + //获取userName,regPhone + UserResiInfoFormDTO userResiInfoFormDTO = new UserResiInfoFormDTO(); + userResiInfoFormDTO.setUserId(loginUserId); + userResiInfoFormDTO.setCustomerId(dto.getCustomerId()); + Result userResiInfoDTO = userResiInfoService.getUserResiInfoDTO(userResiInfoFormDTO); + if (userResiInfoDTO.success()){ + userAdviceDTO.setUserId(loginUserId); + userAdviceDTO.setUserName(userResiInfoDTO.getData().getSurname()+userResiInfoDTO.getData().getName()); + userAdviceDTO.setRegPhone(userResiInfoDTO.getData().getRegMobile()); + }else { + logger.error("userId:{},获取user注册信息失败",loginUserId); + } + //设置AdviceTime + userAdviceDTO.setAdviceTime(new Date()); + //设置adviceType + if (StringUtils.isBlank(dto.getAdviceType())){ + userAdviceDTO.setAdviceType("*"); + } + baseDao.saveUserAdvice(userAdviceDTO); + //如果imgList不为空,插入advice_img表 + List govImgList = dto.getImgList(); + if (!Collections.isEmpty(govImgList)) { + List userAdviceImgEntities = new ArrayList<>(); + for (int i = 0; i < govImgList.size(); i++) { + //最多存三张图片 + if (i == 3) { + break; + } + UserAdviceImgEntity entity = new UserAdviceImgEntity(); + entity.setImgUrl(govImgList.get(i)); + entity.setAdviceId(userAdviceDTO.getId()); + entity.setType("resi"); + userAdviceImgEntities.add(entity); + } + userAdviceImgService.insertBatch(userAdviceImgEntities); + } + } + private void auditText(String text) { TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); TextTaskDTO taskDTO = new TextTaskDTO(); diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserAdviceDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserAdviceDao.xml index 42c4b57f44..4f9aa8730c 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserAdviceDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserAdviceDao.xml @@ -64,4 +64,49 @@ from user_advice_img where del_flag = 0 and advice_Id = #{id} and type = 'resi' + + + + select md5(replace(UUID(),'-','')) + + insert into user_advice( + id, + customer_id, + customer_name, + agency_id, + agency_name, + grid_id, + grid_name, + user_id, + user_name, + reg_phone, + advice_content, + phone, + advice_time, + advice_type, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) + values ( + #{id}, + #{customerId}, + #{customerName}, + #{agencyId}, + #{agencyName}, + #{gridId}, + #{gridName}, + #{userId}, + #{userName}, + #{regPhone}, + #{adviceContent}, + #{phone}, + #{adviceTime}, + #{adviceType}, + 0,0,#{userId},#{adviceTime},#{userId},#{adviceTime} + ) +