Browse Source

Merge remote-tracking branch 'origin/dev_personal_center' into dev_temp

dev_shibei_match
zxc 5 years ago
parent
commit
318d37d6de
  1. 12
      epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java
  2. 7
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceImgDTO.java
  3. 56
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AdviceListFormDTO.java
  4. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeFormDTO.java
  5. 54
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AdviceDetailResultDTO.java
  6. 23
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/BadgeMessageConstant.java
  7. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserAdviceConstant.java
  8. 21
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java
  9. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java
  10. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserAdviceImgEntity.java
  11. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/UserAdviceImgExcel.java
  12. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/feign/MessageFeignClient.java
  13. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/MessageFeignClientFallback.java
  14. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceImgService.java
  15. 20
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceService.java
  16. 30
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java
  17. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceImgServiceImpl.java
  18. 112
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java
  19. 47
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java
  20. 5
      epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml
  21. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/UserAdviceImgDao.xml
  22. 22
      epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml

12
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";
}

7
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;
}
}

56
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;
}

4
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;
}

54
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<String> imgList;
/**
* 政府回应图片
*/
private List<String> govImgList;
/**
* 政府回应文字
*/
private String govContent;
}

23
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,已被驳回。";
}

7
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 = "软件功能及体验问题";
}

21
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<AdviceDetailResultDTO>().ok(userAdviceService.adviceDetail(adviceId));
}
@PostMapping("advicelist")
public Result<PageData<UserAdviceDTO>> adviceList(AdviceListFormDTO dto){
ValidatorUtils.validateEntity(dto);
PageData<UserAdviceDTO> page = userAdviceService.adviceList(dto);
return new Result<PageData<UserAdviceDTO>>().ok(page);
}
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java

@ -36,6 +36,15 @@ public interface UserBadgeDao {
*/
List<UserBadgeListResultDTO> 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

5
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
*/

5
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;
}
}

14
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<UserMessageFormDTO> msgList);
}

14
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<UserMessageFormDTO> msgList) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveUserMessageList", msgList);
}
}

11
epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceImgService.java

@ -92,4 +92,13 @@ public interface UserAdviceImgService extends BaseService<UserAdviceImgEntity> {
* @date 2020-11-04
*/
void delete(String[] ids);
}
/**
* @Description 根据adviceId获取关联的图片
* @param adviceId
* @return void
* @Author liushaowen
* @Date 2020/11/9 9:59
*/
List<UserAdviceImgEntity> getImgsByAdviceId(String adviceId);
}

20
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<UserAdviceEntity> {
* @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<com.epmet.dto.UserAdviceDTO>
* @Author liushaowen
* @Date 2020/11/9 10:41
*/
PageData<UserAdviceDTO> adviceList(AdviceListFormDTO dto);
}

30
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<BadgeDao, BadgeEntity> imp
private UserBadgeService userBadgeService;
@Autowired
private ResiUserBadgeService resiUserBadgeService;
@Autowired
private MessageFeignClient messageFeignClient;
@Override
@ -317,9 +323,11 @@ public class BadgeServiceImpl extends BaseServiceImpl<BadgeDao, BadgeEntity> 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<BadgeDao, BadgeEntity> imp
resiUserBadgeDTO.setCertificationAutidStatus(dto.getAuditStatus());
resiUserBadgeService.save(resiUserBadgeDTO);
List<UserMessageFormDTO> msgList = new ArrayList<>();
if(BadgeConstant.APPROVED.equals(formDTO.getAuditStatus())) {
//更新Redis
OpenedOrClosedFormDTO openedOrClosedFormDTO = new OpenedOrClosedFormDTO();
@ -340,7 +349,28 @@ public class BadgeServiceImpl extends BaseServiceImpl<BadgeDao, BadgeEntity> 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

14
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceImgServiceImpl.java

@ -101,4 +101,16 @@ public class UserAdviceImgServiceImpl extends BaseServiceImpl<UserAdviceImgDao,
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}
/**
* @param adviceId
* @return UserAdviceImgEntity
* @Description 根据adviceId获取关联的图片
* @Author liushaowen
* @Date 2020/11/9 9:59
*/
@Override
public List<UserAdviceImgEntity> getImgsByAdviceId(String adviceId) {
return baseDao.selectList(new QueryWrapper<UserAdviceImgEntity>().eq("ADVICE_ID",adviceId));
}
}

