Browse Source

Merge remote-tracking branch 'origin/dev_view_detail' into dev_special_focus_update

# Conflicts:
#	epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml
master
yinzuomei 3 years ago
parent
commit
2a1a3683c8
  1. 26
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/TopArticleFormDTO.java
  2. 11
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java
  3. 2
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java
  4. 17
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  5. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNoticeDTO.java
  6. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java
  7. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java
  8. 50
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeV2FormDTO.java
  9. 6
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java
  10. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java
  11. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNoticeEntity.java
  12. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java
  13. 122
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java
  14. 10
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.71__icnotice_sendres.sql
  15. 4
      epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml
  16. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml
  17. 1
      epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml

26
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/TopArticleFormDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @Description
* @Author yzm
* @Date 2022/9/21 15:13
*/
@Data
public class TopArticleFormDTO {
/**
* 文章id
*/
@NotBlank(message = "文章id不能为空")
private String articleId;
/**
* top
* cancel_top
*/
@NotBlank(message = "type不能为空,置顶:top,取消置顶:cancel_top")
private String type;
}

11
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java

@ -424,6 +424,17 @@ public class ArticleController {
return new Result<PageData<PublishedListResultDTO>>().ok(articleService.articleListV2(formDTO));
}
/**
* 文章置顶取消置顶
* @param formDTO
* @return
*/
@PostMapping("topArticle")
public Result topArticle(@RequestBody TopArticleFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
articleService.topArticle(formDTO.getArticleId(),formDTO.getType());
return new Result();
}
/**
* @param tokenDTO
* @return

2
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java

@ -255,4 +255,6 @@ public interface ArticleService extends BaseService<ArticleEntity> {
PageData<PublishedListResultDTO> articleListV2(ArticleListFormDTO formDTO);
PublishedListResultDTO detailV2(ArticleListFormDTO formDTO);
void topArticle(String articleId, String type);
}

17
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

@ -1775,4 +1775,21 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
return resultDTO;
}
@Override
public void topArticle(String articleId, String type) {
ArticleEntity articleEntity = baseDao.selectById(articleId);
if (null != articleEntity) {
/**
* top
* cancel_top
*/
if ("top".equals(type)) {
articleEntity.setIsTop(NumConstant.ONE);
} else if ("cancel_top".equals(type)) {
articleEntity.setIsTop(NumConstant.ZERO);
}
baseDao.updateById(articleEntity);
}
}
}

4
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNoticeDTO.java

@ -106,4 +106,8 @@ public class IcNoticeDTO implements Serializable {
@JsonIgnore
private Date updatedTime;
/**
* 发送结果1成功,0失败
*/
private String sendRes;
}

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java

@ -83,6 +83,11 @@ public class IcTripReportRecordDTO implements Serializable {
@ExcelProperty("身份证号")
private String idCard;
/**
* 真实身份证号
*/
private String realIdCard;
/**
* 用户id
*/

3
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java

@ -60,5 +60,8 @@ public class SendNoticeFormDTO implements Serializable {
* 身份证
*/
private String idCard;
private String realIdCard;
}
}

50
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeV2FormDTO.java

@ -0,0 +1,50 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import java.util.List;
/**
* @Description
* @Author yzm
* @Date 2022/9/21 17:06
*/
@Data
public class SendNoticeV2FormDTO {
// token获取
private String customerId;
private String staffId;
// 前端传入
/**
* 用户列表
*/
@NotEmpty(message = "业务数据id不能为空", groups = CustomerClientShowGroup.class)
private List<String> bdIds;
/**
* 通知渠道通知渠道 0小程序通知1短信通知
*/
@NotEmpty(message = "请选择通知渠道", groups = CustomerClientShowGroup.class)
private List<String> channel;
/**
* v1:通知来源 0 行程上报1 疫苗接种2 核酸检测
* v2:0行程上报1疫苗接种关注名单2重点人群关注名单-隔离防疫原核酸检测关注名单
*/
@NotEmpty(message = "通知来源不能为空", groups = CustomerClientShowGroup.class)
private String origin;
/**
* 通知内容
*/
@Size(min = 1, max = 500, message = "通知内容不超过500字", groups = CustomerClientShowGroup.class)
private String content;
// 接口内赋值
/**
* 组织名
*/
private String orgName;
}

6
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java

