Browse Source

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

master
yinzuomei 5 years ago
parent
commit
64d5d5bb18
  1. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PartyMemberUserIdsResultDTO.java
  2. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java
  3. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java
  4. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/ResiUserBadgeDao.java
  5. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java
  6. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java
  7. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java
  8. 88
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java
  9. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java
  10. 4
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.8__alter_useradvice_pids.sql
  11. 5
      epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml
  12. 8
      epmet-user/epmet-user-server/src/main/resources/mapper/ResiUserBadgeDao.xml
  13. 5
      epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml

4
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PartyMemberUserIdsResultDTO.java

@ -16,4 +16,8 @@ public class PartyMemberUserIdsResultDTO implements Serializable {
private String userId;
private Boolean reStatus;
public PartyMemberUserIdsResultDTO() {
this.reStatus = false;
}
}

12
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java

@ -127,4 +127,16 @@ public class UserBadgeController {
Boolean aBoolean = userBadgeService.addUserPartyBadgeRecord(tokenDto, formDTO);
return new Result().ok(aBoolean);
}
/**
* @Description 初始化党员徽章
* @Param userId
* @author zxc
* @date 2020/11/18 下午3:03
*/
@PostMapping("initbadge")
public Result initPartyMemberBadge(){
userBadgeService.initPartyMemberBadge(null);
return new Result();
}
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java

