| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- package cn.com.goldenwater.dcproj.controller.vill2020;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.constValue.StateEnum;
- import cn.com.goldenwater.dcproj.model.BisNewCountryLaw;
- import cn.com.goldenwater.dcproj.model.BisNewVillRgstr;
- import cn.com.goldenwater.dcproj.param.BisNewCountryLawParam;
- import cn.com.goldenwater.dcproj.param.GwComFileParam;
- import cn.com.goldenwater.dcproj.service.BisNewCountryLawService;
- import cn.com.goldenwater.dcproj.service.BisNewVillRgstrService;
- import cn.com.goldenwater.dcproj.service.GwComFileService;
- import cn.com.goldenwater.target.CheckException;
- import cn.com.goldenwater.id.util.UuidUtil;
- import com.github.pagehelper.PageInfo;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.apache.commons.lang3.StringUtils;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.Date;
- import java.util.List;
- /**
- * @author lune
- * @date 2020-3-27
- */
- @Api(value = "BIS 农村供水工程水价相关政策制度制定情况表",tags="BIS 农村供水工程水价相关政策制度制定情况表管理")
- @RestController
- @RequestMapping("/bis/new/country/law")
- public class BisNewCountryLawController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisNewCountryLawService bisNewCountryLawService;
- @Autowired
- private BisNewVillRgstrService bisNewVillRgstrService;
- @Autowired
- private GwComFileService comFileService;
- @ApiOperation(value = "添加/修改农村供水工程水价相关政策制度制定情况表")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisNewCountryLaw> insert(@ApiParam(name = "bisNewCountryLaw", value = "BisNewCountryLaw", required = true) @RequestBody BisNewCountryLaw bisNewCountryLaw) {
- if(StringUtils.isBlank(bisNewCountryLaw.getRegstrId())){
- throw new CheckException("登记表id不能为空");
- }
- bisNewCountryLaw.setUpdateTime(new Date());
- if(StringUtils.isBlank(bisNewCountryLaw.getId())) {
- bisNewCountryLaw.setCreateTime(new Date());
- String uuid = UuidUtil.uuid(); // 生成uuid
- bisNewCountryLaw.setId(uuid);
- bisNewCountryLawService.insert(bisNewCountryLaw);
- }else{
- bisNewCountryLawService.update(bisNewCountryLaw);
- }
- //其他是否制定
- GwComFileParam comFileParam=new GwComFileParam();
- comFileParam.setBizId(bisNewCountryLaw.getId());
- if("2".equals(bisNewCountryLaw.getZcOtherIsMake())){
- comFileParam.setBizType("zcOtherIsMake");
- comFileService.deleteBy(comFileParam);
- }
- if("2".equals(bisNewCountryLaw.getZcWaterIsMake())){
- comFileParam.setBizType("zcWaterIsMake");
- comFileService.deleteBy(comFileParam);
- }
- if("2".equals(bisNewCountryLaw.getZcBuzhuIsMake())){
- comFileParam.setBizType("zcBuzhuIsMake");
- comFileService.deleteBy(comFileParam);
- }
- BisNewVillRgstr villRgstr=new BisNewVillRgstr();
- villRgstr.setId(bisNewCountryLaw.getRegstrId());
- villRgstr.setIsPkx(bisNewCountryLaw.getIsPkx());
- villRgstr.setIsFoOver(bisNewCountryLaw.getIsFoOver());
- villRgstr.setWaterPriceIsMade(bisNewCountryLaw.getStatus());
- villRgstr.setState(StateEnum.EXWASTSTATE.getKey());
- bisNewVillRgstrService.update(villRgstr);
- return buildSuccessResponse(bisNewCountryLaw);
- }
- @ApiOperation(value = "根据ID删除农村供水工程水价相关政策制度制定情况表")
- @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
- public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- int ret = bisNewCountryLawService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据regstrId获取农村供水工程水价相关政策制度制定情况表(单表)")
- @RequestMapping(value = "/{regstrId}", method = RequestMethod.GET)
- public BaseResponse<BisNewCountryLaw> get(@ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId) {
- BisNewCountryLawParam countryLawParam=new BisNewCountryLawParam();
- countryLawParam.setRegstrId(regstrId);
- BisNewCountryLaw bisNewCountryLaw = bisNewCountryLawService.getBy(countryLawParam);
- if(bisNewCountryLaw==null){
- BisNewVillRgstr villRgstr=bisNewVillRgstrService.get(regstrId);
- bisNewCountryLaw=new BisNewCountryLaw();
- bisNewCountryLaw.setId(UuidUtil.uuid());
- bisNewCountryLaw.setCreateTime(new Date());
- bisNewCountryLaw.setRegstrId(regstrId);
- bisNewCountryLaw.setUpdateTime(new Date());
- bisNewCountryLaw.setAdCode(villRgstr.getAdCode());
- bisNewCountryLaw.setPersId(getCurrentPersId());
- bisNewCountryLaw.setIsPkx(villRgstr.getIsPkx());
- bisNewCountryLaw.setStatus("0");
- bisNewCountryLaw.setIsFoOver(villRgstr.getIsFoOver());
- bisNewCountryLawService.insert(bisNewCountryLaw);
- }else{
- GwComFileParam comFileParam=new GwComFileParam();
- comFileParam.setBizId(bisNewCountryLaw.getId());
- if("1".equals(bisNewCountryLaw.getZcOtherIsMake())){
- comFileParam.setBizType("zcOtherIsMake");
- bisNewCountryLaw.setZcOtherIsMakeFiles(comFileService.findList(comFileParam));
- }
- if("1".equals(bisNewCountryLaw.getZcWaterIsMake())){
- comFileParam.setBizType("zcWaterIsMake");
- bisNewCountryLaw.setZcWaterIsMakeFiles(comFileService.findList(comFileParam));
- }
- if("1".equals(bisNewCountryLaw.getZcBuzhuIsMake())){
- comFileParam.setBizType("zcBuzhuIsMake");
- bisNewCountryLaw.setZcBuzhuIsMakeFiles(comFileService.findList(comFileParam));
- }
- }
- return buildSuccessResponse(bisNewCountryLaw);
- }
- @ApiOperation(value = "获取农村供水工程水价相关政策制度制定情况表(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisNewCountryLaw>> list(@ApiParam(name = "bisNewCountryLawParam", value = "bisNewCountryLawParam", required = true) @RequestBody BisNewCountryLawParam bisNewCountryLawParam) {
- List<BisNewCountryLaw> bisNewCountryLawList = bisNewCountryLawService.findList(bisNewCountryLawParam);
- return buildSuccessResponse(bisNewCountryLawList);
- }
- @ApiOperation(value = "获取农村供水工程水价相关政策制度制定情况表(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisNewCountryLaw>> page(@ApiParam(name = "bisNewCountryLawParam", value = "bisNewCountryLawParam", required = true) @RequestBody BisNewCountryLawParam bisNewCountryLawParam) {
- PageInfo<BisNewCountryLaw> bisNewCountryLawList = bisNewCountryLawService.findPageInfo(bisNewCountryLawParam);
- return buildSuccessResponse(bisNewCountryLawList);
- }
- }
|