|
|
@ -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.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
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.MqConstant; |
|
|
|
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.Result; |
|
|
|
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.SystemMsgFormDTO; |
|
|
|
import com.epmet.dto.result.CommonDataFilterResultDTO; |
|
|
|
import com.epmet.dto.result.CustomerUserDetailResultDTO; |
|
|
|
import com.epmet.feign.EpmetMessageOpenFeignClient; |
|
|
|
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.service.IcPartyActService; |
|
|
|
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.partyOrg.form.PartyActSignFormDTO; |
|
|
|
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.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
@ -137,46 +128,62 @@ public class IcPartyActSignInRecordServiceImpl extends BaseServiceImpl<IcPartyAc |
|
|
|
if (!result.success() && null == result.getData()) { |
|
|
|
throw new RenException("获取当前登录人居民信息失败"); |
|
|
|
} |
|
|
|
//保存签到记录数据
|
|
|
|
IcPartyActSignInRecordEntity entity = ConvertUtils.sourceToTarget(formDTO, IcPartyActSignInRecordEntity.class); |
|
|
|
entity.setEpmetUserId(formDTO.getUserId()); |
|
|
|
entity.setIdCard(result.getData().getIdNum()); |
|
|
|
entity.setUserRealName(result.getData().getName()); |
|
|
|
insert(entity); |
|
|
|
|
|
|
|
//推送mq加积分
|
|
|
|
IcPartyActEntity actEntity = icPartyActService.selectById(formDTO.getIcPartyActId()); |
|
|
|
String actType = actEntity.getActType(); |
|
|
|
String eventTag = ("dangke".equals(actType) ? SystemMessageType.DANGKE : ("dxzh".equals(actType) ? SystemMessageType.DXZH : ( |
|
|
|
"wmfwhd".equals(actType) ? SystemMessageType.WMFWHD : ("zbdydh".equals(actType) ? SystemMessageType.ZBDYDH : ( |
|
|
|
"zbwyh".equals(actType) ? SystemMessageType.ZBWYH : ("ztdr".equals(actType) ? SystemMessageType.ZTDR : "") |
|
|
|
)) |
|
|
|
))); |
|
|
|
//网格缓存信息
|
|
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(formDTO.getGridId()); |
|
|
|
if (null == gridInfo) { |
|
|
|
throw new EpmetException(String.format("未查询到网格{%s}信息", formDTO.getGridId())); |
|
|
|
//二次签到不给积分
|
|
|
|
boolean bl = true; |
|
|
|
//2.判断新增/修改签到记录数据
|
|
|
|
LambdaQueryWrapper<IcPartyActSignInRecordEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
wrapper.eq(IcPartyActSignInRecordEntity::getIcPartyActId, formDTO.getIcPartyActId()); |
|
|
|
wrapper.eq(IcPartyActSignInRecordEntity::getEpmetUserId, formDTO.getUserId()); |
|
|
|
IcPartyActSignInRecordEntity entityOne = baseDao.selectOne(wrapper); |
|
|
|
if (null == entityOne) { |
|
|
|
IcPartyActSignInRecordEntity entity = ConvertUtils.sourceToTarget(formDTO, IcPartyActSignInRecordEntity.class); |
|
|
|
entity.setEpmetUserId(formDTO.getUserId()); |
|
|
|
entity.setIdCard(result.getData().getIdNum()); |
|
|
|
entity.setUserRealName(result.getData().getName()); |
|
|
|
insert(entity); |
|
|
|
} else { |
|
|
|
entityOne.setAddress(formDTO.getAddress()); |
|
|
|
entityOne.setLatitude(formDTO.getLatitude()); |
|
|
|
entityOne.setLongitude(formDTO.getLongitude()); |
|
|
|
baseDao.updateById(entityOne); |
|
|
|
bl = false; |
|
|
|
} |
|
|
|
List<BasePointEventMsg> pointEventMsgList = new ArrayList<>(); |
|
|
|
BasePointEventMsg pointEventMsg = new BasePointEventMsg(); |
|
|
|
pointEventMsg.setOpAgencyId(gridInfo.getPid()); |
|
|
|
pointEventMsg.setOperatorId(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()); |
|
|
|
|
|
|
|
//3.推送mq加积分
|
|
|
|
if (bl) { |
|
|
|
IcPartyActEntity actEntity = icPartyActService.selectById(formDTO.getIcPartyActId()); |
|
|
|
String actType = actEntity.getActType(); |
|
|
|
String eventTag = ("dangke".equals(actType) ? SystemMessageType.DANGKE : ("dxzh".equals(actType) ? SystemMessageType.DXZH : ( |
|
|
|
"wmfwhd".equals(actType) ? SystemMessageType.WMFWHD : ("zbdydh".equals(actType) ? SystemMessageType.ZBDYDH : ( |
|
|
|
"zbwyh".equals(actType) ? SystemMessageType.ZBWYH : ("ztdr".equals(actType) ? SystemMessageType.ZTDR : "") |
|
|
|
)) |
|
|
|
))); |
|
|
|
//网格缓存信息
|
|
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(formDTO.getGridId()); |
|
|
|
if (null == gridInfo) { |
|
|
|
throw new EpmetException(String.format("未查询到网格{%s}信息", formDTO.getGridId())); |
|
|
|
} |
|
|
|
List<BasePointEventMsg> pointEventMsgList = new ArrayList<>(); |
|
|
|
BasePointEventMsg pointEventMsg = new BasePointEventMsg(); |
|
|
|
pointEventMsg.setOpAgencyId(gridInfo.getPid()); |
|
|
|
pointEventMsg.setOperatorId(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()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|