Explorar el Código

[cmd]积分处理接口代码

wangzhinan hace 7 años
padre
commit
7b8e7ccb13

+ 42 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/health/bank/CreditLogService.java

@ -10,6 +10,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -38,6 +39,8 @@ public class CreditLogService {
    private HttpClientUtil httpClientUtil;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private StringRedisTemplate redisTemplate;
    /**
     * 调用第三方积分排名接口
@ -80,8 +83,11 @@ public class CreditLogService {
     * @param object
     * @return
     */
    public String insert(JSONObject object){
    public JSONObject insert(JSONObject object){
        init();
        String response = null;
        String integrate = getIntegrate("health:blank:integrate:"+object.getString("flag"));
        object.put("integrate",integrate);
        String url =baseUrl + "createCreditsDetail";
        Map<String,String> params = new HashMap<>();
        params.put("creditsDetail",object.toJSONString());
@ -91,7 +97,7 @@ public class CreditLogService {
            e.printStackTrace();
            logger.error(e.getMessage());
        }
        return response;
        return JSONObject.parseObject(response);
    }
@ -167,4 +173,38 @@ public class CreditLogService {
        }
        return JSONObject.parseObject(response);
    }
    /**
     * 查询银行账户信息
     *
     * @param object 账户对象
     * @param page 页码
     * @param size 每页大小
     * @return
     */
    public JSONObject selectByAccount(JSONObject object,Integer page,Integer size){
        String response = null;
        String url =baseUrl + "findAccount";
        Map<String,String> params = new HashMap<>();
        params.put("account",object.toJSONString());
        params.put("page",page.toString());
        params.put("size",size.toString());
        try {
            response = httpClientUtil.httpPost(url,params);
        }catch (Exception e){
            e.printStackTrace();
            logger.error(e.getMessage());
        }
        return JSONObject.parseObject(response);
    }
    public void init(){
        redisTemplate.opsForValue().set("health:blank:integrate:BIND","20");
        redisTemplate.opsForValue().set("health:blank:integrate:MEASURE","20");
    }
    public String getIntegrate(String key){
        return redisTemplate.opsForValue().get(key);
    }
}

+ 29 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/health/bank/CreditsLogController.java

@ -1,7 +1,7 @@
package com.yihu.wlyy.web.third.health.bank.controller;/**
/**
 * Created by nature of king on 2018/5/7.
 */
package com.yihu.wlyy.web.third.health.bank;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.third.health.bank.CreditLogService;
@ -138,4 +138,31 @@ public class CreditsLogController extends BaseController {
            return error(-1,e.getMessage());
        }
    }
    /**
     *  根据条件查看银行账户信息
     *
     * @param account 银行账户
     * @param page 页码
     * @param size 每页大小
     * @return
     */
    @RequestMapping(value = "/findAccount",method = RequestMethod.POST)
    @ApiOperation("银行账户信息")
    public String selectByAccount(@ApiParam(name = "account",value = "任务JSON")
                               @RequestParam(name = "account") String account,
                               @ApiParam(name = "page", value = "第几页,从1开始")
                               @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                               @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                               @RequestParam(value = "size", required = false)Integer size){
        try {
            JSONObject object = JSONObject.parseObject(account);
            return write(200,"查询成功","data",service.selectByAccount(object,page,size));
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
}

+ 0 - 3
patient-co/patient-co-wlyy/src/main/resources/application-dev.yml

@ -39,9 +39,6 @@ iot:
#健康银行配置
healthBank:
  url: http://localhost:10051/svr-health-bank/
#康复计划配置
rehabilitation:
  url: http://localhost:10055/svr-rehabilitation/
#康复计划配置
rehabilitation: