d9abcdcdfa64eb7b0125a3207a8e59f3be0dc179.svn-base 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package cn.com.goldenwater.dcproj.controller.rsml;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.BisInspRsmlRgstrSafe;
  5. import cn.com.goldenwater.dcproj.param.BisInspRsmlRgstrSafeParam;
  6. import cn.com.goldenwater.dcproj.service.BisInspRsmlRgstrSafeService;
  7. import cn.com.goldenwater.dcproj.service.BisInspRsmlRgstrService;
  8. import cn.com.goldenwater.id.util.UuidUtil;
  9. import cn.com.goldenwater.target.CheckException;
  10. import io.swagger.annotations.Api;
  11. import io.swagger.annotations.ApiOperation;
  12. import io.swagger.annotations.ApiParam;
  13. import org.apache.commons.lang3.StringUtils;
  14. import org.slf4j.Logger;
  15. import org.slf4j.LoggerFactory;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.web.bind.annotation.*;
  18. import java.util.Date;
  19. import java.util.List;
  20. /**
  21. * @author lhc
  22. * @date 2021-3-15
  23. */
  24. @Api(value = "xxx管理", tags = "xxx管理")
  25. @RestController
  26. @RequestMapping("/bis/insp/rsml/rgstr/safe")
  27. public class BisInspRsmlRgstrSafeController extends BaseController {
  28. private Logger logger = LoggerFactory.getLogger(getClass());
  29. @Autowired
  30. private BisInspRsmlRgstrSafeService bisInspRsmlRgstrSafeService;
  31. @Autowired
  32. private BisInspRsmlRgstrService bisInspRsmlRgstrService;
  33. @ApiOperation(value = "修改xxx")
  34. @RequestMapping(value = "", method = RequestMethod.POST)
  35. public BaseResponse<BisInspRsmlRgstrSafe> insert(@ApiParam(name = "bisInspRsmlRgstrSafe", value = "BisInspRsmlRgstrSafe", required = true) @RequestBody BisInspRsmlRgstrSafe bisInspRsmlRgstrSafe) {
  36. if (StringUtils.isBlank(bisInspRsmlRgstrSafe.getRgstrId())) {
  37. throw new CheckException("缺少登记表编码!");
  38. }
  39. BisInspRsmlRgstrSafeParam benefitsParam = new BisInspRsmlRgstrSafeParam();
  40. benefitsParam.setRgstrId(bisInspRsmlRgstrSafe.getRgstrId());
  41. List<BisInspRsmlRgstrSafe> list = bisInspRsmlRgstrSafeService.findList(benefitsParam);
  42. bisInspRsmlRgstrSafe.setUpTm(new Date());
  43. if (list != null && list.size() > 0) {
  44. bisInspRsmlRgstrSafe.setId(list.get(0).getId());
  45. bisInspRsmlRgstrSafeService.update(bisInspRsmlRgstrSafe);
  46. } else {
  47. bisInspRsmlRgstrSafe.setId(UuidUtil.uuid());
  48. bisInspRsmlRgstrSafe.setInTm(new Date());
  49. bisInspRsmlRgstrSafeService.insert(bisInspRsmlRgstrSafe);
  50. }
  51. bisInspRsmlRgstrService.updateRsvr(bisInspRsmlRgstrSafe.getRgstrId(), bisInspRsmlRgstrSafe.getStatus(), "persSafe");
  52. return buildSuccessResponse(bisInspRsmlRgstrSafe);
  53. }
  54. @ApiOperation(value = "根据ID删除xxx")
  55. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  56. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  57. int ret = bisInspRsmlRgstrSafeService.delete(id);
  58. return buildSuccessResponse();
  59. }
  60. @ApiOperation(value = "根据ID获取xxx(单表)")
  61. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  62. public BaseResponse<BisInspRsmlRgstrSafe> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  63. BisInspRsmlRgstrSafe bisInspRsmlRgstrSafe = bisInspRsmlRgstrSafeService.get(id);
  64. return buildSuccessResponse(bisInspRsmlRgstrSafe);
  65. }
  66. }