Browse Source

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

dev_shibei_match
zxc 5 years ago
parent
commit
04a00698ed
  1. 25
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/MyPartIssuesFormDTO.java
  2. 37
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/MyPartIssuesResultDTO.java
  3. 5
      epmet-module/resi-mine/resi-mine-server/pom.xml
  4. 37
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/controller/IssueController.java
  5. 22
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/service/IssueService.java
  6. 32
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/service/impl/IssueServiceImpl.java
  7. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeAuditFormDTO.java
  8. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeFormDTO.java
  9. 1
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditBadgeFormDTO.java
  10. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditRecordResultDTO.java
  11. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditingResultDTO.java
  12. 19
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java
  13. 17
      epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java
  14. 61
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java
  15. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java
  16. 2
      epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml

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

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

5
epmet-module/resi-mine/resi-mine-server/pom.xml

@ -96,6 +96,11 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>gov-issue-client</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
<build>

37
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<List<MyPartIssuesResultDTO>> myPartIssues(@LoginUser TokenDto tokenDto){
return new Result<List<MyPartIssuesResultDTO>>().ok(issueService.myPartIssues(tokenDto));
}
}

22
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<MyPartIssuesResultDTO> myPartIssues(TokenDto tokenDto);
}

32
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<MyPartIssuesResultDTO> myPartIssues(TokenDto tokenDto) {
MyPartIssuesFormDTO form = new MyPartIssuesFormDTO();
form.setUserId(tokenDto.getUserId());
return null;
}
}

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

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

1
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;
/**
* 徽章名称

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

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

19
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java

@ -68,6 +68,7 @@ public class BadgeController {
*/
@PostMapping("detail")
public Result<BadgeDetailResultDTO> detail(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, BadgeFormDTO.ManageGroup.class);
BadgeDetailResultDTO result = badgeService.detail(tokenDto, formDTO);
return new Result<BadgeDetailResultDTO>().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<List<BadgeAuditingResultDTO>> auditingList(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, BadgeFormDTO.AuditGroup.class);
List<BadgeAuditingResultDTO> result = badgeService.auditingList(tokenDto, formDTO);
return new Result<List<BadgeAuditingResultDTO>>().ok(result);
}
@ -130,6 +133,7 @@ public class BadgeController {
*/
@PostMapping("auditrecord")
public Result<List<BadgeAuditRecordResultDTO>> auditRecord(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, BadgeFormDTO.AuditGroup.class);
List<BadgeAuditRecordResultDTO> result = badgeService.auditRecord(tokenDto, formDTO);
return new Result<List<BadgeAuditRecordResultDTO>>().ok(result);
}
@ -144,21 +148,8 @@ public class BadgeController {
*/
@PostMapping("audit")
public Result audit(@LoginUser TokenDto tokenDto, @RequestBody BadgeAuditFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
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();
}
}

17
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<String> pipelinedReturnKeys(String customerId){
List<String> list = redisTemplate.executePipelined(new RedisCallback<List<String>>() {
@Nullable
@Override
public List<String> doInRedis(RedisConnection connection) throws DataAccessException {
connection.openPipeline();
Set<byte[]> keys = connection.keys(redisTemplate.getKeySerializer().serialize(UserRedisKeys.getResiUserBadgeKey(customerId, null)));
return null;
}
},redisTemplate.getKeySerializer());
return list;
}
}

61
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<BadgeDao, BadgeEntity> implements BadgeService {
@Autowired
@ -74,6 +80,9 @@ public class BadgeServiceImpl extends BaseServiceImpl<BadgeDao, BadgeEntity> imp
private ResiUserBadgeService resiUserBadgeService;
@Autowired
private MessageFeignClient messageFeignClient;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Override
@ -322,6 +331,11 @@ public class BadgeServiceImpl extends BaseServiceImpl<BadgeDao, BadgeEntity> 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<BadgeDao, BadgeEntity> imp
dto.setStaffId(tokenDto.getUserId());
dto.setIsLast(BadgeConstant.YES);
dto.setAuditTime(new Date());
userBadgeCertificateRecordService.update(dto);
List<UserMessageFormDTO> msgList = new ArrayList<>();
List<WxSubscribeMessageFormDTO> 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.ZERO);
resiUserBadgeDTO.setIsOpened(NumConstant.ONE);
resiUserBadgeDTO.setCertificationAutidStatus(dto.getAuditStatus());
resiUserBadgeService.save(resiUserBadgeDTO);
List<UserMessageFormDTO> msgList = new ArrayList<>();
if(BadgeConstant.APPROVED.equals(formDTO.getAuditStatus())) {
//更新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

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

2
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

Loading…
Cancel
Save