| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- package cn.com.goldenwater.dcproj.controller.zhejiang;
- import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
- import cn.com.goldenwater.dcproj.dao.AttAdXBaseDao;
- import cn.com.goldenwater.dcproj.dao.BisInspAllObjDao;
- import cn.com.goldenwater.dcproj.dao.BisInspPblmDao;
- import cn.com.goldenwater.dcproj.dto.AttCountryDto;
- import cn.com.goldenwater.dcproj.dto.BisNewDcuserRelVillDto;
- import cn.com.goldenwater.dcproj.dto.BisNewVillRgstrDto;
- import cn.com.goldenwater.dcproj.dto.VillAddDto;
- import cn.com.goldenwater.dcproj.model.*;
- import cn.com.goldenwater.dcproj.param.*;
- import cn.com.goldenwater.dcproj.service.*;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.utils.GeoUtil;
- import cn.com.goldenwater.id.util.UuidUtil;
- 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.transaction.annotation.Transactional;
- 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.*;
- /**
- * @author lune
- * @date 2020-5-11
- */
- @Api(value = "BIS 2020浙江农村饮水工程登记表2管理",tags="BIS 2020浙江农村饮水工程登记表2管理")
- @RestController
- @RequestMapping("/bis/zhejiang/vill/rgstr")
- public class BisZhejiangVillRgstrController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisZhejiangVillRgstrService bisZhejiangVillRgstrService;
- @Autowired
- private AttAdXBaseService attAdXBaseService;
- @Autowired
- private BisInspAllObjService bisInspAllObjService;
- @Autowired
- private BisZhejiangDcuserRelVillService bisZhejiangDcuserRelVillService;
- @Autowired
- private BisZhejiangCountryFeeService bisZhejiangCountryFeeService;
- @Autowired
- private BisInspAllObjDao inspAllObjDao;
- @Autowired
- private BisInspPblmDao bisInspPblmDao;
- @Autowired
- private OlBisInspOrgService olBisInspOrgService;
- @Autowired
- private AttAdXBaseDao attAdXBaseDao;
- @ApiOperation(value = "添加/修改2020浙江农村饮水工程登记表2")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisZhejiangVillRgstr> insert(@ApiParam(name = "bisNewVillRgstr", value = "bisNewVillRgstr", required = true) @RequestBody BisZhejiangVillRgstr bisNewVillRgstr) {
- bisNewVillRgstr.setUptm(new Date());
- if (bisNewVillRgstr.getLgtd() != null && bisNewVillRgstr.getLttd() !=null) {
- if (bisNewVillRgstr.getLgtd().intValue() != 0 && bisNewVillRgstr.getLttd().intValue() != 0) {
- Map<String, Double> map = GeoUtil.gcj02towgs84(bisNewVillRgstr.getLgtd(), bisNewVillRgstr.getLttd());
- bisNewVillRgstr.setLgtdpc(map.get("long"));
- bisNewVillRgstr.setLttdpc(map.get("lat"));
- }
- }
- if(StringUtils.isBlank(bisNewVillRgstr.getId())) {
- String uuid = UuidUtil.uuid(); // 生成uuid
- bisNewVillRgstr.setId(uuid);
- bisZhejiangVillRgstrService.insert(bisNewVillRgstr);
- }else{
- bisZhejiangVillRgstrService.update(bisNewVillRgstr);
- }
- return buildSuccessResponse(bisNewVillRgstr);
- }
- @ApiOperation(value = "根据ID删除2020浙江农村饮水工程登记表2")
- @RequestMapping(value = "/del/{objId}", method = RequestMethod.GET)
- @Transactional
- public BaseResponse delete(@ApiParam(name = "objId", value = "objId", required = true) @PathVariable String objId) {
- bisInspAllObjService.delete(objId);
- BisZhejiangVillRgstrParam villRgstrParam=new BisZhejiangVillRgstrParam();
- villRgstrParam.setObjId(objId);
- BisZhejiangVillRgstr villRgstr=bisZhejiangVillRgstrService.getBy(villRgstrParam);
- bisZhejiangVillRgstrService.deleteBy(villRgstrParam);
- BisZhejiangDcuserRelVillParam newDcuserRelVillParam=new BisZhejiangDcuserRelVillParam();
- newDcuserRelVillParam.setRgstrId(villRgstr.getId());
- bisZhejiangDcuserRelVillService.deleteBy(newDcuserRelVillParam);
- BisZhejiangCountryFeeParam newCountryFeeParam=new BisZhejiangCountryFeeParam();
- newCountryFeeParam.setRgstrId(villRgstr.getId());
- bisZhejiangCountryFeeService.deleteBy(newCountryFeeParam);
- BisInspPblmParam bisInspPblmParam=new BisInspPblmParam();
- bisInspPblmParam.setRegid(objId);
- bisInspPblmParam.setRegid(villRgstr.getId());
- bisInspPblmDao.deleteBy(bisInspPblmParam);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "2020农村饮水批量添加督查对象")
- @RequestMapping(value = "/addBatch", method = RequestMethod.POST)
- public BaseResponse<Object> addBatch(@ApiParam(name = "villAddDtoList", value = "villAddDtoList", required = true) @RequestBody List<VillAddDto> villAddDtoList) {
- for(VillAddDto villAddDto:villAddDtoList) {
- if(StringUtils.isNotBlank(villAddDto.getObjId())){
- BisInspAllObjParam inspAllObjParam=new BisInspAllObjParam();
- inspAllObjParam.setId(villAddDto.getId());
- inspAllObjParam.setCode(villAddDto.getAdCode());
- BisInspAllObj bisInspAllObjExt=bisInspAllObjService.getBy(inspAllObjParam);
- if(bisInspAllObjExt !=null){
- continue;
- }
- }
- AttAdXBase attAdXBase = attAdXBaseService.get(villAddDto.getAdCode());
- BisInspAllObj bisInspAllObj=new BisInspAllObj();
- bisInspAllObj.setId(villAddDto.getId());
- bisInspAllObj.setNm(attAdXBase.getAdName());
- bisInspAllObj.setPtype(BisInspEnum.VILLZHEJIANG.getValue());
- String objId=UuidUtil.uuid();
- bisInspAllObj.setObjId(objId);
- bisInspAllObj.setCode(villAddDto.getAdCode());
- bisInspAllObj.setLttdpc(attAdXBase.getLttdpc());
- bisInspAllObj.setLgtdpc(attAdXBase.getLgtdpc());
- bisInspAllObj.setLgtd(attAdXBase.getLgtd());
- bisInspAllObj.setLttd(attAdXBase.getLttd());
- bisInspAllObjService.insert(bisInspAllObj);
- BisZhejiangVillRgstr bisNewVillRgstr=new BisZhejiangVillRgstr();
- bisNewVillRgstr.setId(UuidUtil.uuid());
- bisNewVillRgstr.setPersId(getCurrentPersId());
- bisNewVillRgstr.setIsPkx(attAdXBase.getIsPoveryt());
- bisNewVillRgstr.setObjId(objId);
- bisNewVillRgstr.setRegsNm(attAdXBase.getAdName());
- bisNewVillRgstr.setState("0");
- bisNewVillRgstr.setLttdpc(attAdXBase.getLttdpc());
- bisNewVillRgstr.setLgtdpc(attAdXBase.getLgtdpc());
- bisNewVillRgstr.setLgtd(attAdXBase.getLgtd());
- bisNewVillRgstr.setLttd(attAdXBase.getLttd());
- bisNewVillRgstr.setAdFullName(attAdXBase.getAdFullName());
- bisNewVillRgstr.setAdCode(attAdXBase.getAdCode());
- bisNewVillRgstr.setUptm(new Date());
- bisNewVillRgstr.setIntm(new Date());
- bisZhejiangVillRgstrService.insert(bisNewVillRgstr);
- }
- return buildSuccessResponse(villAddDtoList);
- }
- @ApiOperation(value = "根据ID获取2020农村饮水工程登记表(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisZhejiangVillRgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisZhejiangVillRgstr bisNewVillRgstr = bisZhejiangVillRgstrService.get(id);
- if(bisNewVillRgstr!=null) {
- BisInspAllObjParam inspAllObjParam = new BisInspAllObjParam();
- inspAllObjParam.setObjId(bisNewVillRgstr.getObjId());
- BisInspAllObj allObj = inspAllObjDao.getBy(inspAllObjParam);
- String planId = allObj.getId();
- bisNewVillRgstr.setPlanId(planId);
- }
- return buildSuccessResponse(bisNewVillRgstr);
- }
- @ApiOperation(value = "获取2020农村饮水工程登记表(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisZhejiangVillRgstr>> list(@ApiParam(name = "bisNewVillRgstrParam", value = "bisNewVillRgstrParam", required = true) @RequestBody BisZhejiangVillRgstrParam bisNewVillRgstrParam) {
- List<BisZhejiangVillRgstr> bisNewVillRgstrList = bisZhejiangVillRgstrService.findList(bisNewVillRgstrParam);
- return buildSuccessResponse(bisNewVillRgstrList);
- }
- @ApiOperation(value = "获取2020农村饮水工程登记表(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisZhejiangVillRgstr>> page(@ApiParam(name = "bisNewVillRgstrParam", value = "bisNewVillRgstrParam", required = true) @RequestBody BisZhejiangVillRgstrParam bisNewVillRgstrParam) {
- PageInfo<BisZhejiangVillRgstr> bisNewVillRgstrList = bisZhejiangVillRgstrService.findPageInfo(bisNewVillRgstrParam);
- return buildSuccessResponse(bisNewVillRgstrList);
- }
- @ApiOperation(value = "添加行政村县下镇(乡)--村树节点,code为县code")
- @RequestMapping(value = "/findCheckTree/{code}/{regstrId}", method = RequestMethod.GET)
- public BaseResponse<List<AttCountryDto>> findCheckTree(
- @ApiParam(name = "code", value = "code", required = true) @PathVariable String code,
- @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId
- ){
- if(code.length()>6){
- code=code.substring(0,6);
- }
- // code=code.replace("00","");
- List<AttCountryDto> zhenDtoList=attAdXBaseDao.findXZCZhenList(code);
- List<AttCountryDto> countryDtoList=attAdXBaseDao.findXZCCunList(code,regstrId,BisInspEnum.VILLZHEJIANG.getValue());
- for(AttCountryDto attCountryDto:zhenDtoList){
- String adCode=attCountryDto.getAdCode().replace("000","");
- List<AttCountryDto> childList=new ArrayList<>();
- for(AttCountryDto countryDto:countryDtoList){
- if(countryDto.getAdCode().startsWith(adCode)){
- childList.add(countryDto);
- }
- }
- attCountryDto.setAttCountryDtoList(childList);
- }
- return buildSuccessResponse(zhenDtoList);
- }
- @ApiOperation(value = "获取督查中县-镇(乡)--村树节点")
- @RequestMapping(value = "/findTree/{code}/{regstrId}", method = RequestMethod.GET)
- public BaseResponse<List<BisNewDcuserRelVillDto>> findTree(
- @ApiParam(name = "code", value = "code", required = true) @PathVariable String code,
- @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId) {
- //获取镇,乡
- if(code.length()==12){
- code=code.substring(0,6);
- }
- List<BisNewDcuserRelVillDto> attAdXBaseList= attAdXBaseService.findZhenList(code,regstrId,BisInspEnum.VILLZHEJIANG.getValue());
- return buildSuccessResponse(attAdXBaseList);
- }
- @ApiOperation(value = "获取县-镇(乡)--村用水户和饮水工程列表")
- @RequestMapping(value = "/findNode/{code}/{regstrId}", method = RequestMethod.GET)
- public BaseResponse<Object> findNode(
- @ApiParam(name = "code", value = "code", required = true) @PathVariable String code,
- @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId) {
- //获取镇,乡
- Map<String,Object> map=new HashMap<>();
- if(code.length()==12 && code.endsWith("000")){
- code=code.substring(0,9);
- }
- BisZhejiangCountryFeeParam countryFeeParam=new BisZhejiangCountryFeeParam();
- countryFeeParam.setAdCode(code);
- countryFeeParam.setRgstrId(regstrId);
- List<BisZhejiangCountryFee> countryFeeList=bisZhejiangCountryFeeService.findList(countryFeeParam);
- map.put("countryPro",countryFeeList);
- return buildSuccessResponse(map);
- }
- @ApiOperation(value = "查询未被督查的县")
- @RequestMapping(value = "/pageNotAddRegstr", method = RequestMethod.POST)
- public BaseResponse<PageInfo<AttCountryDto>> pageNotAddRegstr(@ApiParam(name = "commonParam", value = "commonParam", required = true) @RequestBody CommonParam commonParam) {
- String adCode=commonParam.getAdCode();
- if(StringUtils.isNotBlank(adCode)) {
- if(adCode.length()>6) {
- adCode = adCode.substring(0,6);
- }
- if(adCode.length()==2){
- adCode=adCode+"____000000";
- }
- if(adCode.length()==4){
- adCode=adCode+"__000000";
- }
- commonParam.setAdCode(adCode);
- }
- commonParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
- PageInfo<AttCountryDto> bisNewVillRgstrList = bisZhejiangVillRgstrService.pageNotAddRegstr(commonParam);
- return buildSuccessResponse(bisNewVillRgstrList);
- }
- @ApiOperation(value = "问题栏目:问题列表根据当前登录用户id获取需要督查问题列表")
- @RequestMapping(value = "/list/{persId}", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspPblm>> list(@ApiParam(name = "persId", value = "persId", required = true) @PathVariable String persId
- , @RequestBody(required = false) PlbmParam pblmParam) {
- pblmParam.setPresId(persId);
- pblmParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
- PageInfo<BisInspPblm> inspPblmList = bisZhejiangVillRgstrService.findPageList(pblmParam);
- return buildSuccessResponse(inspPblmList);
- }
- @ApiOperation(value = "获取登记表数据pc端")
- @RequestMapping(value = "/findPageByType", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisNewVillRgstrDto>> findPageByType(@RequestBody(required = false) TypeParam typeParam) {
- typeParam.setPresId(getCurrentPersId());
- typeParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
- PageInfo<BisNewVillRgstrDto> villRgstrDtoPageInfo=bisZhejiangVillRgstrService.findPageByType(typeParam);
- return buildSuccessResponse(villRgstrDtoPageInfo);
- }
- }
|