diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java index f8b6dcc2e5..131e4a9203 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java @@ -30,4 +30,16 @@ public interface BadgeConstant { String OFFLINE ="offline"; + String RESI = "resi"; + + String AUTH_TITLE = "您有一条认证消息"; + + String GET_BADGE_NAME_FAILURE = "获取徽章名称失败......"; + + String MESSAGE_CONTENT = "您好,您的%s因认证失败未成功点亮,请查看"; + + String READ_FLAG = "unread"; + + String DEFAULT = "default"; + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceImgDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceImgDTO.java index 37a50e3df6..cb39a925d5 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceImgDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceImgDTO.java @@ -43,6 +43,11 @@ public class UserAdviceImgDTO implements Serializable { */ private String adviceId; + /** + * 类型,resi为用户上传,oper为运营上传 + */ + private String type; + /** * 图片url */ @@ -78,4 +83,4 @@ public class UserAdviceImgDTO 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/AdviceListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AdviceListFormDTO.java new file mode 100644 index 0000000000..1e001b988a --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AdviceListFormDTO.java @@ -0,0 +1,56 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.Min; +import java.util.Date; + +/** + * @description: + * @author: liushaowen + * @date: 2020/11/9 10:37 + */ +@Data +public class AdviceListFormDTO { + /** + * 客户id 不填查询所有 + */ + private String customerId; + + /** + * 组织id 不填查询所有 + */ + private String agencyId; + + /** + * 是否被回复,0未回复,1回复, 传空查询所有 + */ + private String isReply; + + /** + * 问题类型 gov政府,software软件 ,传空查询全部,单选 + */ + private String adviceType; + + /** + * 开始时间 可不填 + */ + private Date startTime; + + /** + * 结束时间 可不填 + */ + private Date endTime; + + /** + * 页码 + */ + @Min(1) + private int pageNo; + + /** + * 页大小 + */ + @Min(1) + private int pageSize; +} 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 e9702144f0..fdd2969fb0 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 @@ -16,9 +16,9 @@ public class BadgeFormDTO implements Serializable { /** * 页码 */ - private Integer pageNo; + private Integer pageNo = 1; /** * 每页显示数量 */ - private Integer pageSize; + private Integer pageSize = 20; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AdviceDetailResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AdviceDetailResultDTO.java index 462f053373..2f8bbbc262 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AdviceDetailResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AdviceDetailResultDTO.java @@ -1,8 +1,10 @@ package com.epmet.dto.result; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serializable; +import java.util.Date; import java.util.List; /** @@ -18,20 +20,51 @@ public class AdviceDetailResultDTO implements Serializable { */ private String adviceId; + /** + * 客户名 + */ + private String customerName; + + /** + * 组织名 + */ + private String agencyName; + + /** + * 网格名 + */ + private String gridName; + + /** + * 注册电话 + */ + private String regPhone; + + /** + * 意见类型 + */ + private String adviceType; + + /** + * 提建议人姓名 + */ + private String userName; + /** * 建议内容 */ private String adviceContent; /** - * 电话 + * 填写的电话 */ private String phone; /** * 建议时间 */ - private String adviceTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date adviceTime; /** * 回复内容 @@ -41,15 +74,26 @@ public class AdviceDetailResultDTO implements Serializable { /** * 回复时间 */ - private String replyTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date replyTime; /** - * 回复人 + * 回复人姓名 */ - private String replyUser; + private String replyUserName; /** * 建议图片列表 */ private List imgList; + + /** + * 政府回应图片 + */ + private List govImgList; + + /** + * 政府回应文字 + */ + private String govContent; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/BadgeMessageConstant.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/BadgeMessageConstant.java new file mode 100644 index 0000000000..d0dc2a5529 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/BadgeMessageConstant.java @@ -0,0 +1,23 @@ +package com.epmet.constant; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/11/9 10:32 + */ +public interface BadgeMessageConstant { + /** + * 消息标题 + */ + String TITLE = "您有一条认证消息"; + + + /** + * 审核通过消息模板 + */ + String APPROVED_MSG = "您好,您提交的%s申请已通过,请查看。"; + /** + * 审核驳回消息模板 + */ + String REJECTED_MSG = "您好,您提交的%s申请,由于%s,已被驳回。"; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserAdviceConstant.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserAdviceConstant.java new file mode 100644 index 0000000000..fb82d09fd7 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserAdviceConstant.java @@ -0,0 +1,7 @@ +package com.epmet.constant; + +public interface UserAdviceConstant { + String GOV_TYPE_TEXT = "政府业务建议"; + + String SOFTWARE_TYPE_TEXT = "软件功能及体验问题"; +} 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 de9e8b00c6..b58cc793a3 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 @@ -17,6 +17,7 @@ package com.epmet.controller; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ExcelUtils; @@ -27,9 +28,12 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; 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.result.AdviceDetailResultDTO; import com.epmet.excel.UserAdviceExcel; import com.epmet.service.UserAdviceService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -97,9 +101,24 @@ public class UserAdviceController { } @PostMapping("replyadvice") - public Result replyAdvice(ReplyAdviceFormDTO dto){ + public Result replyAdvice(@RequestBody ReplyAdviceFormDTO dto){ ValidatorUtils.validateEntity(dto); userAdviceService.replyAdvice(dto,loginUserUtil.getLoginUserId()); return new Result(); } + + @PostMapping("advicedetail") + public Result adviceDetail(String adviceId){ + if (StringUtils.isBlank(adviceId)){ + throw new RenException("adviceId不能为空"); + } + return new Result().ok(userAdviceService.adviceDetail(adviceId)); + } + + @PostMapping("advicelist") + public Result> adviceList(AdviceListFormDTO dto){ + ValidatorUtils.validateEntity(dto); + PageData page = userAdviceService.adviceList(dto); + return new Result>().ok(page); + } } 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 65910f22cd..aae79a6ac3 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 @@ -36,6 +36,15 @@ public interface UserBadgeDao { */ List selectAllBadge(@Param("customerId") String customerId); + /** + * @Description 查询单个徽章信息 + * @Param customerId + * @Param badgeId + * @author zxc + * @date 2020/11/9 11:17 上午 + */ + UserBadgeListResultDTO selectBadgeByBadgeId(@Param("customerId") String customerId,@Param("badgeId") String badgeId); + /** * @Description 查询徽章认证记录 * @Param userId diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserAdviceImgEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserAdviceImgEntity.java index a507b96b38..849b0ba467 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserAdviceImgEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserAdviceImgEntity.java @@ -43,6 +43,11 @@ public class UserAdviceImgEntity extends BaseEpmetEntity { */ private String adviceId; + /** + * 类型,resi为用户上传,oper为运营上传 + */ + private String type; + /** * 图片url */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/UserAdviceImgExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/UserAdviceImgExcel.java index 55b27a6b7e..f32014927c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/UserAdviceImgExcel.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/UserAdviceImgExcel.java @@ -37,6 +37,9 @@ public class UserAdviceImgExcel { @Excel(name = "建议id") private String adviceId; + @Excel(name = "类型") + private String type; + @Excel(name = "图片url") private String imgUrl; @@ -59,4 +62,4 @@ public class UserAdviceImgExcel { private Date updatedTime; -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/MessageFeignClient.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/MessageFeignClient.java index 0b2cb3c0ef..e0be305d7f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/MessageFeignClient.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/MessageFeignClient.java @@ -2,12 +2,17 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.feign.fallback.MessageFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; +import java.util.List; + @FeignClient(name = ServiceConstant.EPMET_MESSAGE_SERVER, fallback = MessageFeignClientFallback.class) public interface MessageFeignClient { @@ -18,4 +23,13 @@ public interface MessageFeignClient { @GetMapping(value = "message/sms/captcha/{mobile}") Result sendSmsCaptcha(@PathVariable("mobile") String mobile); + /** + * @param msgList + * @return com.epmet.commons.tools.utils.Result + * @Author sun + * @Description 批量推送消息 + **/ + @PostMapping(value = "message/usermessage/saveusermessagelist", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result saveUserMessageList(List msgList); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/MessageFeignClientFallback.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/MessageFeignClientFallback.java index 8af38c06aa..e7dbea7b95 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/MessageFeignClientFallback.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/MessageFeignClientFallback.java @@ -3,9 +3,12 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.feign.MessageFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** * 消息服务降级 */ @@ -17,4 +20,15 @@ public class MessageFeignClientFallback implements MessageFeignClient { return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "sendSmsCaptcha", mobile); } + /** + * @param msgList + * @return com.epmet.commons.tools.utils.Result + * @Author sun + * @Description 批量推送消息 + **/ + @Override + public Result saveUserMessageList(List msgList) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveUserMessageList", msgList); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceImgService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceImgService.java index 0e5cd1d5b5..86ed81cb83 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceImgService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceImgService.java @@ -92,4 +92,13 @@ public interface UserAdviceImgService extends BaseService { * @date 2020-11-04 */ void delete(String[] ids); -} \ No newline at end of file + + /** + * @Description 根据adviceId获取关联的图片 + * @param adviceId + * @return void + * @Author liushaowen + * @Date 2020/11/9 9:59 + */ + List getImgsByAdviceId(String adviceId); +} 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 f13d6f9eda..8e018df061 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 @@ -20,7 +20,9 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; 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.result.AdviceDetailResultDTO; import com.epmet.entity.UserAdviceEntity; import java.util.List; @@ -103,4 +105,22 @@ public interface UserAdviceService extends BaseService { * @Date 2020/11/6 16:44 */ void replyAdvice(ReplyAdviceFormDTO dto, String loginUserId); + + /** + * @Description 建议详情 + * @param adviceId + * @return com.epmet.dto.result.AdviceDetailResultDTO + * @Author liushaowen + * @Date 2020/11/6 17:19 + */ + AdviceDetailResultDTO adviceDetail(String adviceId); + + /** + * @Description 查询建议列表 + * @param dto + * @return com.epmet.commons.tools.page.PageData + * @Author liushaowen + * @Date 2020/11/9 10:41 + */ + PageData adviceList(AdviceListFormDTO dto); } 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 89c6b72a75..1f391e5aa9 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 @@ -20,6 +20,7 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; @@ -28,6 +29,8 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.constant.BadgeConstant; +import com.epmet.constant.BadgeMessageConstant; +import com.epmet.constant.UserConstant; import com.epmet.dao.BadgeDao; import com.epmet.dto.BadgeDTO; import com.epmet.dto.ResiUserBadgeDTO; @@ -39,6 +42,7 @@ 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.MessageFeignClient; import com.epmet.redis.UserBadgeRedis; import com.epmet.service.*; import org.apache.commons.collections4.CollectionUtils; @@ -68,6 +72,8 @@ public class BadgeServiceImpl extends BaseServiceImpl imp private UserBadgeService userBadgeService; @Autowired private ResiUserBadgeService resiUserBadgeService; + @Autowired + private MessageFeignClient messageFeignClient; @Override @@ -317,9 +323,11 @@ public class BadgeServiceImpl extends BaseServiceImpl imp @Override public void audit(TokenDto tokenDto, BadgeAuditFormDTO formDTO) { UserBadgeCertificateRecordDTO dto = userBadgeCertificateRecordService.get(formDTO.getRecordId()); + BadgeDetailResultDTO detail = baseDao.selectDetail(dto.getCustomerId(), dto.getBadgeId()); dto.setAuditStatus(formDTO.getAuditStatus()); dto.setAuditRemark(formDTO.getAuditRemark()); dto.setStaffId(tokenDto.getUserId()); + dto.setIsLast(BadgeConstant.YES); dto.setAuditTime(new Date()); userBadgeCertificateRecordService.update(dto); @@ -333,6 +341,7 @@ public class BadgeServiceImpl extends BaseServiceImpl imp resiUserBadgeDTO.setCertificationAutidStatus(dto.getAuditStatus()); resiUserBadgeService.save(resiUserBadgeDTO); + List msgList = new ArrayList<>(); if(BadgeConstant.APPROVED.equals(formDTO.getAuditStatus())) { //更新Redis OpenedOrClosedFormDTO openedOrClosedFormDTO = new OpenedOrClosedFormDTO(); @@ -340,7 +349,28 @@ public class BadgeServiceImpl extends BaseServiceImpl imp openedOrClosedFormDTO.setUserId(dto.getUserId()); openedOrClosedFormDTO.setBadgeId(dto.getBadgeId()); userBadgeService.openedOrClosed(openedOrClosedFormDTO); + //通知 + 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.setReadFlag(Constant.UNREAD); + } else { + //通知 + 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.setReadFlag(Constant.UNREAD); + msgList.add(messageFormDTO); } + messageFeignClient.saveUserMessageList(msgList); } @Override diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceImgServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceImgServiceImpl.java index bb0828b9a2..cc8a164969 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceImgServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceImgServiceImpl.java @@ -101,4 +101,16 @@ public class UserAdviceImgServiceImpl extends BaseServiceImpl getImgsByAdviceId(String adviceId) { + return baseDao.selectList(new QueryWrapper().eq("ADVICE_ID",adviceId)); + } + +} 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 ceae0d177c..df0ca66996 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 @@ -19,21 +19,35 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.constant.UserAdviceConstant; import com.epmet.dao.UserAdviceDao; 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.entity.UserAdviceEntity; +import com.epmet.entity.UserAdviceImgEntity; import com.epmet.redis.UserAdviceRedis; +import com.epmet.service.UserAdviceImgService; import com.epmet.service.UserAdviceService; +import io.jsonwebtoken.lang.Collections; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.formula.functions.T; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -50,6 +64,9 @@ public class UserAdviceServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -66,8 +83,8 @@ public class UserAdviceServiceImpl extends BaseServiceImpl getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); @@ -112,6 +129,95 @@ public class UserAdviceServiceImpl extends BaseServiceImpl govImgList = dto.getGovImgList(); + 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(dto.getAdviceId()); + entity.setType("oper"); + userAdviceImgEntities.add(entity); + } + userAdviceImgService.insertBatch(userAdviceImgEntities); + } + } + + /** + * @param adviceId + * @return com.epmet.dto.result.AdviceDetailResultDTO + * @Description 建议详情 + * @Author liushaowen + * @Date 2020/11/6 17:19 + */ + @Override + public AdviceDetailResultDTO adviceDetail(String adviceId) { + UserAdviceEntity userAdviceEntity = baseDao.selectById(adviceId); + AdviceDetailResultDTO adviceDetailResultDTO = new AdviceDetailResultDTO(); + BeanUtils.copyProperties(userAdviceEntity, adviceDetailResultDTO); + adviceDetailResultDTO.setAdviceId(userAdviceEntity.getId()); + adviceDetailResultDTO.setAdviceTime(userAdviceEntity.getCreatedTime()); + //拼接建议类型 + if (!"*".equals(userAdviceEntity.getAdviceType())) { + StringBuilder type = new StringBuilder(); + if (userAdviceEntity.getAdviceType().contains("gov")) { + type.append(UserAdviceConstant.GOV_TYPE_TEXT); + } + if (userAdviceEntity.getAdviceType().contains("software")) { + if (type.length() != 0) { + type.append(","); + } + type.append(UserAdviceConstant.SOFTWARE_TYPE_TEXT); + } + adviceDetailResultDTO.setAdviceType(type.toString()); + } + //获取建议图片 + List imgsByAdviceId = userAdviceImgService.getImgsByAdviceId(adviceId); + List govImgList = new ArrayList<>(); + List resiImgList = new ArrayList<>(); + for (UserAdviceImgEntity entity : imgsByAdviceId) { + if ("resi".equals(entity.getType())) { + resiImgList.add(entity.getImgUrl()); + } else if ("oper".equals(entity.getType())) { + govImgList.add(entity.getImgUrl()); + } + } + adviceDetailResultDTO.setImgList(resiImgList); + adviceDetailResultDTO.setGovImgList(govImgList); + return adviceDetailResultDTO; + } + + /** + * @param dto + * @return com.epmet.commons.tools.page.PageData + * @Description 查询建议列表 + * @Author liushaowen + * @Date 2020/11/9 10:41 + */ + @Override + public PageData adviceList(AdviceListFormDTO dto) { + //page分页 + Page page = new Page<>(dto.getPageNo(), dto.getPageSize()); + //时间降序 + page.addOrder(OrderItem.desc(FieldConstant.CREATED_TIME)); + + //wrapper + QueryWrapper wrapper = new QueryWrapper<>(); + + + IPage result = baseDao.selectPage(page,wrapper); + return null; } } 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 2f3f51ed86..9fe158c415 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 @@ -20,7 +20,6 @@ import com.epmet.service.UserBadgeService; import com.epmet.service.UserBaseInfoService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -28,8 +27,6 @@ import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; /** * @Author zxc @@ -47,6 +44,8 @@ public class UserBadgeServiceImpl implements UserBadgeService { private UserBaseInfoService userBaseInfoService; @Autowired private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + @Autowired + private EpmetMessageOpenFeignClient messageFeignClient; /** * @Description 查询已经点亮的徽章 @@ -151,9 +150,32 @@ public class UserBadgeServiceImpl implements UserBadgeService { form.setCertificationImg(certificationAddFormDTO.getCertificationImg()); form.setSurname(certificationAddFormDTO.getSurname()); userBadgeDao.insertUserBadgeCertificateRecord(form); + + //TODO 站内信发送 您好,您的xxx徽章因认证失败未成功点亮,请查看 + this.sendMessageByUser(form); + return new Result(); } + public void sendMessageByUser(UserBadgeCertificateRecordDTO form){ + List msgList = new ArrayList<>(); + UserMessageFormDTO formDTO = new UserMessageFormDTO(); + formDTO.setApp(BadgeConstant.RESI); + formDTO.setCustomerId(form.getCustomerId()); + formDTO.setGridId(form.getGridId()); + UserBadgeListResultDTO userBadgeListResultDTO = userBadgeDao.selectBadgeByBadgeId(form.getCustomerId(), form.getBadgeId()); + if (null == userBadgeListResultDTO){ + log.error(BadgeConstant.GET_BADGE_NAME_FAILURE); + return; + } + formDTO.setMessageContent(String.format(BadgeConstant.MESSAGE_CONTENT,userBadgeListResultDTO.getBadgeName())); + formDTO.setTitle(BadgeConstant.AUTH_TITLE); + formDTO.setReadFlag(BadgeConstant.READ_FLAG); + formDTO.setUserId(form.getUserId()); + msgList.add(formDTO); + Result result = messageFeignClient.saveUserMessageList(msgList); + } + /** * @Description 发送验证码 * @Param badgeSendCodeFormDTO @@ -232,24 +254,9 @@ public class UserBadgeServiceImpl implements UserBadgeService { @Override public void reloadCustomerBadge(String customerId){ userBadgeRedis.delCustomerBadge(customerId); - List resultUserBadge = new ArrayList<>(); List userBadgeListResultDTOS = userBadgeDao.selectAllBadge(customerId); - if (!CollectionUtils.isEmpty(userBadgeListResultDTOS)){ - Map> groupByCustomer = userBadgeListResultDTOS.stream().collect(Collectors.groupingBy(UserBadgeListResultDTO::getCustomerId)); - resultUserBadge.addAll(groupByCustomer.get(BadgeConstant.DEFAULT_CUSTOMER)); - List badgeByCustomer = groupByCustomer.get(customerId); - if (!CollectionUtils.isEmpty(badgeByCustomer)) { - resultUserBadge.forEach(r -> { - for (int i = NumConstant.ZERO; i < badgeByCustomer.size(); i++) { - if (r.getBadgeId().equals(badgeByCustomer.get(i).getBadgeId())) { - BeanUtils.copyProperties(badgeByCustomer.get(i), r); - badgeByCustomer.remove(badgeByCustomer.get(i)); - } - } - }); - resultUserBadge.addAll(badgeByCustomer); - } - userBadgeRedis.setCustomerBadge(resultUserBadge, customerId); + if (CollectionUtils.isEmpty(userBadgeListResultDTOS)){ + throw new RenException("客户徽章缓存初始化未查到数据"); } userBadgeRedis.setCustomerBadge(userBadgeListResultDTOS, customerId); } 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 91267d3a5b..037711a570 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 @@ -142,7 +142,7 @@ +