郑永安
2023-08-23 0a9ed7b7488de66a50799f79369d7806910ae00a
隐患二期
已修改7个文件
已添加5个文件
1938 ■■■■■ 文件已修改
pom.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Controller/SafetyFacilityInspectionController.java 777 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Controller/UserController.java 251 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/SafetyFacilityInspection.java 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/SafetyFacilityProcessflow.java 186 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/SafetyFacilityProcessflowMapper.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyFacilityInspectionMapper.xml 120 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyFacilityProcessflowMapper.xml 215 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/SafetyFacilityInspectionService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/SafetyFacilityProcessflowService.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyFacilityInspectionImpl.java 123 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyFacilityProcessflowImpl.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml
@@ -104,6 +104,11 @@
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-freemarker</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
src/main/java/com/gk/hotwork/Controller/SafetyFacilityInspectionController.java
@@ -1,29 +1,64 @@
package com.gk.hotwork.Controller;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gk.hotwork.Config.attachment.FilePathConfig;
import com.gk.hotwork.Controller.Base.BaseController;
import com.gk.hotwork.Domain.CompanyInfo;
import com.gk.hotwork.Domain.SafetyFacilityInspection;
import com.gk.hotwork.Domain.SafetyInspectionItem;
import com.gk.hotwork.Domain.SafetyFacilityProcessflow;
import com.gk.hotwork.Domain.Enum.ResultCodes;
import com.gk.hotwork.Domain.Exception.BusinessException;
import com.gk.hotwork.Domain.Utils.FilterObject;
import com.gk.hotwork.Domain.Utils.Msg;
import com.gk.hotwork.Domain.Utils.PageInfo;
import com.gk.hotwork.Domain.Utils.StringUtils;
import com.gk.hotwork.Domain.query.CompanyQuery;
import com.gk.hotwork.Service.CompanyService;
import com.gk.hotwork.Service.SafetyFacilityInspectionService;
import com.gk.hotwork.Service.SafetyFacilityProcessflowService;
import com.gk.hotwork.Service.UserService;
import freemarker.template.Template;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(tags = "安全设施审查流程")
@Api(tags = "②安全设施审查流程")
@RestController
@RequestMapping("/safetyFacilityInspection")
public class SafetyFacilityInspectionController extends BaseController{
@@ -31,38 +66,736 @@
    @Autowired
    private SafetyFacilityInspectionService safetyFacilityInspectionService;
    
    @Autowired
    private SafetyFacilityProcessflowService safetyFacilityProcessflowService;
    
