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-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java index c5845d11c8..899a40c76b 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java @@ -3,6 +3,8 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; 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.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; @@ -309,6 +311,14 @@ public class CodeServiceImpl implements CodeService { if (null == authInfo) { throw new RenException("未授权"); } + //校验小程序是否设置了用户隐私 如果没有设置则执行设置后 再发布 + WxResult privacySetting = wxMaCodeService.getPrivacySetting(authInfo.getAuthorizerAccessToken()); + if (!privacySetting.success()){ + WxResult stringWxResult = wxMaCodeService.setPrivacySetting(authInfo.getAuthorizerAccessToken()); + if (!stringWxResult.success()){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),stringWxResult.getErrorMsg(),"用户隐私权限设置失败"); + } + } //获取上传代码信息 CodeCustomerDTO uploadCode = codeCustomerService.getUploadCodeByCustomer(formDTO.getCodeId(), codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType()); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java index 7d1263e3b3..735a3b4569 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java @@ -200,4 +200,16 @@ public interface WxMaCodeConstant { * 获取代码草稿列表 */ String DELETE_TEMPLATE_URL = "https://api.weixin.qq.com/wxa/deletetemplate"; + + /** + * 获取用户隐私地址 + * @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html + */ + String GET_PRIVACY_SETTING_URL = "https://api.weixin.qq.com/cgi-bin/component/getprivacysetting"; + + /** + * 设置用户隐私地址 + * @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html + */ + String SET_PRIVACY_SETTING_URL = "https://api.weixin.qq.com/cgi-bin/component/setprivacysetting"; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java index 452ad866e1..e116eca160 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java @@ -72,6 +72,22 @@ public interface WxMaCodeService { */ WxResult submitAudit(String accessToken, WxMaCodeSubmitAuditRequest auditRequest); + /** + * 获取用户隐私接口权限. + * + * @param accessToken 小程序对应的accessToken + * @return 审核编号 + */ + WxResult getPrivacySetting(String accessToken); + + /** + * 设置用户隐私接口权限. + * + * @param accessToken 小程序对应的accessToken + * @return 审核编号 + */ + WxResult setPrivacySetting(String accessToken); + /** * 加急审核申请 * @author zhaoqifeng @@ -197,7 +213,7 @@ public interface WxMaCodeService { /** * 版本退回 * @author zhaoqifeng - * @date 2020/8/10 15:41 + * @date 2020/8/10 15:41 * @param accessToken * @return com.epmet.wxapi.result.WxResult */ @@ -215,7 +231,7 @@ public interface WxMaCodeService { /** * 将草稿添加到代码模板库 * @author zhaoqifeng - * @date 2020/10/28 10:23 + * @date 2020/10/28 10:23 * @param accessToken * @param request * @return com.epmet.wxapi.result.WxResult diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java index ecf30738c8..b7a6a6374b 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java @@ -1,5 +1,7 @@ package com.epmet.wxapi.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.HttpClientManager; @@ -36,6 +38,7 @@ import java.util.Map; public class WxMaCodeServiceImpl implements WxMaCodeService { private static final String ERR_CODE = "errcode"; private static final String ERR_MSG = "errmsg"; + private static final String SETTING_LIST = "setting_list"; @Autowired private WxMaDomainDTO wxMaDomainDTO; @@ -150,6 +153,50 @@ public class WxMaCodeServiceImpl implements WxMaCodeService { return result; } + @Override + public WxResult getPrivacySetting(String accessToken) { + WxResult result = new WxResult<>(); + String url = WxMaCodeConstant.SET_PRIVACY_SETTING_URL + "?" + "access_token=" + accessToken; + Result submitResult = HttpClientManager.getInstance().sendPostByJSON(url, "{}"); + log.info("getPrivacySetting result:{}", JSON.toJSONString(submitResult)); + if (!submitResult.success()) { + result.setErrorCode(submitResult.getCode()); + result.setErrorMsg(submitResult.getMsg()); + return result; + } + JSONObject jsonObject = JSONObject.parseObject(submitResult.getData()); + + + JSONArray jsonArray = jsonObject.getJSONArray(SETTING_LIST); + if (jsonArray.size() == 9){ + result.setErrorCode(9999); + result.setErrorMsg("用户隐私权限未设置或设置不完整"); + return result; + } + result.setErrorCode(jsonObject.getInteger(ERR_CODE)); + result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(jsonObject.getInteger(ERR_CODE))); + return result; + } + + @Override + public WxResult setPrivacySetting(String accessToken) { + //todo 目前设置9个隐私权限 + String param = "{\"owner_setting\":{\"contact_email\":\"eshitong@elink-cn.com\",\"contact_phone\":\"\",\"contact_qq\":\"\",\"contact_weixin\":\"\",\"ext_file_media_id\":\"\",\"notice_method\":\"通知\",\"store_expire_timestamp\":\"\"},\"setting_list\":[{\"privacy_key\":\"UserInfo\",\"privacy_text\":\"用户个人中心显示用户头像及昵称等\"},{\"privacy_key\":\"Location\",\"privacy_text\":\"发表话题等功能时获取位置信息\"},{\"privacy_key\":\"Record\",\"privacy_text\":\"录音发话题等\"},{\"privacy_key\":\"Album\",\"privacy_text\":\"上传照片发话题等\"},{\"privacy_key\":\"AlbumWriteOnly\",\"privacy_text\":\"下载党建声音图片或项目附近等\"},{\"privacy_key\":\"Camera\",\"privacy_text\":\"通过相机拍照发话题反应问题等\"},{\"privacy_key\":\"PhoneNumber\",\"privacy_text\":\"通过手机号为用户开通账号,更新用户基础信息\"},{\"privacy_key\":\"MessageFile\",\"privacy_text\":\"发表话题等可以选择文件上传\"},{\"privacy_key\":\"ChooseLocation\",\"privacy_text\":\"用户巡查上报\"}],\"privacy_ver\":2}\n"; + WxResult result = new WxResult<>(); + String url = WxMaCodeConstant.SET_PRIVACY_SETTING_URL + "?" + "access_token=" + accessToken; + Result submitResult = HttpClientManager.getInstance().sendPostByJSON(url, param); + log.info("setPrivacySetting param:{}, result:{}", param, JSON.toJSONString(submitResult)); + if (!submitResult.success()) { + result.setErrorCode(submitResult.getCode()); + result.setErrorMsg(submitResult.getMsg()); + return result; + } + JSONObject jsonObject = JSONObject.parseObject(submitResult.getData()); + result.setErrorCode(jsonObject.getInteger(ERR_CODE)); + result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(jsonObject.getInteger(ERR_CODE))); + return result; + } + @Override public WxResult speedUpAudit(String accessToken, WxMaSpeedUpAuditReq request) { WxResult result = new WxResult(); diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonHouseFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonHouseFormDTO.java new file mode 100644 index 0000000000..f56f003137 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonHouseFormDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @program: epmet-cloud + * @description: + * @author: wangtong + * @create: 2022-06-10 13:26 + **/ +@Data +public class CommonHouseFormDTO implements Serializable { + + private String houseCode; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseInfoFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseInfoFormDTO.java new file mode 100644 index 0000000000..e1dd0ea53d --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseInfoFormDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @program: epmet-cloud + * @description: + * @author: wangtong + * @create: 2022-06-09 15:12 + **/ +@Data +public class HouseInfoFormDTO implements Serializable { + + @NotNull(message = "房屋编码不可为空") + private String houseCode; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseListFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseListFormDTO.java index e913c9442b..0e2e25a049 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseListFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseListFormDTO.java @@ -89,8 +89,13 @@ public class IcHouseListFormDTO extends PageFormDTO { * 结束日期 eg:20220505 */ private String updateEndDate; - + private String customerId; private String selectType; + + /** + * 楼栋ID + */ + private String unitId; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoResultDTO.java new file mode 100644 index 0000000000..e83ec67bf4 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoResultDTO.java @@ -0,0 +1,106 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @program: epmet-cloud + * @description: + * @author: wangtong + * @create: 2022-06-09 15:22 + **/ +@Data +public class HouseInfoResultDTO implements Serializable { + + private String houseId; + + private String houseName; + + private String houseCode; + + private String houseQrcodeUrl; + + private String customerId; + + /** + * 所属行政组织 + */ + private String agencyId; + private String agencyPids; + private String agencyName; + + /** + * eg:市北区-阜新路街道-南宁社区 + */ + private String agencyPathName; + /** + * 组织的area_code + */ + private String areaCode; + + /** + * 所属网格 + */ + private String gridName; + private String gridId; + + /** + * 所属小区 + */ + private String neighborHoodId; + private String neighborHoodName; + + /** + * 所属楼栋 + */ + private String buildingId; + private String buildingName; + + /** + * 所属单元id + */ + private String buildingUnitId; + private String unitName; + + /** + * 门牌号 + */ + private String doorName; + + /** + * 房屋类型,这里存储字典value就可以 + */ + private String houseType; + private String houseTypeName; + /** + * 存储字典value + */ + private String purpose; + private String purposeName; + /** + * 1出租;0未出租 + */ + private Integer rentFlag; + private String rentName; + + /** + * 房主姓名 + */ + private String ownerName; + + /** + * 房主电话 + */ + private String ownerPhone; + + /** + * 房主身份证号 + */ + private String ownerIdCard; + + /** + * 备注 + */ + private String remark; +} 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 81ad4df7e2..60419614fc 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 @@ -661,4 +661,15 @@ public interface GovOrgOpenFeignClient { */ @GetMapping("/gov/org/ichouse/getbyhousecode/{houseCode}") Result getByHouseCode(@PathVariable("houseCode") String houseCode); + + + /** + * @describe: 工作端-通过房屋编码获取房屋信息 + * @author wangtong + * @date 2022/6/10 13:27 + * @params [dto] + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("/gov/org/house/getHomeInfoByHouseCode") + Result getHomeInfoByHouseCode(CommonHouseFormDTO dto); } 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 6270575319..23054533c7 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 @@ -425,4 +425,10 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { public Result getDelAgencyGridIdList(String agencyId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getDelAgencyGridIdList", agencyId); } + + @Override + public Result getHomeInfoByHouseCode(CommonHouseFormDTO dto) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getHomeInfoByHouseCode", dto); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java index 297a4c9e7a..6e99cd25f7 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java @@ -554,6 +554,21 @@ public class HouseController implements ResultDataResolver { @PostMapping("createHouseQrcodeUrl") public String createHouseQrcodeUrl(@RequestBody TestFormDTO formDTO) throws Exception { return houseService.createHouseQrcodeUrl(formDTO.getHouseId(),null); + } + + /** + * @describe: 工作端-通过房屋编码获取房屋信息 + * @author wangtong + * @date 2022/6/9 14:48 + * @params [tokenDto] + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("getHomeInfoByHouseCode") + public Result getHomeInfoByHouseCode(@RequestBody HouseInfoFormDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto); + return houseService.getHomeInfoByHouseCode(dto); } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java index 0b6bdcfd93..8efb45cf92 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java @@ -154,4 +154,22 @@ public interface IcHouseDao extends BaseDao { * @return com.epmet.dto.result.IcHouseQrcodeConfigDTO */ CustomerOrgParameterEntity selectByCustomerId(@Param("customerId") String customerId, @Param("preKey") String preKey); + + /** + * @describe: 工作端-通过房屋编码获取房屋信息 + * @author wangtong + * @date 2022/6/9 15:23 + * @params [houseCode] + * @return com.epmet.dto.result.HouseInfoResultDTO + */ + HouseInfoResultDTO selectHomeInfoByHouseCode(@Param("houseCode") String houseCode); + + /** + * @describe: 根据筛选获取需要下载的一户一码信息 + * @author wangtong + * @date 2022/6/13 16:34 + * @params [formDTO] + * @return java.util.List + */ + List searchHouseZipList(IcHouseListFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java index 6316690b89..04c0fc819c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java @@ -163,4 +163,14 @@ public interface HouseService { * @return com.epmet.commons.tools.utils.Result */ Result createBatchHouseCodeAndUrl(String customerId); + + + /** + * @describe: 通过房屋编码获取房屋信息 + * @author wangtong + * @date 2022/6/9 14:51 + * @params [tokenDto] + * @return com.epmet.commons.tools.utils.Result + */ + Result getHomeInfoByHouseCode(HouseInfoFormDTO dto); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java index b98c0bcf3b..e329260f69 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java @@ -27,6 +27,7 @@ import com.epmet.commons.tools.utils.FileUtils; import com.epmet.commons.tools.utils.HouseQRcodeUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerGridConstant; +import com.epmet.constant.NeighborhoodConstant; import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.*; import com.epmet.dto.*; @@ -55,6 +56,7 @@ import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.lang3.StringUtils; import org.apache.http.entity.ContentType; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -808,15 +810,22 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { @Override public void downloadZip(HttpServletResponse response, IcHouseListFormDTO formDTO) throws Exception { - // 查询pids - String pids = null; - if (StringUtils.isNotBlank(formDTO.getAgencyId())) { - pids = getPids(formDTO.getAgencyId()); + if(NeighborhoodConstant.GRID.equals(formDTO.getLevel())){ + //根据网格过滤 + formDTO.setGridId(formDTO.getId()); + }else if(StringUtils.isNotBlank(formDTO.getId())){ + //根据组织过滤 + formDTO.setAgencyId(formDTO.getId()); } - if (StringUtils.isNotBlank(formDTO.getLevel()) && OrgTypeEnum.AGENCY.getCode().equals(formDTO.getLevel())) { - pids = getPids(formDTO.getAgencyId()); - } - formDTO.setPids(pids); + // 查询pids +// String pids = null; +// if (StringUtils.isNotBlank(formDTO.getAgencyId())) { +// pids = getPids(formDTO.getAgencyId()); +// } +// if (StringUtils.isNotBlank(formDTO.getLevel()) && OrgTypeEnum.AGENCY.getCode().equals(formDTO.getLevel())) { +// pids = getPids(formDTO.getAgencyId()); +// } +// formDTO.setPids(pids); //response response.reset(); @@ -830,7 +839,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { response.setHeader("Content-Disposition", "attachment;filename=" + downloadFilename); ZipOutputStream zip = new ZipOutputStream(response.getOutputStream()); - List houseList = icHouseDao.searchHouseByPage(formDTO); + List houseList = icHouseDao.searchHouseZipList(formDTO); //获取一户一码前缀地址 CustomerOrgParameterEntity codePre = icHouseDao.selectByCustomerId(formDTO.getCustomerId(), HouseQrcodeEnum.PREFIX_KEY.getCode()); @@ -1037,4 +1046,28 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { return buffer.toString(); } + @Override + public Result getHomeInfoByHouseCode(HouseInfoFormDTO dto) { + HouseInfoResultDTO house = icHouseDao.selectHomeInfoByHouseCode(dto.getHouseCode()); + + HouseInfoCache cache = CustomerIcHouseRedis.getHouseInfo(house.getCustomerId(), house.getHouseId()); + BeanUtils.copyProperties(cache,house); + + if (null != house && StringUtils.isNotBlank(house.getAgencyId())) { + AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(house.getAgencyId()); + house.setAgencyPathName(StringUtils.isNotBlank(agencyInfoCache.getAllParentName()) ? agencyInfoCache.getAllParentName().concat(StrConstant.HYPHEN).concat(agencyInfoCache.getOrganizationName()) : agencyInfoCache.getOrganizationName()); + house.setAreaCode(StringUtils.isNotBlank(agencyInfoCache.getAreaCode()) ? agencyInfoCache.getAreaCode() : StrConstant.EPMETY_STR); + house.setAgencyName(StringUtils.isNotBlank(agencyInfoCache.getOrganizationName()) ? agencyInfoCache.getOrganizationName() : StrConstant.EPMETY_STR); + } else { + house.setAgencyPathName(StrConstant.EPMETY_STR); + house.setAgencyName(StrConstant.EPMETY_STR); + } + + house.setHouseTypeName(HouseTypeEnums.getTypeValue(house.getHouseType())); + house.setRentName(HouseRentFlagEnums.getTypeValue(house.getRentFlag())); + house.setPurposeName(HousePurposeEnums.getTypeValue(house.getPurpose())); + return new Result().ok(house); + } + + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml index 81ca8c415d..fcc9679915 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml @@ -435,6 +435,83 @@ and PARAMETER_KEY=#{preKey} and DEL_FLAG='0' + + select * from ic_resi_user_confirm where IC_RESI_USER_ID=#{icResiUserId} and del_flag='0' + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index 4187fa45ca..81f3c65f49 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -1094,5 +1094,32 @@ where DEL_FLAG='0' and id=#{icResiUserId} - + +