Browse Source

【pc端 -新增用户指标展示管理】【定时任务接口修改】魏凯 2020-11-25

feature/dangjian
weikai 5 years ago
parent
commit
c70a373aa0
  1. 12
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/feign/MessageFeignClient.java
  2. 5
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/feign/fallback/MessageFeignClientFallback.java
  3. 92
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/UserAnalysisNoteServiceImpl.java
  4. 2
      esua-epdc/epdc-module/epdc-message/epdc-message-client/src/main/java/com/elink/esua/epdc/dto/form/SmsNoticeFormDTO.java
  5. 10
      esua-epdc/epdc-module/epdc-message/epdc-message-server/src/main/java/com/elink/esua/epdc/service/impl/SmsTemplateServiceImpl.java

12
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/feign/MessageFeignClient.java

@ -28,4 +28,16 @@ public interface MessageFeignClient {
*/
@PostMapping(value = "message/epdc-app/smstemplate/sendSmsNoticeNew", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result sendSmsNotice(@RequestBody SmsNoticeFormDTO smsNoticeFormDTO);
/**
* 议题待回应事件 审核结果短信通知 议题发起人
*
* @param smsNoticeFormDTO
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author wk
* @Date2020/5/8
*/
@PostMapping(value = "message/epdc-app/smstemplate/sendSmsNotice", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result sendSmsNoticeDistrict(@RequestBody SmsNoticeFormDTO smsNoticeFormDTO);
}

5
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/feign/fallback/MessageFeignClientFallback.java

@ -13,4 +13,9 @@ public class MessageFeignClientFallback implements MessageFeignClient {
public Result sendSmsNotice(SmsNoticeFormDTO smsNoticeFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_MESSAGE_SERVER, "sendSmsNotice", smsNoticeFormDTO);
}
@Override
public Result sendSmsNoticeDistrict(SmsNoticeFormDTO smsNoticeFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_MESSAGE_SERVER, "sendSmsNoticeDistrict", smsNoticeFormDTO);
}
}

92
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/UserAnalysisNoteServiceImpl.java