    @ApiOperation("分页")
    @Autowired
    private UserService userService;
    @Resource
    private FilePathConfig filePathConfig;
    @Autowired
    private CompanyService companyService;
    @Autowired
    private FreeMarkerConfigurer freeMarkerConfigurer;
    @ApiOperation("审查项目分页列表")
    @PostMapping("/page")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageIndex",value = "当前页码"),
    @ApiImplicitParams({ @ApiImplicitParam(name = "pageIndex", value = "当前页码"),
            @ApiImplicitParam(name = "pageSize",value = "每页行数"),
            @ApiImplicitParam(name = "progress",value = "进度进度(0:待受理,1:已受理,10:待评审,11:评审中,12:评审否决,19:待企业反馈,20:待审查,21:审查中,29:待企业补正,22:审查否决,30:完成)"),
            @ApiImplicitParam(name = "expert",value = "审查专家"),
            @ApiImplicitParam(name = "createBy", value = "企业用户姓名"),
            @ApiImplicitParam(name = "type", value = "类别(1:安全设施设计审查,2:安全条件审查)"),
            @ApiImplicitParam(name = "submitDateStartTime",value = "开始时间"),
            @ApiImplicitParam(name = "submitDateEndTime",value = "结束时间")
    })
            @ApiImplicitParam(name = "submitDateEndTime", value = "结束时间") })
    public Msg selectPage(@RequestBody FilterObject filterObject) {
        Integer pageIndex = filterObject.getPageIndex();
        Integer pageSize = filterObject.getPageSize();
        IPage page = safetyFacilityInspectionService.selectPage(new Page<>(pageIndex, pageSize), filterObject.getFilter(), getUser());
        Integer pageIndex = filterObject.getPageIndex() == null ? 1 : filterObject.getPageIndex();
        Integer pageSize = filterObject.getPageSize() == null ? 10 : filterObject.getPageSize();
        Map<String, Object> map = filterObject.getFilter();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        try {
            if (map.get("submitDateStartTime") != null && StringUtils.isNotBlank(map.get("submitDateStartTime").toString()))
                map.put("submitDateStartTime", simpleDateFormat.format(simpleDateFormat.parse(map.get("submitDateStartTime").toString())));
            if (map.get("submitDateEndTime") != null  && StringUtils.isNotBlank(map.get("submitDateEndTime").toString()))
                map.put("submitDateEndTime", simpleDateFormat.format(simpleDateFormat.parse(map.get("submitDateEndTime").toString())));
            if (map.get("progress") != null  && StringUtils.isNotBlank(map.get("progress").toString()))
                map.put("progress", Integer.valueOf(map.get("progress").toString()));
            else
                map.put("progress", null);
            IPage<SafetyFacilityInspection> page = safetyFacilityInspectionService.selectPage(new Page<>(pageIndex, pageSize), filterObject.getFilter(), getUser());
            return success(page);
        } catch (ParseException e) {
            return failed(e.getMessage());
        }
    }
    @ApiOperation("业务处理历史详情")
    @PostMapping("/dealFlow")
    @ApiImplicitParams({ @ApiImplicitParam(name = "pageIndex", value = "当前页码"),
            @ApiImplicitParam(name = "pageSize", value = "每页行数"),
            @ApiImplicitParam(name = "linkInspectionId", value = "安全审查项目ID", required = true) })
    public Msg dealFlow(@RequestBody FilterObject filterObject) {
        Integer pageIndex = filterObject.getPageIndex() == null ? 1 : filterObject.getPageIndex();
        Integer pageSize = filterObject.getPageSize() == null ? 100 : filterObject.getPageSize();
        Long inspectionId = Long.valueOf(filterObject.getFilter().get("linkInspectionId").toString());
        SafetyFacilityInspection inspection = safetyFacilityInspectionService.selectByPrimaryKey(inspectionId,this.getUser());
        int progress = inspection.getProgress();
        IPage<SafetyFacilityProcessflow> page = safetyFacilityProcessflowService.processflowPages(new Page<>(pageIndex, pageSize), filterObject.getFilter(), getUser());
        List<SafetyFacilityProcessflow> list = new ArrayList<SafetyFacilityProcessflow>();
        List<SafetyFacilityProcessflow> review = new ArrayList<SafetyFacilityProcessflow>();
        List<SafetyFacilityProcessflow> examine = new ArrayList<SafetyFacilityProcessflow>();
        String reviewFinalResolution = "";
        String examineFinalResolution = "";
        for (SafetyFacilityProcessflow flow : page.getRecords()) {
            if ("资料提交".equals(flow.getProgressName()) || "待评审".equals(flow.getProgressName()) || "已受理".equals(flow.getProgressName()) || "待受理".equals(flow.getProgressName()))
                list.add(flow);
        }
        if (progress > 20) { // 构建审查全流程
            SafetyFacilityProcessflow inner = new SafetyFacilityProcessflow();
            inner.setProgressName("审查开始");
            inner.setCheckTime(inspection.getExamineTime());
            examine.add(inner);
            for (SafetyFacilityProcessflow flow : page.getRecords()) {
                if ("通知补正".equals(flow.getProgressName()) || "企业补正".equals(flow.getProgressName()) || "审查通过".equals(flow.getProgressName()) || "审查否决".equals(flow.getProgressName())) {
                    examine.add(flow);
                }
                if ("审查否决".equals(flow.getProgressName()) || "审查通过".equals(flow.getProgressName())) {
                    examineFinalResolution = flow.getResolution();
                }
            }
        }
        if (progress > 10) { // 构建评审全流程
            SafetyFacilityProcessflow inner = new SafetyFacilityProcessflow();
            inner.setProgressName("评审开始");
            inner.setCheckTime(inspection.getReviewTime());
            review.add(inner);
            for (SafetyFacilityProcessflow flow : page.getRecords()) {
                if ("评审反馈".equals(flow.getProgressName()) || "企业反馈".equals(flow.getProgressName()) || "评审通过".equals(flow.getProgressName()) || "评审否决".equals(flow.getProgressName())) {
                    review.add(flow);
                }
                if ("评审通过".equals(flow.getProgressName()) || "评审否决".equals(flow.getProgressName())) {
                    reviewFinalResolution = flow.getResolution();
                }
            }
        }
        if (progress == 30) {
            if (inspection.getType() == 1) {
                SafetyFacilityProcessflow f1 = new SafetyFacilityProcessflow();
                f1.setProgressName("评审通过");
                f1.setResult("评审通过");
                f1.setResolution(reviewFinalResolution);
                f1.setChildFlow(review);
                f1.setLinkInspectionId(inspectionId);
                list.add(f1);
            }
            SafetyFacilityProcessflow f = new SafetyFacilityProcessflow();
            f.setProgressName("审查通过");
            f.setResult("耗时:" + inspection.getExamineTaketime());
            f.setResolution("详情查看审查意见书");
            f.setChildFlow(examine);
            f.setLinkInspectionId(inspectionId);
            list.add(f);
            SafetyFacilityProcessflow ff = new SafetyFacilityProcessflow();
            ff.setProgressName("已完成");
            ff.setLinkInspectionId(inspectionId);
            list.add(ff);
        }
        if (progress >= 20 && progress < 30) {
            if (inspection.getType() == 1) {
                SafetyFacilityProcessflow f1 = new SafetyFacilityProcessflow();
                f1.setProgressName("评审通过");
                f1.setResult("评审通过");
                f1.setLinkInspectionId(inspectionId);
                f1.setResolution(reviewFinalResolution);
                f1.setChildFlow(review);
                list.add(f1);
            }
            SafetyFacilityProcessflow f = new SafetyFacilityProcessflow();
            if (progress == 20)
                f.setProgressName("待审查");
            if (progress == 21)
                f.setProgressName("审查中");
            if (progress == 29)
                f.setProgressName("待企业补正");
            if (progress == 22){
                f.setProgressName("审查否决");
                f.setResolution(examineFinalResolution);
            }
            f.setChildFlow(examine);
            list.add(f);
        }
        if (progress > 10 && progress < 20) {
            SafetyFacilityProcessflow f = new SafetyFacilityProcessflow();
            if (progress == 11)
                f.setProgressName("评审中");
            if (progress == 19)
                f.setProgressName("待企业反馈");
            if (progress == 12){
                f.setProgressName("评审否决");
                f.setResolution(reviewFinalResolution);
            }
            f.setChildFlow(review);
            list.add(f);
        }
        page.setRecords(list);
        return success(page);
    }
    
    @ApiOperation("/新增")
    @ApiOperation("企业新增审查")
    @PostMapping("/add")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "submitDate",value = "提交日期"),
    @ApiImplicitParams({ @ApiImplicitParam(name = "submitDate", value = "提交日期(可为空默认当前时间)", required = false),
        @ApiImplicitParam(name = "type",value = "类别(1:安全设施设计审查,2:安全条件审查)"),
        @ApiImplicitParam(name = "projectName",value = "项目名称"),
        @ApiImplicitParam(name = "progress",value = "进度(0:待受理,1:已受理,10:待评审,11:评审中,12:评审否决,19:待企业反馈,20:待审查,21:审查中,29:待企业补正,22:审查否决,30:完成)"),
        @ApiImplicitParam(name = "expert",value = "审查专家"),
        @ApiImplicitParam(name = "contact",value = "联系人"),
        @ApiImplicitParam(name = "telephone",value = "联系电话")
})
            @ApiImplicitParam(name = "progress", required = false, value = "进度(0:待受理,1:已受理,10:待评审,11:评审中,12:评审否决,19:待企业反馈,20:待审查,21:审查中,29:待企业补正,22:审查否决,30:完成)"),
            @ApiImplicitParam(name = "expert", value = "审查专家", required = false),
            @ApiImplicitParam(name = "contact", value = "联系人", required = false),
            @ApiImplicitParam(name = "telephone", value = "联系电话", required = false),
            @ApiImplicitParam(name = "company", value = "企业名称", required = false) })
    public Msg add(@RequestBody SafetyFacilityInspection param) {
        String genId = LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli() + "" + (int) (Math.random() * 900 + 100);
        param.setId(Long.valueOf(genId));
        Date date = new Date();
        safetyFacilityInspectionService.addOne(param, this.getUser());
        SafetyFacilityProcessflow flow = new SafetyFacilityProcessflow();
        flow.setCheckTime(date);
        flow.setProgressName("资料提交");
        flow.setResult("资料提交");
        flow.setResolution("开始");
        flow.setLinkInspectionId(Long.valueOf(genId));
        flow.setProcessBy(this.getUser().getRealname());
        safetyFacilityProcessflowService.addOne(flow, this.getUser());
        SafetyFacilityProcessflow flowd = new SafetyFacilityProcessflow();
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        c.add(Calendar.SECOND, 1);
        flowd.setCheckTime(c.getTime());
        flowd.setProgressName("待受理");
        flowd.setLinkInspectionId(Long.valueOf(genId));
        safetyFacilityProcessflowService.addOne(flowd, this.getUser());
        return success();
    }
    @ApiOperation("删除审查项目")
    @PostMapping("/delete")
    @ApiImplicitParams({ @ApiImplicitParam(name = "linkInspectionId", value = "安全审查项目ID", required = true) })
    public Msg delete(@RequestBody FilterObject filterObject) {
        if (filterObject.getFilter().get("linkInspectionId") == null)
            return failed("安全审查项目ID不能为空");
        Long inspectionId = Long.valueOf(filterObject.getFilter().get("linkInspectionId").toString());
        safetyFacilityInspectionService.delOne(inspectionId, this.getUser());
        safetyFacilityProcessflowService.deleteBylinkInspectionId(inspectionId, this.getUser());
        return success();
    }
    @ApiOperation("获取审查专家列表")
    @PostMapping("/expert")
    @ApiImplicitParams({ @ApiImplicitParam(name = "pageIndex", value = "当前页码"),
            @ApiImplicitParam(name = "pageSize", value = "每页行数") })
    public Msg getExpert(@RequestParam(defaultValue = "0") Integer pageIndex,@RequestParam(defaultValue = "10") Integer pageSize, String realname) {
        Msg msg = new Msg();
        msg.setCode("200");
        msg.setMessage("success");
        PageInfo pageInfo = new PageInfo(pageIndex, pageSize);
        HashMap<String, Object> condition = new HashMap<String, Object>();
        condition.put("job", "审查");
        condition.put("company", "危化处");
        if (StringUtils.isNotBlank(realname)) {
            condition.put("realname", realname.trim());
        }
        pageInfo.setCondition(condition);
        userService.selectExpertUserDataGrid(pageInfo);
        msg.setResult(pageInfo);
        return msg;
    }
    @ApiOperation("危化处业务处理")
    @PostMapping("/dealCheck")
    @ApiImplicitParams({ @ApiImplicitParam(name = "acceptTime", value = "选择受理时间(默认当前时间)", required = false),
            @ApiImplicitParam(name = "reviewTime", value = "自定义评审开始时间", required = false),
            @ApiImplicitParam(name = "linkInspectionId", value = "安全审查项目ID", required = true) })
    public Msg dealCheck(@RequestBody FilterObject filterObject) throws ParseException {
        if (filterObject.getFilter().get("linkInspectionId") == null)
            return failed("安全审查项目ID不能为空");
        Long inspectionId = Long.valueOf(filterObject.getFilter().get("linkInspectionId").toString());
        SafetyFacilityInspection inspection = safetyFacilityInspectionService.selectByPrimaryKey(inspectionId,this.getUser());
        String acceptTimeString = null;
        if (inspection.getProgress() == 0) {
            if (inspection.getType() == 1) {
                if (filterObject.getFilter().get("acceptTime") != null && StringUtils.isNotBlank(filterObject.getFilter().get("acceptTime").toString())) {
                    acceptTimeString = filterObject.getFilter().get("acceptTime").toString();
                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                    inspection.setAcceptTime(simpleDateFormat.parse(acceptTimeString));
                } else
                    inspection.setAcceptTime(new Date());
                inspection.setProgress(1);
                SafetyFacilityProcessflow flow = new SafetyFacilityProcessflow();
                flow.setCheckTime(new Date());
                flow.setProgressName("已受理");
                flow.setResult("选择受理时间");
                flow.setLinkInspectionId(inspectionId);
                flow.setProcessBy(this.getUser().getRealname());
                safetyFacilityProcessflowService.addOne(flow, this.getUser());
                safetyFacilityInspectionService.modOne(inspection, getUser());
                safetyFacilityProcessflowService.modPending(inspectionId, this.getUser()); // 删除待处理流程记录
            }
            if (inspection.getType() == 2) {
                Date date = new Date();
                if (filterObject.getFilter().get("acceptTime") != null && StringUtils.isNotBlank(filterObject.getFilter().get("acceptTime").toString())) {
                    acceptTimeString = filterObject.getFilter().get("acceptTime").toString();
                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                    inspection.setAcceptTime(simpleDateFormat.parse(acceptTimeString));
                } else
                    inspection.setAcceptTime(date);
                inspection.setProgress(20);
                SafetyFacilityProcessflow flow = new SafetyFacilityProcessflow();
                flow.setCheckTime(date);
                flow.setProgressName("已受理");
                flow.setResult("选择受理时间");
                flow.setLinkInspectionId(inspectionId);
                flow.setProcessBy(this.getUser().getRealname());
                safetyFacilityProcessflowService.addOne(flow, this.getUser());
                safetyFacilityProcessflowService.modPending(inspectionId, this.getUser()); // 删除待处理流程记录
                SafetyFacilityProcessflow flow1 = new SafetyFacilityProcessflow();
                Calendar c = Calendar.getInstance();
                c.setTime(date);
                c.add(Calendar.SECOND, 1);
                flow1.setProgressName("待审查");
                flow1.setCheckTime(c.getTime());
                flow1.setLinkInspectionId(inspectionId);
                flow1.setProcessBy(this.getUser().getRealname());
                safetyFacilityProcessflowService.addOne(flow1, this.getUser());
                safetyFacilityInspectionService.modOne(inspection, getUser());
            }
            return success();
        }
        if (inspection.getProgress() == 1) {
            if (filterObject.getFilter().get("reviewTime") != null && StringUtils.isNotBlank(filterObject.getFilter().get("reviewTime").toString())) {
                acceptTimeString = filterObject.getFilter().get("reviewTime").toString();
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                inspection.setReviewTime(simpleDateFormat.parse(acceptTimeString));
            } else
                inspection.setReviewTime(new Date());
            inspection.setProgress(10);
            SafetyFacilityProcessflow flow = new SafetyFacilityProcessflow();
            flow.setCheckTime(new Date());
            flow.setProgressName("待评审");
            flow.setResult("业务流转");
            flow.setLinkInspectionId(inspectionId);
            flow.setProcessBy(this.getUser().getRealname());
            safetyFacilityProcessflowService.addOne(flow, this.getUser());
            safetyFacilityInspectionService.modOne(inspection, getUser());
            return success();
        }
        return failed("处理失败!");
    }
    @ApiOperation("业务处分配审查专家")
    @PostMapping("/dealExamine")
    @ApiImplicitParams({ @ApiImplicitParam(name = "linkInspectionId", value = "安全审查项目ID", required = true),
            @ApiImplicitParam(name = "expert", value = "审查专家ID(多个ID中间逗号分隔)"),
            @ApiImplicitParam(name = "examineTime", value = "审查开始时间") })
    public Msg dealExamine(@RequestBody FilterObject filterObject) throws ParseException {
        if (filterObject.getFilter().get("linkInspectionId") == null)
            return failed("安全审查项目ID不能为空");
        Long inspectionId = Long.valueOf(filterObject.getFilter().get("linkInspectionId").toString());
        SafetyFacilityInspection inspection = safetyFacilityInspectionService.selectByPrimaryKey(inspectionId,this.getUser());
        int currentprocess = inspection.getProgress();
        if (currentprocess == 20) {
            inspection.setProgress(21);
            inspection.setExpert(filterObject.getFilter().get("expert") == null ? "" : filterObject.getFilter().get("expert").toString());
            if (filterObject.getFilter().get("examineTime") != null && StringUtils.isNotBlank(filterObject.getFilter().get("examineTime").toString())) {
                String examineTimeString = filterObject.getFilter().get("examineTime").toString();
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                inspection.setExamineTime(simpleDateFormat.parse(examineTimeString));
            } else
                inspection.setExamineTime(new Date());
            safetyFacilityInspectionService.modOne(inspection, this.getUser());
            return success();
        } else {
            return failed("当前项目不在待审查状态,无法进行专家分配!");
        }
    }
    @ApiOperation("专家审查")
    @PostMapping("/expertExamine")
    @ApiImplicitParams({ @ApiImplicitParam(name = "linkInspectionId", value = "安全审查项目ID", required = true),
            @ApiImplicitParam(name = "result", required = true, value = "评审反馈结果(9:否决驳回,2:需补正,1:审查通过)"),
            @ApiImplicitParam(name = "correctNo", required = false, value = "补正告知书编号"),
            @ApiImplicitParam(name = "correctPDFPath", required = false, value = "补正告知书路径"),
            @ApiImplicitParam(name = "emergency", value = "应急局通知人(多个ID中间逗号分隔)"),
            @ApiImplicitParam(name = "resolution", value = "反馈意见") })
    public Msg expertExamine(@RequestBody FilterObject filterObject) {
        if (filterObject.getFilter().get("linkInspectionId") == null)
            return failed("安全审查项目ID不能为空");
        Long inspectionId = Long.valueOf(filterObject.getFilter().get("linkInspectionId").toString());
        SafetyFacilityInspection inspection = safetyFacilityInspectionService.selectByPrimaryKey(inspectionId, this.getUser());
        int res = Integer.valueOf(filterObject.getFilter().get("result").toString());
        int currentprocess = inspection.getProgress();
        if (currentprocess == 20 || currentprocess == 21) {
            SafetyFacilityProcessflow flow = new SafetyFacilityProcessflow();
            flow.setCheckTime(new Date());
            flow.setLinkInspectionId(inspectionId);
            flow.setProcessBy(this.getUser().getRealname());
            flow.setResolution(filterObject.getFilter().get("resolution") == null ? "" : filterObject.getFilter().get("resolution").toString());
            if (res == 9) {
                flow.setProgressName("审查否决");
                flow.setResult("否决驳回");
                inspection.setProgress(22);
            }
            if (res == 2) {
                flow.setProgressName("通知补正");
                inspection.setProgress(29);
                String correctNo = filterObject.getFilter().get("correctNo") == null ? "" : filterObject.getFilter().get("correctNo").toString();
                String newFilePath = filterObject.getFilter().get("correctPDFPath") == null ? "" : filterObject.getFilter().get("correctPDFPath").toString();
                flow.setResolution(newFilePath);
                flow.setResult(correctNo);
                inspection.setCorrectpdf(newFilePath);
            }
            if (res == 1) {
                flow.setProgressName("审查通过");
                flow.setResult("审查通过完成");
                inspection.setProgress(30);
                Date begin = inspection.getExamineTime();
                Calendar cal1 = Calendar.getInstance();
                cal1.setTime(begin);
                Calendar cal2 = Calendar.getInstance();
                cal2.setTime(new Date());
                Long diff = (cal2.getTimeInMillis() - cal1.getTimeInMillis()) / 60000;
                int day = diff.intValue() / 1440;
                int hour = (diff.intValue() % 1440) / 60;
                int min = (diff.intValue() % 1440) % 60;
                inspection.setExamineTaketime(day + "天" + hour + "小时" + min + "分钟");
                SimpleDateFormat pageno = new SimpleDateFormat("MMdd");
                int dateno = Integer.valueOf(pageno.format(new Date())) / 2;
                if (dateno < 100)
                    inspection.setExaminePageno("0" + dateno);
                else
                    inspection.setExaminePageno("" + dateno);
            }
            safetyFacilityProcessflowService.addOne(flow, this.getUser());
            safetyFacilityInspectionService.modOne(inspection, this.getUser());
            return success();
        } else {
            return failed("当前项目状态异常无法进行审查!");
        }
    }
    @ApiOperation("专家审查上传补正告知书")
    @PostMapping("/uploadCorrectPDF")
    @ApiImplicitParams({ @ApiImplicitParam(name = "file", value = "上传补正告知书(PDF)文件") })
    public Msg uploadCorrectPDF(HttpServletRequest request, @RequestParam("file") MultipartFile file) {
        if (file.getSize() > 1024 * 1024 * 2) {
            return failed("文件超过2M无法上传");
        }
        String path = filePathConfig.getModule().get("correctPDF");
        String dcPath = filePathConfig.getDcPath();
        String originalFilename = file.getOriginalFilename();
        LocalDateTime now = LocalDateTime.now();
        File newFile = null;
        try {
            String key = UUID.randomUUID().toString().replace("-", "");
            String suffix = originalFilename.substring(originalFilename.lastIndexOf(".")).toLowerCase();
            path = path.replace("/", File.separator);
            String modulePath = now.getYear() + path + now.format(DateTimeFormatter.ofPattern("MMdd"));
            String newFilePath = modulePath + File.separator + key + suffix;
            String localPath = dcPath + newFilePath;
            newFile = new File(localPath);
            if (!newFile.exists() && !newFile.mkdirs()) {
                return failed("文件上传路径不存在!");
            }
            file.transferTo(newFile);
            return success(newFilePath);
        } catch (IOException e) {
            if (newFile != null && newFile.exists()) {
                newFile.delete();
            }
            return failed("文件上传异常!");
        }
    }
    @ApiOperation("补正告知书下载")
    @PostMapping("/downCorrectPDF")
    @ApiImplicitParams({ @ApiImplicitParam(name = "filename", value = "补正告知书文件名", required = true),
            @ApiImplicitParam(name = "correctNo", value = "补正告知书编号") })
    public void downCorrectPDF(@RequestBody FilterObject filterObject, HttpServletResponse response) throws Exception {
        if (filterObject.getFilter().get("filename") == null)
            return;
        String filepath = filterObject.getFilter().get("filename").toString();
        String correctNo = filterObject.getFilter().get("correctNo") == null ? "" : filterObject.getFilter().get("correctNo").toString();
        response.reset();
        response.addHeader("Access-Control-Allow-Origin", "*");
        response.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE");
        response.setContentType("application/octet-stream; charset=UTF-8");
        response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("补正告知书" + correctNo + ".pdf", StandardCharsets.UTF_8.name()));
        response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
        String dcPath = filePathConfig.getDcPath();
        File file = new File(dcPath + filepath);
        if (!file.exists()) {
            throw new BusinessException(ResultCodes.FILE_NOT_EXISIST);
        }
        response.addHeader("Content-Length", "" + file.length());
        FileInputStream inputStream = new FileInputStream(file);
        byte[] b = new byte[inputStream.available()];
        inputStream.read(b);
        ServletOutputStream outputStream = response.getOutputStream();
        outputStream.write(b);
        outputStream.flush();
        inputStream.close();
    }
    @ApiOperation("审查意见书预览")
    @PostMapping("/viewExamineFile")
    @ApiImplicitParams({ @ApiImplicitParam(name = "linkInspectionId", value = "安全审查项目ID", required = true) })
    public void viewExamineFile(@RequestBody FilterObject filterObject, HttpServletResponse response) throws Exception {
        if (filterObject.getFilter().get("linkInspectionId") == null)
            return;
        Template template = freeMarkerConfigurer.getConfiguration().getTemplate("ReviewHtml.ftl", "UTF-8");
        Long inspectionId = Long.valueOf(filterObject.getFilter().get("linkInspectionId").toString());
        SafetyFacilityInspection inspection = safetyFacilityInspectionService.selectByPrimaryKey(inspectionId,this.getUser());
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("year", String.valueOf(LocalDate.now().getYear()));
        map.put("pageno", "0001");
        map.put("company", inspection.getCompany());
        map.put("projectName", inspection.getProjectName());
        map.put("contact", inspection.getContact());
        map.put("telephone", inspection.getTelephone());
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
        map.put("submitDate", simpleDateFormat.format(new Date()));
        String duplicate = "";
        if (inspection.getCompany() != null) {
            duplicate = companyService.selectByName(inspection.getCompany()).getCity();
        }
        map.put("duplicate", duplicate + "应急管理局");
        response.setContentType("text/html;charset=utf-8");
        template.process(map, response.getWriter());
    }
    @ApiOperation("审查意见书下载")
    @PostMapping("/downExamineFile")
    @ApiImplicitParams({ @ApiImplicitParam(name = "linkInspectionId", value = "安全审查项目ID", required = true) })
    public void downExamineFile(@RequestBody FilterObject filterObject, HttpServletResponse response) throws Exception {
        if (filterObject.getFilter().get("linkInspectionId") == null)
            return;
        Template template = freeMarkerConfigurer.getConfiguration().getTemplate("ReviewHtml.ftl", "UTF-8");
        Long inspectionId = Long.valueOf(filterObject.getFilter().get("linkInspectionId").toString());
        SafetyFacilityInspection inspection = safetyFacilityInspectionService.selectByPrimaryKey(inspectionId, this.getUser());
        Map<String, Object> map = new HashMap<String, Object>();
        SimpleDateFormat year = new SimpleDateFormat("yyyy");
        map.put("year", year.format(inspection.getCreateTime()));
        map.put("pageno", inspection.getExaminePageno());
        map.put("company", inspection.getCompany());
        map.put("projectName", inspection.getProjectName());
        map.put("contact", inspection.getContact());
        map.put("telephone", inspection.getTelephone());
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
        map.put("submitDate", simpleDateFormat.format(new Date()));
        String duplicate = "";
        if (inspection.getCompany() != null) {
            duplicate = companyService.selectByName(inspection.getCompany()).getCity();
        }
        map.put("duplicate", duplicate + "应急管理局");
        response.setHeader("content-Type", "application/msword");
        String fileName = URLEncoder.encode("审查意见书", "UTF-8");
        response.setCharacterEncoding("UTF-8");
        response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".doc");
        template.process(map, response.getWriter());
    }
    @ApiOperation("安科院评审反馈")
    @PostMapping("/reviewFeedback")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "result", required = true, value = "评审反馈结果(9:否决驳回,2:需问题反馈,1:通过并流转到业务处室)"),
            @ApiImplicitParam(name = "resolution", value = "反馈意见"),
            @ApiImplicitParam(name = "reviewTime", value = "评审开始时间", required = true),
            @ApiImplicitParam(name = "linkInspectionId", value = "安全审查项目ID", required = true) })
    public Msg reviewFeedback(@RequestBody FilterObject filterObject) throws ParseException {
        if (filterObject.getFilter().get("linkInspectionId") == null)
            return failed("安全审查项目ID不能为空");
        if (filterObject.getFilter().get("result") == null)
            return failed("评审反馈结果不能为空");
        if (filterObject.getFilter().get("reviewTime") == null)
            return failed("请选择评审开始时间");
        Long inspectionId = Long.valueOf(filterObject.getFilter().get("linkInspectionId").toString());
        int res = Integer.valueOf(filterObject.getFilter().get("result").toString());
        SafetyFacilityInspection inspection = safetyFacilityInspectionService.selectByPrimaryKey(inspectionId,this.getUser());
        int currentprocess = inspection.getProgress();
        String timeString = filterObject.getFilter().get("reviewTime").toString();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        inspection.setReviewTime(simpleDateFormat.parse(timeString));
        if (currentprocess == 10 || currentprocess == 11) {
            SafetyFacilityProcessflow flow = new SafetyFacilityProcessflow();
            Date date = new Date();
            flow.setCheckTime(date);
            flow.setLinkInspectionId(inspectionId);
            flow.setProcessBy(this.getUser().getRealname());
            flow.setResolution(filterObject.getFilter().get("resolution") == null ? "" : filterObject.getFilter().get("resolution").toString());
            if (res == 9) {
                flow.setProgressName("评审否决");
                flow.setResult("否决驳回");
                inspection.setProgress(12);
            }
            if (res == 2) {
                flow.setProgressName("评审反馈");
                flow.setResult("需问题反馈");
                inspection.setProgress(19);
            }
            if (res == 1) {
                flow.setProgressName("评审通过");
                flow.setResult("通过并流转到业务处室");
                inspection.setProgress(20);
            }
            safetyFacilityProcessflowService.addOne(flow, this.getUser());
            safetyFacilityInspectionService.modOne(inspection, this.getUser());
            safetyFacilityProcessflowService.modPending(inspectionId, this.getUser()); // 删除待处理流程记录
            if (res == 1) {
                SafetyFacilityProcessflow flow1 = new SafetyFacilityProcessflow();
                Calendar c = Calendar.getInstance();
                c.setTime(date);
                c.add(Calendar.SECOND, 1);
                flow1.setProgressName("待审查");
                flow1.setCheckTime(c.getTime());
                flow1.setLinkInspectionId(inspectionId);
                flow1.setProcessBy(this.getUser().getRealname());
                safetyFacilityProcessflowService.addOne(flow1, this.getUser());
            }
            return success();
        } else {
            return failed("当前项目不在评审环节,不能进行评审!");
        }
    }
    @ApiOperation("企业提交反馈")
    @PostMapping("/companySubmission")
    @ApiImplicitParams({ @ApiImplicitParam(name = "linkInspectionId", value = "安全审查项目ID", required = true) })
    public Msg companySubmission(@RequestBody FilterObject filterObject) {
        if (filterObject.getFilter().get("linkInspectionId") == null)
            return failed("安全审查项目ID不能为空");
        Long inspectionId = Long.valueOf(filterObject.getFilter().get("linkInspectionId").toString());
        SafetyFacilityInspection inspection = safetyFacilityInspectionService.selectByPrimaryKey(inspectionId,this.getUser());
        int currentprocess = inspection.getProgress();
        if (currentprocess == 19) {
            SafetyFacilityProcessflow flow = new SafetyFacilityProcessflow();
            flow.setCheckTime(new Date());
            flow.setLinkInspectionId(inspectionId);
            flow.setProcessBy(this.getUser().getRealname());
            flow.setProgressName("企业反馈");
            flow.setResult("已线下提交反馈资料");
            safetyFacilityProcessflowService.addOne(flow, this.getUser());
            inspection.setProgress(11);
            safetyFacilityInspectionService.modOne(inspection, this.getUser());
            return success();
        } else {
            return failed("当前项目不在待提交反馈状态,企业无法提交反馈!");
        }
    }
    @ApiOperation("获取审查项目对应的当地(市、州)级应急局所有人")
    @PostMapping("/getEmergencyInfo")
    @ApiImplicitParams({ @ApiImplicitParam(name = "pageIndex", value = "当前页码"),
            @ApiImplicitParam(name = "pageSize", value = "每页行数"),
            @ApiImplicitParam(name = "linkInspectionId", value = "安全审查项目ID", required = true) })
    public Msg getEmergencyInfo(@RequestBody FilterObject filterObject) {
        if (filterObject.getFilter().get("linkInspectionId") == null)
            return failed("安全审查项目ID不能为空");
        Long inspectionId = Long.valueOf(filterObject.getFilter().get("linkInspectionId").toString());
        SafetyFacilityInspection inspection = safetyFacilityInspectionService.selectByPrimaryKey(inspectionId,this.getUser());
        String duplicate = null;
        if (inspection.getCompany() != null) {
            duplicate = companyService.selectByName(inspection.getCompany()).getCity();
        } else {
            return failed("当前安全审查项目没有归属地!");
        }
        Msg msg = new Msg();
        msg.setCode("200");
        msg.setMessage("success");
        Integer pageIndex = filterObject.getPageIndex() == null ? 1 : filterObject.getPageIndex();
        Integer pageSize = filterObject.getPageSize() == null ? 10 : filterObject.getPageSize();
        PageInfo pageInfo = new PageInfo(pageIndex, pageSize);
        HashMap<String, Object> condition = new HashMap<String, Object>();
        condition.put("company", duplicate);
        pageInfo.setCondition(condition);
        userService.selectSuperviseUserDataGrid(pageInfo);
        msg.setResult(pageInfo);
        return msg;
    }
    @ApiOperation("企业提交补正")
    @PostMapping("/companySubcorrect")
    @ApiImplicitParams({ @ApiImplicitParam(name = "linkInspectionId", value = "安全审查项目ID", required = true) })
    public Msg companySubcorrect(@RequestBody FilterObject filterObject) {
        if (filterObject.getFilter().get("linkInspectionId") == null)
            return failed("安全审查项目ID不能为空");
        Long inspectionId = Long.valueOf(filterObject.getFilter().get("linkInspectionId").toString());
        SafetyFacilityInspection inspection = safetyFacilityInspectionService.selectByPrimaryKey(inspectionId,this.getUser());
        int currentprocess = inspection.getProgress();
        if (currentprocess == 29) {
            SafetyFacilityProcessflow flow = new SafetyFacilityProcessflow();
            flow.setCheckTime(new Date());
            flow.setLinkInspectionId(inspectionId);
            flow.setProcessBy(this.getUser().getRealname());
            flow.setProgressName("企业补正");
            flow.setResult("已线下提交补正材料");
            safetyFacilityProcessflowService.addOne(flow, this.getUser());
            inspection.setProgress(21);
            safetyFacilityInspectionService.modOne(inspection, this.getUser());
            return success();
        } else {
            return failed("当前项目不在待提交补正状态,企业无法提交补正!");
        }
    }
}
src/main/java/com/gk/hotwork/Controller/UserController.java
@@ -2701,4 +2701,255 @@
        msg.setResult(companyService.selectCompanyList(companyName,getUser()));
        return msg;
    }
    /**
     * 安科院用户-新增
     * @param jsonObject
     * @return
     */
    @PostMapping("/add/safetyInstitute/user")
    @ApiOperation(value = "添加安科院用户数据",response = Msg.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "username",value = "手机号",required = true),
            @ApiImplicitParam(name = "password",value = "密码",required = true),
            @ApiImplicitParam(name = "email",value = "邮箱"),
            @ApiImplicitParam(name = "company",value = "单位名称"),
            @ApiImplicitParam(name = "job",value = "职务"),
            @ApiImplicitParam(name = "realname",value = "姓名"),
            @ApiImplicitParam(name = "idcard",value = "身份证"),
    })
    public Msg addSafetyInstituteUserInfo(@RequestBody JSONObject jsonObject){
        Msg msg = new Msg();
        msg.setCode("200");
        msg.setMessage("success");
        UserInfo userInfo = new UserInfo();
        String password = jsonObject.getString("password");
        String PW_PATTERN = "(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~!@#$%^&*_.]).{8,}";
        if (!password.matches(PW_PATTERN)){
            msg.setCode(ErrorCode.ERROR_10004.getCode());
            msg.setMessage("密码必须8位以上,并且包含大小写字母、数字、特殊符号三种以上");
            return msg;
        }else {
            userInfo.setPassword(MD5Utils.encode(password));
        }
        String username = jsonObject.getString("username");
        if (StringUtils.isNotBlank(username) && username.length() == 11){
            userInfo.setUsername(username);
        }else{
            msg.setCode(ErrorCode.ERROR_10004.getCode());
            msg.setMessage("手机号必须为11位数");
            return msg;
        }
        String realname = jsonObject.getString("realname");
        if (StringUtils.isBlank(realname)){
            msg.setCode(ErrorCode.ERROR_10004.getCode());
            msg.setMessage("姓名不能为空");
            return msg;
        }
        String idcard = jsonObject.getString("idcard");
        if (StringUtils.isNotBlank(idcard)){
            UserInfo idCardExist = userService.selectByIdCard(null,idcard);
            if (null != idCardExist){
                msg.setCode(ErrorCode.ERROR_10004.getCode());
                msg.setMessage("身份证重复");
                return msg;
            }else{
                userInfo.setIdcard(idcard);
            }
            if (!IdCardUtil.strongVerifyIdNumber(idcard)) {
                msg.setCode(ErrorCode.ERROR_10004.getCode());
                msg.setMessage("身份证非法");
                return msg;
            }
        }
        String company = jsonObject.getString("company");
        CompanyInfo companyInfo = companyService.selectByName(company);
        if (companyInfo != null) {
            userInfo.setCompanyid(companyInfo.getId());
        }
        userInfo.setEmail(jsonObject.getString("email"));
        userInfo.setCompany(companyInfo.getCompany());
        userInfo.setJob(jsonObject.getString("job"));
        userInfo.setStatus((byte)1);
        userInfo.setType(2);
        userInfo.setCreatedby(getUser().getRealname());
        userInfo.setRealname(realname);
        userInfo.setCreateddate(new Date());
        userInfo.setLastmodifiedby(getUser().getRealname());
        userInfo.setLastmodifieddate(new Date());
        userInfo.setIsdel((byte)0);
        userInfo.setIsupload((byte)0);
        List<UserInfo> userInfoExist = userService.selectUserInfo(null,userInfo.getUsername());
        if (userInfoExist.size() > 0){
            msg.setCode(ErrorCode.ERROR_10004.getCode());
            msg.setMessage("用户名重复");
            return msg;
        }
        int userSize = userService.selectUserSize();
        int sli = (userSize + 1) % sliceSize;
        userInfo.setSlice(sli + "");
        if (sli == 0)
            userInfo.setSlice(sliceSize + "");
        userService.save(userInfo);
        UserInfo user = userService.selectByUser(userInfo.getUsername());
        UserRolesInfo userRolesInfo = new UserRolesInfo();
        List<RoleInfo> list = roleService.selectPageForRole("安科院", 0, 10000);
        if(list.isEmpty() || list.size()==0){
            msg.setCode(ErrorCode.ERROR_50004.getCode());
            msg.setMessage("安科院角色不存在");
        }
        userRolesInfo.setRoleid(list.get(0).getId());
        userRolesInfo.setUserid(user.getId());
        userRolesService.save(userRolesInfo);
        return msg;
    }
    /**
     * 安科院用户-修改
     * @param jsonObject
     * @return
     */
    @PostMapping("/put/safetyInstitute/user")
    @ApiOperation(value = "修改安科院用户数据",response = Msg.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "用户id",required = true),
            @ApiImplicitParam(name = "username",value = "手机号",required = true),
            @ApiImplicitParam(name = "password",value = "密码",required = true),
            @ApiImplicitParam(name = "email",value = "邮箱"),
            @ApiImplicitParam(name = "company",value = "单位"),
            @ApiImplicitParam(name = "job",value = "职务"),
            @ApiImplicitParam(name = "realname",value = "姓名"),
            @ApiImplicitParam(name = "idcard",value = "身份证"),
    })
    public Msg putSafetyInstituteUserInfo(@RequestBody JSONObject jsonObject){
        Msg msg = new Msg();
        msg.setCode("200");
        msg.setMessage("success");
        UserInfo userInfo = new UserInfo();
        Long id = jsonObject.getLong("id");
        if (id == null) {
            msg.setCode(ErrorCode.ERROR_10004.getCode());
            msg.setMessage("主键参数为空");
            return msg;
        }else {
            userInfo.setId(id);
        }
        String password = jsonObject.getString("password");
        String PW_PATTERN = "(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~!@#$%^&*_.]).{8,}";
        if (StringUtils.isNotBlank(password)){
            if (!password.matches(PW_PATTERN)){
                msg.setCode(ErrorCode.ERROR_10004.getCode());
                msg.setMessage("密码必须8位以上,并且包含大小写字母、数字、特殊符号三种以上");
                return msg;
            }else {
                userInfo.setPassword(MD5Utils.encode(password));
            }
        }
        String username = jsonObject.getString("username");
        if (StringUtils.isNotBlank(username) && username.length() == 11){
            userInfo.setUsername(username);
        }else{
            msg.setCode(ErrorCode.ERROR_10004.getCode());
            msg.setMessage("手机号必须为11位数");
            return msg;
        }
        String realname = jsonObject.getString("realname");
        if (StringUtils.isBlank(realname)){
            msg.setCode(ErrorCode.ERROR_10004.getCode());
            msg.setMessage("姓名不能为空");
            return msg;
        }
        String idcard = jsonObject.getString("idcard");
        if (StringUtils.isNotBlank(idcard)){
            UserInfo idCardExist = userService.selectByIdCard(userInfo.getId(),idcard);
            if (null != idCardExist){
                msg.setCode(ErrorCode.ERROR_10004.getCode());
                msg.setMessage("身份证重复");
                return msg;
            }else{
                userInfo.setIdcard(idcard);
            }
            if (!IdCardUtil.strongVerifyIdNumber(idcard)) {
                msg.setCode(ErrorCode.ERROR_10004.getCode());
                msg.setMessage("身份证非法");
                return msg;
            }
        }
        String company = jsonObject.getString("company");
        CompanyInfo companyInfo = companyService.selectByName(company);
        if (companyInfo != null) {
            userInfo.setCompanyid(companyInfo.getId());
        }
        userInfo.setEmail(jsonObject.getString("email"));
        userInfo.setCompany(company);
        userInfo.setJob(jsonObject.getString("job"));
        userInfo.setLastmodifiedby(getUser().getRealname());
        userInfo.setLastmodifieddate(new Date());
        userInfo.setIsdel((byte)0);
        userInfo.setRealname(realname);
        List<UserInfo> userInfoExist = userService.selectUserInfo(userInfo.getId(),userInfo.getUsername());
        if (userInfoExist.size() > 0){
            msg.setCode(ErrorCode.ERROR_10004.getCode());
            msg.setMessage("用户名重复");
            return msg;
        }
        userService.updateById(userInfo);
        return msg;
    }
    @GetMapping("/safetyInstitute/user/list")
    @ApiOperation(value = "获取安科院用户数据-分页",response = Msg.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageIndex",value = "当前页码"),
            @ApiImplicitParam(name = "pageSize",value = "每页行数"),
            @ApiImplicitParam(name = "sort",value = "排序规则"),
            @ApiImplicitParam(name = "order",value = "排序字段"),
            @ApiImplicitParam(name = "username",value = "用户名"),
            @ApiImplicitParam(name = "realname",value = "姓名"),
            @ApiImplicitParam(name = "idcard",value = "身份证号"),
    })
    public Msg getSafetyInstituteUserInfo(@RequestParam(defaultValue = "0") Integer pageIndex, @RequestParam(defaultValue = "10") Integer pageSize, String sort,String order,
                                  String username,String realname, String idcard){
        Msg msg = new Msg();
        msg.setCode("200");
        msg.setMessage("success");
        PageInfo pageInfo = new PageInfo(pageIndex, pageSize,sort,order);
        HashMap<String, Object> condition = new HashMap<String, Object>();
        if (StringUtils.isNotBlank(username)) {
            condition.put("username", username.trim());
        }
        condition.put("company", "安科院");
        if (StringUtils.isNotBlank(realname)){
            condition.put("realname",realname.trim());
        }
        if (StringUtils.isNotBlank(idcard)){
            condition.put("idcard",idcard.trim());
        }
        pageInfo.setCondition(condition);
        userService.selectUserDataGrid(pageInfo);
        msg.setResult(pageInfo);
        return msg;
    }
}
src/main/java/com/gk/hotwork/Domain/SafetyFacilityInspection.java
@@ -3,6 +3,8 @@
import java.io.Serializable;
import java.util.Date;
import org.springframework.data.annotation.Transient;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -50,6 +52,28 @@
    /** 联系电话  telephone **/
    private String telephone;
    /** 企业名称  company **/
    private String company;
    /** 受理时间  accept_ time **/
    private Date acceptTime;
    /** 自定义评审开始时间  review_time **/
    private Date reviewTime;
    /** 自定义审查开始时间  examine_time **/
    private Date examineTime;
    /** 补正告知书  correctpdf **/
    private String correctpdf;
    /** 审查意见书编号  examine_pageno **/
    private String examinePageno;
    /** 审查耗时(-天-时-分)  examine_taketime **/
    private String examineTaketime;
    /**   主键id  id   **/
    public Long getId() {
@@ -170,4 +194,87 @@
    public void setTelephone(String telephone) {
        this.telephone = telephone == null ? null : telephone.trim();
    }
    /**   企业名称  company   **/
    public String getCompany() {
        return company;
    }
    /**   企业名称  company   **/
    public void setCompany(String company) {
        this.company = company == null ? null : company.trim();
    }
    /**   受理时间  accept_ time   **/
    public Date getAcceptTime() {
        return acceptTime;
    }
    /**   受理时间  accept_ time   **/
    public void setAcceptTime(Date acceptTime) {
        this.acceptTime = acceptTime;
    }
    /**   自定义评审开始时间  review_time   **/
    public Date getReviewTime() {
        return reviewTime;
    }
    /**   自定义评审开始时间  review_time   **/
    public void setReviewTime(Date reviewTime) {
        this.reviewTime = reviewTime;
    }
    /**   自定义审查开始时间  examine_time   **/
    public Date getExamineTime() {
        return examineTime;
    }
    /**   自定义审查开始时间  examine_time   **/
    public void setExamineTime(Date examineTime) {
        this.examineTime = examineTime;
    }
    /**   补正告知书  correctpdf   **/
    public String getCorrectpdf() {
        return correctpdf;
    }
    /**   补正告知书  correctpdf   **/
    public void setCorrectpdf(String correctpdf) {
        this.correctpdf = correctpdf == null ? null : correctpdf.trim();
    }
    /**   审查意见书编号  examine_pageno   **/
    public String getExaminePageno() {
        return examinePageno;
    }
    /**   审查意见书编号  examine_pageno   **/
    public void setExaminePageno(String examinePageno) {
        this.examinePageno = examinePageno == null ? null : examinePageno.trim();
    }
    /**   专家姓名  expertName **/
    @Transient
    private String expertName;
    @Transient
    public String getExpertName() {
        return expertName;
    }
    public void setExpertName(String expertName) {
        this.expertName = expertName;
    }
    /**   审查耗时(-天-时-分)  examine_taketime   **/
    public String getExamineTaketime() {
        return examineTaketime;
    }
    /**   审查耗时(-天-时-分)  examine_taketime   **/
    public void setExamineTaketime(String examineTaketime) {
        this.examineTaketime = examineTaketime == null ? null : examineTaketime.trim();
    }
}
src/main/java/com/gk/hotwork/Domain/SafetyFacilityProcessflow.java
对比新文件
@@ -0,0 +1,186 @@
package com.gk.hotwork.Domain;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import org.springframework.data.annotation.Transient;
import com.baomidou.mybatisplus.annotation.TableName;
@TableName("safety_facility_processflow")
public class SafetyFacilityProcessflow implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 9099478058115190759L;
    /** 主键id  id **/
    private Long id;
    /** 有效标识  valid_flag **/
    private Byte validFlag;
    /** 创建时间  create_time **/
    private Date createTime;
    /** 创建人  create_by **/
    private String createBy;
    /** 最新更新时间  update_time **/
    private Date updateTime;
    /** 处理时间  check_time **/
    private Date checkTime;
    /** 处理状态  progress_name **/
    private String progressName;
    /** 处理结果  result **/
    private String result;
    /** 处理反馈意见  resolution **/
    private String resolution;
    /** 处理人  process_by **/
    private String processBy;
    /** 耗时(分钟)  take_time **/
    private Integer takeTime;
    /** 关联安全业务审查ID  link_inspection_id **/
    private Long linkInspectionId;
    /**   专家姓名  expertName **/
    @Transient
    private List<SafetyFacilityProcessflow> childFlow;
    @Transient
    public List<SafetyFacilityProcessflow> getChildFlow() {
        return childFlow;
    }
    public void setChildFlow(List<SafetyFacilityProcessflow> childFlow) {
        this.childFlow = childFlow;
    }
    /**   主键id  id   **/
    public Long getId() {
        return id;
    }
    /**   主键id  id   **/
    public void setId(Long id) {
        this.id = id;
    }
    /**   有效标识  valid_flag   **/
    public Byte getValidFlag() {
        return validFlag;
    }
    /**   有效标识  valid_flag   **/
    public void setValidFlag(Byte validFlag) {
        this.validFlag = validFlag;
    }
    /**   创建时间  create_time   **/
    public Date getCreateTime() {
        return createTime;
    }
    /**   创建时间  create_time   **/
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    /**   创建人  create_by   **/
    public String getCreateBy() {
        return createBy;
    }
    /**   创建人  create_by   **/
    public void setCreateBy(String createBy) {
        this.createBy = createBy == null ? null : createBy.trim();
    }
    /**   最新更新时间  update_time   **/
    public Date getUpdateTime() {
        return updateTime;
    }
    /**   最新更新时间  update_time   **/
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    /**   处理时间  check_time   **/
    public Date getCheckTime() {
        return checkTime;
    }
    /**   处理时间  check_time   **/
    public void setCheckTime(Date checkTime) {
        this.checkTime = checkTime;
    }
    /**   处理状态  progress_name   **/
    public String getProgressName() {
        return progressName;
    }
    /**   处理状态  progress_name   **/
    public void setProgressName(String progressName) {
        this.progressName = progressName == null ? null : progressName.trim();
    }
    /**   处理结果  result   **/
    public String getResult() {
        return result;
    }
    /**   处理结果  result   **/
    public void setResult(String result) {
        this.result = result == null ? null : result.trim();
    }
    /**   处理反馈意见  resolution   **/
    public String getResolution() {
        return resolution;
    }
    /**   处理反馈意见  resolution   **/
    public void setResolution(String resolution) {
        this.resolution = resolution == null ? null : resolution.trim();
    }
    /**   处理人  process_by   **/
    public String getProcessBy() {
        return processBy;
    }
    /**   处理人  process_by   **/
    public void setProcessBy(String processBy) {
        this.processBy = processBy == null ? null : processBy.trim();
    }
    /**   耗时(分钟)  take_time   **/
    public Integer getTakeTime() {
        return takeTime;
    }
    /**   耗时(分钟)  take_time   **/
    public void setTakeTime(Integer takeTime) {
        this.takeTime = takeTime;
    }
    /**   安全业务审查ID  link_inspection_id   **/
    public Long getLinkInspectionId() {
        return linkInspectionId;
    }
    /**   安全业务审查ID  link_inspection_id   **/
    public void setLinkInspectionId(Long linkInspectionId) {
        this.linkInspectionId = linkInspectionId;
    }
}
src/main/java/com/gk/hotwork/Mapper/SafetyFacilityProcessflowMapper.java
对比新文件
@@ -0,0 +1,33 @@
package com.gk.hotwork.Mapper;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gk.hotwork.Domain.SafetyFacilityProcessflow;
@Repository
public interface SafetyFacilityProcessflowMapper extends BaseMapper<SafetyFacilityProcessflow>{
    int deleteByPrimaryKey(Long id);
    int deleteBylinkInspectionId(Long inspectionId);
    int insert(SafetyFacilityProcessflow record);
    int insertSelective(SafetyFacilityProcessflow record);
    SafetyFacilityProcessflow selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(SafetyFacilityProcessflow record);
    int updateByPrimaryKey(SafetyFacilityProcessflow record);
    void modPending(Long linkInspectionId);
    IPage<SafetyFacilityProcessflow> processflowPages(Page<SafetyFacilityProcessflow> page,@Param("params") Map<String, Object> params);
}
src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyFacilityInspectionMapper.xml
@@ -8,18 +8,26 @@
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
    <result column="submit_date" property="submitDate" jdbcType="TIMESTAMP" />
    <result column="submit_date" property="submitDate" jdbcType="DATE" />
    <result column="type" property="type" jdbcType="INTEGER" />
    <result column="project_name" property="projectName" jdbcType="VARCHAR" />
    <result column="progress" property="progress" jdbcType="INTEGER" />
    <result column="expert" property="expert" jdbcType="VARCHAR" />
    <result column="contact" property="contact" jdbcType="VARCHAR" />
    <result column="telephone" property="telephone" jdbcType="VARCHAR" />
    <result column="company" property="company" jdbcType="VARCHAR" />
    <result column="accept_time" property="acceptTime" jdbcType="TIMESTAMP" />
    <result column="review_time" property="reviewTime" jdbcType="TIMESTAMP" />
    <result column="examine_time" property="examineTime" jdbcType="TIMESTAMP" />
    <result column="correctpdf" property="correctpdf" jdbcType="VARCHAR" />
    <result column="examine_pageno" property="examinePageno" jdbcType="VARCHAR" />
    <result column="examine_taketime" property="examineTaketime" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--          -->
    id, valid_flag, create_time, create_by, update_time, submit_date, type, project_name, 
    progress, expert, contact, telephone
    progress, expert, contact, telephone, company, accept_time, review_time, examine_time,
    correctpdf, examine_pageno, examine_taketime
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    <!--          -->
@@ -38,13 +46,17 @@
    insert into safety_facility_inspection (id, valid_flag, create_time, 
      create_by, update_time, submit_date, 
      type, project_name, progress, 
      expert, contact, telephone
      )
      expert, contact, telephone,
      company, accept_time, review_time,
      examine_time, correctpdf, examine_pageno,
      examine_taketime)
    values (#{id,jdbcType=BIGINT}, #{validFlag,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, 
      #{createBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{submitDate,jdbcType=TIMESTAMP},
      #{createBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{submitDate,jdbcType=DATE},
      #{type,jdbcType=INTEGER}, #{projectName,jdbcType=VARCHAR}, #{progress,jdbcType=INTEGER}, 
      #{expert,jdbcType=VARCHAR}, #{contact,jdbcType=VARCHAR}, #{telephone,jdbcType=VARCHAR}
      )
      #{expert,jdbcType=VARCHAR}, #{contact,jdbcType=VARCHAR}, #{telephone,jdbcType=VARCHAR},
      #{company,jdbcType=VARCHAR}, #{acceptTime,jdbcType=TIMESTAMP}, #{reviewTime,jdbcType=TIMESTAMP},
      #{examineTime,jdbcType=TIMESTAMP}, #{correctpdf,jdbcType=VARCHAR}, #{examinePageno,jdbcType=VARCHAR},
      #{examineTaketime,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.gk.hotwork.Domain.SafetyFacilityInspection" >
    <!--          -->
