From d25b1c96cf281c3716fd4ab96f53462e11b7a880 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Tue, 14 Jun 2022 16:56:12 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=A7=AF=E5=88=86=EF=BC=8C?= =?UTF-8?q?=E6=80=BB=E5=88=86=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../redis/common/bean/ResiUserInfoCache.java | 99 ++++++++++ .../com/epmet/dto/PointAditiveCalcDTO.java | 79 ++++++++ .../com/epmet/dto/PointAditiveRecordDTO.java | 95 ++++++++++ .../java/com/epmet/dto/PointAnnexDTO.java | 80 ++++++++ .../java/com/epmet/dto/PointApplyDTO.java | 174 ++++++++++++++++++ .../com/epmet/dto/form/PointApplyFormDTO.java | 32 ++++ .../dto/result/MyTotalPointResultDTO.java | 37 ++++ .../java/com/epmet/common/CommonConstant.java | 48 +++++ .../com/epmet/common/enu/ApplyStatusEnum.java | 49 +++++ .../controller/PointApplyController.java | 84 +++++++++ .../epmet/controller/ResiPointController.java | 5 + .../com/epmet/dao/PointAditiveCalcDao.java | 16 ++ .../com/epmet/dao/PointAditiveRecordDao.java | 16 ++ .../java/com/epmet/dao/PointAnnexDao.java | 16 ++ .../java/com/epmet/dao/PointApplyDao.java | 16 ++ .../epmet/entity/PointAditiveCalcEntity.java | 46 +++++ .../entity/PointAditiveRecordEntity.java | 61 ++++++ .../com/epmet/entity/PointAnnexEntity.java | 45 +++++ .../com/epmet/entity/PointApplyEntity.java | 144 +++++++++++++++ .../service/PointAditiveCalcService.java | 78 ++++++++ .../service/PointAditiveRecordService.java | 78 ++++++++ .../com/epmet/service/PointAnnexService.java | 78 ++++++++ .../com/epmet/service/PointApplyService.java | 88 +++++++++ .../epmet/service/UserPointTotalService.java | 12 ++ .../impl/PointAditiveCalcServiceImpl.java | 82 +++++++++ .../impl/PointAditiveRecordServiceImpl.java | 84 +++++++++ .../service/impl/PointAnnexServiceImpl.java | 83 +++++++++ .../service/impl/PointApplyServiceImpl.java | 153 +++++++++++++++ .../impl/UserPointTotalServiceImpl.java | 77 +++++++- .../resources/mapper/PointAditiveCalcDao.xml | 22 +++ .../mapper/PointAditiveRecordDao.xml | 25 +++ .../main/resources/mapper/PointAnnexDao.xml | 21 +++ .../main/resources/mapper/PointApplyDao.xml | 41 +++++ .../epmet/dto/result/HomeInfoResultDTO.java | 1 + .../epmet/feign/EpmetUserOpenFeignClient.java | 3 + .../EpmetUserOpenFeignClientFallback.java | 5 + .../epmet/service/impl/MyHomeServiceImpl.java | 1 + 37 files changed, 2071 insertions(+), 3 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/ResiUserInfoCache.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAditiveCalcDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAditiveRecordDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAnnexDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointApplyDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointApplyFormDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/MyTotalPointResultDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/CommonConstant.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/ApplyStatusEnum.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointApplyController.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAditiveCalcDao.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAditiveRecordDao.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAnnexDao.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointApplyDao.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAditiveCalcEntity.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAditiveRecordEntity.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAnnexEntity.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointApplyEntity.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAditiveCalcService.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAditiveRecordService.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAnnexService.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointApplyService.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAditiveCalcServiceImpl.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAditiveRecordServiceImpl.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAnnexServiceImpl.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointApplyServiceImpl.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAditiveCalcDao.xml create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAditiveRecordDao.xml create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAnnexDao.xml create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointApplyDao.xml diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/ResiUserInfoCache.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/ResiUserInfoCache.java new file mode 100644 index 0000000000..6cba629aca --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/ResiUserInfoCache.java @@ -0,0 +1,99 @@ +package com.epmet.commons.tools.redis.common.bean; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 房屋信息缓存 + * @author Administrator + */ +@Data +public class ResiUserInfoCache implements Serializable { + private String id; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 用户id + */ + private String userId; + + /** + * 手机号(注册手机号) + */ + private String mobile; + + /** + * 姓氏 + */ + private String surname; + + /** + * 名 + */ + private String name; + + /** + * 姓名 + */ + private String realName; + + /** + * 身份证号 + */ + private String idNum; + + /** + * 性别(1男2女0未知) + */ + private String gender; + + /** + * 街道 + */ + private String street; + + /** + * 小区名称 + */ + private String district; + + /** + * 楼栋单元 + */ + private String buildingAddress; + + /** + * 昵称(目前来源于微信昵称,后续系统可支持用户有昵称) + */ + private String nickname; + + /** + * 头像(目前来源于微信,后续系统顾客支持上传头像) + */ + private String headImgUrl; + + /** + * 网格Id + * */ + private String registeredGridId; + + /** + * xx机关-yy网格 + * */ + private String registeredGridName; + + /** + * 显示昵称 xx网格-y先生/女士 + * */ + private String showName; + + /** + * xxx街道-尹女士 + */ + private String userShowName; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAditiveCalcDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAditiveCalcDTO.java new file mode 100644 index 0000000000..dd61db0db7 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAditiveCalcDTO.java @@ -0,0 +1,79 @@ +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 2022-06-14 + */ +@Data +public class PointAditiveCalcDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 积分类别;德育积分moral_education;党建积分party_building + */ + private String categoryCode; + + /** + * 积分主体ID;居民端用户ID或房屋ID + */ + private String subjectId; + + /** + * 已用积分;累计已花费 + */ + private Integer spend; + + /** + * 总分;累计积分 + */ + private Integer total; + + /** + * 删除标识;0.未删除 1.已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAditiveRecordDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAditiveRecordDTO.java new file mode 100644 index 0000000000..b72fe77a08 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAditiveRecordDTO.java @@ -0,0 +1,95 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 附加积分记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +@Data +public class PointAditiveRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 标题;积分变动标题或业务场景标题 + */ + private String title; + + /** + * 说明;积分变动的说明 + */ + private String statement; + + /** + * 分值 + */ + private Integer pointValue; + + /** + * 积分类别;德育积分moral_education;党建积分party_building + */ + private String categoryCode; + + /** + * 积分主体ID;居民端用户ID或房屋ID + */ + private String subjectId; + + /** + * 业务主键 + */ + private String businessId; + + /** + * 业务编码;积分申请point_apply;积分奖励point_reward;积分扣罚point_fine;积分花费point_cost;驳回积分申请point_reject + */ + private String businessCode; + + /** + * 删除标识;0.未删除 1.已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAnnexDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAnnexDTO.java new file mode 100644 index 0000000000..db0bcc7e16 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAnnexDTO.java @@ -0,0 +1,80 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 积分相关附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +@Data +public class PointAnnexDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 业务ID;业务主键,包括积分申请、奖扣等业务 + */ + private String businessId; + + /** + * 业务编码;积分申请point_apply,积分奖励point_reward,积分扣罚point_fine,积分花费point_cost + */ + private String businessCode; + + /** + * 附件访问地址 + */ + private String url; + + /** + * 排序 + */ + private Integer sort; + + /** + * 删除标识;0.未删除 1.已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointApplyDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointApplyDTO.java new file mode 100644 index 0000000000..459447f84c --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointApplyDTO.java @@ -0,0 +1,174 @@ +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 2022-06-14 + */ +@Data +public class PointApplyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 类别ID + */ + private String categoryId; + + /** + * 类别名称 + */ + private String categoryName; + + /** + * 类别编码;德育积分moral_education;党建积分party_building + */ + private String categoryCode; + + /** + * 积分规则ID + */ + private String ruleId; + + /** + * 积分规则名称 + */ + private String ruleName; + + /** + * 申请标题;30字内 + */ + private String title; + + /** + * 申请内容说明;1000字内 + */ + private String statement; + + /** + * 申请状态;0已提交;1已驳回;2已通过 + */ + private String status; + + /** + * 申请人所属网格名称 + */ + private String gridName; + + /** + * 申请人所属网格ID + */ + private String gridId; + + /** + * 申请人所属组织ID + */ + private String agencyId; + + /** + * 上级组织ID路径 + */ + private String agencyPids; + + /** + * 用户ID;申请人ID(居民端用户ID) + */ + private String userId; + + /** + * 居民ID;申请人居民ID(IC_RESI_USER表主键) + */ + private String icResiUser; + + /** + * 房屋ID;房屋或家庭ID + */ + private String houseId; + + /** + * 房屋名称;完整拼接的名称 + */ + private String houseAllName; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * 昵称 + */ + private String nickname; + + /** + * 性别;未知0;男1;女2 + */ + private String gender; + + /** + * 姓名 + */ + private String name; + + /** + * 身份证号 + */ + private String idCard; + + /** + * 手机号 + */ + private String mobile; + + /** + * 审核备注 + */ + private String remark; + + /** + * 删除标识;0.未删除 1.已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointApplyFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointApplyFormDTO.java new file mode 100644 index 0000000000..2d46dca728 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointApplyFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.AddGroup; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/14 14:08 + */ +@NoArgsConstructor +@Data +public class PointApplyFormDTO implements Serializable { + private static final long serialVersionUID = 4850146857511834988L; + private String customerId; + private String userId; + @NotBlank(message = "申请类别不能为空", groups = {AddGroup.class}) + private String ruleId; + @NotBlank(message = "标题不能为空", groups = {AddGroup.class}) + private String title; + @NotBlank(message = "申请内容不能为空", groups = {AddGroup.class}) + private String statement; + @NotBlank(message = "分类不能为空", groups = {AddGroup.class}) + private String categoryCode; + private List annexList; + private String gridId; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/MyTotalPointResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/MyTotalPointResultDTO.java new file mode 100644 index 0000000000..81d70ffd3c --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/MyTotalPointResultDTO.java @@ -0,0 +1,37 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/14 15:39 + */ +@Data +public class MyTotalPointResultDTO implements Serializable { + private static final long serialVersionUID = 15299506166024546L; + /** + * 德育积分moral_education;党建积分party_building;活跃积分active + */ + private String categoryCode; + /** + * 总积分 + */ + private Integer total; + /** + * 已花费积分 + */ + private Integer spend; + /** + * 可用积分 + */ + private Integer usable; + + public MyTotalPointResultDTO() { + this.total = 0; + this.spend = 0; + this.usable = 0; + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/CommonConstant.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/CommonConstant.java new file mode 100644 index 0000000000..9f8a8786d9 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/CommonConstant.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.common; + +import com.epmet.commons.tools.constant.Constant; + +/** + * 身边党员-积分排行 入参常量 + * + * @author Mark sunlightcs@gmail.com + * @since 1.1.0 + */ +public interface CommonConstant extends Constant { + /** + * 德育积分 + */ + String MORAL_EDUCATION = "moral_education"; + /** + * 党建积分 + */ + String PARTY_BUILDING = "party_building"; + /** + * 活跃积分 + */ + String ACTIVE = "active"; + /** + * 积分申请 + */ + String POINT_APPLY = "point_apply"; + /** + * 积分奖励 + */ + String POINT_REWARD = "point_reward"; + /** + * 积分扣罚 + */ + String POINT_FINE = "point_fine"; + /** + * 积分花费 + */ + String POINT_COST = "point_cost"; +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/ApplyStatusEnum.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/ApplyStatusEnum.java new file mode 100644 index 0000000000..5db66d452b --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/ApplyStatusEnum.java @@ -0,0 +1,49 @@ +package com.epmet.common.enu; + +import java.util.Objects; + +/** + * @author Administrator + */ + +public enum ApplyStatusEnum { + //审核状态 + AUDITING("0", "未审核"), + REJECT("1", "未通过"), + PASSED("2", "已通过"); + + private String code; + private String name; + + + ApplyStatusEnum(String code, String name) { + this.code = code; + this.name = name; + } + + public static String getName(String code) { + ApplyStatusEnum[] applyStatusEnums = values(); + for (ApplyStatusEnum applyStatusEnum : applyStatusEnums) { + if (Objects.equals(applyStatusEnum.getCode(), code)) { + return applyStatusEnum.getName(); + } + } + return null; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointApplyController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointApplyController.java new file mode 100644 index 0000000000..4f7ba03a07 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointApplyController.java @@ -0,0 +1,84 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +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.PointApplyDTO; +import com.epmet.dto.form.PointApplyFormDTO; +import com.epmet.service.PointApplyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 积分申请 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +@RestController +@RequestMapping("apply") +public class PointApplyController { + + @Autowired + private PointApplyService pointApplyService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = pointApplyService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + PointApplyDTO data = pointApplyService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody PointApplyDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + pointApplyService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody PointApplyDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + pointApplyService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + pointApplyService.delete(ids); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("submit") + public Result submit(@LoginUser TokenDto tokenDto, @RequestBody PointApplyFormDTO formDTO){ + //效验数据 + ValidatorUtils.validateEntity(formDTO, AddGroup.class, DefaultGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + pointApplyService.submit(formDTO); + return new Result(); + } + +} 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 0b19244e0a..05b37956d2 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 @@ -232,5 +232,10 @@ public class ResiPointController { return new Result().ok(userPointStatisticalDailyService.gridPointRank(tokenDto, formDTO)); } + @PostMapping("total") + public Result> totalPoint(@LoginUser TokenDto tokenDto) { + return new Result>().ok(userPointTotalService.totalPoint(tokenDto)); + } + } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAditiveCalcDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAditiveCalcDao.java new file mode 100644 index 0000000000..b5410693e5 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAditiveCalcDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.PointAditiveCalcEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 附加积分计算 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +@Mapper +public interface PointAditiveCalcDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAditiveRecordDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAditiveRecordDao.java new file mode 100644 index 0000000000..cf95a4367c --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAditiveRecordDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.PointAditiveRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 附加积分记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +@Mapper +public interface PointAditiveRecordDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAnnexDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAnnexDao.java new file mode 100644 index 0000000000..6d1163adc3 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAnnexDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.PointAnnexEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 积分相关附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +@Mapper +public interface PointAnnexDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointApplyDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointApplyDao.java new file mode 100644 index 0000000000..29fd3d8c90 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointApplyDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.PointApplyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 积分申请 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +@Mapper +public interface PointApplyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAditiveCalcEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAditiveCalcEntity.java new file mode 100644 index 0000000000..552b9e5dea --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAditiveCalcEntity.java @@ -0,0 +1,46 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 附加积分计算 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("point_aditive_calc") +public class PointAditiveCalcEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 积分类别;德育积分moral_education;党建积分party_building + */ + private String categoryCode; + + /** + * 积分主体ID;居民端用户ID或房屋ID + */ + private String subjectId; + + /** + * 已用积分;累计已花费 + */ + private Integer spend; + + /** + * 总分;累计积分 + */ + private Integer total; + +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAditiveRecordEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAditiveRecordEntity.java new file mode 100644 index 0000000000..1a3ad83056 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAditiveRecordEntity.java @@ -0,0 +1,61 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 附加积分记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("point_aditive_record") +public class PointAditiveRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 标题;积分变动标题或业务场景标题 + */ + private String title; + + /** + * 说明;积分变动的说明 + */ + private String statement; + + /** + * 分值 + */ + private Integer pointValue; + + /** + * 积分类别;德育积分moral_education;党建积分party_building + */ + private String categoryCode; + + /** + * 积分主体ID;居民端用户ID或房屋ID + */ + private String subjectId; + + /** + * 业务主键 + */ + private String businessId; + + /** + * 业务编码;积分申请point_apply;积分奖励point_reward;积分扣罚point_fine;积分花费point_cost;驳回积分申请point_reject + */ + private String businessCode; + +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAnnexEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAnnexEntity.java new file mode 100644 index 0000000000..b5b19d6ccb --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAnnexEntity.java @@ -0,0 +1,45 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 积分相关附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("point_annex") +public class PointAnnexEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 业务ID;业务主键,包括积分申请、奖扣等业务 + */ + private String businessId; + + /** + * 业务编码;积分申请point_apply,积分奖励point_reward,积分扣罚point_fine,积分花费point_cost + */ + private String businessCode; + + /** + * 附件访问地址 + */ + private String url; + + /** + * 排序 + */ + private Integer sort; +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointApplyEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointApplyEntity.java new file mode 100644 index 0000000000..29c2272fec --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointApplyEntity.java @@ -0,0 +1,144 @@ +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 2022-06-14 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("point_apply") +public class PointApplyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 类别ID + */ + private String categoryId; + + /** + * 类别名称 + */ + private String categoryName; + + /** + * 类别编码;德育积分moral_education;党建积分party_building + */ + private String categoryCode; + + /** + * 积分规则ID + */ + private String ruleId; + + /** + * 积分规则名称 + */ + private String ruleName; + + /** + * 申请标题;30字内 + */ + private String title; + + /** + * 申请内容说明;1000字内 + */ + private String statement; + + /** + * 申请状态;0已提交;1已驳回;2已通过 + */ + private String status; + + /** + * 申请人所属网格名称 + */ + private String gridName; + + /** + * 申请人所属网格ID + */ + private String gridId; + + /** + * 申请人所属组织ID + */ + private String agencyId; + + /** + * 上级组织ID路径 + */ + private String agencyPids; + + /** + * 用户ID;申请人ID(居民端用户ID) + */ + private String userId; + + /** + * 居民ID;申请人居民ID(IC_RESI_USER表主键) + */ + private String icResiUser; + + /** + * 房屋ID;房屋或家庭ID + */ + private String houseId; + + /** + * 房屋名称;完整拼接的名称 + */ + private String houseAllName; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * 昵称 + */ + private String nickname; + + /** + * 性别;未知0;男1;女2 + */ + private String gender; + + /** + * 姓名 + */ + private String name; + + /** + * 身份证号 + */ + private String idCard; + + /** + * 手机号 + */ + private String mobile; + + /** + * 审核备注 + */ + private String remark; + +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAditiveCalcService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAditiveCalcService.java new file mode 100644 index 0000000000..6b87e5cefc --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAditiveCalcService.java @@ -0,0 +1,78 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.PointAditiveCalcDTO; +import com.epmet.entity.PointAditiveCalcEntity; + +import java.util.List; +import java.util.Map; + +/** + * 附加积分计算 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +public interface PointAditiveCalcService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-06-14 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-06-14 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PointAditiveCalcDTO + * @author generator + * @date 2022-06-14 + */ + PointAditiveCalcDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-06-14 + */ + void save(PointAditiveCalcDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-06-14 + */ + void update(PointAditiveCalcDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-06-14 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAditiveRecordService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAditiveRecordService.java new file mode 100644 index 0000000000..857d5b797d --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAditiveRecordService.java @@ -0,0 +1,78 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.PointAditiveRecordDTO; +import com.epmet.entity.PointAditiveRecordEntity; + +import java.util.List; +import java.util.Map; + +/** + * 附加积分记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +public interface PointAditiveRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-06-14 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-06-14 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PointAditiveRecordDTO + * @author generator + * @date 2022-06-14 + */ + PointAditiveRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-06-14 + */ + void save(PointAditiveRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-06-14 + */ + void update(PointAditiveRecordDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-06-14 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAnnexService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAnnexService.java new file mode 100644 index 0000000000..f2c7cdb49e --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAnnexService.java @@ -0,0 +1,78 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.PointAnnexDTO; +import com.epmet.entity.PointAnnexEntity; + +import java.util.List; +import java.util.Map; + +/** + * 积分相关附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +public interface PointAnnexService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-06-14 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-06-14 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PointAnnexDTO + * @author generator + * @date 2022-06-14 + */ + PointAnnexDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-06-14 + */ + void save(PointAnnexDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-06-14 + */ + void update(PointAnnexDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-06-14 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointApplyService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointApplyService.java new file mode 100644 index 0000000000..7988b94f26 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointApplyService.java @@ -0,0 +1,88 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.PointApplyDTO; +import com.epmet.dto.form.PointApplyFormDTO; +import com.epmet.entity.PointApplyEntity; + +import java.util.List; +import java.util.Map; + +/** + * 积分申请 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +public interface PointApplyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-06-14 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-06-14 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PointApplyDTO + * @author generator + * @date 2022-06-14 + */ + PointApplyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-06-14 + */ + void save(PointApplyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-06-14 + */ + void update(PointApplyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-06-14 + */ + void delete(String[] ids); + + /** + * 申请德育积分/党建积分 + * @Param formDTO + * @Return + * @Author zhaoqifeng + * @Date 2022/6/14 14:14 + */ + void submit(PointApplyFormDTO formDTO); +} \ 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 8c9977dce8..07bc0b77e1 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 @@ -18,8 +18,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.form.CommonUserFormDTO; import com.epmet.dto.form.ResiPointRankFormDTO; +import com.epmet.dto.result.MyTotalPointResultDTO; import com.epmet.dto.result.ResiPointDetailResultDTO; import com.epmet.dto.result.ResiPointRankListResultDTO; import com.epmet.entity.UserPointTotalEntity; @@ -69,4 +71,14 @@ public interface UserPointTotalService extends BaseService * @date 2020.07.22 15:58 **/ ResiPointDetailResultDTO getMyPointGroupByCustomer(CommonUserFormDTO customerUserParam); + + /** + * 积分总分 + * + * @Param tokenDto + * @Return {@link MyTotalPointResultDTO} + * @Author zhaoqifeng + * @Date 2022/6/14 15:46 + */ + List totalPoint(TokenDto tokenDto); } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAditiveCalcServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAditiveCalcServiceImpl.java new file mode 100644 index 0000000000..2b8bc7ed16 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAditiveCalcServiceImpl.java @@ -0,0 +1,82 @@ +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.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.PointAditiveCalcDao; +import com.epmet.dto.PointAditiveCalcDTO; +import com.epmet.entity.PointAditiveCalcEntity; +import com.epmet.service.PointAditiveCalcService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 附加积分计算 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +@Service +public class PointAditiveCalcServiceImpl extends BaseServiceImpl implements PointAditiveCalcService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PointAditiveCalcDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PointAditiveCalcDTO.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 PointAditiveCalcDTO get(String id) { + PointAditiveCalcEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PointAditiveCalcDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PointAditiveCalcDTO dto) { + PointAditiveCalcEntity entity = ConvertUtils.sourceToTarget(dto, PointAditiveCalcEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PointAditiveCalcDTO dto) { + PointAditiveCalcEntity entity = ConvertUtils.sourceToTarget(dto, PointAditiveCalcEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAditiveRecordServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAditiveRecordServiceImpl.java new file mode 100644 index 0000000000..6ca0fb5f22 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAditiveRecordServiceImpl.java @@ -0,0 +1,84 @@ +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.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.PointAditiveRecordDao; +import com.epmet.dto.PointAditiveRecordDTO; +import com.epmet.entity.PointAditiveRecordEntity; +import com.epmet.service.PointAditiveRecordService; +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; + +/** + * 附加积分记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +@Service +public class PointAditiveRecordServiceImpl extends BaseServiceImpl implements PointAditiveRecordService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PointAditiveRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PointAditiveRecordDTO.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 PointAditiveRecordDTO get(String id) { + PointAditiveRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PointAditiveRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PointAditiveRecordDTO dto) { + PointAditiveRecordEntity entity = ConvertUtils.sourceToTarget(dto, PointAditiveRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PointAditiveRecordDTO dto) { + PointAditiveRecordEntity entity = ConvertUtils.sourceToTarget(dto, PointAditiveRecordEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAnnexServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAnnexServiceImpl.java new file mode 100644 index 0000000000..fdfd83e9fd --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAnnexServiceImpl.java @@ -0,0 +1,83 @@ +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.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.PointAnnexDao; +import com.epmet.dto.PointAnnexDTO; +import com.epmet.entity.PointAnnexEntity; +import com.epmet.service.PointAnnexService; +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; + +/** + * 积分相关附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +@Service +public class PointAnnexServiceImpl extends BaseServiceImpl implements PointAnnexService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PointAnnexDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PointAnnexDTO.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 PointAnnexDTO get(String id) { + PointAnnexEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PointAnnexDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PointAnnexDTO dto) { + PointAnnexEntity entity = ConvertUtils.sourceToTarget(dto, PointAnnexEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PointAnnexDTO dto) { + PointAnnexEntity entity = ConvertUtils.sourceToTarget(dto, PointAnnexEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointApplyServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointApplyServiceImpl.java new file mode 100644 index 0000000000..4827ab4d2d --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointApplyServiceImpl.java @@ -0,0 +1,153 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.common.CommonConstant; +import com.epmet.common.enu.ApplyStatusEnum; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.PointAnnexDao; +import com.epmet.dao.PointApplyDao; +import com.epmet.dto.PointApplyDTO; +import com.epmet.dto.form.PointApplyFormDTO; +import com.epmet.dto.result.HomeInfoResultDTO; +import com.epmet.entity.PointAnnexEntity; +import com.epmet.entity.PointApplyEntity; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.service.PointApplyService; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * 积分申请 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-14 + */ +@Service +public class PointApplyServiceImpl extends BaseServiceImpl implements PointApplyService { + + @Resource + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Resource + private PointAnnexDao pointAnnexDao; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PointApplyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PointApplyDTO.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 PointApplyDTO get(String id) { + PointApplyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PointApplyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PointApplyDTO dto) { + PointApplyEntity entity = ConvertUtils.sourceToTarget(dto, PointApplyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PointApplyDTO dto) { + PointApplyEntity entity = ConvertUtils.sourceToTarget(dto, PointApplyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 申请德育积分/党建积分 + * + * @param formDTO + * @Param formDTO + * @Return + * @Author zhaoqifeng + * @Date 2022/6/14 14:14 + */ + @Override + public void submit(PointApplyFormDTO formDTO) { + PointApplyEntity entity = ConvertUtils.sourceToTarget(formDTO, PointApplyEntity.class); + //从缓存获取网格信息 + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(formDTO.getGridId()); + if (null == gridInfo) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取网格缓存失败", "获取网格缓存失败"); + } + //如果申请类型为德育积分,需要获取用户所在房屋 + if (CommonConstant.MORAL_EDUCATION.equals(formDTO.getCategoryCode())) { + Result result = epmetUserOpenFeignClient.getHomeInfo(); + if (!result.success() || null == result.getData()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取居民所在家庭信息失败", "获取居民所在家庭信息失败"); + } + if (StringUtils.isBlank(result.getData().getHouseId())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "无法申请", "没有绑定家庭,无法申请德育积分"); + } + entity.setHouseId(result.getData().getHouseId()); + } + + entity.setAgencyId(gridInfo.getPid()); + entity.setAgencyPids(gridInfo.getPids()); + entity.setStatus(ApplyStatusEnum.AUDITING.getCode()); + baseDao.insert(entity); + + //保存附件 + if (CollectionUtils.isNotEmpty(formDTO.getAnnexList())) { + AtomicInteger i = new AtomicInteger(NumConstant.ONE); + formDTO.getAnnexList().forEach(url -> { + PointAnnexEntity annex = new PointAnnexEntity(); + annex.setCustomerId(formDTO.getCustomerId()); + annex.setBusinessId(entity.getId()); + annex.setBusinessCode(CommonConstant.POINT_APPLY); + annex.setUrl(url); + annex.setSort(i.getAndIncrement()); + pointAnnexDao.insert(annex); + }); + } + + } + +} \ 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 66f83715c8..4dbda58db2 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 @@ -17,15 +17,22 @@ package com.epmet.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.epmet.common.CommonConstant; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.PointAditiveCalcDao; import com.epmet.dao.UserPointTotalDao; import com.epmet.dto.form.CommonUserFormDTO; import com.epmet.dto.form.ResiPointRankFormDTO; import com.epmet.dto.result.*; +import com.epmet.entity.PointAditiveCalcEntity; import com.epmet.entity.UserPointTotalEntity; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.service.UserPointTotalService; @@ -33,9 +40,9 @@ import com.github.pagehelper.PageHelper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -50,8 +57,10 @@ import java.util.stream.Collectors; @Slf4j public class UserPointTotalServiceImpl extends BaseServiceImpl implements UserPointTotalService { - @Autowired - EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Resource + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Resource + private PointAditiveCalcDao pointAditiveCalcDao; /** * @Description 获取指定居民的积分信息 @@ -203,4 +212,66 @@ public class UserPointTotalServiceImpl extends BaseServiceImpl totalPoint(TokenDto tokenDto) { + List list = new ArrayList(); + //活跃度积分 + MyTotalPointResultDTO active = new MyTotalPointResultDTO(); + active.setCategoryCode(CommonConstant.ACTIVE); + ResiPointDetailResultDTO activeTotal = baseDao.selectPointByCustomerUserId(tokenDto.getUserId(), tokenDto.getCustomerId()); + if (null != activeTotal) { + active.setTotal(activeTotal.getAccumulatedPoint()); + active.setUsable(activeTotal.getUsablePoint()); + active.setSpend(activeTotal.getAccumulatedPoint() - activeTotal.getUsablePoint()); + } + list.add(active); + //德育积分 + MyTotalPointResultDTO education = new MyTotalPointResultDTO(); + education.setCategoryCode(CommonConstant.MORAL_EDUCATION); + //获取居民绑定的家庭 + Result result = epmetUserOpenFeignClient.getHomeInfo(); + if (!result.success() || null == result.getData()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取居民绑定家庭信息失败", "获取居民绑定家庭信息失败"); + } + if (StringUtils.isNotBlank(result.getData().getHouseId())) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PointAditiveCalcEntity::getCustomerId, tokenDto.getCustomerId()); + wrapper.eq(PointAditiveCalcEntity::getSubjectId, result.getData().getHouseId()); + wrapper.eq(PointAditiveCalcEntity::getCategoryCode, CommonConstant.MORAL_EDUCATION); + PointAditiveCalcEntity entity = pointAditiveCalcDao.selectOne(wrapper); + if (null != entity) { + education.setTotal(entity.getTotal()); + education.setSpend(entity.getSpend()); + education.setUsable(entity.getTotal() - entity.getSpend()); + } + } + list.add(education); + + //党建积分 + MyTotalPointResultDTO party = new MyTotalPointResultDTO(); + party.setCategoryCode(CommonConstant.PARTY_BUILDING); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PointAditiveCalcEntity::getCustomerId, tokenDto.getCustomerId()); + wrapper.eq(PointAditiveCalcEntity::getSubjectId, tokenDto.getUserId()); + wrapper.eq(PointAditiveCalcEntity::getCategoryCode, CommonConstant.PARTY_BUILDING); + PointAditiveCalcEntity entity = pointAditiveCalcDao.selectOne(wrapper); + if (null != entity) { + party.setTotal(entity.getTotal()); + party.setSpend(entity.getSpend()); + party.setUsable(entity.getTotal() - entity.getSpend()); + } + list.add(party); + + return list; + } + } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAditiveCalcDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAditiveCalcDao.xml new file mode 100644 index 0000000000..c015362019 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAditiveCalcDao.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAditiveRecordDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAditiveRecordDao.xml new file mode 100644 index 0000000000..4839dd26fa --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAditiveRecordDao.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAnnexDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAnnexDao.xml new file mode 100644 index 0000000000..b53f102654 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAnnexDao.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointApplyDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointApplyDao.xml new file mode 100644 index 0000000000..6daa8936d8 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointApplyDao.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/HomeInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/HomeInfoResultDTO.java index 5ff591455f..e890aa3092 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/HomeInfoResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/HomeInfoResultDTO.java @@ -16,6 +16,7 @@ public class HomeInfoResultDTO implements Serializable { private static final long serialVersionUID = -6109420020924607393L; private String icResiUserId; + private String houseId; private String houseName; private String houseCode; private String qrCodeUrl; 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 e5952a2726..2071c9f904 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 @@ -806,4 +806,7 @@ public interface EpmetUserOpenFeignClient { @PostMapping("/epmetuser/icVolunteerPoly/volunteerDataExtraction/{customerId}") Result volunteerDataExtraction(@PathVariable("customerId") String customerId); + + @PostMapping("/epmetuser/myHome/homeInfo") + Result getHomeInfo(); } 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 404ba7d0c3..23554e16d4 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 @@ -595,4 +595,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "volunteerDataExtraction", customerId); } + @Override + public Result getHomeInfo() { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getHomeInfo"); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/MyHomeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/MyHomeServiceImpl.java index 6fb98f8b7a..9ae1bba783 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/MyHomeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/MyHomeServiceImpl.java @@ -183,6 +183,7 @@ public class MyHomeServiceImpl implements MyHomeService { if (null == houseInfo) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取房屋信息失败", "获取房屋信息失败"); } + resultDto.setHouseId(houseInfo.getHomeId()); resultDto.setHouseName(houseInfo.getAllName()); resultDto.setHouseCode(houseInfo.getHouseCode()); resultDto.setQrCodeUrl(houseInfo.getHouseQrcodeUrl());