From 63e7cc4dad234ffd0e06fca0e2ff5fb93b558c63 Mon Sep 17 00:00:00 2001 From: wangchao Date: Tue, 28 Jul 2020 09:24:18 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=A7=AF=E5=88=86=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/PointAdjustmentLogDTO.java | 106 ++++++++ .../epmet/dto/PointVerificationLogDTO.java | 10 - .../epmet/dto/form/CommonPageUserFormDTO.java | 29 ++ .../dto/form/PointAdjustmentFormDTO.java | 56 ++++ .../dto/form/PointVerificationFormDTO.java | 53 ++++ .../dto/form/ResiCommonUserIdFormDTO.java | 4 +- .../epmet/dto/form/ResiPointRankFormDTO.java | 20 +- .../form/WorkPointVerificationFormDTO.java | 32 +++ .../dto/result/PointAdjustmentResultDTO.java | 36 +++ .../result/PointVerificationResultDTO.java | 36 +++ .../result/ResiPointRankListResultDTO.java | 2 +- .../WorkPointVerficationListResultDTO.java | 27 ++ .../WorkPointVerificationDetailResultDTO.java | 33 +++ .../WorkPointVerificationLogResultDTO.java | 38 +++ .../feign/EpmetPointOpenFeignClient.java | 15 + .../EpmetPointOpenFeignClientFallback.java | 9 + .../epmet-point/epmet-point-server/pom.xml | 6 + .../controller/AdjustmentController.java | 59 ++++ .../epmet/controller/ExchangeController.java | 2 + .../epmet/controller/ResiPointController.java | 122 ++++++++- .../com/epmet/dao/PointAdjustmentLogDao.java | 46 ++++ .../epmet/dao/PointVerificationLogDao.java | 12 + .../PointVerificationStatisticalDailyDao.java | 11 +- .../dao/UserPointStatisticalDailyDao.java | 8 + .../java/com/epmet/dao/UserPointTotalDao.java | 9 + .../entity/PointAdjustmentLogEntity.java | 76 ++++++ .../entity/PointVerificationLogEntity.java | 10 - .../main/java/com/epmet/redis/PointRedis.java | 18 ++ .../service/PointAdjustmentLogService.java | 126 +++++++++ .../service/PointVerificationLogService.java | 28 +- ...ntVerificationStatisticalDailyService.java | 9 + .../service/UserPointActionLogService.java | 7 +- .../UserPointStatisticalDailyService.java | 11 +- .../epmet/service/UserPointTotalService.java | 31 +++ .../impl/PointAdjustmentLogServiceImpl.java | 242 +++++++++++++++++ .../impl/PointVerificationLogServiceImpl.java | 256 +++++++++++++++++- ...rificationStatisticalDailyServiceImpl.java | 18 ++ .../impl/UserPointActionLogServiceImpl.java | 10 +- .../UserPointStatisticalDailyServiceImpl.java | 113 +++++++- .../impl/UserPointTotalServiceImpl.java | 137 +++++++++- .../java/com/epmet/utils/DimIdGenerator.java | 91 +++++++ .../java/com/epmet/utils/ModuleConstant.java | 55 +++- .../mapper/PointAdjustmentLogDao.xml | 43 +++ .../mapper/PointVerificationLogDao.xml | 20 +- .../PointVerificationStatisticalDailyDao.xml | 14 + .../mapper/UserPointStatisticalDailyDao.xml | 20 ++ .../resources/mapper/UserPointTotalDao.xml | 15 + .../epmet/feign/GovOrgOpenFeignClient.java | 10 + .../GovOrgOpenFeignClientFallback.java | 6 + .../dto/result/MyResiUserInfoResultDTO.java | 4 + .../impl/PartyMemberConfirmServiceImpl.java | 18 +- .../epmet/dto/form/CustomerUserFormDTO.java | 34 +++ .../epmet/dto/form/IssueInitiatorFormDTO.java | 5 + .../result/CustomerUserDetailResultDTO.java | 51 ++++ .../dto/result/CustomerUserResultDTO.java | 41 +++ .../dto/result/MyResiUserInfoResultDTO.java | 5 + .../dto/result/StaffEtAgencyResultDTO.java | 42 +++ .../dto/result/UserBaseInfoResultDTO.java | 21 ++ .../epmet/feign/EpmetUserOpenFeignClient.java | 41 +++ .../EpmetUserOpenFeignClientFallback.java | 49 ++++ epmet-user/epmet-user-server/pom.xml | 6 + .../com/epmet/constant/UserRedisKeys.java | 26 ++ .../controller/CustomerStaffController.java | 15 +- .../controller/GridLatestController.java | 15 + .../controller/UserBaseInfoController.java | 31 ++- .../com/epmet/controller/UserController.java | 7 +- .../java/com/epmet/dao/GridLatestDao.java | 9 + .../com/epmet/dao/RegisterRelationDao.java | 8 + .../java/com/epmet/dao/UserWechatDao.java | 11 + .../OperRoleUserFeignClientFallBack.java | 2 +- .../com/epmet/redis/UserBaseInfoRedis.java | 99 ++++++- .../epmet/service/CustomerStaffService.java | 9 + .../com/epmet/service/GridLatestService.java | 11 + .../epmet/service/UserBaseInfoService.java | 19 ++ .../impl/CustomerStaffServiceImpl.java | 26 ++ .../service/impl/GridLatestServiceImpl.java | 47 +++- .../impl/RegisterRelationServiceImpl.java | 1 + .../service/impl/UserBaseInfoServiceImpl.java | 56 ++++ .../service/impl/UserResiInfoServiceImpl.java | 25 +- .../epmet/service/impl/UserServiceImpl.java | 22 ++ .../java/com/epmet/util/ModuleConstant.java | 15 + .../main/resources/mapper/GridLatestDao.xml | 11 + .../resources/mapper/RegisterRelationDao.xml | 14 + .../main/resources/mapper/UserWechatDao.xml | 23 ++ 84 files changed, 2872 insertions(+), 94 deletions(-) create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdjustmentLogDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/CommonPageUserFormDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointAdjustmentFormDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointVerificationFormDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/WorkPointVerificationFormDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointAdjustmentResultDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointVerificationResultDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerficationListResultDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerificationDetailResultDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerificationLogResultDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAdjustmentLogDao.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAdjustmentLogEntity.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/redis/PointRedis.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAdjustmentLogService.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/DimIdGenerator.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdjustmentLogDao.xml create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerUserFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerUserDetailResultDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerUserResultDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffEtAgencyResultDTO.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRedisKeys.java diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdjustmentLogDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdjustmentLogDTO.java new file mode 100644 index 0000000000..3f75c7fecc --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdjustmentLogDTO.java @@ -0,0 +1,106 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@Data +public class PointAdjustmentLogDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 关联的积分动作Id + */ + private String actionId; + + /** + * 调整人名称【xx机关-xx】 + */ + private String operatorName; + + /** + * 调整原因 + */ + private String adjustReason; + + /** + * 调整积分 + */ + private Integer point; + + /** + * plus/minus + */ + private String adjustmentType; + + /** + * 调整人所属机关Id + */ + private String operatorAgencyId; + + /** + * 居民Id + */ + private String userId; + + /** + * + */ + private String delFlag; + + /** + * + */ + private Integer revision; + + /** + * + */ + private Date createdTime; + + /** + * + */ + private String createdBy; + + /** + * + */ + private Date updatedTime; + + /** + * + */ + private String updatedBy; + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointVerificationLogDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointVerificationLogDTO.java index 8c8c1a6db1..9a570898db 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointVerificationLogDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointVerificationLogDTO.java @@ -48,16 +48,6 @@ public class PointVerificationLogDTO implements Serializable { */ private String userId; - /** - * 核销对象首次注册网格 - */ - private String userRegistedGridId; - - /** - * 核销对象首次注册网格所在机关 - */ - private String userRegistedAgnecyId; - /** * 核销人员ID */ diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/CommonPageUserFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/CommonPageUserFormDTO.java new file mode 100644 index 0000000000..3dd0e34ac9 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/CommonPageUserFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 用户Id 分页参数 + * @ClassName CommonPageUserFormDTO + * @Auth wangc + * @Date 2020-07-24 13:24 + */ +@Data +public class CommonPageUserFormDTO implements Serializable { + private static final long serialVersionUID = -6721313124444595189L; + + public interface PageUserGroup extends CustomerClientShowGroup{} + + @NotBlank(message = "获取不到用户Id" , groups = PageUserGroup.class) + private String userId; + + @Min(value = 1) + private Integer pageNo = 1; + + private Integer pageSize = 10; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointAdjustmentFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointAdjustmentFormDTO.java new file mode 100644 index 0000000000..d43c069393 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointAdjustmentFormDTO.java @@ -0,0 +1,56 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 积分调整传参积分dto + * @ClassName PointAdjustmentFormDTO + * @Auth wangc + * @Date 2020-07-27 13:36 + */ +@Data +public class PointAdjustmentFormDTO implements Serializable { + private static final long serialVersionUID = -1879530107301465633L; + + public interface PointAdjustmentGroup extends CustomerClientShowGroup{} + + /** + * 用户Id + * */ + @NotBlank(message = "用户Id不能为空", groups = PointAdjustmentGroup.class) + private String userId; + + /** + * 积分调整标识 key:add/minus + * */ + @NotBlank(message = "调整类型不能为空", groups = PointAdjustmentGroup.class) + private String adjustmentType; + + /** + * 调整的分值 + * */ + private Integer point; + + /** + * 调整原因 + * */ + @NotBlank(message = "调整原因不能为空", groups = PointAdjustmentGroup.class) + private String reason; + + /** + * 操作人Id + * */ + @NotBlank(message = "当前工作人员Id不能为空", groups = PointAdjustmentGroup.class) + private String operatorId; + + /** + * 客户Id + * */ + @NotBlank(message = "客户Id不能为空", groups = PointAdjustmentGroup.class) + private String customerId; + +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointVerificationFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointVerificationFormDTO.java new file mode 100644 index 0000000000..4a5aff0a09 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointVerificationFormDTO.java @@ -0,0 +1,53 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 积分核销传参dto + * + * @ClassName PointVerificationFormDTO + * @Auth wangc + * @Date 2020-07-27 13:45 + */ +@Data +public class PointVerificationFormDTO implements Serializable { + private static final long serialVersionUID = -154634518066538184L; + + public interface PointVerificationGroup extends CustomerClientShowGroup{} + + /** + * 用户Id + * */ + @NotBlank(message = "用户Id不能为空", groups = PointVerificationGroup.class) + private String userId; + + /** + * 核销备注 + * */ + @NotBlank(message = "核销备注不能为空", groups = PointVerificationGroup.class) + private String remark; + + /** + * 核销积分数 + * */ + @Min(0) + private Integer point; + + /** + * 操作人Id + * */ + @NotBlank(message = "当前工作人员Id不能为空", groups = PointVerificationGroup.class) + private String operatorId; + + + private String longitude; + + private String dimension; + + private String address; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiCommonUserIdFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiCommonUserIdFormDTO.java index af247b84f0..01d72ace70 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiCommonUserIdFormDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiCommonUserIdFormDTO.java @@ -16,8 +16,8 @@ import java.io.Serializable; public class ResiCommonUserIdFormDTO implements Serializable { private static final long serialVersionUID = -1961545266124776452L; - public interface UserId extends CustomerClientShowGroup{} + public interface UserIdGroup extends CustomerClientShowGroup{} - @NotBlank(message = "获取不到用户Id",groups = UserId.class) + @NotBlank(message = "获取不到用户Id",groups = UserIdGroup.class) private String userId; } diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiPointRankFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiPointRankFormDTO.java index e78baf6178..49f6d22f8a 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiPointRankFormDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiPointRankFormDTO.java @@ -1,8 +1,10 @@ package com.epmet.dto.form; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -15,19 +17,29 @@ import java.io.Serializable; public class ResiPointRankFormDTO implements Serializable { private static final long serialVersionUID = 1534061512200591149L; + public interface ResiPointRankGroup extends CustomerClientShowGroup{} + /** * 页码 * */ - @Min(1) - private Integer pageNo; + @Min(value = 1,groups = ResiPointRankGroup.class) + private Integer pageNo = 1; /** * 每页数据条数 * */ - private Integer pageSize; + private Integer pageSize = 10; /** - * 时间维度 week month + * 时间维度 week month 如果为空则按照week处理 * */ private String timeDimension; + + @NotBlank(message = "获取不到用户Id",groups = ResiPointRankGroup.class) + private String userId; + + /** + * 客户Id,不做校验,如果前端不传则使用userId查询相应的客户Id + * */ + private String customerId; } diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/WorkPointVerificationFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/WorkPointVerificationFormDTO.java new file mode 100644 index 0000000000..8741ae49c6 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/WorkPointVerificationFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 工作端核销记录传参 + * @ClassName WorkPointVerificationFormDTO + * @Auth wangc + * @Date 2020-07-24 16:25 + */ +@Data +public class WorkPointVerificationFormDTO implements Serializable { + private static final long serialVersionUID = -590822390667788693L; + + @NotBlank(message = "获取不到用户Id",groups = ResiCommonUserIdFormDTO.UserIdGroup.class) + private String staffId; + + /** + * yyyy-MM + * */ + private String timeParam; + + @Min(1) + private Integer pageNo; + + private Integer pageSize; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointAdjustmentResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointAdjustmentResultDTO.java new file mode 100644 index 0000000000..224406c199 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointAdjustmentResultDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @ClassName PointAdjustmentResultDTO + * @Auth wangc + * @Date 2020-07-27 09:45 + */ +@Data +public class PointAdjustmentResultDTO implements Serializable { + private static final long serialVersionUID = -5339173292750971212L; + + /** + * 操作日期 + * */ + private String date; + + /** + * 调整积分 + * */ + private String point; + + /** + * 调整原因 + * */ + private String reason; + + /** + * 调整人昵称 + * */ + private String staffNickname; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointVerificationResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointVerificationResultDTO.java new file mode 100644 index 0000000000..d62686d66a --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointVerificationResultDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 积分核销返参Dto + * @ClassName PointVerificationResultDTO + * @Auth wangc + * @Date 2020-07-27 13:57 + */ +@Data +public class PointVerificationResultDTO implements Serializable { + private static final long serialVersionUID = 6990717665110392389L; + + /** + * 核销成功标识 + * */ + private boolean successFlag; + + /** + * 失败原因 + * */ + private String failureReason; + + /** + * 用户(居民)昵称 + * */ + private String userNickname; + + /** + * 用户(居民)头像 + * */ + private String userHeadPhoto; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/ResiPointRankListResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/ResiPointRankListResultDTO.java index 0bcf0a4758..ab1d289bf5 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/ResiPointRankListResultDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/ResiPointRankListResultDTO.java @@ -33,5 +33,5 @@ public class ResiPointRankListResultDTO implements Serializable { /** * 积分排名列表 * */ - private List rankList; + private ResiPointRankingResultDTO rankList; } diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerficationListResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerficationListResultDTO.java new file mode 100644 index 0000000000..fea0f2d6b3 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerficationListResultDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 工作端积分核销记录列表 + * @ClassName WorkPointVerficationListResultDTO + * @Auth wangc + * @Date 2020-07-24 15:38 + */ +@Data +public class WorkPointVerficationListResultDTO implements Serializable { + private static final long serialVersionUID = 2737976236826002595L; + + /** + * 当月总积分 + * */ + private Integer totalPoint; + + /** + * 核销列表 + * */ + List checkingList; +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerificationDetailResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerificationDetailResultDTO.java new file mode 100644 index 0000000000..694c80a1cd --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerificationDetailResultDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 工作端积分核销显示记录 + * @ClassName WorkPointVerificationDetailResultDTO + * @Auth wangc + * @Date 2020-07-24 15:38 + */ +@Data +public class WorkPointVerificationDetailResultDTO implements Serializable { + private static final long serialVersionUID = -205177259417194562L; + + /** + * 被核销用户昵称 + * */ + private String userNickname; + + /** + * 核销积分 "-100" + * */ + private String point; + + /** + * 核销备注 + * */ + private String remark; + + +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerificationLogResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerificationLogResultDTO.java new file mode 100644 index 0000000000..0cc4689899 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerificationLogResultDTO.java @@ -0,0 +1,38 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 工作端积分核销记录 + * @ClassName WorkPointVerificationLogResultDTO + * @Auth wangc + * @Date 2020-07-24 15:38 + */ +@Data +public class WorkPointVerificationLogResultDTO implements Serializable { + private static final long serialVersionUID = -3570820382554221450L; + + /** + * 积分 + * */ + private Integer point; + + /** + * 用户Id + * */ + private String userId; + + /** + * 日期 yyyy-MM-dd HH:mm:ss + * */ + private String date; + + /** + * 核销备注 + * */ + private String remark; + + +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/feign/EpmetPointOpenFeignClient.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/feign/EpmetPointOpenFeignClient.java index 643542bddc..5598ff8732 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/feign/EpmetPointOpenFeignClient.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/feign/EpmetPointOpenFeignClient.java @@ -1,8 +1,13 @@ package com.epmet.feign; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.ResiPointDetailResultDTO; import com.epmet.feign.fallback.EpmetPointOpenFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -12,4 +17,14 @@ import org.springframework.cloud.openfeign.FeignClient; */ @FeignClient(name = ServiceConstant.EPMET_HEART_SERVER, fallback = EpmetPointOpenFeignClientFallback.class) public interface EpmetPointOpenFeignClient { + + /** + * @Description 获取指定居民的积分信息 + * @param dto + * @return + * @author wangc + * @date 2020.07.22 15:58 + **/ + @GetMapping("mypoint") + Result myPoint(TokenDto dto); } diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/feign/fallback/EpmetPointOpenFeignClientFallback.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/feign/fallback/EpmetPointOpenFeignClientFallback.java index 7dfd5ee983..188881efd8 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/feign/fallback/EpmetPointOpenFeignClientFallback.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/feign/fallback/EpmetPointOpenFeignClientFallback.java @@ -1,5 +1,10 @@ package com.epmet.feign.fallback; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.ResiPointDetailResultDTO; import com.epmet.feign.EpmetPointOpenFeignClient; import org.springframework.stereotype.Component; @@ -11,4 +16,8 @@ import org.springframework.stereotype.Component; */ @Component public class EpmetPointOpenFeignClientFallback implements EpmetPointOpenFeignClient { + @Override + public Result myPoint(TokenDto dto) { + return ModuleUtils.feignConError(ServiceConstant.RESI_PARTYMEMBER_SERVER, "myPoint", dto); + } } diff --git a/epmet-module/epmet-point/epmet-point-server/pom.xml b/epmet-module/epmet-point/epmet-point-server/pom.xml index 49ccab5b90..31263dd1a3 100644 --- a/epmet-module/epmet-point/epmet-point-server/pom.xml +++ b/epmet-module/epmet-point/epmet-point-server/pom.xml @@ -69,6 +69,12 @@ 2.0.0 compile + + com.epmet + epmet-user-client + 2.0.0 + compile + diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java index 04d9f2c4b4..15e1980651 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java @@ -1,8 +1,23 @@ package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.CustomerUserFormDTO; +import com.epmet.dto.form.IssueInitiatorFormDTO; +import com.epmet.dto.result.CustomerUserDetailResultDTO; +import com.epmet.dto.result.CustomerUserResultDTO; +import com.epmet.dto.result.PointAdjustmentResultDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.service.PointAdjustmentLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * @description: 工作人员积分调整Controller * @date: Created in 2020-07-20 16:38 @@ -11,4 +26,48 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("work/adjustment") public class AdjustmentController { + + @Autowired + EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Autowired + PointAdjustmentLogService pointAdjustmentLogService; + /** + * @Description 调整积分时获取用户列表 + * @param param + * @return + * @author wangc + * @date 2020.07.27 10:57 + **/ + @PostMapping("userlist") + public Result> userList(@RequestBody CustomerUserFormDTO param){ + ValidatorUtils.validateEntity(param, CustomerUserFormDTO.CustomerIdGroup.class); + return epmetUserOpenFeignClient.customerUserList(param); + } + + /** + * @Description 调整积分时获取用户详情 + * @param param + * @return + * @author wangc + * @date 2020.07.27 11:15 + **/ + @PostMapping("userdetail") + public Result userDetail(@RequestBody IssueInitiatorFormDTO param){ + ValidatorUtils.validateEntity(param,IssueInitiatorFormDTO.UserIdGroup.class); + return new Result().ok(pointAdjustmentLogService.userDetail(param)); + } + + /** + * @Description 根据UserId获取积分调整记录 + * @param param :: getUserId + * @return + * @author wangc + * @date 2020.07.27 10:51 + **/ + @PostMapping("adjustrecord") + public Result> adjustRecord(@RequestBody IssueInitiatorFormDTO param){ + ValidatorUtils.validateEntity(param, IssueInitiatorFormDTO.UserIdGroup.class); + return new Result>().ok(pointAdjustmentLogService.adjustRecord(param)); + } } + diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ExchangeController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ExchangeController.java index c3bf13d4ba..8f81e46de2 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ExchangeController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ExchangeController.java @@ -11,4 +11,6 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("work/exchange") public class ExchangeController { + + } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java index 9a935771cb..f58da5b0fa 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java @@ -1,7 +1,24 @@ package com.epmet.controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +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.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.CommonPageUserFormDTO; +import com.epmet.dto.form.ResiCommonUserIdFormDTO; +import com.epmet.dto.form.ResiPointRankFormDTO; +import com.epmet.dto.result.ResiPointDetailResultDTO; +import com.epmet.dto.result.ResiPointLogListResultDTO; +import com.epmet.dto.result.ResiPointRankListResultDTO; +import com.epmet.service.PointVerificationLogService; +import com.epmet.service.UserPointActionLogService; +import com.epmet.service.UserPointStatisticalDailyService; +import com.epmet.service.UserPointTotalService; +import com.epmet.utils.ModuleConstant; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; /** * @description: 居民端积分信息controller @@ -11,4 +28,105 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("resi/point") public class ResiPointController { + + @Autowired + private UserPointTotalService userPointTotalService; + @Autowired + private UserPointStatisticalDailyService userPointStatisticalDailyService; + @Autowired + private PointVerificationLogService pointVerificationLogService; + @Autowired + private UserPointActionLogService pointActionLogService; + + /** + * @Description 获取指定居民的积分信息 + * @param dto + * @return + * @author wangc + * @date 2020.07.22 15:58 + **/ + @GetMapping("mypoint") + public Result myPoint(@LoginUser TokenDto dto){ + ResiCommonUserIdFormDTO param = new ResiCommonUserIdFormDTO(); + param.setUserId(dto.getUserId()); + ValidatorUtils.validateEntity(param,ResiCommonUserIdFormDTO.UserIdGroup.class); + return new Result().ok(userPointTotalService.getMyPoint(param)); + } + + /** + * @Description 获取客户下用户积分排名榜 + * @param dto + * @param pointRankFormDTO + * @return + * @author wangc + * @date 2020.07.22 16:13 + **/ + @PostMapping("rank") + public Result> rank(@LoginUser TokenDto dto,@RequestBody ResiPointRankFormDTO pointRankFormDTO){ + pointRankFormDTO.setUserId(dto.getUserId()); + ValidatorUtils.validateEntity(pointRankFormDTO, ResiPointRankFormDTO.ResiPointRankGroup.class); + return new Result>().ok(userPointTotalService.getPointRanking(pointRankFormDTO)); + } + + /** + * @Description 获取居民端周积分排行榜 还有当前用的信息 + * @param dto + * @param pointRankFormDTO + * @return + * @author wangc + * @date 2020.07.21 16:57 + **/ + @PostMapping("weeklyrank") + public Result> weeklyRank(@LoginUser TokenDto dto,@RequestBody ResiPointRankFormDTO pointRankFormDTO){ + pointRankFormDTO.setUserId(dto.getUserId()); + pointRankFormDTO.setTimeDimension(ModuleConstant.TIME_DIMENSION_WEEK); + ValidatorUtils.validateEntity(pointRankFormDTO, ResiPointRankFormDTO.ResiPointRankGroup.class); + return new Result>().ok(userPointStatisticalDailyService.getPointRankWithinTimeZone(pointRankFormDTO)); + } + + /** + * @Description 获取居民端月积分排行榜 还有当前用的信息 + * @param dto + * @param pointRankFormDTO + * @return + * @author wangc + * @date 2020.07.21 16:57 + **/ + @PostMapping("monthlyrank") + public Result> monthlyRank(@LoginUser TokenDto dto,@RequestBody ResiPointRankFormDTO pointRankFormDTO){ + pointRankFormDTO.setUserId(dto.getUserId()); + pointRankFormDTO.setTimeDimension(ModuleConstant.TIME_DIMENSION_MONTH); + ValidatorUtils.validateEntity(pointRankFormDTO,ResiPointRankFormDTO.ResiPointRankGroup.class); + return new Result>().ok(userPointStatisticalDailyService.getPointRankWithinTimeZone(pointRankFormDTO)); + } + + /** + * @Description 查找指定用户的积分记录 + * @param dto + * @param pageUserParam + * @return + * @author wangc + * @date 2020.07.22 14:05 + **/ + @PostMapping("records") + public Result> records(@LoginUser TokenDto dto,@RequestBody CommonPageUserFormDTO pageUserParam){ + pageUserParam.setUserId(dto.getUserId()); + ValidatorUtils.validateEntity(pageUserParam, CommonPageUserFormDTO.PageUserGroup.class); + return new Result>().ok(pointActionLogService.getMyPointRecord(pageUserParam)); + } + + /** + * @Description 查找指定用户的积分兑换记录 + * @param dto + * @param pageUserParam + * @return + * @author wangc + * @date 2020.07.22 14:05 + **/ + @PostMapping("exchangedrecord") + public Result> exchangeRecord(@LoginUser TokenDto dto,@RequestBody CommonPageUserFormDTO pageUserParam){ + pageUserParam.setUserId(dto.getUserId()); + ValidatorUtils.validateEntity(pageUserParam,CommonPageUserFormDTO.PageUserGroup.class); + return new Result>().ok(pointVerificationLogService.getMyExchangeRecord(pageUserParam)); + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAdjustmentLogDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAdjustmentLogDao.java new file mode 100644 index 0000000000..517874eacf --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAdjustmentLogDao.java @@ -0,0 +1,46 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.PointAdjustmentResultDTO; +import com.epmet.entity.PointAdjustmentLogEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@Mapper +public interface PointAdjustmentLogDao extends BaseDao { + + /** + * @Description 查询积分调整列表 + * @param userId + * @return + * @author wangc + * @date 2020.07.27 10:44 + **/ + List selectAdjustmentListByUserId(@Param("userId") String userId); + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointVerificationLogDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointVerificationLogDao.java index 4791eb6c00..9138df614f 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointVerificationLogDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointVerificationLogDao.java @@ -19,10 +19,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.result.ResiPointLogPeriodResultDTO; +import com.epmet.dto.result.WorkPointVerificationLogResultDTO; import com.epmet.entity.PointVerificationLogEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.Date; import java.util.List; /** @@ -43,4 +45,14 @@ public interface PointVerificationLogDao extends BaseDao selectVerificationLog(@Param("userId") String userId); + /** + * @Description 获取工作人员月度核销记录 + * @param staffId + * @param startDate + * @param endDate + * @return + * @author wangc + * @date 2020.07.25 13:17 + **/ + List selectStaffVerificationLog(String staffId, Date startDate, Date endDate); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointVerificationStatisticalDailyDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointVerificationStatisticalDailyDao.java index d123b66210..5880d4bc3e 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointVerificationStatisticalDailyDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointVerificationStatisticalDailyDao.java @@ -20,6 +20,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.PointVerificationStatisticalDailyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 工作人员核销数据统计 @@ -29,5 +30,13 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface PointVerificationStatisticalDailyDao extends BaseDao { - + /** + * @Description 查询指定日期的工作人员核销积分是否存在 + * @param createdBy + * @param dateId + * @return + * @author wangc + * @date 2020.07.27 17:37 + **/ + PointVerificationStatisticalDailyEntity selectIfExisted(@Param("createdBy") String createdBy, @Param("dateId") String dateId); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java index 142817ae9f..1c3352a090 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java @@ -45,4 +45,12 @@ public interface UserPointStatisticalDailyDao extends BaseDao selectPointRankWithinTimeZone(@Param("customerId") String customerId,@Param("dimension") String dimension,@Param("dimensionId") String dimensionId); + /** + * @Description 查询有无指定日期的积分日统计 + * @param userId + * @return + * @author wangc + * @date 2020.07.27 16:20 + **/ + UserPointStatisticalDailyEntity selectIfExisted(@Param("userId") String userId,@Param("dateId") String dateId,@Param("actionFlag")String actionFlag); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointTotalDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointTotalDao.java index b50249c020..9d5ebca3f6 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointTotalDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointTotalDao.java @@ -53,4 +53,13 @@ public interface UserPointTotalDao extends BaseDao { **/ List selectUserPointRank(@Param("customerId") String customerId); + /** + * @Description 根据userId查找是否存在数据 + * @param userId + * @return + * @author wangc + * @date 2020.07.27 16:51 + **/ + UserPointTotalEntity selectIfExisted(@Param("userId") String userId); + } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAdjustmentLogEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAdjustmentLogEntity.java new file mode 100644 index 0000000000..2cfdbf6e3b --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAdjustmentLogEntity.java @@ -0,0 +1,76 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("point_adjustment_log") +public class PointAdjustmentLogEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 关联的积分动作Id + */ + private String actionId; + + /** + * 调整人名称【xx机关-xx】 + */ + private String operatorName; + + /** + * 调整原因 + */ + private String adjustReason; + + /** + * 调整积分 + */ + private Integer point; + + /** + * plus/minus + */ + private String adjustmentType; + + /** + * 调整人所属机关Id + */ + private String operatorAgencyId; + + /** + * 居民Id + */ + private String userId; + +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointVerificationLogEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointVerificationLogEntity.java index 5e9de373e1..531bf9ca93 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointVerificationLogEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointVerificationLogEntity.java @@ -48,16 +48,6 @@ public class PointVerificationLogEntity extends BaseEpmetEntity { */ private String userId; - /** - * 核销对象首次注册网格 - */ - private String userRegistedGridId; - - /** - * 核销对象首次注册网格所在机关 - */ - private String userRegistedAgnecyId; - /** * 核销人员ID */ diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/redis/PointRedis.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/redis/PointRedis.java new file mode 100644 index 0000000000..4e868d150f --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/redis/PointRedis.java @@ -0,0 +1,18 @@ +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @Description 积分缓存相关 + * @ClassName PointRedis + * @Auth wangc + * @Date 2020-07-27 17:25 + */ +@Component +public class PointRedis { + + @Autowired + private RedisUtils redisUtils; +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAdjustmentLogService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAdjustmentLogService.java new file mode 100644 index 0000000000..02df12d652 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAdjustmentLogService.java @@ -0,0 +1,126 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.PointAdjustmentLogDTO; +import com.epmet.dto.form.IssueInitiatorFormDTO; +import com.epmet.dto.form.PointAdjustmentFormDTO; +import com.epmet.dto.result.CustomerUserDetailResultDTO; +import com.epmet.dto.result.PointAdjustmentResultDTO; +import com.epmet.entity.PointAdjustmentLogEntity; + +import java.util.List; +import java.util.Map; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +public interface PointAdjustmentLogService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-07-27 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-07-27 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PointAdjustmentLogDTO + * @author generator + * @date 2020-07-27 + */ + PointAdjustmentLogDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-27 + */ + void save(PointAdjustmentLogDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-27 + */ + void update(PointAdjustmentLogDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-07-27 + */ + void delete(String[] ids); + + /** + * @Description 根据UserId获取积分调整记录 + * @param param :: getUserId + * @return + * @author wangc + * @date 2020.07.27 10:51 + **/ + List adjustRecord(IssueInitiatorFormDTO param); + + /** + * @Description 用户详情 + * @param param + * @return + * @author wangc + * @date 2020.07.27 10:57 + **/ + CustomerUserDetailResultDTO userDetail(IssueInitiatorFormDTO param); + + /** + * @Description 积分调整 + * @param param + * @return + * @author wangc + * @date 2020.07.27 13:52 + **/ + void adjustPoint(PointAdjustmentFormDTO param); +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointVerificationLogService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointVerificationLogService.java index 54700cbf63..d8610aa2b0 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointVerificationLogService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointVerificationLogService.java @@ -20,8 +20,12 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.PointVerificationLogDTO; -import com.epmet.dto.form.ResiCommonUserIdFormDTO; +import com.epmet.dto.form.CommonPageUserFormDTO; +import com.epmet.dto.form.PointVerificationFormDTO; +import com.epmet.dto.form.WorkPointVerificationFormDTO; +import com.epmet.dto.result.PointVerificationResultDTO; import com.epmet.dto.result.ResiPointLogListResultDTO; +import com.epmet.dto.result.WorkPointVerficationListResultDTO; import com.epmet.entity.PointVerificationLogEntity; import java.util.List; @@ -97,10 +101,28 @@ public interface PointVerificationLogService extends BaseService getMyExchangeRecord(ResiCommonUserIdFormDTO userId); + List getMyExchangeRecord(CommonPageUserFormDTO pageUser); + + /** + * @Description 获取工作端积分核销记录 + * @param verificationParam + * @return + * @author wangc + * @date 2020.07.24 16:08 + **/ + WorkPointVerficationListResultDTO getStaffVerificationRecordMonthly(WorkPointVerificationFormDTO verificationParam); + + /** + * @Description 积分核销 + * @param verificationParam + * @return + * @author wangc + * @date 2020.07.27 14:03 + **/ + PointVerificationResultDTO verifyPoint(PointVerificationFormDTO verificationParam); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointVerificationStatisticalDailyService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointVerificationStatisticalDailyService.java index 5c7b8903b3..d48e70529b 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointVerificationStatisticalDailyService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointVerificationStatisticalDailyService.java @@ -92,4 +92,13 @@ public interface PointVerificationStatisticalDailyService extends BaseService getMyPointRecord(ResiCommonUserIdFormDTO userId); + List getMyPointRecord(CommonPageUserFormDTO pageUser); + } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointStatisticalDailyService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointStatisticalDailyService.java index b3cdc6443f..8e3616e51f 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointStatisticalDailyService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointStatisticalDailyService.java @@ -102,5 +102,14 @@ public interface UserPointStatisticalDailyService extends BaseService getPointRankWithinTimeZone(ResiPointRankFormDTO pointRankFormDTO); + + /** + * @Description 用户积分日统计新增或修改 + * @param entity + * @return + * @author wangc + * @date 2020.07.27 16:10 + **/ + void insertOrUpdate(UserPointStatisticalDailyEntity entity); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointTotalService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointTotalService.java index 04a49fbf11..c6ca4a0c3d 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointTotalService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointTotalService.java @@ -20,6 +20,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.UserPointTotalDTO; +import com.epmet.dto.form.ResiCommonUserIdFormDTO; +import com.epmet.dto.form.ResiPointRankFormDTO; +import com.epmet.dto.result.ResiPointDetailResultDTO; +import com.epmet.dto.result.ResiPointRankListResultDTO; import com.epmet.entity.UserPointTotalEntity; import java.util.List; @@ -92,4 +96,31 @@ public interface UserPointTotalService extends BaseService * @date 2020-07-20 */ void delete(String[] ids); + + /** + * @Description 获取指定居民的积分信息 + * @param userId + * @return + * @author wangc + * @date 2020.07.22 15:58 + **/ + ResiPointDetailResultDTO getMyPoint(ResiCommonUserIdFormDTO userId); + + /** + * @Description 获取客户下用户积分排名榜 + * @param pointRankFormDTO + * @return + * @author wangc + * @date 2020.07.22 16:13 + **/ + List getPointRanking(ResiPointRankFormDTO pointRankFormDTO); + + /** + * @Description 新增或修改用户总积分记录 + * @param entity + * @return + * @author wangc + * @date 2020.07.27 16:45 + **/ + void insertOrUpdate(UserPointTotalEntity entity); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java new file mode 100644 index 0000000000..220dc525e7 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java @@ -0,0 +1,242 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +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.commons.tools.utils.Result; +import com.epmet.dao.PointAdjustmentLogDao; +import com.epmet.dao.UserPointActionLogDao; +import com.epmet.dto.PointAdjustmentLogDTO; +import com.epmet.dto.form.IssueInitiatorFormDTO; +import com.epmet.dto.form.PointAdjustmentFormDTO; +import com.epmet.dto.form.ResiCommonUserIdFormDTO; +import com.epmet.dto.result.CustomerUserDetailResultDTO; +import com.epmet.dto.result.PointAdjustmentResultDTO; +import com.epmet.dto.result.ResiPointDetailResultDTO; +import com.epmet.dto.result.StaffEtAgencyResultDTO; +import com.epmet.entity.PointAdjustmentLogEntity; +import com.epmet.entity.UserPointActionLogEntity; +import com.epmet.entity.UserPointStatisticalDailyEntity; +import com.epmet.entity.UserPointTotalEntity; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.service.PointAdjustmentLogService; +import com.epmet.service.UserPointStatisticalDailyService; +import com.epmet.service.UserPointTotalService; +import com.epmet.utils.DimIdGenerator; +import com.epmet.utils.ModuleConstant; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@Service +public class PointAdjustmentLogServiceImpl extends BaseServiceImpl implements PointAdjustmentLogService { + + @Autowired + EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Autowired + UserPointTotalService userPointTotalService; + @Autowired + UserPointActionLogDao userPointActionLogDao; + @Autowired + UserPointStatisticalDailyService userPointStatisticalDailyService; + @Autowired + PointAdjustmentLogDao pointAdjustmentLogDao; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PointAdjustmentLogDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PointAdjustmentLogDTO.class); + } + + 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); + + return wrapper; + } + + @Override + public PointAdjustmentLogDTO get(String id) { + PointAdjustmentLogEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PointAdjustmentLogDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PointAdjustmentLogDTO dto) { + PointAdjustmentLogEntity entity = ConvertUtils.sourceToTarget(dto, PointAdjustmentLogEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PointAdjustmentLogDTO dto) { + PointAdjustmentLogEntity entity = ConvertUtils.sourceToTarget(dto, PointAdjustmentLogEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @Description 根据UserId获取积分调整记录 + * @param param :: getUserId + * @return + * @author wangc + * @date 2020.07.27 10:51 + **/ + @Override + public List adjustRecord(IssueInitiatorFormDTO param) { + return baseDao.selectAdjustmentListByUserId(param.getUserId()); + } + + + /** + * @Description 用户详情 + * @param param + * @return + * @author wangc + * @date 2020.07.27 10:57 + **/ + @Override + public CustomerUserDetailResultDTO userDetail(IssueInitiatorFormDTO param) { + Result detailResult = epmetUserOpenFeignClient.customerUserDetail(param); + if(!detailResult.success()){ + throw new RenException(detailResult.getCode()); + } + ResiCommonUserIdFormDTO userParam = ConvertUtils.sourceToTarget(param,ResiCommonUserIdFormDTO.class); + ResiPointDetailResultDTO pointDto = userPointTotalService.getMyPoint(userParam); + if(null != detailResult.getData()){ + CustomerUserDetailResultDTO result = new CustomerUserDetailResultDTO(); + result.setPoint(null != pointDto ? pointDto.getUsablePoint() : NumConstant.ZERO); + } + detailResult.getData().setPoint(null != pointDto ? pointDto.getUsablePoint() : NumConstant.ZERO); + return detailResult.getData(); + } + + /** + * @Description 积分调整 + * @param param + * @return + * @author wangc + * @date 2020.07.27 13:52 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public void adjustPoint(PointAdjustmentFormDTO param) { + if(null == param.getPoint()) throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + Date currentTime = new Date(); + Integer point = param.getPoint(); + if(StringUtils.equals(ModuleConstant.OPERATION_TYPE_MINUS,param.getAdjustmentType())){ + if(point > NumConstant.ZERO){ + point *= NumConstant.ONE_NEG; + } + }else{ + if(point < NumConstant.ZERO){ + point *= NumConstant.ONE_NEG; + } + } + //0.工作人员基本信息[agencyId 昵称] + IssueInitiatorFormDTO staffParam = new IssueInitiatorFormDTO(); + staffParam.setUserId(param.getOperatorId()); + Result staffResult = + epmetUserOpenFeignClient.staffMsg(staffParam); + String agencyId = ModuleConstant.EMPTY_STR; + String operatorName = ModuleConstant.EMPTY_STR; + if(staffResult.success() && null != staffResult.getData()){ + agencyId = staffResult.getData().getAgencyId(); + operatorName = staffResult.getData().getNickname(); + } + //1.记录用户积分行为记录表 + UserPointActionLogEntity userPointActionEntity = new UserPointActionLogEntity(); + userPointActionEntity.setUserId(param.getUserId()); + userPointActionEntity.setCustomerId(param.getCustomerId()); + userPointActionEntity.setActionFlag(param.getAdjustmentType()); + userPointActionEntity.setPoint(point); + userPointActionEntity.setEventStatement(param.getReason()); + userPointActionEntity.setEventName(ModuleConstant.EVENT_NAME_ADJUSTMENT); + userPointActionEntity.setOperatorAgencyId(agencyId); + userPointActionLogDao.insert(userPointActionEntity); + //2.记录积分调整记录表 + PointAdjustmentLogEntity adjustmentEntity = new PointAdjustmentLogEntity(); + adjustmentEntity.setActionId(userPointActionEntity.getId()); + adjustmentEntity.setOperatorName(operatorName); + adjustmentEntity.setAdjustReason(param.getReason()); + adjustmentEntity.setAdjustmentType(param.getAdjustmentType()); + adjustmentEntity.setPoint(point); + adjustmentEntity.setOperatorAgencyId(agencyId); + adjustmentEntity.setUserId(param.getUserId()); + //此处设置无效,会拦截到当前请求token中的userId,实际与这里的operatorId一致 + adjustmentEntity.setCreatedBy(param.getOperatorId()); + pointAdjustmentLogDao.insert(adjustmentEntity); + //3.新增或更新用户积分日统计表 + DimIdGenerator.DimIdBean dim = DimIdGenerator.getDimIdBean(currentTime); + UserPointStatisticalDailyEntity statistical = ConvertUtils.sourceToTarget(dim,UserPointStatisticalDailyEntity.class); + statistical.setUserId(param.getUserId()); + statistical.setActionFlag(param.getAdjustmentType()); + statistical.setCustomerId(param.getCustomerId()); + statistical.setPointChange(point); + userPointStatisticalDailyService.insertOrUpdate(statistical); + //4.更新用户积分总表 + UserPointTotalEntity total = new UserPointTotalEntity(); + total.setUserId(param.getUserId()); + total.setCustomerId(param.getCustomerId()); + //增量 + total.setUsedPoint(NumConstant.ZERO); + total.setUsablePoint(point); + total.setTotalPoint(point); + userPointTotalService.insertOrUpdate(total); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationLogServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationLogServiceImpl.java index 6b48127276..0cfe6d642f 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationLogServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationLogServiceImpl.java @@ -20,25 +20,42 @@ 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.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.PointVerificationLogDao; +import com.epmet.dao.UserPointActionLogDao; import com.epmet.dto.PointVerificationLogDTO; -import com.epmet.dto.form.ResiCommonUserIdFormDTO; -import com.epmet.dto.result.ResiPointLogListResultDTO; -import com.epmet.dto.result.ResiPointLogPeriodResultDTO; -import com.epmet.entity.PointVerificationLogEntity; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; +import com.epmet.entity.*; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.redis.PointRedis; import com.epmet.service.PointVerificationLogService; +import com.epmet.service.PointVerificationStatisticalDailyService; +import com.epmet.service.UserPointStatisticalDailyService; +import com.epmet.service.UserPointTotalService; +import com.epmet.utils.DimIdGenerator; +import com.epmet.utils.ModuleConstant; +import com.github.pagehelper.PageHelper; import com.google.common.collect.Maps; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; +import java.text.SimpleDateFormat; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.ZoneId; +import java.util.*; import java.util.stream.Collectors; /** @@ -50,6 +67,22 @@ import java.util.stream.Collectors; @Service public class PointVerificationLogServiceImpl extends BaseServiceImpl implements PointVerificationLogService { + protected final Logger logger = LoggerFactory.getLogger(getClass()); + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Autowired + private UserPointTotalService userPointTotalService; + @Autowired + private PointVerificationLogDao pointVerificationLogDao; + @Autowired + private PointVerificationStatisticalDailyService pointVerificationStatisticalDailyService; + @Autowired + PointRedis pointRedis; + @Autowired + private UserPointActionLogDao userPointActionLogDao; + @Autowired + private UserPointStatisticalDailyService userPointStatisticalDailyService; + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -104,14 +137,15 @@ public class PointVerificationLogServiceImpl extends BaseServiceImpl getMyExchangeRecord(ResiCommonUserIdFormDTO userId) { - List logList = baseDao.selectVerificationLog(userId.getUserId()); + public List getMyExchangeRecord(CommonPageUserFormDTO pageUser) { + PageHelper.startPage(pageUser.getPageNo(),pageUser.getPageSize()); + List logList = baseDao.selectVerificationLog(pageUser.getUserId()); List result = new LinkedList<>(); if(null != logList && !logList.isEmpty()){ Map> map = @@ -130,4 +164,204 @@ public class PointVerificationLogServiceImpl extends BaseServiceImpl resultObj = new LinkedList<>(); + + try{ + Date date = format.parse(verificationParam.getTimeParam()); + List dataList = + baseDao.selectStaffVerificationLog(verificationParam.getStaffId(),getFirstDayDateOfMonth(date),getLastDayOfMonth(date)); + result.setTotalPoint( + dataList.stream().mapToInt(o -> o.getPoint()).sum() + ); + List userIds = dataList.stream().map(data -> data.getUserId()).collect(Collectors.toList()); + Result> userInfo = + epmetUserOpenFeignClient.queryUserBaseInfo(userIds); + boolean userRequestCallback = userInfo.success() && null != userInfo.getData() && !userInfo.getData().isEmpty(); + for(int i = NumConstant.ZERO ; i < dataList.size() ; i++){ + + WorkPointVerificationDetailResultDTO o = new WorkPointVerificationDetailResultDTO(); + o.setPoint(new StringBuilder("-").append(dataList.get(i).getPoint().toString()).toString()); + o.setRemark(dataList.get(i).getRemark()); + if(userRequestCallback) { + //如果是陌生人显示微信昵称 + o.setUserNickname(userInfo.getData().get(i) == null ? ModuleConstant.EMPTY_STR : (StringUtils.isBlank(userInfo.getData().get(i).getShowName()) ? userInfo.getData().get(i).getNickname() : userInfo.getData().get(i).getShowName())); + } + resultObj.add(o); + } + + }catch (Exception e){ + logger.error(String.format(ModuleConstant.DATE_TRANSLATION_ERROR,e.getMessage())); + } + result.setCheckingList(resultObj); + return result; + } + + /** + * @Description 积分核销 + * @param verificationParam + * @return + * @author wangc + * @date 2020.07.27 14:03 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public PointVerificationResultDTO verifyPoint(PointVerificationFormDTO verificationParam) { + Date currentTime = new Date(); + PointVerificationResultDTO result = new PointVerificationResultDTO(); + ResiCommonUserIdFormDTO userId = new ResiCommonUserIdFormDTO(); + userId.setUserId(verificationParam.getUserId()); + ResiPointDetailResultDTO currentPoint = userPointTotalService.getMyPoint(userId); + if(null == currentPoint || null == currentPoint.getUsablePoint() || currentPoint.getUsablePoint() < verificationParam.getPoint()){ + result.setSuccessFlag(false); + result.setFailureReason(ModuleConstant.POINT_NOT_ENOUGH); + return result; + } + IssueInitiatorFormDTO staffId = new IssueInitiatorFormDTO(); + staffId.setUserId(verificationParam.getOperatorId()); + Result staffResult = + epmetUserOpenFeignClient.staffMsg(staffId); + //保证积分为负数,因为是积分核销,只有在积分核销日统计和积分核销日志里存储正数 + Integer point = verificationParam.getPoint(); + if(point > NumConstant.ZERO){ + point *= NumConstant.ONE_NEG; + } + + String customerId = ModuleConstant.EMPTY_STR; + + String agencyId = ModuleConstant.EMPTY_STR; + String operatorName = ModuleConstant.EMPTY_STR; + PointVerificationStatisticalDailyEntity statistical = new PointVerificationStatisticalDailyEntity(); + if(staffResult.success() && null != staffResult.getData()){ + statistical = ConvertUtils.sourceToTarget(staffResult.getData(),PointVerificationStatisticalDailyEntity.class); + customerId = staffResult.getData().getCustomerId(); + operatorName = staffResult.getData().getNickname(); + agencyId = staffResult.getData().getAgencyId(); + } + + //1.记录积分行为日志 - 居民端 + UserPointActionLogEntity action = new UserPointActionLogEntity(); + action.setCreatedBy(verificationParam.getOperatorId()); + action.setUserId(verificationParam.getUserId()); + action.setActionFlag(ModuleConstant.OPERATION_TYPE_MINUS); + action.setEventName(ModuleConstant.EVENT_NAME_EXCHANGE); + action.setEventStatement(verificationParam.getRemark()); + action.setPoint(point); + userPointActionLogDao.insert(action); + //2.记录积分核销日志表 + PointVerificationLogEntity verificationLog = new PointVerificationLogEntity(); + verificationLog.setActionId(action.getId()); + verificationLog.setUserId(verificationParam.getUserId()); + verificationLog.setOperatorId(verificationParam.getOperatorId()); + verificationLog.setOperatorName(operatorName); + verificationLog.setOperatorAgencyId(agencyId); + verificationLog.setExchangedItem(verificationParam.getRemark()); + verificationLog.setPoint(point * NumConstant.ONE_NEG); + verificationLog.setLongitude(verificationParam.getLongitude()); + verificationLog.setDimension(verificationParam.getDimension()); + verificationLog.setAddress(verificationParam.getAddress()); + pointVerificationLogDao.insert(verificationLog); + //3.记录积分日统计表 + DimIdGenerator.DimIdBean dim = DimIdGenerator.getDimIdBean(currentTime); + UserPointStatisticalDailyEntity userStatistical = ConvertUtils.sourceToTarget(dim,UserPointStatisticalDailyEntity.class); + userStatistical.setUserId(verificationParam.getUserId()); + userStatistical.setActionFlag(ModuleConstant.OPERATION_TYPE_EXCHANGE); + userStatistical.setCustomerId(customerId); + userStatistical.setPointChange(point); + userPointStatisticalDailyService.insertOrUpdate(userStatistical); + //4.记录积分核销日统计 - 政府端 + statistical.setVerificatedPoint(point * NumConstant.ONE_NEG); + pointVerificationStatisticalDailyService.insertOrUpdate(statistical); + //5.更新用户总积分表 + UserPointTotalEntity userPoint = new UserPointTotalEntity(); + userPoint.setUserId(verificationParam.getUserId()); + userPoint.setCustomerId(customerId); + //负数 + userPoint.setTotalPoint(point); + //负数 + userPoint.setUsablePoint(point); + //正数 + userPoint.setUsedPoint(point * NumConstant.ONE_NEG); + userPointTotalService.insertOrUpdate(userPoint); + //6.将核销结果记录redis(List) key -> [epmet:point:verification:userId] lpush #新元素插入表头 lindex key 0 #表头 + + result.setSuccessFlag(true); + List userParam = new LinkedList<>(); + userParam.add(verificationParam.getUserId()); + Result> userResult = + epmetUserOpenFeignClient.queryUserBaseInfo(userParam); + String userHeadPhoto = ModuleConstant.EMPTY_STR; + String userNickname = ModuleConstant.EMPTY_STR; + if(userResult.success() && null != userResult.getData() && !userResult.getData().isEmpty()){ + userHeadPhoto = userResult.getData().get(NumConstant.ZERO).getHeadImgUrl(); + userNickname = userResult.getData().get(NumConstant.ZERO).getShowName(); + } + result.setUserHeadPhoto(userHeadPhoto); + result.setUserNickname(userNickname); + return result; + } + + /** + * @Description 得到指定日所在月第一天 + * @param date + * @return + * @author wangc + * @date 2020.07.27 17:21 + **/ + private static Date getFirstDayDateOfMonth(final Date date) { + + final Calendar cal = Calendar.getInstance(); + + cal.setTime(date); + + final int last = cal.getActualMinimum(Calendar.DAY_OF_MONTH); + + cal.set(Calendar.DAY_OF_MONTH, last); + + LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(cal.getTimeInMillis()), ZoneId.systemDefault()); + LocalDateTime startOfDay = localDateTime.with(LocalTime.MIN); + return Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant()); + + + } + + /** + * @Description 得到指定日所在月最后一天 + * @param date + * @return + * @author wangc + * @date 2020.07.27 17:21 + **/ + public static Date getLastDayOfMonth(final Date date) { + + final Calendar cal = Calendar.getInstance(); + + cal.setTime(date); + + final int last = cal.getActualMaximum(Calendar.DAY_OF_MONTH); + + cal.set(Calendar.DAY_OF_MONTH, last); + + LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(cal.getTimeInMillis()), ZoneId.systemDefault());; + LocalDateTime endOfDay = localDateTime.with(LocalTime.MAX); + return Date.from(endOfDay.atZone(ZoneId.systemDefault()).toInstant()); + + + } } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationStatisticalDailyServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationStatisticalDailyServiceImpl.java index b1802b95cd..195d5fe3d8 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationStatisticalDailyServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationStatisticalDailyServiceImpl.java @@ -97,4 +97,22 @@ public class PointVerificationStatisticalDailyServiceImpl extends BaseServiceImp baseDao.deleteBatchIds(Arrays.asList(ids)); } + /** + * @Description 新增或修改积分核销数据 + * @param entity + * @return + * @author wangc + * @date 2020.07.27 17:28 + **/ + @Override + public void insertOrUpdate(PointVerificationStatisticalDailyEntity entity) { + PointVerificationStatisticalDailyEntity existed = baseDao.selectIfExisted(entity.getCreatedBy(),entity.getDateId()); + if(null != existed && StringUtils.isNotBlank(existed.getId())){ + existed.setVerificatedPoint(null == existed.getVerificatedPoint() ? entity.getVerificatedPoint() : existed.getVerificatedPoint() + entity.getVerificatedPoint()); + updateById(existed); + }else{ + insert(entity); + } + } + } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java index bb57179d6c..a3d82366c2 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java @@ -25,11 +25,12 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.UserPointActionLogDao; import com.epmet.dto.UserPointActionLogDTO; -import com.epmet.dto.form.ResiCommonUserIdFormDTO; +import com.epmet.dto.form.CommonPageUserFormDTO; import com.epmet.dto.result.ResiPointLogListResultDTO; import com.epmet.dto.result.ResiPointLogPeriodResultDTO; import com.epmet.entity.UserPointActionLogEntity; import com.epmet.service.UserPointActionLogService; +import com.github.pagehelper.PageHelper; import com.google.common.collect.Maps; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -102,14 +103,15 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl getMyPointRecord(ResiCommonUserIdFormDTO userId) { - List logList = baseDao.selectPointActionLogList(userId.getUserId()); + public List getMyPointRecord(CommonPageUserFormDTO pageUser) { + PageHelper.startPage(pageUser.getPageNo(),pageUser.getPageSize()); + List logList = baseDao.selectPointActionLogList(pageUser.getUserId()); List result = new LinkedList<>(); if(null != logList && !logList.isEmpty()){ Map> map = diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java index 6f68297877..851a65ecca 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java @@ -20,23 +20,31 @@ 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.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.UserPointStatisticalDailyDao; import com.epmet.dto.UserPointStatisticalDailyDTO; import com.epmet.dto.form.ResiPointRankFormDTO; import com.epmet.dto.result.ResiPointRankListResultDTO; +import com.epmet.dto.result.ResiPointRankResultDTO; +import com.epmet.dto.result.ResiPointRankingResultDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.entity.UserPointStatisticalDailyEntity; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.service.UserPointStatisticalDailyService; +import com.epmet.utils.DimIdGenerator; import com.epmet.utils.ModuleConstant; +import com.github.pagehelper.PageHelper; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * 用户积分统计情况 @@ -47,6 +55,8 @@ import java.util.Map; @Service public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl implements UserPointStatisticalDailyService { + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Override public PageData page(Map params) { @@ -108,13 +118,100 @@ public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl getPointRankWithinTimeZone(ResiPointRankFormDTO pointRankFormDTO) { + + List result = new LinkedList<>(); + ResiPointRankListResultDTO o = new ResiPointRankListResultDTO(); + //需要参数 Id 维度值 维度标识 + + //1.获取当前用户昵称以及当前用户所属客户Id + List userIdParam = new LinkedList<>(); + userIdParam.add(pointRankFormDTO.getUserId()); + Result> myResiInfoResult = + epmetUserOpenFeignClient.queryUserBaseInfo(userIdParam); + if(myResiInfoResult.success() && null != myResiInfoResult.getData() && !myResiInfoResult.getData().isEmpty()){ + if(StringUtils.isBlank(pointRankFormDTO.getCustomerId())) { + //缓存中陌生人游客也有对应的customerId + pointRankFormDTO.setCustomerId(myResiInfoResult.getData().get(NumConstant.ZERO).getCustomerId()); + } + //微信昵称 + o.setMyNickname(myResiInfoResult.getData().get(NumConstant.ZERO).getNickname()); } + //2.获取维度值 + DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(new Date()); + String dimVal = StringUtils.equals(ModuleConstant.TIME_ZONE_WEEK,pointRankFormDTO.getTimeDimension()) ? dimIdBean.getWeekId() : dimIdBean.getMonthId(); + //3.查询排行榜信息,个人排行(分页) + if(NumConstant.ONE < pointRankFormDTO.getPageNo()){ + PageHelper.startPage(pointRankFormDTO.getPageNo(),pointRankFormDTO.getPageSize()); + } + List rankList = + baseDao.selectPointRankWithinTimeZone(pointRankFormDTO.getCustomerId(),pointRankFormDTO.getTimeDimension(),dimVal); + if(null == rankList || rankList.isEmpty()){ + o.setMyPoint(NumConstant.ZERO); + o.setMyRanking(NumConstant.ZERO); + + return result; + } + //如果请求的是第一页 + if(NumConstant.ONE == pointRankFormDTO.getPageNo()) { + ResiPointRankResultDTO myself = + rankList.stream().filter(obj -> StringUtils.equals(obj.getUserId(), pointRankFormDTO.getUserId())).findFirst().get(); + if (null != myself) { + o.setMyPoint(myself.getTotalPoint()); + o.setMyRanking(myself.getRank()); + } else { + o.setMyPoint(NumConstant.ZERO); + if (rankList.get(rankList.size() - NumConstant.ONE).getTotalPoint() > NumConstant.ZERO) { + o.setMyRanking(rankList.get(rankList.size() - NumConstant.ONE).getRank() + NumConstant.ONE); + } else { + o.setMyRanking(rankList.get(rankList.size() - NumConstant.ONE).getRank()); + } + } + int fromIndex = pointRankFormDTO.getPageNo() * pointRankFormDTO.getPageSize(); + int toIndex = (pointRankFormDTO.getPageNo() + 1) * pointRankFormDTO.getPageSize(); + if(toIndex > rankList.size()) { + toIndex = rankList.size(); + } + rankList = rankList.subList(fromIndex,toIndex); + + } + List userIds = rankList.stream().map(ResiPointRankResultDTO::getUserId).collect(Collectors.toList()); + //查询用户昵称 + Result> userInfo = + epmetUserOpenFeignClient.queryUserBaseInfo(userIds); + boolean userRequestCallback = userInfo.success() && null != userInfo.getData() && !userInfo.getData().isEmpty(); + + for (int i = NumConstant.ZERO; i < rankList.size(); i++) { + ResiPointRankListResultDTO resultObj = ConvertUtils.sourceToTarget(o,ResiPointRankListResultDTO.class); + ResiPointRankingResultDTO target = new ResiPointRankingResultDTO(); + target.setRanking(rankList.get(i).getRank()); + target.setPoint(rankList.get(i).getTotalPoint()); + if(userRequestCallback) { + target.setNickname(null == userInfo.getData().get(i) ? "" : userInfo.getData().get(i).getNickname()); + } + resultObj.setRankList(target); + result.add(resultObj); + } + return result; + } - return null; + /** + * @Description 用户积分日统计新增或修改 + * @param entity + * @return + * @author wangc + * @date 2020.07.27 16:10 + **/ + @Override + public void insertOrUpdate(UserPointStatisticalDailyEntity entity) { + UserPointStatisticalDailyEntity existed = baseDao.selectIfExisted(entity.getUserId(),entity.getDateId(),entity.getActionFlag()); + if(null != existed && StringUtils.isNotBlank(existed.getId())){ + existed.setPointChange(null == existed.getPointChange() ? entity.getPointChange() : existed.getPointChange() + entity.getPointChange()); + updateById(existed); + }else{ + insert(entity); + } } + } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointTotalServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointTotalServiceImpl.java index 22f3cf2e94..741e5ad54f 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointTotalServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointTotalServiceImpl.java @@ -20,20 +20,30 @@ 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.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.UserPointTotalDao; import com.epmet.dto.UserPointTotalDTO; +import com.epmet.dto.form.ResiCommonUserIdFormDTO; +import com.epmet.dto.form.ResiPointRankFormDTO; +import com.epmet.dto.result.*; import com.epmet.entity.UserPointTotalEntity; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.service.UserPointTotalService; +import com.epmet.utils.DimIdGenerator; +import com.epmet.utils.ModuleConstant; +import com.github.pagehelper.PageHelper; import org.apache.commons.lang3.StringUtils; +import org.apache.ibatis.annotations.Param; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * 用户积分总计 @@ -44,6 +54,8 @@ import java.util.Map; @Service public class UserPointTotalServiceImpl extends BaseServiceImpl implements UserPointTotalService { + @Autowired + EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Override public PageData page(Map params) { @@ -97,4 +109,123 @@ public class UserPointTotalServiceImpl extends BaseServiceImpl getPointRanking(ResiPointRankFormDTO pointRankFormDTO) { + + List result = new LinkedList<>(); + ResiPointRankListResultDTO o = new ResiPointRankListResultDTO(); + + + //1.获取当前用户昵称以及当前用户所属客户Id + List userIdParam = new LinkedList<>(); + userIdParam.add(pointRankFormDTO.getUserId()); + Result> myResiInfoResult = + epmetUserOpenFeignClient.queryUserBaseInfo(userIdParam); + if(myResiInfoResult.success() && null != myResiInfoResult.getData() && !myResiInfoResult.getData().isEmpty()){ + if(StringUtils.isBlank(pointRankFormDTO.getCustomerId())) { + pointRankFormDTO.setCustomerId(myResiInfoResult.getData().get(NumConstant.ZERO).getCustomerId()); + } + //微信昵称 + o.setMyNickname(myResiInfoResult.getData().get(NumConstant.ZERO).getNickname()); + } + //2.查询排行榜信息,个人排行(分页) + if(NumConstant.ONE < pointRankFormDTO.getPageNo()){ + PageHelper.startPage(pointRankFormDTO.getPageNo(),pointRankFormDTO.getPageSize()); + } + //排行榜 + List rankList = + baseDao.selectUserPointRank(pointRankFormDTO.getCustomerId()); + //当排行榜没有数据时 + if(null == rankList || rankList.isEmpty()){ + o.setMyPoint(NumConstant.ZERO); + o.setMyRanking(NumConstant.ZERO); + + result.add(o); + return result; + } + //如果当前请求不是第一页 + if(NumConstant.ONE == pointRankFormDTO.getPageNo()) { + ResiPointRankResultDTO myself = + rankList.stream().filter(obj -> StringUtils.equals(obj.getUserId(), pointRankFormDTO.getUserId())).findFirst().get(); + if (null != myself) { + o.setMyPoint(myself.getTotalPoint()); + o.setMyRanking(myself.getRank()); + } else { + + if (rankList.get(rankList.size() - NumConstant.ONE).getTotalPoint() > NumConstant.ZERO) { + o.setMyRanking(rankList.get(rankList.size() - NumConstant.ONE).getRank() + NumConstant.ONE); + } else { + o.setMyRanking(rankList.get(rankList.size() - NumConstant.ONE).getRank()); + } + } + int fromIndex = pointRankFormDTO.getPageNo() * pointRankFormDTO.getPageSize(); + int toIndex = (pointRankFormDTO.getPageNo() + 1) * pointRankFormDTO.getPageSize(); + if(toIndex > rankList.size()) { + toIndex = rankList.size(); + } + //将假分页结果替换到rankList + rankList = rankList.subList(fromIndex,toIndex); + + } + + List userIds = rankList.stream().map(ResiPointRankResultDTO::getUserId).collect(Collectors.toList()); + //查询用户昵称 + Result> userInfo = + epmetUserOpenFeignClient.queryUserBaseInfo(userIds); + boolean userRequestCallback = userInfo.success() && null != userInfo.getData() && !userInfo.getData().isEmpty(); + + for (int i = NumConstant.ZERO; i < rankList.size(); i++) { + ResiPointRankListResultDTO resultObj = ConvertUtils.sourceToTarget(o,ResiPointRankListResultDTO.class); + + ResiPointRankingResultDTO target = new ResiPointRankingResultDTO(); + target.setRanking(rankList.get(i).getRank()); + target.setPoint(rankList.get(i).getTotalPoint()); + if(userRequestCallback) { + target.setNickname(null == userInfo.getData().get(i) ? "" : userInfo.getData().get(i).getNickname()); + } + resultObj.setRankList(target); + result.add(resultObj); + } + return result; + } + + /** + * @Description 新增或修改用户总积分记录 + * @param entity + * @return + * @author wangc + * @date 2020.07.27 16:45 + **/ + @Override + public void insertOrUpdate(UserPointTotalEntity entity) { + UserPointTotalEntity existed = baseDao.selectIfExisted(entity.getUserId()); + if(null != existed && StringUtils.isBlank(existed.getId())){ + existed.setUsedPoint(null == existed.getUsedPoint() ? entity.getUsedPoint() : entity.getUsedPoint() + existed.getUsedPoint()); + existed.setUsablePoint(null == existed.getUsablePoint() ? entity.getUsablePoint() : entity.getUsablePoint() + existed.getUsablePoint()); + existed.setTotalPoint(null == existed.getTotalPoint() ? entity.getTotalPoint() : entity.getTotalPoint() + existed.getTotalPoint()); + updateById(existed); + }else{ + insert(entity); + } + } + } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/DimIdGenerator.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/DimIdGenerator.java new file mode 100644 index 0000000000..09809250f5 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/DimIdGenerator.java @@ -0,0 +1,91 @@ +package com.epmet.utils; + +import com.epmet.commons.tools.utils.DateUtils; +import lombok.Data; + +import java.util.Calendar; +import java.util.Date; + +public class DimIdGenerator { + + /** + * 生成日期维度ID + * @param targetDate + * @return + */ + public static String getDateDimId(Date targetDate) { + return DateUtils.format(targetDate, DateUtils.DATE_PATTERN_YYYYMMDD); + } + + /** + * 获取月维度ID + * @param date + * @return + */ + public static String getMonthDimId(Date date) { + return DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMM); + } + + /** + * 获取周维度ID ,每周的星期一为 周的开始 + * @param date + * @return + */ + public static String getWeekDimId(Date date) { + String yyyy = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYY); + Calendar calendar = Calendar.getInstance(); + calendar.setFirstDayOfWeek(Calendar.MONDAY); + calendar.setTime(date); + return yyyy.concat("W").concat(calendar.get(Calendar.WEEK_OF_YEAR)+""); + } + + /** + * 获取季度维度ID + * @param date + * @return + */ + public static String getQuarterDimId(Date date) { + String yyyy = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYY); + return yyyy.concat("Q").concat(DateUtils.getQuarterIndex(date) + ""); + } + + /** + * 获取年维度ID + * @param date + * @return + */ + public static String getYearDimId(Date date) { + return DateUtils.format(date, DateUtils.DATE_PATTERN_YYYY); + } + + /** + * 获取封装了所有ID的对象 + * @return + */ + public static DimIdBean getDimIdBean(Date date) { + DimIdBean dimIdBean = new DimIdBean(); + dimIdBean.setDateId(getDateDimId(date)); + dimIdBean.setMonthId(getMonthDimId(date)); + dimIdBean.setWeekId(getWeekDimId(date)); + dimIdBean.setQuarterId(getQuarterDimId(date)); + dimIdBean.setYearId(getYearDimId(date)); + return dimIdBean; + } + + public static void main(String[] args) { + DimIdBean dimIdBean = getDimIdBean(DateUtils.stringToDate("2020-06-14",DateUtils.DATE_PATTERN)); + System.out.println(dimIdBean); + } + + @Data + public static class DimIdBean { + private String dateId; + private String monthId; + private String quarterId; + private String yearId; + private String weekId; + + public DimIdBean() { + } + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java index b21041f82c..c20c88fa00 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java @@ -20,31 +20,74 @@ public interface ModuleConstant extends Constant { /** * 正则表达式 日期 严格按照【yyyy-MM-dd】格式匹配 - * */ + */ String DATE_REG = "^([1-9]\\d{3}-)([0-1][1-9]-)(([0-3]{0,1}[0-9]))$"; /** * 正则表达式 周 严格按照【yyyyWcc】格式匹配 - * */ + */ String WEEK_REG = "^([1-9]\\d{3}W)(([0-4][1-9])|50|51|52)"; /** * 正则表达式 月份 严格按照【yyyy-MM】格式匹配 - * */ + */ String MONTH_REG = "^([1-9]\\d{3}-)(([0][1-9])|10|11|12)"; /** * 兑换记录标题 - * */ + */ String TITLE_EXCHANGE_POINT = "积分兑换"; /** * 按周排行 - * */ + */ String TIME_ZONE_WEEK = "week"; /** * 按月排行 - * */ + */ String TIME_ZONE_MONTH = "month"; + + /** + * 给传参 yyyy-MM形式补全日期 + */ + String DATE_COMPLEMENT = "-01"; + + /** + * 日期转换格式异常 + */ + String DATE_TRANSLATION_ERROR = "日期转换格式异常 -> 【%s】"; + + /** + * 时间维度:周 + */ + String TIME_DIMENSION_WEEK = "week"; + + /** + * 时间维度:月 + */ + String TIME_DIMENSION_MONTH = "month"; + + /** + * 减 + */ + String OPERATION_TYPE_MINUS = "minus"; + + /** + * 加 + */ + String OPERATION_TYPE_PLUS = "plus"; + + /** + * 核销 + */ + String OPERATION_TYPE_EXCHANGE = "exchange"; + + String EMPTY_STR = ""; + + String EVENT_NAME_ADJUSTMENT = "积分调整"; + + String EVENT_NAME_EXCHANGE = "积分兑换"; + + String POINT_NOT_ENOUGH = "积分余额不足"; } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdjustmentLogDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdjustmentLogDao.xml new file mode 100644 index 0000000000..b16836e89f --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdjustmentLogDao.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointVerificationLogDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointVerificationLogDao.xml index da8ca4135c..c6bb3e4bc6 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointVerificationLogDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointVerificationLogDao.xml @@ -7,8 +7,6 @@ - - @@ -42,4 +40,22 @@ ORDER BY CREATED_TIME DESC + + + \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointVerificationStatisticalDailyDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointVerificationStatisticalDailyDao.xml index 1a69fb4c49..df61f4dc2d 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointVerificationStatisticalDailyDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointVerificationStatisticalDailyDao.xml @@ -23,5 +23,19 @@ + + \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml index e37642cd78..f8a5d074ec 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml @@ -23,12 +23,14 @@ + + + \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml index 9c372dc78b..1603237883 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml @@ -44,4 +44,19 @@ ( SELECT @point := NULL, @rank := 1 ) a + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 4fbf1e6f59..68391842db 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerPartyBranchDTO; import com.epmet.dto.form.AddAgencyAndStaffFormDTO; +import com.epmet.dto.form.BelongGridNameFormDTO; import com.epmet.dto.form.ListPartyBranchFormDTO; import com.epmet.dto.result.*; import com.epmet.feign.fallback.GovOrgOpenFeignClientFallback; @@ -156,4 +157,13 @@ public interface GovOrgOpenFeignClient { */ @PostMapping("/gov/org/grid/gridsbystaffid/{staffId}") Result> listGridsbystaffid(@PathVariable("staffId") String staffId); + + /** + * + * @Description 根据网格id查询网格名称 + * @Author zxc + * @CreatedTime 2020/4/27 9:22 + */ + @PostMapping("/gov/org/customergrid/getgridnamebygridid") + Result getGridNameByGridId(@RequestBody BelongGridNameFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index 48fa9c84dc..f6ca2691ee 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerPartyBranchDTO; import com.epmet.dto.form.AddAgencyAndStaffFormDTO; +import com.epmet.dto.form.BelongGridNameFormDTO; import com.epmet.dto.form.ListPartyBranchFormDTO; import com.epmet.dto.result.*; import com.epmet.feign.GovOrgOpenFeignClient; @@ -90,4 +91,9 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { public Result> listGridsbystaffid(String staffId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "listGridsbystaffid", staffId); } + + @Override + public Result getGridNameByGridId(BelongGridNameFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridNameByGridId", formDTO); + } } diff --git a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/MyResiUserInfoResultDTO.java b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/MyResiUserInfoResultDTO.java index 35c8d0203c..21d940ec2c 100644 --- a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/MyResiUserInfoResultDTO.java +++ b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/MyResiUserInfoResultDTO.java @@ -42,5 +42,9 @@ public class MyResiUserInfoResultDTO implements Serializable { * 拥有角色名称列表,可为空[] * */ private List roleList; + /** + * 累计积分 + * */ + private Integer point; } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java index e047396cfd..7b4398dc31 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java @@ -12,13 +12,11 @@ import com.epmet.constant.PartyMemberConstant; import com.epmet.constant.PartyMemberMessageConstant; import com.epmet.constant.ReadFlagConstant; import com.epmet.constant.SmsTemplateConstant; -import com.epmet.dto.CustomerGridDTO; -import com.epmet.dto.CustomerStaffGridDTO; -import com.epmet.dto.UserResiInfoDTO; -import com.epmet.dto.UserRoleDTO; +import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.modules.feign.EpmetUserFeignClient; import com.epmet.modules.feign.GovOrgFeignClient; import com.epmet.modules.feign.ResiGroupFeignClient; @@ -91,6 +89,8 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService private ResiGroupFeignClient resiGroupFeignClient; @Autowired private PartymemberAuthRecordService partymemberAuthRecordService; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Override @Transactional(rollbackFor = Exception.class) @@ -266,6 +266,16 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService //判断是否已注册居民,如果没有则注册居民 isResiRegister(partyMemberInfoDTO); + //将身份证号更新到用户基础信息表中 + UserBaseInfoDTO baseInfo = new UserBaseInfoDTO(); + baseInfo.setUserId(partyMemberInfoDTO.getUserId()); + baseInfo.setIdNum(partyMemberInfoDTO.getIdCard()); + baseInfo.setBuildingAddress(partyMemberInfoDTO.getBuilding()); + baseInfo.setStreet(partyMemberInfoDTO.getStreet()); + baseInfo.setSurname(partyMemberInfoDTO.getSurname()); + baseInfo.setName(partyMemberInfoDTO.getName()); + + epmetUserOpenFeignClient.saveUserBaseInfo(baseInfo); return result; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerUserFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerUserFormDTO.java new file mode 100644 index 0000000000..4be83bca63 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerUserFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 查询一个客户下所有用户包括陌生人 + * @ClassName CustomerUserFormDTO + * @Auth wangc + * @Date 2020-07-25 15:38 + */ +@Data +public class CustomerUserFormDTO implements Serializable { + private static final long serialVersionUID = -8209934663808878617L; + + public interface CustomerIdGroup extends CustomerClientShowGroup{} + + @NotBlank(message = "客户Id不能为空", groups = CustomerIdGroup.class) + private String customerId; + + /** + * 查询参数:全名 + * */ + private String name; + + @Min(1) + private Integer pageNo = 1; + + private Integer pageSize = 20; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IssueInitiatorFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IssueInitiatorFormDTO.java index e52d7c19e6..5e48aec3fd 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IssueInitiatorFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IssueInitiatorFormDTO.java @@ -1,7 +1,9 @@ package com.epmet.dto.form; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -14,9 +16,12 @@ public class IssueInitiatorFormDTO implements Serializable { private static final long serialVersionUID = 1L; + public interface UserIdGroup extends CustomerClientShowGroup{} + /** * 话题id */ + @NotBlank(message = "用户Id不能为空",groups = UserIdGroup.class) private String userId; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerUserDetailResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerUserDetailResultDTO.java new file mode 100644 index 0000000000..de2d3bf04c --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerUserDetailResultDTO.java @@ -0,0 +1,51 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 积分调整-人员查询-人员详情 + * @ClassName CustomerUserDetailResultDTO + * @Auth wangc + * @Date 2020-07-27 01:26 + */ +@Data +public class CustomerUserDetailResultDTO implements Serializable { + private static final long serialVersionUID = 893146364651215391L; + + /** + * 姓名 + * */ + private String name; + + /** + * 男 女 未知 + * */ + private String gender; + + /** + * 手机号 + * */ + private String mobile; + + /** + * 身份证号 + * */ + private String idNum; + + /** + * 居民地址 + * */ + private String address; + + /** + * 所属(注册)网格 + * */ + private String associatedGrid; + + /** + * 积分(可用) + * */ + private Integer point; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerUserResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerUserResultDTO.java new file mode 100644 index 0000000000..52885077d0 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerUserResultDTO.java @@ -0,0 +1,41 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @ClassName CustomerUserResultDTO + * @Auth wangc + * @Date 2020-07-25 15:45 + */ +@Data +public class CustomerUserResultDTO implements Serializable { + private static final long serialVersionUID = 388843991776771308L; + + /** + * 用户头像 + * */ + private String userHeadPhoto; + + /** + * 用户显示昵称 + * */ + private String userName; + + /** + * 用户微信昵称 + * */ + private String userNickname; + + /** + *注册网格名称 + * */ + private String registeredGrid; + + /** + * 用户Id + * */ + private String userId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyResiUserInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyResiUserInfoResultDTO.java index bd9bd52e5b..4201a109a3 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyResiUserInfoResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyResiUserInfoResultDTO.java @@ -43,4 +43,9 @@ public class MyResiUserInfoResultDTO implements Serializable { * */ private List roleList; + /** + * 累计积分 + * */ + private Integer point; + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffEtAgencyResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffEtAgencyResultDTO.java new file mode 100644 index 0000000000..08e83f83a6 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffEtAgencyResultDTO.java @@ -0,0 +1,42 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 工作人员的信息:显示昵称、所属机关Id + * @ClassName StaffEtAgencyResultDTO + * @Auth wangc + * @Date 2020-07-27 15:11 + */ +@Data +public class StaffEtAgencyResultDTO implements Serializable { + + private static final long serialVersionUID = -7048248108253396688L; + + /** + * 所属机关Id + * */ + private String agencyId; + + /** + * 工作人员昵称 xx机关-xx + * */ + private String nickname; + + /** + * 上级机关Id + * */ + private String pid; + + /** + * 上级机关Id集合 + * */ + private String pids; + + /** + * 客户Id + * */ + private String customerId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBaseInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBaseInfoResultDTO.java index 983bffec24..96d90db4ef 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBaseInfoResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBaseInfoResultDTO.java @@ -16,6 +16,12 @@ public class UserBaseInfoResultDTO implements Serializable { private static final long serialVersionUID = 3124057264557384333L; @JsonIgnore private String id; + + /** + * 客户Id + * */ + private String customerId; + /** * 用户id */ @@ -76,6 +82,21 @@ public class UserBaseInfoResultDTO implements Serializable { */ private String headImgUrl; + /** + * 网格Id + * */ + private String registeredGridId; + + /** + * xx机关-yy网格 + * */ + private String registeredGridName; + + /** + * 显示昵称 xx网格-y先生/女士 + * */ + private String showName; + /** * 微信基本信息 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 8a4de9898e..67ffff8fb1 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.UserBaseInfoDTO; import com.epmet.dto.UserDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; @@ -148,4 +149,44 @@ public interface EpmetUserOpenFeignClient { **/ @PostMapping("/epmetuser/userbaseinfo/queryuserbaseinfo") Result> queryUserBaseInfo(@RequestBody List userIdList); + + /** + * @Description 新增或保存用户基本信息 + * @param baseInfo + * @return + * @author wangc + * @date 2020.07.23 13:31 + **/ + @PostMapping("/epmetuser/userbaseinfo/saveuserbaseinfo") + Result saveUserBaseInfo(@RequestBody UserBaseInfoDTO baseInfo); + + /** + * @Description 查询客户下所有用户包括陌生人 + * @param param + * @return + * @author wangc + * @date 2020.07.25 16:15 + **/ + @PostMapping("/epmetuser/gridlatest/customeruserlist") + Result> customerUserList(@RequestBody CustomerUserFormDTO param); + + /** + * @Description 查询用户详情信息 + * @param param + * @return + * @author wangc + * @date 2020.07.27 01:34 + **/ + @PostMapping("/epmetuser/userbaseinfo/customeruserdetail") + Result customerUserDetail(@RequestBody IssueInitiatorFormDTO param); + + /** + * @Description 得到工组人员的头像、名称、所属机关名称 + * @param userId + * @return + * @author wangc + * @date 2020.07.27 14:45 + **/ + @PostMapping("/epmetuser/customerstaff/staffmsg") + Result staffMsg(@RequestBody IssueInitiatorFormDTO userId); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index bb2cbe9d77..a6403a0448 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.UserBaseInfoDTO; import com.epmet.dto.UserDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; @@ -98,4 +99,52 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result> queryUserBaseInfo(List userIdList) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "queryUserBaseInfo", userIdList); } + + /** + * @Description 新增或保存用户基本信息 + * @param baseInfo + * @return + * @author wangc + * @date 2020.07.23 13:31 + **/ + @Override + public Result saveUserBaseInfo(UserBaseInfoDTO baseInfo) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveUserBaseInfo", baseInfo); + } + + /** + * @Description 查询客户下所有用户包括陌生人 + * @param param + * @return + * @author wangc + * @date 2020.07.25 16:15 + **/ + @Override + public Result> customerUserList(CustomerUserFormDTO param) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "customerUserList", param); + } + + /** + * @Description 查询用户详情信息 + * @param param + * @return + * @author wangc + * @date 2020.07.27 01:34 + **/ + @Override + public Result customerUserDetail(IssueInitiatorFormDTO param) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "customerUserDetail", param); + } + + /** + * @Description 得到工组人员的头像、名称、所属机关名称 + * @param userId + * @return + * @author wangc + * @date 2020.07.27 14:45 + **/ + @Override + public Result staffMsg(IssueInitiatorFormDTO userId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "staffMsg", userId); + } } diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index 2c3f938f56..69a426911b 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -88,6 +88,12 @@ 2.0.0 compile + + com.epmet + epmet-point-client + 2.0.0 + compile + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRedisKeys.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRedisKeys.java new file mode 100644 index 0000000000..f4fffb6975 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRedisKeys.java @@ -0,0 +1,26 @@ +package com.epmet.constant; + +/** + * @Description + * @ClassName UserRedisKeys + * @Auth wangc + * @Date 2020-07-22 17:16 + */ +public class UserRedisKeys { + + /** + * 党群e事通redis前缀 + */ + private static String rootPrefix = "epmet:"; + + /** + * @Description 用户缓存Key + * @Param 用户Id + * @return epmet:resi:user:userId + * @Author wangc + * @Date 2020.04.13 11:27 + **/ + public static String getResiUserKey(String userId){ + return rootPrefix.concat("resi:user:").concat(userId); + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index 883b9b21bd..ff6920eb27 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java @@ -297,4 +297,17 @@ public class CustomerStaffController { customerStaffService.resetStaffPassword(staffResetPwFormDTO); return new Result(); } -} \ No newline at end of file + + /** + * @Description 得到工组人员的头像、名称、所属机关名称 + * @param userId + * @return + * @author wangc + * @date 2020.07.27 14:45 + **/ + @PostMapping("staffmsg") + public Result staffMsg(@RequestBody IssueInitiatorFormDTO userId){ + ValidatorUtils.validateEntity(userId, IssueInitiatorFormDTO.UserIdGroup.class); + return new Result().ok(customerStaffService.getStaffMsg(userId)); + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java index 6d0344839d..8f0922d2b1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java @@ -26,6 +26,8 @@ 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.GridLatestDTO; +import com.epmet.dto.form.CustomerUserFormDTO; +import com.epmet.dto.result.CustomerUserResultDTO; import com.epmet.dto.result.LatestGridInfoResultDTO; import com.epmet.excel.GridLatestExcel; import com.epmet.service.GridLatestService; @@ -115,4 +117,17 @@ public class GridLatestController { return gridLatestService.getGridsByUserId(userId); } + + /** + * @Description 查询客户下所有用户包括陌生人 + * @param param + * @return + * @author wangc + * @date 2020.07.25 16:15 + **/ + @PostMapping("customeruserlist") + public Result> customerUserList(@RequestBody CustomerUserFormDTO param){ + return new Result>().ok(gridLatestService.getCustomerUsers(param)); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java index 046bc0f071..1b9f707e1a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java @@ -26,9 +26,13 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.UserBaseInfoDTO; +import com.epmet.dto.form.IssueInitiatorFormDTO; +import com.epmet.dto.result.CustomerUserDetailResultDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.entity.UserBaseInfoEntity; import com.epmet.excel.UserBaseInfoExcel; import com.epmet.service.UserBaseInfoService; +import oracle.jdbc.proxy.annotation.Post; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -117,4 +121,29 @@ public class UserBaseInfoController { userBaseInfoService.initBaseInfo(); return new Result(); } -} \ No newline at end of file + + /** + * @Description 新增或保存用户基本信息 + * @param baseInfo + * @return + * @author wangc + * @date 2020.07.23 13:31 + **/ + @PostMapping("saveuserbaseinfo") + public Result insertOrUpdate(@RequestBody UserBaseInfoEntity baseInfo){ + userBaseInfoService.insertOrUpdate(baseInfo); + return new Result(); + } + + /** + * @Description 查询用户详情信息 + * @param param + * @return + * @author wangc + * @date 2020.07.27 01:34 + **/ + @PostMapping("customeruserdetail") + public Result customerUserDetail(@RequestBody IssueInitiatorFormDTO param){ + return new Result().ok(userBaseInfoService.customerUserDetail(param.getUserId())); + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java index 9c0f40c8ef..ffd2e1f5c7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java @@ -9,10 +9,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.UserDTO; import com.epmet.dto.UserWechatDTO; import com.epmet.dto.form.*; -import com.epmet.dto.result.CreatedTimeByUserIdResultDTO; -import com.epmet.dto.result.LoginUserDetailsResultDTO; -import com.epmet.dto.result.MyResiUserInfoResultDTO; -import com.epmet.dto.result.PasswordLoginUserInfoResultDTO; +import com.epmet.dto.result.*; import com.epmet.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -31,7 +28,6 @@ public class UserController { @Autowired private UserService userService; - /** * @param formDTO * @return com.epmet.commons.tools.utils.Result @@ -131,5 +127,4 @@ public class UserController { public Result saveWxUser(@RequestBody WxUserFormDTO formDTO){ return new Result().ok(userService.saveWxUser(formDTO)); } - } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java index 735be62827..2e5b9e7b8f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java @@ -55,4 +55,13 @@ public interface GridLatestDao extends BaseDao { * @Author sun **/ List selectAllGridsByUserId(@Param("userId") String userId); + + /** + * @Description 查询一个客户下的所有用户:注册居民、陌生人 + * @param customerId + * @return + * @author wangc + * @date 2020.07.25 15:26 + **/ + List selectAllUserByCustomerId(@Param("customerId")String customerId); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RegisterRelationDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RegisterRelationDao.java index ff7df4de5c..4570711923 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RegisterRelationDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RegisterRelationDao.java @@ -36,4 +36,12 @@ public interface RegisterRelationDao extends BaseDao { List getListByUserId(@Param("userId") String userId); + /** + * @Description 查询用户的首次注册网格Id + * @param userId + * @return + * @author wangc + * @date 2020.07.23 15:31 + **/ + RegisterRelationEntity selectRegisteredGridIdByUserId(@Param("userId") String userId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java index fc00b799bf..b0a2490bda 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java @@ -6,6 +6,7 @@ import com.epmet.dto.UserHeadPhotoDTO; import com.epmet.dto.UserWechatDTO; import com.epmet.dto.form.WxLoginUserInfoFormDTO; import com.epmet.dto.result.CertifiedResultDTO; +import com.epmet.dto.result.CustomerUserResultDTO; import com.epmet.entity.UserWechatEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -64,4 +65,14 @@ public interface UserWechatDao extends BaseDao{ * @Date 2020/7/22 10:46 **/ List selectAll(); + + /** + * @Description 查询人员信息,排序,包括陌生人与注册居民,没有注册居民则只有微信昵称 + * @param userIds + * @return + * @author wangc + * @date 2020.07.27 00:58 + **/ + List selectResiAndStrangerInfo(@Param("userIds") List userIds,@Param("realName")String realName); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/OperRoleUserFeignClientFallBack.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/OperRoleUserFeignClientFallBack.java index 53691f4e84..39fc8aae8a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/OperRoleUserFeignClientFallBack.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/OperRoleUserFeignClientFallBack.java @@ -5,7 +5,7 @@ import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.feign.OperRoleUserFeignClient; import org.springframework.stereotype.Component; -import sun.misc.Contended; + import java.util.List; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java index 1e34bba718..ac442388ad 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java @@ -17,10 +17,29 @@ package com.epmet.redis; +import cn.hutool.core.bean.BeanUtil; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.UserRedisKeys; +import com.epmet.dao.GridLatestDao; +import com.epmet.dao.RegisterRelationDao; +import com.epmet.dao.UserBaseInfoDao; +import com.epmet.dto.form.BelongGridNameFormDTO; +import com.epmet.dto.result.BelongGridNameResultDTO; +import com.epmet.dto.result.LatestGridInfoResultDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.entity.RegisterRelationEntity; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.util.ModuleConstant; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.Map; + +import static com.epmet.commons.tools.redis.RedisUtils.NOT_EXPIRE; + /** * 用户基础信息 * @@ -31,17 +50,93 @@ import org.springframework.stereotype.Component; public class UserBaseInfoRedis { @Autowired private RedisUtils redisUtils; + @Autowired + private UserBaseInfoDao userBaseInfoDao; + @Autowired + private RegisterRelationDao registerRelationDao; + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + @Autowired + private GridLatestDao gridLatestDao; public void delete(Object[] ids) { } - public void set(){ - + /** + * @Description 将用户基本信息放入缓存 + * @param baseInfo + * @return + * @author wangc + * @date 2020.07.23 14:43 + **/ + public void set(UserBaseInfoResultDTO baseInfo){ + if(StringUtils.isBlank(baseInfo.getUserId())) return; + String key = UserRedisKeys.getResiUserKey(baseInfo.getUserId()); + //bean to map + Map map = BeanUtil.beanToMap(baseInfo, false, true); + redisUtils.hMSet(key, map,NOT_EXPIRE); } public String get(String id){ return null; } + /** + * @Description 缓存中获取用户基本信息 + * @param userId + * @return + * @author wangc + * @date 2020.07.23 14:58 + **/ + public UserBaseInfoResultDTO getUserInfo(String userId){ + if(StringUtils.isNotBlank(userId)){ + //获取居民缓存key + Map map = redisUtils.hGetAll(UserRedisKeys.getResiUserKey(userId)); + if(null != map && !map.isEmpty()) { + //缓存中有数据,直接返回 + return BeanUtil.mapToBean(map, UserBaseInfoResultDTO.class, true); + } + //缓存中没有数据,先查数据库,放入缓存后再返回 + UserBaseInfoResultDTO baseInfo = userBaseInfoDao.selectListByUserIdList(userId); + if(null != baseInfo && StringUtils.isNotBlank(baseInfo.getId())){ + RegisterRelationEntity relation = registerRelationDao.selectRegisteredGridIdByUserId(userId); + //如果没有首次注册网格,则没有网格名称(xx机关-xx网格)、显示昵称(xx网格-x先生/女士) + if(null != relation && StringUtils.isNotBlank(relation.getGridId())){ + baseInfo.setCustomerId(relation.getCustomerId()); + BelongGridNameFormDTO gridParam = new BelongGridNameFormDTO(); + gridParam.setGridId(relation.getGridId()); + Result gridResult = + govOrgOpenFeignClient.getGridNameByGridId(gridParam); + if(gridResult.success() && null != gridResult.getData() + && StringUtils.isNotBlank(gridResult.getData().getBelongsGridName())){ + String gridFullName = gridResult.getData().getBelongsGridName(); + baseInfo.setRegisteredGridName(gridFullName); + StringBuffer buffer = new StringBuffer(gridFullName.split(ModuleConstant.DASH)[NumConstant.ONE]).append(ModuleConstant.DASH).append(baseInfo.getSurname()); + switch(baseInfo.getGender()){ + case NumConstant.ONE_STR : + buffer.append(ModuleConstant.RESI_USER_NICKNAME_SUFFIX_MALE); + break; + case NumConstant.TWO_STR : + buffer.append(ModuleConstant.RESI_USER_NICKNAME_SUFFIX_FEMALE); + break; + default: + buffer.append(ModuleConstant.RESI_USER_NICKNAME_SUFFIX_GENDER_UNKNOWN); + } + baseInfo.setShowName(buffer.toString()); + } + }else{ + //如果没有居民注册记录,说明当前用户是陌生人,需要从陌生人网格访问列表中查询所属的客户Id + LatestGridInfoResultDTO gridLatest = + gridLatestDao.selectLatestGridInfoByUserId(userId); + if(null != gridLatest){ + baseInfo.setCustomerId(gridLatest.getCustomerId()); + } + } + set(baseInfo); + return baseInfo; + } + } + return null; + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java index 4129e37c8c..9d7003fa65 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java @@ -241,4 +241,13 @@ public interface CustomerStaffService extends BaseService { * @Date 2020/7/1 10:41 **/ void resetStaffPassword(StaffResetPwFormDTO staffResetPwFormDTO); + + /** + * @Description 得到工组人员的头像、名称、所属机关名称 + * @param userId + * @return + * @author wangc + * @date 2020.07.27 14:45 + **/ + StaffEtAgencyResultDTO getStaffMsg(IssueInitiatorFormDTO userId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java index 1833106279..595f5a503f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java @@ -22,7 +22,9 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.GridLatestDTO; +import com.epmet.dto.form.CustomerUserFormDTO; import com.epmet.dto.form.VisitedFormDTO; +import com.epmet.dto.result.CustomerUserResultDTO; import com.epmet.dto.result.LatestGridInfoResultDTO; import com.epmet.entity.GridLatestEntity; @@ -120,4 +122,13 @@ public interface GridLatestService extends BaseService { **/ Result> getGridsByUserId(String userId); + /** + * @Description 查询客户下所有用户包括陌生人 + * @param customerUserFormDTO + * @return + * @author wangc + * @date 2020.07.25 16:15 + **/ + List getCustomerUsers(CustomerUserFormDTO customerUserFormDTO); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java index d4c13a7c1c..c2512b3e8b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java @@ -20,6 +20,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.UserBaseInfoDTO; +import com.epmet.dto.result.CustomerUserDetailResultDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.entity.UserBaseInfoEntity; @@ -111,4 +112,22 @@ public interface UserBaseInfoService extends BaseService { * @Date 2020/7/22 10:42 **/ void initBaseInfo(); + + /** + * @Description 检查有无居民基础信息表,如果有更新,无插入 + * @param baseInfo + * @return + * @author wangc + * @date 2020.07.23 10:35 + **/ + void insertOrUpdate(UserBaseInfoEntity baseInfo); + + /** + * @Description 查询用户详情信息 + * @param userId + * @return + * @author wangc + * @date 2020.07.27 01:34 + **/ + CustomerUserDetailResultDTO customerUserDetail(String userId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index a0f3aab8e2..00975b17de 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -43,11 +43,13 @@ import com.epmet.entity.GovStaffRoleEntity; import com.epmet.entity.StaffRoleEntity; import com.epmet.entity.UserEntity; import com.epmet.feign.AuthFeignClient; +import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.redis.CustomerStaffRedis; import com.epmet.service.CustomerStaffService; import com.epmet.service.GovStaffRoleService; import com.epmet.service.StaffRoleService; import com.epmet.service.UserService; +import com.epmet.util.ModuleConstant; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; @@ -86,6 +88,8 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl page(Map params) { @@ -480,4 +484,26 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl agencyResult = govOrgOpenFeignClient.getAgencyByStaff(userId.getUserId()); + if(agencyResult.success() && null != agencyResult.getData()){ + result = ConvertUtils.sourceToTarget(agencyResult.getData(),StaffEtAgencyResultDTO.class); + result.setAgencyId(agencyResult.getData().getId()); + result.setNickname(new StringBuilder(agencyResult.getData().getOrganizationName()).append(ModuleConstant.DASH).append(staff.getRealName()).toString()); + } + } + return result; + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java index 8f24ebf889..a8938ea276 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java @@ -26,13 +26,20 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.GridLatestDao; +import com.epmet.dao.UserWechatDao; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.GridLatestDTO; +import com.epmet.dto.form.CustomerUserFormDTO; import com.epmet.dto.form.VisitedFormDTO; +import com.epmet.dto.result.CustomerUserResultDTO; import com.epmet.dto.result.LatestGridInfoResultDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.entity.GridLatestEntity; import com.epmet.redis.GridLatestRedis; +import com.epmet.redis.UserBaseInfoRedis; import com.epmet.service.GridLatestService; +import com.epmet.util.ModuleConstant; +import com.github.pagehelper.PageHelper; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,10 +47,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 @@ -58,6 +62,10 @@ public class GridLatestServiceImpl extends BaseServiceImpl page(Map params) { @@ -166,4 +174,35 @@ public class GridLatestServiceImpl extends BaseServiceImpl>().ok(gridList); } + /** + * @Description 查询客户下所有用户包括陌生人 + * @param customerUserFormDTO + * @return + * @author wangc + * @date 2020.07.25 16:15 + **/ + @Override + public List getCustomerUsers(CustomerUserFormDTO customerUserFormDTO) { + List userIds = baseDao.selectAllUserByCustomerId(customerUserFormDTO.getCustomerId()); + List allData = new LinkedList<>(); + if(null == userIds || userIds.isEmpty()){ + return allData; + } + PageHelper.startPage(customerUserFormDTO.getPageNo(),customerUserFormDTO.getPageSize()); + allData = userWechatDao.selectResiAndStrangerInfo(userIds,customerUserFormDTO.getName()); + if(null == allData || allData.isEmpty()){ + return allData; + } + allData.forEach(info -> { + if(StringUtils.isBlank(info.getUserName())){ + info.setUserName(ModuleConstant.EMPTY_STR); + UserBaseInfoResultDTO cache = userBaseInfoRedis.getUserInfo(info.getUserId()); + if(null != cache) { + info.setRegisteredGrid(cache.getRegisteredGridName()); + } + } + }); + return allData; + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java index b2cba9216e..2b0e655f24 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java @@ -296,6 +296,7 @@ public class RegisterRelationServiceImpl extends BaseServiceImpl { + UserBaseInfoResultDTO baseInfo = userBaseInfoRedis.getUserInfo(id); + //为了保证传过来的user数量与返回的一致,就算查出的用户信息为空也要添加进集合里 + //if(null != baseInfo && StringUtils.isNotBlank(baseInfo.getId())){ + userBaseInfoList.add(baseInfo); + //} + }); return userBaseInfoList; } @@ -197,5 +206,52 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl page(Map params) { @@ -192,6 +197,18 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl wechat = userWechatService.selectByUserId(userResiInfoDTO.getUserId()); + if(null != wechat && !wechat.isEmpty()){ + baseInfo.setHeadImgUrl(wechat.get(NumConstant.ZERO).getHeadImgUrl()); + baseInfo.setGender(wechat.get(NumConstant.ZERO).getSex().toString()); + baseInfo.setNickname(wechat.get(NumConstant.ZERO).getNickname()); + } + userBaseInfoService.insertOrUpdate(baseInfo); } /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java index b6d3a63965..70f342e4c4 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java @@ -3,6 +3,7 @@ package com.epmet.service.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.Result; @@ -15,9 +16,12 @@ import com.epmet.dto.UserDTO; import com.epmet.dto.UserWechatDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; +import com.epmet.entity.UserBaseInfoEntity; import com.epmet.entity.UserEntity; import com.epmet.entity.UserWechatEntity; +import com.epmet.feign.EpmetPointOpenFeignClient; import com.epmet.feign.GovOrgFeignClient; +import com.epmet.service.UserBaseInfoService; import com.epmet.service.UserService; import com.epmet.util.ModuleConstant; import org.apache.commons.lang3.StringUtils; @@ -45,6 +49,10 @@ public class UserServiceImpl extends BaseServiceImpl implem private UserRoleDao userRoleDao; @Autowired private CpUserDetailRedis cpUserDetailRedis; + @Autowired + private UserBaseInfoService userBaseInfoService; + @Autowired + private EpmetPointOpenFeignClient epmetPointOpenFeignClient; private static final Logger log = LoggerFactory.getLogger(UserServiceImpl.class); @@ -122,6 +130,12 @@ public class UserServiceImpl extends BaseServiceImpl implem userWechatDTO.setUpdatedTime(new Date()); userWechatDTO.setUpdatedBy(wxUserInfoFormDTO.getUserId()); userWechatDao.updateByUserId(userWechatDTO); + UserBaseInfoEntity baseInfo = new UserBaseInfoEntity(); + baseInfo.setUserId(wxUserInfoFormDTO.getUserId()); + baseInfo.setNickname(wxUserInfoFormDTO.getNickName()); + baseInfo.setHeadImgUrl(wxUserInfoFormDTO.getAvatarUrl()); + baseInfo.setGender(wxUserInfoFormDTO.getGender()); + userBaseInfoService.insertOrUpdate(baseInfo); return new Result(); } @@ -172,6 +186,14 @@ public class UserServiceImpl extends BaseServiceImpl implem userRoleFormDTO.setCustomerId(myResiUserInfoFormDTO.getCustomerId()); userRoleFormDTO.setGridId(myResiUserInfoFormDTO.getGridId()); result.setRoleList(userRoleDao.getUserRoleList(userRoleFormDTO)); + + TokenDto dto = new TokenDto(); + dto.setUserId(myResiUserInfoFormDTO.getUserId()); + Result pointResult = epmetPointOpenFeignClient.myPoint(dto); + if(pointResult.success() && null != pointResult.getData()){ + //累计积分 + result.setPoint(pointResult.getData().getAccumulatedPoint()); + } return result; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/util/ModuleConstant.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/ModuleConstant.java index 7bd388d54a..68b95319ac 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/util/ModuleConstant.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/ModuleConstant.java @@ -19,4 +19,19 @@ public interface ModuleConstant { * 未检索到客户信息 * */ String CUSTOMER_INFO_NOT_FOUND = "未检索到客户信息"; + + String RESI_USER_NICKNAME_SUFFIX_MALE = "先生"; + + String RESI_USER_NICKNAME_SUFFIX_FEMALE = "女士"; + + String RESI_USER_NICKNAME_SUFFIX_GENDER_UNKNOWN = "先生/女士"; + + String DASH = "-"; + + String GENDER_MALE = "男"; + + String GENDER_FEMALE = "女"; + + String GENDER_UNKNOWN = "未知"; + } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml index 3dfe0f9939..d98797d043 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml @@ -82,4 +82,15 @@ AND customer_user_id = #{userId} ORDER BY latest_time DESC + + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml index 472540b853..44dbb58269 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml @@ -30,5 +30,19 @@ user_id = #{userId} + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml index 6ed041a555..9d3167ed1b 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml @@ -89,4 +89,27 @@ uw.DEL_FLAG = '0' AND uw.NICKNAME IS NOT NULL + + + From 24cd250261b7d037b5a992ab27c873f5b36fde0a Mon Sep 17 00:00:00 2001 From: wangchao Date: Tue, 28 Jul 2020 10:00:01 +0800 Subject: [PATCH 2/3] =?UTF-8?q?dto=E5=90=8D=E7=A7=B0=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/controller/AdjustmentController.java | 4 ++-- ...UserResultDTO.java => CustomerUser4PointResultDTO.java} | 7 +++---- .../java/com/epmet/feign/EpmetUserOpenFeignClient.java | 2 +- .../feign/fallback/EpmetUserOpenFeignClientFallback.java | 2 +- .../java/com/epmet/controller/GridLatestController.java | 6 +++--- .../src/main/java/com/epmet/dao/UserWechatDao.java | 4 ++-- .../src/main/java/com/epmet/service/GridLatestService.java | 4 ++-- .../java/com/epmet/service/impl/GridLatestServiceImpl.java | 6 +++--- .../src/main/resources/mapper/UserWechatDao.xml | 2 +- 9 files changed, 18 insertions(+), 19 deletions(-) rename epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/{CustomerUserResultDTO.java => CustomerUser4PointResultDTO.java} (71%) diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java index 15e1980651..0f2876f74f 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java @@ -5,8 +5,8 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.CustomerUserFormDTO; import com.epmet.dto.form.IssueInitiatorFormDTO; +import com.epmet.dto.result.CustomerUser4PointResultDTO; import com.epmet.dto.result.CustomerUserDetailResultDTO; -import com.epmet.dto.result.CustomerUserResultDTO; import com.epmet.dto.result.PointAdjustmentResultDTO; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.service.PointAdjustmentLogService; @@ -39,7 +39,7 @@ public class AdjustmentController { * @date 2020.07.27 10:57 **/ @PostMapping("userlist") - public Result> userList(@RequestBody CustomerUserFormDTO param){ + public Result> userList(@RequestBody CustomerUserFormDTO param){ ValidatorUtils.validateEntity(param, CustomerUserFormDTO.CustomerIdGroup.class); return epmetUserOpenFeignClient.customerUserList(param); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerUserResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerUser4PointResultDTO.java similarity index 71% rename from epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerUserResultDTO.java rename to epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerUser4PointResultDTO.java index 52885077d0..95cba037ef 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerUserResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerUser4PointResultDTO.java @@ -6,13 +6,12 @@ import java.io.Serializable; /** * @Description - * @ClassName CustomerUserResultDTO + * @ClassName CustomerUser4PointResultDTO * @Auth wangc - * @Date 2020-07-25 15:45 + * @Date 2020-07-28 09:47 */ @Data -public class CustomerUserResultDTO implements Serializable { - private static final long serialVersionUID = 388843991776771308L; +public class CustomerUser4PointResultDTO implements Serializable { /** * 用户头像 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index c765ec0a28..70116e6e91 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -199,7 +199,7 @@ public interface EpmetUserOpenFeignClient { * @date 2020.07.25 16:15 **/ @PostMapping("/epmetuser/gridlatest/customeruserlist") - Result> customerUserList(@RequestBody CustomerUserFormDTO param); + Result> customerUserList(@RequestBody CustomerUserFormDTO param); /** * @Description 查询用户详情信息 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 39c71e8e9f..6ba2d156fd 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -135,7 +135,7 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien * @date 2020.07.25 16:15 **/ @Override - public Result> customerUserList(CustomerUserFormDTO param) { + public Result> customerUserList(CustomerUserFormDTO param) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "customerUserList", param); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java index 8f0922d2b1..342300ea58 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java @@ -27,7 +27,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.GridLatestDTO; import com.epmet.dto.form.CustomerUserFormDTO; -import com.epmet.dto.result.CustomerUserResultDTO; +import com.epmet.dto.result.CustomerUser4PointResultDTO; import com.epmet.dto.result.LatestGridInfoResultDTO; import com.epmet.excel.GridLatestExcel; import com.epmet.service.GridLatestService; @@ -126,8 +126,8 @@ public class GridLatestController { * @date 2020.07.25 16:15 **/ @PostMapping("customeruserlist") - public Result> customerUserList(@RequestBody CustomerUserFormDTO param){ - return new Result>().ok(gridLatestService.getCustomerUsers(param)); + public Result> customerUserList(@RequestBody CustomerUserFormDTO param){ + return new Result>().ok(gridLatestService.getCustomerUsers(param)); } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java index b0a2490bda..ef513d0ac7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java @@ -6,7 +6,7 @@ import com.epmet.dto.UserHeadPhotoDTO; import com.epmet.dto.UserWechatDTO; import com.epmet.dto.form.WxLoginUserInfoFormDTO; import com.epmet.dto.result.CertifiedResultDTO; -import com.epmet.dto.result.CustomerUserResultDTO; +import com.epmet.dto.result.CustomerUser4PointResultDTO; import com.epmet.entity.UserWechatEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -73,6 +73,6 @@ public interface UserWechatDao extends BaseDao{ * @author wangc * @date 2020.07.27 00:58 **/ - List selectResiAndStrangerInfo(@Param("userIds") List userIds,@Param("realName")String realName); + List selectResiAndStrangerInfo(@Param("userIds") List userIds, @Param("realName")String realName); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java index 595f5a503f..4298d1ef68 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java @@ -24,7 +24,7 @@ import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.GridLatestDTO; import com.epmet.dto.form.CustomerUserFormDTO; import com.epmet.dto.form.VisitedFormDTO; -import com.epmet.dto.result.CustomerUserResultDTO; +import com.epmet.dto.result.CustomerUser4PointResultDTO; import com.epmet.dto.result.LatestGridInfoResultDTO; import com.epmet.entity.GridLatestEntity; @@ -129,6 +129,6 @@ public interface GridLatestService extends BaseService { * @author wangc * @date 2020.07.25 16:15 **/ - List getCustomerUsers(CustomerUserFormDTO customerUserFormDTO); + List getCustomerUsers(CustomerUserFormDTO customerUserFormDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java index a8938ea276..a3b1a97331 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java @@ -31,7 +31,7 @@ import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.GridLatestDTO; import com.epmet.dto.form.CustomerUserFormDTO; import com.epmet.dto.form.VisitedFormDTO; -import com.epmet.dto.result.CustomerUserResultDTO; +import com.epmet.dto.result.CustomerUser4PointResultDTO; import com.epmet.dto.result.LatestGridInfoResultDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.entity.GridLatestEntity; @@ -182,9 +182,9 @@ public class GridLatestServiceImpl extends BaseServiceImpl getCustomerUsers(CustomerUserFormDTO customerUserFormDTO) { + public List getCustomerUsers(CustomerUserFormDTO customerUserFormDTO) { List userIds = baseDao.selectAllUserByCustomerId(customerUserFormDTO.getCustomerId()); - List allData = new LinkedList<>(); + List allData = new LinkedList<>(); if(null == userIds || userIds.isEmpty()){ return allData; } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml index 9d3167ed1b..d3edc68319 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml @@ -91,7 +91,7 @@ - SELECT wechat.USER_ID, wechat.NICKNAME AS userNickname, From eb80a21b3b80a1f71f07dacd4587dd624d824933 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 28 Jul 2020 10:41:59 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=A7=AF=E5=88=86=E8=A7=84=E5=88=99?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dto/result/PointDetailResultDTO.java | 2 +- .../src/main/java/com/epmet/dto/result/PointRuleResultDTO.java | 1 + .../main/java/com/epmet/service/impl/PointRuleServiceImpl.java | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java index 8ed856dc91..a911fed232 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java @@ -19,6 +19,6 @@ public class PointDetailResultDTO implements Serializable { private Integer point; private String pointUnit; private String upLimit; - private String enabledFlag; + private Boolean enabledFlag; private String upLimitDesc; } diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java index bf8e546806..e66779580e 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java @@ -16,6 +16,7 @@ public class PointRuleResultDTO implements Serializable { private String ruleId; private String ruleName; private String ruleDesc; + private Boolean enabledFlag; /** * 拼接好的 积分值/单位 */ diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java index a0ef4fed91..68c14c2739 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java @@ -115,6 +115,7 @@ public class PointRuleServiceImpl extends BaseServiceImpl fun != null).collect(Collectors.toList()); @@ -129,7 +130,7 @@ public class PointRuleServiceImpl extends BaseServiceImpl