4f04f6e4d50e03ad111804c7ac3a6f40a757765d.svn-base 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. package cn.com.goldenwater.dcproj.controller.zhejiang;
  2. import cn.com.goldenwater.dcproj.constValue.SplitValue;
  3. import cn.com.goldenwater.dcproj.dao.BisInspPblmDao;
  4. import cn.com.goldenwater.dcproj.model.AttAdXBase;
  5. import cn.com.goldenwater.dcproj.model.AttCwsBase;
  6. import cn.com.goldenwater.dcproj.model.BisZhejiangCountryFee;
  7. import cn.com.goldenwater.dcproj.model.BisZhejiangVillRgstr;
  8. import cn.com.goldenwater.dcproj.param.BisInspPblmParam;
  9. import cn.com.goldenwater.dcproj.param.BisZhejiangCountryFeeParam;
  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.BisZhejiangCountryFeeService;
  14. import cn.com.goldenwater.core.web.BaseController;
  15. import cn.com.goldenwater.core.web.BaseResponse;
  16. import cn.com.goldenwater.dcproj.service.BisZhejiangVillRgstrService;
  17. import cn.com.goldenwater.target.CheckException;
  18. import cn.com.goldenwater.dcproj.utils.GeoUtil;
  19. import cn.com.goldenwater.id.util.UuidUtil;
  20. import cn.com.goldenwater.util.common.InspPblmUtils;
  21. import io.swagger.annotations.Api;
  22. import io.swagger.annotations.ApiOperation;
  23. import io.swagger.annotations.ApiParam;
  24. import org.apache.commons.lang3.StringUtils;
  25. import com.github.pagehelper.PageInfo;
  26. import org.slf4j.Logger;
  27. import org.slf4j.LoggerFactory;
  28. import org.springframework.beans.factory.annotation.Autowired;
  29. import org.springframework.web.bind.annotation.PathVariable;
  30. import org.springframework.web.bind.annotation.RequestBody;
  31. import org.springframework.web.bind.annotation.RequestMapping;
  32. import org.springframework.web.bind.annotation.RequestMethod;
  33. import org.springframework.web.bind.annotation.RestController;
  34. import java.util.Date;
  35. import java.util.List;
  36. import java.util.Map;
  37. /**
  38. * @author lune
  39. * @date 2020-5-11
  40. */
  41. @Api(value = "BIS 浙江农村供水工程水费收缴及水质保障情况表管理",tags="BIS 浙江农村供水工程水费收缴及水质保障情况表管理")
  42. @RestController
  43. @RequestMapping("/bis/zhejiang/country/fee")
  44. public class BisZhejiangCountryFeeController extends BaseController {
  45. private Logger logger = LoggerFactory.getLogger(getClass());
  46. @Autowired
  47. private BisZhejiangCountryFeeService bisZhejiangCountryFeeService;
  48. @Autowired
  49. private BisZhejiangVillRgstrService bisZhejiangVillRgstrService;
  50. @Autowired
  51. private AttCwsBaseService attCwsBaseService;
  52. @Autowired
  53. private AttAdXBaseService attAdXBaseService;
  54. @Autowired
  55. private BisInspPblmDao bisInspPblmDao;
  56. @ApiOperation(value = "添加/修改农村供水工程水费收缴及水质保障情况表")
  57. @RequestMapping(value = "addBatch", method = RequestMethod.POST)
  58. public BaseResponse addBatch(@ApiParam(name = "cwsParam", value = "cwsParam", required = true) @RequestBody CwsParam cwsParam) {
  59. String cwsIds=cwsParam.getCwsIds();
  60. if(StringUtils.isBlank(cwsIds)){
  61. throw new CheckException("批量添加供水工程失败!!");
  62. }
  63. String[] arrays=cwsIds.split(SplitValue.DOUHAO_SPLIT);
  64. int count=0;
  65. for(String arr:arrays){
  66. AttCwsBase attCwsBase=attCwsBaseService.get(arr);
  67. if(attCwsBase!=null){
  68. count=count+1;
  69. BisZhejiangCountryFee newCountryFee=new BisZhejiangCountryFee();
  70. newCountryFee.setId(UuidUtil.uuid());
  71. newCountryFee.setCreateTime(new Date());
  72. newCountryFee.setStatus("1");
  73. newCountryFee.setRgstrId(cwsParam.getRegstrId());
  74. newCountryFee.setAdCode(cwsParam.getAdCode());
  75. if(StringUtils.isNotBlank(cwsParam.getAdCode())){
  76. AttAdXBase attAdXBase=attAdXBaseService.get(cwsParam.getAdCode());
  77. if(attAdXBase!=null){
  78. newCountryFee.setAdFullName(attAdXBase.getAdFullName());
  79. }
  80. }
  81. newCountryFee.setCwsCode(attCwsBase.getCwsCode());
  82. newCountryFee.setFinishTime(attCwsBase.getCompDate());
  83. newCountryFee.setProjectNm(attCwsBase.getCwsName());
  84. newCountryFee.setProjectType(attCwsBase.getEngType());
  85. newCountryFee.setLgtd(attCwsBase.getCenterXGd());
  86. newCountryFee.setLttd(attCwsBase.getCenterYGd());
  87. newCountryFee.setLgtdpc(attCwsBase.getCwsLong());
  88. newCountryFee.setLttdpc(attCwsBase.getCwsLat());
  89. newCountryFee.setPersId(getCurrentPersId());
  90. newCountryFee.setUpdateTime(new Date());
  91. bisZhejiangCountryFeeService.insert(newCountryFee);
  92. }
  93. }
  94. if(count !=0) {
  95. BisZhejiangVillRgstr bisNewVillRgstr = bisZhejiangVillRgstrService.get(cwsParam.getRegstrId());
  96. int pronum = bisNewVillRgstr.getProNum() + count;
  97. bisNewVillRgstr.setProNum(pronum);
  98. bisZhejiangVillRgstrService.updateProSum(bisNewVillRgstr);
  99. }
  100. return buildSuccessResponse();
  101. }
  102. @ApiOperation(value = "添加/修改浙江农村供水工程水费收缴及水质保障情况表")
  103. @RequestMapping(value = "", method = RequestMethod.POST)
  104. public BaseResponse<BisZhejiangCountryFee> insert(@ApiParam(name = "bisZhejiangCountryFee", value = "BisZhejiangCountryFee", required = true) @RequestBody BisZhejiangCountryFee bisZhejiangCountryFee) {
  105. bisZhejiangCountryFee.setUpdateTime(new Date());
  106. if(StringUtils.isBlank(bisZhejiangCountryFee.getId())) {
  107. String uuid = UuidUtil.uuid(); // 生成uuid
  108. bisZhejiangCountryFee.setId(uuid);
  109. bisZhejiangCountryFee.setCreateTime(new Date());
  110. bisZhejiangCountryFeeService.insert(bisZhejiangCountryFee);
  111. BisZhejiangVillRgstr bisNewVillRgstr = bisZhejiangVillRgstrService.get(bisZhejiangCountryFee.getRgstrId());
  112. int pronum = bisNewVillRgstr.getProNum() +1;
  113. bisNewVillRgstr.setProNum(pronum);
  114. bisZhejiangVillRgstrService.updateProSum(bisNewVillRgstr);
  115. }else{
  116. if (bisZhejiangCountryFee.getLgtd() != null && bisZhejiangCountryFee.getLttd() !=null) {
  117. if (bisZhejiangCountryFee.getLgtd().intValue() != 0 && bisZhejiangCountryFee.getLttd().intValue() != 0) {
  118. Map<String, Double> map = GeoUtil.gcj02towgs84(bisZhejiangCountryFee.getLgtd(), bisZhejiangCountryFee.getLttd());
  119. bisZhejiangCountryFee.setLgtdpc(map.get("long"));
  120. bisZhejiangCountryFee.setLttdpc(map.get("lat"));
  121. }
  122. }
  123. bisZhejiangCountryFeeService.update(bisZhejiangCountryFee);
  124. }
  125. bisZhejiangCountryFeeService.updateWaterOrPay(bisZhejiangCountryFee.getRgstrId());
  126. return buildSuccessResponse(bisZhejiangCountryFee);
  127. }
  128. @ApiOperation(value = "根据ID删除浙江农村供水工程水费收缴及水质保障情况表")
  129. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  130. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  131. BisZhejiangCountryFee bisNewCountryFee=bisZhejiangCountryFeeService.get(id);
  132. if(bisNewCountryFee!=null){
  133. BisInspPblmParam bisInspPblmParam=new BisInspPblmParam();
  134. bisInspPblmParam.setCwsCode(id);
  135. bisInspPblmParam.setRegid(bisNewCountryFee.getRgstrId());
  136. bisInspPblmDao.deleteBy(bisInspPblmParam);
  137. BisZhejiangVillRgstr bisNewVillRgstr = bisZhejiangVillRgstrService.get(bisNewCountryFee.getRgstrId());
  138. int pronum = bisNewVillRgstr.getProNum() -1;
  139. bisNewVillRgstr.setProNum(pronum);
  140. bisZhejiangVillRgstrService.updateProSum(bisNewVillRgstr);
  141. }
  142. int ret = bisZhejiangCountryFeeService.delete(id);
  143. return buildSuccessResponse();
  144. }
  145. @ApiOperation(value = "根据ID获取浙江农村供水工程水费收缴及水质保障情况表(单表)")
  146. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  147. public BaseResponse<BisZhejiangCountryFee> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  148. BisZhejiangCountryFee bisZhejiangCountryFee = bisZhejiangCountryFeeService.get(id);
  149. return buildSuccessResponse(bisZhejiangCountryFee);
  150. }
  151. @ApiOperation(value = "获取浙江农村供水工程水费收缴及水质保障情况表(列表所有)")
  152. @RequestMapping(value = "/list", method = RequestMethod.POST)
  153. public BaseResponse<List<BisZhejiangCountryFee>> list(@ApiParam(name = "bisZhejiangCountryFeeParam", value = "bisZhejiangCountryFeeParam", required = true) @RequestBody BisZhejiangCountryFeeParam bisZhejiangCountryFeeParam) {
  154. List<BisZhejiangCountryFee> bisZhejiangCountryFeeList = bisZhejiangCountryFeeService.findList(bisZhejiangCountryFeeParam);
  155. return buildSuccessResponse(bisZhejiangCountryFeeList);
  156. }
  157. @ApiOperation(value = "获取浙江农村供水工程水费收缴及水质保障情况表(列表--分页)")
  158. @RequestMapping(value = "/page", method = RequestMethod.POST)
  159. public BaseResponse<PageInfo<BisZhejiangCountryFee>> page(@ApiParam(name = "bisZhejiangCountryFeeParam", value = "bisZhejiangCountryFeeParam", required = true) @RequestBody BisZhejiangCountryFeeParam bisZhejiangCountryFeeParam) {
  160. PageInfo<BisZhejiangCountryFee> bisZhejiangCountryFeeList = bisZhejiangCountryFeeService.findPageInfo(bisZhejiangCountryFeeParam);
  161. return buildSuccessResponse(bisZhejiangCountryFeeList);
  162. }
  163. @ApiOperation(value = "获取未被督查的供水工程(添加供水工程列表)")
  164. @RequestMapping(value = "/pageNotDC", method = RequestMethod.POST)
  165. public BaseResponse<PageInfo<AttCwsBase>> pageNotDC(@ApiParam(name = "cwsParam", value = "cwsParam", required = true) @RequestBody CwsParam cwsParam) {
  166. if(StringUtils.isNotBlank(cwsParam.getAdCode())) {
  167. cwsParam.setAdCode(InspPblmUtils.getAddVCD(cwsParam.getAdCode()));
  168. }
  169. PageInfo<AttCwsBase> bisNewCountryFeeList = bisZhejiangCountryFeeService.pageNotDC(cwsParam);
  170. return buildSuccessResponse(bisNewCountryFeeList);
  171. }
  172. }