86 changed files with 2869 additions and 94 deletions
@ -0,0 +1,106 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-07-27 |
|||
*/ |
|||
@Data |
|||
public class PointAdjustmentLogDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 关联的积分动作Id |
|||
*/ |
|||
private String actionId; |
|||
|
|||
/** |
|||
* 调整人名称【xx机关-xx】 |
|||
*/ |
|||
private String operatorName; |
|||
|
|||
/** |
|||
* 调整原因 |
|||
*/ |
|||
private String adjustReason; |
|||
|
|||
/** |
|||
* 调整积分 |
|||
*/ |
|||
private Integer point; |
|||
|
|||
/** |
|||
* plus/minus |
|||
*/ |
|||
private String adjustmentType; |
|||
|
|||
/** |
|||
* 调整人所属机关Id |
|||
*/ |
|||
private String operatorAgencyId; |
|||
|
|||
/** |
|||
* 居民Id |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.Min; |
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 用户Id 分页参数 |
|||
* @ClassName CommonPageUserFormDTO |
|||
* @Auth wangc |
|||
* @Date 2020-07-24 13:24 |
|||
*/ |
|||
@Data |
|||
public class CommonPageUserFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -6721313124444595189L; |
|||
|
|||
public interface PageUserGroup extends CustomerClientShowGroup{} |
|||
|
|||
@NotBlank(message = "获取不到用户Id" , groups = PageUserGroup.class) |
|||
private String userId; |
|||
|
|||
@Min(value = 1) |
|||
private Integer pageNo = 1; |
|||
|
|||
private Integer pageSize = 10; |
|||
} |
@ -0,0 +1,56 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 积分调整传参积分dto |
|||
* @ClassName PointAdjustmentFormDTO |
|||
* @Auth wangc |
|||
* @Date 2020-07-27 13:36 |
|||
*/ |
|||
@Data |
|||
public class PointAdjustmentFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -1879530107301465633L; |
|||
|
|||
public interface PointAdjustmentGroup extends CustomerClientShowGroup{} |
|||
|
|||
/** |
|||
* 用户Id |
|||
* */ |
|||
@NotBlank(message = "用户Id不能为空", groups = PointAdjustmentGroup.class) |
|||
private String userId; |
|||
|
|||
/** |
|||
* 积分调整标识 key:add/minus |
|||
* */ |
|||
@NotBlank(message = "调整类型不能为空", groups = PointAdjustmentGroup.class) |
|||
private String adjustmentType; |
|||
|
|||
/** |
|||
* 调整的分值 |
|||
* */ |
|||
private Integer point; |
|||
|
|||
/** |
|||
* 调整原因 |
|||
* */ |
|||
@NotBlank(message = "调整原因不能为空", groups = PointAdjustmentGroup.class) |
|||
private String reason; |
|||
|
|||
/** |
|||
* 操作人Id |
|||
* */ |
|||
@NotBlank(message = "当前工作人员Id不能为空", groups = PointAdjustmentGroup.class) |
|||
private String operatorId; |
|||
|
|||
/** |
|||
* 客户Id |
|||
* */ |
|||
@NotBlank(message = "客户Id不能为空", groups = PointAdjustmentGroup.class) |
|||
private String customerId; |
|||
|
|||
} |
@ -0,0 +1,53 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.Min; |
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 积分核销传参dto |
|||
* |
|||
* @ClassName PointVerificationFormDTO |
|||
* @Auth wangc |
|||
* @Date 2020-07-27 13:45 |
|||
*/ |
|||
@Data |
|||
public class PointVerificationFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -154634518066538184L; |
|||
|
|||
public interface PointVerificationGroup extends CustomerClientShowGroup{} |
|||
|
|||
/** |
|||
* 用户Id |
|||
* */ |
|||
@NotBlank(message = "用户Id不能为空", groups = PointVerificationGroup.class) |
|||
private String userId; |
|||
|
|||
/** |
|||
* 核销备注 |
|||
* */ |
|||
@NotBlank(message = "核销备注不能为空", groups = PointVerificationGroup.class) |
|||
private String remark; |
|||
|
|||
/** |
|||
* 核销积分数 |
|||
* */ |
|||
@Min(0) |
|||
private Integer point; |
|||
|
|||
/** |
|||
* 操作人Id |
|||
* */ |
|||
@NotBlank(message = "当前工作人员Id不能为空", groups = PointVerificationGroup.class) |
|||
private String operatorId; |
|||
|
|||
|
|||
private String longitude; |
|||
|
|||
private String dimension; |
|||
|
|||
private String address; |
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.Max; |
|||
import javax.validation.constraints.Min; |
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 工作端核销记录传参 |
|||
* @ClassName WorkPointVerificationFormDTO |
|||
* @Auth wangc |
|||
* @Date 2020-07-24 16:25 |
|||
*/ |
|||
@Data |
|||
public class WorkPointVerificationFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -590822390667788693L; |
|||
|
|||
@NotBlank(message = "获取不到用户Id",groups = ResiCommonUserIdFormDTO.UserIdGroup.class) |
|||
private String staffId; |
|||
|
|||
/** |
|||
* yyyy-MM |
|||
* */ |
|||
private String timeParam; |
|||
|
|||
@Min(1) |
|||
private Integer pageNo; |
|||
|
|||
private Integer pageSize; |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName PointAdjustmentResultDTO |
|||
* @Auth wangc |
|||
* @Date 2020-07-27 09:45 |
|||
*/ |
|||
@Data |
|||
public class PointAdjustmentResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -5339173292750971212L; |
|||
|
|||
/** |
|||
* 操作日期 |
|||
* */ |
|||
private String date; |
|||
|
|||
/** |
|||
* 调整积分 |
|||
* */ |
|||
private String point; |
|||
|
|||
/** |
|||
* 调整原因 |
|||
* */ |
|||
private String reason; |
|||
|
|||
/** |
|||
* 调整人昵称 |
|||
* */ |
|||
private String staffNickname; |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 积分核销返参Dto |
|||
* @ClassName PointVerificationResultDTO |
|||
* @Auth wangc |
|||
* @Date 2020-07-27 13:57 |
|||
*/ |
|||
@Data |
|||
public class PointVerificationResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 6990717665110392389L; |
|||
|
|||
/** |
|||
* 核销成功标识 |
|||
* */ |
|||
private boolean successFlag; |
|||
|
|||
/** |
|||
* 失败原因 |
|||
* */ |
|||
private String failureReason; |
|||
|
|||
/** |
|||
* 用户(居民)昵称 |
|||
* */ |
|||
private String userNickname; |
|||
|
|||
/** |
|||
* 用户(居民)头像 |
|||
* */ |
|||
private String userHeadPhoto; |
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description 工作端积分核销记录列表 |
|||
* @ClassName WorkPointVerficationListResultDTO |
|||
* @Auth wangc |
|||
* @Date 2020-07-24 15:38 |
|||
*/ |
|||
@Data |
|||
public class WorkPointVerficationListResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 2737976236826002595L; |
|||
|
|||
/** |
|||
* 当月总积分 |
|||
* */ |
|||
private Integer totalPoint; |
|||
|
|||
/** |
|||
* 核销列表 |
|||
* */ |
|||
List<WorkPointVerificationDetailResultDTO> checkingList; |
|||
} |
@ -0,0 +1,33 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 工作端积分核销显示记录 |
|||
* @ClassName WorkPointVerificationDetailResultDTO |
|||
* @Auth wangc |
|||
* @Date 2020-07-24 15:38 |
|||
*/ |
|||
@Data |
|||
public class WorkPointVerificationDetailResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -205177259417194562L; |
|||
|
|||
/** |
|||
* 被核销用户昵称 |
|||
* */ |
|||
private String userNickname; |
|||
|
|||
/** |
|||
* 核销积分 "-100" |
|||
* */ |
|||
private String point; |
|||
|
|||
/** |
|||
* 核销备注 |
|||
* */ |
|||
private String remark; |
|||
|
|||
|
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 工作端积分核销记录 |
|||
* @ClassName WorkPointVerificationLogResultDTO |
|||
* @Auth wangc |
|||
* @Date 2020-07-24 15:38 |
|||
*/ |
|||
@Data |
|||
public class WorkPointVerificationLogResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -3570820382554221450L; |
|||
|
|||
/** |
|||
* 积分 |
|||
* */ |
|||
private Integer point; |
|||
|
|||
/** |
|||
* 用户Id |
|||
* */ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 日期 yyyy-MM-dd HH:mm:ss |
|||
* */ |
|||
private String date; |
|||
|
|||
/** |
|||
* 核销备注 |
|||
* */ |
|||
private String remark; |
|||
|
|||
|
|||
} |
@ -0,0 +1,46 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.result.PointAdjustmentResultDTO; |
|||
import com.epmet.entity.PointAdjustmentLogEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-07-27 |
|||
*/ |
|||
@Mapper |
|||
public interface PointAdjustmentLogDao extends BaseDao<PointAdjustmentLogEntity> { |
|||
|
|||
/** |
|||
* @Description 查询积分调整列表 |
|||
* @param userId |
|||
* @return |
|||
* @author wangc |
|||
* @date 2020.07.27 10:44 |
|||
**/ |
|||
List<PointAdjustmentResultDTO> selectAdjustmentListByUserId(@Param("userId") String userId); |
|||
|
|||
} |
@ -0,0 +1,76 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-07-27 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("point_adjustment_log") |
|||
public class PointAdjustmentLogEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 关联的积分动作Id |
|||
*/ |
|||
private String actionId; |
|||
|
|||
/** |
|||
* 调整人名称【xx机关-xx】 |
|||
*/ |
|||
private String operatorName; |
|||
|
|||
/** |
|||
* 调整原因 |
|||
*/ |
|||
private String adjustReason; |
|||
|
|||
/** |
|||
* 调整积分 |
|||
*/ |
|||
private Integer point; |
|||
|
|||
/** |
|||
* plus/minus |
|||
*/ |
|||
private String adjustmentType; |
|||
|
|||
/** |
|||
* 调整人所属机关Id |
|||
*/ |
|||
private String operatorAgencyId; |
|||
|
|||
/** |
|||
* 居民Id |
|||
*/ |
|||
private String userId; |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.redis; |
|||
|
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* @Description 积分缓存相关 |
|||
* @ClassName PointRedis |
|||
* @Auth wangc |
|||
* @Date 2020-07-27 17:25 |
|||
*/ |
|||
@Component |
|||
public class PointRedis { |
|||
|
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
} |
@ -0,0 +1,126 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.PointAdjustmentLogDTO; |
|||
import com.epmet.dto.form.IssueInitiatorFormDTO; |
|||
import com.epmet.dto.form.PointAdjustmentFormDTO; |
|||
import com.epmet.dto.result.CustomerUserDetailResultDTO; |
|||
import com.epmet.dto.result.PointAdjustmentResultDTO; |
|||
import com.epmet.entity.PointAdjustmentLogEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-07-27 |
|||
*/ |
|||
public interface PointAdjustmentLogService extends BaseService<PointAdjustmentLogEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<PointAdjustmentLogDTO> |
|||
* @author generator |
|||
* @date 2020-07-27 |
|||
*/ |
|||
PageData<PointAdjustmentLogDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<PointAdjustmentLogDTO> |
|||
* @author generator |
|||
* @date 2020-07-27 |
|||
*/ |
|||
List<PointAdjustmentLogDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return PointAdjustmentLogDTO |
|||
* @author generator |
|||
* @date 2020-07-27 |
|||
*/ |
|||
PointAdjustmentLogDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-07-27 |
|||
*/ |
|||
void save(PointAdjustmentLogDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-07-27 |
|||
*/ |
|||
void update(PointAdjustmentLogDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-07-27 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* @Description 根据UserId获取积分调整记录 |
|||
* @param param :: getUserId |
|||
* @return |
|||
* @author wangc |
|||
* @date 2020.07.27 10:51 |
|||
**/ |
|||
List<PointAdjustmentResultDTO> adjustRecord(IssueInitiatorFormDTO param); |
|||
|
|||
/** |
|||
* @Description 用户详情 |
|||
* @param param |
|||
* @return |
|||
* @author wangc |
|||
* @date 2020.07.27 10:57 |
|||
**/ |
|||
CustomerUserDetailResultDTO userDetail(IssueInitiatorFormDTO param); |
|||
|
|||
/** |
|||
* @Description 积分调整 |
|||
* @param param |
|||
* @return |
|||
* @author wangc |
|||
* @date 2020.07.27 13:52 |
|||
**/ |
|||
void adjustPoint(PointAdjustmentFormDTO param); |
|||
} |
@ -0,0 +1,242 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dao.PointAdjustmentLogDao; |
|||
import com.epmet.dao.UserPointActionLogDao; |
|||
import com.epmet.dto.PointAdjustmentLogDTO; |
|||
import com.epmet.dto.form.IssueInitiatorFormDTO; |
|||
import com.epmet.dto.form.PointAdjustmentFormDTO; |
|||
import com.epmet.dto.form.ResiCommonUserIdFormDTO; |
|||
import com.epmet.dto.result.CustomerUserDetailResultDTO; |
|||
import com.epmet.dto.result.PointAdjustmentResultDTO; |
|||
import com.epmet.dto.result.ResiPointDetailResultDTO; |
|||
import com.epmet.dto.result.StaffEtAgencyResultDTO; |
|||
import com.epmet.entity.PointAdjustmentLogEntity; |
|||
import com.epmet.entity.UserPointActionLogEntity; |
|||
import com.epmet.entity.UserPointStatisticalDailyEntity; |
|||
import com.epmet.entity.UserPointTotalEntity; |
|||
import com.epmet.feign.EpmetUserOpenFeignClient; |
|||
import com.epmet.service.PointAdjustmentLogService; |
|||
import com.epmet.service.UserPointStatisticalDailyService; |
|||
import com.epmet.service.UserPointTotalService; |
|||
import com.epmet.utils.DimIdGenerator; |
|||
import com.epmet.utils.ModuleConstant; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-07-27 |
|||
*/ |
|||
@Service |
|||
public class PointAdjustmentLogServiceImpl extends BaseServiceImpl<PointAdjustmentLogDao, PointAdjustmentLogEntity> implements PointAdjustmentLogService { |
|||
|
|||
@Autowired |
|||
EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|||
@Autowired |
|||
UserPointTotalService userPointTotalService; |
|||
@Autowired |
|||
UserPointActionLogDao userPointActionLogDao; |
|||
@Autowired |
|||
UserPointStatisticalDailyService userPointStatisticalDailyService; |
|||
@Autowired |
|||
PointAdjustmentLogDao pointAdjustmentLogDao; |
|||
|
|||
@Override |
|||
public PageData<PointAdjustmentLogDTO> page(Map<String, Object> params) { |
|||
IPage<PointAdjustmentLogEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, PointAdjustmentLogDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<PointAdjustmentLogDTO> list(Map<String, Object> params) { |
|||
List<PointAdjustmentLogEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, PointAdjustmentLogDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<PointAdjustmentLogEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<PointAdjustmentLogEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public PointAdjustmentLogDTO get(String id) { |
|||
PointAdjustmentLogEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, PointAdjustmentLogDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(PointAdjustmentLogDTO dto) { |
|||
PointAdjustmentLogEntity entity = ConvertUtils.sourceToTarget(dto, PointAdjustmentLogEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(PointAdjustmentLogDTO dto) { |
|||
PointAdjustmentLogEntity entity = ConvertUtils.sourceToTarget(dto, PointAdjustmentLogEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
/** |
|||
* @Description 根据UserId获取积分调整记录 |
|||
* @param param :: getUserId |
|||
* @return |
|||
* @author wangc |
|||
* @date 2020.07.27 10:51 |
|||
**/ |
|||
@Override |
|||
public List<PointAdjustmentResultDTO> adjustRecord(IssueInitiatorFormDTO param) { |
|||
return baseDao.selectAdjustmentListByUserId(param.getUserId()); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* @Description 用户详情 |
|||
* @param param |
|||
* @return |
|||
* @author wangc |
|||
* @date 2020.07.27 10:57 |
|||
**/ |
|||
@Override |
|||
public CustomerUserDetailResultDTO userDetail(IssueInitiatorFormDTO param) { |
|||
Result<CustomerUserDetailResultDTO> detailResult = epmetUserOpenFeignClient.customerUserDetail(param); |
|||
if(!detailResult.success()){ |
|||
throw new RenException(detailResult.getCode()); |
|||
} |
|||
ResiCommonUserIdFormDTO userParam = ConvertUtils.sourceToTarget(param,ResiCommonUserIdFormDTO.class); |
|||
ResiPointDetailResultDTO pointDto = userPointTotalService.getMyPoint(userParam); |
|||
if(null != detailResult.getData()){ |
|||
CustomerUserDetailResultDTO result = new CustomerUserDetailResultDTO(); |
|||
result.setPoint(null != pointDto ? pointDto.getUsablePoint() : NumConstant.ZERO); |
|||
} |
|||
detailResult.getData().setPoint(null != pointDto ? pointDto.getUsablePoint() : NumConstant.ZERO); |
|||
return detailResult.getData(); |
|||
} |
|||
|
|||
/** |
|||
* @Description 积分调整 |
|||
* @param param |
|||
* @return |
|||
* @author wangc |
|||
* @date 2020.07.27 13:52 |
|||
**/ |
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void adjustPoint(PointAdjustmentFormDTO param) { |
|||
if(null == param.getPoint()) throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|||
Date currentTime = new Date(); |
|||
Integer point = param.getPoint(); |
|||
if(StringUtils.equals(ModuleConstant.OPERATION_TYPE_MINUS,param.getAdjustmentType())){ |
|||
if(point > NumConstant.ZERO){ |
|||
point *= NumConstant.ONE_NEG; |
|||
} |
|||
}else{ |
|||
if(point < NumConstant.ZERO){ |
|||
point *= NumConstant.ONE_NEG; |
|||
} |
|||
} |
|||
//0.工作人员基本信息[agencyId 昵称]
|
|||
IssueInitiatorFormDTO staffParam = new IssueInitiatorFormDTO(); |
|||
staffParam.setUserId(param.getOperatorId()); |
|||
Result<StaffEtAgencyResultDTO> staffResult = |
|||
epmetUserOpenFeignClient.staffMsg(staffParam); |
|||
String agencyId = ModuleConstant.EMPTY_STR; |
|||
String operatorName = ModuleConstant.EMPTY_STR; |
|||
if(staffResult.success() && null != staffResult.getData()){ |
|||
agencyId = staffResult.getData().getAgencyId(); |
|||
operatorName = staffResult.getData().getNickname(); |
|||
} |
|||
//1.记录用户积分行为记录表
|
|||
UserPointActionLogEntity userPointActionEntity = new UserPointActionLogEntity(); |
|||
userPointActionEntity.setUserId(param.getUserId()); |
|||
userPointActionEntity.setCustomerId(param.getCustomerId()); |
|||
userPointActionEntity.setActionFlag(param.getAdjustmentType()); |
|||
userPointActionEntity.setPoint(point); |
|||
userPointActionEntity.setEventStatement(param.getReason()); |
|||
userPointActionEntity.setEventName(ModuleConstant.EVENT_NAME_ADJUSTMENT); |
|||
userPointActionEntity.setOperatorAgencyId(agencyId); |
|||
userPointActionLogDao.insert(userPointActionEntity); |
|||
//2.记录积分调整记录表
|
|||
PointAdjustmentLogEntity adjustmentEntity = new PointAdjustmentLogEntity(); |
|||
adjustmentEntity.setActionId(userPointActionEntity.getId()); |
|||
adjustmentEntity.setOperatorName(operatorName); |
|||
adjustmentEntity.setAdjustReason(param.getReason()); |
|||
adjustmentEntity.setAdjustmentType(param.getAdjustmentType()); |
|||
adjustmentEntity.setPoint(point); |
|||
adjustmentEntity.setOperatorAgencyId(agencyId); |
|||
adjustmentEntity.setUserId(param.getUserId()); |
|||
//此处设置无效,会拦截到当前请求token中的userId,实际与这里的operatorId一致
|
|||
adjustmentEntity.setCreatedBy(param.getOperatorId()); |
|||
pointAdjustmentLogDao.insert(adjustmentEntity); |
|||
//3.新增或更新用户积分日统计表
|
|||
DimIdGenerator.DimIdBean dim = DimIdGenerator.getDimIdBean(currentTime); |
|||
UserPointStatisticalDailyEntity statistical = ConvertUtils.sourceToTarget(dim,UserPointStatisticalDailyEntity.class); |
|||
statistical.setUserId(param.getUserId()); |
|||
statistical.setActionFlag(param.getAdjustmentType()); |
|||
statistical.setCustomerId(param.getCustomerId()); |
|||
statistical.setPointChange(point); |
|||
userPointStatisticalDailyService.insertOrUpdate(statistical); |
|||
//4.更新用户积分总表
|
|||
UserPointTotalEntity total = new UserPointTotalEntity(); |
|||
total.setUserId(param.getUserId()); |
|||
total.setCustomerId(param.getCustomerId()); |
|||
//增量
|
|||
total.setUsedPoint(NumConstant.ZERO); |
|||
total.setUsablePoint(point); |
|||
total.setTotalPoint(point); |
|||
userPointTotalService.insertOrUpdate(total); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,91 @@ |
|||
package com.epmet.utils; |
|||
|
|||
import com.epmet.commons.tools.utils.DateUtils; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Calendar; |
|||
import java.util.Date; |
|||
|
|||
public class DimIdGenerator { |
|||
|
|||
/** |
|||
* 生成日期维度ID |
|||
* @param targetDate |
|||
* @return |
|||
*/ |
|||
public static String getDateDimId(Date targetDate) { |
|||
return DateUtils.format(targetDate, DateUtils.DATE_PATTERN_YYYYMMDD); |
|||
} |
|||
|
|||
/** |
|||
* 获取月维度ID |
|||
* @param date |
|||
* @return |
|||
*/ |
|||
public static String getMonthDimId(Date date) { |
|||
return DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMM); |
|||
} |
|||
|
|||
/** |
|||
* 获取周维度ID ,每周的星期一为 周的开始 |
|||
* @param date |
|||
* @return |
|||
*/ |
|||
public static String getWeekDimId(Date date) { |
|||
String yyyy = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYY); |
|||
Calendar calendar = Calendar.getInstance(); |
|||
calendar.setFirstDayOfWeek(Calendar.MONDAY); |
|||
calendar.setTime(date); |
|||
return yyyy.concat("W").concat(calendar.get(Calendar.WEEK_OF_YEAR)+""); |
|||
} |
|||
|
|||
/** |
|||
* 获取季度维度ID |
|||
* @param date |
|||
* @return |
|||
*/ |
|||
public static String getQuarterDimId(Date date) { |
|||
String yyyy = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYY); |
|||
return yyyy.concat("Q").concat(DateUtils.getQuarterIndex(date) + ""); |
|||
} |
|||
|
|||
/** |
|||
* 获取年维度ID |
|||
* @param date |
|||
* @return |
|||
*/ |
|||
public static String getYearDimId(Date date) { |
|||
return DateUtils.format(date, DateUtils.DATE_PATTERN_YYYY); |
|||
} |
|||
|
|||
/** |
|||
* 获取封装了所有ID的对象 |
|||
* @return |
|||
*/ |
|||
public static DimIdBean getDimIdBean(Date date) { |
|||
DimIdBean dimIdBean = new DimIdBean(); |
|||
dimIdBean.setDateId(getDateDimId(date)); |
|||
dimIdBean.setMonthId(getMonthDimId(date)); |
|||
dimIdBean.setWeekId(getWeekDimId(date)); |
|||
dimIdBean.setQuarterId(getQuarterDimId(date)); |
|||
dimIdBean.setYearId(getYearDimId(date)); |
|||
return dimIdBean; |
|||
} |
|||
|
|||
public static void main(String[] args) { |
|||
DimIdBean dimIdBean = getDimIdBean(DateUtils.stringToDate("2020-06-14",DateUtils.DATE_PATTERN)); |
|||
System.out.println(dimIdBean); |
|||
} |
|||
|
|||
@Data |
|||
public static class DimIdBean { |
|||
private String dateId; |
|||
private String monthId; |
|||
private String quarterId; |
|||
private String yearId; |
|||
private String weekId; |
|||
|
|||
public DimIdBean() { |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,43 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.PointAdjustmentLogDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.PointAdjustmentLogEntity" id="pointAdjustmentLogMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="actionId" column="ACTION_ID"/> |
|||
<result property="operatorName" column="OPERATOR_NAME"/> |
|||
<result property="adjustReason" column="ADJUST_REASON"/> |
|||
<result property="point" column="POINT"/> |
|||
<result property="adjustmentType" column="ADJUSTMENT_TYPE"/> |
|||
<result property="operatorAgencyId" column="OPERATOR_AGENCY_ID"/> |
|||
<result property="userId" column="USER_ID"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
</resultMap> |
|||
|
|||
<!-- 查询积分调整记录 --> |
|||
<select id="selectAdjustmentListByUserId" resultType="com.epmet.dto.result.PointAdjustmentResultDTO"> |
|||
SELECT |
|||
operator_name AS staffNickname, |
|||
adjust_reason AS reason, |
|||
DATE_FORMAT( created_time, '%Y-%m-%d %H:%i:%s' ) AS date, |
|||
CASE |
|||
action_flag |
|||
WHEN 'plus' THEN |
|||
CONCAT( '+', POINT ) ELSE CONCAT( '-', POINT ) |
|||
END AS POINT |
|||
FROM |
|||
point_adjustment_log |
|||
WHERE |
|||
del_flag = '0' |
|||
AND user_id = #{userId} |
|||
ORDER BY |
|||
created_time DESC |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,34 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.Min; |
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 查询一个客户下所有用户包括陌生人 |
|||
* @ClassName CustomerUserFormDTO |
|||
* @Auth wangc |
|||
* @Date 2020-07-25 15:38 |
|||
*/ |
|||
@Data |
|||
public class CustomerUserFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -8209934663808878617L; |
|||
|
|||
public interface CustomerIdGroup extends CustomerClientShowGroup{} |
|||
|
|||
@NotBlank(message = "客户Id不能为空", groups = CustomerIdGroup.class) |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 查询参数:全名 |
|||
* */ |
|||
private String name; |
|||
|
|||
@Min(1) |
|||
private Integer pageNo = 1; |
|||
|
|||
private Integer pageSize = 20; |
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName CustomerUser4PointResultDTO |
|||
* @Auth wangc |
|||
* @Date 2020-07-28 09:47 |
|||
*/ |
|||
@Data |
|||
public class CustomerUser4PointResultDTO implements Serializable { |
|||
|
|||
/** |
|||
* 用户头像 |
|||
* */ |
|||
private String userHeadPhoto; |
|||
|
|||
/** |
|||
* 用户显示昵称 |
|||
* */ |
|||
private String userName; |
|||
|
|||
/** |
|||
* 用户微信昵称 |
|||
* */ |
|||
private String userNickname; |
|||
|
|||
/** |
|||
*注册网格名称 |
|||
* */ |
|||
private String registeredGrid; |
|||
|
|||
/** |
|||
* 用户Id |
|||
* */ |
|||
private String userId; |
|||
} |
@ -0,0 +1,51 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 积分调整-人员查询-人员详情 |
|||
* @ClassName CustomerUserDetailResultDTO |
|||
* @Auth wangc |
|||
* @Date 2020-07-27 01:26 |
|||
*/ |
|||
@Data |
|||
public class CustomerUserDetailResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 893146364651215391L; |
|||
|
|||
/** |
|||
* 姓名 |
|||
* */ |
|||
private String name; |
|||
|
|||
/** |
|||
* 男 女 未知 |
|||
* */ |
|||
private String gender; |
|||
|
|||
/** |
|||
* 手机号 |
|||
* */ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 身份证号 |
|||
* */ |
|||
private String idNum; |
|||
|
|||
/** |
|||
* 居民地址 |
|||
* */ |
|||
private String address; |
|||
|
|||
/** |
|||
* 所属(注册)网格 |
|||
* */ |
|||
private String associatedGrid; |
|||
|
|||
/** |
|||
* 积分(可用) |
|||
* */ |
|||
private Integer point; |
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 工作人员的信息:显示昵称、所属机关Id |
|||
* @ClassName StaffEtAgencyResultDTO |
|||
* @Auth wangc |
|||
* @Date 2020-07-27 15:11 |
|||
*/ |
|||
@Data |
|||
public class StaffEtAgencyResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -7048248108253396688L; |
|||
|
|||
/** |
|||
* 所属机关Id |
|||
* */ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 工作人员昵称 xx机关-xx |
|||
* */ |
|||
private String nickname; |
|||
|
|||
/** |
|||
* 上级机关Id |
|||
* */ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 上级机关Id集合 |
|||
* */ |
|||
private String pids; |
|||
|
|||
/** |
|||
* 客户Id |
|||
* */ |
|||
private String customerId; |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.epmet.constant; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName UserRedisKeys |
|||
* @Auth wangc |
|||
* @Date 2020-07-22 17:16 |
|||
*/ |
|||
public class UserRedisKeys { |
|||
|
|||
/** |
|||
* 党群e事通redis前缀 |
|||
*/ |
|||
private static String rootPrefix = "epmet:"; |
|||
|
|||
/** |
|||
* @Description 用户缓存Key |
|||
* @Param 用户Id |
|||
* @return epmet:resi:user:userId |
|||
* @Author wangc |
|||
* @Date 2020.04.13 11:27 |
|||
**/ |
|||
public static String getResiUserKey(String userId){ |
|||
return rootPrefix.concat("resi:user:").concat(userId); |
|||
} |
|||
} |
Loading…
Reference in new issue