| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- 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.BisInspEnum;
- import cn.com.goldenwater.dcproj.constValue.CommonLabel;
- 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.dcproj.utils.GeoUtil;
- import cn.com.goldenwater.id.util.UuidUtil;
- import cn.com.goldenwater.util.common.SqlUtils;
- 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.transaction.annotation.Transactional;
- import org.springframework.web.bind.annotation.*;
- import java.text.SimpleDateFormat;
- import java.util.*;
- /**
- * @author lune
- * @date 2020-3-27
- */
- @Api(value = "BIS 2020农村饮水工程登记表管理", tags = "BIS 2020农村饮水工程登记表管理")
- @RestController
- @RequestMapping("/bis/new/vill/rgstr")
- public class BisNewVillRgstrController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisNewVillRgstrService bisNewVillRgstrService;
- @Autowired
- private AttAdXBaseDao attAdXBaseDao;
- @Autowired
- private AttAdXBaseService attAdXBaseService;
- @Autowired
- private BisInspAllObjService bisInspAllObjService;
- @Autowired
- private BisNewCountryFeeService bisNewCountryFeeService;
- @Autowired
- private BisNewDcuserRelVillService bisNewDcuserRelVillService;
- @Autowired
- private BisNewWateruserInfoService bisNewWateruserInfoService;
- @Autowired
- private BisInspAllObjDao inspAllObjDao;
- @Autowired
- private BisInspPblmDao bisInspPblmDao;
- @ApiOperation(value = "添加/修改2020农村饮水工程登记表")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisNewVillRgstr> insert(@ApiParam(name = "bisNewVillRgstr", value = "BisNewVillRgstr", required = true) @RequestBody BisNewVillRgstr 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();
- bisNewVillRgstr.setId(uuid);
- bisNewVillRgstrService.insert(bisNewVillRgstr);
- } else {
- bisNewVillRgstrService.update(bisNewVillRgstr);
- }
- return buildSuccessResponse(bisNewVillRgstr);
- }
- @ApiOperation(value = "根据ID删除2020农饮督查对象,id未objId")
- @RequestMapping(value = "/del/{objId}", method = RequestMethod.GET)
- @Transactional
- public BaseResponse delete(@ApiParam(name = "objId", value = "objId", required = true) @PathVariable String objId) {
- bisInspAllObjService.delete(objId);
- BisNewVillRgstrParam villRgstrParam = new BisNewVillRgstrParam();
- villRgstrParam.setObjId(objId);
- BisNewVillRgstr villRgstr = bisNewVillRgstrService.getBy(villRgstrParam);
- bisNewVillRgstrService.deleteBy(villRgstrParam);
- BisNewDcuserRelVillParam newDcuserRelVillParam = new BisNewDcuserRelVillParam();
- newDcuserRelVillParam.setRegstrId(villRgstr.getId());
- bisNewDcuserRelVillService.deleteBy(newDcuserRelVillParam);
- BisNewWateruserInfoParam newWateruserInfoParam = new BisNewWateruserInfoParam();
- newWateruserInfoParam.setRegstrId(villRgstr.getId());
- bisNewWateruserInfoService.deleteBy(newWateruserInfoParam);
- BisNewCountryFeeParam newCountryFeeParam = new BisNewCountryFeeParam();
- newCountryFeeParam.setRegstrId(villRgstr.getId());
- bisNewCountryFeeService.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.VILL2020.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);
- BisNewVillRgstr bisNewVillRgstr = new BisNewVillRgstr();
- 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());
- bisNewVillRgstr.setWaterPriceIsMade("0");
- bisNewVillRgstrService.insert(bisNewVillRgstr);
- }
- return buildSuccessResponse(villAddDtoList);
- }
- @ApiOperation(value = "根据ID获取2020农村饮水工程登记表(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisNewVillRgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisNewVillRgstr bisNewVillRgstr = bisNewVillRgstrService.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<BisNewVillRgstr>> list(@ApiParam(name = "bisNewVillRgstrParam", value = "bisNewVillRgstrParam", required = true) @RequestBody BisNewVillRgstrParam bisNewVillRgstrParam) {
- List<BisNewVillRgstr> bisNewVillRgstrList = bisNewVillRgstrService.findList(bisNewVillRgstrParam);
- return buildSuccessResponse(bisNewVillRgstrList);
- }
- @ApiOperation(value = "获取2020农村饮水工程登记表(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisNewVillRgstr>> page(@ApiParam(name = "bisNewVillRgstrParam", value = "bisNewVillRgstrParam", required = true) @RequestBody BisNewVillRgstrParam bisNewVillRgstrParam) {
- PageInfo<BisNewVillRgstr> bisNewVillRgstrList = bisNewVillRgstrService.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() == 12) {
- code = code.substring(0, 6);
- }
- List<AttCountryDto> zhenDtoList = attAdXBaseDao.findXZCZhenList(code);
- List<AttCountryDto> countryDtoList = attAdXBaseDao.findXZCCunList(code, regstrId, BisInspEnum.VILL2020.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.VILL2020.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<>();
- BisNewWateruserInfoParam wateruserInfoParam = new BisNewWateruserInfoParam();
- wateruserInfoParam.setRegstrId(regstrId);
- if (code.length() == 12 && code.endsWith("000")) {
- code = code.substring(0, 9);
- }
- wateruserInfoParam.setAdCode(code);
- List<BisNewWateruserInfo> wateruserInfos = bisNewWateruserInfoService.findList(wateruserInfoParam);
- BisNewCountryFeeParam countryFeeParam = new BisNewCountryFeeParam();
- countryFeeParam.setAdCode(code);
- countryFeeParam.setRegstrId(regstrId);
- List<BisNewCountryFee> countryFeeList = bisNewCountryFeeService.findList(countryFeeParam);
- map.put("waterUsers", wateruserInfos);
- 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.endsWith("00000000")) {
- adCode = adCode.substring(0, 8);
- adCode = adCode + "__000000";
- }
- if (adCode.endsWith("0000000000")) {
- adCode = adCode.substring(0, 10);
- adCode = adCode + "____000000";
- }
- commonParam.setAdCode(adCode);
- }
- PageInfo<AttCountryDto> bisNewVillRgstrList = bisNewVillRgstrService.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 = bisNewVillRgstrService.findPageList(pblmParam);
- return buildSuccessResponse(inspPblmList);
- }
- @Autowired
- private OlBisInspOrgService olBisInspOrgService;
- @ApiOperation(value = "获取登记表数据pc端")
- @RequestMapping(value = "/findPageByType", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisNewVillRgstrDto>> findPageByType(@RequestBody(required = false) TypeParam typeParam) {
- typeParam.setPresId(getCurrentPersId());
- if (StringUtils.isBlank(typeParam.getTabType())) {
- typeParam.setTabType(CommonLabel.TAB_TYPE);
- }
- String nowTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
- typeParam.setNowTime(nowTime);
- typeParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
- typeParam.setInIdsSql(SqlUtils.getinIdsSql(getCurrentPersId(), typeParam.getProvince()));
- PageInfo<BisNewVillRgstrDto> villRgstrDtoPageInfo = bisNewVillRgstrService.findPageByType(typeParam);
- return buildSuccessResponse(villRgstrDtoPageInfo);
- }
- }
|