@@ -86,6 +98,27 @@
      <if test="telephone != null" >
        telephone,
      </if>
      <if test="company != null" >
        company,
      </if>
      <if test="acceptTime != null" >
        accept_time,
      </if>
      <if test="reviewTime != null" >
        review_time,
      </if>
      <if test="examineTime != null" >
        examine_time,
      </if>
      <if test="correctpdf != null" >
        correctpdf,
      </if>
      <if test="examinePageno != null" >
        examine_pageno,
      </if>
      <if test="examineTaketime != null" >
        examine_taketime,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
@@ -104,7 +137,7 @@
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="submitDate != null" >
        #{submitDate,jdbcType=TIMESTAMP},
        #{submitDate,jdbcType=DATE},
      </if>
      <if test="type != null" >
        #{type,jdbcType=INTEGER},
@@ -123,6 +156,27 @@
      </if>
      <if test="telephone != null" >
        #{telephone,jdbcType=VARCHAR},
      </if>
      <if test="company != null" >
        #{company,jdbcType=VARCHAR},
      </if>
      <if test="acceptTime != null" >
        #{acceptTime,jdbcType=TIMESTAMP},
      </if>
      <if test="reviewTime != null" >
        #{reviewTime,jdbcType=TIMESTAMP},
      </if>
      <if test="examineTime != null" >
        #{examineTime,jdbcType=TIMESTAMP},
      </if>
      <if test="correctpdf != null" >
        #{correctpdf,jdbcType=VARCHAR},
      </if>
      <if test="examinePageno != null" >
        #{examinePageno,jdbcType=VARCHAR},
      </if>
      <if test="examineTaketime != null" >
        #{examineTaketime,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
