Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

LAPTOP-KB9HII50\70708 2 years ago
parent
commit
8105bcf3cd

+ 18 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/log/BasePushRecordLogEntity.java

@ -6,7 +6,9 @@ import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
/**
 * Created by wsl on 2022/7/4
@ -24,7 +26,22 @@ public class BasePushRecordLogEntity extends UuidIdentityEntity {
    private Date createTime;  //创建时间
    private String sendObject;  //发送对象
    private Integer messageType;//消息推送类型
    private  Integer sendObjectType;//发送对象类型(1签约老人,2部分签约老人)
    private Integer sendObjectType;//发送对象类型(1签约老人,2部分签约老人)
    private List<String> patientList;
    @Transient
    public List<String> getPatientList() {
        return patientList;
    }
    public void setPatientList(List<String> patientList) {
        this.patientList = patientList;
    }
    @Column(name = "send_object_type")

+ 7 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/log/BasePushrecordLogInfoDao.java

@ -2,6 +2,8 @@ package com.yihu.jw.base.dao.log;
import com.yihu.jw.entity.log.BasePushrecordLogInfoEntity;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
@ -9,4 +11,9 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 */
public interface BasePushrecordLogInfoDao extends PagingAndSortingRepository<BasePushrecordLogInfoEntity, String>, JpaSpecificationExecutor<BasePushrecordLogInfoEntity> {
    @Modifying
    @Query("delete from BasePushrecordLogInfoEntity p where  p.pushId = ?1  ")
    void deleteByPushId(String pushId);
}

+ 6 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/ManageMessagePush/ManageSystemPushMessageController.java

@ -101,9 +101,13 @@ public class ManageSystemPushMessageController extends EnvelopRestEndpoint {
                                  @ApiParam(name = "pushDateType", value = "推送类型 1立即发送 2 定时发送", required = true)
                                  @RequestParam(value = "pushDateType", required = true) Integer pushDateType,
                                  @ApiParam(name = "pushDate", value = "推送时间 定时发送才传", required = false)
                                  @RequestParam(value = "pushDate", required = false) String pushDate) {
                                  @RequestParam(value = "pushDate", required = false) String pushDate,
                                  @ApiParam(name = "addType",value = "类型 1新增 2修改",required = false)
                                  @RequestParam(value = "addType",required = false)Integer addType,
                                  @ApiParam(name = "pushId",value = "推送id",required = false)
                                  @RequestParam(value = "pushId",required = false)String pushId) {
        try {
            mspmservice.addPushMessage(content,pushObjectType,pushObjectJson,pushDateType,pushDate);
            mspmservice.addPushMessage(content,pushObjectType,pushObjectJson,pushDateType,pushDate,addType,pushId);
            return success("添加成功");
        } catch (Exception e) {
            e.printStackTrace();

+ 35 - 21
svr/svr-base/src/main/java/com/yihu/jw/base/service/ManageMessagePush/ManageSystemPushMessageService.java

@ -19,10 +19,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.*;
/**
 * Created by wsl on 2022/7/4
@ -76,12 +73,19 @@ public class ManageSystemPushMessageService {
     * @param pushDate
     */
    @Transactional(rollbackFor = Exception.class)
    public void addPushMessage(String content, Integer pushObjectType, String pushObjectJson, Integer pushDateType, String pushDate) {
    public void addPushMessage(String content, Integer pushObjectType, String pushObjectJson, Integer pushDateType, String pushDate,Integer addType,String pushId) {
        BasePushRecordLogEntity basePushRecordLogEntity = new BasePushRecordLogEntity();
        List<BasePatientDO> basePatientDOS = null;
        List<BasePushrecordLogInfoEntity> basePushrecordLogInfoEntityList = new ArrayList<>();
        Date date =DateUtil.strToDate(pushDate);
        if (null!=addType&&addType==2) {
            BasePushRecordLogEntity one = basePushRecordLogDao.findOne(pushId);
            if (one.getStatus()!=1) {
                basePushRecordLogDao.delete(pushId);
                basePushrecordLogInfoDao.deleteByPushId(pushId);
            }
        }
        //判断发送对象类型  1签约老人  2 部分签约老人
        if (1 == pushObjectType) {
@ -95,31 +99,34 @@ public class ManageSystemPushMessageService {
            basePushRecordLogEntity.setSendObject(s);
        }
        Integer status ;
        //判断 1立即发送   2定时发送
        if (1==pushDateType) {
            SystemMessageDOListSave(basePatientDOS,content);
            basePushRecordLogEntity.setStatus(1);
            basePushRecordLogEntity.setSendTime(new Date());
            basePushRecordLogEntity.setPushType("1");
        }else {
            //创建定时任务记录
            basePatientDOS.forEach(logInfoDO->{
                String data = content;
                if (StringUtils.containsIgnoreCase(content,"【姓名】"))data = data.replace("【姓名】",logInfoDO.getName());
                if (StringUtils.containsIgnoreCase(content,"【称谓】"))data = data.replace("【称谓】",logInfoDO.getSex()==1?"大爷":"大妈");
                BasePushrecordLogInfoEntity basePushrecordLogInfoEntity = new BasePushrecordLogInfoEntity();
                basePushrecordLogInfoEntity.setPatient(logInfoDO.getId());
                basePushrecordLogInfoEntity.setPatientName(logInfoDO.getName());
                basePushrecordLogInfoEntity.setContent(data);
                basePushrecordLogInfoEntity.setStatus(0);
                basePushrecordLogInfoEntity.setSendTime(date);
                basePushrecordLogInfoEntityList.add(basePushrecordLogInfoEntity);
            });
            status = 1;
        }else{
            basePushRecordLogEntity.setSendTime(date);
            basePushRecordLogEntity.setStatus(0);
            basePushRecordLogEntity.setPushType("2");
            status = 0;
        }
        //创建定时任务记录
        for (BasePatientDO logInfoDO : basePatientDOS) {
            String data = content;
            if (StringUtils.containsIgnoreCase(content,"【姓名】"))data = data.replace("【姓名】",logInfoDO.getName());
            if (StringUtils.containsIgnoreCase(content,"【称谓】"))data = data.replace("【称谓】",logInfoDO.getSex()==1?"大爷":"大妈");
            BasePushrecordLogInfoEntity basePushrecordLogInfoEntity = new BasePushrecordLogInfoEntity();
            basePushrecordLogInfoEntity.setPatient(logInfoDO.getId());
            basePushrecordLogInfoEntity.setPatientName(logInfoDO.getName());
            basePushrecordLogInfoEntity.setContent(data);
            basePushrecordLogInfoEntity.setStatus(status);
            basePushrecordLogInfoEntity.setSendTime(date);
            basePushrecordLogInfoEntityList.add(basePushrecordLogInfoEntity);
        }
        //日志保存
@ -173,6 +180,14 @@ public class ManageSystemPushMessageService {
        Integer count = jdbcTemplate.queryForObject(countSql + filite, Integer.class);
        result.put("count",count);
        if (entityList.size()>0) {
            for (BasePushRecordLogEntity logEntity : entityList) {
                String patientListSql = "select patient from base_pushrecord_log_info where push_id = '"+logEntity.getId()+"'";
                List<String> list = jdbcTemplate.queryForList(patientListSql, String.class);
                logEntity.setPatientList(list);
            }
        }
        return result;
    }
@ -207,7 +222,6 @@ public class ManageSystemPushMessageService {
            messageDOS.add(systemMessageDO);
        }
        systemMessageDao.save(messageDOS);
    }