Browse Source

[CMT]修改小程序

wangzhinan 7 years ago
parent
commit
d5cee26a29

+ 18 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/bank/CreditLogService.java

@ -19,6 +19,7 @@ import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -43,6 +44,7 @@ public class CreditLogService {
    private Logger logger = LoggerFactory.getLogger(CreditLogService.class);
    private Logger logger = LoggerFactory.getLogger(CreditLogService.class);
    private static String URL = "health:blank:url";
    private static String URL = "health:blank:url";
    private static String STEP = "health:blank:step";
    //    private String baseUrl = "http://192.168.131.24:8088/svr-iot/";
    //    private String baseUrl = "http://192.168.131.24:8088/svr-iot/";
    @Autowired
    @Autowired
@ -360,7 +362,7 @@ public class CreditLogService {
            }
            }
        }
        }
        String response = null;
        String response = null;
        String url =getBaseUrl() + "findAccount";
        String url =/*getBaseUrl()*/"http://localhost:10051/svr-health-bank/" + "findAccount";
        object.put("patientIds",patientIds.toArray());
        object.put("patientIds",patientIds.toArray());
        Map<String,String> params = new HashMap<>();
        Map<String,String> params = new HashMap<>();
        params.put("account",object.toJSONString());
        params.put("account",object.toJSONString());
@ -666,7 +668,7 @@ public class CreditLogService {
        object.put("idCard",patient.getIdcard());
        object.put("idCard",patient.getIdcard());
        object.put("openId",patient.getOpenid());
        object.put("openId",patient.getOpenid());
        object.put("unionId",patient.getUnionid());
        object.put("unionId",patient.getUnionid());
        String url =getBaseUrl()+ "addStepIntegrate";
        String url ="http://localhost:10051/svr-health-bank/"+ "addStepIntegrate";
        Map<String,String> params = new HashMap<>();
        Map<String,String> params = new HashMap<>();
        params.put("creditsDetail",object.toJSONString());
        params.put("creditsDetail",object.toJSONString());
        try {
        try {
@ -715,10 +717,14 @@ public class CreditLogService {
        SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
        String imptimeBegin = sdf.format(cal.getTime());
        String imptimeBegin = sdf.format(cal.getTime());
        List<String> timeList = new ArrayList<>();
        List<String> timeList = new ArrayList<>();
        timeList.add(imptimeBegin);
        if (sdf.format(cal.getTime()).compareTo(sdf.format(sdf.parse("2018-08-01")))>=0){
            timeList.add(imptimeBegin);
        }
        for (int i =0;i<6;i++){
        for (int i =0;i<6;i++){
            cal.add(Calendar.DATE,1);
            cal.add(Calendar.DATE,1);
            timeList.add(sdf.format(cal.getTime()));
            if(sdf.format(cal.getTime()).compareTo(sdf.format(sdf.parse("2018-08-01")))>=0){
                timeList.add(sdf.format(cal.getTime()));
            }
        }
        }
        logger.info("一周的日期:"+timeList.toString());
        logger.info("一周的日期:"+timeList.toString());
        StringBuffer buffer = new StringBuffer();
        StringBuffer buffer = new StringBuffer();
@ -729,8 +735,14 @@ public class CreditLogService {
        buffer.deleteCharAt(buffer.length()-1);
        buffer.deleteCharAt(buffer.length()-1);
        buffer.append(")");
        buffer.append(")");
        logger.info("组装的sql"+buffer);
        logger.info("组装的sql"+buffer);
        String step = redisTemplate.opsForValue().get(STEP);
        if (StringUtils.isEmpty(step)){
            throw new Exception("获取步数失败!");
        }
        JSONObject object1 = JSONObject.parseObject(step);
        int step1 = object1.getInteger("step1");
        String sql = "select count(1) as total from (select * FROM wlyy_patient_aim_sports where DATE_FORMAT(create_time,'%Y-%m-%d') IN "+buffer +" and patientcode = '"+patientId+"'"+
        String sql = "select count(1) as total from (select * FROM wlyy_patient_aim_sports where DATE_FORMAT(create_time,'%Y-%m-%d') IN "+buffer +" and patientcode = '"+patientId+"'"+
                ") pas where pas.daily_step_count > 600";
                ") pas where pas.daily_step_count > "+step1;
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        Long count = 0L;
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
        if(rstotal!=null&&rstotal.size()>0){
@ -740,7 +752,7 @@ public class CreditLogService {
            object.put("weekTimes",buffer);
            object.put("weekTimes",buffer);
            object.put("integrate",3);
            object.put("integrate",3);
            object.put("description","周奖励");
            object.put("description","周奖励");
            String url =getBaseUrl()+ "weekReward";
            String url ="http://localhost:10051/svr-health-bank/"+ "weekReward";
            Map<String,String> params = new HashMap<>();
            Map<String,String> params = new HashMap<>();
            params.put("creditsDetail",object.toJSONString());
            params.put("creditsDetail",object.toJSONString());
            try {
            try {