|
@ -0,0 +1,141 @@
|
|
|
package com.yihu.wlyy.web.third.health.bank.controller;/**
|
|
|
* Created by nature of king on 2018/5/7.
|
|
|
*/
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.wlyy.service.third.health.bank.CreditLogService;
|
|
|
import com.yihu.wlyy.web.BaseController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
/**
|
|
|
* @author wangzhinan
|
|
|
* @create 2018-05-07 8:50
|
|
|
* @desc credit log controller
|
|
|
**/
|
|
|
@RestController
|
|
|
@RequestMapping(value = "/healthBank",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
@Api(description = "积分处理机制")
|
|
|
public class CreditsLogController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private CreditLogService service;
|
|
|
|
|
|
/**
|
|
|
* 查询积分排名
|
|
|
*
|
|
|
* @param doctorId
|
|
|
* @param page
|
|
|
* @param size
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/findCreditRanking",method = RequestMethod.POST)
|
|
|
@ApiOperation("查询积分排名")
|
|
|
public String getById(@ApiParam(name = "doctorId",value = "医生Id")
|
|
|
@RequestParam(name = "doctorId")String doctorId,
|
|
|
@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 {
|
|
|
return write(200,"查询成功","data",service.selectByRanking(doctorId,page,size));
|
|
|
}catch (Exception e){
|
|
|
error(e);
|
|
|
return error(-1,e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 添加积分
|
|
|
*
|
|
|
* @param creditsDetail
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/insertCredits",method = RequestMethod.POST)
|
|
|
@ApiOperation("添加积分")
|
|
|
public String insert(@ApiParam(name = "creditsDetail",value = "居民id集合")
|
|
|
@RequestParam(name = "creditsDetail") String creditsDetail){
|
|
|
try {
|
|
|
JSONObject object = JSONObject.parseObject(creditsDetail);
|
|
|
return write(200,"添加成功","data",service.insert(object));
|
|
|
}catch (Exception e){
|
|
|
error(e);
|
|
|
return error(-1,e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* find credits log details
|
|
|
*
|
|
|
* @param creditsLogDo
|
|
|
* @param page
|
|
|
* @param size
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/selectDetails",method = RequestMethod.POST)
|
|
|
@ApiOperation("积分详情")
|
|
|
public String selectByCondition(@ApiParam(name = "creditsLogDo",value = "积分JSON")
|
|
|
@RequestParam(name = "creditsLogDo") String creditsLogDo,
|
|
|
@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(creditsLogDo);
|
|
|
return write(200,"查询成功","data",service.selectByCondition(object,page,size));
|
|
|
}catch (Exception e){
|
|
|
error(e);
|
|
|
return error(-1,e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 账户积分详情
|
|
|
*
|
|
|
* @param creditsDetail
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/selectAccount",method = RequestMethod.POST)
|
|
|
@ApiOperation("账户积分情况")
|
|
|
public String selectAccount(@ApiParam(name = "creditsDetail",value = "积分JSON")
|
|
|
@RequestParam(name = "creditsDetail") String creditsDetail){
|
|
|
try {
|
|
|
JSONObject object = JSONObject.parseObject(creditsDetail);
|
|
|
return write(200,"查询成功","data",service.selectAccount(object));
|
|
|
}catch (Exception e){
|
|
|
error(e);
|
|
|
return error(-1,e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询任务完成情况
|
|
|
*
|
|
|
* @param task
|
|
|
* @param page
|
|
|
* @param size
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/selectTasks",method = RequestMethod.POST)
|
|
|
@ApiOperation("任务完成情况")
|
|
|
public String selectByTask(@ApiParam(name = "task",value = "任务JSON")
|
|
|
@RequestParam(name = "task") String task,
|
|
|
@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(task);
|
|
|
return write(200,"查询成功","data",service.selectByTask(object,page,size));
|
|
|
}catch (Exception e){
|
|
|
error(e);
|
|
|
return error(-1,e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
}
|