package cn.com.goldenwater.dcproj.controller.tac; 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.dao.TacObjSubject515Dao; import cn.com.goldenwater.dcproj.dto.TacCountDto; import cn.com.goldenwater.dcproj.dto.TacPblmInfoDto; import cn.com.goldenwater.dcproj.model.*; import cn.com.goldenwater.dcproj.param.GwComFileParam; import cn.com.goldenwater.dcproj.param.TacPblmInfoParam; import cn.com.goldenwater.dcproj.param.TacPblmSubjectParam; import cn.com.goldenwater.dcproj.service.*; 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.transaction.annotation.Transactional; import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * @author lune * @date 2019-6-19 */ @Api(value = "TAC 稽察问题信息表管理", tags = "TAC 稽察问题信息表管理") @RestController @RequestMapping("/tac/pblm/info") public class TacPblmInfoController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private TacPblmInfoService tacPblmInfoService; @Autowired private TacPblmSubjectService tacPblmSubjectService; @Autowired private TacObjPblmstbService tacObjPblmstbService; @Autowired private TacObjSubjectService tacObjSubjectService; @Autowired private GwComFileService gwComFileService; @Autowired private OlBisInspOrgService olBisInspOrgService; @Autowired private TacPawpRgstrService pawpRgstrService; @Autowired private TacObjSubject515Dao tacObjSubject515Dao; /** * 稽查业务--稽查填报 添加问题 法律条款 法规内容 从问题清单 带过来 , * 保存 专家编辑后的内容 ,存入 问题表 tac_pblm_info 的冗余字段 :法律条款、法规内容 * * @param tacPblmInfo * @return * @date 2023/01/28 */ @ApiOperation(value = "添加/修改稽察问题信息表") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "tacPblmInfo", value = "TacPblmInfo", required = true) @RequestBody TacPblmInfo tacPblmInfo) { tacPblmInfo.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); // if(StringUtils.isBlank(tacPblmInfo.getPblmReason())){ // return buildFailResponse("原因分析必填"); // } // if(StringUtils.isBlank(tacPblmInfo.getPblmSggtn())){ // return buildFailResponse("意见建议必填"); // } if (StringUtils.isNotBlank(tacPblmInfo.getId())) { tacPblmInfo.setUptm(new Date()); tacPblmInfoService.updatePblm(tacPblmInfo); } else { String key = getCurrentPersId() + "_pblm_info"; synchronized (this) { if (!pawpRgstrService.suoding(key)) { return buildFailResponse("操作太频繁,请等会儿再操作"); } } if (StringUtils.isBlank(tacPblmInfo.getIfCasePblm())) { tacPblmInfo.setIfCasePblm("0"); } String uuid = UuidUtil.uuid(); tacPblmInfo.setId(uuid); tacPblmInfo.setIntm(new Date()); tacPblmInfo.setDataStat(StateEnum.NOWASTSTATE.getKey()); tacPblmInfoService.insertPblm(tacPblmInfo); } return buildSuccessResponse(tacPblmInfo); } @ApiOperation(value = "根据问题id锁定问题,让专家修改") @RequestMapping(value = "/rect/{id}", method = RequestMethod.GET) @Transactional(rollbackFor = Exception.class) public BaseResponse rect(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { String key = id + "_rect"; synchronized (this) { if (!pawpRgstrService.suoding(key)) { return buildFailResponse("操作太频繁,请等会儿再操作"); } } TacPblmInfo pblmInfo = tacPblmInfoService.get(id); if (pblmInfo == null) { return buildFailResponse("数据不存在,不支持问题锁定"); } String rgstrId = pblmInfo.getRgstrId(); if (!rgstrId.contains("_")) { return buildFailResponse("当前阶段问题不能再回退"); } String[] arrays = rgstrId.split("_"); String newRegistrId = arrays[0] + "_8"; pblmInfo.setRgstrId(newRegistrId); pblmInfo.setId(UuidUtil.uuid()); tacPblmInfoService.insert(pblmInfo); List comFiles = gwComFileService.findFileByBiz(id); if (comFiles != null && !comFiles.isEmpty()) { for (GwComFile comFile : comFiles) { comFile.setBizId(pblmInfo.getId()); comFile.setId(UuidUtil.uuid()); gwComFileService.insert(comFile); } } pawpRgstrService.addUnitSctn(rgstrId, newRegistrId); tacPblmInfoService.delete(id); GwComFileParam comFileParam = new GwComFileParam(); comFileParam.setBizId(id); gwComFileService.deleteBy(comFileParam); return buildSuccessResponse(pblmInfo); } @ApiOperation(value = "根据问题id锁定问题,让专家修改列表") @RequestMapping(value = "/rectList", method = RequestMethod.GET) public BaseResponse rectList(@RequestBody TacPblmInfoParam pblmInfoParam) { BisInspAllRlationPers pers = rlationPersService.get(getCurrentPersId()); if (pers == null) { return null; } pblmInfoParam.setPersId(getCurrentPersId()); if ("1".equals(pers.getPersType()) || "2".equals(pers.getPersType())) { pblmInfoParam.setPersId(""); } pblmInfoParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); pblmInfoParam.setRgstrId("_8"); List tacWorkerBList = workerBService.findPerInZLOrTPY(getCurrentPersId()); if (tacWorkerBList != null && !tacWorkerBList.isEmpty()) { return buildSuccessResponse(tacPblmInfoService.findPageJieduanZLorTPY(pblmInfoParam)); } return buildSuccessResponse(tacPblmInfoService.findPageJieduanInfo(pblmInfoParam)); } @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 = tacPblmInfoService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "更新稽察问题信息表信息") @RequestMapping(value = "/update", method = RequestMethod.POST) public BaseResponse update(@ApiParam(name = "tacPblmInfo", value = "TacPblmInfo", required = true) @RequestBody TacPblmInfo tacPblmInfo) { Assert.notNull(tacPblmInfo.getId(), "主键id为必填参数"); tacPblmInfo.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); int ret = tacPblmInfoService.update(tacPblmInfo); return buildSuccessResponse(tacPblmInfo); } /** * 获取稽查填报--问题详情的 时候,法律条款、法规内容 取专家编辑后的值,编辑时不允许修改 * tac_pblm_info 的字段 :法律条款 RELATIVE_LAW、法规内容 LAW_CONTENT * @param id * @return */ @ApiOperation(value = "根据ID获取稽察问题信息表(单表)详情,包括主体单位,标准库信息等") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { TacPblmInfo tacPblmInfo = tacPblmInfoService.get(id); if (tacPblmInfo != null) { TacPblmSubjectParam pblmSubjectParam = new TacPblmSubjectParam(); pblmSubjectParam.setPblmId(id); List pblmSubjectList = tacPblmSubjectService.findList(pblmSubjectParam); if (pblmSubjectList != null && !pblmSubjectList.isEmpty()) { tacPblmInfo.setPblmSubjectList(pblmSubjectList); } else { pblmSubjectList = new ArrayList<>(); if (StringUtils.isNotBlank(tacPblmInfo.getSubjectNames())) { String[] subjects = tacPblmInfo.getSubjectNames().split(","); String[] subjeids = tacPblmInfo.getSubjectIds().split(","); for (int i = 0; i < subjects.length; i++) { TacObjSubject objSubject = tacObjSubjectService.get(subjeids[i]); if (objSubject == null) { objSubject = tacObjSubject515Dao.get(subjeids[i]); } if (objSubject != null) { TacPblmSubject subject = new TacPblmSubject(); subject.setPblmId(tacPblmInfo.getId()); subject.setSubId(subjeids[i]); subject.setSubName(objSubject.getSubName()); subject.setIntm(new Date()); subject.setUnitNm(subjects[i]); pblmSubjectList.add(subject); } } tacPblmInfo.setPblmSubjectList(pblmSubjectList); } } if (StringUtils.isNotBlank(tacPblmInfo.getPblmstdId())) { TacObjPblmstb objPblmstb = tacObjPblmstbService.getOne(tacPblmInfo.getPblmstdId()); tacPblmInfo.setTacObjPblmstb(objPblmstb); } tacPblmInfo.setGwComFileList(gwComFileService.findFileByBiz(id)); } return buildSuccessResponse(tacPblmInfo); } @ApiOperation(value = "分页查询稽察问题清单") @RequestMapping(value = "/page", method = RequestMethod.POST) public BaseResponse> page(@RequestBody TacPblmInfoParam pblmInfoParam) { pblmInfoParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); return buildSuccessResponse(getpageInfo(pblmInfoParam)); } @ApiOperation(value = "分页查询稽察问题清单-成果") @RequestMapping(value = "/pagecg", method = RequestMethod.POST) public BaseResponse> pageCg(@RequestBody TacPblmInfoParam pblmInfoParam) { String province = olBisInspOrgService.getRlProvince(getCurrentOrgId()); pblmInfoParam.setProvince(province); return buildSuccessResponse(tacPblmInfoService.findPageJieduanInfo(pblmInfoParam)); } @Autowired private TacWorkerBService workerBService; @Autowired private BisInspAllRlationPersService rlationPersService; @ApiOperation(value = "分页查询稽察问题清单-手机app稽察问题") @RequestMapping(value = "/pageNew", method = RequestMethod.POST) public BaseResponse> pageNew(@RequestBody TacPblmInfoParam pblmInfoParam) { String province = olBisInspOrgService.getRlProvince(getCurrentOrgId()); pblmInfoParam.setProvince(province); return buildSuccessResponse(getpageInfo(pblmInfoParam)); } private PageInfo getpageInfo(TacPblmInfoParam pblmInfoParam) { BisInspAllRlationPers pers = rlationPersService.get(getCurrentPersId()); if (pers == null) { return null; } pblmInfoParam.setPersId(getCurrentPersId()); //管理员 PageInfo tacPawpRgstr = new PageInfo<>(); if ("1".equals(pers.getPersType()) || "2".equals(pers.getPersType())) { pblmInfoParam.setPersId(""); tacPawpRgstr = tacPblmInfoService.findPageInfoNew(pblmInfoParam); return tacPawpRgstr; } //助理 List tacWorkerBList = workerBService.findPerInZLOrTPY(getCurrentPersId()); if (tacWorkerBList == null || tacWorkerBList.isEmpty()) { tacPawpRgstr = tacPblmInfoService.findPageInfo(pblmInfoParam); } else { tacPawpRgstr = tacPblmInfoService.findPageInfoZLorTPY(pblmInfoParam); } return tacPawpRgstr; } @ApiOperation(value = "稽察问题统计 - 统计分类") @RequestMapping(value = "/countPblmInfoByType", method = RequestMethod.POST) public BaseResponse> countPblmInfoByType(@RequestBody TacPblmInfoParam pblmInfoParam) { pblmInfoParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); List list = tacPblmInfoService.countPblmInfoByType(pblmInfoParam); return buildSuccessResponse(list); } @ApiOperation(value = "稽察问题统计-- 责任主体") @RequestMapping(value = "/countPblmInfoBySub", method = RequestMethod.POST) public BaseResponse> countPblmInfoBySub(@RequestBody TacPblmInfoParam pblmInfoParam) { pblmInfoParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); List list = tacPblmInfoService.countPblmInfoBySub(pblmInfoParam); return buildSuccessResponse(list); } @ApiOperation(value = "稽察问题统计新-- 责任主体(对应新阶段流程信息)") @RequestMapping(value = "/countPblmInfoBySubNew", method = RequestMethod.POST) public BaseResponse> countPblmInfoBySubNew(@RequestBody TacPblmInfoParam pblmInfoParam) { pblmInfoParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); pblmInfoParam.setYear(Long.parseLong(pblmInfoParam.getYears())); List list = tacPblmInfoService.countPblmInfoBySubNew(pblmInfoParam); return buildSuccessResponse(list); } @ApiOperation(value = "稽察问题统计-- 行政区划") @RequestMapping(value = "/countPblmInfoByAdCode", method = RequestMethod.POST) public BaseResponse> countPblmInfoByAdCode(@RequestBody TacPblmInfoParam pblmInfoParam) { pblmInfoParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); List list = tacPblmInfoService.countPblmInfoByAdCode(pblmInfoParam); return buildSuccessResponse(list); } @ApiOperation(value = "稽察问题统计新-- 所在省份地市(对应新阶段流程信息)") @RequestMapping(value = "/countPblmInfoByAdCodeNew", method = RequestMethod.POST) public BaseResponse> countPblmInfoByAdCodeNew(@RequestBody TacPblmInfoParam pblmInfoParam) { pblmInfoParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); List list = tacPblmInfoService.countPblmInfoByAdCodeNew(pblmInfoParam); return buildSuccessResponse(list); } @ApiOperation(value = "稽察问题统计-- 标准库") @RequestMapping(value = "/countPblmInfoByStb", method = RequestMethod.POST) public BaseResponse> countPblmInfoByStb(@RequestBody TacPblmInfoParam pblmInfoParam) { pblmInfoParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); List list = tacPblmInfoService.countPblmInfoByStb(pblmInfoParam); return buildSuccessResponse(list); } @ApiOperation(value = "批量修改问题") @RequestMapping(value = "/updatePblmInfoList", method = RequestMethod.POST) public BaseResponse updatePblmInfoList(@RequestBody TacPblmInfoDto dto) { int a = tacPblmInfoService.updatePblmInfoList(dto); return buildSuccessResponse(); } @ApiOperation(value = "统计典型问题") @RequestMapping(value = "/countPblmInfoByCase", method = RequestMethod.POST) public BaseResponse> countPblmInfoByCase(@RequestBody TacPblmInfoParam pblmInfoParam) { List list = tacPblmInfoService.countPblmInfoByCase(pblmInfoParam); return buildSuccessResponse(list); } @Deprecated @ApiOperation(value = "统计问题发生频度") @RequestMapping(value = "/countPblmInfoByQlttv", method = RequestMethod.POST) public BaseResponse> countPblmInfoByQlttv(@RequestBody TacPblmInfoParam pblmInfoParam) { List list = tacPblmInfoService.countPblmInfoByQlttv(pblmInfoParam); return buildSuccessResponse(list); } @ApiOperation(value = "问题发生频度第一个接口,统计问题数或项目数") @RequestMapping(value = "/countPblmInfoByQt", method = RequestMethod.POST) public BaseResponse> countPblmInfoByQt(@RequestBody TacPblmInfoParam pblmInfoParam) { List list = tacPblmInfoService.countPblmInfoByQt(pblmInfoParam); return buildSuccessResponse(list); } @ApiOperation(value = "问题发生频度新第一个接口,统计问题数或项目数(对应新阶段流程信息)") @RequestMapping(value = "/countPblmInfoByQtNew", method = RequestMethod.POST) public BaseResponse> countPblmInfoByQtNew(@RequestBody TacPblmInfoParam pblmInfoParam) { pblmInfoParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); List list = tacPblmInfoService.countPblmInfoByQtNew(pblmInfoParam); return buildSuccessResponse(list); } @ApiOperation(value = "问题发生频度第二个接口,统计问题数或项目数 问题分类最大值") @RequestMapping(value = "/countPblmInfoMaxByQt", method = RequestMethod.POST) public BaseResponse> countPblmInfoMaxByQt(@RequestBody TacPblmInfoParam pblmInfoParam) { List list = tacPblmInfoService.countPblmInfoMaxByQt(pblmInfoParam); return buildSuccessResponse(list); } @ApiOperation(value = "问题发生频度新第二个接口,统计问题数或项目数 问题分类最大值(对应新阶段流程信息)") @RequestMapping(value = "/countPblmInfoMaxByQtNew", method = RequestMethod.POST) public BaseResponse> countPblmInfoMaxByQtNew(@RequestBody TacPblmInfoParam pblmInfoParam) { pblmInfoParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); List list = tacPblmInfoService.countPblmInfoMaxByQtNew(pblmInfoParam); return buildSuccessResponse(list); } @ApiOperation(value = "分页查询稽察问题清单") @RequestMapping(value = "/pageObjPblm", method = RequestMethod.POST) public BaseResponse> pageObjPblm(@RequestBody TacPblmInfoParam pblmInfoParam) { String province = olBisInspOrgService.getRlProvince(getCurrentOrgId()); pblmInfoParam.setProvince(province); pblmInfoParam.setOrgId(getCurrentOrgId()); PageInfo tacPawpRgstr = tacPblmInfoService.findPageInfoNew(pblmInfoParam); return buildSuccessResponse(tacPawpRgstr); } @ApiOperation(value = "分页查询稽察问题清单") @RequestMapping(value = "/pageProvincePblm", method = RequestMethod.POST) public BaseResponse> pageProvincePblm(@RequestBody TacPblmInfoParam pblmInfoParam) { String province = olBisInspOrgService.getRlProvince(getCurrentOrgId()); pblmInfoParam.setProvince(province); pblmInfoParam.setOrgId(getCurrentOrgId()); PageInfo tacPawpRgstr = tacPblmInfoService.findProvincePblmInfo(pblmInfoParam); return buildSuccessResponse(tacPawpRgstr); } @ApiOperation(value = "问题统计-工程项目") @RequestMapping(value = "/countPblmInfoByObj", method = RequestMethod.POST) public BaseResponse> countPblmInfoByObj(@RequestBody TacPblmInfoParam pblmInfoParam) { String province = olBisInspOrgService.getRlProvince(getCurrentOrgId()); pblmInfoParam.setProvince(province); List tacCountDtos = tacPblmInfoService.countPblmInfoByObj(pblmInfoParam); return buildSuccessResponse(tacCountDtos); } @ApiOperation(value = "获取当前人员是否是当前问题所在组的组长") @RequestMapping(value = "/ifLeader/{id}", method = RequestMethod.GET) public BaseResponse ifLeader(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { List guids = tacPblmInfoService.getLeaderId(id); if(!CollectionUtils.isEmpty(guids) && guids.contains(getCurrentPersId())){ return buildSuccessResponse(true); } return buildSuccessResponse(false); } }