82ecd9e6d8a3ddc973c06d61369a08524a62411a.svn-base 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. package cn.com.goldenwater.dcproj.controller.vill2020;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.constValue.StateEnum;
  5. import cn.com.goldenwater.dcproj.model.BisNewCountryLaw;
  6. import cn.com.goldenwater.dcproj.model.BisNewVillRgstr;
  7. import cn.com.goldenwater.dcproj.param.BisNewCountryLawParam;
  8. import cn.com.goldenwater.dcproj.param.GwComFileParam;
  9. import cn.com.goldenwater.dcproj.service.BisNewCountryLawService;
  10. import cn.com.goldenwater.dcproj.service.BisNewVillRgstrService;
  11. import cn.com.goldenwater.dcproj.service.GwComFileService;
  12. import cn.com.goldenwater.target.CheckException;
  13. import cn.com.goldenwater.id.util.UuidUtil;
  14. import com.github.pagehelper.PageInfo;
  15. import io.swagger.annotations.Api;
  16. import io.swagger.annotations.ApiOperation;
  17. import io.swagger.annotations.ApiParam;
  18. import org.apache.commons.lang3.StringUtils;
  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.*;
  23. import java.util.Date;
  24. import java.util.List;
  25. /**
  26. * @author lune
  27. * @date 2020-3-27
  28. */
  29. @Api(value = "BIS 农村供水工程水价相关政策制度制定情况表",tags="BIS 农村供水工程水价相关政策制度制定情况表管理")
  30. @RestController
  31. @RequestMapping("/bis/new/country/law")
  32. public class BisNewCountryLawController extends BaseController {
  33. private Logger logger = LoggerFactory.getLogger(getClass());
  34. @Autowired
  35. private BisNewCountryLawService bisNewCountryLawService;
  36. @Autowired
  37. private BisNewVillRgstrService bisNewVillRgstrService;
  38. @Autowired
  39. private GwComFileService comFileService;
  40. @ApiOperation(value = "添加/修改农村供水工程水价相关政策制度制定情况表")
  41. @RequestMapping(value = "", method = RequestMethod.POST)
  42. public BaseResponse<BisNewCountryLaw> insert(@ApiParam(name = "bisNewCountryLaw", value = "BisNewCountryLaw", required = true) @RequestBody BisNewCountryLaw bisNewCountryLaw) {
  43. if(StringUtils.isBlank(bisNewCountryLaw.getRegstrId())){
  44. throw new CheckException("登记表id不能为空");
  45. }
  46. bisNewCountryLaw.setUpdateTime(new Date());
  47. if(StringUtils.isBlank(bisNewCountryLaw.getId())) {
  48. bisNewCountryLaw.setCreateTime(new Date());
  49. String uuid = UuidUtil.uuid(); // 生成uuid
  50. bisNewCountryLaw.setId(uuid);
  51. bisNewCountryLawService.insert(bisNewCountryLaw);
  52. }else{
  53. bisNewCountryLawService.update(bisNewCountryLaw);
  54. }
  55. //其他是否制定
  56. GwComFileParam comFileParam=new GwComFileParam();
  57. comFileParam.setBizId(bisNewCountryLaw.getId());
  58. if("2".equals(bisNewCountryLaw.getZcOtherIsMake())){
  59. comFileParam.setBizType("zcOtherIsMake");
  60. comFileService.deleteBy(comFileParam);
  61. }
  62. if("2".equals(bisNewCountryLaw.getZcWaterIsMake())){
  63. comFileParam.setBizType("zcWaterIsMake");
  64. comFileService.deleteBy(comFileParam);
  65. }
  66. if("2".equals(bisNewCountryLaw.getZcBuzhuIsMake())){
  67. comFileParam.setBizType("zcBuzhuIsMake");
  68. comFileService.deleteBy(comFileParam);
  69. }
  70. BisNewVillRgstr villRgstr=new BisNewVillRgstr();
  71. villRgstr.setId(bisNewCountryLaw.getRegstrId());
  72. villRgstr.setIsPkx(bisNewCountryLaw.getIsPkx());
  73. villRgstr.setIsFoOver(bisNewCountryLaw.getIsFoOver());
  74. villRgstr.setWaterPriceIsMade(bisNewCountryLaw.getStatus());
  75. villRgstr.setState(StateEnum.EXWASTSTATE.getKey());
  76. bisNewVillRgstrService.update(villRgstr);
  77. return buildSuccessResponse(bisNewCountryLaw);
  78. }
  79. @ApiOperation(value = "根据ID删除农村供水工程水价相关政策制度制定情况表")
  80. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  81. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  82. int ret = bisNewCountryLawService.delete(id);
  83. return buildSuccessResponse();
  84. }
  85. @ApiOperation(value = "根据regstrId获取农村供水工程水价相关政策制度制定情况表(单表)")
  86. @RequestMapping(value = "/{regstrId}", method = RequestMethod.GET)
  87. public BaseResponse<BisNewCountryLaw> get(@ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId) {
  88. BisNewCountryLawParam countryLawParam=new BisNewCountryLawParam();
  89. countryLawParam.setRegstrId(regstrId);
  90. BisNewCountryLaw bisNewCountryLaw = bisNewCountryLawService.getBy(countryLawParam);
  91. if(bisNewCountryLaw==null){
  92. BisNewVillRgstr villRgstr=bisNewVillRgstrService.get(regstrId);
  93. bisNewCountryLaw=new BisNewCountryLaw();
  94. bisNewCountryLaw.setId(UuidUtil.uuid());
  95. bisNewCountryLaw.setCreateTime(new Date());
  96. bisNewCountryLaw.setRegstrId(regstrId);
  97. bisNewCountryLaw.setUpdateTime(new Date());
  98. bisNewCountryLaw.setAdCode(villRgstr.getAdCode());
  99. bisNewCountryLaw.setPersId(getCurrentPersId());
  100. bisNewCountryLaw.setIsPkx(villRgstr.getIsPkx());
  101. bisNewCountryLaw.setStatus("0");
  102. bisNewCountryLaw.setIsFoOver(villRgstr.getIsFoOver());
  103. bisNewCountryLawService.insert(bisNewCountryLaw);
  104. }else{
  105. GwComFileParam comFileParam=new GwComFileParam();
  106. comFileParam.setBizId(bisNewCountryLaw.getId());
  107. if("1".equals(bisNewCountryLaw.getZcOtherIsMake())){
  108. comFileParam.setBizType("zcOtherIsMake");
  109. bisNewCountryLaw.setZcOtherIsMakeFiles(comFileService.findList(comFileParam));
  110. }
  111. if("1".equals(bisNewCountryLaw.getZcWaterIsMake())){
  112. comFileParam.setBizType("zcWaterIsMake");
  113. bisNewCountryLaw.setZcWaterIsMakeFiles(comFileService.findList(comFileParam));
  114. }
  115. if("1".equals(bisNewCountryLaw.getZcBuzhuIsMake())){
  116. comFileParam.setBizType("zcBuzhuIsMake");
  117. bisNewCountryLaw.setZcBuzhuIsMakeFiles(comFileService.findList(comFileParam));
  118. }
  119. }
  120. return buildSuccessResponse(bisNewCountryLaw);
  121. }
  122. @ApiOperation(value = "获取农村供水工程水价相关政策制度制定情况表(列表所有)")
  123. @RequestMapping(value = "/list", method = RequestMethod.POST)
  124. public BaseResponse<List<BisNewCountryLaw>> list(@ApiParam(name = "bisNewCountryLawParam", value = "bisNewCountryLawParam", required = true) @RequestBody BisNewCountryLawParam bisNewCountryLawParam) {
  125. List<BisNewCountryLaw> bisNewCountryLawList = bisNewCountryLawService.findList(bisNewCountryLawParam);
  126. return buildSuccessResponse(bisNewCountryLawList);
  127. }
  128. @ApiOperation(value = "获取农村供水工程水价相关政策制度制定情况表(列表--分页)")
  129. @RequestMapping(value = "/page", method = RequestMethod.POST)
  130. public BaseResponse<PageInfo<BisNewCountryLaw>> page(@ApiParam(name = "bisNewCountryLawParam", value = "bisNewCountryLawParam", required = true) @RequestBody BisNewCountryLawParam bisNewCountryLawParam) {
  131. PageInfo<BisNewCountryLaw> bisNewCountryLawList = bisNewCountryLawService.findPageInfo(bisNewCountryLawParam);
  132. return buildSuccessResponse(bisNewCountryLawList);
  133. }
  134. }