| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- package cn.com.goldenwater.dcproj.controller.zhejiang;
- import cn.com.goldenwater.dcproj.constValue.PlanEnum;
- import cn.com.goldenwater.dcproj.constValue.SendState;
- import cn.com.goldenwater.dcproj.dto.DepartDto;
- import cn.com.goldenwater.dcproj.dto.GroupInfoDto;
- import cn.com.goldenwater.dcproj.model.*;
- import cn.com.goldenwater.dcproj.param.BisZhejiangCheckPlanParam;
- import cn.com.goldenwater.dcproj.param.BisZhejiangCheckProcessParam;
- import cn.com.goldenwater.dcproj.param.GwComFileParam;
- 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.InspPblmUtils;
- 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.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 javax.servlet.http.HttpServletResponse;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
- /**
- * @author lune
- * @date 2020-5-12
- */
- @Api(value = "BIS 浙江监督检查工作计划表管理", tags = "BIS 浙江监督检查工作计划表管理")
- @RestController
- @RequestMapping("/bis/zhejiang/check/plan")
- public class BisZhejiangCheckPlanController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisZhejiangCheckPlanService bisZhejiangCheckPlanService;
- @Autowired
- private BisZhejiangCheckProcessService bisZhejiangCheckProcessService;
- @Autowired
- private BisInspAllRlationPersService bisInspAllRlationPersService;
- @Autowired
- private GwComFileService gwComFileService;
- @Autowired
- private BisInspAllService bisInspAllService;
- @Autowired
- private OlBisInspOrgService olBisInspOrgService;
- @Autowired
- private SupervisionPlanService supervisionPlanService;
- @ApiOperation(value = "添加/修改浙江监督检查工作计划表")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisZhejiangCheckPlan> insert(@ApiParam(name = "bisZhejiangCheckPlan", value = "BisZhejiangCheckPlan", required = true) @RequestBody BisZhejiangCheckPlan bisZhejiangCheckPlan) {
- OlBisInspOrg olBisInspOrg = olBisInspOrgService.get(getCurrentOrgId());
- BisInspAllRlationPers bisInspAllRlationPers = bisInspAllRlationPersService.get(getCurrentPersId());
- bisZhejiangCheckPlan.setPersName(bisInspAllRlationPers.getPersName());
- bisZhejiangCheckPlan.setOrgId(getCurrentOrgId());
- bisZhejiangCheckPlan.setOrgName(olBisInspOrg.getOrgNm());
- bisZhejiangCheckPlan.setFileState("0");
- bisZhejiangCheckPlan.setUptm(new Date());
- if (StringUtils.isBlank(bisZhejiangCheckPlan.getId())) {
- String uuid = UuidUtil.uuid(); // 生成uuid
- bisZhejiangCheckPlan.setId(uuid);
- bisZhejiangCheckPlan.setIntm(new Date());
- bisZhejiangCheckPlan.setState(PlanEnum.PLAN_CHECK.getKey());
- bisZhejiangCheckPlan.setIsSend(SendState.SEND_NO.getKey());
- bisZhejiangCheckPlan.setPersId(getCurrentPersId());
- bisZhejiangCheckPlanService.insert(bisZhejiangCheckPlan);
- } else {
- if (PlanEnum.PLAN_SEND.getKey().equals(bisZhejiangCheckPlan.getState())) {
- bisZhejiangCheckPlan.setIsSend(SendState.SEND.getKey());
- }
- if (SendState.SEND.getKey().equals(bisZhejiangCheckPlan.getIsSend())) {
- bisZhejiangCheckPlan.setState(PlanEnum.PLAN_SEND.getKey());
- }
- if ("2".equals(bisZhejiangCheckPlan.getState())) {
- bisZhejiangCheckPlan.setState("1");
- }
- bisZhejiangCheckPlanService.update(bisZhejiangCheckPlan);
- }
- return buildSuccessResponse(bisZhejiangCheckPlan);
- }
- @ApiOperation(value = "工作方案上传状态维护")
- @RequestMapping(value = "/modify", method = RequestMethod.POST)
- public BaseResponse<BisZhejiangCheckPlan> modify(@ApiParam(name = "bisZhejiangCheckPlan", value = "BisZhejiangCheckPlan", required = true) @RequestBody BisZhejiangCheckPlan bisZhejiangCheckPlan) throws Exception {
- bisZhejiangCheckPlan.setFileState("0");
- if (bisZhejiangCheckPlan.getGwComFileList() != null && !bisZhejiangCheckPlan.getGwComFileList().isEmpty()) {
- for (GwComFile gwComFile : bisZhejiangCheckPlan.getGwComFileList()) {
- gwComFile.setBizId(bisZhejiangCheckPlan.getId());
- gwComFileService.update(gwComFile);
- }
- bisZhejiangCheckPlan = bisZhejiangCheckPlanService.get(bisZhejiangCheckPlan.getId());
- bisZhejiangCheckPlan.setFileState("1");
- GroupInfoDto groupInfoDto = new GroupInfoDto();
- groupInfoDto.setOrgId(getCurrentOrgId());
- groupInfoDto.setPtype(bisZhejiangCheckPlan.getInspType());
- groupInfoDto.setInspMnth(bisZhejiangCheckPlan.getMonth());
- groupInfoDto.setInspYear(bisZhejiangCheckPlan.getYear());
- groupInfoDto.setEntm(bisZhejiangCheckPlan.getCheckEndDate());
- groupInfoDto.setSttm(bisZhejiangCheckPlan.getCheckSttdDate());
- groupInfoDto.setName(bisZhejiangCheckPlan.getWokerNm());
- supervisionPlanService.insertGroupInfo(groupInfoDto);
- }
- bisZhejiangCheckPlanService.update(bisZhejiangCheckPlan);
- return buildSuccessResponse(bisZhejiangCheckPlan);
- }
- @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 = bisZhejiangCheckPlanService.delete(id);
- BisZhejiangCheckProcessParam bisZhejiangCheckProcess = new BisZhejiangCheckProcessParam();
- bisZhejiangCheckProcess.setPlanId(id);
- bisZhejiangCheckProcessService.deleteBy(bisZhejiangCheckProcess);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取浙江监督检查工作方案表(单表,工作方案维护)")
- @RequestMapping(value = "/weihu/{id}", method = RequestMethod.GET)
- public BaseResponse<BisZhejiangCheckPlan> weihu(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisZhejiangCheckPlan bisZhejiangCheckPlan = bisZhejiangCheckPlanService.get(id);
- if (bisZhejiangCheckPlan != null && "1".equals(bisZhejiangCheckPlan.getFileState())) {
- GwComFileParam checkProcessParam = new GwComFileParam();
- checkProcessParam.setBizId(id);
- List<GwComFile> checkProcessList = gwComFileService.findList(checkProcessParam);
- if (checkProcessList == null) {
- checkProcessList = new ArrayList<>();
- }
- bisZhejiangCheckPlan.setGwComFileList(checkProcessList);
- }
- return buildSuccessResponse(bisZhejiangCheckPlan);
- }
- @ApiOperation(value = "根据ID获取浙江监督检查工作计划表(单表,包括审核流程)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisZhejiangCheckPlan> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisZhejiangCheckPlan bisZhejiangCheckPlan = bisZhejiangCheckPlanService.get(id);
- if (bisZhejiangCheckPlan != null) {
- BisZhejiangCheckProcessParam checkProcessParam = new BisZhejiangCheckProcessParam();
- checkProcessParam.setPlanId(id);
- List<BisZhejiangCheckProcess> checkProcessList = bisZhejiangCheckProcessService.findList(checkProcessParam);
- if (checkProcessList == null) {
- checkProcessList = new ArrayList<>();
- }
- bisZhejiangCheckPlan.setCheckProcessList(checkProcessList);
- }
- return buildSuccessResponse(bisZhejiangCheckPlan);
- }
- @ApiOperation(value = "获取浙江监督检查工作计划表(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisZhejiangCheckPlan>> list(@ApiParam(name = "bisZhejiangCheckPlanParam", value = "bisZhejiangCheckPlanParam", required = true) @RequestBody BisZhejiangCheckPlanParam bisZhejiangCheckPlanParam) {
- List<BisZhejiangCheckPlan> bisZhejiangCheckPlanList = bisZhejiangCheckPlanService.findList(bisZhejiangCheckPlanParam);
- return buildSuccessResponse(bisZhejiangCheckPlanList);
- }
- @Autowired
- BisZhejiangCheckDepartService bisZhejiangCheckDepartService;
- @ApiOperation(value = "获取浙江监督检查工作计划表(列表--分页--检查计划)")
- @RequestMapping(value = "/pagePlan", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisZhejiangCheckPlan>> page(@ApiParam(name = "bisZhejiangCheckPlanParam", value = "bisZhejiangCheckPlanParam", required = true) @RequestBody BisZhejiangCheckPlanParam bisZhejiangCheckPlanParam) {
- DepartDto departDto = bisZhejiangCheckDepartService.getState(getCurrentPersId());
- PageInfo<BisZhejiangCheckPlan> bisZhejiangCheckPlanList = bisZhejiangCheckPlanService.findPageInfo(bisZhejiangCheckPlanParam);
- if (departDto != null) {
- for (BisZhejiangCheckPlan checkPlan : bisZhejiangCheckPlanList.getList()) {
- if (!"3".equals(checkPlan.getState())) {
- checkPlan.setIsCheck("0");
- checkPlan.setIsRect("0");
- if (departDto.getId().equals(checkPlan.getDepartId()) && "2".equals(checkPlan.getState())) {
- checkPlan.setIsRect("1");
- }
- if ("1".equals(departDto.getIsCheck()) && "1".equals(checkPlan.getState())) {
- checkPlan.setIsCheck("1");
- }
- }
- }
- }
- return buildSuccessResponse(bisZhejiangCheckPlanList);
- }
- @ApiOperation(value = "获取浙江监督检查工作计划表(列表--分页--工作方案)")
- @RequestMapping(value = "/pageFangan", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisZhejiangCheckPlan>> pageFangan(@ApiParam(name = "bisZhejiangCheckPlanParam", value = "bisZhejiangCheckPlanParam", required = true) @RequestBody BisZhejiangCheckPlanParam bisZhejiangCheckPlanParam) {
- bisZhejiangCheckPlanParam.setIsSend(PlanEnum.PLAN_SEND.getKey());
- bisZhejiangCheckPlanParam.setState(PlanEnum.PLAN_SEND.getKey());
- DepartDto departDto = bisZhejiangCheckDepartService.getState(getCurrentPersId());
- PageInfo<BisZhejiangCheckPlan> bisZhejiangCheckPlanList = bisZhejiangCheckPlanService.findPageInfo(bisZhejiangCheckPlanParam);
- for (BisZhejiangCheckPlan checkPlan : bisZhejiangCheckPlanList.getList()) {
- if (departDto == null) {
- checkPlan.setIsControl("0");
- } else {
- if (checkPlan.getDepartId().equals(departDto.getId())) {
- checkPlan.setIsControl("1");
- } else {
- checkPlan.setIsControl("0");
- }
- }
- }
- return buildSuccessResponse(bisZhejiangCheckPlanList);
- }
- @ApiOperation(value = "获取浙江监督检查工作计划表-导出excel")
- @RequestMapping(value = "/export", method = RequestMethod.POST)
- public void export(@ApiParam(name = "bisZhejiangCheckPlanParam", value = "bisZhejiangCheckPlanParam", required = true) @RequestBody BisZhejiangCheckPlanParam bisZhejiangCheckPlanParam,
- HttpServletResponse response) throws Exception {
- response.setContentType("application/binary;charset=UTF-8");
- String fileName = "监督检查工作计划";
- List<BisZhejiangCheckPlan> bisZhejiangCheckPlanList = bisZhejiangCheckPlanService.findList(bisZhejiangCheckPlanParam);
- InspPblmUtils.ExportWorkNew(response, bisZhejiangCheckPlanList, fileName);
- // ExcelUtil.sendExcel(bisZhejiangCheckPlanList,response,fileName);
- }
- }
|