df73d916942800dc7c91e7eaaf9ac56f1f961987.svn-base 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. package cn.com.goldenwater.dcproj.controller.zhejiang;
  2. import cn.com.goldenwater.dcproj.constValue.PlanEnum;
  3. import cn.com.goldenwater.dcproj.constValue.SendState;
  4. import cn.com.goldenwater.dcproj.model.BisInspAllRlationPers;
  5. import cn.com.goldenwater.dcproj.model.BisZhejiangCheckPlan;
  6. import cn.com.goldenwater.dcproj.model.BisZhejiangCheckProcess;
  7. import cn.com.goldenwater.dcproj.param.BisZhejiangCheckProcessParam;
  8. import cn.com.goldenwater.dcproj.service.BisInspAllRlationPersService;
  9. import cn.com.goldenwater.dcproj.service.BisZhejiangCheckPlanService;
  10. import cn.com.goldenwater.dcproj.service.BisZhejiangCheckProcessService;
  11. import cn.com.goldenwater.core.web.BaseController;
  12. import cn.com.goldenwater.core.web.BaseResponse;
  13. import cn.com.goldenwater.id.util.UuidUtil;
  14. import io.swagger.annotations.Api;
  15. import io.swagger.annotations.ApiOperation;
  16. import io.swagger.annotations.ApiParam;
  17. import org.apache.commons.lang3.StringUtils;
  18. import com.github.pagehelper.PageInfo;
  19. import org.slf4j.Logger;
  20. import org.slf4j.LoggerFactory;
  21. import org.springframework.beans.factory.annotation.Autowired;
  22. import org.springframework.web.bind.annotation.PathVariable;
  23. import org.springframework.web.bind.annotation.RequestBody;
  24. import org.springframework.web.bind.annotation.RequestMapping;
  25. import org.springframework.web.bind.annotation.RequestMethod;
  26. import org.springframework.web.bind.annotation.RestController;
  27. import java.util.Date;
  28. import java.util.List;
  29. /**
  30. * @author lune
  31. * @date 2020-5-12
  32. */
  33. @Api(value = "BIS 浙江监督检查工作审核表管理",tags="BIS 浙江监督检查工作审核表管理")
  34. @RestController
  35. @RequestMapping("/bis/zhejiang/check/process")
  36. public class BisZhejiangCheckProcessController extends BaseController {
  37. private Logger logger = LoggerFactory.getLogger(getClass());
  38. @Autowired
  39. private BisZhejiangCheckProcessService bisZhejiangCheckProcessService;
  40. @Autowired
  41. private BisZhejiangCheckPlanService bisZhejiangCheckPlanService;
  42. @Autowired
  43. private BisInspAllRlationPersService bisInspAllRlationPersService;
  44. @ApiOperation(value = "添加/修改浙江监督检查工作审核表")
  45. @RequestMapping(value = "", method = RequestMethod.POST)
  46. public BaseResponse<BisZhejiangCheckProcess> insert(@ApiParam(name = "bisZhejiangCheckProcess", value = "BisZhejiangCheckProcess", required = true) @RequestBody BisZhejiangCheckProcess bisZhejiangCheckProcess) {
  47. BisInspAllRlationPers bisInspAllRlationPers=bisInspAllRlationPersService.get(getCurrentPersId());
  48. bisZhejiangCheckProcess.setPersName(bisInspAllRlationPers.getPersName());
  49. bisZhejiangCheckProcess.setPersId(getCurrentPersId());
  50. bisZhejiangCheckProcess.setUptm(new Date());
  51. if(PlanEnum.PLAN_SEND.getKey().equals(bisZhejiangCheckProcess.getIsSend())){
  52. BisZhejiangCheckPlan bisZhejiangCheckPlan=new BisZhejiangCheckPlan();
  53. bisZhejiangCheckPlan.setId(bisZhejiangCheckProcess.getPlanId());
  54. bisZhejiangCheckPlan.setIsSend(bisZhejiangCheckProcess.getIsSend());
  55. bisZhejiangCheckPlan.setState(bisZhejiangCheckProcess.getIsSend());
  56. bisZhejiangCheckPlanService.update(bisZhejiangCheckPlan);
  57. return buildSuccessResponse(bisZhejiangCheckProcess);
  58. }else{
  59. BisZhejiangCheckPlan bisZhejiangCheckPlan=new BisZhejiangCheckPlan();
  60. bisZhejiangCheckPlan.setId(bisZhejiangCheckProcess.getPlanId());
  61. bisZhejiangCheckPlan.setState(bisZhejiangCheckProcess.getWorkStep());
  62. bisZhejiangCheckPlan.setIsSend(SendState.SEND_NO.getKey());
  63. bisZhejiangCheckPlanService.update(bisZhejiangCheckPlan);
  64. }
  65. if(StringUtils.isBlank(bisZhejiangCheckProcess.getId())) {
  66. String uuid = UuidUtil.uuid(); // 生成uuid
  67. bisZhejiangCheckProcess.setId(uuid);
  68. bisZhejiangCheckProcess.setIntm(new Date());
  69. bisZhejiangCheckProcessService.insert(bisZhejiangCheckProcess);
  70. }else{
  71. bisZhejiangCheckProcess.setUptm(new Date());
  72. bisZhejiangCheckProcessService.update(bisZhejiangCheckProcess);
  73. }
  74. return buildSuccessResponse(bisZhejiangCheckProcess);
  75. }
  76. @ApiOperation(value = "根据ID删除浙江监督检查工作审核表")
  77. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  78. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  79. int ret = bisZhejiangCheckProcessService.delete(id);
  80. return buildSuccessResponse();
  81. }
  82. @ApiOperation(value = "根据ID获取浙江监督检查工作审核表(单表)")
  83. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  84. public BaseResponse<BisZhejiangCheckProcess> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  85. BisZhejiangCheckProcess bisZhejiangCheckProcess = bisZhejiangCheckProcessService.get(id);
  86. return buildSuccessResponse(bisZhejiangCheckProcess);
  87. }
  88. @ApiOperation(value = "获取浙江监督检查工作审核表(列表所有)")
  89. @RequestMapping(value = "/list", method = RequestMethod.POST)
  90. public BaseResponse<List<BisZhejiangCheckProcess>> list(@ApiParam(name = "bisZhejiangCheckProcessParam", value = "bisZhejiangCheckProcessParam", required = true) @RequestBody BisZhejiangCheckProcessParam bisZhejiangCheckProcessParam) {
  91. List<BisZhejiangCheckProcess> bisZhejiangCheckProcessList = bisZhejiangCheckProcessService.findList(bisZhejiangCheckProcessParam);
  92. return buildSuccessResponse(bisZhejiangCheckProcessList);
  93. }
  94. @ApiOperation(value = "获取浙江监督检查工作审核表(列表--分页)")
  95. @RequestMapping(value = "/page", method = RequestMethod.POST)
  96. public BaseResponse<PageInfo<BisZhejiangCheckProcess>> page(@ApiParam(name = "bisZhejiangCheckProcessParam", value = "bisZhejiangCheckProcessParam", required = true) @RequestBody BisZhejiangCheckProcessParam bisZhejiangCheckProcessParam) {
  97. PageInfo<BisZhejiangCheckProcess> bisZhejiangCheckProcessList = bisZhejiangCheckProcessService.findPageInfo(bisZhejiangCheckProcessParam);
  98. return buildSuccessResponse(bisZhejiangCheckProcessList);
  99. }
  100. }