@ -110,7 +110,7 @@ public class UserBaseInfoController {
**/
@PostMapping("queryuserbaseinfo")
public Result<List<UserBaseInfoResultDTO>> queryUserBaseInfo(@RequestBody List<String> userIdList) {
List<UserBaseInfoResultDTO> list = userBaseInfoService.queryUserBaseInfoFromCache(userIdList);
List<UserBaseInfoResultDTO> list = userBaseInfoService.queryUserBaseInfo(userIdList);
return new Result<List<UserBaseInfoResultDTO>>().ok(list);
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/ResiUserBadgeDao.java

@ -43,4 +43,6 @@ public interface ResiUserBadgeDao extends BaseDao<ResiUserBadgeEntity> {
*/
void insertResiUserBadge(@Param("badges")List<ResiUserBadgeDTO> badges);
List<String> selectUserIds();
}

3
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java

@ -22,6 +22,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserRoleDTO;
import com.epmet.dto.form.GetRoleKeyListFormDTO;
import com.epmet.dto.form.UserRoleFormDTO;
import com.epmet.dto.result.PartyMemberUserIdsResultDTO;
import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.entity.UserRoleEntity;
import org.apache.ibatis.annotations.Mapper;
@ -79,5 +80,5 @@ public interface UserRoleDao extends BaseDao<UserRoleEntity> {
* @author zxc
* @date 2020/11/18 上午10:50
*/
List<String> selectPartyMemberUserIds();
List<PartyMemberUserIdsResultDTO> selectPartyMemberUserIds();
}

10
epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java

@ -96,8 +96,16 @@ public interface UserBadgeService {
* @Description 批量获取用户显示徽章
* @author wangc
* @date 2020.11.10 15:12
*/
Map<String,List<UserBadgeInfoResultDTO>> getBatchUserSortedBadge(String customerId, List<String> userIds);
/**
* @Description 初始化党员徽章
* @Param userId
* @author zxc
* @date 2020/11/18 下午3:03
*/
Map<String, List<UserBadgeInfoResultDTO>> getBatchUserSortedBadge(String customerId, List<String> userIds);
void initPartyMemberBadge(String userId);
/**
* desc: 添加用户党员徽章记录

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java

@ -116,7 +116,7 @@ public interface UserBaseInfoService extends BaseService<UserBaseInfoEntity> {
* @description 传入用户id集合返回用户的基本信息包含微信基本信息
* @Date 2020/7/22 9:35
**/
List<UserBaseInfoResultDTO> queryUserBaseInfoFromCache(List<String> userIdList);
List<UserBaseInfoResultDTO> queryUserBaseInfo(List<String> userIdList);
/**
* @return void

88
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java

@ -30,6 +30,11 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
@ -123,17 +128,78 @@ public class UserBadgeServiceImpl implements UserBadgeService {
return userOperListResultDTOS;
}
public void initPartyMemberBadge(){
List<String> userIds = userRoleDao.selectPartyMemberUserIds();
if (CollectionUtils.isEmpty(userIds)){
return;
}
List<UserBaseInfoResultDTO> userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfo(userIds);
if (CollectionUtils.isEmpty(userBaseInfoResultDTOS)){
log.error("未查询到党员基本信息......");
throw new RenException("未查询到党员基本信息......");
/**
* @Description 初始化党员徽章
* @Param userId
* @author zxc
* @date 2020/11/18 下午3:04
*/
@Override
public void initPartyMemberBadge(String userId){
List<String> userIds = resiUserBadgeDao.selectUserIds();
List<ResiUserBadgeDTO> badges = new ArrayList<>();
String partyBadgeId = badgeDao.getPartyBadgeId(null);
if (StringUtils.isEmpty(userId)) {
List<PartyMemberUserIdsResultDTO> partyMemberUserIds = userRoleDao.selectPartyMemberUserIds();
if (CollectionUtils.isEmpty(partyMemberUserIds)) {
return;
}
if (!CollectionUtils.isEmpty(userIds)) {
userIds.stream().forEach(u -> partyMemberUserIds.stream().filter(p -> u.equals(p.getUserId())).forEach(p -> p.setReStatus(true)));
}
List<String> reUserIds = partyMemberUserIds.stream().filter(p -> !p.getReStatus()).map(p -> p.getUserId()).collect(Collectors.toList());
List<UserBaseInfoResultDTO> userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfo(reUserIds);
if (CollectionUtils.isEmpty(userBaseInfoResultDTOS)) {
log.error("未查询到党员基本信息......");
throw new RenException("未查询到党员基本信息......");
}
userBaseInfoResultDTOS.forEach(u -> {
ResiUserBadgeDTO dto = new ResiUserBadgeDTO();
dto.setBadgeId(partyBadgeId);
dto.setCertificationAutidStatus("approved");
dto.setCustomerId(u.getCustomerId());
dto.setGridId(u.getRegisteredGridId());
dto.setIsOpened(NumConstant.ZERO);
badges.add(dto);
});
resiUserBadgeDao.insertResiUserBadge(badges);
}else {
List<String> oneUserIds = new ArrayList<>();
oneUserIds.add(userId);
List<UserBaseInfoResultDTO> userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfo(oneUserIds);
if (!CollectionUtils.isEmpty(userIds)) {
AtomicReference<Boolean> status = new AtomicReference<>(true);
userIds.forEach(u -> {
if(u.equals(userId)){
status.set(false);
}
});
if (status.get()==false){
return;
}else {
userBaseInfoResultDTOS.forEach(u -> {
ResiUserBadgeDTO dto = new ResiUserBadgeDTO();
dto.setBadgeId(partyBadgeId);
dto.setCertificationAutidStatus("approved");
dto.setCustomerId(u.getCustomerId());
dto.setGridId(u.getRegisteredGridId());
dto.setIsOpened(NumConstant.ZERO);
badges.add(dto);
});
}
}else {
userBaseInfoResultDTOS.forEach(u -> {
ResiUserBadgeDTO dto = new ResiUserBadgeDTO();
dto.setBadgeId(partyBadgeId);
dto.setCertificationAutidStatus("approved");
dto.setCustomerId(u.getCustomerId());
dto.setGridId(u.getRegisteredGridId());
dto.setIsOpened(NumConstant.ZERO);
badges.add(dto);
});
}
resiUserBadgeDao.insertResiUserBadge(badges);
}
// badgeDao.getPartyBadgeId()
}
/**
@ -155,7 +221,7 @@ public class UserBadgeServiceImpl implements UserBadgeService {
UserBadgeCertificateRecordDTO form = ConvertUtils.sourceToTarget(certificationAddFormDTO, UserBadgeCertificateRecordDTO.class);
List<String> userIds = new ArrayList<>();
userIds.add(certificationAddFormDTO.getUserId());
List<UserBaseInfoResultDTO> userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfoFromCache(userIds);
List<UserBaseInfoResultDTO> userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfo(userIds);
if (CollectionUtils.isEmpty(userBaseInfoResultDTOS)){
throw new RenException("查询用户基本信息集合为空......");
}

4
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java

@ -141,7 +141,7 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us
if (StringUtils.isBlank(userId)) {
throw new RenException("用户Id不能为空");
}
List<UserBaseInfoResultDTO> userBaseInfoResultDTOS = this.queryUserBaseInfoFromCache(Arrays.asList(userId));
List<UserBaseInfoResultDTO> userBaseInfoResultDTOS = this.queryUserBaseInfo(Arrays.asList(userId));
if (CollectionUtils.isEmpty(userBaseInfoResultDTOS)) {
logger.warn("queryUserBaseInfo return empty,userId:{}", userId);
return null;
@ -157,7 +157,7 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us
* @Date 2020/7/22 9:35
**/
@Override
public List<UserBaseInfoResultDTO> queryUserBaseInfoFromCache(List<String> userIdList) {
public List<UserBaseInfoResultDTO> queryUserBaseInfo(List<String> userIdList) {
if (null == userIdList || userIdList.size() < 1) {
return new ArrayList<>();
}

4
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.8__alter_useradvice_pids.sql

@ -0,0 +1,4 @@
ALTER TABLE `user_advice` DROP COLUMN `AGENCY_PIDS`;
ALTER TABLE `user_advice`
ADD COLUMN `AGENCY_PIDS` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `AGENCY_ID`;

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

@ -275,7 +275,12 @@
badge
WHERE
DEL_FLAG = '0'
<if test="customerId != null and customerId != '' ">
AND (CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} OR CUSTOMER_ID = 'default')
</if>
<if test="customerId == null and customerId == '' ">
AND CUSTOMER_ID = 'default'
</if>
AND FIXATION_BADGE_TYPE = 'party'
order by CREATED_TIME desc LIMIT 1
</select>

8
epmet-user/epmet-user-server/src/main/resources/mapper/ResiUserBadgeDao.xml

@ -16,9 +16,7 @@
CERTIFICATION_AUTID_STATUS,
DEL_FLAG,
REVISION,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME
)
VALUES
@ -33,13 +31,15 @@
#{b.certificationAutidStatus},
#{b.delFlag},
#{b.revision},
#{b.createdBy},
NOW(),
#{b.updatedBy},
NOW(),
)
</foreach>
</insert>
<select id="selectUserIds" resultType="java.lang.String">
SELECT USER_ID FROM resi_user_badge WHERE DEL_FLAG = 0
</select>
</mapper>

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

@ -102,13 +102,14 @@
</select>
<!-- 查询所有党员UserId -->
<select id="selectPartyMemberUserIds" resultType="java.lang.String">
<select id="selectPartyMemberUserIds" resultType="com.epmet.dto.result.PartyMemberUserIdsResultDTO">
SELECT
ur.USER_ID
FROM user_role ur
LEFT JOIN epmet_role er ON er.ID = ur.ROLE_ID
LEFT JOIN epmet_role er ON er.ID = ur.ROLE_ID
WHERE ur.DEL_FLAG = 0
AND er.DEL_FLAG = 0
AND er.ROLE_KEY = 'partymember'
</select>
</mapper>

Loading…
Cancel
Save