| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- package cn.com.goldenwater.dcproj.controller.rsvr;
- import cn.com.goldenwater.dcproj.model.BisInspBaseView;
- import cn.com.goldenwater.dcproj.model.BisInspPreList;
- import cn.com.goldenwater.dcproj.param.BisInspPreListParam;
- import cn.com.goldenwater.dcproj.service.BisInspBaseViewService;
- import cn.com.goldenwater.dcproj.service.BisInspPreListService;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.service.BisInspRsvrRgstrService;
- import cn.com.goldenwater.id.util.UuidUtil;
- import com.github.pagehelper.PageInfo;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- /**
- * @author lune
- * @date 2019-2-18
- */
- @Api(value = "APP 走访人员情况管理", tags = "APP 走访人员情况管理")
- @RestController
- @RequestMapping("/dc/insp/preList")
- public class BisInspPreListController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspPreListService bisInspPreListService;
- @Autowired
- private BisInspRsvrRgstrService bisInspRsvrRgstrService;
- @Autowired
- private BisInspBaseViewService bisInspBaseViewService;
- @ApiOperation(value = "添加走访人信息")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<String> insert(@ApiParam(name = "bisInspPreList", value = "BisInspPreList", required = true) @RequestBody BisInspPreList bisInspPreList) {
- BisInspPreListParam bisInspPreListParam = new BisInspPreListParam();
- bisInspPreListParam.setViewId(bisInspPreList.getViewId());
- bisInspPreListParam.setViewPreName(bisInspPreList.getViewPreName());
- BisInspPreList bisInspPre = bisInspPreListService.getBy(bisInspPreListParam);
- if (bisInspPre != null) {
- return buildFailResponse(1003, "走访人员姓名不能重复添加");
- }
- String uuid = UuidUtil.uuid();
- bisInspPreList.setViewPreId(uuid);
- int ret = bisInspPreListService.insert(bisInspPreList);
- BisInspBaseView inspBaseView = bisInspBaseViewService.get(bisInspPreList.getViewId());
- if (inspBaseView != null) {
- bisInspRsvrRgstrService.updateRsvr(inspBaseView.getRgstrId(), inspBaseView.getStatus(), "view");
- }
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID删除走访人员信息")
- @RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
- public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- int ret = bisInspPreListService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "更新走访人员信息")
- @RequestMapping(value = "/update", method = RequestMethod.POST)
- public BaseResponse update(@ApiParam(name = "bisInspPreList", value = "BisInspPreList", required = true) @RequestBody BisInspPreList bisInspPreList) {
- int ret = bisInspPreListService.update(bisInspPreList);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取走访人员信息(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspPreList> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspPreList bisInspPreList = bisInspPreListService.get(id);
- return buildSuccessResponse(bisInspPreList);
- }
- @ApiOperation(value = "根据访问Id获取走访人员列表")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspPreList>> list(@ApiParam(name = "inspPreListParam", value = "inspPreListParam", required = true) @RequestBody BisInspPreListParam inspPreListParam) {
- PageInfo<BisInspPreList> bisInspPreList = bisInspPreListService.findPageInfo(inspPreListParam);
- return buildSuccessResponse(bisInspPreList);
- }
- @ApiOperation(value = "根据访问Id获取走访人员列表")
- @RequestMapping(value = "/list/{viewId}", method = RequestMethod.GET)
- public BaseResponse<PageInfo<BisInspPreList>> list(@ApiParam(name = "viewId", value = "viewId", required = true) @PathVariable String viewId) {
- BisInspPreListParam inspPreListParam = new BisInspPreListParam();
- inspPreListParam.setViewId(viewId);
- PageInfo<BisInspPreList> bisInspPreList = bisInspPreListService.findPageInfo(inspPreListParam);
- return buildSuccessResponse(bisInspPreList);
- }
- }
|