112
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<UserAdviceDao, UserAd
@Autowired
private UserAdviceRedis userAdviceRedis;
@Autowired
private UserAdviceImgService userAdviceImgService;
@Override
public PageData<UserAdviceDTO> page(Map<String, Object> params) {
IPage<UserAdviceEntity> page = baseDao.selectPage(
@ -66,8 +83,8 @@ public class UserAdviceServiceImpl extends BaseServiceImpl<UserAdviceDao, UserAd
return ConvertUtils.sourceToTarget(entityList, UserAdviceDTO.class);
}
private QueryWrapper<UserAdviceEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
private QueryWrapper<UserAdviceEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<UserAdviceEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
@ -112,6 +129,95 @@ public class UserAdviceServiceImpl extends BaseServiceImpl<UserAdviceDao, UserAd
*/
@Override
public void replyAdvice(ReplyAdviceFormDTO dto, String loginUserId) {
baseDao.replyAdvice(dto.getAdviceId(),dto.getReplyContent(),dto.getGovContent(),loginUserId);
//检验是否已经回复过
UserAdviceEntity userAdviceEntity = baseDao.selectById(dto.getAdviceId());
if (StringUtils.isNotBlank(userAdviceEntity.getReplyContent()) || StringUtils.isNotBlank(userAdviceEntity.getReplyUserId())) {
throw new RenException("该建议已被回复,不能再次回复");
}
//更新advice表
baseDao.replyAdvice(dto.getAdviceId(), dto.getReplyContent(), dto.getGovContent(), loginUserId);
//如果govImg不为空,插入advice_img表
List<String> govImgList = dto.getGovImgList();
if (!Collections.isEmpty(govImgList)) {
List<UserAdviceImgEntity> 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<UserAdviceImgEntity> imgsByAdviceId = userAdviceImgService.getImgsByAdviceId(adviceId);
List<String> govImgList = new ArrayList<>();
List<String> 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<com.epmet.dto.UserAdviceDTO>
* @Description 查询建议列表
* @Author liushaowen
* @Date 2020/11/9 10:41
*/
@Override
public PageData<UserAdviceDTO> adviceList(AdviceListFormDTO dto) {
//page分页
Page<UserAdviceEntity> page = new Page<>(dto.getPageNo(), dto.getPageSize());
//时间降序
page.addOrder(OrderItem.desc(FieldConstant.CREATED_TIME));
//wrapper
QueryWrapper<UserAdviceEntity> wrapper = new QueryWrapper<>();
IPage<UserAdviceEntity> result = baseDao.selectPage(page,wrapper);
return null;
}
}

47
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<UserMessageFormDTO> 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<UserBadgeListResultDTO> resultUserBadge = new ArrayList<>();
List<UserBadgeListResultDTO> userBadgeListResultDTOS = userBadgeDao.selectAllBadge(customerId);
if (!CollectionUtils.isEmpty(userBadgeListResultDTOS)){
Map<String, List<UserBadgeListResultDTO>> groupByCustomer = userBadgeListResultDTOS.stream().collect(Collectors.groupingBy(UserBadgeListResultDTO::getCustomerId));
resultUserBadge.addAll(groupByCustomer.get(BadgeConstant.DEFAULT_CUSTOMER));
List<UserBadgeListResultDTO> 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);
}

5
epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml

@ -142,7 +142,7 @@
</select>
<select id="selectAuditingList" resultType="com.epmet.dto.result.BadgeAuditingResultDTO">
SELECT
ubcr.ID,
ubcr.ID AS "badgeId",
badge.BADGE_NAME,
badge.BADGE_ICON,
ubcr.USER_ID,
@ -174,10 +174,11 @@
</select>
<select id="selectAuditRecord" resultType="com.epmet.dto.result.BadgeAuditRecordResultDTO">
SELECT
ubcr.ID,
ubcr.ID AS "badgeId",
badge.BADGE_NAME,
badge.BADGE_ICON,
ubcr.USER_ID,
ubcr.AUDIT_STATUS,
ubi.REAL_NAME AS "userName",
unix_timestamp(ubcr.CREATED_TIME) AS "createTime"
FROM

3
epmet-user/epmet-user-server/src/main/resources/mapper/UserAdviceImgDao.xml

@ -6,6 +6,7 @@
<resultMap type="com.epmet.entity.UserAdviceImgEntity" id="userAdviceImgMap">
<result property="id" column="ID"/>
<result property="adviceId" column="ADVICE_ID"/>
<result property="type" column="TYPE"/>
<result property="imgUrl" column="IMG_URL"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
@ -16,4 +17,4 @@
</resultMap>
</mapper>
</mapper>

22
epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml

@ -126,6 +126,28 @@
AND cc.BADGE_ID = #{badgeId}
ORDER BY cf.SORT
</select>
<select id="selectBadgeByBadgeId" resultType="com.epmet.dto.result.UserBadgeListResultDTO">
SELECT
ID AS badgeId,
BADGE_NAME,
BADGE_ICON,
BADGE_STATUS
FROM
(
SELECT * FROM badge
WHERE CUSTOMER_ID = #{customerId}
AND DEL_FLAG = '0'
AND ID = #{badgeId}
UNION ALL
SELECT * FROM badge a
WHERE CUSTOMER_ID = 'default'
AND a.DEL_FLAG = '0'
AND BADGE_STATUS = 'online'
AND ID = #{badgeId}
AND NOT EXISTS
( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.ID = b.ID)
) t
</select>
<!-- 徽章审核记录表插入 -->
<insert id="insertUserBadgeCertificateRecord">

Loading…
Cancel
Save