diff --git a/epmet-auth/deploy/docker-compose-test.yml b/epmet-auth/deploy/docker-compose-test.yml index e71cca12c3..6f97df8be2 100644 --- a/epmet-auth/deploy/docker-compose-test.yml +++ b/epmet-auth/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-auth:0.3.56 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-auth:0.3.57 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/ActPointEventMsg.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/ActPointEventMsg.java deleted file mode 100644 index 60db245a07..0000000000 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/ActPointEventMsg.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.epmet.commons.tools.dto.form.mq.eventmsg; - -import lombok.Data; - -/** - * 结束活动,发放活动积分消息体 - * - * @author yinzuomei@elink-cn.com - * @date 2020/7/27 9:26 - */ -@Data -public class ActPointEventMsg extends BasePointEventMsg{ - /** - * 参与活动的备注 - */ - private String remark; - -} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java index 435234f7dd..ec14e7c812 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java @@ -19,6 +19,11 @@ public class BasePointEventMsg implements Serializable { */ private String opAgencyId; + /** + * 操作人Id,当有固定的操作人时,传入此值,如果没有则为空 + * */ + private String operatorId; + /** * 客户Id */ @@ -42,4 +47,14 @@ public class BasePointEventMsg implements Serializable { * 是否是通用事件,通用事件不走规则 */ private Boolean isCommon; + + /** + * 备注 + */ + private String remark; + + /** + * 业务id eg:活动id + */ + private String sourceId; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 1cd6ba736c..78c341fcb4 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -85,6 +85,7 @@ public enum EpmetErrorCode { NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"), NON_CERTIFIED_VOLUNTEER(8511, "活动报名失败,请先认证志愿者"), ACT_TIME_CONFLICT(8512, "报名失败。您本次报名活动时间与已报名活动时间间隔较短,为了不影响您已报名的活动,请选择其他时间的活动,谢谢。"), + ACT_REGISTRATION_SUCCESS(8513, "报名成功。"), // 该错误不会提示给前端,只是后端传输错误信息用。 ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"), diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRegistrationResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRegistrationResultDTO.java new file mode 100644 index 0000000000..96ca7a6e61 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRegistrationResultDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.result.resi; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 活动报名 - 返回值 + * + * @Auther: zhangyong + * @Date: 2020-07-28 16:22 + */ +@Data +public class ResiActRegistrationResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 异常编码 + */ + private Integer flag; + + /** + * 提示信息 + */ + private String tip; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/LatestDraftActInfoResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/LatestDraftActInfoResultDTO.java index 89d5c1e4ec..7906c364d5 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/LatestDraftActInfoResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/LatestDraftActInfoResultDTO.java @@ -165,5 +165,5 @@ public class LatestDraftActInfoResultDTO implements Serializable { /** * 活动内容- */ - private List actContentList; + private List actContent; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-dev.yml index 98dfa4eb08..1ae781d21c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-heart-server: container_name: epmet-heart-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-heart-server:0.0.5 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-heart-server:0.0.8 ports: - "8111:8111" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-heart/epmet-heart-server/pom.xml b/epmet-module/epmet-heart/epmet-heart-server/pom.xml index 428cba0d77..20462901b2 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/pom.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.5 + 0.0.8 com.epmet epmet-heart diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java index 1dfb2ed28a..d2a3efec16 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java @@ -131,7 +131,7 @@ public class ResiActListController { return actInfoService.latestAct(formDto); } - /* + /** * 正在进行中的活动 * 进入活动的快捷入口, 前端只取第一条 * @@ -158,8 +158,6 @@ public class ResiActListController { return actInfoService.actLookBack(formDto); } - // - /** * 活动详情 * @@ -217,8 +215,6 @@ public class ResiActListController { return actLiveRecService.liveRecList(map); } - // - /** * 取消活动报名 * @@ -298,12 +294,12 @@ public class ResiActListController { * * @param tokenDto * @param formDTO - * @return com.epmet.commons.tools.utils.Result + * @return com.epmet.commons.tools.utils.Result * @Author zhangyong - * @Date 16:46 2020-07-23 + * @Date 16:26 2020-07-28 **/ @PostMapping("registration") - public Result registration(@LoginUser TokenDto tokenDto, @RequestBody ResiActRegistrationFormDTO formDTO) { + public Result registration(@LoginUser TokenDto tokenDto, @RequestBody ResiActRegistrationFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, ResiActRegistrationFormDTO.AddUserInternalGroup.class); return actUserRelationService.registration(tokenDto, formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java index f3a135ee6a..a290d59c5f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java @@ -24,6 +24,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActUserRelationDTO; import com.epmet.dto.form.resi.ResiActRegistrationFormDTO; import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO; +import com.epmet.dto.result.resi.ResiActRegistrationResultDTO; import com.epmet.entity.ActUserRelationEntity; import org.apache.ibatis.annotations.Param; @@ -145,9 +146,9 @@ public interface ActUserRelationService extends BaseService> * @Author zhangyong - * @Date 16:46 2020-07-23 + * @Date 15:54 2020-07-28 **/ - Result registration(TokenDto tokenDto, ResiActRegistrationFormDTO formDTO); + Result registration(TokenDto tokenDto, ResiActRegistrationFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java index d47594761f..f7b0da4e16 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java @@ -368,7 +368,7 @@ public class ActInfoServiceImpl extends BaseServiceImpl().ok(dto); } else { - logger.info("您还未进入指定的签到范围~"); + logger.info(EpmetErrorCode.NOT_IN_THE_SIGN_IN_RANGE.getMsg()); dto.setIsAddress(false); dto.setErrorTip(EpmetErrorCode.NOT_IN_THE_SIGN_IN_RANGE.getMsg()); return new Result().ok(dto); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java index ef55f849ab..d1f11ccf68 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java @@ -23,7 +23,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.MqConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; -import com.epmet.commons.tools.dto.form.mq.eventmsg.ActPointEventMsg; +import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; import com.epmet.commons.tools.enums.EventEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; @@ -109,7 +109,7 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl dataContainer = new ArrayList<>(); for (int k = 0; k < actLives.size(); k++) { - Map base = new HashMap<>(); + Map base = new HashMap<>(NumConstant.ONE); base.put("nickname", userWxInfos.getData().get(k).getNickname()); base.put("headImg", userWxInfos.getData().get(k).getHeadImgUrl()); base.put("desc", actLives.get(k).getDesc()); @@ -130,6 +130,9 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl()); + resultDto.setActLiveNum(NumConstant.ZERO); } return new Result().ok(resultDto); } @@ -221,13 +224,14 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl actPointEventMsgList=new ArrayList<>(); - ActPointEventMsg actPointEventMsg=new ActPointEventMsg(); + List actPointEventMsgList=new ArrayList<>(); + BasePointEventMsg actPointEventMsg=new BasePointEventMsg(); actPointEventMsg.setCustomerId(formDTO.getCustomerId()); actPointEventMsg.setUserId(formDTO.getUserId()); actPointEventMsg.setActionFlag(MqConstant.PLUS); actPointEventMsg.setIsCommon(false); actPointEventMsg.setRemark(remark); + actPointEventMsg.setSourceId(formDTO.getActId()); actPointEventMsgList.add(actPointEventMsg); mqBaseMsgDTO.setMsg(JSON.toJSONString(actPointEventMsgList)); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java index 5d6ed5249b..c84e1efa93 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java @@ -39,6 +39,7 @@ import com.epmet.dto.ActUserRelationDTO; import com.epmet.dto.form.resi.ResiActRegistrationFormDTO; import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO; import com.epmet.dto.result.UserRoleResultDTO; +import com.epmet.dto.result.resi.ResiActRegistrationResultDTO; import com.epmet.entity.ActUserLogEntity; import com.epmet.entity.ActUserRelationEntity; import com.epmet.entity.HeartUserInfoEntity; @@ -54,10 +55,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 用户活动关系表 @@ -197,9 +195,10 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl registration(TokenDto tokenDto, ResiActRegistrationFormDTO formDTO) { formDTO.setUserId(tokenDto.getUserId()); boolean satisfy = false; + ResiActRegistrationResultDTO resultDTO = new ResiActRegistrationResultDTO(); // 查询活动信息 ActInfoDTO actInfoDTO = actInfoService.get(formDTO.getActId()); // >0 当前用户是志愿者 @@ -207,15 +206,35 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl().ok(resultDTO); + } } else { // 活动不限制志愿者身份,但要求是 居民身份, 当前用户是否满足条件 satisfy = this.resiParticipationAct(formDTO.getUserId()); + if (!satisfy){ + logger.info(EpmetErrorCode.CANNOT_AUDIT_WARM.getMsg()); + resultDTO.setFlag(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode()); + resultDTO.setTip(EpmetErrorCode.CANNOT_AUDIT_WARM.getMsg()); + return new Result().ok(resultDTO); + } } if (satisfy){ // 开始报名 - this.actStartSignUp(actInfoDTO, formDTO, volunteerFlag); + boolean actTimeConflict = this.actStartSignUp(actInfoDTO, formDTO, volunteerFlag); + if (!actTimeConflict){ + logger.info(EpmetErrorCode.ACT_TIME_CONFLICT.getMsg()); + resultDTO.setFlag(EpmetErrorCode.ACT_TIME_CONFLICT.getCode()); + resultDTO.setTip(EpmetErrorCode.ACT_TIME_CONFLICT.getMsg()); + return new Result().ok(resultDTO); + } } - return new Result(); + resultDTO.setFlag(EpmetErrorCode.ACT_REGISTRATION_SUCCESS.getCode()); + resultDTO.setTip(EpmetErrorCode.ACT_REGISTRATION_SUCCESS.getMsg()); + return new Result().ok(resultDTO); } /** @@ -228,7 +247,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl NumConstant.ZERO){ @@ -237,8 +256,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl NumConstant.ZERO){ signUp = false; - logger.info("报名失败。您本次报名活动时间与已报名活动时间间隔较短,为了不影响您已报名的活动,请选择其他时间的活动,谢谢。"); - throw new RenException(EpmetErrorCode.ACT_TIME_CONFLICT.getCode()); + return signUp; } } else { // 3.第一次报名 @@ -249,7 +267,8 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl NumConstant.ZERO){ satisfy = true; return satisfy; - } else { - logger.info("活动报名失败,请先认证志愿者"); - throw new RenException(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getCode()); } + return satisfy; } /** @@ -289,12 +306,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl> leaderboard(ResiActBaseFormDTO formDTO) { - List resultDTOS = new ArrayList<>(); + List resultDtoS = new ArrayList<>(); // 获取排好序的 排行榜 List leaderboardList = baseDao.selectListLeaderboard(formDTO); if (leaderboardList.size() > NumConstant.ZERO){ @@ -151,14 +151,14 @@ public class HeartUserInfoServiceImpl extends BaseServiceImpl>().ok(resultDTOS); + return new Result>().ok(resultDtoS); } @Override diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java index e6f0ae3173..7d219aca27 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java @@ -22,7 +22,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.MqConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; -import com.epmet.commons.tools.dto.form.mq.eventmsg.ActPointEventMsg; +import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; import com.epmet.commons.tools.enums.EventEnum; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; @@ -33,7 +33,6 @@ import com.epmet.dao.VolunteerInfoDao; import com.epmet.dto.HeartUserInfoDTO; import com.epmet.dto.form.WxUserInfoFormDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; -import com.epmet.entity.ActUserRelationEntity; import com.epmet.entity.VolunteerInfoEntity; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.redis.VolunteerInfoRedis; @@ -103,8 +102,8 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl actPointEventMsgList=new ArrayList<>(); - ActPointEventMsg actPointEventMsg=new ActPointEventMsg(); + List actPointEventMsgList=new ArrayList<>(); + BasePointEventMsg actPointEventMsg=new BasePointEventMsg(); actPointEventMsg.setCustomerId(formDTO.getCustomerId()); actPointEventMsg.setUserId(formDTO.getUserId()); actPointEventMsg.setActionFlag(MqConstant.PLUS); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java index 1af9e0522b..0375e16a36 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java @@ -76,7 +76,7 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { LatestDraftActInfoResultDTO latestAct=latestActInfoService.getLatestActDraft(userId); if(null!=latestAct){ List actContentList=latestActContentService.selectActContentList(latestAct.getActDraftId()); - latestAct.setActContentList(actContentList); + latestAct.setActContent(actContentList); } return latestAct; }else{ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index 39f8bc5226..b435c6088a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java @@ -3,11 +3,10 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.commons.tools.constant.AppClientConstant; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.MqConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; -import com.epmet.commons.tools.dto.form.mq.eventmsg.ActPointEventMsg; +import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; import com.epmet.commons.tools.enums.EventEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; @@ -122,8 +121,9 @@ public class WorkActServiceImpl implements WorkActService { sponsorResultDTO.setAgencyGridList(ConvertUtils.sourceToTarget(result.getData().getAgencyGridList(), Grid.class)); return sponsorResultDTO; } + }else{ + logger.error("当前用户id获取为空"); } - logger.error("当前用户id获取为空"); return null; } @@ -687,13 +687,13 @@ public class WorkActServiceImpl implements WorkActService { @Override @Transactional(rollbackFor = Exception.class) public void saveActualTime(SaveActualTimeFormDTO formDTO) { - if(formDTO.getActualStartTime().compareTo(formDTO.getActualEndTime())!=-1){ + Date actualStartTime= DateUtils.minStrToSecondDate(formDTO.getActualStartTime()); + Date actualEndTime= DateUtils.minStrToSecondDate(formDTO.getActualEndTime()); + if(actualStartTime.compareTo(actualEndTime)!=-1){ throw new RenException(EpmetErrorCode.ACT_ACTUAL_START_TIME_ERROR.getCode()); } ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId()); - Date actualStartTime= DateUtils.minStrToSecondDate(formDTO.getActualStartTime()); actInfoDTO.setActualStartTime(actualStartTime); - Date actualEndTime= DateUtils.minStrToSecondDate(formDTO.getActualEndTime()); actInfoDTO.setActualEndTime(actualEndTime); actInfoDTO.setServiceMin(DateUtils.calculateMin(actualStartTime,actualEndTime)); actInfoService.update(actInfoDTO); @@ -778,7 +778,7 @@ public class WorkActServiceImpl implements WorkActService { private void grantActPoints(ActInfoDTO actInfoDTO) { //查询已经给分的用户 QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(actInfoDTO.getId()), FieldConstant.ID, actInfoDTO.getId()) + wrapper.eq(StringUtils.isNotBlank(actInfoDTO.getId()), "ACT_ID", actInfoDTO.getId()) .eq("PROCESS_FLAG",ActConstant.HANDLED) .eq("REWARD_FLAG",ActConstant.ACT_USER_STATUS_AGREE); List actUserRelationEntityList=actUserRelationDao.selectList(wrapper); @@ -799,19 +799,21 @@ public class WorkActServiceImpl implements WorkActService { mqBaseMsgDTO.setEventClass(EventEnum.ACTIVE_SEND_POINT.getEventClass()); //事件code mqBaseMsgDTO.setEventTag(EventEnum.ACTIVE_SEND_POINT.getEventTag()); - List actPointEventMsgList=new ArrayList<>(); + List basePointEventMsgArrayList=new ArrayList<>(); for(ActUserRelationEntity actUserRelationEntity:actUserRelationEntityList){ - ActPointEventMsg actPointEventMsg=new ActPointEventMsg(); - actPointEventMsg.setOpAgencyId(opAgencyId); - actPointEventMsg.setCustomerId(actInfoDTO.getCustomerId()); - actPointEventMsg.setUserId(actUserRelationEntity.getUserId()); - actPointEventMsg.setActionFlag(MqConstant.PLUS); - actPointEventMsg.setPoint(actInfoDTO.getReward()); - actPointEventMsg.setIsCommon(true); - actPointEventMsg.setRemark(remark); - actPointEventMsgList.add(actPointEventMsg); + BasePointEventMsg basePointEventMsg=new BasePointEventMsg(); + basePointEventMsg.setOpAgencyId(opAgencyId); + basePointEventMsg.setCustomerId(actInfoDTO.getCustomerId()); + basePointEventMsg.setUserId(actUserRelationEntity.getUserId()); + basePointEventMsg.setActionFlag(MqConstant.PLUS); + basePointEventMsg.setPoint(actInfoDTO.getReward()); + basePointEventMsg.setIsCommon(true); + basePointEventMsg.setRemark(remark); + basePointEventMsg.setSourceId(actInfoDTO.getId()); + basePointEventMsg.setOperatorId(loginUserUtil.getLoginUserId()); + basePointEventMsgArrayList.add(basePointEventMsg); } - mqBaseMsgDTO.setMsg(JSON.toJSONString(actPointEventMsgList)); + mqBaseMsgDTO.setMsg(JSON.toJSONString(basePointEventMsgArrayList)); Result result=SendMqMsgUtils.sendMsg(mqBaseMsgDTO); if(!result.success()){ logger.error("活动积分发放失败"); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index 3828a814f8..2c0bff8748 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml @@ -59,7 +59,7 @@ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime, DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime, i.ACT_ADDRESS actAddress, - IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) + i.ACT_QUOTA_CATEGORY actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) i.ACT_QUOTA actQuota, IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'signing_up' AS actCurrentState, -- 活动状态:报名中,未报满 @@ -85,7 +85,7 @@ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime, DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime, i.ACT_ADDRESS actAddress, - IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) + i.ACT_QUOTA_CATEGORY actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) i.ACT_QUOTA actQuota, IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'enough' AS actCurrentState, -- 活动状态:报名中,已报满 @@ -112,7 +112,7 @@ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime, DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime, i.ACT_ADDRESS actAddress, - IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) + i.ACT_QUOTA_CATEGORY actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) i.ACT_QUOTA actQuota, IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'end_sign_up' AS actCurrentState, -- 活动状态:未开始 @@ -138,7 +138,7 @@ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime, DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime, i.ACT_ADDRESS actAddress, - IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) + i.ACT_QUOTA_CATEGORY actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) i.ACT_QUOTA actQuota, IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'in_progress' AS actCurrentState, -- 活动状态:进行中 @@ -164,7 +164,7 @@ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime, DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime, i.ACT_ADDRESS actAddress, - IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) + i.ACT_QUOTA_CATEGORY actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) i.ACT_QUOTA actQuota, IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'finished' AS actCurrentState, -- 活动状态:已结束 @@ -190,7 +190,7 @@ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime, DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime, i.ACT_ADDRESS actAddress, - IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) + i.ACT_QUOTA_CATEGORY actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) i.ACT_QUOTA actQuota, IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'auditing' AS actCurrentState -- 活动状态 @@ -213,7 +213,7 @@ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime, DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime, i.ACT_ADDRESS actAddress, - IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) + i.ACT_QUOTA_CATEGORY actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) i.ACT_QUOTA actQuota, IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'passed' AS actCurrentState -- 活动状态 @@ -236,7 +236,7 @@ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime, DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime, i.ACT_ADDRESS actAddress, - IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) + i.ACT_QUOTA_CATEGORY actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) i.ACT_QUOTA actQuota, IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'refused' AS actCurrentState -- 活动状态 @@ -259,7 +259,7 @@ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime, DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime, i.ACT_ADDRESS actAddress, - IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) + i.ACT_QUOTA_CATEGORY actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) i.ACT_QUOTA actQuota, IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'canceld' AS actCurrentState -- 活动状态 @@ -282,7 +282,7 @@ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime, DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime, i.ACT_ADDRESS actAddress, - IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, + i.ACT_QUOTA_CATEGORY actQuotaCategory, i.ACT_QUOTA actQuota, IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 case @@ -391,12 +391,12 @@ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime, DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime, i.ACT_ADDRESS actAddress, - IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) + i.ACT_QUOTA_CATEGORY actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) i.ACT_QUOTA actQuota, IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 i.REWARD reward, i.REQUIREMENT requirement, - IF(i.VOLUNTEER_LIMIT = 1, true , false ) as volunteerLimit, -- 是否是志愿者(true:只有志愿者才可以参加活动1,false: 只要是居民就可以参加活动0) + i.VOLUNTEER_LIMIT volunteerLimit, -- 是否是志愿者(true:只有志愿者才可以参加活动1,false: 只要是居民就可以参加活动0) i.SPONSOR_NAME sponsor, DATE_FORMAT(i.ACTUAL_START_TIME,'%Y-%m-%d %H:%i') actualStartTime, DATE_FORMAT(i.ACTUAL_END_TIME,'%Y-%m-%d %H:%i') actualEndTime, @@ -420,7 +420,7 @@ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime, DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime, i.ACT_ADDRESS actAddress, - IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) + i.ACT_QUOTA_CATEGORY actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0)) i.ACT_QUOTA actQuota, i.SPONSOR_CONTACTS contacts, i.SPONSOR_TEL tel, diff --git a/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-test.yml b/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-test.yml index 00aef6ff53..6978f9d660 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-test.yml +++ b/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-test.yml @@ -3,7 +3,7 @@ services: epmet-oss-server: container_name: epmet-oss-server-test # image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-test/epmet-oss-server:0.3.2 - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-oss-server:0.3.23 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-oss-server:0.3.24 ports: - "8083:8083" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/UserPointActionLogDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/UserPointActionLogDTO.java index 254e53bbd6..113572b051 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/UserPointActionLogDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/UserPointActionLogDTO.java @@ -53,6 +53,11 @@ public class UserPointActionLogDTO implements Serializable { */ private String actionFlag; + /** + * 来源Id,可以是活动Id + * */ + private String sourceId; + /** * 来源ID 当来源为积分调整时 通过事件Id查找规则ID计算出分数 通过EVENT_ID能查出RUIE_ID */ diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointVerificationFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointVerificationFormDTO.java index 4a5aff0a09..7920d68c66 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointVerificationFormDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointVerificationFormDTO.java @@ -44,10 +44,12 @@ public class PointVerificationFormDTO implements Serializable { @NotBlank(message = "当前工作人员Id不能为空", groups = PointVerificationGroup.class) private String operatorId; - + @NotBlank(message = "缺失经度信息" , groups = PointVerificationGroup.class) private String longitude; + @NotBlank(message = "缺失维度信息" , groups = PointVerificationGroup.class) private String dimension; + @NotBlank(message = "缺失地址信息" , groups = PointVerificationGroup.class) private String address; } diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/WorkPointVerificationFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/WorkPointVerificationFormDTO.java index 8741ae49c6..c9cbe06642 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/WorkPointVerificationFormDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/WorkPointVerificationFormDTO.java @@ -26,7 +26,7 @@ public class WorkPointVerificationFormDTO implements Serializable { private String timeParam; @Min(1) - private Integer pageNo; + private Integer pageNo = 1; - private Integer pageSize; + private Integer pageSize = 20; } diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/dto/form/SendPointFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/dto/form/SendPointFormDTO.java index ae4c7aeeba..fef7e11cc5 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/dto/form/SendPointFormDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/dto/form/SendPointFormDTO.java @@ -14,5 +14,50 @@ import lombok.Data; @Data public class SendPointFormDTO { private String pointDesc; + + /** + * 积分 + * */ private Integer point; + + /** + * 操作人机关id + */ + private String opAgencyId; + + /** + * 操作人Id,当有固定的操作人时,传入此值,如果没有则为空 + * */ + private String operatorId; + + /** + * 客户Id + */ + private String customerId; + /** + * 被操作用户id + */ + private String userId; + + /** + * 加减分标识 plus/minus + */ + private String actionFlag; + + + /** + * 是否是通用事件,通用事件不走规则 + */ + private Boolean isCommon; + + /** + * 备注 + */ + private String remark; + + /** + * 业务id eg:活动id + */ + private String sourceId; + } diff --git a/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml index 20460ab5a4..f30b3a56a9 100644 --- a/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-point-server: container_name: epmet-point-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-point-server:0.0.4 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-point-server:0.0.6 ports: - "8112:8112" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-point/epmet-point-server/pom.xml b/epmet-module/epmet-point/epmet-point-server/pom.xml index 3285affd5b..1f76d70f96 100644 --- a/epmet-module/epmet-point/epmet-point-server/pom.xml +++ b/epmet-module/epmet-point/epmet-point-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.0.4 + 0.0.6 epmet-point com.epmet diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java index 0f2876f74f..c30ee3c1d6 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java @@ -1,10 +1,13 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.CustomerUserFormDTO; import com.epmet.dto.form.IssueInitiatorFormDTO; +import com.epmet.dto.form.PointAdjustmentFormDTO; import com.epmet.dto.result.CustomerUser4PointResultDTO; import com.epmet.dto.result.CustomerUserDetailResultDTO; import com.epmet.dto.result.PointAdjustmentResultDTO; @@ -69,5 +72,21 @@ public class AdjustmentController { ValidatorUtils.validateEntity(param, IssueInitiatorFormDTO.UserIdGroup.class); return new Result>().ok(pointAdjustmentLogService.adjustRecord(param)); } + + /** + * @Description 积分调整 + * @param param + * @return + * @author wangc + * @date 2020.07.27 13:52 + **/ + @PostMapping("adjust") + public Result adjustPoint(@LoginUser TokenDto token, @RequestBody PointAdjustmentFormDTO param){ + param.setOperatorId(token.getUserId()); + param.setCustomerId(token.getCustomerId()); + ValidatorUtils.validateEntity(param, PointAdjustmentFormDTO.PointAdjustmentGroup.class); + pointAdjustmentLogService.adjustPoint(param); + return new Result(); + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ExchangeController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ExchangeController.java index 8f81e46de2..5b1445db95 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ExchangeController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ExchangeController.java @@ -1,5 +1,16 @@ package com.epmet.controller; +import com.epmet.common.token.annotation.Login; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.PointVerificationFormDTO; +import com.epmet.dto.result.PointVerificationResultDTO; +import com.epmet.service.PointVerificationLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -12,5 +23,22 @@ import org.springframework.web.bind.annotation.RestController; @RequestMapping("work/exchange") public class ExchangeController { + @Autowired + private PointVerificationLogService pointVerificationLogService; + + /** + * @Description 积分核销 + * @param verificationParam + * @return + * @author wangc + * @date 2020.07.27 14:03 + **/ + @PostMapping("execute") + public Result execute(@LoginUser TokenDto token, @RequestBody PointVerificationFormDTO verificationParam){ + verificationParam.setOperatorId(token.getUserId()); + ValidatorUtils.validateEntity(verificationParam, PointVerificationFormDTO.PointVerificationGroup.class); + return new Result().ok(pointVerificationLogService.verifyPoint(verificationParam)); + } + } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java index 51146befb0..10b21cf105 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java @@ -46,7 +46,7 @@ public class MqPointCallbackController { } SendPointFormDTO formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), SendPointFormDTO.class); try { - //TODO 调用调整积分方法去给用户加减积分 userPointActionLogService. + userPointActionLogService.grantPoint(formDTO); } catch (Exception e) { logger.error("activeSendPoint consume fail,msg:{}",JSON.toJSONString(mqMsg.getMsg())); throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg()); diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointVerificationLogDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointVerificationLogDao.java index 9138df614f..5b90380b88 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointVerificationLogDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointVerificationLogDao.java @@ -54,5 +54,5 @@ public interface PointVerificationLogDao extends BaseDao selectStaffVerificationLog(String staffId, Date startDate, Date endDate); + List selectStaffVerificationLog(@Param("staffId") String staffId, @Param("startDate") Date startDate,@Param("endDate") Date endDate); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/UserPointActionLogEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/UserPointActionLogEntity.java index 4c72c5659a..b52ed79b2f 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/UserPointActionLogEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/UserPointActionLogEntity.java @@ -54,10 +54,15 @@ public class UserPointActionLogEntity extends BaseEpmetEntity { private String actionFlag; /** - * 来源ID 当来源为积分调整时 通过事件Id查找规则ID计算出分数 通过EVENT_ID能查出RUIE_ID + * 当来源为积分调整时 通过事件Id查找规则ID计算出分数 通过EVENT_ID能查出RUIE_ID */ private String eventId; + /** + * 来源Id,可以是活动Id + * */ + private String sourceId; + /** * 活动描述 获取积分的原因,相关内容,用来拼接【用户参加了xxx活动获取?积分】的文案,取活动的名称;【积分调整文案】;其他…… 如果是管理员手动调整扣减积分,ACTION_FLAG为"minus",但是不会生成核销记录,核销记录只保存用户使用积分兑换商品的核销详情 diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java index 84d6379e22..81873314f7 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java @@ -23,6 +23,7 @@ import com.epmet.dto.UserPointActionLogDTO; import com.epmet.dto.form.CommonPageUserFormDTO; import com.epmet.dto.result.ResiPointLogListResultDTO; import com.epmet.entity.UserPointActionLogEntity; +import dto.form.SendPointFormDTO; import java.util.List; import java.util.Map; @@ -104,5 +105,13 @@ public interface UserPointActionLogService extends BaseService getMyPointRecord(CommonPageUserFormDTO pageUser); + /** + * @Description 消息网关回调进行积分发放 + * @param grantPointParam + * @return + * @author wangc + * @date 2020.07.29 09:11 + **/ + void grantPoint(SendPointFormDTO grantPointParam); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java index 220dc525e7..a78e6f70bf 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java @@ -178,7 +178,7 @@ public class PointAdjustmentLogServiceImpl extends BaseServiceImpl NumConstant.ZERO){ point *= NumConstant.ONE_NEG; } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationLogServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationLogServiceImpl.java index 0cfe6d642f..319b3fa0ce 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationLogServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationLogServiceImpl.java @@ -185,11 +185,24 @@ public class PointVerificationLogServiceImpl extends BaseServiceImpl dataList = baseDao.selectStaffVerificationLog(verificationParam.getStaffId(),getFirstDayDateOfMonth(date),getLastDayOfMonth(date)); - result.setTotalPoint( - dataList.stream().mapToInt(o -> o.getPoint()).sum() - ); + if(NumConstant.ONE < verificationParam.getPageNo()){ + result.setTotalPoint( + dataList.stream().mapToInt(o -> o.getPoint()).sum() + ); + }else{ + int fromIndex = verificationParam.getPageNo() * verificationParam.getPageSize(); + int toIndex = (verificationParam.getPageNo() + 1) * verificationParam.getPageSize(); + if(toIndex > dataList.size()) { + toIndex = dataList.size(); + } + dataList = dataList.subList(fromIndex,toIndex); + } + List userIds = dataList.stream().map(data -> data.getUserId()).collect(Collectors.toList()); Result> userInfo = epmetUserOpenFeignClient.queryUserBaseInfo(userIds); @@ -223,7 +236,8 @@ public class PointVerificationLogServiceImpl extends BaseServiceImpl implements UserPointActionLogService { + @Autowired + private UserPointTotalService userPointTotalService; + @Autowired + private UserPointStatisticalDailyService userPointStatisticalDailyService; @Override public PageData page(Map params) { @@ -131,4 +145,62 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl NumConstant.ZERO){ + //保证负数 + grantPointParam.setPoint(grantPointParam.getPoint() * NumConstant.ONE_NEG); + } + }else{ + //加 + if(grantPointParam.getPoint() < NumConstant.ZERO){ + //保证正数 + grantPointParam.setPoint(grantPointParam.getPoint() * NumConstant.ONE_NEG); + } + } + //1.新增用户积分行为记录 + UserPointActionLogEntity action = new UserPointActionLogEntity(); + action.setCustomerId(grantPointParam.getCustomerId()); + action.setPoint(grantPointParam.getPoint()); + action.setEventStatement(grantPointParam.getPointDesc()); + action.setEventName(EventEnum.ACTIVE_SEND_POINT.getEventDesc()); + action.setEventId(EventEnum.ACTIVE_INSERT_LIVE.getEventTag()); + action.setActionFlag(grantPointParam.getActionFlag()); + action.setUserId(grantPointParam.getUserId()); + action.setCreatedBy(grantPointParam.getOperatorId()); + action.setUpdatedBy(grantPointParam.getOperatorId()); + action.setSourceId(grantPointParam.getSourceId()); + action.setOperatorAgencyId(grantPointParam.getOpAgencyId()); + baseDao.insert(action); + //2.新增/修改用户积分日统计 + DimIdGenerator.DimIdBean dimVal = DimIdGenerator.getDimIdBean(new Date()); + UserPointStatisticalDailyEntity statistical = ConvertUtils.sourceToTarget(dimVal,UserPointStatisticalDailyEntity.class); + statistical.setPointChange(grantPointParam.getPoint()); + statistical.setActionFlag(grantPointParam.getActionFlag()); + statistical.setCustomerId(grantPointParam.getCustomerId()); + statistical.setUserId(grantPointParam.getUserId()); + statistical.setCreatedBy(grantPointParam.getOperatorId()); + statistical.setUpdatedBy(grantPointParam.getOperatorId()); + userPointStatisticalDailyService.insertOrUpdate(statistical); + //3.新增/修改用户总积分 + UserPointTotalEntity point = new UserPointTotalEntity(); + point.setCustomerId(grantPointParam.getCustomerId()); + point.setUserId(grantPointParam.getUserId()); + point.setTotalPoint(grantPointParam.getPoint()); + point.setUsablePoint(grantPointParam.getPoint()); + point.setUsedPoint(NumConstant.ZERO); + point.setCreatedBy(grantPointParam.getOperatorId()); + point.setUpdatedBy(grantPointParam.getOperatorId()); + userPointTotalService.insertOrUpdate(point); + } + } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java index 851a65ecca..51537b8fac 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java @@ -147,19 +147,24 @@ public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl rankList = baseDao.selectPointRankWithinTimeZone(pointRankFormDTO.getCustomerId(),pointRankFormDTO.getTimeDimension(),dimVal); if(null == rankList || rankList.isEmpty()){ - o.setMyPoint(NumConstant.ZERO); - o.setMyRanking(NumConstant.ZERO); - - return result; + if(NumConstant.ONE < pointRankFormDTO.getPageNo()){ + return result; + }else { + o.setMyPoint(NumConstant.ZERO); + o.setMyRanking(NumConstant.ZERO); + result.add(o); + return result; + } } //如果请求的是第一页 if(NumConstant.ONE == pointRankFormDTO.getPageNo()) { - ResiPointRankResultDTO myself = - rankList.stream().filter(obj -> StringUtils.equals(obj.getUserId(), pointRankFormDTO.getUserId())).findFirst().get(); - if (null != myself) { + ResiPointRankResultDTO myself = null; + Optional opt = rankList.stream().filter(obj -> StringUtils.equals(obj.getUserId(), pointRankFormDTO.getUserId())).findFirst(); + if(opt.isPresent()){ + myself = opt.get(); o.setMyPoint(myself.getTotalPoint()); o.setMyRanking(myself.getRank()); - } else { + }else{ o.setMyPoint(NumConstant.ZERO); if (rankList.get(rankList.size() - NumConstant.ONE).getTotalPoint() > NumConstant.ZERO) { o.setMyRanking(rankList.get(rankList.size() - NumConstant.ONE).getRank() + NumConstant.ONE); @@ -167,8 +172,9 @@ public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl rankList.size()) { toIndex = rankList.size(); } 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 741e5ad54f..e2ab66cde8 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 @@ -156,29 +156,34 @@ public class UserPointTotalServiceImpl extends BaseServiceImpl StringUtils.equals(obj.getUserId(), pointRankFormDTO.getUserId())).findFirst().get(); - if (null != myself) { + ResiPointRankResultDTO myself = null; + Optional opt = rankList.stream().filter(obj -> StringUtils.equals(obj.getUserId(), pointRankFormDTO.getUserId())).findFirst(); + if(opt.isPresent()){ + myself = opt.get(); o.setMyPoint(myself.getTotalPoint()); o.setMyRanking(myself.getRank()); } else { - if (rankList.get(rankList.size() - NumConstant.ONE).getTotalPoint() > NumConstant.ZERO) { o.setMyRanking(rankList.get(rankList.size() - NumConstant.ONE).getRank() + NumConstant.ONE); } else { o.setMyRanking(rankList.get(rankList.size() - NumConstant.ONE).getRank()); } } - int fromIndex = pointRankFormDTO.getPageNo() * pointRankFormDTO.getPageSize(); - int toIndex = (pointRankFormDTO.getPageNo() + 1) * pointRankFormDTO.getPageSize(); + + int fromIndex = (pointRankFormDTO.getPageNo() - 1) * pointRankFormDTO.getPageSize(); + int toIndex = pointRankFormDTO.getPageNo() * pointRankFormDTO.getPageSize(); if(toIndex > rankList.size()) { toIndex = rankList.size(); } @@ -218,7 +223,7 @@ public class UserPointTotalServiceImpl extends BaseServiceImpl + diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml index f8a5d074ec..633b3f75fa 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml @@ -25,38 +25,42 @@ diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml index 1603237883..cc797271a4 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml @@ -48,7 +48,7 @@ diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml index 222d4cc6d3..2d548065f3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml @@ -121,7 +121,7 @@ diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml index d3edc68319..cfacc58191 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml @@ -103,6 +103,7 @@ user_base_info base on wechat.USER_ID = base.USER_ID WHERE wechat.DEL_FLAG = '0' + AND (wechat.NICKNAME IS NOT NULL OR wechat.NICKNAME ]]> '') wechat.USER_ID = #{item}