|
@ -0,0 +1,94 @@
|
|
|
package com.yihu.jw.base.endpoint.followup;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.yihu.jw.base.service.followup.FollowupTemplateService;
|
|
|
import com.yihu.jw.entity.followup.FollowupTemplate;
|
|
|
import com.yihu.jw.restmodel.qvo.ParamQvo;
|
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
|
import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
import com.yihu.jw.rm.base.BaseRequestMapping;
|
|
|
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.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping(value = BaseRequestMapping.Follow.PREFIX_TEMPLATE)
|
|
|
@Api(value = "随访模板", description = "随访模板", tags = {"随访模板"})
|
|
|
public class FollowupTemplatePoint extends EnvelopRestEndpoint {
|
|
|
@Autowired
|
|
|
private FollowupTemplateService followupTemplateService;
|
|
|
|
|
|
@GetMapping(value = "findList")
|
|
|
@ApiOperation(value = "获取模板列表")
|
|
|
public PageEnvelop<Map<String, Object>> findList(
|
|
|
@ApiParam(name = "jsonStr", value = "jsonStr") @RequestParam(value = "jsonStr", required = false) String jsonStr
|
|
|
) throws Exception {
|
|
|
ParamQvo qvo = JSON.parseObject(jsonStr, ParamQvo.class);
|
|
|
HashMap<String, Object> map = followupTemplateService.findList(qvo);
|
|
|
List<Map<String, Object>> list = (List<Map<String, Object>>) map.get("list");
|
|
|
Integer count = (Integer) map.get("count");
|
|
|
|
|
|
return success(list, count, qvo.getPage(), qvo.getPageSize());
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 创建模板和更新模板
|
|
|
*/
|
|
|
@PostMapping(value = "createTemplate")
|
|
|
@ApiOperation(value = "创建模板")
|
|
|
public ObjEnvelop createTemplate(
|
|
|
@ApiParam(name = "jsonStr", value = "jsonStr") @RequestParam(value = "jsonStr", required = false) String jsonStr
|
|
|
) throws Exception {
|
|
|
FollowupTemplate vo = JSON.parseObject(jsonStr, FollowupTemplate.class);
|
|
|
FollowupTemplate entity = followupTemplateService.createTemplate(vo);
|
|
|
return success("创建成功", entity);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 改变模板状态
|
|
|
*/
|
|
|
@PostMapping(value = "changeTemplateStatus")
|
|
|
@ApiOperation(value = "改变模板状态")
|
|
|
public ObjEnvelop changeTemplateStatus(
|
|
|
@ApiParam(name = "jsonStr", value = "jsonStr") @RequestParam(value = "jsonStr", required = false) String jsonStr
|
|
|
) throws Exception {
|
|
|
ParamQvo qvo = JSON.parseObject(jsonStr, ParamQvo.class);
|
|
|
|
|
|
try {
|
|
|
FollowupTemplate entity = followupTemplateService.changeTemplateStatus(qvo);
|
|
|
return success("改变模板状态成功", entity);
|
|
|
} catch (Exception e) {
|
|
|
return failedObjEnvelopException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 删除模板
|
|
|
*/
|
|
|
@PostMapping(value = "deleteTemplate")
|
|
|
@ApiOperation(value = "删除模板")
|
|
|
public Envelop deleteTemplate(
|
|
|
@ApiParam(name = "jsonStr", value = "jsonStr") @RequestParam(value = "jsonStr", required = false) String jsonStr
|
|
|
) throws Exception {
|
|
|
ParamQvo qvo = JSON.parseObject(jsonStr, ParamQvo.class);
|
|
|
try {
|
|
|
followupTemplateService.deleteTemplate(qvo);
|
|
|
return success("删除成功");
|
|
|
} catch (Exception e) {
|
|
|
return failedObjEnvelopException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|