@ -200,7 +200,7 @@ public class UserAnalysisNoteServiceImpl extends BaseServiceImpl<UserAnalysisNot
//街道账号电话号
List<String> streetMobiles = new ArrayList<>();
//街道模板内容
List< Map<String,LinkedHashMap<String, String>>> streeContentNoteList = new ArrayList<>();
Map<String,LinkedHashMap<String, String>> contentNote = new HashMap<>();
//2.查询出要发送的用户信息
Map<String, Object> params = new HashMap<>();
List<UserAnalysisNoteDTO> userNoteList = baseDao.getList(params);
@ -215,55 +215,30 @@ public class UserAnalysisNoteServiceImpl extends BaseServiceImpl<UserAnalysisNot
String mobile = dto.getMobile();
districtMobiles.add(mobile);
}else if ("1".equals(deptType)){ //街道级账号 发送街道模板
Map<String,LinkedHashMap<String, String>> contentNote = new HashMap<>();
LinkedHashMap<String, String> noteParams = new LinkedHashMap<>();
//获取电话号
String mobile = dto.getMobile();
streetMobiles.add(mobile);
//获取部门排行
Integer ranking = streeRanking.get(dto.getDeptId());
noteParams.put("deptName",dto.getDeptName());
noteParams.put("deptType","街道");
noteParams.put("month",getLastMonth());
noteParams.put("sort",ranking.toString());
noteParams.put("code",dto.getDeptId());
if (ranking<=3){
noteParams.put("msmType","恭喜");
}else if ( ranking>3 && ranking<=10){
noteParams.put("msmType","祝贺");
}else if ( ranking>10 && ranking<=18){
noteParams.put("msmType","打扰一下");
}else {
noteParams.put("msmType","很遗憾");
}
//组装短信内容参数
LinkedHashMap<String, String> noteParams = streeNoteContent(ranking,dto);
contentNote.put(mobile,noteParams);
streeContentNoteList.add(contentNote);
}else {//社区级账号 发送街道模板
//获取电话号
String mobile = dto.getMobile();
streetMobiles.add(mobile);
Map<String,LinkedHashMap<String, String>> contentNote = new HashMap<>();
LinkedHashMap<String, String> noteParams = new LinkedHashMap<>();
//获取部门排行
Integer ranking = communiytRanking.get(dto.getDeptId());
noteParams.put("deptName",dto.getDeptName());
noteParams.put("deptType","社区");
noteParams.put("month",getLastMonth());
noteParams.put("sort",ranking.toString());
noteParams.put("code",dto.getDeptId());
if (ranking<=3){
noteParams.put("msmType","恭喜");
}else if ( ranking>23 && ranking<=20){
noteParams.put("msmType","很遗憾");
}else {
noteParams.put("msmType","祝贺");
}
Integer rankingCommunity = communiytRanking.get(dto.getDeptId());
//组装短信内容参数
LinkedHashMap<String, String> noteParams = streeNoteContent(rankingCommunity,dto);
contentNote.put(mobile,noteParams);
streeContentNoteList.add(contentNote);
}
}
//6.开始发送发送短信(区级,和街道级分开发)
//区级 短信
sendMessagesDistrict(districtMobiles);
//街道级短信
sendMessages(streetMobiles,contentNote);
}
/**
@ -298,21 +273,62 @@ public class UserAnalysisNoteServiceImpl extends BaseServiceImpl<UserAnalysisNot
* @Description: 发送短信功能
* @Param: mobiles 电话号
* @Param: streeContentNoteList 短信模板内容
* @Param: type 模板类型 0 1 街道
* @return: void
* @Author: wk
* @Date: 2020/5/8
*/
@Async
public void sendMessages( List<String>mobiles,
List< Map<String,LinkedHashMap<String, String>>> streeContentNoteList,
String type){
Map<String,LinkedHashMap<String, String>> contentNoteList){
//获取所有手机号,以及短信模板
SmsNoticeFormDTO smsNoticeFormDTO = new SmsNoticeFormDTO();
smsNoticeFormDTO.setMobiles(mobiles);
smsNoticeFormDTO.setNoteContent(contentNoteList);
//插入固定短信模板
smsNoticeFormDTO.setSmsTemplateType(SMSTYPENAME);
messageFeignClient.sendSmsNotice(smsNoticeFormDTO);
}
/**
* @Description: 发送短信功能 -区级
* @Param: mobiles 电话号
* @Param: streeContentNoteList 短信模板内容
* @return: void
* @Author: wk
* @Date: 2020/5/8
*/
@Async
public void sendMessagesDistrict( List<String>mobiles){
//获取所有手机号,以及短信模板
SmsNoticeFormDTO smsNoticeFormDTO = new SmsNoticeFormDTO();
smsNoticeFormDTO.setMobiles(mobiles);
//插入固定短信模板
smsNoticeFormDTO.setSmsTemplateType(SMSTYPENAME);
messageFeignClient.sendSmsNoticeDistrict(smsNoticeFormDTO);
}
/**
* 根据部门排名拼接部门短信内容参数
* @param ranking
* @param dto
* @return wk
*/
private LinkedHashMap<String, String> streeNoteContent(Integer ranking,UserAnalysisNoteDTO dto){
LinkedHashMap<String, String> noteParams = new LinkedHashMap<>();
noteParams.put("deptName",dto.getDeptName());
noteParams.put("deptType","街道");
noteParams.put("month",getLastMonth());
noteParams.put("sort",ranking.toString());
noteParams.put("code",dto.getDeptId());
if (ranking<=3){
noteParams.put("msmType","恭喜");
}else if ( ranking>23 && ranking<=20){
noteParams.put("msmType","很遗憾");
}else {
noteParams.put("msmType","祝贺");
}
return noteParams;
}
}

2
esua-epdc/epdc-module/epdc-message/epdc-message-client/src/main/java/com/elink/esua/epdc/dto/form/SmsNoticeFormDTO.java

@ -32,5 +32,5 @@ public class SmsNoticeFormDTO implements Serializable {
/**
* 新增短信模板内容
*/
private List<Map<String, LinkedHashMap<String, String>>> noteContent;
private Map<String, LinkedHashMap<String, String>> noteContent;
}

10
esua-epdc/epdc-module/epdc-message/epdc-message-server/src/main/java/com/elink/esua/epdc/service/impl/SmsTemplateServiceImpl.java

@ -275,16 +275,16 @@ public class SmsTemplateServiceImpl extends BaseServiceImpl<SmsTemplateDao, SmsT
if (service == null) {
throw new RenException(ModuleErrorCode.SMS_CONFIG);
}
List<Map<String, LinkedHashMap<String, String>>> noteContenList = formDto.getNoteContent();
Map<String, LinkedHashMap<String, String>> noteConten = formDto.getNoteContent();
List<SmsLogEntity> smsLogEntities = new ArrayList<>(mobiles.size());
for (int i = 0;i<mobiles.size();i++) {
for (String mobile:
mobiles) {
//发送短信
SysSmsDTO sysSmsDto = service.sendSmsNotice(mobiles.get(i), noteContenList.get(i).get(mobiles.get(i)), templateDto.getSignName(), templateDto.getTemplate());
SysSmsDTO sysSmsDto = service.sendSmsNotice(mobile,noteConten.get(mobile) , templateDto.getSignName(), templateDto.getTemplate());
SmsLogEntity entity = new SmsLogEntity();
entity.setSmsTemplateId(templateDto.getId());
entity.setMobile(mobiles.get(i));
entity.setMobile(mobile);
entity.setStatus(sysSmsDto.getStatus());
entity.setPlatform(sysSmsDto.getPlatform());
smsLogEntities.add(entity);

Loading…
Cancel
Save