@@ -143,7 +197,7 @@
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="submitDate != null" >
        submit_date = #{submitDate,jdbcType=TIMESTAMP},
        submit_date = #{submitDate,jdbcType=DATE},
      </if>
      <if test="type != null" >
        type = #{type,jdbcType=INTEGER},
@@ -163,6 +217,27 @@
      <if test="telephone != null" >
        telephone = #{telephone,jdbcType=VARCHAR},
      </if>
      <if test="company != null" >
        company = #{company,jdbcType=VARCHAR},
      </if>
      <if test="acceptTime != null" >
        accept_time = #{acceptTime,jdbcType=TIMESTAMP},
      </if>
      <if test="reviewTime != null" >
        review_time = #{reviewTime,jdbcType=TIMESTAMP},
      </if>
      <if test="examineTime != null" >
        examine_time = #{examineTime,jdbcType=TIMESTAMP},
      </if>
      <if test="correctpdf != null" >
        correctpdf = #{correctpdf,jdbcType=VARCHAR},
      </if>
      <if test="examinePageno != null" >
        examine_pageno = #{examinePageno,jdbcType=VARCHAR},
      </if>
      <if test="examineTaketime != null" >
        examine_taketime = #{examineTaketime,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
@@ -173,13 +248,20 @@
      create_time = #{createTime,jdbcType=TIMESTAMP},
      create_by = #{createBy,jdbcType=VARCHAR},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      submit_date = #{submitDate,jdbcType=TIMESTAMP},
      submit_date = #{submitDate,jdbcType=DATE},
      type = #{type,jdbcType=INTEGER},
      project_name = #{projectName,jdbcType=VARCHAR},
      progress = #{progress,jdbcType=INTEGER},
      expert = #{expert,jdbcType=VARCHAR},
      contact = #{contact,jdbcType=VARCHAR},
      telephone = #{telephone,jdbcType=VARCHAR}
      telephone = #{telephone,jdbcType=VARCHAR},
      company = #{company,jdbcType=VARCHAR},
      accept_time = #{acceptTime,jdbcType=TIMESTAMP},
      review_time = #{reviewTime,jdbcType=TIMESTAMP},
      examine_time = #{examineTime,jdbcType=TIMESTAMP},
      correctpdf = #{correctpdf,jdbcType=VARCHAR},
      examine_pageno = #{examinePageno,jdbcType=VARCHAR},
      examine_taketime = #{examineTaketime,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  
