Browse Source

代码修改

liubing 3 years ago
parent
commit
030b72f69e

+ 2 - 0
common/common-entity/sql记录

@ -1487,5 +1487,7 @@ CREATE TABLE `base_onenet_receive_record` (
  PRIMARY KEY (`id`)
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='onenet 数据接收记录表';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='onenet 数据接收记录表';
-- 2021-09-10
ALTER table wlyy_job_config_new add COLUMN area_level VARCHAR(1) default null comment '1省2市3区县4机构5团队6医生'

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/job/QuartzJobConfig.java

@ -16,6 +16,7 @@ public class QuartzJobConfig implements java.io.Serializable {
	private String jobName;//任务名称
	private String jobName;//任务名称
	private String jobInfo;//任务描述
	private String jobInfo;//任务描述
	private String jobType;//任务类型(0--单次执行  1--周期执行 2--监听任务)
	private String jobType;//任务类型(0--单次执行  1--周期执行 2--监听任务)
	private String areaLevel;//1省2市3区县4机构5团队6医生
	private String jobClass;//任务执行的class
	private String jobClass;//任务执行的class
	private String quartzCron;//quartz表达式
	private String quartzCron;//quartz表达式
	private String status;//1 启动 0停止
	private String status;//1 启动 0停止
@ -222,4 +223,13 @@ public class QuartzJobConfig implements java.io.Serializable {
    public void setTimeLevel(String timeLevel) {
    public void setTimeLevel(String timeLevel) {
        this.timeLevel = timeLevel;
        this.timeLevel = timeLevel;
    }
    }
	@Column(name = "area_level", length = 1)
	public String getAreaLevel() {
		return areaLevel;
	}
	public void setAreaLevel(String areaLevel) {
		this.areaLevel = areaLevel;
	}
}
}

+ 1 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/MessageUtil.java

@ -171,6 +171,7 @@ public class MessageUtil {
        }
        }
    }
    }
    @Async
    public String sendTXYSJson(String templateCode,String mobile,String ...params){
    public String sendTXYSJson(String templateCode,String mobile,String ...params){
        JSONObject sendObj = new JSONObject();
        JSONObject sendObj = new JSONObject();
        sendObj.put("templateCode",templateCode);
        sendObj.put("templateCode",templateCode);

+ 2 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/util/MessageUtil.java

@ -15,6 +15,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Component;
/**
/**
@ -126,6 +127,7 @@ public class MessageUtil {
        return wxTemplateConfigDO;
        return wxTemplateConfigDO;
    }
    }
    @Async
    public String sendTXYSJson(String templateCode,String mobile,String ...params)throws Exception{
    public String sendTXYSJson(String templateCode,String mobile,String ...params)throws Exception{
        if (sendTXMessageFlag){
        if (sendTXMessageFlag){
            JSONObject sendObj = new JSONObject();
            JSONObject sendObj = new JSONObject();

+ 39 - 24
svr/svr-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/compute/ComputeHelper.java

@ -39,28 +39,32 @@ public class ComputeHelper {
     * @param endTime
     * @param endTime
     * @return
     * @return
     */
     */
    public List<SaveModel> compute(List<DataModel> dataModels, List<BaseDimensionQuota> dimensionQuotas, String wlyyJobCongId, String endTime, String timeLevel) {
    public List<SaveModel> compute(List<DataModel> dataModels, List<BaseDimensionQuota> dimensionQuotas, String wlyyJobCongId, String endTime, String timeLevel,String areaLevel) {
        try {
        try {
            //得到机构类型
            //得到机构类型
            String orgType = findOrgType(wlyyJobCongId);
            String orgType = findOrgType(wlyyJobCongId);
            if (StringUtils.isBlank(areaLevel)){
                areaLevel="6";
            }
            //计算数据 返回map key 根据团队和维度拼凑在map中的key   1-2-1  如果维度是长度是0返回团队id 1
            //计算数据 返回map key 根据团队和维度拼凑在map中的key   1-2-1  如果维度是长度是0返回团队id 1
            Map<String, List<DataModel>> computeMap = computeDataModel(dimensionQuotas, dataModels,wlyyJobCongId);
            Map<String, List<DataModel>> computeMap = computeDataModel(dimensionQuotas, dataModels,wlyyJobCongId,areaLevel);
            List<SaveModel> savemodels = null;
            List<SaveModel> savemodels = null;
            if ("45".equals(wlyyJobCongId)||"47".equals(wlyyJobCongId)||"50".equals(wlyyJobCongId)){
                savemodels = initAndSetResultCity( dimensionQuotas, computeMap, wlyyJobCongId, endTime, timeLevel);
            }else if("42".equals(wlyyJobCongId)||"41".equals(wlyyJobCongId)||"43".equals(wlyyJobCongId)||"46".equals(wlyyJobCongId)||"48".equals(wlyyJobCongId)
            ||"49".equals(wlyyJobCongId)){
                //新生儿入学只到机构级别
                List<BaseOrgDO> orgDOs = findAllOrg(orgType);
                savemodels = initAndSetResultOrg(orgDOs, dimensionQuotas, computeMap, wlyyJobCongId, endTime, timeLevel);
            }else{
                //得到全部团队
                List<BaseDoctorDO> doctors = findAllDoctor(orgType);
                //初始化map并且设置统计出来的数目
                savemodels = initAndSetResult(doctors, dimensionQuotas, computeMap, wlyyJobCongId, endTime, timeLevel);
            switch (areaLevel){
                case "2":
                    savemodels = initAndSetResultCity( dimensionQuotas, computeMap, wlyyJobCongId, endTime, timeLevel);
                    break;
                case "4":
                    List<BaseOrgDO> orgDOs = findAllOrg(orgType);
                    savemodels = initAndSetResultOrg(orgDOs, dimensionQuotas, computeMap, wlyyJobCongId, endTime, timeLevel);
                    break;
                default:
                    //得到全部团队
                    List<BaseDoctorDO> doctors = findAllDoctor(orgType);
                    //初始化map并且设置统计出来的数目
                    savemodels = initAndSetResult(doctors, dimensionQuotas, computeMap, wlyyJobCongId, endTime, timeLevel);
                    break;
            }
            }
            return savemodels;
            return savemodels;
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
@ -75,19 +79,30 @@ public class ComputeHelper {
     * @param dimensionQuotas 该指标的维度
     * @param dimensionQuotas 该指标的维度
     * @return
     * @return
     */
     */
    private Map<String, List<DataModel>> computeDataModel(List<BaseDimensionQuota> dimensionQuotas, List<DataModel> dataModels,String wlyyJobCongId) {
    private Map<String, List<DataModel>> computeDataModel(List<BaseDimensionQuota> dimensionQuotas, List<DataModel> dataModels,String wlyyJobCongId,String areaLevel) {
        Map<String, List<DataModel>> returnMap = new HashMap<>();
        Map<String, List<DataModel>> returnMap = new HashMap<>();
        dataModels.stream().forEach(one -> {
        dataModels.stream().forEach(one -> {
            String key;
            String key;
            if ("45".equals(wlyyJobCongId)||"47".equals(wlyyJobCongId)||"50".equals(wlyyJobCongId)){
                key = getCityKey(one,dimensionQuotas.size());
            }
            else if("42".equals(wlyyJobCongId)||"41".equals(wlyyJobCongId)||"43".equals(wlyyJobCongId)||"46".equals(wlyyJobCongId)||"48".equals(wlyyJobCongId)
            ||"49".equals(wlyyJobCongId)){
                key = getOrgKey(one, dimensionQuotas.size());
            }else{
                key = getKey(one, dimensionQuotas.size());
            switch (areaLevel){
                case "2":
                    key = getCityKey(one,dimensionQuotas.size());
                    break;
                case "4":
                    key = getOrgKey(one, dimensionQuotas.size());
                    break;
                default:
                    key = getKey(one, dimensionQuotas.size());
                    break;
            }
            }
//            if ("45".equals(wlyyJobCongId)||"47".equals(wlyyJobCongId)||"50".equals(wlyyJobCongId)){
//                key = getCityKey(one,dimensionQuotas.size());
//            }
//            else if("42".equals(wlyyJobCongId)||"41".equals(wlyyJobCongId)||"43".equals(wlyyJobCongId)||"46".equals(wlyyJobCongId)||"48".equals(wlyyJobCongId)
//            ||"49".equals(wlyyJobCongId)){
//                key = getOrgKey(one, dimensionQuotas.size());
//            }else{
//                key = getKey(one, dimensionQuotas.size());
//            }
            List<DataModel> sms = new ArrayList<DataModel>();
            List<DataModel> sms = new ArrayList<DataModel>();
            if (returnMap.containsKey(key)) {
            if (returnMap.containsKey(key)) {
                sms = returnMap.get(key);
                sms = returnMap.get(key);

+ 1 - 1
svr/svr-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentMysqlToEsQuotaJob.java

@ -347,7 +347,7 @@ public class CurrentMysqlToEsQuotaJob implements Job {
     */
     */
    private List<SaveModel> compute(List<DataModel> dataModels, List<BaseDimensionQuota> dimensionQuotas, String timeLevel, QuartzJobConfig quartzJobConfig) {
    private List<SaveModel> compute(List<DataModel> dataModels, List<BaseDimensionQuota> dimensionQuotas, String timeLevel, QuartzJobConfig quartzJobConfig) {
        try {
        try {
            return SpringUtil.getBean(ComputeHelper.class).compute(dataModels, dimensionQuotas, quartzJobConfig.getId(), endTime, timeLevel);
            return SpringUtil.getBean(ComputeHelper.class).compute(dataModels, dimensionQuotas, quartzJobConfig.getId(), endTime, timeLevel, quartzJobConfig.getAreaLevel());
        } catch (Exception e) {
        } catch (Exception e) {
            logger.error("compute error:" + e.getMessage());
            logger.error("compute error:" + e.getMessage());
        }
        }

+ 1 - 1
svr/svr-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/EsToEsQuotaJob.java

@ -242,7 +242,7 @@ public class EsToEsQuotaJob implements Job {
     */
     */
    private List<SaveModel> compute(List<DataModel> dataModels, List<BaseDimensionQuota> dimensionQuotas, String timeLevel) {
    private List<SaveModel> compute(List<DataModel> dataModels, List<BaseDimensionQuota> dimensionQuotas, String timeLevel) {
        try {
        try {
            return SpringUtil.getBean(ComputeHelper.class).compute(dataModels, dimensionQuotas, wlyyJobCongId, endTime, timeLevel);
            return SpringUtil.getBean(ComputeHelper.class).compute(dataModels, dimensionQuotas, wlyyJobCongId, endTime, timeLevel,quartzJobConfig.getAreaLevel());
        } catch (Exception e) {
        } catch (Exception e) {
            logger.error("compute error:" + e.getMessage());
            logger.error("compute error:" + e.getMessage());
        }
        }

+ 2 - 1
svr/svr-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/MysqlToEsQuotaJob.java

@ -60,6 +60,7 @@ public class MysqlToEsQuotaJob implements Job {
    private Date quotaDate;//统计的时间
    private Date quotaDate;//统计的时间
    private String timeLevel;//1 日 2年
    private String timeLevel;//1 日 2年
    private String incrementInterval;//增量的时间间隔(天)
    private String incrementInterval;//增量的时间间隔(天)
    private String areaLevel;//1省2市3区县4机构5团队6医生
    @Autowired
    @Autowired
    private QuartzJobLogDao quartzJobLogDao;//执行日志Dao
    private QuartzJobLogDao quartzJobLogDao;//执行日志Dao
@ -258,7 +259,7 @@ public class MysqlToEsQuotaJob implements Job {
     */
     */
    private List<SaveModel> compute(List<DataModel> dataModels, List<BaseDimensionQuota> dimensionQuotas, String timeLevel) {
    private List<SaveModel> compute(List<DataModel> dataModels, List<BaseDimensionQuota> dimensionQuotas, String timeLevel) {
        try {
        try {
            return SpringUtil.getBean(ComputeHelper.class).compute(dataModels, dimensionQuotas, wlyyJobCongId, endTime, timeLevel);
            return SpringUtil.getBean(ComputeHelper.class).compute(dataModels, dimensionQuotas, wlyyJobCongId, endTime, timeLevel,quartzJobConfig.getAreaLevel());
        } catch (Exception e) {
        } catch (Exception e) {
            logger.error("compute error:" + e.getMessage());
            logger.error("compute error:" + e.getMessage());
        }
        }