| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- package cn.com.goldenwater.dcproj.controller.rsvryn;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.constValue.SplitValue;
- import cn.com.goldenwater.dcproj.dao.BisInspOrgDao;
- import cn.com.goldenwater.dcproj.model.BisInspOrg;
- import cn.com.goldenwater.dcproj.model.BisInspRsvrynPblmMend;
- import cn.com.goldenwater.dcproj.model.GwComFile;
- import cn.com.goldenwater.dcproj.param.BisInspRsvrynPblmMendParam;
- import cn.com.goldenwater.dcproj.param.GwComFileParam;
- import cn.com.goldenwater.dcproj.service.BisInspRsvrynPblmMendService;
- import cn.com.goldenwater.dcproj.service.GwComFileService;
- import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
- import cn.com.goldenwater.dcproj.utils.HttpClientUtils;
- 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.beans.factory.annotation.Value;
- import org.springframework.web.bind.annotation.*;
- import javax.servlet.http.HttpServletResponse;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- /**
- * @author lune
- * @date 2020-7-7
- */
- @Api(value = "BIS 小水库问题清单整改情况管理", tags = "BIS 小水库问题清单整改情况管理")
- @RestController
- @RequestMapping("/bis/insp/rsvryn/pblm/mend")
- public class BisInspRsvrynPblmMendController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspRsvrynPblmMendService bisInspRsvrynPblmMendService;
- @Autowired
- private BisInspOrgDao bisInspOrgDao;
- @Value("${mwr.ducha.url}")
- private String quanguoUrl;
- @Autowired
- private GwComFileService gwComFileService;
- @ApiOperation(value = "添加/修改小水库问题清单整改情况")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspRsvrynPblmMend> insert(@ApiParam(name = "bisInspRsvrynPblmMend", value = "BisInspRsvrynPblmMend", required = true) @RequestBody List<BisInspRsvrynPblmMend> bisInspRsvrynPblmMendList) {
- for (BisInspRsvrynPblmMend bisInspRsvrynPblmMend : bisInspRsvrynPblmMendList) {
- bisInspRsvrynPblmMendService.update(bisInspRsvrynPblmMend);
- }
- return buildSuccessResponse();
- }
- @ApiOperation(value = "修改小水库问题清单整改情况")
- @RequestMapping(value = "/2021/update", method = RequestMethod.POST)
- public BaseResponse<BisInspRsvrynPblmMend> update2021(@ApiParam(name = "bisInspRsvrynPblmMend", value = "BisInspRsvrynPblmMend", required = true) @RequestBody BisInspRsvrynPblmMend bisInspRsvrynPblmMend) {
- if (StringUtils.isBlank(bisInspRsvrynPblmMend.getId())) {
- String uuid = UuidUtil.uuid(); // 生成uuid
- bisInspRsvrynPblmMend.setId(uuid);
- bisInspRsvrynPblmMend.setIntm(new Date());
- bisInspRsvrynPblmMendService.insert2021(bisInspRsvrynPblmMend);
- } else {
- bisInspRsvrynPblmMend.setUptm(new Date());
- int a = bisInspRsvrynPblmMendService.update2021(bisInspRsvrynPblmMend);
- }
- return buildSuccessResponse(bisInspRsvrynPblmMend);
- }
- @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 = bisInspRsvrynPblmMendService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取小水库问题清单整改情况(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspRsvrynPblmMend> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspRsvrynPblmMend bisInspRsvrynPblmMend = bisInspRsvrynPblmMendService.get(id);
- return buildSuccessResponse(bisInspRsvrynPblmMend);
- }
- @ApiOperation(value = "根据ID获取小水库问题清单整改情况(单表)及附件")
- @RequestMapping(value = "/getWithExtras", method = RequestMethod.POST)
- public BaseResponse<BisInspRsvrynPblmMend> getWithExtras(@ApiParam(name = "param", value = "param", required = true) @RequestBody GwComFileParam param) {
- BisInspRsvrynPblmMend bisInspRsvrynPblmMend = bisInspRsvrynPblmMendService.get(param.getId());
- if (bisInspRsvrynPblmMend != null){
- param.setId("");
- List<GwComFile> list = gwComFileService.findList(param);
- bisInspRsvrynPblmMend.setGwComFiles(list);
- }
- return buildSuccessResponse(bisInspRsvrynPblmMend);
- }
- @ApiOperation(value = "获取小水库问题清单整改情况(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspRsvrynPblmMend>> page(@ApiParam(name = "bisInspRsvrynPblmMendParam", value = "bisInspRsvrynPblmMendParam", required = true) @RequestBody BisInspRsvrynPblmMendParam bisInspRsvrynPblmMendParam, HttpServletResponse response) {
- //bisInspRsvrynPblmMendParam.setPersGuid(getCurrentPersId());
- bisInspRsvrynPblmMendParam.setOrgId(getCurrentOrgId());
- BisInspOrg org = bisInspOrgDao.get(bisInspRsvrynPblmMendParam.getOrgId());
- if (StringUtils.isNotBlank(org.getRlcode())) {
- bisInspRsvrynPblmMendParam.setRelCode(AdLevelUtil.SubAd(org.getRlcode()).get(SplitValue.SUBAD).toString());
- }
- PageInfo<BisInspRsvrynPblmMend> bisInspRsvrynPblmMendList = bisInspRsvrynPblmMendService.findRsvrPblmPage(bisInspRsvrynPblmMendParam);
- return buildSuccessResponse(bisInspRsvrynPblmMendList);
- }
- @ApiOperation(value = "获取小水库问题清单整改情况(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisInspRsvrynPblmMend>> list(@ApiParam(name = "bisInspRsvrynPblmMendParam", value = "bisInspRsvrynPblmMendParam", required = true) @RequestBody BisInspRsvrynPblmMendParam bisInspRsvrynPblmMendParam) {
- List<BisInspRsvrynPblmMend> bisInspRsvrynPblmMendList = bisInspRsvrynPblmMendService.findList(bisInspRsvrynPblmMendParam);
- return buildSuccessResponse(bisInspRsvrynPblmMendList);
- }
- @ApiOperation(value = "Pc获取小水库问题清单整改情况(列表--分页)")
- @RequestMapping(value = "/pagePc", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspRsvrynPblmMend>> pagePc(@ApiParam(name = "bisInspRsvrynPblmMendParam", value = "bisInspRsvrynPblmMendParam", required = true) @RequestBody BisInspRsvrynPblmMendParam bisInspRsvrynPblmMendParam, HttpServletResponse response) {
- PageInfo<BisInspRsvrynPblmMend> pc = bisInspRsvrynPblmMendService.pagerPc(bisInspRsvrynPblmMendParam);
- return buildSuccessResponse(pc);
- }
- @ApiOperation(value = "单条或批量反馈水利部")
- @RequestMapping(value = "/updateMwr", method = RequestMethod.POST)
- public BaseResponse<BisInspRsvrynPblmMend> updateMwr(@ApiParam(name = "bisInspRsvrynPblmMend", value = "BisInspRsvrynPblmMend", required = true) @RequestBody List<BisInspRsvrynPblmMend> bisInspRsvrynPblmMendList) {
- for (BisInspRsvrynPblmMend bisInspRsvrynPblmMend : bisInspRsvrynPblmMendList) {
- String url = quanguoUrl + "/bis/insp/rsvr/pblm/mend";
- Map<String, String> map = new HashMap<>();
- map.put("id", bisInspRsvrynPblmMend.getId());
- map.put("rectConc", bisInspRsvrynPblmMend.getRectConc());
- map.put("rectMsrs", bisInspRsvrynPblmMend.getRectMsrs());
- try {
- HttpClientUtils.doHttpsPost2(url, map, new HashMap());
- bisInspRsvrynPblmMend.setIsRect("2");
- } catch (Exception e) {
- logger.error("部里整改状态修改失败!:{}", e.getMessage());
- bisInspRsvrynPblmMend.setIsRect("3");//反馈失败
- } finally {
- bisInspRsvrynPblmMendService.update(bisInspRsvrynPblmMend);
- }
- }
- return buildSuccessResponse();
- }
- }
|