Browse Source

活动签到推送mq发放积分

dev
sunyuchao 3 years ago
parent
commit
ef33d631cc
  1. 1
      epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/IcMessageDao.xml
  2. 5
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyActSignFormDTO.java
  3. 57
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActSignInRecordServiceImpl.java

1
epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/IcMessageDao.xml

@ -41,6 +41,7 @@
ic_message ic_message
WHERE WHERE
del_flag = '0' del_flag = '0'
AND read_flag = 'unread'
AND user_id = #{userId} AND user_id = #{userId}
</select> </select>

5
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyActSignFormDTO.java

@ -15,6 +15,11 @@ public class PartyActSignFormDTO implements Serializable {
*/ */
@NotBlank(message = "活动Id不能为空",groups = {UpdateGroup.class}) @NotBlank(message = "活动Id不能为空",groups = {UpdateGroup.class})
private String icPartyActId; private String icPartyActId;
/**
* 网格Id
*/
@NotBlank(message = "网格Id不能为空",groups = {UpdateGroup.class})
private String gridId;
/** /**
* 签到地点 * 签到地点
*/ */

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

@ -4,29 +4,46 @@ 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.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.dto.form.mq.eventmsg.BasePointEventMsg;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.SystemMessageType;
import com.epmet.dto.IcMessageDTO; import com.epmet.dto.IcMessageDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.IcMessageListFormDTO; 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.result.CommonDataFilterResultDTO;
import com.epmet.dto.result.CustomerUserDetailResultDTO; import com.epmet.dto.result.CustomerUserDetailResultDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.modules.partyOrg.dao.IcPartyActSignInRecordDao; import com.epmet.modules.partyOrg.dao.IcPartyActSignInRecordDao;
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.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;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; 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 org.springframework.web.bind.annotation.RequestBody;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -38,9 +55,14 @@ import java.util.Map;
* @since v1.0.0 2022-08-18 * @since v1.0.0 2022-08-18
*/ */
@Service @Service
@Slf4j
public class IcPartyActSignInRecordServiceImpl extends BaseServiceImpl<IcPartyActSignInRecordDao, IcPartyActSignInRecordEntity> implements IcPartyActSignInRecordService { public class IcPartyActSignInRecordServiceImpl extends BaseServiceImpl<IcPartyActSignInRecordDao, IcPartyActSignInRecordEntity> implements IcPartyActSignInRecordService {
@Autowired @Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private IcPartyActService icPartyActService;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Override @Override
@ -121,6 +143,41 @@ public class IcPartyActSignInRecordServiceImpl extends BaseServiceImpl<IcPartyAc
entity.setIdCard(result.getData().getIdNum()); entity.setIdCard(result.getData().getIdNum());
entity.setUserRealName(result.getData().getName()); entity.setUserRealName(result.getData().getName());
insert(entity); 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()));
}
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());
}
} }
} }
Loading…
Cancel
Save