src/main/java/com/gk/hotwork/Controller/Base/BaseController.java
@@ -94,6 +94,11 @@ user.setRealname(jo.getString("realname")); user.setType(jo.getInteger("type")); user.setCompanyid(jo.getLong("companyid")); user.setCompany(jo.getString("company")); user.setProvince(jo.getString("province")); user.setCity(jo.getString("city")); user.setCounty(jo.getString("county")); user.setProfessionalLevel(jo.getInteger("professionalLevel")); user.setDepartment(jo.getLong("department")); user.setDepartmentname(jo.getString("departmentname")); return user; src/main/java/com/gk/hotwork/Controller/InspectionExpertController.java
对比新文件 @@ -0,0 +1,86 @@ package com.gk.hotwork.Controller; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gk.hotwork.Controller.Base.BaseController; import com.gk.hotwork.Domain.InspectionExpert; import com.gk.hotwork.Domain.InspectionHiddenDanger; import com.gk.hotwork.Domain.Utils.FilterObject; import com.gk.hotwork.Domain.Utils.Msg; import com.gk.hotwork.Domain.dto.req.IdParam; import com.gk.hotwork.Service.InspectionExpertService; import com.gk.hotwork.Service.InspectionHiddenDangerService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.Date; import java.util.List; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/17 * @time: 13:36 */ @Api(tags = "监管检查清单-专家成员") @RequestMapping("/expert") @RestController public class InspectionExpertController extends BaseController { @Autowired private InspectionExpertService expertService; @PostMapping("/setLeader") @ApiOperation(value = "修改专家成员数据",response = Msg.class) @ApiImplicitParams({ @ApiImplicitParam(name = "id",value = "主键"), @ApiImplicitParam(name = "isLeader",value = "是否是组长(0否,1是)"), }) public Msg setLeader(@RequestBody InspectionExpert inspectionExpert){ Msg msg = new Msg(); msg.setCode("200"); msg.setMessage("success"); expertService.setLeader(inspectionExpert,getUser()); return msg; } @PostMapping("/del") @ApiOperation(value = "删除专家成员数据",response = Msg.class) public Msg del(@Validated @RequestBody IdParam idParam){ Msg msg = new Msg(); msg.setCode("200"); msg.setMessage("success"); expertService.removeById(idParam.getId()); return msg; } @PostMapping("/listByGroupId") @ApiOperation(value = "根据专家组id获取专家成员数据",response = Msg.class) public Msg getByGroupId(@RequestBody JSONObject jsonObject){ Msg msg = new Msg(); msg.setCode("200"); msg.setMessage("success"); Long expertGroupId = jsonObject.getLong("expertGroupId"); msg.setResult(expertService.getByGroupId(expertGroupId)); return msg; } @PostMapping("/listBySelfInspectionId") @ApiOperation(value = "根据检查清单获取专家成员数据",response = Msg.class) public Msg getBySelfInspectionId(@RequestBody JSONObject jsonObject){ Msg msg = new Msg(); msg.setCode("200"); msg.setMessage("success"); Long selfInspectionId = jsonObject.getLong("selfInspectionId"); msg.setResult(expertService.getBySelfInspectionId(selfInspectionId)); return msg; } } src/main/java/com/gk/hotwork/Controller/InspectionExpertcGroupController.java
对比新文件 @@ -0,0 +1,57 @@ package com.gk.hotwork.Controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gk.hotwork.Controller.Base.BaseController; import com.gk.hotwork.Domain.InspectionExpert; import com.gk.hotwork.Domain.InspectionExpertGroup; import com.gk.hotwork.Domain.InspectionHiddenDanger; import com.gk.hotwork.Domain.Utils.FilterObject; import com.gk.hotwork.Domain.Utils.Msg; import com.gk.hotwork.Domain.dto.req.IdParam; import com.gk.hotwork.Service.InspectionExpertGroupService; import com.gk.hotwork.Service.InspectionHiddenDangerService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.Date; import java.util.List; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/17 * @time: 13:36 */ @Api(tags = "监管检查清单-专家组") @RequestMapping("/expert/group") @RestController public class InspectionExpertcGroupController extends BaseController { @Autowired private InspectionExpertGroupService expertGroupService; @PostMapping("/list/page") @ApiOperation(value = "分页查询隐患排查数据",response = Msg.class) @ApiImplicitParams({ @ApiImplicitParam(name = "pageIndex",value = "当前页码"), @ApiImplicitParam(name = "pageSize",value = "每页行数"), @ApiImplicitParam(name = "inspectionName",value = "检查名称"), @ApiImplicitParam(name = "checkedCompanyName",value = "被检查公司"), @ApiImplicitParam(name = "inspectionStartTime",value = "开始时间"), @ApiImplicitParam(name = "inspectionEndTime",value = "结束时间") }) public Msg selectPage(@RequestBody FilterObject filterObject) { Integer pageIndex = filterObject.getPageIndex(); Integer pageSize = filterObject.getPageSize(); IPage page = expertGroupService.selectPage(new Page<>(pageIndex, pageSize), filterObject.getFilter(), getUser()); return success(page); } } src/main/java/com/gk/hotwork/Controller/InspectionHiddenDangerController.java
对比新文件 @@ -0,0 +1,104 @@ package com.gk.hotwork.Controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gk.hotwork.Controller.Base.BaseController; import com.gk.hotwork.Domain.InspectionHiddenDanger; import com.gk.hotwork.Domain.SpecialityInfo; 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.dto.req.IdParam; import com.gk.hotwork.Domain.dto.req.SpecialityAddReqDTO; import com.gk.hotwork.Domain.dto.req.SpecialityModReqDTO; import com.gk.hotwork.Service.InspectionHiddenDangerService; import com.gk.hotwork.Service.SpecialityService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.Date; import java.util.HashMap; import java.util.List; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/17 * @time: 13:36 */ @Api(tags = "隐患接口(新)") @RequestMapping("/hiddendanger") @RestController public class InspectionHiddenDangerController extends BaseController { @Autowired private InspectionHiddenDangerService dangerService; @PostMapping("/mod") @ApiOperation(value = "修改隐患数据",response = Msg.class) public Msg mod(@RequestBody InspectionHiddenDanger inspectionHiddenDanger){ Msg msg = new Msg(); msg.setCode("200"); msg.setMessage("success"); dangerService.mod(inspectionHiddenDanger,getUser()); return msg; } @PostMapping("/del") @ApiOperation(value = "删除专业数据",response = Msg.class) public Msg del(@Validated @RequestBody IdParam idParam){ Msg msg = new Msg(); msg.setCode("200"); msg.setMessage("success"); InspectionHiddenDanger inspectionHiddenDanger = new InspectionHiddenDanger(); inspectionHiddenDanger.setId(idParam.getId()); inspectionHiddenDanger.setValidFlag(false); inspectionHiddenDanger.setUpdateTime(new Date()); inspectionHiddenDanger.setCreateBy(getUser().getRealname()); dangerService.updateById(inspectionHiddenDanger); return msg; } @PostMapping("/list/page") @ApiOperation(value = "分页查询隐患排查数据",response = Msg.class) @ApiImplicitParams({ @ApiImplicitParam(name = "pageIndex",value = "当前页码"), @ApiImplicitParam(name = "pageSize",value = "每页行数"), @ApiImplicitParam(name = "inspectionName",value = "检查名称"), @ApiImplicitParam(name = "checkedCompanyName",value = "被检查公司"), @ApiImplicitParam(name = "inspectionStartTime",value = "开始时间"), @ApiImplicitParam(name = "inspectionEndTime",value = "结束时间"), @ApiImplicitParam(name = "flag",value = "检查类型"), }) public Msg selectPage(@RequestBody FilterObject filterObject) { Integer pageIndex = filterObject.getPageIndex(); Integer pageSize = filterObject.getPageSize(); IPage page = dangerService.selectPage(new Page<>(pageIndex, pageSize), filterObject.getFilter(), getUser()); return success(page); } @GetMapping("/inspection/hdanger/list") @ApiOperation(value = "检查清单隐患数据列表",response = Msg.class) @ApiImplicitParams({ @ApiImplicitParam(name = "selfInspectionId",value = "检查清单id") }) public Msg inspectionHdangerlist(Long selfInspectionId){ Msg msg = new Msg(); msg.setCode("200"); msg.setMessage("success"); List<InspectionHiddenDanger> specialityInfos = dangerService.inspectionHdangerlist(selfInspectionId); msg.setResult(specialityInfos); return msg; } } src/main/java/com/gk/hotwork/Controller/SafetyInspectionItemController.java
@@ -7,6 +7,7 @@ import com.gk.hotwork.Domain.SafetyInspectionItem; import com.gk.hotwork.Domain.Utils.FilterObject; import com.gk.hotwork.Domain.Utils.Msg; import com.gk.hotwork.Domain.dto.resp.SafetyInspectionElementRespDTO; import com.gk.hotwork.Service.SafetyInspectionItemService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -63,8 +64,8 @@ }) public Msg infoElementA(@RequestBody JSONObject jsonObject) { Long id = jsonObject.getLong("id"); List<SafetyInspectionItem> list = safetyInspectionItemService.infoElementA(id, getUser()); return success(list); SafetyInspectionElementRespDTO respDTO = safetyInspectionItemService.infoElementA(id, getUser()); return success(respDTO); } @@ -85,6 +86,7 @@ return success(); } @ApiOperation("/修改") @PostMapping("/mod") @ApiImplicitParams({ src/main/java/com/gk/hotwork/Controller/SafetySelfInspectionController.java
@@ -8,6 +8,7 @@ import com.gk.hotwork.Domain.SafetySelfInspectionItem; import com.gk.hotwork.Domain.Utils.FilterObject; import com.gk.hotwork.Domain.Utils.Msg; import com.gk.hotwork.Domain.dto.resp.SafetySelfInspectionRespDTO; import com.gk.hotwork.Service.SafetySelfInspectionService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -19,6 +20,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @Api(tags = "安全生产标准化_自查清单") @RestController @@ -28,7 +31,7 @@ @Autowired private SafetySelfInspectionService safetySelfInspectionService; @ApiOperation("分页") @ApiOperation("自排查分页") @PostMapping("/page") @ApiImplicitParams({ @ApiImplicitParam(name = "pageIndex",value = "当前页码"), @@ -46,6 +49,24 @@ IPage page = safetySelfInspectionService.selectPage(new Page<>(pageIndex, pageSize), filterObject.getFilter(), getUser()); return success(page); } @ApiOperation("监管排查分页") @PostMapping("/supervise/page") @ApiImplicitParams({ @ApiImplicitParam(name = "pageIndex",value = "当前页码"), @ApiImplicitParam(name = "pageSize",value = "每页行数"), @ApiImplicitParam(name = "inspectionName",value = "自查清单名称"), @ApiImplicitParam(name = "inspectorName",value = "检查人名称"), @ApiImplicitParam(name = "checkedCompanyId",value = "被检查公司id"), @ApiImplicitParam(name = "inspectionStartTime",value = "开始时间"), @ApiImplicitParam(name = "inspectionEndTime",value = "结束时间"), @ApiImplicitParam(name = "status",value = "状态"), }) public Msg selectSupervisePage(@RequestBody FilterObject filterObject) { Integer pageIndex = filterObject.getPageIndex(); Integer pageSize = filterObject.getPageSize(); IPage page = safetySelfInspectionService.selectSupervisePage(new Page<>(pageIndex, pageSize), filterObject.getFilter(), getUser()); return success(page); } @ApiOperation("/自查清单详情") @PostMapping("/info") @@ -56,7 +77,7 @@ public Msg info(@RequestBody JSONObject jsonObject) { Long id = jsonObject.getLong("id"); String unqualified = jsonObject.getString("unqualified"); SafetySelfInspection safetySelfInspection= safetySelfInspectionService.infoOne(id,unqualified,getUser()); SafetySelfInspectionRespDTO safetySelfInspection= safetySelfInspectionService.infoOne(id,unqualified,getUser()); return success(safetySelfInspection); } @@ -96,6 +117,15 @@ safetySelfInspectionService.modItemInfo(param, getUser()); return success(); } @ApiOperation("/添加专家") @PostMapping("/add/item/expert") @ApiImplicitParams({ @ApiImplicitParam(name = "itemList",value = "检查项集合"), }) public Msg addItemExpert(@RequestBody List<SafetySelfInspectionItem> itemList) { safetySelfInspectionService.addItemExpert(itemList, getUser()); return success(); } @ApiOperation("/新增") @@ -108,11 +138,29 @@ @ApiImplicitParam(name = "inspectionTime",value = "检查时间"), @ApiImplicitParam(name = "status",value = "状态"), @ApiImplicitParam(name = "itemList",value = "检查项集合"), @ApiImplicitParam(name = "elementAList",value = "一级要素id"), }) public Msg add(@RequestBody SafetySelfInspection param) { safetySelfInspectionService.addOne(param, getUser()); return success(); } @ApiOperation("/新增监管排查") @PostMapping("/add/supervise") @ApiImplicitParams({ @ApiImplicitParam(name = "inspectionName",value = "排查清单名称"), @ApiImplicitParam(name = "checkedCompanyId",value = "被检查公司id"), @ApiImplicitParam(name = "checkedCompanyName",value = "被检查公司"), @ApiImplicitParam(name = "inspectionTime",value = "检查时间"), @ApiImplicitParam(name = "status",value = "状态"), @ApiImplicitParam(name = "itemList",value = "检查项集合"), @ApiImplicitParam(name = "elementAList",value = "一级要素id"), @ApiImplicitParam(name = "expertList",value = "专家用户id"), }) public Msg addSupervise(@RequestBody SafetySelfInspection param) { safetySelfInspectionService.addSupervise(param, getUser()); return success(); } @ApiOperation("/修改") @PostMapping("/mod") src/main/java/com/gk/hotwork/Controller/UserController.java
@@ -1760,8 +1760,15 @@ if (StringUtils.isNotBlank(company)) { condition.put("company", company.trim()); } if (StringUtils.isNotBlank(province)) { if(getUser().getType() == 3){ condition.put("companyid", getUser().getCompanyid()); } if(getUser().getType() == 2){ condition.put("province", getUser().getProvince()); condition.put("city", getUser().getCity()); condition.put("area", getUser().getCounty()); } /*if (StringUtils.isNotBlank(province)) { condition.put("province", province.trim()); } @@ -1779,11 +1786,11 @@ if (StringUtils.isNotBlank(community)) { condition.put("community", community.trim()); } UserInfo userInfo = userService.selectByUser(getUser().getUsername()); }*/ /*UserInfo userInfo = userService.selectByUser(getUser().getUsername()); if (!companyService.isMain(userInfo.getCompany())){ condition.put("company",userInfo.getCompany()); } }*/ //是系统菜单下的就显示主体,否则非主体 // if (isMain) { // condition.put("isMain", 1); @@ -1792,6 +1799,9 @@ // } pageInfo.setCondition(condition); companyService.selectDataGrid(pageInfo); if(getUser().getType() ==4 ){ pageInfo.setResult(new ArrayList()); } msg.setResult(pageInfo); return msg; } @@ -2669,4 +2679,23 @@ msg.setResult(userService.selectExpertList(realname)); return msg; } /** * 获取监管辖区内的企业 */ /** * 获取专家用户列表 */ @GetMapping("/company/list") @ApiOperation(value = "获取监管辖区企业数据",response = Msg.class) @ApiImplicitParams({ @ApiImplicitParam(name = "companyName",value = "企业名称"), }) public Msg getCompanyList(String companyName){ Msg msg = new Msg(); msg.setCode("200"); msg.setMessage("success"); msg.setResult(companyService.selectCompanyList(companyName,getUser())); return msg; } } src/main/java/com/gk/hotwork/Domain/ElementTree.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.models.auth.In; import java.io.Serializable; import java.util.Date; @@ -28,9 +29,19 @@ /** 父级ID **/ private Long pid; private Integer point; /** 子节点 **/ private List<ElementTree> children; public Integer getPoint() { return point; } public void setPoint(Integer point) { this.point = point; } public Long getPid() { return pid; } src/main/java/com/gk/hotwork/Domain/InspectionExpert.java
对比新文件 @@ -0,0 +1,57 @@ package com.gk.hotwork.Domain; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.io.Serializable; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/21 * @time: 9:24 */ @TableName("inspection_expert") @Data public class InspectionExpert implements Serializable { @TableField(exist = false) private static final long serialVersionUID = 1L; @TableId(type = IdType.AUTO) private Long id; //专家用户 private Long expertId; //用户类型 private Integer type; //名称 private String name; //是否是组长 0否,1是 private Boolean isLeader; //检查清单id private Long selfInspectionId; //专家组id private Long expertGropId; //身份证 private String idcard; //手机号 private String phone; //职称 private Integer professionalLevel; //专业方向 private String specialityName; //单位名称 private String companyName; } src/main/java/com/gk/hotwork/Domain/InspectionExpertGroup.java
对比新文件 @@ -0,0 +1,54 @@ package com.gk.hotwork.Domain; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/21 * @time: 9:43 */ @Data @TableName("inspection_expert_group") public class InspectionExpertGroup implements Serializable { @TableField(exist = false) private static final long serialVersionUID = 1L; @TableId(type = IdType.AUTO) private Long id; //检查名称 private String inspectionName; //检查时间 private Date inspectionTime; //指定单位 private String checkUnit; //被检查单位id private Long checkedCompanyId; //被检查单位名称 private String checkedCompanyName; //组长 private String expertLeader; //是否有效 private Boolean validFlag; //创建时间 private Date createTime; //检查清单 private Long selfInspectionId; } src/main/java/com/gk/hotwork/Domain/InspectionHiddenDanger.java
对比新文件 @@ -0,0 +1,77 @@ package com.gk.hotwork.Domain; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.util.Date; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/21 * @time: 16:16 */ @Data @TableName("inspection_hidden_danger") public class InspectionHiddenDanger { private Long id; /** * 检查清单Id */ private Long selfInspectionId; private String info; /** * 隐患级别 * 1一般 * 2重大 */ private Integer level; private String url; private Boolean validFlag; /** * 检查项id */ private Long selfInspectionItemId; /** 创建时间 create_time **/ private Date createTime; /** 创建人 create_by **/ private String createBy; /** 最新更新时间 update_time **/ private Date updateTime; /** 最后更新人 update_by **/ private String updateBy; /** * 整改状态 0未整改,1已整改 */ private Byte status; /** * 整改描述 */ private String rectificationInfo; /** * 整改附件 */ private String rectificationUrl; @TableField(exist = false) private String elementAname; @TableField(exist = false) private String elementBname; @TableField(exist = false) private String elementCname; @TableField(exist = false) private String standardizationRequirements; @TableField(exist = false) private String enterpriseStandard; @TableField(exist = false) private String reviewMethod; @TableField(exist = false) private String veto; } src/main/java/com/gk/hotwork/Domain/SafetyInspectionElementA.java
对比新文件 @@ -0,0 +1,24 @@ package com.gk.hotwork.Domain; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/19 * @time: 17:23 */ @Data @TableName("safety_inspection_element_a") public class SafetyInspectionElementA { @TableId(type = IdType.AUTO) private Long id; private Long safetyInspectionId; private Long elementA; } src/main/java/com/gk/hotwork/Domain/SafetySelfInspection.java
@@ -67,7 +67,16 @@ /** 检查项集合 **/ @TableField(exist = false) private List<SafetySelfInspectionItem> itemList; /** * 一级要素 */ @TableField(exist = false) private List<SafetyInspectionElementA> elementAList; /** * 评价专家 */ @TableField(exist = false) private List<InspectionExpert> expertList; /** 主键id id **/ @TableId(type = IdType.AUTO) @@ -88,6 +97,96 @@ /** 最后更新人 update_by **/ private String updateBy; /** 检查单位 **/ private String checkUnit; //检查标识 0自查,1监管检查 private Byte flag; /** * 隐患总数 */ @TableField(exist = false) private Integer hdTocalCount; /** * 一般隐患数量 */ @TableField(exist = false) private Integer sameAsCount; /** * 重大隐患数量 */ @TableField(exist = false) private Integer majorCount; /** * 整改状态 0未整改 1部分整改 2全部整改 */ @TableField(exist = false) private Integer rectificationStatus; public List<InspectionExpert> getExpertList() { return expertList; } public Integer getHdTocalCount() { return hdTocalCount; } public void setHdTocalCount(Integer hdTocalCount) { this.hdTocalCount = hdTocalCount; } public Integer getSameAsCount() { return sameAsCount; } public void setSameAsCount(Integer sameAsCount) { this.sameAsCount = sameAsCount; } public Integer getMajorCount() { return majorCount; } public void setMajorCount(Integer majorCount) { this.majorCount = majorCount; } public Integer getRectificationStatus() { return rectificationStatus; } public void setRectificationStatus(Integer rectificationStatus) { this.rectificationStatus = rectificationStatus; } public void setExpertList(List<InspectionExpert> expertList) { this.expertList = expertList; } public String getCheckUnit() { return checkUnit; } public void setCheckUnit(String checkUnit) { this.checkUnit = checkUnit; } public Byte getFlag() { return flag; } public void setFlag(Byte flag) { this.flag = flag; } public List<SafetyInspectionElementA> getElementAList() { return elementAList; } public void setElementAList(List<SafetyInspectionElementA> elementAList) { this.elementAList = elementAList; } public Long getCheckedCompanyId() { return checkedCompanyId; src/main/java/com/gk/hotwork/Domain/SafetySelfInspectionItem.java
@@ -21,7 +21,7 @@ /** 检查项id safety_inspection_item_id **/ private Long safetyInspectionItemId; /** 检查结果0:否决 1:扣分 safety_inspection_item_result **/ /** 检查结果0:否决 1:扣分 2:合格 safety_inspection_item_result **/ private Integer safetyInspectionItemResult; /** 否决项说明 **/ @@ -42,13 +42,13 @@ /** A级要素 **/ @TableField(exist = false) private Integer elementA; private Long elementA; /** A级要素权重 **/ @TableField(exist = false) private Float elementAWeight; /** B级要素 **/ @TableField(exist = false) private Integer elementB; private Long elementB; /** B级要素 **/ @TableField(exist = false) @@ -75,6 +75,10 @@ /** 扣分项集合 **/ private List<SafetySelfInspectionItemDeduction> selfDeductionList; @TableField(exist = false) /** 隐患项集合 **/ private List<InspectionHiddenDanger> dangerList; /** 主键id id **/ @TableId(type = IdType.AUTO) @@ -94,6 +98,38 @@ /** 最后更新人 update_by **/ private String updateBy; /*专家id*/ private String expertIds; /** * 专家名称 */ private String expertNames; public String getExpertIds() { return expertIds; } public void setExpertIds(String expertIds) { this.expertIds = expertIds; } public String getExpertNames() { return expertNames; } public void setExpertNames(String expertNames) { this.expertNames = expertNames; } public List<InspectionHiddenDanger> getDangerList() { return dangerList; } public void setDangerList(List<InspectionHiddenDanger> dangerList) { this.dangerList = dangerList; } public String getElementCName() { return elementCName; @@ -259,19 +295,19 @@ this.selfDeductionList = selfDeductionList; } public Integer getElementA() { public Long getElementA() { return elementA; } public void setElementA(Integer elementA) { public void setElementA(Long elementA) { this.elementA = elementA; } public Integer getElementB() { public Long getElementB() { return elementB; } public void setElementB(Integer elementB) { public void setElementB(Long elementB) { this.elementB = elementB; } src/main/java/com/gk/hotwork/Domain/Vo/UserVo.java
@@ -53,11 +53,45 @@ * 专业方向id */ private Long specialityId; private String specialityName; /** * 专业等级(1初级,2中级,3高级,4其他) */ private Integer professionalLevel; private String company; private Long companyid; @Override public Long getCompanyid() { return companyid; } @Override public void setCompanyid(Long companyid) { this.companyid = companyid; } public String getSpecialityName() { return specialityName; } public void setSpecialityName(String specialityName) { this.specialityName = specialityName; } @Override public String getCompany() { return company; } @Override public void setCompany(String company) { this.company = company; } private CompanyInfo companyInfo; src/main/java/com/gk/hotwork/Domain/dto/resp/InspectionHiddenDangerRespDTO.java
对比新文件 @@ -0,0 +1,32 @@ package com.gk.hotwork.Domain.dto.resp; import io.swagger.models.auth.In; import lombok.Data; import java.util.Date; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/21 * @time: 17:53 */ @Data public class InspectionHiddenDangerRespDTO { /** * 检查清单id */ private Long selfInspectionId; private Date inspectionTime; private String inspectionName; private Byte flag; private String checkedCompanyName; private Integer hdTocalCount; private Integer sameAsCount; private Integer majorCount; /** * 整改状态 0未整改 1部分整改 2全部整改 */ private Integer rectificationStatus; } src/main/java/com/gk/hotwork/Domain/dto/resp/SafetyInspectionElementRespDTO.java
对比新文件 @@ -0,0 +1,29 @@ package com.gk.hotwork.Domain.dto.resp; import com.gk.hotwork.Domain.SafetyInspectionItem; import lombok.Data; import java.util.List; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/20 * @time: 8:52 */ @Data public class SafetyInspectionElementRespDTO { //要素id private Long elementId; //要素名称 private String elementName; //要素等级 private Integer type; //父级 private Long pid; //检查项目 private List<SafetyInspectionItem> itemList; //孩子节点 private List<SafetyInspectionElementRespDTO> children; } src/main/java/com/gk/hotwork/Domain/dto/resp/SafetySelfInspectionElementRespDTO.java
对比新文件 @@ -0,0 +1,34 @@ package com.gk.hotwork.Domain.dto.resp; import com.gk.hotwork.Domain.SafetyInspectionItem; import com.gk.hotwork.Domain.SafetySelfInspectionItem; import lombok.Data; import java.util.List; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/20 * @time: 8:52 */ @Data public class SafetySelfInspectionElementRespDTO { //要素id private Long elementId; //要素名称 private String elementName; //要素等级 private Integer type; //父级 private Long pid; //总分 private Integer totalScore; //得分 private Integer score; //检查项目 private List<SafetySelfInspectionItem> itemList; //孩子节点 private List<SafetySelfInspectionElementRespDTO> children; } src/main/java/com/gk/hotwork/Domain/dto/resp/SafetySelfInspectionRespDTO.java
对比新文件 @@ -0,0 +1,84 @@ package com.gk.hotwork.Domain.dto.resp; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.util.Date; import java.util.List; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/20 * @time: 16:24 */ @Data public class SafetySelfInspectionRespDTO { /** 自查清单名称 inspection_name **/ private String inspectionName; /** 检查时间 inspection_time **/ @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8") private Date inspectionTime; /** 检察人员 inspector **/ private Long inspector; /** 被检查公司id **/ private Long checkedCompanyId; /** 被检查公司名字 **/ private String checkedCompanyName; /** 状态 0:暂存 1:评审中 2:已评审 status **/ private Integer status; /** 不合格项数 **/ @TableField(exist = false) private Integer unqualifiedItem; /** 项数 **/ @TableField(exist = false) private Integer itemSum; /** 合格率 **/ private String qualifiedRate; /** 角色id **/ private Long roleid; /** 检察人员 **/ private String inspectorName; /** 检查开始时间 **/ @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8") private Date inspectionStartTime; /** 检查结束时间 **/ @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8") private Date inspectionEndTime; /** 主键id id **/ @TableId(type = IdType.AUTO) private Long id; /** 有效标识 valid_flag **/ private Boolean validFlag; /** 创建时间 create_time **/ private Date createTime; /** 创建人 create_by **/ private String createBy; /** 最新更新时间 update_time **/ private Date updateTime; /** 最后更新人 update_by **/ private String updateBy; List<SafetySelfInspectionElementRespDTO> elementList; } src/main/java/com/gk/hotwork/Domain/query/CompanyQuery.java
对比新文件 @@ -0,0 +1,28 @@ package com.gk.hotwork.Domain.query; import lombok.Data; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/21 * @time: 15:57 */ @Data public class CompanyQuery { private String company; private Long companyid; private String province; /** 城市 city **/ private String city; /** 区县 area **/ private String area; /** 乡镇 town **/ private String town; } src/main/java/com/gk/hotwork/Domain/query/InspectionQuery.java
对比新文件 @@ -0,0 +1,37 @@ package com.gk.hotwork.Domain.query; import io.swagger.models.auth.In; import lombok.Data; import java.util.Date; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/22 * @time: 9:41 */ @Data public class InspectionQuery { /** * 检查名称 */ private String inspectionName; /** * 被检查公司 */ private String companyName; /** * 开始时间 */ private Date startTime; /** * 结束时间 */ private Date endTime; /** * 检查类型 */ private Integer flag; } src/main/java/com/gk/hotwork/Mapper/CompanyInfoMapper.java
@@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gk.hotwork.Domain.CompanyInfo; import com.gk.hotwork.Domain.query.CompanyQuery; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @@ -19,4 +20,7 @@ List<CompanyInfo> selectByAll(); CompanyInfo selectExistMain(@Param("id") Long id); List<CompanyInfo> selectCompanyList(@Param("query") CompanyQuery query); } src/main/java/com/gk/hotwork/Mapper/InspectionExpertGroupMapper.java
对比新文件 @@ -0,0 +1,22 @@ package com.gk.hotwork.Mapper; 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.InspectionExpert; import com.gk.hotwork.Domain.InspectionExpertGroup; import com.gk.hotwork.Domain.SafetySelfInspection; import org.springframework.stereotype.Repository; import java.util.Map; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/19 * @time: 17:31 */ @Repository public interface InspectionExpertGroupMapper extends BaseMapper<InspectionExpertGroup> { IPage<InspectionExpertGroup> selectPages(Page<InspectionExpertGroup> page, Map<String, Object> params); } src/main/java/com/gk/hotwork/Mapper/InspectionExpertMapper.java
对比新文件 @@ -0,0 +1,16 @@ package com.gk.hotwork.Mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.gk.hotwork.Domain.InspectionExpert; import com.gk.hotwork.Domain.SafetyInspectionElementA; import org.springframework.stereotype.Repository; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/19 * @time: 17:31 */ @Repository public interface InspectionExpertMapper extends BaseMapper<InspectionExpert> { } src/main/java/com/gk/hotwork/Mapper/InspectionHiddenDangerMapper.java
对比新文件 @@ -0,0 +1,29 @@ package com.gk.hotwork.Mapper; 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.InspectionHiddenDanger; import com.gk.hotwork.Domain.SafetySelfInspection; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; import java.util.Map; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/19 * @time: 17:31 */ @Repository public interface InspectionHiddenDangerMapper extends BaseMapper<InspectionHiddenDanger> { void delByInspectionItemId(InspectionHiddenDanger inspectionHiddenDanger); void delByIds(List<Long> idList); IPage<SafetySelfInspection> selectPages(Page<SafetySelfInspection> page, @Param("params") Map<String, Object> params); List<InspectionHiddenDanger> inspectionHdangerlist(Long selfInspectionId); } src/main/java/com/gk/hotwork/Mapper/SafetyInspectionElementAMapper.java
对比新文件 @@ -0,0 +1,16 @@ package com.gk.hotwork.Mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.gk.hotwork.Domain.SafetyInspectionElementA; import org.springframework.stereotype.Repository; import org.springframework.web.bind.annotation.RequestBody; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/19 * @time: 17:31 */ @Repository public interface SafetyInspectionElementAMapper extends BaseMapper<SafetyInspectionElementA> { } src/main/java/com/gk/hotwork/Mapper/SafetySelfInspectionItemMapper.java
@@ -13,6 +13,7 @@ public interface SafetySelfInspectionItemMapper extends BaseMapper<SafetySelfInspectionItem> { List<SafetySelfInspectionItem> getBySafetySelfInspectionId(@Param("safetySelfInspectionId") Long safetySelfInspectionId); List<SafetySelfInspectionItem> getBySafetySelfInspectionId2(@Param("safetySelfInspectionId") Long safetySelfInspectionId); void deleteById(@Param("id") Long id ,@Param("updateBy") String updateBy ,@Param("updateTime") Date updateTime); @@ -21,4 +22,6 @@ SafetySelfInspectionItem getDetailById(@Param("id")Long id); SafetySelfInspectionItemQualifiedCountDO countQualifiedDataById(@Param("id") Long id); void updateBatch(List<SafetySelfInspectionItem> itemList); } src/main/java/com/gk/hotwork/Mapper/SafetySelfInspectionMapper.java
@@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gk.hotwork.Domain.SafetySelfInspection; import com.gk.hotwork.Domain.SafetySelfInspectionItem; import org.springframework.stereotype.Repository; import java.util.List; import java.util.Map; @Repository @@ -13,4 +15,5 @@ IPage<SafetySelfInspection> selectPages(Page<SafetySelfInspection> page, Map<String, Object> params); } src/main/java/com/gk/hotwork/Mapper/UserInfoMapper.java
@@ -65,4 +65,6 @@ List<UserVo> selectExpertUserDataList(Page<UserVo> page, Map<String, Object> record); List<UserInfo> selectExpertList(String realname); UserVo selectUserVoById(Long userId); } src/main/java/com/gk/hotwork/Mapper/mybatis/CompanyInfoMapper.xml
@@ -37,14 +37,17 @@ <if test="condition.company != null and condition.company !=''"> and company like concat('%',#{condition.company},'%') </if> <if test="condition.companyid != null "> and id = #{condition.companyid} </if> <if test="condition.province != null and condition.province !=''"> and province like concat('%',#{condition.province},'%') and province = #{condition.province} </if> <if test="condition.city != null and condition.city !=''"> and city like concat('%',#{condition.city},'%') and city = #{condition.city} </if> <if test="condition.area != null and condition.area !=''"> and area like concat('%',#{condition.area},'%') and area = #{condition.area} </if> <if test="condition.town != null and condition.town !=''"> and town like concat('%',#{condition.town},'%') @@ -84,4 +87,27 @@ </if> limit 1 </select> <select id="selectCompanyList" resultType="com.gk.hotwork.Domain.CompanyInfo"> select * from company <where> 1=1 and isdel = 0 <if test="query.companyid != null and query.companyid !=''"> and id = #{query.companyid} </if> <if test="query.company != null and query.company !=''"> and company like concat('%',#{query.company},'%') </if> <if test="query.province != null and query.province !=''"> and province = #{query.province} </if> <if test="query.city != null and query.city !=''"> and city = #{query.city} </if> <if test="query.area != null and query.area !=''"> and area = #{query.area} </if> </where> </select> </mapper> src/main/java/com/gk/hotwork/Mapper/mybatis/ElementManagementMapper.xml
@@ -39,12 +39,50 @@ </select> <select id="getElementTree" resultType="java.util.Map"> <!-- <select id="getElementTree" resultType="java.util.Map"> select DISTINCT t.label,t.mt,t.type,t.pid,t.value,(case when (t.keyw is null and t.type>0) then 1 else 0 end ) as isLeaf from( select t1.mt,t1.label,t1.type,t1.value,t1.pid,t2.label as keyw from (select name as label,menu_type as mt,type,id as value,parent_id as pid from element_management WHERE valid_flag=1) t1 left join (select name as label,type,id as value, parent_id as pid from element_management WHERE valid_flag=1) t2 on t1.value=t2.pid) t </select> </select>--> <select id="getElementTree" resultType="java.util.Map"> SELECT DISTINCT t.label, t.mt, t.type, t.pid, t.point, t.value, (CASE WHEN ( t.keyw IS NULL AND t.type > 0 ) THEN 1 ELSE 0 END ) AS isLeaf FROM ( SELECT t1.mt, t1.label, t1.type, t1.value, t1.pid, t1.point, t2.label AS keyw FROM ( SELECT name AS label, menu_type AS mt, type, id AS value, parent_id AS pid, point FROM element_management WHERE valid_flag = 1 ) t1 LEFT JOIN ( SELECT name AS label, type, id AS value, parent_id AS pid FROM element_management WHERE valid_flag = 1 ) t2 ON t1.value= t2.pid ) t </select> </mapper> src/main/java/com/gk/hotwork/Mapper/mybatis/InspectionExpertGroupMapper.xml
对比新文件 @@ -0,0 +1,43 @@ <?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.InspectionExpertGroupMapper" > <select id="selectPages" resultType="com.gk.hotwork.Domain.InspectionExpertGroup"> SELECT g.* FROM inspection_expert_group g left join safety_self_inspection s on s.id = g.self_inspection_id left join company as co on g.checked_company_id = co.id WHERE g.valid_flag =1 and s.valid_flag = 1 <if test="params.inspectionName != null and params.inspectionName != ''"> and g.inspection_name like concat("%",#{params.inspectionName},"%") </if> <if test="params.checkedCompanyName != null and params.checkedCompanyName != ''"> and g.checked_company_name like concat("%",#{params.checkedCompanyName},"%") </if> <if test="params.flag != null and params.flag != '' "> and s.flag = #{params.flag} </if> <if test="params.inspectionStartTime != null and params.inspectionStartTime != ''" > and g.inspection_time <![CDATA[ >= ]]> #{params.inspectionStartTime} </if> <if test="params.inspectionEndTime != null and params.inspectionEndTime != ''" > and g.inspection_time <![CDATA[ <= ]]> #{params.inspectionEndTime} </if> <if test="params.province != null and params.province != ''" > and co.province = #{params.province} </if> <if test="params.city != null and params.city != ''" > and co.city = #{params.city} </if> <if test="params.area != null and params.area != ''" > and co.area = #{params.area} </if> ORDER BY g.create_time </select> </mapper> src/main/java/com/gk/hotwork/Mapper/mybatis/InspectionHiddenDangerMapper.xml
对比新文件 @@ -0,0 +1,83 @@ <?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.InspectionHiddenDangerMapper" > <update id="delByInspectionItemId"> update inspection_hidden_danger set valid_flag = 0 , update_time = #{inspectionHiddenDanger.updateTime},update_by = #{inspectionHiddenDanger.updateBy} </update> <update id="delByIds"> update inspection_hidden_danger set valid_flag = 0 where id in <foreach collection="idList" item="id" close=")" open="(" separator=","> #{id} </foreach> </update> <select id="selectPages" resultType="com.gk.hotwork.Domain.SafetySelfInspection"> SELECT s.* FROM safety_self_inspection s LEFT JOIN inspection_hidden_danger h ON s.id = h.self_inspection_id left join company as co on s.checked_company_id = co.id WHERE s.valid_flag = 1 AND h.valid_flag = 1 AND h.id IS NOT NULL <if test="params.inspectionName != null and params.inspectionName != ''"> and s.inspection_name like concat("%",#{params.inspectionName},"%") </if> <if test="params.checkedCompanyName != null and params.checkedCompanyName != ''"> and h.checked_company_name like concat("%",#{params.checkedCompanyName},"%") </if> <if test="params.flag != null and params.flag != '' "> and s.flag = #{params.flag} </if> <if test="params.inspectionStartTime != null and params.inspectionStartTime != ''" > and s.inspection_time <![CDATA[ >= ]]> #{params.inspectionStartTime} </if> <if test="params.inspectionEndTime != null and params.inspectionEndTime != ''" > and s.inspection_time <![CDATA[ <= ]]> #{params.inspectionEndTime} </if> <if test="params.province != null and params.province != ''" > and co.province = #{params.province} </if> <if test="params.city != null and params.city != ''" > and co.city = #{params.city} </if> <if test="params.area != null and params.area != ''" > and co.area = #{params.area} </if> GROUP BY s.id ORDER BY s.create_time </select> <select id="inspectionHdangerlist" resultType="com.gk.hotwork.Domain.InspectionHiddenDanger"> SELECT h.*, i.element_a, a.`name` as elementAname, i.element_b, b.`name` as elementBname, i.element_c , c.`name` as elementCname, i.standardization_requirements, i.enterprise_standard, i.review_method, i.veto FROM inspection_hidden_danger h LEFT JOIN safety_self_inspection_item s ON h.self_inspection_item_id = s.id LEFT JOIN safety_inspection_item i ON s.safety_inspection_item_id = i.id left join element_management a on a.id = i.element_a left join element_management b on b.id = i.element_b left join element_management c on c.id = i.element_c where h.valid_flag = 1 and h.self_inspection_id = #{selfInspectionId} </select> </mapper> src/main/java/com/gk/hotwork/Mapper/mybatis/SafetySelfInspectionItemMapper.xml
@@ -20,6 +20,19 @@ <select id="getBySafetySelfInspectionId" resultMap="BaseResultMap"> select * from safety_self_inspection_item where valid_flag = 1 and safety_self_inspection_id=#{safetySelfInspectionId} </select> <select id="getBySafetySelfInspectionId2" resultType="com.gk.hotwork.Domain.SafetySelfInspectionItem"> SELECT ss.* , si.element_a, si.element_b, si.element_c FROM safety_self_inspection_item ss LEFT JOIN safety_inspection_item si on si.id = ss.safety_inspection_item_id WHERE ss.valid_flag = 1 and ss.safety_self_inspection_id = #{safetySelfInspectionId} </select> <update id="deleteById"> update safety_self_inspection_item set @@ -36,6 +49,7 @@ b.enterprise_standard AS enterpriseStandard, b.review_method AS reviewMethod, b.veto AS veto, b.element_c as elementC, c.id AS elementA, c.NAME AS elementAName, c.weight AS elementAWeight, @@ -89,6 +103,18 @@ FROM safety_self_inspection_item WHERE valid_flag = 1 </select> <update id="updateBatch"> <foreach collection="itemList" item="item" index="index" open="" close="" separator=";"> update safety_self_inspection_item set expert_ids=#{item.expertIds}, expert_names=#{item.expertNames}, update_time=#{item.updateTime}, update_by=#{item.updateBy} where id=#{item.id} </foreach> </update> </mapper> src/main/java/com/gk/hotwork/Mapper/mybatis/SafetySelfInspectionMapper.xml
@@ -14,7 +14,7 @@ <result column="inspection_name" property="inspectionName" jdbcType="BIGINT" /> <result column="inspection_time" property="inspectionTime" jdbcType="BIGINT" /> <result column="inspector" property="inspector" jdbcType="VARCHAR" /> <result column="inspector" property="inspector" jdbcType="BIGINT" /> <result column="status" property="status" jdbcType="VARCHAR" /> <result column="inspector_name" property="inspectorName" jdbcType="VARCHAR" /> @@ -27,14 +27,14 @@ LEFT JOIN userroles as c on b.id = c.userid left join company as co on a.checked_company_id = co.id where a.valid_flag = 1 <if test="params.flag != null and params.flag != '' "> and a.flag = #{params.flag} </if> <if test="params.inspectionName != null and params.inspectionName != ''"> and a.inspection_name like concat("%",#{params.inspectionName},"%") </if> <if test="params.companyid != null and params.companyid != ''"> and b.companyid = #{params.companyid} </if> <if test="params.checkedCompanyId != null"> and b.checkedCompanyId = #{params.checkedCompanyId} and a.checked_company_id = #{params.checkedCompanyId} </if> <if test="params.roleid != null "> and c.roleid = #{params.roleid} src/main/java/com/gk/hotwork/Mapper/mybatis/UserInfoMapper.xml
@@ -39,6 +39,7 @@ <result column="password" property="password" jdbcType="VARCHAR" /> <result column="email" property="email" jdbcType="VARCHAR" /> <result column="company" property="company" jdbcType="VARCHAR" /> <result column="companyid" property="companyid" jdbcType="BIGINT" /> <result column="department" property="department" jdbcType="VARCHAR" /> <result column="job" property="job" jdbcType="VARCHAR" /> <result column="createdby" property="createdby" jdbcType="VARCHAR" /> @@ -70,6 +71,8 @@ <result column="city" property="city" jdbcType="VARCHAR" /> <result column="county" property="county" jdbcType="VARCHAR" /> <result column="professional_level" property="professionalLevel" jdbcType="INTEGER" /> <result column="speciality_id" property="specialityId" jdbcType="BIGINT" /> <result column="speciality_name" property="specialityName" jdbcType="VARCHAR" /> <association property="companyInfo" javaType="com.gk.hotwork.Domain.CompanyInfo"> <result column="company_id" property="id" /> <result column="company" property="company" /> @@ -365,10 +368,12 @@ select `user`.*, c.ismain AS isMainCompany, d.department departmentname d.department departmentname, s.name as speciality_name from `user` as user LEFT JOIN company as c ON c.id = `user`.companyid left join department as d on d.id = user.department and d.isdel = 0 left join speciality as s on s.id = `user`.speciality_id where `user`.username = #{username,jdbcType=VARCHAR} and `user`.status = 1 @@ -556,12 +561,26 @@ left join userroles r on r.userid = u.id where u.status = 1 and u.type != 1 and r.roleid = 36 and u.type = 4 <if test="realname != null and realname != ''"> u.realname like concat("%",#{realname},"%") </if> </select> <select id="selectUserVoById" resultType="com.gk.hotwork.Domain.Vo.UserVo"> select `user`.*, c.ismain AS isMainCompany, d.department departmentname, s.name as speciality_name from `user` as user LEFT JOIN company as c ON c.id = `user`.companyid left join department as d on d.id = user.department and d.isdel = 0 left join speciality as s on s.id = `user`.speciality_id where `user`.id = #{userId} and `user`.status = 1 </select> </mapper> src/main/java/com/gk/hotwork/Service/CompanyService.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.gk.hotwork.Domain.CompanyInfo; import com.gk.hotwork.Domain.UserInfo; import com.gk.hotwork.Domain.Utils.PageInfo; import java.util.List; @@ -19,4 +20,6 @@ CompanyInfo selectExistMain(Long id); boolean isMain(String company); List<CompanyInfo> selectCompanyList(String companyName, UserInfo user); } src/main/java/com/gk/hotwork/Service/ElementManagementService.java
@@ -50,4 +50,7 @@ List<ElementTree> getMenuType2Tree(); List<ElementManagement> getElementByParentId(Long elementB); List<ElementTree> getElementTreeByParentId(Long parentId); } src/main/java/com/gk/hotwork/Service/InspectionExpertGroupService.java
对比新文件 @@ -0,0 +1,22 @@ package com.gk.hotwork.Service; 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.InspectionExpert; import com.gk.hotwork.Domain.InspectionExpertGroup; import com.gk.hotwork.Domain.UserInfo; import java.util.Map; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/21 * @time: 9:55 */ public interface InspectionExpertGroupService extends IService<InspectionExpertGroup> { IPage selectPage(Page<InspectionExpertGroup> page, Map<String, Object> filter, UserInfo user); InspectionExpertGroup getBySelfInspectionId(Long id); } src/main/java/com/gk/hotwork/Service/InspectionExpertService.java
对比新文件 @@ -0,0 +1,21 @@ package com.gk.hotwork.Service; import com.baomidou.mybatisplus.extension.service.IService; import com.gk.hotwork.Domain.InspectionExpert; import com.gk.hotwork.Domain.UserInfo; import java.util.List; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/21 * @time: 9:55 */ public interface InspectionExpertService extends IService<InspectionExpert> { void setLeader(InspectionExpert inspectionExpert, UserInfo user); List<InspectionExpert> getByGroupId(Long expertGroupId); List<InspectionExpert> getBySelfInspectionId(Long selfInspectionId); } src/main/java/com/gk/hotwork/Service/InspectionHiddenDangerService.java
对比新文件 @@ -0,0 +1,33 @@ package com.gk.hotwork.Service; 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.InspectionHiddenDanger; import com.gk.hotwork.Domain.SafetySelfInspection; import com.gk.hotwork.Domain.UserInfo; import com.gk.hotwork.Domain.Utils.PageInfo; import java.util.List; import java.util.Map; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/21 * @time: 9:55 */ public interface InspectionHiddenDangerService extends IService<InspectionHiddenDanger> { void mod(InspectionHiddenDanger inspectionHiddenDanger, UserInfo userInfo); void delByInspectionItemId(Long inspectionItemId,UserInfo userInfo); List<InspectionHiddenDanger> getBySafetySelfInspectionItemId(Long inspectionItemId); List<InspectionHiddenDanger> listByPage(PageInfo pageInfo); void delByIds(List<Long> idList); IPage selectPage(Page<SafetySelfInspection> page, Map<String, Object> filter, UserInfo user); List<InspectionHiddenDanger> inspectionHdangerlist(Long selfInspectionId); } src/main/java/com/gk/hotwork/Service/SafetyInspectionElementAService.java
对比新文件 @@ -0,0 +1,17 @@ package com.gk.hotwork.Service; import com.baomidou.mybatisplus.extension.service.IService; import com.gk.hotwork.Domain.SafetyInspectionElementA; import java.util.List; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/19 * @time: 17:28 */ public interface SafetyInspectionElementAService extends IService<SafetyInspectionElementA> { List<SafetyInspectionElementA> getBySafetySelfInspectionId(Long safetyInspectionId); } src/main/java/com/gk/hotwork/Service/SafetyInspectionItemService.java
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.gk.hotwork.Domain.SafetyInspectionItem; import com.gk.hotwork.Domain.UserInfo; import com.gk.hotwork.Domain.dto.resp.SafetyInspectionElementRespDTO; import java.util.List; import java.util.Map; @@ -33,7 +34,7 @@ */ void delOne(Long id, UserInfo user); List<SafetyInspectionItem> infoElementA(Long id, UserInfo user); SafetyInspectionElementRespDTO infoElementA(Long id, UserInfo user); SafetyInspectionItem info(Long id, UserInfo user); src/main/java/com/gk/hotwork/Service/SafetySelfInspectionService.java
@@ -6,7 +6,9 @@ import com.gk.hotwork.Domain.SafetySelfInspection; import com.gk.hotwork.Domain.SafetySelfInspectionItem; import com.gk.hotwork.Domain.UserInfo; import com.gk.hotwork.Domain.dto.resp.SafetySelfInspectionRespDTO; import java.util.List; import java.util.Map; public interface SafetySelfInspectionService extends IService<SafetySelfInspection> { @@ -16,12 +18,16 @@ */ IPage<SafetySelfInspection> selectPage(Page<SafetySelfInspection> page, Map<String, Object> filter, UserInfo user); IPage<SafetySelfInspection> selectSupervisePage(Page<SafetySelfInspection> page, Map<String, Object> filter, UserInfo user); /** * @Description: 新增 */ void addOne(SafetySelfInspection param, UserInfo user); /** * 新增监管检查 */ void addSupervise(SafetySelfInspection param, UserInfo user); /** * @Description: 修改 */ @@ -33,11 +39,16 @@ */ void delOne(Long id, UserInfo user); SafetySelfInspection infoOne(Long id,String unqualified, UserInfo user); SafetySelfInspectionRespDTO infoOne(Long id, String unqualified, UserInfo user); SafetySelfInspectionItem itemInfoOne(Long id, UserInfo user); void modItemInfo(SafetySelfInspectionItem param, UserInfo user); void finish(Long id, UserInfo user); void addItemExpert(List<SafetySelfInspectionItem> itemList, UserInfo user); } src/main/java/com/gk/hotwork/Service/ServiceImpl/CompanyServiceImpl.java
@@ -5,15 +5,19 @@ 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.UserInfo; 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.Mapper.CompanyInfoMapper; import com.gk.hotwork.Service.CompanyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Service("CompanyService") public class CompanyServiceImpl extends ServiceImpl<CompanyInfoMapper, CompanyInfo> implements CompanyService { @@ -70,5 +74,29 @@ return companyInfo.getIsmain() == 1; } @Override public List<CompanyInfo> selectCompanyList(String companyName, UserInfo user) { CompanyQuery query = new CompanyQuery(); query.setCompany(companyName); Integer type = user.getType(); //企业用户 if (type.equals(3)) { Long companyid = user.getCompanyid(); query.setCompanyid(companyid); } //监管用户 if (type.equals(2)) { //获取企业信息 query.setArea(user.getCounty()); query.setProvince(user.getProvince()); query.setCity(user.getCity()); } List<CompanyInfo> companyInfos = companyInfoMapper.selectCompanyList(query); return companyInfos; } } src/main/java/com/gk/hotwork/Service/ServiceImpl/ElementManagementImpl.java
@@ -5,12 +5,11 @@ 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.ElementManagement; import com.gk.hotwork.Domain.ElementTree; import com.gk.hotwork.Domain.*; import com.gk.hotwork.Domain.Exception.BusinessException; import com.gk.hotwork.Domain.UserInfo; import com.gk.hotwork.Domain.Utils.StringUtils; import com.gk.hotwork.Mapper.ElementManagementMapper; import com.gk.hotwork.Mapper.SafetyInspectionItemMapper; import com.gk.hotwork.Service.ElementManagementService; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -28,6 +27,9 @@ @Autowired private ElementManagementMapper elementManagementMapper; @Autowired private SafetyInspectionItemMapper safetyInspectionItemMapper; /** * @Description: 分页 @@ -96,7 +98,9 @@ elementTree.setType(Integer.valueOf(e.get("type").toString())); elementTree.setLabel(e.get("label").toString()); elementTree.setValue(Long.valueOf(e.get("value").toString())); elementTree.setLeaf(e.get("isLeaf").toString().equals("1")?true:false); elementTree.setLeaf(e.get("isLeaf").toString().equals("1")?true:false); elementTree.setPid(Long.valueOf(e.get("pid").toString())); elementTree.setPoint(e.get("point") != null ? Integer.valueOf(e.get("point").toString()) : 0); if(elementTree.isLeaf()){ elementTree.setChildren(new ArrayList<ElementTree>()); elementTreeList.add(elementTree); @@ -175,6 +179,36 @@ return returnTree; } @Override public List<ElementManagement> getElementByParentId(Long parentId) { List<ElementManagement> list = elementManagementMapper.selectList(new LambdaQueryWrapper<ElementManagement>() .eq(ElementManagement::getValidFlag, 1) .eq(ElementManagement::getParentId, parentId)); return list; } @Override public List<ElementTree> getElementTreeByParentId(Long parentId) { List<ElementTree> returnTree = new ArrayList<>(); List<Map<String,Object>> list = elementManagementMapper.getElementTree(); //读取元素配置 for (Map<String, Object> map : list) { if(map.get("value") == parentId){ //一级要素,MenuType2 ElementTree elementTree=new ElementTree(); elementTree.setType(Integer.valueOf(map.get("type").toString())); elementTree.setLabel(map.get("label").toString()); elementTree.setValue(Long.valueOf(map.get("value").toString())); elementTree.setLeaf(map.get("isLeaf").toString().equals("1")?true:false); elementTree.setPoint(map.get("point") != null ? Integer.valueOf(map.get("point").toString()) : 0); elementTree.setChildren(getChindrenTree(list,Long.valueOf(map.get("value").toString()))); returnTree.add(elementTree); }else{ continue; } } return returnTree; } /** * 查询验证 * 验证对象存在 @@ -194,9 +228,25 @@ public void requiredVerification(ElementManagement param){ if(StringUtils.isBlank(param.getName())) throw new BusinessException("请填写要素名称"); if (param.getType() == null) throw new BusinessException("请选择要素类型"); if (param.getType() == 1 && param.getParentId()==null){ throw new BusinessException("请选择父要素"); if (param.getType() == 1 && param.getParentId() == null){//二级要素 throw new BusinessException("请选择一级要素"); } if(param.getType() == 2){//三级要素 if(param.getParentId() == null){ throw new BusinessException("请选择二级要素"); } List<SafetyInspectionItem> safetyInspectionItems = safetyInspectionItemMapper.selectList(new LambdaQueryWrapper<SafetyInspectionItem>() .eq(SafetyInspectionItem::getValidFlag, 1) .eq(SafetyInspectionItem::getElementB, param.getParentId())); if(safetyInspectionItems.size() > 0){ throw new BusinessException("二级要素下存在检查内容,不可建立三级"); } } } /** src/main/java/com/gk/hotwork/Service/ServiceImpl/InspectionExpertGroupServiceImpl.java
对比新文件 @@ -0,0 +1,59 @@ package com.gk.hotwork.Service.ServiceImpl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.InspectionExpert; import com.gk.hotwork.Domain.InspectionExpertGroup; import com.gk.hotwork.Domain.SafetySelfInspection; import com.gk.hotwork.Domain.UserInfo; import com.gk.hotwork.Domain.Utils.StringUtils; import com.gk.hotwork.Mapper.InspectionExpertGroupMapper; import com.gk.hotwork.Service.InspectionExpertGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Map; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/19 * @time: 17:30 */ @Service public class InspectionExpertGroupServiceImpl extends ServiceImpl<InspectionExpertGroupMapper, InspectionExpertGroup> implements InspectionExpertGroupService { @Autowired private InspectionExpertGroupMapper inspectionExpertGroupMapper; @Override public IPage selectPage(Page<InspectionExpertGroup> page, Map<String, Object> filter, UserInfo user) { Integer type = user.getType(); //普通用户 if (type.equals(3)) { Long companyid = user.getCompanyid(); filter.put("checkedCompanyId",companyid); } //监管用户 if (type.equals(2)) { //获取企业信息 filter.put("province",user.getProvince()); filter.put("city",user.getCity()); filter.put("area",user.getCounty()); } IPage<InspectionExpertGroup> res = inspectionExpertGroupMapper.selectPages(page, filter); return res; } @Override public InspectionExpertGroup getBySelfInspectionId(Long selfInspectionId) { return inspectionExpertGroupMapper.selectOne(new LambdaQueryWrapper<InspectionExpertGroup>() .eq(InspectionExpertGroup::getValidFlag,true) .eq(InspectionExpertGroup::getSelfInspectionId,selfInspectionId) ); } } src/main/java/com/gk/hotwork/Service/ServiceImpl/InspectionExpertServiceImpl.java
对比新文件 @@ -0,0 +1,92 @@ package com.gk.hotwork.Service.ServiceImpl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gk.hotwork.Domain.Exception.BusinessException; import com.gk.hotwork.Domain.InspectionExpert; import com.gk.hotwork.Domain.SafetyInspectionElementA; import com.gk.hotwork.Domain.UserInfo; import com.gk.hotwork.Mapper.InspectionExpertGroupMapper; import com.gk.hotwork.Mapper.InspectionExpertMapper; import com.gk.hotwork.Mapper.SafetyInspectionElementAMapper; import com.gk.hotwork.Service.InspectionExpertService; import com.gk.hotwork.Service.SafetyInspectionElementAService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/19 * @time: 17:30 */ @Service public class InspectionExpertServiceImpl extends ServiceImpl<InspectionExpertMapper, InspectionExpert> implements InspectionExpertService { @Autowired private InspectionExpertMapper inspectionExpertMapper; @Override public void setLeader(InspectionExpert inspectionExpert, UserInfo user) { requireVertify(inspectionExpert); inspectionExpertMapper.updateById(inspectionExpert); } /** * 根据专家组id获取专家成员 * @param expertGroupId * @return */ public List<InspectionExpert> getByGroupId(Long expertGroupId){ List<InspectionExpert> list = inspectionExpertMapper.selectList(new LambdaQueryWrapper<InspectionExpert>().eq(InspectionExpert::getExpertGropId, expertGroupId)); return list; } /** * 根据检查清单id获取专家成员 * @param selfInspectionId * @return */ public List<InspectionExpert> getBySelfInspectionId(Long selfInspectionId){ List<InspectionExpert> list = inspectionExpertMapper.selectList(new LambdaQueryWrapper<InspectionExpert>() .eq(InspectionExpert::getSelfInspectionId, selfInspectionId)); return list; } public List<InspectionExpert> getLeaderList(Long expertGroupId){ List<InspectionExpert> list = inspectionExpertMapper .selectList(new LambdaQueryWrapper<InspectionExpert>() .eq(InspectionExpert::getExpertGropId, expertGroupId) .eq(InspectionExpert::getIsLeader,true)); return list; } private void requireVertify(InspectionExpert inspectionExpert) { if(inspectionExpert.getId() == null){ throw new BusinessException("专家主键不可为空"); } if(inspectionExpert.getIsLeader() == null){ throw new BusinessException("专家成员类型不可为空"); } if(inspectionExpert.getExpertGropId() == null){ throw new BusinessException("专家组id不可为空"); } List<InspectionExpert> leaderList = this.getLeaderList(inspectionExpert.getExpertGropId()); if(leaderList.size() > 0){ InspectionExpert expert = leaderList.get(0); if(expert.getId().equals(inspectionExpert.getId())){ if(expert.getIsLeader() == true){ throw new BusinessException("该专家成员已是组长"); } }else { throw new BusinessException("该专家组已有组长"); } } } } src/main/java/com/gk/hotwork/Service/ServiceImpl/InspectionHiddenDangerServiceImpl.java
对比新文件 @@ -0,0 +1,170 @@ package com.gk.hotwork.Service.ServiceImpl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.Do.SafetySelfInspectionItemQualifiedCountDO; import com.gk.hotwork.Domain.Exception.BusinessException; import com.gk.hotwork.Domain.InspectionExpert; import com.gk.hotwork.Domain.InspectionHiddenDanger; import com.gk.hotwork.Domain.SafetySelfInspection; import com.gk.hotwork.Domain.UserInfo; import com.gk.hotwork.Domain.Utils.PageInfo; import com.gk.hotwork.Domain.Utils.StringUtils; import com.gk.hotwork.Domain.dto.resp.InspectionHiddenDangerRespDTO; import com.gk.hotwork.Mapper.InspectionExpertMapper; import com.gk.hotwork.Mapper.InspectionHiddenDangerMapper; import com.gk.hotwork.Service.InspectionExpertService; import com.gk.hotwork.Service.InspectionHiddenDangerService; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/19 * @time: 17:30 */ @Service public class InspectionHiddenDangerServiceImpl extends ServiceImpl<InspectionHiddenDangerMapper, InspectionHiddenDanger> implements InspectionHiddenDangerService { @Autowired private InspectionHiddenDangerMapper inspectionHiddenDangerMapper; /** * 修改 * @param inspectionHiddenDanger */ @Override public void mod(InspectionHiddenDanger inspectionHiddenDanger, UserInfo userInfo) { modrequiredVerification(inspectionHiddenDanger); inspectionHiddenDanger.setUpdateTime(new Date()); inspectionHiddenDanger.setUpdateBy(userInfo.getRealname()); inspectionHiddenDangerMapper.updateById(inspectionHiddenDanger); } /** * 删除 * @param */ public void delByInspectionItemId(Long inspectionItemId,UserInfo userInfo){ InspectionHiddenDanger inspectionHiddenDanger = new InspectionHiddenDanger(); inspectionHiddenDanger.setSelfInspectionItemId(inspectionItemId); inspectionHiddenDanger.setUpdateBy(userInfo.getRealname()); inspectionHiddenDanger.setUpdateTime(new Date()); inspectionHiddenDangerMapper.delByInspectionItemId(inspectionHiddenDanger); } @Override public List<InspectionHiddenDanger> getBySafetySelfInspectionItemId(Long inspectionItemId) { List<InspectionHiddenDanger> inspectionHiddenDangerList = inspectionHiddenDangerMapper.selectList(new LambdaQueryWrapper<InspectionHiddenDanger>() .eq(InspectionHiddenDanger::getValidFlag, true) .eq(InspectionHiddenDanger::getSelfInspectionItemId, inspectionItemId)); return inspectionHiddenDangerList; } public List<InspectionHiddenDanger> getBySafetySelfInspectionId(Long inspectionId) { List<InspectionHiddenDanger> inspectionHiddenDangerList = inspectionHiddenDangerMapper.selectList(new LambdaQueryWrapper<InspectionHiddenDanger>() .eq(InspectionHiddenDanger::getValidFlag, true) .eq(InspectionHiddenDanger::getSelfInspectionId, inspectionId)); return inspectionHiddenDangerList; } @Override public List<InspectionHiddenDanger> listByPage(PageInfo pageInfo) { return null; } @Override public void delByIds(List<Long> idList) { inspectionHiddenDangerMapper.delByIds(idList); } @Override public IPage selectPage(Page<SafetySelfInspection> page, Map<String, Object> params, UserInfo user) { Integer type = user.getType(); //普通用户 if (type.equals(3)) { Long companyid = user.getCompanyid(); params.put("checkedCompanyId",companyid); } //监管用户 if (type.equals(2)) { //获取企业信息 params.put("province",user.getProvince()); params.put("city",user.getCity()); params.put("area",user.getCounty()); } IPage<SafetySelfInspection> res = inspectionHiddenDangerMapper.selectPages(page, params); List<SafetySelfInspection> records = res.getRecords(); if (CollectionUtils.isNotEmpty(records)){ for (SafetySelfInspection inspection : records) { List<InspectionHiddenDanger> dangerList = this.getBySafetySelfInspectionId(inspection.getId()); //一般 1 int sameasCount = 0; //重大 2 int majorCount = 0; //总数 int totalCount = 0; //未整改数量 int unRectifyCount = 0; for (InspectionHiddenDanger inspectionHiddenDanger : dangerList) { if (inspectionHiddenDanger.getLevel().equals(1)) { sameasCount += 1; }else { majorCount += 1; } if(inspectionHiddenDanger.getStatus().equals((byte) 0)){ unRectifyCount += 1; } totalCount += 1; } inspection.setSameAsCount(sameasCount); inspection.setMajorCount(majorCount); inspection.setHdTocalCount(totalCount); if(unRectifyCount == 0){ inspection.setRectificationStatus(2); }else if(unRectifyCount == totalCount){ inspection.setRectificationStatus(0); }else { inspection.setRectificationStatus(1); } } res.setRecords(records); } return res; } @Override public List<InspectionHiddenDanger> inspectionHdangerlist(Long selfInspectionId) { return inspectionHiddenDangerMapper.inspectionHdangerlist(selfInspectionId); } private void modrequiredVerification(InspectionHiddenDanger inspectionHiddenDanger){ if(inspectionHiddenDanger.getId() == null){ throw new BusinessException("隐患主键不可为空"); } InspectionHiddenDanger danger = this.inspectionHiddenDangerMapper.selectById(inspectionHiddenDanger.getId()); if(danger.getStatus().equals((byte) 1)){ throw new BusinessException("已整改不可再修改"); } if (StringUtils.isBlank(inspectionHiddenDanger.getInfo())) throw new BusinessException("请填写隐患描述"); if (inspectionHiddenDanger.getLevel() == null) throw new BusinessException("请选择隐患等级"); if (inspectionHiddenDanger.getStatus() == null) throw new BusinessException("整改状态不可为空"); } } src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyInspectionElementAServiceImpl.java
对比新文件 @@ -0,0 +1,32 @@ package com.gk.hotwork.Service.ServiceImpl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gk.hotwork.Domain.SafetyInspectionElementA; import com.gk.hotwork.Mapper.SafetyInspectionElementAMapper; import com.gk.hotwork.Service.SafetyInspectionElementAService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/19 * @time: 17:30 */ @Service public class SafetyInspectionElementAServiceImpl extends ServiceImpl<SafetyInspectionElementAMapper, SafetyInspectionElementA> implements SafetyInspectionElementAService { @Autowired private SafetyInspectionElementAMapper safetyInspectionElementAMapper; @Override public List<SafetyInspectionElementA> getBySafetySelfInspectionId(Long safetyInspectionId) { return safetyInspectionElementAMapper.selectList(new LambdaQueryWrapper<SafetyInspectionElementA>() .eq(SafetyInspectionElementA::getSafetyInspectionId,safetyInspectionId) ); } } src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyInspectionItemImpl.java
@@ -6,9 +6,11 @@ import com.gk.hotwork.Domain.*; import com.gk.hotwork.Domain.Exception.BusinessException; import com.gk.hotwork.Domain.Utils.StringUtils; import com.gk.hotwork.Domain.dto.resp.SafetyInspectionElementRespDTO; import com.gk.hotwork.Mapper.SafetyInspectionItemDeductionMapper; import com.gk.hotwork.Mapper.SafetyInspectionItemMapper; import com.gk.hotwork.Service.ElementManagementService; import com.gk.hotwork.Service.SafetyInspectionElementAService; import com.gk.hotwork.Service.SafetyInspectionItemService; import org.apache.commons.collections4.CollectionUtils; import org.checkerframework.checker.units.qual.C; @@ -20,6 +22,7 @@ import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @Service("SafetyInspectionItemService") @Transactional @@ -32,6 +35,9 @@ @Autowired private ElementManagementService elementManagementService; @Autowired private SafetyInspectionElementAService safetyInspectionElementAService; /** * @Description: 分页 @@ -175,10 +181,69 @@ } @Override public List<SafetyInspectionItem> infoElementA(Long id, UserInfo user) { public SafetyInspectionElementRespDTO infoElementA(Long id, UserInfo user) { //获取要素 List<ElementTree> elementTree = elementManagementService.getElementTreeByParentId(id); if(CollectionUtils.isEmpty(elementTree)){ throw new BusinessException("该要素记录不存在"); } //获取要素树下面的检查项 List<SafetyInspectionItem> list = safetyInspectionItemMapper.infoElementA(id); if (CollectionUtils.isNotEmpty(list)){ for (SafetyInspectionItem safetyInspectionItem : list){ //一级 SafetyInspectionElementRespDTO respDTO = new SafetyInspectionElementRespDTO(); respDTO.setElementId(elementTree.get(0).getValue()); respDTO.setElementName(elementTree.get(0).getLabel()); respDTO.setType(elementTree.get(0).getType()); respDTO.setPid(elementTree.get(0).getPid()); List<SafetyInspectionElementRespDTO> sRespList = new ArrayList<>(); //循环孩子节点(二级) if(CollectionUtils.isNotEmpty(elementTree.get(0).getChildren())){ for (ElementTree schildren : elementTree.get(0).getChildren()){ SafetyInspectionElementRespDTO schildrenRespDTO = new SafetyInspectionElementRespDTO(); schildrenRespDTO.setElementId(schildren.getValue()); schildrenRespDTO.setElementName(schildren.getLabel()); schildrenRespDTO.setType(schildren.getType()); schildrenRespDTO.setPid(schildren.getPid()); if(CollectionUtils.isEmpty(schildren.getChildren())){ List<SafetyInspectionItem> sSelectItemList = list .stream() .filter(item -> item.getElementB().equals(schildren.getValue()) && item.getElementC() == null) .collect(Collectors.toList()); schildrenRespDTO.setItemList(getSafetyInspectionItem(sSelectItemList)); }else { List<SafetyInspectionElementRespDTO> tRespList = new ArrayList<>(); //三级 for (ElementTree tchildren : schildren.getChildren()){ SafetyInspectionElementRespDTO tchildrenRespDTO = new SafetyInspectionElementRespDTO(); tchildrenRespDTO.setElementId(tchildren.getValue()); tchildrenRespDTO.setElementName(tchildren.getLabel()); tchildrenRespDTO.setType(tchildren.getType()); tchildrenRespDTO.setPid(tchildren.getPid()); List<SafetyInspectionItem> tSelectItemList = list .stream() .filter(item -> item.getElementC() != null && item.getElementC().equals(tchildren.getValue())) .collect(Collectors.toList()); tchildrenRespDTO.setItemList(getSafetyInspectionItem(tSelectItemList)); tRespList.add(tchildrenRespDTO); } schildrenRespDTO.setChildren(tRespList); } sRespList.add(schildrenRespDTO); } } respDTO.setChildren(sRespList); return respDTO; } private List<SafetyInspectionItem> getSafetyInspectionItem(List<SafetyInspectionItem> itemList){ if (CollectionUtils.isNotEmpty(itemList)){ for (SafetyInspectionItem safetyInspectionItem : itemList){ List<SafetyInspectionItemDeduction> deductionList = safetyInspectionItemDeductionMapper.getBySafetyInspectionItemId(safetyInspectionItem.getId()); if (CollectionUtils.isNotEmpty(deductionList)){ safetyInspectionItem.setDeductionList(deductionList); @@ -187,7 +252,8 @@ } } } return list; return itemList; } @Override @@ -221,6 +287,11 @@ public void requiredVerification(SafetyInspectionItem param){ if (param.getElementA() == null) throw new BusinessException("请选择A级要素"); if (param.getElementB() == null) throw new BusinessException("请选择B级要素"); //如果有三级要素则不创建标准 List<ElementManagement> elementList = elementManagementService.getElementByParentId(param.getElementB()); if(elementList.size() > 0){ throw new BusinessException("请先删除三级要素"); } if(StringUtils.isBlank(param.getStandardizationRequirements())) throw new BusinessException("请填写标准化要求"); if(StringUtils.isBlank(param.getEnterpriseStandard())) throw new BusinessException("请填写企业达标标准"); if(StringUtils.isBlank(param.getReviewMethod())) throw new BusinessException("请填写评审方法"); src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java
@@ -1,16 +1,19 @@ package com.gk.hotwork.Service.ServiceImpl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.*; import com.gk.hotwork.Domain.Do.SafetySelfInspectionItemQualifiedCountDO; import com.gk.hotwork.Domain.Exception.BusinessException; import com.gk.hotwork.Domain.Utils.BeanUtils; import com.gk.hotwork.Domain.Utils.StringUtils; import com.gk.hotwork.Domain.Vo.UserVo; import com.gk.hotwork.Domain.dto.resp.SafetySelfInspectionElementRespDTO; import com.gk.hotwork.Domain.dto.resp.SafetySelfInspectionRespDTO; import com.gk.hotwork.Mapper.*; import com.gk.hotwork.Service.CompanyService; import com.gk.hotwork.Service.SafetySelfInspectionService; import com.gk.hotwork.Service.UserService; import com.gk.hotwork.Service.*; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -38,26 +41,38 @@ private SafetyInspectionItemDeductionMapper safetyInspectionItemDeductionMapper; @Autowired private CompanyService companyService; @Autowired private ElementManagementService elementManagementService; @Autowired private SafetyInspectionElementAService safetyInspectionElementAService; @Autowired private UserService userService; @Autowired private InspectionExpertGroupService expertGroupService; @Autowired private InspectionExpertService expertService; @Autowired private InspectionHiddenDangerService dangerService; /** * @Description: 分页 */ @Override public IPage<SafetySelfInspection> selectPage(Page<SafetySelfInspection> page, Map<String, Object> filter, UserInfo user) { Integer type = user.getType(); //普通用户 //企业用户 if (type.equals(3)) { Long companyid = user.getCompanyid(); filter.put("companyid",companyid); filter.put("checkedCompanyId",companyid); } //监管用户 if (type.equals(2)) { Long companyid = user.getCompanyid(); //获取企业信息 CompanyInfo companyInfo = companyService.getById(companyid); filter.put("province",companyInfo.getProvince()); filter.put("city",companyInfo.getCity()); filter.put("area",companyInfo.getArea()); filter.put("province",user.getProvince()); filter.put("city",user.getCity()); filter.put("area",user.getCounty()); } filter.put("flag",0); IPage<SafetySelfInspection> res = safetySelfInspectionMapper.selectPages(page, filter); List<SafetySelfInspection> records = res.getRecords(); @@ -83,6 +98,183 @@ return res; } /** * @Description: 分页 */ @Override public IPage<SafetySelfInspection> selectSupervisePage(Page<SafetySelfInspection> page, Map<String, Object> filter, UserInfo user) { Integer type = user.getType(); //普通用户 if (type.equals(3)) { Long companyid = user.getCompanyid(); filter.put("checkedCompanyId",companyid); } //监管用户 if (type.equals(2)) { //获取企业信息 filter.put("province",user.getProvince()); filter.put("city",user.getCity()); filter.put("area",user.getCounty()); } filter.put("flag",1); IPage<SafetySelfInspection> res = safetySelfInspectionMapper.selectPages(page, filter); List<SafetySelfInspection> records = res.getRecords(); if (CollectionUtils.isNotEmpty(records)){ DecimalFormat df = new DecimalFormat("0.00%"); records = records.stream().map((safetySelfInspection) -> { if (safetySelfInspection.getStatus() == 2) { Long id = safetySelfInspection.getId(); SafetySelfInspectionItemQualifiedCountDO countDO = safetySelfInspectionItemMapper.countQualifiedDataById(id); safetySelfInspection.setUnqualifiedItem(countDO.getItemSum() - countDO.getQualifiedItem()); if (countDO != null && countDO.getItemSum() != 0 && countDO.getItemSum() != null) { BigDecimal rate = new BigDecimal(countDO.getQualifiedItem()) .divide(new BigDecimal(countDO.getItemSum()), 4, BigDecimal.ROUND_HALF_UP); String qualifiedRate = df.format(rate); safetySelfInspection.setQualifiedRate(qualifiedRate); safetySelfInspection.setItemSum(countDO.getItemSum()); } } return safetySelfInspection; }).collect(Collectors.toList()); res.setRecords(records); } return res; } /* @Override public IPage<SafetySelfInspection> selectPage(Page<SafetySelfInspection> page, Map<String, Object> filter, UserInfo user) { Integer type = user.getType(); //普通用户 if (type.equals(3)) { Long companyid = user.getCompanyid(); filter.put("companyid",companyid); } //监管用户 if (type.equals(2)) { Long companyid = user.getCompanyid(); //获取企业信息 CompanyInfo companyInfo = companyService.getById(companyid); filter.put("province",companyInfo.getProvince()); filter.put("city",companyInfo.getCity()); filter.put("area",companyInfo.getArea()); } IPage<SafetySelfInspection> res = safetySelfInspectionMapper.selectPages(page, filter); List<SafetySelfInspection> records = res.getRecords(); if (CollectionUtils.isNotEmpty(records)){ DecimalFormat df = new DecimalFormat("0.00%"); records = records.stream().map((safetySelfInspection) -> { //总分 Integer totalScore = 0; //扣分 Integer delScore =0; Long id = safetySelfInspection.getId(); SafetySelfInspectionItemQualifiedCountDO countDO = safetySelfInspectionItemMapper.countQualifiedDataById(id); safetySelfInspection.setUnqualifiedItem(countDO.getItemSum() - countDO.getQualifiedItem()); if (countDO != null && countDO.getItemSum() != 0 && countDO.getItemSum() != null) { BigDecimal rate = new BigDecimal(countDO.getQualifiedItem()) .divide(new BigDecimal(countDO.getItemSum()), 4, BigDecimal.ROUND_HALF_UP); String qualifiedRate = df.format(rate); safetySelfInspection.setQualifiedRate(qualifiedRate); safetySelfInspection.setItemSum(countDO.getItemSum()); } //计算总分以及得分 //获取要素 List<SafetyInspectionElementA> inspectionElementAList = safetyInspectionElementAService.getBySafetySelfInspectionId(id); //获取检查项 List<SafetySelfInspectionItem> safetySelfInspectionItemList = safetySelfInspectionItemMapper.getBySafetySelfInspectionId2(id); //循环要素 for(SafetyInspectionElementA elementA : inspectionElementAList){ //获取该要素的树 List<ElementTree> elementTree = elementManagementService.getElementTreeByParentId(elementA.getElementA()); //二级要素 if (CollectionUtils.isNotEmpty(elementTree)) { List<ElementTree> elementBList = elementTree.get(0).getChildren(); for(ElementTree stree : elementBList){ //三级要素为空 if(CollectionUtils.isEmpty(stree.getChildren())){ //总分累计 totalScore += stree.getPoint(); //无三级要素过滤出二级要素检查内容 List<SafetySelfInspectionItem> sItemList = safetySelfInspectionItemList .stream() .filter(item -> item.getElementC() == null && item.getElementB().equals(stree.getValue())) .collect(Collectors.toList()); //判断是否有否决项 List<SafetySelfInspectionItem> rejectList = sItemList .stream() .filter(item -> item.getSafetyInspectionItemResult().equals(0)) .collect(Collectors.toList()); if(rejectList.size() > 0){ delScore += stree.getPoint(); }else { //计算出不合格扣分 delScore += unqualifiedItemDelScore(sItemList); } } else { List<ElementTree> elementCList = stree.getChildren(); for(ElementTree ttree : elementCList){ //计算总分 totalScore += ttree.getPoint(); //过滤该三级要素检查项目 List<SafetySelfInspectionItem> tItemList = safetySelfInspectionItemList .stream() .filter(item -> item.getElementC() != null && item.getElementC().equals(ttree.getValue())) .collect(Collectors.toList()); //判断是否有被否决 List<SafetySelfInspectionItem> rejectList = tItemList .stream() .filter(item -> item.getSafetyInspectionItemResult().equals(0)) .collect(Collectors.toList()); if(rejectList.size() > 0){ delScore += ttree.getPoint(); }else { //计算出不合格扣分 totalScore += unqualifiedItemDelScore(tItemList); } } } } } } //得分 Integer score = totalScore - delScore; safetySelfInspection.setTotalScore(totalScore.toString()); safetySelfInspection.setScore(score.toString()); return safetySelfInspection; }).collect(Collectors.toList()); res.setRecords(records); } return res; }*/ //累计过出不合格扣分 private Integer unqualifiedItemDelScore(List<SafetySelfInspectionItem> itemList){ int delScore = 0; //过滤出不合格 List<SafetySelfInspectionItem> unqualifiedItemList = itemList .stream() .filter(item -> item.getSafetyInspectionItemResult().equals(1)) .collect(Collectors.toList()); for (SafetySelfInspectionItem unqualifiedItem : unqualifiedItemList){ List<SafetySelfInspectionItemDeduction> itemDeductionList = safetySelfInspectionItemDeductionMapper .selectList(new LambdaQueryWrapper<SafetySelfInspectionItemDeduction>() .eq(SafetySelfInspectionItemDeduction::getSafetySelfInspectionItemId, unqualifiedItem.getId()) .eq(SafetySelfInspectionItemDeduction::getValidFlag,1)); for (SafetySelfInspectionItemDeduction itemDeduction : itemDeductionList) { delScore += itemDeduction.getPoint(); } } return delScore; } /** * @Description: 新增 @@ -95,14 +287,18 @@ Date date = new Date(); String username = user.getRealname(); param.setValidFlag(Boolean.TRUE); param.setFlag((byte) 0); param.setUpdateBy(username); param.setCreateBy(username); param.setUpdateTime(date); param.setCreateTime(date); param.setCheckUnit(user.getCompany()); this.save(param); if (CollectionUtils.isNotEmpty(param.getItemList())) { for (SafetySelfInspectionItem safetySelfInspectionItem : param.getItemList()) { //默认合格 safetySelfInspectionItem.setSafetyInspectionItemResult(2); safetySelfInspectionItem.setValidFlag(Boolean.TRUE); safetySelfInspectionItem.setUpdateBy(username); safetySelfInspectionItem.setCreateBy(username); @@ -110,6 +306,93 @@ safetySelfInspectionItem.setCreateTime(date); safetySelfInspectionItem.setSafetySelfInspectionId(param.getId()); safetySelfInspectionItemMapper.insert(safetySelfInspectionItem); } } if(CollectionUtils.isNotEmpty(param.getElementAList())){ for (SafetyInspectionElementA inspectionElementA : param.getElementAList()) { SafetyInspectionElementA safetyInspectionElementA = new SafetyInspectionElementA(); safetyInspectionElementA.setSafetyInspectionId(param.getId()); safetyInspectionElementA.setElementA(inspectionElementA.getElementA()); safetyInspectionElementAService.save(safetyInspectionElementA); } } } /** * 监管检查-新增 * @param param * @param user */ @Override public void addSupervise(SafetySelfInspection param, UserInfo user) { requiredSuperviseVerification(param); Date date = new Date(); String username = user.getRealname(); param.setValidFlag(Boolean.TRUE); param.setFlag((byte) 1); param.setInspector(user.getId()); param.setUpdateBy(username); param.setCreateBy(username); param.setUpdateTime(date); param.setCreateTime(date); param.setCheckUnit(user.getCompany()); this.save(param); //生成专家组记录 InspectionExpertGroup inspectionExpertGroup = new InspectionExpertGroup(); inspectionExpertGroup.setInspectionName(param.getInspectionName()); inspectionExpertGroup.setInspectionTime(param.getInspectionTime()); inspectionExpertGroup.setCheckedCompanyId(param.getCheckedCompanyId()); inspectionExpertGroup.setCheckedCompanyName(param.getCheckedCompanyName()); inspectionExpertGroup.setCheckUnit(user.getCompany()); inspectionExpertGroup.setSelfInspectionId(param.getId()); inspectionExpertGroup.setValidFlag(true); inspectionExpertGroup.setCreateTime(new Date()); List<InspectionExpert> collect = param.getExpertList().stream().filter(inspectionExpert -> inspectionExpert.getIsLeader() == true).collect(Collectors.toList()); if (collect.size() > 0) { UserVo userVo = userService.selectUserVoById(collect.get(0).getExpertId()); inspectionExpertGroup.setExpertLeader(userVo.getRealname()); } expertGroupService.save(inspectionExpertGroup); if (CollectionUtils.isNotEmpty(param.getItemList())) { for (SafetySelfInspectionItem safetySelfInspectionItem : param.getItemList()) { //默认合格 safetySelfInspectionItem.setSafetyInspectionItemResult(2); safetySelfInspectionItem.setValidFlag(Boolean.TRUE); safetySelfInspectionItem.setUpdateBy(username); safetySelfInspectionItem.setCreateBy(username); safetySelfInspectionItem.setUpdateTime(date); safetySelfInspectionItem.setCreateTime(date); safetySelfInspectionItem.setSafetySelfInspectionId(param.getId()); safetySelfInspectionItemMapper.insert(safetySelfInspectionItem); } } if(CollectionUtils.isNotEmpty(param.getElementAList())){ for (SafetyInspectionElementA inspectionElementA : param.getElementAList()) { SafetyInspectionElementA safetyInspectionElementA = new SafetyInspectionElementA(); safetyInspectionElementA.setSafetyInspectionId(param.getId()); safetyInspectionElementA.setElementA(inspectionElementA.getElementA()); safetyInspectionElementAService.save(safetyInspectionElementA); } } if(CollectionUtils.isNotEmpty(param.getExpertList())){ for (InspectionExpert inspectionExpert : param.getExpertList()) { UserVo userVo = userService.selectUserVoById(inspectionExpert.getExpertId()); inspectionExpert.setCompanyName(userVo.getCompany()); inspectionExpert.setIdcard(userVo.getIdcard()); inspectionExpert.setName(userVo.getRealname()); inspectionExpert.setPhone(userVo.getUsername()); inspectionExpert.setType(userVo.getType()); inspectionExpert.setProfessionalLevel(user.getProfessionalLevel()); inspectionExpert.setSpecialityName(userVo.getSpecialityName()); inspectionExpert.setSelfInspectionId(param.getId()); inspectionExpert.setExpertGropId(inspectionExpertGroup.getId()); expertService.save(inspectionExpert); } } } @@ -186,9 +469,15 @@ delOne.setUpdateBy(user.getRealname()); delOne.setValidFlag(Boolean.FALSE); this.updateById(delOne); InspectionExpertGroup expertGroup = expertGroupService.getBySelfInspectionId(id); if(expertGroup != null){ expertGroup.setValidFlag(false); expertGroupService.updateById(expertGroup); } } @Override /* @Override public SafetySelfInspection infoOne(Long id,String unqualified, UserInfo user) { SafetySelfInspection safetySelfInspection=selectVerification(id); //组装检查项 @@ -225,12 +514,164 @@ safetySelfInspection.setItemList(new ArrayList<>()); } return safetySelfInspection; }*/ @Override public SafetySelfInspectionRespDTO infoOne(Long id, String unqualified, UserInfo user) { SafetySelfInspection safetySelfInspection = selectVerification(id); SafetySelfInspectionRespDTO safetySelfInspectionRespDTO = new SafetySelfInspectionRespDTO(); BeanUtils.copyProperties(safetySelfInspection,safetySelfInspectionRespDTO); //获取所有检查项 List<SafetySelfInspectionItem> itemList= safetySelfInspectionItemMapper.getDetailBySafetySelfInspectionId(id,unqualified); //获取关联要素 List<SafetyInspectionElementA> inspectionElementAList = safetyInspectionElementAService.getBySafetySelfInspectionId(id); List<SafetySelfInspectionElementRespDTO> arespDTOList = new ArrayList<>(); if (CollectionUtils.isNotEmpty(inspectionElementAList)) { for (SafetyInspectionElementA elementA : inspectionElementAList) { //获取该要素的树 List<ElementTree> elementTree = elementManagementService.getElementTreeByParentId(elementA.getElementA()); if (CollectionUtils.isNotEmpty(elementTree)) { //一级要素 ElementTree otree = elementTree.get(0); SafetySelfInspectionElementRespDTO elementARespDTO = new SafetySelfInspectionElementRespDTO(); elementARespDTO.setElementId(otree.getValue()); elementARespDTO.setElementName(otree.getLabel()); elementARespDTO.setType(otree.getType()); List<SafetySelfInspectionElementRespDTO> brespDTOList = new ArrayList<>(); //二级要素 List<ElementTree> elementBList = otree.getChildren(); if(CollectionUtils.isNotEmpty(elementBList)){ for (ElementTree stree : elementBList) { SafetySelfInspectionElementRespDTO elementBRespDTO = new SafetySelfInspectionElementRespDTO(); elementBRespDTO.setElementId(stree.getValue()); elementBRespDTO.setElementName(stree.getLabel()); elementBRespDTO.setType(stree.getType()); elementBRespDTO.setPid(stree.getPid()); List<SafetySelfInspectionElementRespDTO> cRespDTOList = new ArrayList<>(); //三级要素 List<ElementTree> elementCList = stree.getChildren(); if(CollectionUtils.isEmpty(elementCList)){ //扣分 int delScore = 0; int totalScore = stree.getPoint(); //无三级要素过滤出二级要素检查内容 List<SafetySelfInspectionItem> sItemList = itemList .stream() .filter(item -> item.getElementC() == null && item.getElementB().equals(stree.getValue())) .collect(Collectors.toList()); //填充检查项 elementBRespDTO.setItemList(assemblyDeduction(sItemList)); //判断是否有否决项 List<SafetySelfInspectionItem> rejectList = sItemList .stream() .filter(item -> item.getSafetyInspectionItemResult().equals(0)) .collect(Collectors.toList()); if(rejectList.size() > 0){ delScore = stree.getPoint(); }else { //计算出不合格扣分 delScore += unqualifiedItemDelScore(sItemList); } //总分 elementBRespDTO.setTotalScore(stree.getPoint()); //得分 elementBRespDTO.setScore(totalScore-delScore); }else { for(ElementTree ttree : elementCList){ SafetySelfInspectionElementRespDTO elementCRespDTO = new SafetySelfInspectionElementRespDTO(); elementCRespDTO.setElementId(ttree.getValue()); elementCRespDTO.setElementName(ttree.getLabel()); elementCRespDTO.setType(ttree.getType()); elementCRespDTO.setPid(ttree.getPid()); //扣分 int delScore = 0; int totalScore = ttree.getPoint(); //过滤该三级要素检查项目 List<SafetySelfInspectionItem> tItemList = itemList .stream() .filter(item -> item.getElementC() != null && item.getElementC().equals(ttree.getValue())) .collect(Collectors.toList()); //填充检查项 elementCRespDTO.setItemList(assemblyDeduction(tItemList)); //判断是否有被否决 List<SafetySelfInspectionItem> rejectList = tItemList .stream() .filter(item -> item.getSafetyInspectionItemResult().equals(0)) .collect(Collectors.toList()); if(rejectList.size() > 0){ delScore = ttree.getPoint(); }else { //计算出不合格扣分 delScore = unqualifiedItemDelScore(tItemList); } //总分 elementCRespDTO.setTotalScore(ttree.getPoint()); //得分 elementCRespDTO.setScore(totalScore-delScore); cRespDTOList.add(elementCRespDTO); } } elementBRespDTO.setChildren(cRespDTOList); brespDTOList.add(elementBRespDTO); } } elementARespDTO.setChildren(brespDTOList); arespDTOList.add(elementARespDTO); } } } safetySelfInspectionRespDTO.setElementList(arespDTOList); return safetySelfInspectionRespDTO; } //组装扣分项 private List<SafetySelfInspectionItem> assemblyDeduction( List<SafetySelfInspectionItem> itemList){ for (SafetySelfInspectionItem safetySelfInspectionItem : itemList){ if (safetySelfInspectionItem.getSafetyInspectionItemResult().equals(2)){ //根据检查项id获取原始扣分项 List<SafetyInspectionItemDeduction> safetyInspectionItemDeductionList = safetyInspectionItemDeductionMapper.getBySafetyInspectionItemId(safetySelfInspectionItem.getSafetyInspectionItemId()); if (CollectionUtils.isNotEmpty(safetyInspectionItemDeductionList)){ List<SafetySelfInspectionItemDeduction> oldSafetySelfInspectionItemDeductionList=new ArrayList<>(); for (SafetyInspectionItemDeduction safetyInspectionItemDeduction : safetyInspectionItemDeductionList){ SafetySelfInspectionItemDeduction safetySelfInspectionItemDeduction = new SafetySelfInspectionItemDeduction(); safetySelfInspectionItemDeduction.setSafetyInspectionItemDeductionId(safetyInspectionItemDeduction.getId()); safetySelfInspectionItemDeduction.setName(safetyInspectionItemDeduction.getName()); safetySelfInspectionItemDeduction.setPoint(0); oldSafetySelfInspectionItemDeductionList.add(safetySelfInspectionItemDeduction); } safetySelfInspectionItem.setSelfDeductionList(oldSafetySelfInspectionItemDeductionList); }else{ safetySelfInspectionItem.setSelfDeductionList(new ArrayList<>()); } }else if (safetySelfInspectionItem.getSafetyInspectionItemResult().equals(1)){ //根据自查清单记录的检查项id获取其扣分项 List<SafetySelfInspectionItemDeduction> selfDeductionList = safetySelfInspectionItemDeductionMapper.getBySafetySelfInspectionItemId(safetySelfInspectionItem.getId()); if (CollectionUtils.isNotEmpty(selfDeductionList)){ safetySelfInspectionItem.setSelfDeductionList(selfDeductionList); } } } return itemList; } @Override public SafetySelfInspectionItem itemInfoOne(Long id, UserInfo user){ SafetySelfInspectionItem safetySelfInspectionItem = safetySelfInspectionItemMapper.getDetailById(id); List<SafetySelfInspectionItemDeduction> selfDeductionList = safetySelfInspectionItemDeductionMapper.getBySafetySelfInspectionItemId(safetySelfInspectionItem.getId()); List<InspectionHiddenDanger> inspectionHiddenDangerList = dangerService.getBySafetySelfInspectionItemId(id); if (CollectionUtils.isNotEmpty(selfDeductionList)){ safetySelfInspectionItem.setSelfDeductionList(selfDeductionList); }else{ @@ -250,11 +691,13 @@ safetySelfInspectionItem.setSelfDeductionList(new ArrayList<>()); } } safetySelfInspectionItem.setDangerList(inspectionHiddenDangerList); return safetySelfInspectionItem; } @Override public void modItemInfo(SafetySelfInspectionItem param, UserInfo user) { if (param.getSafetyInspectionItemResult()==0 && StringUtils.isBlank(param.getSafetyInspectionItemResultDesc())){ throw new BusinessException("否决说明必填!"); } @@ -266,6 +709,8 @@ if (param.getSafetyInspectionItemResult()==0 || param.getSafetyInspectionItemResult() == 2){ //否决 合格--删除扣分记录 safetySelfInspectionItemDeductionMapper.delBySafetySelfInspectionItemId(param.getId(),username,date); //删除隐患 dangerService.delByInspectionItemId(param.getSafetyInspectionItemId(),user); }else{ //扣分 List<SafetySelfInspectionItemDeduction> list = safetySelfInspectionItemDeductionMapper.getBySafetySelfInspectionItemId(param.getId()); @@ -289,8 +734,41 @@ safetySelfInspectionItemDeductionMapper.updateById(safetySelfInspectionItemDeduction); } } //隐患 if(CollectionUtils.isNotEmpty(param.getDangerList())){ List<InspectionHiddenDanger> oldDangerList = dangerService.getBySafetySelfInspectionItemId(param.getId()); //过滤出要删除数据 List<InspectionHiddenDanger> deleteOldDangerList = oldDangerList.stream().parallel().filter(a -> param.getDangerList().stream().noneMatch(b -> a.getId().equals(b.getId()))) .collect(Collectors.toList()); //删除 if (CollectionUtils.isNotEmpty(deleteOldDangerList)) { List<Long> idList = deleteOldDangerList.stream().map(InspectionHiddenDanger::getId).collect(Collectors.toList()); dangerService.delByIds(idList); } for (InspectionHiddenDanger inspectionHiddenDanger : param.getDangerList()) { if(inspectionHiddenDanger.getId() == null){ inspectionHiddenDanger.setCreateBy(user.getRealname()); inspectionHiddenDanger.setCreateTime(new Date()); inspectionHiddenDanger.setUpdateBy(user.getRealname()); inspectionHiddenDanger.setUpdateTime(new Date()); inspectionHiddenDanger.setStatus((byte)0); inspectionHiddenDanger.setValidFlag(true); inspectionHiddenDanger.setSelfInspectionId(param.getSafetySelfInspectionId()); inspectionHiddenDanger.setSelfInspectionItemId(param.getId()); dangerService.save(inspectionHiddenDanger); }else { inspectionHiddenDanger.setUpdateBy(user.getRealname()); inspectionHiddenDanger.setUpdateTime(new Date()); dangerService.updateById(inspectionHiddenDanger); } } } } } @Override public void finish(Long id, UserInfo user) { @@ -303,6 +781,14 @@ safetySelfInspectionMapper.updateById(safetySelfInspection); } @Override public void addItemExpert(List<SafetySelfInspectionItem> itemList, UserInfo user) { itemList.forEach(item -> { item.setUpdateBy(user.getRealname()); item.setUpdateTime(new Date()); }); safetySelfInspectionItemMapper.updateBatch(itemList); } /** * 查询验证 @@ -329,5 +815,43 @@ if (param.getCheckedCompanyId() == null){ throw new BusinessException("请选择被检查公司"); } if(CollectionUtils.isEmpty(param.getElementAList())){ throw new BusinessException("请选择A检查要素"); } for(SafetyInspectionElementA elementA : param.getElementAList()){ if(elementA.getElementA() == null){ throw new BusinessException("请选择A检查要素"); } } } public void requiredSuperviseVerification(SafetySelfInspection param) { if (StringUtils.isBlank(param.getInspectionName())) throw new BusinessException("请填写排查清单名称"); if (param.getInspectionTime() == null) throw new BusinessException("请选择排查时间"); if (CollectionUtils.isEmpty(param.getExpertList())) throw new BusinessException("请选择检查专家"); for(InspectionExpert inspectionExpert : param.getExpertList()){ if(inspectionExpert.getExpertId() == null){ throw new BusinessException("请选择检查专家"); } if(StringUtils.isBlank(inspectionExpert.getName())){ throw new BusinessException("请选择检查专家名字"); } if(inspectionExpert.getIsLeader() == null){ throw new BusinessException("请选择组长或者组员"); } } if (CollectionUtils.isEmpty(param.getItemList())) { throw new BusinessException("请选择检查项"); } if (param.getCheckedCompanyId() == null){ throw new BusinessException("请选择被检查公司"); } if(CollectionUtils.isEmpty(param.getElementAList())){ throw new BusinessException("请选择A检查要素"); } for(SafetyInspectionElementA elementA : param.getElementAList()){ if(elementA.getElementA() == null){ throw new BusinessException("请选择A检查要素"); } } } } src/main/java/com/gk/hotwork/Service/ServiceImpl/UserServiceImpl.java
@@ -181,6 +181,10 @@ public UserVo selectUserVoByName(String examtype,String username) { return userInfoMapper.selectUserVoByName(examtype,username); } @Override public UserVo selectUserVoById(Long userId) { return userInfoMapper.selectUserVoById(userId); } @Override src/main/java/com/gk/hotwork/Service/UserService.java
@@ -32,6 +32,8 @@ UserVo selectUserVoByName(String examtype, String username); UserVo selectUserVoById(Long userId); void deleteById(Long id); void recoverOneById(Long id); src/main/resources/application.yml
@@ -54,6 +54,8 @@ mapper-locations: classpath*:com/gk/hotwork/**/*.xml type-aliases-package: com.gk.hotwork.Domain type-enums-package: com.gk.hotwork.Domain.Enum configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #线程池配置 threadPool: