Browse Source

允许二次签到 更新签到记录 不推送二次加积分操作

dev
sunyuchao 3 years ago
parent
commit
16a7c51a6e
  1. 103
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActSignInRecordServiceImpl.java

103
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActSignInRecordServiceImpl.java

@ -2,9 +2,7 @@ package com.epmet.modules.partyOrg.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.rocketmq.constants.TopicConstants;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.MqConstant; import com.epmet.commons.tools.constant.MqConstant;
import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg;
@ -16,12 +14,8 @@ import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.SystemMessageType; import com.epmet.constant.SystemMessageType;
import com.epmet.dto.IcMessageDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.IcMessageListFormDTO;
import com.epmet.dto.form.IssueInitiatorFormDTO; import com.epmet.dto.form.IssueInitiatorFormDTO;
import com.epmet.dto.form.SystemMsgFormDTO; import com.epmet.dto.form.SystemMsgFormDTO;
import com.epmet.dto.result.CommonDataFilterResultDTO;
import com.epmet.dto.result.CustomerUserDetailResultDTO; import com.epmet.dto.result.CustomerUserDetailResultDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient;
@ -30,8 +24,6 @@ import com.epmet.modules.partyOrg.entity.IcPartyActEntity;
import com.epmet.modules.partyOrg.entity.IcPartyActSignInRecordEntity; import com.epmet.modules.partyOrg.entity.IcPartyActSignInRecordEntity;
import com.epmet.modules.partyOrg.service.IcPartyActService; import com.epmet.modules.partyOrg.service.IcPartyActService;
import com.epmet.modules.partyOrg.service.IcPartyActSignInRecordService; import com.epmet.modules.partyOrg.service.IcPartyActSignInRecordService;
import com.epmet.resi.group.constant.TopicConstant;
import com.epmet.resi.group.dto.group.ResiGroupInfoRedisDTO;
import com.epmet.resi.partymember.dto.IcPartyActSignInRecordDTO; import com.epmet.resi.partymember.dto.IcPartyActSignInRecordDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.PartyActSignFormDTO; import com.epmet.resi.partymember.dto.partyOrg.form.PartyActSignFormDTO;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
@ -41,7 +33,6 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -137,46 +128,62 @@ public class IcPartyActSignInRecordServiceImpl extends BaseServiceImpl<IcPartyAc
if (!result.success() && null == result.getData()) { if (!result.success() && null == result.getData()) {
throw new RenException("获取当前登录人居民信息失败"); throw new RenException("获取当前登录人居民信息失败");
} }
//保存签到记录数据 //二次签到不给积分
IcPartyActSignInRecordEntity entity = ConvertUtils.sourceToTarget(formDTO, IcPartyActSignInRecordEntity.class); boolean bl = true;
entity.setEpmetUserId(formDTO.getUserId()); //2.判断新增/修改签到记录数据
entity.setIdCard(result.getData().getIdNum()); LambdaQueryWrapper<IcPartyActSignInRecordEntity> wrapper = new LambdaQueryWrapper<>();
entity.setUserRealName(result.getData().getName()); wrapper.eq(IcPartyActSignInRecordEntity::getIcPartyActId, formDTO.getIcPartyActId());
insert(entity); wrapper.eq(IcPartyActSignInRecordEntity::getEpmetUserId, formDTO.getUserId());
IcPartyActSignInRecordEntity entityOne = baseDao.selectOne(wrapper);
//推送mq加积分 if (null == entityOne) {
IcPartyActEntity actEntity = icPartyActService.selectById(formDTO.getIcPartyActId()); IcPartyActSignInRecordEntity entity = ConvertUtils.sourceToTarget(formDTO, IcPartyActSignInRecordEntity.class);
String actType = actEntity.getActType(); entity.setEpmetUserId(formDTO.getUserId());
String eventTag = ("dangke".equals(actType) ? SystemMessageType.DANGKE : ("dxzh".equals(actType) ? SystemMessageType.DXZH : ( entity.setIdCard(result.getData().getIdNum());
"wmfwhd".equals(actType) ? SystemMessageType.WMFWHD : ("zbdydh".equals(actType) ? SystemMessageType.ZBDYDH : ( entity.setUserRealName(result.getData().getName());
"zbwyh".equals(actType) ? SystemMessageType.ZBWYH : ("ztdr".equals(actType) ? SystemMessageType.ZTDR : "") insert(entity);
)) } else {
))); entityOne.setAddress(formDTO.getAddress());
//网格缓存信息 entityOne.setLatitude(formDTO.getLatitude());
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(formDTO.getGridId()); entityOne.setLongitude(formDTO.getLongitude());
if (null == gridInfo) { baseDao.updateById(entityOne);
throw new EpmetException(String.format("未查询到网格{%s}信息", formDTO.getGridId())); bl = false;
} }
List<BasePointEventMsg> pointEventMsgList = new ArrayList<>();
BasePointEventMsg pointEventMsg = new BasePointEventMsg(); //3.推送mq加积分
pointEventMsg.setOpAgencyId(gridInfo.getPid()); if (bl) {
pointEventMsg.setOperatorId(formDTO.getUserId()); IcPartyActEntity actEntity = icPartyActService.selectById(formDTO.getIcPartyActId());
pointEventMsg.setAgencyId(gridInfo.getPid()); String actType = actEntity.getActType();
pointEventMsg.setCustomerId(formDTO.getCustomerId()); String eventTag = ("dangke".equals(actType) ? SystemMessageType.DANGKE : ("dxzh".equals(actType) ? SystemMessageType.DXZH : (
pointEventMsg.setGridId(gridInfo.getId()); "wmfwhd".equals(actType) ? SystemMessageType.WMFWHD : ("zbdydh".equals(actType) ? SystemMessageType.ZBDYDH : (
pointEventMsg.setUserId(formDTO.getUserId()); "zbwyh".equals(actType) ? SystemMessageType.ZBWYH : ("ztdr".equals(actType) ? SystemMessageType.ZTDR : "")
pointEventMsg.setActionFlag(MqConstant.PLUS); ))
pointEventMsg.setIsCommon(false); )));
pointEventMsg.setSourceType(actType); //网格缓存信息
pointEventMsg.setSourceId(formDTO.getIcPartyActId()); GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(formDTO.getGridId());
pointEventMsgList.add(pointEventMsg); if (null == gridInfo) {
throw new EpmetException(String.format("未查询到网格{%s}信息", formDTO.getGridId()));
SystemMsgFormDTO msgFormDTO = new SystemMsgFormDTO(); }
msgFormDTO.setMessageType(eventTag); List<BasePointEventMsg> pointEventMsgList = new ArrayList<>();
msgFormDTO.setContent(pointEventMsgList); BasePointEventMsg pointEventMsg = new BasePointEventMsg();
Result sendMsgResult = epmetMessageOpenFeignClient.sendSystemMsgByMQ(msgFormDTO); pointEventMsg.setOpAgencyId(gridInfo.getPid());
if (!sendMsgResult.success()) { pointEventMsg.setOperatorId(formDTO.getUserId());
log.error("党建活动签到发送积分失败,活动Id->" + formDTO.getIcPartyActId() + " 用户->" + formDTO.getUserId()); pointEventMsg.setAgencyId(gridInfo.getPid());
pointEventMsg.setCustomerId(formDTO.getCustomerId());
pointEventMsg.setGridId(gridInfo.getId());
pointEventMsg.setUserId(formDTO.getUserId());
pointEventMsg.setActionFlag(MqConstant.PLUS);
pointEventMsg.setIsCommon(false);
pointEventMsg.setSourceType(actType);
pointEventMsg.setSourceId(formDTO.getIcPartyActId());
pointEventMsgList.add(pointEventMsg);
SystemMsgFormDTO msgFormDTO = new SystemMsgFormDTO();
msgFormDTO.setMessageType(eventTag);
msgFormDTO.setContent(pointEventMsgList);
Result sendMsgResult = epmetMessageOpenFeignClient.sendSystemMsgByMQ(msgFormDTO);
if (!sendMsgResult.success()) {
log.error("党建活动签到发送积分失败,活动Id->" + formDTO.getIcPartyActId() + " 用户->" + formDTO.getUserId());
}
} }
} }

Loading…
Cancel
Save