c6054dd0eaf0f4f7f7b38885e2a4f35bb8aa6a6c.svn-base 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. package cn.com.goldenwater.dcproj.controller.rdwsp;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.constValue.SplitValue;
  5. import cn.com.goldenwater.dcproj.model.AttAdXBase;
  6. import cn.com.goldenwater.dcproj.model.AttCwsBase;
  7. import cn.com.goldenwater.dcproj.model.BisBisRdwspRgstrFee;
  8. import cn.com.goldenwater.dcproj.model.BisRdwspRgstr;
  9. import cn.com.goldenwater.dcproj.param.BisBisRdwspRgstrFeeParam;
  10. import cn.com.goldenwater.dcproj.param.CwsParam;
  11. import cn.com.goldenwater.dcproj.service.AttAdXBaseService;
  12. import cn.com.goldenwater.dcproj.service.AttCwsBaseService;
  13. import cn.com.goldenwater.dcproj.service.BisBisRdwspRgstrFeeService;
  14. import cn.com.goldenwater.dcproj.service.BisRdwspRgstrService;
  15. import cn.com.goldenwater.target.CheckException;
  16. import cn.com.goldenwater.dcproj.utils.Constant;
  17. import cn.com.goldenwater.id.util.UuidUtil;
  18. import com.github.pagehelper.PageInfo;
  19. import io.swagger.annotations.Api;
  20. import io.swagger.annotations.ApiOperation;
  21. import io.swagger.annotations.ApiParam;
  22. import org.apache.commons.lang3.StringUtils;
  23. import org.slf4j.Logger;
  24. import org.slf4j.LoggerFactory;
  25. import org.springframework.beans.factory.annotation.Autowired;
  26. import org.springframework.web.bind.annotation.*;
  27. import java.util.Date;
  28. import java.util.List;
  29. /**
  30. * @author lune
  31. * @date 2020-10-9
  32. */
  33. @Api(value = "BIS 农村供水工程暗访情况表管理",tags="BIS 农村供水工程暗访情况表管理")
  34. @RestController
  35. @RequestMapping("/bis/bis/rdwsp/rgstr/fee")
  36. public class BisBisRdwspRgstrFeeController extends BaseController {
  37. private Logger logger = LoggerFactory.getLogger(getClass());
  38. @Autowired
  39. private BisBisRdwspRgstrFeeService bisBisRdwspRgstrFeeService;
  40. @Autowired
  41. private AttAdXBaseService attAdXBaseService;
  42. @Autowired
  43. private AttCwsBaseService attCwsBaseService;
  44. @Autowired
  45. private BisRdwspRgstrService bisRdwspRgstrService;
  46. @ApiOperation(value = "添加/修改农村供水工程暗访情况表")
  47. @RequestMapping(value = "", method = RequestMethod.POST)
  48. public BaseResponse<BisBisRdwspRgstrFee> insert(@ApiParam(name = "bisBisRdwspRgstrFee", value = "BisBisRdwspRgstrFee", required = true) @RequestBody BisBisRdwspRgstrFee bisBisRdwspRgstrFee) {
  49. if(StringUtils.isBlank(bisBisRdwspRgstrFee.getId())) {
  50. // 生成uuid
  51. String uuid = UuidUtil.uuid();
  52. bisBisRdwspRgstrFee.setId(uuid);
  53. bisBisRdwspRgstrFeeService.insert(bisBisRdwspRgstrFee);
  54. }else{
  55. bisBisRdwspRgstrFeeService.update(bisBisRdwspRgstrFee);
  56. }
  57. if (StringUtils.isNotBlank(bisBisRdwspRgstrFee.getRegstrId())) {
  58. BisRdwspRgstr rgstr = bisRdwspRgstrService.get(bisBisRdwspRgstrFee.getRegstrId());
  59. if (!Constant.STRING_TWO.equals(rgstr.getState())) {
  60. rgstr.setUptm(new Date());
  61. rgstr.setState(Constant.STRING_ONE);
  62. rgstr.setFeeState(bisBisRdwspRgstrFee.getStatus());
  63. bisRdwspRgstrService.update(rgstr);
  64. }
  65. }
  66. return buildSuccessResponse(bisBisRdwspRgstrFee);
  67. }
  68. @ApiOperation(value = "根据ID删除农村供水工程暗访情况表")
  69. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  70. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  71. int ret = bisBisRdwspRgstrFeeService.delete(id);
  72. return buildSuccessResponse();
  73. }
  74. @ApiOperation(value = "根据ID获取农村供水工程暗访情况表(单表)")
  75. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  76. public BaseResponse<BisBisRdwspRgstrFee> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  77. BisBisRdwspRgstrFee bisBisRdwspRgstrFee = bisBisRdwspRgstrFeeService.get(id);
  78. return buildSuccessResponse(bisBisRdwspRgstrFee);
  79. }
  80. @ApiOperation(value = "获取农村供水工程暗访情况表(列表所有)")
  81. @RequestMapping(value = "/list", method = RequestMethod.POST)
  82. public BaseResponse<List<BisBisRdwspRgstrFee>> list(@ApiParam(name = "bisBisRdwspRgstrFeeParam", value = "bisBisRdwspRgstrFeeParam", required = true) @RequestBody BisBisRdwspRgstrFeeParam bisBisRdwspRgstrFeeParam) {
  83. List<BisBisRdwspRgstrFee> bisBisRdwspRgstrFeeList = bisBisRdwspRgstrFeeService.findList(bisBisRdwspRgstrFeeParam);
  84. return buildSuccessResponse(bisBisRdwspRgstrFeeList);
  85. }
  86. @ApiOperation(value = "获取农村供水工程暗访情况表(列表--分页)")
  87. @RequestMapping(value = "/page", method = RequestMethod.POST)
  88. public BaseResponse<PageInfo<BisBisRdwspRgstrFee>> page(@ApiParam(name = "bisBisRdwspRgstrFeeParam", value = "bisBisRdwspRgstrFeeParam", required = true) @RequestBody BisBisRdwspRgstrFeeParam bisBisRdwspRgstrFeeParam) {
  89. PageInfo<BisBisRdwspRgstrFee> bisBisRdwspRgstrFeeList = bisBisRdwspRgstrFeeService.findPageInfo(bisBisRdwspRgstrFeeParam);
  90. return buildSuccessResponse(bisBisRdwspRgstrFeeList);
  91. }
  92. @ApiOperation(value = "获取未被督查的供水工程(添加供水工程列表)")
  93. @RequestMapping(value = "/pageNotDC", method = RequestMethod.POST)
  94. public BaseResponse<PageInfo<AttCwsBase>> pageNotDC(@ApiParam(name = "cwsParam", value = "cwsParam", required = true) @RequestBody CwsParam cwsParam) {
  95. if(StringUtils.isNotBlank(cwsParam.getAdCode())) {
  96. String adCode = cwsParam.getAdCode().substring(0, 6);
  97. cwsParam.setAdCode(adCode);
  98. }
  99. PageInfo<AttCwsBase> bisNewCountryFeeList = bisBisRdwspRgstrFeeService.pageNotDC(cwsParam);
  100. return buildSuccessResponse(bisNewCountryFeeList);
  101. }
  102. @ApiOperation(value = "添加/修改农村供水工程水费收缴及水质保障情况表")
  103. @RequestMapping(value = "addBatch", method = RequestMethod.POST)
  104. public BaseResponse addBatch(@ApiParam(name = "cwsParam", value = "cwsParam", required = true) @RequestBody CwsParam cwsParam) {
  105. String cwsIds=cwsParam.getCwsIds();
  106. if(StringUtils.isBlank(cwsIds)){
  107. throw new CheckException("批量添加供水工程失败!!");
  108. }
  109. String[] arrays=cwsIds.split(SplitValue.DOUHAO_SPLIT);
  110. for(String arr:arrays){
  111. AttCwsBase attCwsBase=attCwsBaseService.get(arr);
  112. if(attCwsBase!=null){
  113. BisBisRdwspRgstrFee newCountryFee=new BisBisRdwspRgstrFee();
  114. newCountryFee.setId(UuidUtil.uuid());
  115. newCountryFee.setIntm(new Date());
  116. newCountryFee.setUptm(new Date());
  117. newCountryFee.setStatus("1");
  118. newCountryFee.setRegstrId(cwsParam.getRegstrId());
  119. newCountryFee.setAdCode(cwsParam.getAdCode());
  120. if(StringUtils.isNotBlank(cwsParam.getAdCode())){
  121. AttAdXBase attAdXBase=attAdXBaseService.get(cwsParam.getAdCode());
  122. if(attAdXBase!=null){
  123. newCountryFee.setAdFullName(attAdXBase.getAdFullName());
  124. }
  125. }
  126. newCountryFee.setPrjId(attCwsBase.getCwsCode());
  127. newCountryFee.setPrjNm(attCwsBase.getCwsName());
  128. newCountryFee.setPrjType(attCwsBase.getEngType());
  129. newCountryFee.setGdX(attCwsBase.getCenterXGd());
  130. newCountryFee.setGdY(attCwsBase.getCenterYGd());
  131. newCountryFee.setAdName(attCwsBase.getCwsLoc());
  132. newCountryFee.setAdFullName(attCwsBase.getCwsLoc());
  133. newCountryFee.setCenterX(attCwsBase.getCwsLong());
  134. newCountryFee.setCenterY(attCwsBase.getCwsLat());
  135. bisBisRdwspRgstrFeeService.insert(newCountryFee);
  136. }
  137. }
  138. return buildSuccessResponse();
  139. }
  140. }