@ -42,6 +42,12 @@ public class VaccinationListResultDTO implements Serializable {
* 身份证
*/
private String idCard;
/**
* 真实的身份证
*/
private String realIdCard;
private String sex;
/**

16
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java

@ -4,7 +4,6 @@ import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -15,6 +14,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcNoticeDTO;
import com.epmet.dto.form.IcNoticeFormDTO;
import com.epmet.dto.form.SendNoticeFormDTO;
import com.epmet.dto.form.SendNoticeV2FormDTO;
import com.epmet.dto.form.SendPointNoticeFormDTO;
import com.epmet.dto.result.CommunityInfoResultDTO;
import com.epmet.feign.GovOrgFeignClient;
@ -108,4 +108,18 @@ public class IcNoticeController {
return new Result();
}
/**
* 行程上报重点人群关注名单疫苗接种关注名单这几个页面的发送通知
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("sendNoticeV2")
public Result sendNoticeV2(@LoginUser TokenDto tokenDto, @RequestBody SendNoticeV2FormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, CustomerClientShowGroup.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
icNoticeService.sendNoticeV2(formDTO);
return new Result();
}
}

4
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNoticeEntity.java

@ -57,4 +57,8 @@ public class IcNoticeEntity extends BaseEpmetEntity {
*/
private String orgName;
/**
* 发送结果1成功,0失败
*/
private String sendRes;
}

7
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java

@ -5,6 +5,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcNoticeDTO;
import com.epmet.dto.form.IcNoticeFormDTO;
import com.epmet.dto.form.SendNoticeFormDTO;
import com.epmet.dto.form.SendNoticeV2FormDTO;
import com.epmet.dto.form.SendPointNoticeFormDTO;
import com.epmet.entity.IcNoticeEntity;
@ -115,4 +116,10 @@ public interface IcNoticeService extends BaseService<IcNoticeEntity> {
* @return
*/
Map<String, Date> getUserLatestNoticeTime(String customerId,List<String> idCardSet);
/**
* 行程上报重点人群关注名单疫苗接种关注名单这几个页面的发送通知
* @param formDTO
*/
void sendNoticeV2(SendNoticeV2FormDTO formDTO);
}

122
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java

