de289e5f8eda9976bd4b94cfaf858bdc47432b89.svn-base 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. package cn.com.goldenwater.dcproj.controller.tacplan;
  2. import cn.com.goldenwater.dcproj.dao.BisInspAllRlationPersDao;
  3. import cn.com.goldenwater.dcproj.model.TacProvincePlanExamRecord;
  4. import cn.com.goldenwater.dcproj.model.TacProvincePlanExamine;
  5. import cn.com.goldenwater.dcproj.param.TacProvincePlanExamRecordParam;
  6. import cn.com.goldenwater.dcproj.param.TacProvincePlanExamineParam;
  7. import cn.com.goldenwater.dcproj.service.TacProvincePlanExamRecordService;
  8. import cn.com.goldenwater.core.web.BaseController;
  9. import cn.com.goldenwater.core.web.BaseResponse;
  10. import cn.com.goldenwater.dcproj.service.TacProvincePlanExamineService;
  11. import cn.com.goldenwater.id.util.UuidUtil;
  12. import io.swagger.annotations.Api;
  13. import io.swagger.annotations.ApiOperation;
  14. import io.swagger.annotations.ApiParam;
  15. import org.apache.commons.lang3.StringUtils;
  16. import org.slf4j.Logger;
  17. import org.slf4j.LoggerFactory;
  18. import org.springframework.beans.factory.annotation.Autowired;
  19. import org.springframework.web.bind.annotation.RequestBody;
  20. import org.springframework.web.bind.annotation.RequestMapping;
  21. import org.springframework.web.bind.annotation.RequestMethod;
  22. import org.springframework.web.bind.annotation.RestController;
  23. import java.util.Date;
  24. import java.util.List;
  25. /**
  26. * @author
  27. * @date 2021-1-28
  28. */
  29. @Api(value = "工程阶段审定记录管理",tags="工程阶段审定记录管理")
  30. @RestController
  31. @RequestMapping("/tac/province/examRecord")
  32. public class TacProvincePlanExamRecordController extends BaseController {
  33. private Logger logger = LoggerFactory.getLogger(getClass());
  34. @Autowired
  35. private TacProvincePlanExamRecordService tacProvincePlanExamRecordService;
  36. @Autowired
  37. private TacProvincePlanExamineService tacProvincePlanExamineService;
  38. @Autowired
  39. private BisInspAllRlationPersDao bisInspAllRlationPersDao;
  40. @ApiOperation(value = "添加工程阶段审定记录/修改工程阶段审定")
  41. @RequestMapping(value = "/insertExamine", method = RequestMethod.POST)
  42. public BaseResponse<TacProvincePlanExamRecord> insert(@ApiParam(name = "tacProvincePlanExamRecord", value = "TacProvincePlanExamRecord", required = true) @RequestBody TacProvincePlanExamRecord tacProvincePlanExamRecord) {
  43. if(StringUtils.isBlank(tacProvincePlanExamRecord.getRgstrId())){
  44. return buildFailResponse("工程参数不能为空");
  45. }
  46. if(StringUtils.isBlank(tacProvincePlanExamRecord.getPlanProcessId())){
  47. return buildFailResponse("阶段参数不能为空");
  48. }
  49. TacProvincePlanExamineParam tacProvincePlanExamineParam = new TacProvincePlanExamineParam();
  50. tacProvincePlanExamineParam.setRgstrId(tacProvincePlanExamRecord.getRgstrId());
  51. tacProvincePlanExamineParam.setPlanProcessId(tacProvincePlanExamRecord.getPlanProcessId());
  52. TacProvincePlanExamine by = tacProvincePlanExamineService.getBy(tacProvincePlanExamineParam);
  53. if(by==null){
  54. return buildFailResponse("无工程阶段审定初始状态");
  55. }else{
  56. //修改工程阶段状态值
  57. by.setStageStatus(tacProvincePlanExamRecord.getStageStatus());
  58. by.setUptm(new Date());
  59. tacProvincePlanExamineService.update(by);
  60. //入库工程阶段审定记录
  61. String currentPersId = getCurrentPersId();
  62. tacProvincePlanExamRecord.setId(UuidUtil.uuid());
  63. tacProvincePlanExamRecord.setIntm(new Date());
  64. tacProvincePlanExamRecord.setPersId(currentPersId);
  65. tacProvincePlanExamRecord.setPersName(bisInspAllRlationPersDao.get(currentPersId).getPersName());
  66. tacProvincePlanExamRecordService.insert(tacProvincePlanExamRecord);
  67. return buildSuccessResponse();
  68. }
  69. }
  70. @ApiOperation(value = "工程阶段审定记录")
  71. @RequestMapping(value = "/list", method = RequestMethod.POST)
  72. public BaseResponse<List<TacProvincePlanExamRecord>> list(@ApiParam(name = "tacProvincePlanProcessParam", value = "tacProvincePlanProcessParam", required = true) @RequestBody TacProvincePlanExamRecordParam tacProvincePlanExamRecordParam) {
  73. if(StringUtils.isBlank(tacProvincePlanExamRecordParam.getRgstrId())){
  74. return buildFailResponse("工程参数不能为空");
  75. }
  76. if(StringUtils.isBlank(tacProvincePlanExamRecordParam.getPlanProcessId())){
  77. return buildFailResponse("阶段参数不能为空");
  78. }
  79. List<TacProvincePlanExamRecord> tacProvincePlanProcessList = tacProvincePlanExamRecordService.findList(tacProvincePlanExamRecordParam);
  80. return buildSuccessResponse(tacProvincePlanProcessList);
  81. }
  82. }