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.dao.TacObjSubject515Dao; import cn.com.goldenwater.dcproj.model.*; import cn.com.goldenwater.dcproj.param.TacObjPblmHbParam; import cn.com.goldenwater.dcproj.param.TacObjPblmstbHbParam; import cn.com.goldenwater.dcproj.param.TacPblmSubjectParam; import cn.com.goldenwater.dcproj.service.*; 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.util.Assert; import org.springframework.web.bind.annotation.*; import java.util.*; /** * @author lhc * @date 2024-11-26 */ @Api(value = "xxx管理",tags="xxx管理") @RestController @RequestMapping("/tac/obj/pblm/hb") public class TacObjPblmHbController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private TacObjPblmHbService tacObjPblmHbService; @Autowired private TacObjPblmstbHbService tacObjPblmstbHbService; @Autowired private TacPblmInfoService tacPblmInfoService; @Autowired private TacPblmSubjectService tacPblmSubjectService; @Autowired private TacObjSubjectService tacObjSubjectService; @Autowired private TacObjSubject515Dao tacObjSubject515Dao; @Autowired private TacObjPblmstbService tacObjPblmstbService; @Autowired private GwComFileService gwComFileService; @ApiOperation(value = "添加数据到必查清单填报表") @RequestMapping(value = "/insert", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "tacObjPblmHb", value = "TacObjPblmHb", required = true) @RequestBody TacObjPblmHb tacObjPblmHb) { if (org.apache.commons.lang3.StringUtils.isBlank(tacObjPblmHb.getPersId())) { String persId = this.getCurrentPersId(); tacObjPblmHb.setPersId(persId); } TacObjPblmHbParam tacObjPblmHbParam = new TacObjPblmHbParam(); tacObjPblmHbParam.setObjId(tacObjPblmHb.getObjId()); List list = tacObjPblmHbService.getListData(tacObjPblmHbParam); List mustList = tacObjPblmstbHbService.getPblmForm(new TacObjPblmstbHbParam()); if(list!=null && list.size()>0){ for(int i=0;i> page(@RequestBody TacObjPblmHbParam pblmInfoParam) { if (org.apache.commons.lang3.StringUtils.isBlank(pblmInfoParam.getPersId())) { pblmInfoParam.setPersId(getCurrentPersId()); } PageInfo tacPawpRgstrList = tacObjPblmHbService.findPblmHbPageinfo(pblmInfoParam); return buildSuccessResponse(tacPawpRgstrList); } @ApiOperation(value = "更新必查清单信息") @RequestMapping(value = "/update", method = RequestMethod.POST) public BaseResponse update(@ApiParam(name = "tacObjPblmHb", value = "TacObjPblmHb", required = true) @RequestBody TacObjPblmHb tacObjPblmHb) { Assert.notNull(tacObjPblmHb.getId(), "主键id为必填参数"); tacObjPblmHbService.update(tacObjPblmHb); return buildSuccessResponse(tacObjPblmHb); } @ApiOperation(value = "根据ID删除必查清单") @RequestMapping(value = "delete/{id}", method = RequestMethod.GET) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = tacObjPblmHbService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "生成必查清单") @RequestMapping(value = "/page1", method = RequestMethod.POST) public BaseResponse> page1(@RequestBody TacObjPblmHbParam pblmInfoParam) { if (org.apache.commons.lang3.StringUtils.isBlank(pblmInfoParam.getPersId())) { pblmInfoParam.setPersId(getCurrentPersId()); } PageInfo tacPawpRgstrList = tacObjPblmHbService.findPblmHbPageinfo(pblmInfoParam); return buildSuccessResponse(tacPawpRgstrList); } @ApiOperation(value = "根据ID获取xxx(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { TacObjPblmHb tacObjPblmHb = tacObjPblmHbService.getfile(id); TacPblmInfo tacPblmInfo = tacPblmInfoService.get(tacObjPblmHb.getPblmId()); 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 (org.apache.commons.lang3.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); } } tacObjPblmHb.setPblmSubjectList(pblmSubjectList); } } if (StringUtils.isNotBlank(tacPblmInfo.getPblmstdId())) { TacObjPblmstb objPblmstb = tacObjPblmstbService.getOne(tacPblmInfo.getPblmstdId()); tacObjPblmHb.setTacObjPblmstb(objPblmstb); } tacObjPblmHb.setGwComFileList(gwComFileService.findFileByBiz(id)); } return buildSuccessResponse(tacObjPblmHb); } }