@@ -194,12 +276,24 @@
    <if test="params.submitDateEndTime != null  and params.submitDateEndTime != ''">
      and submit_date &lt;=#{params.submitDateEndTime,jdbcType=VARCHAR} 
    </if>
    <if test="params.expert != null">
      and expert = #{params.expert,jdbcType=VARCHAR}
    <if test="params.expert != null  and params.expert != ''">
        and expert like concat("%",#{params.expert,jdbcType=VARCHAR},"%")
    </if>
    <if test="params.progress != null">
      and progress = #{params.progress,jdbcType=INTEGER}
    </if>
    <if test="params.type != null and params.type != ''">
      and type = #{params.type,jdbcType=INTEGER}
    </if>
       <if test="params.createBy != null and params.createBy != ''">
      and create_by = #{params.createBy,jdbcType=VARCHAR}
    </if>
    <if test="params.company != null and params.company.size > 0">
      and company in
      <foreach collection="params.company" index="index" item="item" open="(" separator="," close=")">
          #{item}
      </foreach>
     </if>
    ORDER BY
    type,
    create_time DESC
src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyFacilityProcessflowMapper.xml
对比新文件
@@ -0,0 +1,215 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.gk.hotwork.Mapper.SafetyFacilityProcessflowMapper" >
  <resultMap id="BaseResultMap" type="com.gk.hotwork.Domain.SafetyFacilityProcessflow" >
    <!--          -->
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="valid_flag" property="validFlag" jdbcType="TINYINT" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
    <result column="check_time" property="checkTime" jdbcType="TIMESTAMP" />
    <result column="progress_name" property="progressName" jdbcType="VARCHAR" />
    <result column="result" property="result" jdbcType="VARCHAR" />
    <result column="resolution" property="resolution" jdbcType="VARCHAR" />
    <result column="process_by" property="processBy" jdbcType="VARCHAR" />
    <result column="take_time" property="takeTime" jdbcType="INTEGER" />
    <result column="link_inspection_id" property="linkInspectionId" jdbcType="BIGINT" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--          -->
    id, valid_flag, create_time, create_by, update_time, check_time, progress_name, result,
    resolution, process_by, take_time, link_inspection_id
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    <!--          -->
    select
    <include refid="Base_Column_List" />
    from safety_facility_processflow
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    <!--          -->
    delete from safety_facility_processflow
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="modPending" parameterType="java.lang.Long" >
    <!--          -->
    delete from safety_facility_processflow
    where link_inspection_id = #{linkInspectionId,jdbcType=BIGINT}
    and progress_name like '待%'
  </delete>
    <delete id="deleteBylinkInspectionId" parameterType="java.lang.Long" >
    <!--          -->
    update safety_facility_processflow set valid_flag = 0
    where link_inspection_id = #{linkInspectionId,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.gk.hotwork.Domain.SafetyFacilityProcessflow" >
    <!--          -->
    insert into safety_facility_processflow (id, valid_flag, create_time,
      create_by, update_time, check_time,
      progress_name, result, resolution,
      process_by, take_time, link_inspection_id
      )
    values (#{id,jdbcType=BIGINT}, #{validFlag,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP},
      #{createBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{checkTime,jdbcType=TIMESTAMP},
      #{progressName,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR}, #{resolution,jdbcType=VARCHAR},
      #{processBy,jdbcType=VARCHAR}, #{takeTime,jdbcType=INTEGER}, #{linkInspectionId,jdbcType=BIGINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.gk.hotwork.Domain.SafetyFacilityProcessflow" >
    <!--          -->
    insert into safety_facility_processflow
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="validFlag != null" >
        valid_flag,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="createBy != null" >
        create_by,
      </if>
      <if test="updateTime != null" >
        update_time,
      </if>
      <if test="checkTime != null" >
        check_time,
      </if>
      <if test="progressName != null" >
        progress_name,
      </if>
      <if test="result != null" >
        result,
      </if>
      <if test="resolution != null" >
        resolution,
      </if>
      <if test="processBy != null" >
        process_by,
      </if>
      <if test="takeTime != null" >
        take_time,
      </if>
      <if test="linkInspectionId != null" >
        link_inspection_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=BIGINT},
      </if>
      <if test="validFlag != null" >
        #{validFlag,jdbcType=TINYINT},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createBy != null" >
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null" >
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="checkTime != null" >
        #{checkTime,jdbcType=TIMESTAMP},
      </if>
      <if test="progressName != null" >
        #{progressName,jdbcType=VARCHAR},
      </if>
      <if test="result != null" >
        #{result,jdbcType=VARCHAR},
      </if>
      <if test="resolution != null" >
        #{resolution,jdbcType=VARCHAR},
      </if>
      <if test="processBy != null" >
        #{processBy,jdbcType=VARCHAR},
      </if>
      <if test="takeTime != null" >
        #{takeTime,jdbcType=INTEGER},
      </if>
      <if test="linkInspectionId != null" >
        #{linkInspectionId,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.gk.hotwork.Domain.SafetyFacilityProcessflow" >
    <!--          -->
    update safety_facility_processflow
    <set >
      <if test="validFlag != null" >
        valid_flag = #{validFlag,jdbcType=TINYINT},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createBy != null" >
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null" >
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="checkTime != null" >
        check_time = #{checkTime,jdbcType=TIMESTAMP},
      </if>
      <if test="progressName != null" >
        progress_name = #{progressName,jdbcType=VARCHAR},
      </if>
      <if test="result != null" >
        result = #{result,jdbcType=VARCHAR},
      </if>
      <if test="resolution != null" >
        resolution = #{resolution,jdbcType=VARCHAR},
      </if>
      <if test="processBy != null" >
        process_by = #{processBy,jdbcType=VARCHAR},
      </if>
      <if test="takeTime != null" >
        take_time = #{takeTime,jdbcType=INTEGER},
      </if>
      <if test="linkInspectionId != null" >
        link_inspection_id = #{linkInspectionId,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.gk.hotwork.Domain.SafetyFacilityProcessflow" >
    <!--          -->
    update safety_facility_processflow
    set valid_flag = #{validFlag,jdbcType=TINYINT},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      create_by = #{createBy,jdbcType=VARCHAR},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      check_time = #{checkTime,jdbcType=TIMESTAMP},
      progress_name = #{progressName,jdbcType=VARCHAR},
      result = #{result,jdbcType=VARCHAR},
      resolution = #{resolution,jdbcType=VARCHAR},
      process_by = #{processBy,jdbcType=VARCHAR},
      take_time = #{takeTime,jdbcType=INTEGER},
      link_inspection_id = #{linkInspectionId,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
    <select id="processflowPages" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from safety_facility_processflow
    where valid_flag = 1
    <if test="params.linkInspectionId != null">
      and link_inspection_id = #{params.linkInspectionId,jdbcType=BIGINT}
    </if>
    ORDER BY
    create_time ASC
  </select>
</mapper>
src/main/java/com/gk/hotwork/Service/SafetyFacilityInspectionService.java
@@ -33,7 +33,7 @@
    /**
    * @Description: 根据ID查询
    */
    SafetyFacilityInspection info(Long id, UserInfo user);
    SafetyFacilityInspection selectByPrimaryKey(Long id, UserInfo user);
}
src/main/java/com/gk/hotwork/Service/SafetyFacilityProcessflowService.java
对比新文件
@@ -0,0 +1,48 @@
package com.gk.hotwork.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gk.hotwork.Domain.SafetyFacilityProcessflow;
import com.gk.hotwork.Domain.UserInfo;
public interface SafetyFacilityProcessflowService extends IService<SafetyFacilityProcessflow> {
    /**
    * @Description: 分页
    */
    IPage<SafetyFacilityProcessflow> processflowPages(Page<SafetyFacilityProcessflow> page, Map<String, Object> filter, UserInfo user);
    /**
    * @Description: 新增
    */
    void addOne(SafetyFacilityProcessflow param, UserInfo user);
    /**
    * @Description: 修改
    */
    void modOne(SafetyFacilityProcessflow param, UserInfo user);
    /**
    * @Description: 删除
    */
    void delOne(Long id, UserInfo user);
    /**
    * @Description: 根据ID查询
    */
    SafetyFacilityProcessflow info(Long id, UserInfo user);
    /**
    * @Description: 更改待处理流程
    */
    void modPending(Long linkInspectionId, UserInfo user);
    /**
    * @Description: 删除安全项目对应处理流程
    */
    void deleteBylinkInspectionId(Long linkInspectionId, UserInfo user);
}
src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyFacilityInspectionImpl.java
@@ -1,62 +1,159 @@
package com.gk.hotwork.Service.ServiceImpl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gk.hotwork.Domain.CompanyInfo;
import com.gk.hotwork.Domain.SafetyFacilityInspection;
import com.gk.hotwork.Domain.SafetyFacilityProcessflow;
import com.gk.hotwork.Domain.SafetyInspectionItemDeduction;
import com.gk.hotwork.Domain.UserInfo;
import com.gk.hotwork.Mapper.CompanyInfoMapper;
import com.gk.hotwork.Mapper.SafetyFacilityInspectionMapper;
import com.gk.hotwork.Mapper.SafetyFacilityProcessflowMapper;
import com.gk.hotwork.Mapper.UserInfoMapper;
import com.gk.hotwork.Service.SafetyFacilityInspectionService;
@Service("SafetyFacilityInspectionService")
@Transactional
public class SafetyFacilityInspectionImpl extends ServiceImpl<SafetyFacilityInspectionMapper,SafetyFacilityInspection> implements SafetyFacilityInspectionService {
public class SafetyFacilityInspectionImpl extends ServiceImpl<SafetyFacilityInspectionMapper, SafetyFacilityInspection>
        implements SafetyFacilityInspectionService {
    
    @Autowired
    private SafetyFacilityInspectionMapper safetyFacilityInspectionMapper;
    @Autowired
    private SafetyFacilityProcessflowMapper safetyFacilityProcessflowMapper;
    @Autowired
    private UserInfoMapper userInfoMapper;
    @Autowired
    private CompanyInfoMapper companyInfoMapper;
    @Override
    public IPage<SafetyFacilityInspection> selectPage(Page<SafetyFacilityInspection> page, Map<String, Object> filter, UserInfo user) {
    public IPage<SafetyFacilityInspection> selectPage(Page<SafetyFacilityInspection> page, Map<String, Object> filter,
            UserInfo user) {
        Date date = new Date();
        if (user.getType() == 3 ) {
            filter.put("createBy", user.getUsername());
        }
        if (user.getType() == 4) {
            filter.put("expert", user.getId());
        }
        if (user.getType() == 2) {
            QueryWrapper<CompanyInfo> queryWrapper = new QueryWrapper<CompanyInfo>();
            queryWrapper.eq("city", user.getCity());
            queryWrapper.eq("province", user.getProvince());
            List<CompanyInfo> list = companyInfoMapper.selectList(queryWrapper);
            List<String> companyList = new ArrayList<String>();
            for (CompanyInfo companyInfo : list) {
                companyList.add(companyInfo.getCompany());
            }
            filter.put("company", companyList);
        }
        if("安科院".equals(user.getCompany())){
            filter.remove("createBy");
            filter.remove("company");
        }
        IPage<SafetyFacilityInspection> res = safetyFacilityInspectionMapper.selectPages(page,filter);
        List<SafetyFacilityInspection> list = new ArrayList<SafetyFacilityInspection>();
        for (SafetyFacilityInspection safetyFacilityInspection : res.getRecords()) {
            if (safetyFacilityInspection.getProgress() == 10 && safetyFacilityInspection.getReviewTime() != null && safetyFacilityInspection.getReviewTime().before(date)) {
                safetyFacilityInspection.setProgress(11);
                this.updateById(safetyFacilityInspection);
                SafetyFacilityProcessflow flow = new SafetyFacilityProcessflow();
                flow.setCheckTime(new Date());
                flow.setValidFlag(Byte.valueOf("1"));
                flow.setCreateBy("SYSTEM");
                flow.setUpdateTime(date);
                flow.setCreateTime(date);
                flow.setProgressName("评审中");
                flow.setResult("预置时间到");
                flow.setLinkInspectionId(safetyFacilityInspection.getId());
                flow.setProcessBy(user.getRealname());
                safetyFacilityProcessflowMapper.insert(flow);
                safetyFacilityProcessflowMapper.modPending(safetyFacilityInspection.getId());
            }
            if (safetyFacilityInspection.getProgress() == 20 && safetyFacilityInspection.getExamineTime() != null && safetyFacilityInspection.getExamineTime().before(date)) {
                safetyFacilityInspection.setProgress(21);
                this.updateById(safetyFacilityInspection);
                SafetyFacilityProcessflow flow = new SafetyFacilityProcessflow();
                flow.setCheckTime(new Date());
                flow.setValidFlag(Byte.valueOf("1"));
                flow.setCreateBy("SYSTEM");
                flow.setUpdateTime(date);
                flow.setCreateTime(date);
                flow.setProgressName("审查中");
                flow.setResult("预置时间到");
                flow.setLinkInspectionId(safetyFacilityInspection.getId());
                flow.setProcessBy(user.getRealname());
                safetyFacilityProcessflowMapper.insert(flow);
                safetyFacilityProcessflowMapper.modPending(safetyFacilityInspection.getId());
            }
            if (safetyFacilityInspection.getExpert() != null) {
                String[] expertIds = safetyFacilityInspection.getExpert().split(",");
                String expertName = "";
                List<UserInfo> temp = userInfoMapper.selectBatchIds(Arrays.asList(expertIds));
                for (UserInfo userInfo : temp) {
                    expertName += "," + userInfo.getRealname();
                }
                safetyFacilityInspection.setExpertName(expertName.substring(1));
            }
            list.add(safetyFacilityInspection);
        }
        res.setRecords(list);
        return res;
    }
    @Override
    public void addOne(SafetyFacilityInspection param, UserInfo user) {
        Date date = new Date();
        String username = user.getRealname();
        String username = user.getUsername();
        param.setValidFlag(Byte.valueOf("1"));
        param.setCreateBy(username);
        param.setUpdateTime(date);
        param.setCreateTime(date);
        param.setSubmitDate(date);
        param.setSubmitDate(param.getSubmitDate() == null ? date : param.getSubmitDate());
        param.setProgress(Integer.valueOf(0));
        param.setCompany(param.getCompany() == null ? user.getCompany() : param.getCompany());
        this.save(param); 
    }
    @Override
    public void modOne(SafetyFacilityInspection param, UserInfo user) {
        // TODO Auto-generated method stub
        param.setUpdateTime(new Date());
        this.updateById(param);
    }
    @Override
    public void delOne(Long id, UserInfo user) {
        // TODO Auto-generated method stub
        SafetyFacilityInspection object = safetyFacilityInspectionMapper.selectByPrimaryKey(id);
        object.setValidFlag(Byte.valueOf("0"));
        object.setUpdateTime(new Date());
        this.updateById(object);
        
    }
    @Override
    public SafetyFacilityInspection info(Long id, UserInfo user) {
        // TODO Auto-generated method stub
        return null;
    public SafetyFacilityInspection selectByPrimaryKey(Long id, UserInfo user) {
        return safetyFacilityInspectionMapper.selectByPrimaryKey(id);
    }
}
src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyFacilityProcessflowImpl.java
对比新文件
@@ -0,0 +1,71 @@
package com.gk.hotwork.Service.ServiceImpl;
import java.util.Date;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gk.hotwork.Domain.SafetyFacilityProcessflow;
import com.gk.hotwork.Domain.UserInfo;
import com.gk.hotwork.Mapper.SafetyFacilityProcessflowMapper;
import com.gk.hotwork.Service.SafetyFacilityProcessflowService;
@Service("SafetyFacilityProcessflowService")
@Transactional
public class SafetyFacilityProcessflowImpl extends ServiceImpl<SafetyFacilityProcessflowMapper,SafetyFacilityProcessflow> implements SafetyFacilityProcessflowService {
    @Autowired
    private SafetyFacilityProcessflowMapper safetyFacilityProcessflowMapper;
    @Override
    public IPage<SafetyFacilityProcessflow> processflowPages(Page<SafetyFacilityProcessflow> page, Map<String, Object> filter, UserInfo user) {
        IPage<SafetyFacilityProcessflow> res = safetyFacilityProcessflowMapper.processflowPages(page,filter);
        return res;
    }
    @Override
    public void addOne(SafetyFacilityProcessflow param, UserInfo user) {
        Date date = new Date();
        String username = user.getRealname();
        param.setValidFlag(Byte.valueOf("1"));
        param.setCreateBy(username);
        param.setUpdateTime(date);
        param.setCreateTime(date);
        param.setCheckTime(param.getCheckTime()==null?date:param.getCheckTime());
        this.save(param);
    }
    @Override
    public void modOne(SafetyFacilityProcessflow param, UserInfo user) {
        // TODO Auto-generated method stub
    }
    @Override
    public void delOne(Long id, UserInfo user) {
        safetyFacilityProcessflowMapper.deleteByPrimaryKey(id);
    }
    @Override
    public SafetyFacilityProcessflow info(Long id, UserInfo user) {
        // TODO Auto-generated method stub
        return null;
    }
    @Override
    public void modPending(Long linkInspectionId, UserInfo user) {
        safetyFacilityProcessflowMapper.modPending(linkInspectionId);
    }
    @Override
    public void deleteBylinkInspectionId(Long linkInspectionId, UserInfo user) {
        safetyFacilityProcessflowMapper.deleteBylinkInspectionId(linkInspectionId);
    }
}