@ -13,11 +13,15 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.SmsTemplateConstant;
import com.epmet.constant.UserMessageTypeConstant;
import com.epmet.dao.IcEpidemicSpecialAttentionDao;
import com.epmet.dao.IcNoticeDao;
import com.epmet.dao.IcTripReportRecordDao;
import com.epmet.dto.IcNoticeDTO;
import com.epmet.dto.UserBaseInfoDTO;
import com.epmet.dto.form.*;
import com.epmet.entity.IcEpidemicSpecialAttentionEntity;
import com.epmet.entity.IcNoticeEntity;
import com.epmet.entity.IcTripReportRecordEntity;
import com.epmet.feign.MessageFeignClient;
import com.epmet.service.IcNoticeService;
import com.epmet.service.UserBaseInfoService;
@ -26,6 +30,7 @@ import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -47,6 +52,10 @@ public class IcNoticeServiceImpl extends BaseServiceImpl<IcNoticeDao, IcNoticeEn
private MessageFeignClient messageFeignClient;
@Resource
private UserBaseInfoService userBaseInfoService;
@Autowired
private IcTripReportRecordDao icTripReportRecordDao;
@Autowired
private IcEpidemicSpecialAttentionDao icEpidemicSpecialAttentionDao;
@Override
public PageData<IcNoticeDTO> page(IcNoticeFormDTO formDTO) {
@ -147,6 +156,8 @@ public class IcNoticeServiceImpl extends BaseServiceImpl<IcNoticeDao, IcNoticeEn
entity.setMobile(item.getMobile());
entity.setIdCard(item.getIdCard());
entity.setOrgName(finalOrgName);
// 发送结果:1成功,0失败 默认插入发送成功。下面没有找到居民端的用户id,会更新
entity.setSendRes(NumConstant.ONE_STR);
return entity;
}).collect(Collectors.toList());
insertBatch(entityList);
@ -158,40 +169,45 @@ public class IcNoticeServiceImpl extends BaseServiceImpl<IcNoticeDao, IcNoticeEn
entityList.forEach(item -> {
if (StringUtils.isNotBlank(item.getIdCard())) {
//根据身份证获取居民ID
//根据身份证获取居民ID 如果一个客户下,存在多个身份证号相同的而用户,该接口只返回一个
List<UserBaseInfoDTO> userList = userBaseInfoService.getCommonIdNumUser(item.getCustomerId(), item.getIdCard());
if (CollectionUtils.isNotEmpty(userList)) {
userList.forEach(user -> {
// userList.forEach(user -> {
UserBaseInfoDTO userBaseInfoDTO=userList.get(NumConstant.ZERO);
UserMessageFormDTO messageFormDTO = new UserMessageFormDTO();
messageFormDTO.setCustomerId(item.getCustomerId());
messageFormDTO.setApp(AppClientConstant.APP_GOV);
messageFormDTO.setGridId(StrConstant.STAR);
messageFormDTO.setUserId(user.getUserId());
messageFormDTO.setUserId(userBaseInfoDTO.getUserId());
messageFormDTO.setTitle("您有一条通知消息!");
messageFormDTO.setMessageContent(item.getContent());
messageFormDTO.setReadFlag(Constant.UNREAD);
messageFormDTO.setMessageType(UserMessageTypeConstant.ANTIEPIDEMIC);
messageFormDTO.setTargetId(item.getId());
msgList.add(messageFormDTO);
});
item.setUserId(userBaseInfoDTO.getUserId());
// });
}else{
// 没有找到居民端的用户id,发送失败
item.setSendRes(NumConstant.ZERO_STR);
}
baseDao.updateById(item);
}
//TODO 短信消息
if (StringUtils.isNotBlank(item.getMobile())) {
/*if (StringUtils.isNotBlank(item.getMobile())) {
ProjectSendMsgFormDTO sms = new ProjectSendMsgFormDTO();
sms.setCustomerId(item.getCustomerId());
sms.setMobile(item.getMobile());
sms.setAliyunTemplateCode(SmsTemplateConstant.PROJECT_OVERDUE);
sms.setParameterKey("send_msg");
smsList.add(sms);
}
}*/
});
//发送小程序消息
Result result = messageFeignClient.saveUserMessageList(msgList);
if (!result.success()) {
log.error("发送小程序消息失败" + JSON.toJSONString(result));
}
//TODO 发送短信
}
/**
@ -326,4 +342,96 @@ public class IcNoticeServiceImpl extends BaseServiceImpl<IcNoticeDao, IcNoticeEn
return map;
}
/**
* 行程上报重点人群关注名单疫苗接种关注名单这几个页面的发送通知
*
* @param formDTO
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void sendNoticeV2(SendNoticeV2FormDTO formDTO) {
String orgName = "";
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
if (null != staffInfo) {
orgName = staffInfo.getAgencyName();
}
// 保存消息
String channel = StringUtils.join(formDTO.getChannel(), StrConstant.COMMA);
String finalOrgName = orgName;
List<SendNoticeFormDTO.UserListBean> userBeanList = null;
List<IcNoticeEntity> entityList = new ArrayList<>();
for (String bdId : formDTO.getBdIds()) {
IcNoticeEntity entity = new IcNoticeEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setChannel(channel);
entity.setContent(formDTO.getContent());
entity.setOrigin(formDTO.getOrigin());
// 这时候还不知道居民端的用户id
entity.setUserId(StrConstant.EPMETY_STR);
entity.setOrgName(finalOrgName);
// 发送结果:1成功,0失败 默认插入发送成功。下面没有找到居民端的用户id,会更新
entity.setSendRes(NumConstant.ONE_STR);
// v2:0行程上报,1疫苗接种关注名单,2隔离防疫原核酸检测
// 身份证号手机号
if (NumConstant.ZERO_STR.equals(formDTO.getOrigin())) {
IcTripReportRecordEntity icTripReportRecordEntity = icTripReportRecordDao.selectById(bdId);
entity.setMobile(icTripReportRecordEntity.getMobile());
entity.setIdCard(icTripReportRecordEntity.getIdCard());
} else if (NumConstant.ONE_STR.equals(formDTO.getOrigin()) || NumConstant.TWO_STR.equals(formDTO.getOrigin())) {
IcEpidemicSpecialAttentionEntity icEpidemicSpecialAttentionEntity = icEpidemicSpecialAttentionDao.selectById(bdId);
entity.setMobile(icEpidemicSpecialAttentionEntity.getMobile());
entity.setIdCard(icEpidemicSpecialAttentionEntity.getIdCard());
}
entityList.add(entity);
}
if (CollectionUtils.isEmpty(entityList)) {
return;
}
insertBatch(entityList);
// 通知渠道通知渠道 0小程序通知,1短信通知
for (String channelValue : formDTO.getChannel()) {
if ("0".equals(channelValue)) {
// 小程序通知
List<UserMessageFormDTO> msgList = new ArrayList<>();
entityList.forEach(item -> {
// 根据身份证获取居民ID 如果一个客户下,存在多个身份证号相同的而用户,该接口只返回一个
List<UserBaseInfoDTO> userList = userBaseInfoService.getCommonIdNumUser(item.getCustomerId(), item.getIdCard());
if (CollectionUtils.isNotEmpty(userList)) {
UserBaseInfoDTO userBaseInfoDTO = userList.get(NumConstant.ZERO);
UserMessageFormDTO messageFormDTO = new UserMessageFormDTO();
messageFormDTO.setCustomerId(item.getCustomerId());
messageFormDTO.setApp(AppClientConstant.APP_GOV);
messageFormDTO.setGridId(StrConstant.STAR);
messageFormDTO.setUserId(userBaseInfoDTO.getUserId());
messageFormDTO.setTitle("您有一条通知消息!");
messageFormDTO.setMessageContent(item.getContent());
messageFormDTO.setReadFlag(Constant.UNREAD);
messageFormDTO.setMessageType(UserMessageTypeConstant.ANTIEPIDEMIC);
messageFormDTO.setTargetId(item.getId());
msgList.add(messageFormDTO);
item.setUserId(userBaseInfoDTO.getUserId());
} else {
// 没有找到居民端的用户id,发送失败
item.setSendRes(NumConstant.ZERO_STR);
}
baseDao.updateById(item);
});
// 发送小程序消息-站内信
Result result = messageFeignClient.saveUserMessageList(msgList);
if (!result.success()) {
log.warn("发送小程序消息失败" + JSON.toJSONString(result));
}
} else {
// 短信通知再说 todo
}
}
}
}

10
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.71__icnotice_sendres.sql

@ -0,0 +1,10 @@
ALTER TABLE ic_notice ADD COLUMN SEND_RES VARCHAR ( 1 ) NOT NULL DEFAULT '1' COMMENT '发送结果:1成功,0失败' after ORG_NAME;
update ic_notice n
set n.SEND_RES='1'
where n.USER_ID is not null
and n.USER_ID !='';
update ic_notice n
set n.SEND_RES='0'
where (n.USER_ID is null
or n.USER_ID ='');

4
epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml

@ -72,6 +72,7 @@
a.`NAME`,
a.MOBILE,
a.ID_CARD,
a.ID_CARD as realIdCard,
IFNULL(a.reason,'') AS reason,
a.REMARK,
b.VILLAGE_ID,
@ -93,7 +94,7 @@
<if test='null != mobile and "" != mobile'>
AND a.MOBILE LIKE CONCAT('%',#{mobile},'%')
</if>
<if test='null != mobile and "" != mobile'>
<if test='null != idCard and "" != idCard'>
AND a.ID_CARD LIKE CONCAT('%',#{idCard},'%')
</if>
<if test='null != villageId and "" != villageId'>
@ -127,6 +128,7 @@
a.customer_id as customerId,
a.MOBILE,
a.ID_CARD,
a.ID_CARD as realIdCard,
a.REMARK,
a.REASON,
b.VILLAGE_ID,

3
epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml

@ -27,7 +27,8 @@
SELECT
r.*,
a.ID AS epidemicId,
r.CREATED_TIME AS reportTime
r.CREATED_TIME AS reportTime,
r.ID_CARD as realIdCard
FROM ic_trip_report_record r
LEFT JOIN ic_epidemic_special_attention a ON (a.ID_CARD = r.ID_CARD AND a.DEL_FLAG = 0 AND a.IS_ATTENTION = 1 AND a.ATTENTION_TYPE = 2)
WHERE

1
epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml

@ -128,6 +128,7 @@
WHERE DEL_FLAG = '0'
AND customer_id = #{customerId}
and id_num=#{idNum}
limit 1
</select>
<select id="selectCountIdNum" parameterType="map" resultType="java.lang.Integer">

Loading…
Cancel
Save