| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- package cn.com.goldenwater.dcproj.controller.zhejiang;
- import cn.com.goldenwater.dcproj.constValue.SplitValue;
- import cn.com.goldenwater.dcproj.dao.BisInspPblmDao;
- import cn.com.goldenwater.dcproj.model.AttAdXBase;
- import cn.com.goldenwater.dcproj.model.AttCwsBase;
- import cn.com.goldenwater.dcproj.model.BisZhejiangCountryFee;
- import cn.com.goldenwater.dcproj.model.BisZhejiangVillRgstr;
- import cn.com.goldenwater.dcproj.param.BisInspPblmParam;
- import cn.com.goldenwater.dcproj.param.BisZhejiangCountryFeeParam;
- import cn.com.goldenwater.dcproj.param.CwsParam;
- import cn.com.goldenwater.dcproj.service.AttAdXBaseService;
- import cn.com.goldenwater.dcproj.service.AttCwsBaseService;
- import cn.com.goldenwater.dcproj.service.BisZhejiangCountryFeeService;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.service.BisZhejiangVillRgstrService;
- import cn.com.goldenwater.target.CheckException;
- import cn.com.goldenwater.dcproj.utils.GeoUtil;
- import cn.com.goldenwater.id.util.UuidUtil;
- import cn.com.goldenwater.util.common.InspPblmUtils;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.apache.commons.lang3.StringUtils;
- import com.github.pagehelper.PageInfo;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- import java.util.Date;
- import java.util.List;
- import java.util.Map;
- /**
- * @author lune
- * @date 2020-5-11
- */
- @Api(value = "BIS 浙江农村供水工程水费收缴及水质保障情况表管理",tags="BIS 浙江农村供水工程水费收缴及水质保障情况表管理")
- @RestController
- @RequestMapping("/bis/zhejiang/country/fee")
- public class BisZhejiangCountryFeeController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisZhejiangCountryFeeService bisZhejiangCountryFeeService;
- @Autowired
- private BisZhejiangVillRgstrService bisZhejiangVillRgstrService;
- @Autowired
- private AttCwsBaseService attCwsBaseService;
- @Autowired
- private AttAdXBaseService attAdXBaseService;
- @Autowired
- private BisInspPblmDao bisInspPblmDao;
- @ApiOperation(value = "添加/修改农村供水工程水费收缴及水质保障情况表")
- @RequestMapping(value = "addBatch", method = RequestMethod.POST)
- public BaseResponse addBatch(@ApiParam(name = "cwsParam", value = "cwsParam", required = true) @RequestBody CwsParam cwsParam) {
- String cwsIds=cwsParam.getCwsIds();
- if(StringUtils.isBlank(cwsIds)){
- throw new CheckException("批量添加供水工程失败!!");
- }
- String[] arrays=cwsIds.split(SplitValue.DOUHAO_SPLIT);
- int count=0;
- for(String arr:arrays){
- AttCwsBase attCwsBase=attCwsBaseService.get(arr);
- if(attCwsBase!=null){
- count=count+1;
- BisZhejiangCountryFee newCountryFee=new BisZhejiangCountryFee();
- newCountryFee.setId(UuidUtil.uuid());
- newCountryFee.setCreateTime(new Date());
- newCountryFee.setStatus("1");
- newCountryFee.setRgstrId(cwsParam.getRegstrId());
- newCountryFee.setAdCode(cwsParam.getAdCode());
- if(StringUtils.isNotBlank(cwsParam.getAdCode())){
- AttAdXBase attAdXBase=attAdXBaseService.get(cwsParam.getAdCode());
- if(attAdXBase!=null){
- newCountryFee.setAdFullName(attAdXBase.getAdFullName());
- }
- }
- newCountryFee.setCwsCode(attCwsBase.getCwsCode());
- newCountryFee.setFinishTime(attCwsBase.getCompDate());
- newCountryFee.setProjectNm(attCwsBase.getCwsName());
- newCountryFee.setProjectType(attCwsBase.getEngType());
- newCountryFee.setLgtd(attCwsBase.getCenterXGd());
- newCountryFee.setLttd(attCwsBase.getCenterYGd());
- newCountryFee.setLgtdpc(attCwsBase.getCwsLong());
- newCountryFee.setLttdpc(attCwsBase.getCwsLat());
- newCountryFee.setPersId(getCurrentPersId());
- newCountryFee.setUpdateTime(new Date());
- bisZhejiangCountryFeeService.insert(newCountryFee);
- }
- }
- if(count !=0) {
- BisZhejiangVillRgstr bisNewVillRgstr = bisZhejiangVillRgstrService.get(cwsParam.getRegstrId());
- int pronum = bisNewVillRgstr.getProNum() + count;
- bisNewVillRgstr.setProNum(pronum);
- bisZhejiangVillRgstrService.updateProSum(bisNewVillRgstr);
- }
- return buildSuccessResponse();
- }
- @ApiOperation(value = "添加/修改浙江农村供水工程水费收缴及水质保障情况表")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisZhejiangCountryFee> insert(@ApiParam(name = "bisZhejiangCountryFee", value = "BisZhejiangCountryFee", required = true) @RequestBody BisZhejiangCountryFee bisZhejiangCountryFee) {
- bisZhejiangCountryFee.setUpdateTime(new Date());
- if(StringUtils.isBlank(bisZhejiangCountryFee.getId())) {
- String uuid = UuidUtil.uuid(); // 生成uuid
- bisZhejiangCountryFee.setId(uuid);
- bisZhejiangCountryFee.setCreateTime(new Date());
- bisZhejiangCountryFeeService.insert(bisZhejiangCountryFee);
- BisZhejiangVillRgstr bisNewVillRgstr = bisZhejiangVillRgstrService.get(bisZhejiangCountryFee.getRgstrId());
- int pronum = bisNewVillRgstr.getProNum() +1;
- bisNewVillRgstr.setProNum(pronum);
- bisZhejiangVillRgstrService.updateProSum(bisNewVillRgstr);
- }else{
- if (bisZhejiangCountryFee.getLgtd() != null && bisZhejiangCountryFee.getLttd() !=null) {
- if (bisZhejiangCountryFee.getLgtd().intValue() != 0 && bisZhejiangCountryFee.getLttd().intValue() != 0) {
- Map<String, Double> map = GeoUtil.gcj02towgs84(bisZhejiangCountryFee.getLgtd(), bisZhejiangCountryFee.getLttd());
- bisZhejiangCountryFee.setLgtdpc(map.get("long"));
- bisZhejiangCountryFee.setLttdpc(map.get("lat"));
- }
- }
- bisZhejiangCountryFeeService.update(bisZhejiangCountryFee);
- }
- bisZhejiangCountryFeeService.updateWaterOrPay(bisZhejiangCountryFee.getRgstrId());
- return buildSuccessResponse(bisZhejiangCountryFee);
- }
- @ApiOperation(value = "根据ID删除浙江农村供水工程水费收缴及水质保障情况表")
- @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
- public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisZhejiangCountryFee bisNewCountryFee=bisZhejiangCountryFeeService.get(id);
- if(bisNewCountryFee!=null){
- BisInspPblmParam bisInspPblmParam=new BisInspPblmParam();
- bisInspPblmParam.setCwsCode(id);
- bisInspPblmParam.setRegid(bisNewCountryFee.getRgstrId());
- bisInspPblmDao.deleteBy(bisInspPblmParam);
- BisZhejiangVillRgstr bisNewVillRgstr = bisZhejiangVillRgstrService.get(bisNewCountryFee.getRgstrId());
- int pronum = bisNewVillRgstr.getProNum() -1;
- bisNewVillRgstr.setProNum(pronum);
- bisZhejiangVillRgstrService.updateProSum(bisNewVillRgstr);
- }
- int ret = bisZhejiangCountryFeeService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取浙江农村供水工程水费收缴及水质保障情况表(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisZhejiangCountryFee> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisZhejiangCountryFee bisZhejiangCountryFee = bisZhejiangCountryFeeService.get(id);
- return buildSuccessResponse(bisZhejiangCountryFee);
- }
- @ApiOperation(value = "获取浙江农村供水工程水费收缴及水质保障情况表(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisZhejiangCountryFee>> list(@ApiParam(name = "bisZhejiangCountryFeeParam", value = "bisZhejiangCountryFeeParam", required = true) @RequestBody BisZhejiangCountryFeeParam bisZhejiangCountryFeeParam) {
- List<BisZhejiangCountryFee> bisZhejiangCountryFeeList = bisZhejiangCountryFeeService.findList(bisZhejiangCountryFeeParam);
- return buildSuccessResponse(bisZhejiangCountryFeeList);
- }
- @ApiOperation(value = "获取浙江农村供水工程水费收缴及水质保障情况表(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisZhejiangCountryFee>> page(@ApiParam(name = "bisZhejiangCountryFeeParam", value = "bisZhejiangCountryFeeParam", required = true) @RequestBody BisZhejiangCountryFeeParam bisZhejiangCountryFeeParam) {
- PageInfo<BisZhejiangCountryFee> bisZhejiangCountryFeeList = bisZhejiangCountryFeeService.findPageInfo(bisZhejiangCountryFeeParam);
- return buildSuccessResponse(bisZhejiangCountryFeeList);
- }
- @ApiOperation(value = "获取未被督查的供水工程(添加供水工程列表)")
- @RequestMapping(value = "/pageNotDC", method = RequestMethod.POST)
- public BaseResponse<PageInfo<AttCwsBase>> pageNotDC(@ApiParam(name = "cwsParam", value = "cwsParam", required = true) @RequestBody CwsParam cwsParam) {
- if(StringUtils.isNotBlank(cwsParam.getAdCode())) {
- cwsParam.setAdCode(InspPblmUtils.getAddVCD(cwsParam.getAdCode()));
- }
- PageInfo<AttCwsBase> bisNewCountryFeeList = bisZhejiangCountryFeeService.pageNotDC(cwsParam);
- return buildSuccessResponse(bisNewCountryFeeList);
- }
- }
|