7f28579bd4674698790e4bdbedfbbea8714e61de.svn-base 9.9 KB

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