| | |
| | | package com.gk.hotwork.Config.Cors; |
| | | |
| | | import com.gk.hotwork.Config.attachment.FilePathConfig; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.servlet.config.annotation.CorsRegistry; |
| | |
| | | private String taskPath; |
| | | @Value("${emergencyPlanPath}") |
| | | private String emergencyPlanPath; |
| | | |
| | | @Value("${file.path.dcPath}") |
| | | private String dcPath; |
| | | |
| | | @Value("${file.path.urlRootPath}") |
| | | private String urlRootPath; |
| | | |
| | | |
| | | @Override |
| | |
| | | .addResourceLocations("file:" + taskPath); |
| | | registry.addResourceHandler("/upload/emergencyPlan/**") |
| | | .addResourceLocations("file:" + emergencyPlanPath); |
| | | registry.addResourceHandler("/uploadfile/**") |
| | | .addResourceLocations("file:" + dcPath); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.gk.hotwork.Controller; |
| | | import com.gk.hotwork.Controller.Base.BaseController; |
| | | import com.gk.hotwork.Domain.AttachmentInfo; |
| | | import com.gk.hotwork.Domain.Utils.Msg; |
| | | import com.gk.hotwork.Service.AttachmentService; |
| | | |
| | | import com.gk.hotwork.common.FileProjectConstants; |
| | | 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.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | |
| | | /** |
| | | * @email 1603559716@qq.com |
| | | * @author: zf |
| | | * @date: 2023/5/6 |
| | | * @time: 14:22 |
| | | */ |
| | | @Api(tags = "附件上传接口") |
| | | @RestController |
| | | @RequestMapping("/attachment") |
| | | public class AttachmentController extends BaseController { |
| | | |
| | | @Autowired |
| | | private AttachmentService attachmentService; |
| | | |
| | | |
| | | /** |
| | | * 根据标识查询文件具体信息 |
| | | * @param key |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "根据标识查询文件具体信息",response = Msg.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "key",value = "文件标识") |
| | | }) |
| | | @GetMapping("/get/key/{key}") |
| | | public Msg findByKey(@PathVariable String key) { |
| | | Msg msg = new Msg(); |
| | | msg.setCode("200"); |
| | | msg.setMessage("查询成功"); |
| | | AttachmentInfo byKey = attachmentService.findByKey(key); |
| | | msg.setResult(byKey); |
| | | return msg; |
| | | } |
| | | |
| | | /** |
| | | * 根据id获取文件 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "根据id获取文件",response = Msg.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id",value = "文件id") |
| | | }) |
| | | @GetMapping("/get/id/{id}") |
| | | public Msg get(@PathVariable Long id) { |
| | | Msg msg = new Msg(); |
| | | msg.setCode("200"); |
| | | msg.setMessage("查询成功"); |
| | | AttachmentInfo byKey = attachmentService.findById(id); |
| | | msg.setResult(byKey); |
| | | return msg; |
| | | } |
| | | |
| | | /** |
| | | * 删除文件数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "删除文件数据",response = Msg.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id",value = "文件id") |
| | | }) |
| | | @GetMapping("/delete/{id}") |
| | | public Msg delete(@PathVariable Long id) { |
| | | Msg msg = new Msg(); |
| | | msg.setCode("200"); |
| | | msg.setMessage("删除成功"); |
| | | attachmentService.delete(id,getUser()); |
| | | return msg; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 单个文件上传 |
| | | * @Description 上传文件(返回文件标识) |
| | | * @Param [file, module] |
| | | **/ |
| | | @ApiOperation(value = "上传文件(返回文件标识)-单个文件",response = Msg.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file",value = "文件"), |
| | | @ApiImplicitParam(name = "module",value = "checkPath") |
| | | }) |
| | | @PostMapping("/upload/key") |
| | | public Msg uploadReturnKey(@RequestParam("file") MultipartFile |
| | | file, @RequestParam("module") String module) { |
| | | Msg msg = new Msg(); |
| | | msg.setCode("200"); |
| | | msg.setMessage("上传成功"); |
| | | Object returnStr = attachmentService.saveFileToPath(file, module, FileProjectConstants.ReturnType.KEY,getUser()); |
| | | msg.setResult(returnStr); |
| | | return msg; |
| | | } |
| | | |
| | | /** |
| | | * 单个文件 |
| | | * @Description 上传文件(返回文件信息) |
| | | * @Param [file, module] |
| | | **/ |
| | | @ApiOperation(value = "上传文件(返回文件信息)-单个文件",response = Msg.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file",value = "文件"), |
| | | @ApiImplicitParam(name = "module",value = "模块(checkPath)") |
| | | }) |
| | | @PostMapping("/upload/detail") |
| | | public Msg uploadReturnDetail(@RequestParam("file") MultipartFile |
| | | file, @RequestParam("module") String module) { |
| | | Msg msg = new Msg(); |
| | | msg.setCode("200"); |
| | | msg.setMessage("上传成功"); |
| | | Object detail = attachmentService.saveFileToPath(file, module, FileProjectConstants.ReturnType.DETAIL,getUser()); |
| | | msg.setResult(detail); |
| | | return msg; |
| | | } |
| | | /** |
| | | * 单个文件 |
| | | * @Description 上传文件(返回访问路径) |
| | | * @Date 2021/4/20 19:28 |
| | | * @Param [file, module] |
| | | **/ |
| | | @ApiOperation(value = "上传文件(返回访问路径)-单个文件",response = Msg.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file",value = "文件"), |
| | | @ApiImplicitParam(name = "module",value = "模块(checkPath)") |
| | | }) |
| | | @PostMapping("/upload/url") |
| | | public Msg uploadReturnUrl(@RequestParam("file") MultipartFile file, @RequestParam("module") String module) { |
| | | Msg msg = new Msg(); |
| | | msg.setCode("200"); |
| | | msg.setMessage("上传成功"); |
| | | Object returnStr = attachmentService.saveFileToPath(file, module, FileProjectConstants.ReturnType.URL,getUser()); |
| | | msg.setResult(returnStr); |
| | | return msg; |
| | | } |
| | | |
| | | /** |
| | | * 批量文件 |
| | | * @Description 上传文件(返回文件信息) |
| | | * @Param [file, module] |
| | | **/ |
| | | @ApiOperation(value = "上传文件(返回访问路径)-批量",response = Msg.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file",value = "文件"), |
| | | @ApiImplicitParam(name = "module",value = "模块(checkPath)") |
| | | }) |
| | | @PostMapping("/upload/batch/detail") |
| | | public Msg uploadBatchReturnDetail(@RequestParam("file") MultipartFile[] |
| | | file, @RequestParam("module") String module) { |
| | | Msg msg = new Msg(); |
| | | msg.setCode("200"); |
| | | msg.setMessage("上传成功"); |
| | | Object detail = attachmentService.saveBatchFileToPath(file, module,getUser()); |
| | | msg.setResult(detail); |
| | | return msg; |
| | | } |
| | | |
| | | /** |
| | | * @return org.springframework.http.ResponseEntity<byte [ ]> |
| | | * @Description 获取下载文件流 |
| | | * @Param [key] |
| | | **/ |
| | | @ApiOperation(value = "获取下载文件流",response = Msg.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "key",value = "文件标识"), |
| | | }) |
| | | @GetMapping("/downloadFile/{key}") |
| | | public void download(@PathVariable String key, HttpServletResponse response) { |
| | | attachmentService.downloadForStream(response, key); |
| | | } |
| | | |
| | | /** |
| | | * @return void |
| | | * @Description 文件下载 |
| | | * @Param [key, response, request] |
| | | **/ |
| | | @ApiOperation(value = "文件下载",response = Msg.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id",value = "文件id"), |
| | | }) |
| | | @RequestMapping(value = "/downloadFileById/{id}", method = {RequestMethod.POST, RequestMethod.GET}) |
| | | public void downloadFileByKey(@PathVariable Long id, HttpServletResponse response, HttpServletRequest |
| | | request) { |
| | | attachmentService.downloadById(response, request, id); |
| | | } |
| | | |
| | | /** |
| | | * @Description 获取下载文件路径 |
| | | * @Param [key] |
| | | **/ |
| | | @ApiOperation(value = "获取下载文件路径",response = Msg.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "key",value = "文件key"), |
| | | }) |
| | | @GetMapping("/downloadUrl/{key}") |
| | | public Msg downLoad( @PathVariable String key) { |
| | | Msg msg = new Msg(); |
| | | msg.setCode("200"); |
| | | msg.setMessage("查询成功"); |
| | | AttachmentInfo byKey = attachmentService.findByKey(key); |
| | | msg.setResult(byKey); |
| | | return msg; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @ApiImplicitParam(name = "inspectionStartTime",value = "开始时间"), |
| | | @ApiImplicitParam(name = "inspectionEndTime",value = "结束时间"), |
| | | @ApiImplicitParam(name = "flag",value = "检查类型"), |
| | | @ApiImplicitParam(name = "rectificationStatus",value = "整改状态"), |
| | | |
| | | }) |
| | | public Msg selectPage(@RequestBody FilterObject filterObject) { |
| | |
| | | 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.AttachmentInfo; |
| | | import com.gk.hotwork.Domain.SafetySelfInspection; |
| | | import com.gk.hotwork.Domain.SafetySelfInspectionItem; |
| | | import com.gk.hotwork.Domain.Utils.FilterObject; |
| | |
| | | @ApiImplicitParam(name = "pageSize",value = "每页行数"), |
| | | @ApiImplicitParam(name = "inspectionName",value = "自查清单名称"), |
| | | @ApiImplicitParam(name = "inspectorName",value = "检查人名称"), |
| | | @ApiImplicitParam(name = "checkedCompanyId",value = "被检查公司id"), |
| | | @ApiImplicitParam(name = "checkedCompanyName",value = "被检查公司名称"), |
| | | @ApiImplicitParam(name = "inspectionStartTime",value = "开始时间"), |
| | | @ApiImplicitParam(name = "inspectionEndTime",value = "结束时间"), |
| | | @ApiImplicitParam(name = "status",value = "状态"), |
| | |
| | | safetySelfInspectionService.addItemExpert(itemList, getUser()); |
| | | return success(); |
| | | } |
| | | @ApiOperation("/添加检查清单附件") |
| | | @PostMapping("/add/check/attachment") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "attachmentList",value = "附件集合"), |
| | | }) |
| | | public Msg addCheckAttachment(@RequestBody List<AttachmentInfo> attachmentList) { |
| | | safetySelfInspectionService.addCheckAttachment(attachmentList, getUser()); |
| | | return success(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("/新增") |
| | |
| | | if (StringUtils.isNotBlank(job)){ |
| | | condition.put("job",job.trim()); |
| | | } |
| | | |
| | | Integer type = getUser().getType(); |
| | | if(type.equals(3)){ |
| | | condition.put("companyid",getUser().getCompanyid()); |
| | | } |
| | | |
| | | pageInfo.setCondition(condition); |
| | | userService.selectCompanyUserDataGrid(pageInfo); |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @email 1603559716@qq.com |
| | |
| | | * 2重大 |
| | | */ |
| | | private Integer level; |
| | | /** |
| | | * 隐患附件 |
| | | */ |
| | | private String url; |
| | | private Boolean validFlag; |
| | | /** |
| | |
| | | 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已整改 |
| | | * 整改状态 -1未整改,1已整改 |
| | | */ |
| | | private Byte status; |
| | | /** |
| | | * 整改描述 |
| | | */ |
| | | private String rectificationInfo; |
| | | |
| | | /** |
| | | * 整改附件 |
| | | */ |
| | |
| | | private String reviewMethod; |
| | | @TableField(exist = false) |
| | | private String veto; |
| | | //隐患附件 |
| | | @TableField(exist = false) |
| | | private List<AttachmentInfo> attachmentList; |
| | | //整改附件 |
| | | @TableField(exist = false) |
| | | private List<AttachmentInfo> rattachmentList; |
| | | |
| | | } |
| | |
| | | /** 检查单位 **/ |
| | | private String checkUnit; |
| | | |
| | | //检查标识 0自查,1监管检查 |
| | | //检查标识 2自查,1监管检查 |
| | | private Byte flag; |
| | | /** |
| | | * 隐患总数 |
| | |
| | | @TableField(exist = false) |
| | | private Integer majorCount; |
| | | /** |
| | | * 整改状态 0未整改 1部分整改 2全部整改 |
| | | * 整改状态 -1未整改 1部分整改 2全部整改 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Integer rectificationStatus; |
| | | |
| | | //检查清单附件 |
| | | @TableField(exist = false) |
| | | private List<AttachmentInfo> attachmentList; |
| | | |
| | | public List<AttachmentInfo> getAttachmentList() { |
| | | return attachmentList; |
| | | } |
| | | |
| | | public void setAttachmentList(List<AttachmentInfo> attachmentList) { |
| | | this.attachmentList = attachmentList; |
| | | } |
| | | |
| | | public List<InspectionExpert> getExpertList() { |
| | | return expertList; |
| | | } |
对比新文件 |
| | |
| | | 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 com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.gk.hotwork.Domain.dto.resp.SafetySelfInspectionElementRespDTO; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Data |
| | | public class SafetySelfInspectionDO { |
| | | |
| | | /** 自查清单名称 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; |
| | | |
| | | //检查标识 2自查,1监管检查 |
| | | private Byte flag; |
| | | /** 检查单位 **/ |
| | | private String checkUnit; |
| | | |
| | | /** |
| | | * 隐患总数 |
| | | */ |
| | | private Integer hdTocalCount; |
| | | /** |
| | | * 已整改数量 |
| | | */ |
| | | private Integer rectifyCount; |
| | | /** |
| | | * 未整改数量 |
| | | */ |
| | | private Integer unRectifyCount; |
| | | /** |
| | | * 一般隐患数量 |
| | | */ |
| | | private Integer sameAsCount; |
| | | /** |
| | | * 重大隐患数量 |
| | | */ |
| | | private Integer majorCount; |
| | | /** |
| | | * 整改状态 -1未整改 1部分整改 2全部整改 |
| | | */ |
| | | private Integer rectificationStatus; |
| | | |
| | | } |
| | |
| | | */ |
| | | private String expertNames; |
| | | |
| | | //附件 |
| | | @TableField(exist = false) |
| | | private List<AttachmentInfo> attachmentList; |
| | | |
| | | public List<AttachmentInfo> getAttachmentList() { |
| | | return attachmentList; |
| | | } |
| | | |
| | | public void setAttachmentList(List<AttachmentInfo> attachmentList) { |
| | | this.attachmentList = attachmentList; |
| | | } |
| | | |
| | | public String getExpertIds() { |
| | | return expertIds; |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.gk.hotwork.Domain.AttachmentInfo; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | |
| | | private String updateBy; |
| | | |
| | | List<SafetySelfInspectionElementRespDTO> elementList; |
| | | |
| | | //检查清单附件 |
| | | private List<AttachmentInfo> attachmentList; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.gk.hotwork.Mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.gk.hotwork.Domain.AttachmentInfo; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @email 1603559716@qq.com |
| | | * @author: zf |
| | | * @date: 2023/7/24 |
| | | * @time: 13:49 |
| | | */ |
| | | @Repository |
| | | public interface AttachmentInfoMapper extends BaseMapper<AttachmentInfo> { |
| | | void saveBatch(List<AttachmentInfo> attachmentList); |
| | | |
| | | void updateBusinessIdBatch(List<AttachmentInfo> attachmentList); |
| | | |
| | | void deleteByBusinessId(Long businessId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.gk.hotwork.Domain.InspectionHiddenDanger; |
| | | import com.gk.hotwork.Domain.SafetySelfInspection; |
| | | import com.gk.hotwork.Domain.SafetySelfInspectionDO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | |
| | | */ |
| | | @Repository |
| | | public interface InspectionHiddenDangerMapper extends BaseMapper<InspectionHiddenDanger> { |
| | | void delByInspectionItemId(InspectionHiddenDanger inspectionHiddenDanger); |
| | | void delByInspectionItemId(@Param("inspectionHiddenDanger") InspectionHiddenDanger inspectionHiddenDanger); |
| | | |
| | | void delByIds(List<Long> idList); |
| | | |
| | | IPage<SafetySelfInspection> selectPages(Page<SafetySelfInspection> page, @Param("params") Map<String, Object> params); |
| | | IPage<SafetySelfInspectionDO> selectPages(Page<SafetySelfInspection> page, @Param("params") Map<String, Object> params); |
| | | |
| | | List<InspectionHiddenDanger> inspectionHdangerlist(Long selfInspectionId); |
| | | } |
对比新文件 |
| | |
| | | <?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.AttachmentInfoMapper" > |
| | | <insert id="saveBatch" useGeneratedKeys="true" keyProperty="id" > |
| | | insert into attachment (file_key,file_path,file_url,file_name,file_suffix,file_desc,file_size,file_type,module,del_flag, |
| | | create_uid,create_uname,create_time,update_uid,update_uname,update_time)values |
| | | <foreach collection="attachmentList" item="attachment" separator=","> |
| | | (#{attachment.fileKey},#{attachment.filePath},#{attachment.fileUrl},#{attachment.fileName},#{attachment.fileSuffix},#{attachment.fileDesc}, |
| | | #{attachment.fileSize},#{attachment.fileType},#{attachment.module},#{attachment.delFlag},#{attachment.createUid},#{attachment.createUname}, |
| | | #{attachment.createTime},#{attachment.updateUid},#{attachment.updateUname},#{attachment.updateTime}) |
| | | </foreach> |
| | | </insert> |
| | | <update id="updateBusinessIdBatch"> |
| | | <foreach collection="attachmentList" item="attachment" separator=";"> |
| | | update attachment |
| | | set |
| | | business_id = #{attachment.businessId} |
| | | where id = #{attachment.id} |
| | | </foreach> |
| | | </update> |
| | | <update id="deleteByBusinessId"> |
| | | update attachment |
| | | set |
| | | del_flag = 1 |
| | | where business_id = #{businessId} |
| | | </update> |
| | | </mapper> |
| | |
| | | id,code,company, contactname, contactphone, ismain, province, city, area, town, community, isdel, |
| | | createdby,createddate, lastmodifiedby, lastmodifieddate, longitude, latitude, isbanned |
| | | </sql> |
| | | <!-- |
| | | <select id="selectDataGrid" resultType="com.gk.hotwork.Domain.CompanyInfo"> |
| | | select * |
| | | from company |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | --> |
| | | <select id="selectDataGrid" resultType="com.gk.hotwork.Domain.CompanyInfo"> |
| | | select c.* |
| | | from |
| | | (select * |
| | | from company |
| | | <where> |
| | | 1=1 |
| | | and isdel = 0 |
| | | <if test="condition.province != null and condition.province !=''"> |
| | | and province = #{condition.province} |
| | | </if> |
| | | <if test="condition.city != null and condition.city !=''"> |
| | | and city = #{condition.city} |
| | | </if> |
| | | <if test="condition.area != null and condition.area !=''"> |
| | | and area = #{condition.area} |
| | | </if> |
| | | </where> |
| | | union |
| | | select * |
| | | from company |
| | | <where>1=1 |
| | | and |
| | | isdel = 0 |
| | | and province in(null,'') |
| | | </where>) c |
| | | <where> |
| | | 1=1 |
| | | <if test="condition.company != null and condition.company !=''"> |
| | | and c.company like concat('%',#{condition.company},'%') |
| | | </if> |
| | | <if test="condition.companyid != null "> |
| | | and c.id = #{condition.companyid} |
| | | </if> |
| | | </where> |
| | | |
| | | </select> |
| | | |
| | | <select id="selectExistByName" resultType="com.gk.hotwork.Domain.CompanyInfo"> |
| | | select * |
| | | from company |
| | |
| | | |
| | | </update> |
| | | |
| | | <select id="selectPages" resultType="com.gk.hotwork.Domain.SafetySelfInspection"> |
| | | <select id="selectPages" resultType="com.gk.hotwork.Domain.SafetySelfInspectionDO"> |
| | | SELECT |
| | | s.* |
| | | l.* |
| | | 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 |
| | | ( |
| | | SELECT |
| | | t.*, |
| | | ( CASE WHEN t.unRectifyCount = t.hdTocalCount THEN - 1 WHEN t.rectifyCount = t.hdTocalCount THEN 2 ELSE 1 END ) rectificationStatus |
| | | FROM |
| | | ( |
| | | SELECT |
| | | s.*, |
| | | count( h.`status` = - 1 OR NULL ) unRectifyCount, |
| | | count( h.`status` = 1 OR NULL ) rectifyCount, |
| | | count( h.`status` ) hdTocalCount, |
| | | count( h.LEVEL = 1 OR NULL ) sameAsCount, |
| | | count( h.LEVEL = 2 OR NULL ) majorCount |
| | | FROM |
| | | safety_self_inspection s |
| | | LEFT JOIN inspection_hidden_danger h ON s.id = h.self_inspection_id |
| | | WHERE |
| | | s.valid_flag = 1 |
| | | AND h.valid_flag = 1 |
| | | AND h.id IS NOT NULL |
| | | s.valid_flag = 1 |
| | | AND h.valid_flag = 1 |
| | | AND h.id IS NOT NULL |
| | | GROUP BY |
| | | s.id |
| | | ) t |
| | | ) l |
| | | LEFT JOIN company AS co ON l.checked_company_id = co.id |
| | | WHERE |
| | | 1 =1 |
| | | <if test="params.inspectionName != null and params.inspectionName != ''"> |
| | | and s.inspection_name like concat("%",#{params.inspectionName},"%") |
| | | and l.inspection_name like concat("%",#{params.inspectionName},"%") |
| | | </if> |
| | | <if test="params.checkedCompanyId != null and params.checkedCompanyId != ''"> |
| | | and l.checked_company_id = #{params.checkedCompanyId} |
| | | </if> |
| | | <if test="params.checkedCompanyName != null and params.checkedCompanyName != ''"> |
| | | and s.checked_company_name like concat("%",#{params.checkedCompanyName},"%") |
| | | and l.checked_company_name like concat("%",#{params.checkedCompanyName},"%") |
| | | </if> |
| | | <if test="params.flag != null and params.flag != '' "> |
| | | and s.flag = #{params.flag} |
| | | and l.flag = #{params.flag} |
| | | </if> |
| | | <if test="params.rectificationStatus != null and params.rectificationStatus != '' "> |
| | | and l.rectificationStatus = #{params.rectificationStatus} |
| | | </if> |
| | | <if test="params.inspectionStartTime != null and params.inspectionStartTime != ''" > |
| | | and s.inspection_time <![CDATA[ >= ]]> #{params.inspectionStartTime} |
| | | and l.inspection_time <![CDATA[ >= ]]> #{params.inspectionStartTime} |
| | | </if> |
| | | <if test="params.inspectionEndTime != null and params.inspectionEndTime != ''" > |
| | | and s.inspection_time <![CDATA[ <= ]]> #{params.inspectionEndTime} |
| | | and l.inspection_time <![CDATA[ <= ]]> #{params.inspectionEndTime} |
| | | </if> |
| | | <if test="params.province != null and params.province != ''" > |
| | | and co.province = #{params.province} |
| | |
| | | <if test="params.area != null and params.area != ''" > |
| | | and co.area = #{params.area} |
| | | </if> |
| | | GROUP BY |
| | | s.id |
| | | ORDER BY s.create_time |
| | | ORDER BY l.create_time |
| | | </select> |
| | | <select id="inspectionHdangerlist" resultType="com.gk.hotwork.Domain.InspectionHiddenDanger"> |
| | | SELECT |
| | |
| | | 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 != '' "> |
| | | <if test="params.flag != null and params.flag != '' "> |
| | | and a.flag = #{params.flag} |
| | | </if> |
| | | <if test="params.inspectionName != null and params.inspectionName != ''"> |
| | |
| | | <if test="params.checkedCompanyId != null"> |
| | | and a.checked_company_id = #{params.checkedCompanyId} |
| | | </if> |
| | | <if test="params.checkedCompanyName != null and params.checkedCompanyName != ''"> |
| | | and a.checked_company_name like concat("%",#{params.checkedCompanyName},"%") |
| | | </if> |
| | | <if test="params.roleid != null "> |
| | | and c.roleid = #{params.roleid} |
| | | </if> |
| | |
| | | <if test="record.roleId != null"> |
| | | and r.roleid = #{record.roleId} |
| | | </if> |
| | | <if test="record.companyid != null"> |
| | | and c.id = #{record.companyid} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="selectSuperviseUserDataList" resultMap="UserVo"> |
对比新文件 |
| | |
| | | package com.gk.hotwork.Service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.gk.hotwork.Domain.AttachmentInfo; |
| | | import com.gk.hotwork.Domain.UserInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @email 1603559716@qq.com |
| | | * @author: zf |
| | | * @date: 2023/7/24 |
| | | * @time: 13:51 |
| | | */ |
| | | public interface AttachmentInfoService extends IService<AttachmentInfo> { |
| | | AttachmentInfo findByKey(String key); |
| | | |
| | | AttachmentInfo findById(Long id); |
| | | |
| | | List<AttachmentInfo> findByBusinessId(Long businessId); |
| | | |
| | | List<AttachmentInfo> findByIds(List<Long> ids); |
| | | |
| | | |
| | | void delete(Long id, UserInfo userInfo); |
| | | |
| | | AttachmentInfo saveOne(AttachmentInfo attachmentInfo); |
| | | |
| | | List<AttachmentInfo> saveBatchAttachment(List<AttachmentInfo> attachmentInfoList); |
| | | |
| | | void updateBusinessIdBatch(List<AttachmentInfo> attachmentList); |
| | | |
| | | void deleteByBusinessId(Long businessId); |
| | | } |
对比新文件 |
| | |
| | | package com.gk.hotwork.Service; |
| | | |
| | | import com.gk.hotwork.Domain.AttachmentInfo; |
| | | import com.gk.hotwork.Domain.Exception.BusinessException; |
| | | import com.gk.hotwork.Domain.UserInfo; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @email 1603559716@qq.com |
| | | * @author: zf |
| | | * @date: 2023/7/24 |
| | | * @time: 13:53 |
| | | */ |
| | | public interface AttachmentService { |
| | | AttachmentInfo findByKey(String key); |
| | | |
| | | AttachmentInfo findById(Long id); |
| | | List<AttachmentInfo> findByIds(List<Long> ids); |
| | | List<AttachmentInfo> findByBusinessId(Long businessId); |
| | | |
| | | void delete(Long id, UserInfo userInfo); |
| | | |
| | | Object saveFileToPath(MultipartFile file, String module, int type, UserInfo user); |
| | | |
| | | Object saveBatchFileToPath(MultipartFile[] file, String module, UserInfo user); |
| | | |
| | | void downloadForStream(HttpServletResponse response, String key); |
| | | |
| | | void downloadById(HttpServletResponse response, HttpServletRequest request, Long id); |
| | | } |
| | |
| | | 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.AttachmentInfo; |
| | | import com.gk.hotwork.Domain.SafetySelfInspection; |
| | | import com.gk.hotwork.Domain.SafetySelfInspectionItem; |
| | | import com.gk.hotwork.Domain.UserInfo; |
| | |
| | | |
| | | |
| | | void addItemExpert(List<SafetySelfInspectionItem> itemList, UserInfo user); |
| | | |
| | | void addCheckAttachment(List<AttachmentInfo> attachmentList, UserInfo user); |
| | | } |
对比新文件 |
| | |
| | | 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.AttachmentInfo; |
| | | import com.gk.hotwork.Domain.UserInfo; |
| | | import com.gk.hotwork.Mapper.AttachmentInfoMapper; |
| | | import com.gk.hotwork.Service.AttachmentInfoService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @email 1603559716@qq.com |
| | | * @author: zf |
| | | * @date: 2023/7/24 |
| | | * @time: 13:48 |
| | | */ |
| | | @Service |
| | | public class AttachmentInfoServiceImpl extends ServiceImpl<AttachmentInfoMapper, AttachmentInfo> implements AttachmentInfoService { |
| | | @Autowired |
| | | private AttachmentInfoMapper attachmentInfoMapper; |
| | | |
| | | @Override |
| | | public AttachmentInfo findByKey(String key) { |
| | | AttachmentInfo attachmentInfo = attachmentInfoMapper.selectOne(new LambdaQueryWrapper<AttachmentInfo>() |
| | | .eq(AttachmentInfo::getDelFlag,0) |
| | | .eq(AttachmentInfo::getFileKey,key)); |
| | | return attachmentInfo; |
| | | } |
| | | @Override |
| | | public AttachmentInfo findById(Long id) { |
| | | AttachmentInfo attachmentInfo = attachmentInfoMapper.selectOne(new LambdaQueryWrapper<AttachmentInfo>() |
| | | .eq(AttachmentInfo::getDelFlag,0) |
| | | .eq(AttachmentInfo::getId,id)); |
| | | return attachmentInfo; |
| | | } |
| | | @Override |
| | | public List<AttachmentInfo> findByBusinessId(Long businessId) { |
| | | List<AttachmentInfo> attachmentInfoList = attachmentInfoMapper.selectList(new LambdaQueryWrapper<AttachmentInfo>() |
| | | .eq(AttachmentInfo::getDelFlag,0) |
| | | .eq(AttachmentInfo::getBusinessId,businessId)); |
| | | return attachmentInfoList; |
| | | } |
| | | |
| | | @Override |
| | | public List<AttachmentInfo> findByIds(List<Long> ids) { |
| | | return attachmentInfoMapper.selectList(new LambdaQueryWrapper<AttachmentInfo>() |
| | | .in(AttachmentInfo::getId,ids) |
| | | .eq(AttachmentInfo::getDelFlag,0)); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(Long id, UserInfo userInfo) { |
| | | AttachmentInfo attachmentInfo = new AttachmentInfo(); |
| | | attachmentInfo.setId(id); |
| | | attachmentInfo.setUpdateTime(new Date()); |
| | | attachmentInfo.setUpdateUid(userInfo.getId()); |
| | | attachmentInfo.setUpdateUname(userInfo.getRealname()); |
| | | attachmentInfo.setDelFlag(1); |
| | | attachmentInfoMapper.updateById(attachmentInfo); |
| | | } |
| | | |
| | | @Override |
| | | public AttachmentInfo saveOne(AttachmentInfo attachmentInfo) { |
| | | attachmentInfoMapper.insert(attachmentInfo); |
| | | return attachmentInfoMapper.selectById(attachmentInfo.getId()); |
| | | } |
| | | |
| | | @Override |
| | | public List<AttachmentInfo> saveBatchAttachment(List<AttachmentInfo> attachmentInfoList) { |
| | | attachmentInfoMapper.saveBatch(attachmentInfoList); |
| | | return attachmentInfoList; |
| | | } |
| | | |
| | | @Override |
| | | public void updateBusinessIdBatch(List<AttachmentInfo> attachmentList) { |
| | | attachmentInfoMapper.updateBusinessIdBatch(attachmentList); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByBusinessId(Long businessId) { |
| | | attachmentInfoMapper.deleteByBusinessId(businessId); |
| | | } |
| | | } |
| | | |
对比新文件 |
| | |
| | | package com.gk.hotwork.Service.ServiceImpl; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import cn.hutool.core.io.IoUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.extra.servlet.ServletUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.gk.hotwork.Config.attachment.FilePathConfig; |
| | | import com.gk.hotwork.Domain.AttachmentInfo; |
| | | import com.gk.hotwork.Domain.Enum.ResultCodes; |
| | | 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.AttachmentInfoMapper; |
| | | import com.gk.hotwork.Service.AttachmentInfoService; |
| | | import com.gk.hotwork.Service.AttachmentService; |
| | | import com.gk.hotwork.common.FileProjectConstants; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.Assert; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | import static cn.hutool.core.io.FileTypeUtil.getType; |
| | | |
| | | /** |
| | | * @email 1603559716@qq.com |
| | | * @author: zf |
| | | * @date: 2023/7/24 |
| | | * @time: 13:54 |
| | | */ |
| | | @Service |
| | | public class AttachmentServiceImpl implements AttachmentService { |
| | | |
| | | @Autowired |
| | | private AttachmentInfoService attachmentInfoService; |
| | | |
| | | private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
| | | /** |
| | | * 错误信息格式 |
| | | */ |
| | | private static final String ERROR_FORMATTER = "{}:{}"; |
| | | |
| | | @Resource |
| | | private FilePathConfig filePathConfig; |
| | | @Override |
| | | public AttachmentInfo findByKey(String key) { |
| | | if (StringUtils.isBlank(key)){ |
| | | throw new BusinessException("文件标识为空"); |
| | | } |
| | | return attachmentInfoService.findByKey(key); |
| | | } |
| | | @Override |
| | | public AttachmentInfo findById(Long id) { |
| | | if (id == null){ |
| | | throw new BusinessException("文件主键为空"); |
| | | } |
| | | return attachmentInfoService.findById(id); |
| | | } |
| | | @Override |
| | | public List<AttachmentInfo> findByIds(List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)){ |
| | | throw new BusinessException("文件主键为空"); |
| | | } |
| | | return attachmentInfoService.findByIds(ids); |
| | | } |
| | | @Override |
| | | public List<AttachmentInfo> findByBusinessId(Long businessId) { |
| | | if (businessId == null){ |
| | | throw new BusinessException("业务主键为空"); |
| | | } |
| | | return attachmentInfoService.findByBusinessId(businessId); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(Long id, UserInfo userInfo) { |
| | | if (id == null){ |
| | | throw new BusinessException("文件主键为空"); |
| | | } |
| | | attachmentInfoService.delete(id,userInfo); |
| | | } |
| | | |
| | | @Override |
| | | public Object saveFileToPath(MultipartFile file, String module, int type, UserInfo user) { |
| | | //获取对应模块路径 |
| | | String path; |
| | | //获取对应模块根路径 |
| | | String dcPath; |
| | | path = filePathConfig.getModule().get(module); |
| | | dcPath = filePathConfig.getDcPath(); |
| | | |
| | | String originalFilename = file.getOriginalFilename(); |
| | | if (com.alibaba.druid.util.StringUtils.isEmpty(originalFilename)) { |
| | | logger.error(ERROR_FORMATTER,module, ResultCodes.PATH_NOT_EXISIST.getDesc()); |
| | | throw new BusinessException(ResultCodes.FILE_NOT_EXISIST); |
| | | } |
| | | if (com.alibaba.druid.util.StringUtils.isEmpty(path)) { |
| | | logger.error(ERROR_FORMATTER, module, ResultCodes.PATH_NOT_EXISIST.getDesc()); |
| | | throw new BusinessException(ResultCodes.PATH_NOT_EXISIST); |
| | | } |
| | | assert originalFilename != null; |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | File newFile = null; |
| | | try { |
| | | //文件标识 UUID 如4d6873609b144945935ae84442711fd6 |
| | | String key = ""; |
| | | String suffix = ""; |
| | | if (originalFilename.contains(".mp3")) { |
| | | key = originalFilename; |
| | | suffix = ""; |
| | | } else { |
| | | key = UUID.randomUUID().toString().replace("-", ""); |
| | | //文件后缀 包含. |
| | | suffix = originalFilename.substring(originalFilename.lastIndexOf(".")).toLowerCase(); |
| | | } |
| | | |
| | | path = path.replace("/", File.separator); |
| | | //文件模块路径 如 2021/base/build/0421 |
| | | String modulePath = now.getYear() + path + now.format(DateTimeFormatter.ofPattern("MMdd")); |
| | | //文件路径 如 2021/base/build/0421/4d6873609b144945935ae84442711fd6.后缀 |
| | | String newFilePath = modulePath + File.separator + key + suffix; |
| | | //文件绝对路径 如 /home/img/2021/base/build/0421/4d6873609b144945935ae84442711fd6.后缀 |
| | | String localPath = dcPath + newFilePath; |
| | | //文件访问路径 如 /upload/2021/base/build/0421/4d6873609b144945935ae84442711fd6.后缀 |
| | | String url = filePathConfig.getUrlRootPath() + newFilePath.replace(File.separator, "/"); |
| | | newFile = new File(localPath); |
| | | if (!newFile.exists() && !newFile.mkdirs()) { |
| | | logger.error(ERROR_FORMATTER, newFilePath, ResultCodes.FILE_UPLOAD_FAIL.getDesc()); |
| | | throw new BusinessException(ResultCodes.FILE_UPLOAD_FAIL); |
| | | } |
| | | file.transferTo(newFile); |
| | | //创建文件信息 |
| | | AttachmentInfo attachmentInfo = new AttachmentInfo(); |
| | | attachmentInfo.setDelFlag(0); |
| | | attachmentInfo.setFileKey(key); |
| | | attachmentInfo.setFileSuffix(suffix); |
| | | attachmentInfo.setFilePath(localPath); |
| | | attachmentInfo.setFileUrl(url); |
| | | attachmentInfo.setFileName(file.getOriginalFilename()); |
| | | attachmentInfo.setFileSize(file.getSize()); |
| | | attachmentInfo.setModule(module); |
| | | attachmentInfo.setFileType(getType(suffix)); |
| | | attachmentInfo.setCreateUid(user.getId()); |
| | | attachmentInfo.setCreateUname(user.getRealname()); |
| | | attachmentInfo.setUpdateUid(user.getId()); |
| | | attachmentInfo.setUpdateUname(user.getRealname()); |
| | | attachmentInfo.setUpdateTime(new Date()); |
| | | attachmentInfo.setCreateTime(new Date()); |
| | | AttachmentInfo attachment = attachmentInfoService.saveOne(attachmentInfo); |
| | | switch (type) { |
| | | case FileProjectConstants.ReturnType.URL: |
| | | return url; |
| | | case FileProjectConstants.ReturnType.KEY: |
| | | return key; |
| | | case FileProjectConstants.ReturnType.DETAIL: |
| | | return attachment; |
| | | default: |
| | | return null; |
| | | } |
| | | } catch (IOException e) { |
| | | if (newFile != null && newFile.exists()) { |
| | | newFile.delete(); |
| | | } |
| | | logger.error(ERROR_FORMATTER, ResultCodes.FILE_UPLOAD_FAIL, e.getMessage()); |
| | | throw new BusinessException(ResultCodes.FILE_UPLOAD_FAIL); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Object saveBatchFileToPath(MultipartFile[] fileList, String module, UserInfo user) { |
| | | //获取对应模块路径 |
| | | String path; |
| | | //获取对应模块根路径 |
| | | String dcPath; |
| | | path = filePathConfig.getModule().get(module); |
| | | dcPath = filePathConfig.getDcPath(); |
| | | List<AttachmentInfo> attachmentInfoList = new ArrayList<>(); |
| | | for (MultipartFile file : fileList) { |
| | | String originalFilename = file.getOriginalFilename(); |
| | | if (com.alibaba.druid.util.StringUtils.isEmpty(originalFilename)) { |
| | | logger.error(ERROR_FORMATTER,module, ResultCodes.PATH_NOT_EXISIST.getDesc()); |
| | | throw new BusinessException(ResultCodes.FILE_NOT_EXISIST); |
| | | } |
| | | if (com.alibaba.druid.util.StringUtils.isEmpty(path)) { |
| | | logger.error(ERROR_FORMATTER, module, ResultCodes.PATH_NOT_EXISIST.getDesc()); |
| | | throw new BusinessException(ResultCodes.PATH_NOT_EXISIST); |
| | | } |
| | | assert originalFilename != null; |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | File newFile = null; |
| | | try { |
| | | //文件标识 UUID 如4d6873609b144945935ae84442711fd6 |
| | | String key = ""; |
| | | String suffix = ""; |
| | | if (originalFilename.contains(".mp3")) { |
| | | key = originalFilename; |
| | | suffix = ""; |
| | | } else { |
| | | key = UUID.randomUUID().toString().replace("-", ""); |
| | | //文件后缀 包含. |
| | | suffix = originalFilename.substring(originalFilename.lastIndexOf(".")).toLowerCase(); |
| | | } |
| | | |
| | | path = path.replace("/", File.separator); |
| | | //文件模块路径 如 2021/base/build/0421 |
| | | String modulePath = now.getYear() + path + now.format(DateTimeFormatter.ofPattern("MMdd")); |
| | | //文件路径 如 2021/base/build/0421/4d6873609b144945935ae84442711fd6.后缀 |
| | | String newFilePath = modulePath + File.separator + key + suffix; |
| | | //文件绝对路径 如 /home/img/2021/base/build/0421/4d6873609b144945935ae84442711fd6.后缀 |
| | | String localPath = dcPath + newFilePath; |
| | | //文件访问路径 如 /upload/2021/base/build/0421/4d6873609b144945935ae84442711fd6.后缀 |
| | | String url = filePathConfig.getUrlRootPath() + newFilePath.replace(File.separator, "/"); |
| | | newFile = new File(localPath); |
| | | if (!newFile.exists() && !newFile.mkdirs()) { |
| | | logger.error(ERROR_FORMATTER, newFilePath, ResultCodes.FILE_UPLOAD_FAIL.getDesc()); |
| | | throw new BusinessException(ResultCodes.FILE_UPLOAD_FAIL); |
| | | } |
| | | //上传文件 |
| | | file.transferTo(newFile); |
| | | //创建文件信息 |
| | | AttachmentInfo attachmentInfo = new AttachmentInfo(); |
| | | attachmentInfo.setDelFlag(0); |
| | | attachmentInfo.setFileKey(key); |
| | | attachmentInfo.setFileSuffix(suffix); |
| | | attachmentInfo.setFilePath(localPath); |
| | | attachmentInfo.setFileUrl(url); |
| | | attachmentInfo.setFileName(file.getOriginalFilename()); |
| | | attachmentInfo.setFileSize(file.getSize()); |
| | | attachmentInfo.setModule(module); |
| | | attachmentInfo.setFileType(getType(suffix)); |
| | | attachmentInfo.setCreateUid(user.getId()); |
| | | attachmentInfo.setCreateUname(user.getRealname()); |
| | | attachmentInfo.setUpdateUid(user.getId()); |
| | | attachmentInfo.setUpdateUname(user.getRealname()); |
| | | attachmentInfo.setUpdateTime(new Date()); |
| | | attachmentInfo.setCreateTime(new Date()); |
| | | attachmentInfoList.add(attachmentInfo); |
| | | |
| | | } catch (IOException e) { |
| | | if (newFile != null && newFile.exists()) { |
| | | newFile.delete(); |
| | | } |
| | | logger.error(ERROR_FORMATTER, ResultCodes.FILE_UPLOAD_FAIL, e.getMessage()); |
| | | throw new BusinessException(ResultCodes.FILE_UPLOAD_FAIL); |
| | | } |
| | | } |
| | | List<AttachmentInfo> detailList = attachmentInfoService.saveBatchAttachment(attachmentInfoList); |
| | | |
| | | return detailList; |
| | | } |
| | | |
| | | @Override |
| | | public void downloadForStream(HttpServletResponse response, String key) { |
| | | AttachmentInfo byKey = findByKey(key); |
| | | File file; |
| | | try { |
| | | response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode(byKey.getFileName(), StandardCharsets.UTF_8.name())); |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | file = new File(byKey.getFilePath()); |
| | | if (!file.exists()) { |
| | | logger.error(ERROR_FORMATTER, key, ResultCodes.FILE_NOT_EXISIST.getDesc()); |
| | | throw new BusinessException(ResultCodes.FILE_NOT_EXISIST); |
| | | } |
| | | OutputStream outputStream = response.getOutputStream(); |
| | | FileInputStream inputStream = new FileInputStream(file); |
| | | IoUtil.copy(inputStream, outputStream); |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | logger.error(e.getMessage()); |
| | | throw new BusinessException(ResultCodes.FILE_DOWNLOAD_EXPERTION); |
| | | } |
| | | } |
| | | @Override |
| | | public void downloadById(HttpServletResponse response, HttpServletRequest request, Long id) { |
| | | Assert.isTrue(id == null, "文件key未知异常"); |
| | | AttachmentInfo byId = findById(id); |
| | | downloadByEntity(response, request, byId); |
| | | } |
| | | |
| | | |
| | | public void downloadByEntity(HttpServletResponse response, HttpServletRequest request, AttachmentInfo attachmentInfo) { |
| | | if (ObjectUtil.isNotNull(attachmentInfo)) { |
| | | String type = attachmentInfo.getFileType(); |
| | | if (StrUtil.isBlank(type)) { |
| | | type = "application/octet-stream"; |
| | | } |
| | | type = type + ";charset=utf-8"; |
| | | String fileName = attachmentInfo.getFileName(); |
| | | response.setContentType("multipart/form-data;charset=utf-8"); |
| | | ServletUtil.setHeader(response, "Access-Control-Expose-Headers", "Content-Disposition"); |
| | | //本地文件下载 |
| | | File file = FileUtil.file(attachmentInfo.getFilePath()); |
| | | if (!FileUtil.exist(file)) { |
| | | throw new BusinessException(attachmentInfo.getFileKey() + "文件不存在"); |
| | | } |
| | | InputStream is = null; |
| | | try { |
| | | is = IoUtil.toStream(file); |
| | | ServletUtil.write(response, is, type, fileName); |
| | | } catch (Exception e) { |
| | | throw new BusinessException(ResultCodes.FILE_DOWNLOAD_EXPERTION); |
| | | } finally { |
| | | IoUtil.close(is); |
| | | } |
| | | } else { |
| | | throw new BusinessException(ResultCodes.FILE_NOT_EXISIST); |
| | | } |
| | | } |
| | | } |
| | |
| | | List<ElementTree> returnTree = new ArrayList<>(); |
| | | List<Map<String,Object>> list = elementManagementMapper.getElementTree(); //读取元素配置 |
| | | for (Map<String, Object> map : list) { |
| | | if(map.get("value") == parentId){ //一级要素,MenuType2 |
| | | if(map.get("value").equals(parentId)){ //一级要素 |
| | | ElementTree elementTree=new ElementTree(); |
| | | elementTree.setType(Integer.valueOf(map.get("type").toString())); |
| | | elementTree.setLabel(map.get("label").toString()); |
| | |
| | | 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.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.AttachmentInfoService; |
| | | import com.gk.hotwork.Service.InspectionExpertService; |
| | | import com.gk.hotwork.Service.InspectionHiddenDangerService; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | |
| | | @Autowired |
| | | private InspectionHiddenDangerMapper inspectionHiddenDangerMapper; |
| | | |
| | | @Autowired |
| | | private AttachmentInfoService attachmentInfoService; |
| | | |
| | | /** |
| | | * 修改 |
| | | * @param inspectionHiddenDanger |
| | |
| | | @Override |
| | | public void mod(InspectionHiddenDanger inspectionHiddenDanger, UserInfo userInfo) { |
| | | modrequiredVerification(inspectionHiddenDanger); |
| | | |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | //附件 |
| | | if(CollectionUtils.isNotEmpty(inspectionHiddenDanger.getRattachmentList())){ |
| | | for (AttachmentInfo attachmentInfo : inspectionHiddenDanger.getRattachmentList()) { |
| | | attachmentInfo.setBusinessId(inspectionHiddenDanger.getId()); |
| | | stringBuffer.append(attachmentInfo.getId().toString()).append(","); |
| | | } |
| | | stringBuffer = stringBuffer.deleteCharAt(stringBuffer.length()-1); |
| | | } |
| | | |
| | | inspectionHiddenDanger.setUpdateTime(new Date()); |
| | | inspectionHiddenDanger.setUpdateBy(userInfo.getRealname()); |
| | | inspectionHiddenDanger.setRectificationUrl(stringBuffer.toString()); |
| | | inspectionHiddenDangerMapper.updateById(inspectionHiddenDanger); |
| | | //更新附件 |
| | | if(CollectionUtils.isNotEmpty(inspectionHiddenDanger.getRattachmentList())){ |
| | | attachmentInfoService.updateBusinessIdBatch(inspectionHiddenDanger.getRattachmentList()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | inspectionHiddenDanger.setUpdateBy(userInfo.getRealname()); |
| | | inspectionHiddenDanger.setUpdateTime(new Date()); |
| | | inspectionHiddenDangerMapper.delByInspectionItemId(inspectionHiddenDanger); |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | 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); |
| | | } |
| | | IPage<SafetySelfInspectionDO> res = inspectionHiddenDangerMapper.selectPages(page, params); |
| | | return res; |
| | | } |
| | | |
| | | @Override |
| | | public List<InspectionHiddenDanger> inspectionHdangerlist(Long selfInspectionId) { |
| | | return inspectionHiddenDangerMapper.inspectionHdangerlist(selfInspectionId); |
| | | |
| | | List<InspectionHiddenDanger> inspectionHiddenDangerList = inspectionHiddenDangerMapper.inspectionHdangerlist(selfInspectionId); |
| | | for (InspectionHiddenDanger inspectionHiddenDanger : inspectionHiddenDangerList) { |
| | | if(StringUtils.isNotBlank(inspectionHiddenDanger.getRectificationUrl())){ |
| | | List<Long> idList = new ArrayList<>(); |
| | | String[] split = inspectionHiddenDanger.getRectificationUrl().split(","); |
| | | for (String s : split) { |
| | | idList.add(Long.valueOf(s)); |
| | | } |
| | | List<AttachmentInfo> byIds = attachmentInfoService.findByIds(idList); |
| | | inspectionHiddenDanger.setRattachmentList(byIds); |
| | | } |
| | | if(StringUtils.isNotBlank(inspectionHiddenDanger.getUrl())){ |
| | | List<Long> idList = new ArrayList<>(); |
| | | String[] split = inspectionHiddenDanger.getUrl().split(","); |
| | | for (String s : split) { |
| | | idList.add(Long.valueOf(s)); |
| | | } |
| | | List<AttachmentInfo> byIds = attachmentInfoService.findByIds(idList); |
| | | inspectionHiddenDanger.setAttachmentList(byIds); |
| | | } |
| | | } |
| | | return inspectionHiddenDangerList; |
| | | |
| | | } |
| | | |
| | | private void modrequiredVerification(InspectionHiddenDanger inspectionHiddenDanger){ |
| | |
| | | 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("整改状态不可为空"); |
| | | } |
| | |
| | | private InspectionExpertService expertService; |
| | | @Autowired |
| | | private InspectionHiddenDangerService dangerService; |
| | | @Autowired |
| | | private AttachmentInfoService attachmentInfoService; |
| | | |
| | | /** |
| | | * @Description: 分页 |
| | | * @Description: 自查分页 |
| | | */ |
| | | @Override |
| | | public IPage<SafetySelfInspection> selectPage(Page<SafetySelfInspection> page, Map<String, Object> filter, UserInfo user) { |
| | |
| | | filter.put("city",user.getCity()); |
| | | filter.put("area",user.getCounty()); |
| | | } |
| | | filter.put("flag",0); |
| | | filter.put("flag",(byte)2); |
| | | |
| | | IPage<SafetySelfInspection> res = safetySelfInspectionMapper.selectPages(page, filter); |
| | | List<SafetySelfInspection> records = res.getRecords(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * @Description: 分页 |
| | | * @Description: 监管检查分页 |
| | | */ |
| | | @Override |
| | | public IPage<SafetySelfInspection> selectSupervisePage(Page<SafetySelfInspection> page, Map<String, Object> filter, UserInfo user) { |
| | |
| | | filter.put("city",user.getCity()); |
| | | filter.put("area",user.getCounty()); |
| | | } |
| | | filter.put("flag",1); |
| | | filter.put("flag",(byte)1); |
| | | |
| | | IPage<SafetySelfInspection> res = safetySelfInspectionMapper.selectPages(page, filter); |
| | | List<SafetySelfInspection> records = res.getRecords(); |
| | |
| | | } |
| | | 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; |
| | |
| | | Date date = new Date(); |
| | | String username = user.getRealname(); |
| | | param.setValidFlag(Boolean.TRUE); |
| | | param.setFlag((byte) 0); |
| | | param.setFlag((byte) 2); |
| | | param.setUpdateBy(username); |
| | | param.setCreateBy(username); |
| | | param.setUpdateTime(date); |
| | |
| | | BeanUtils.copyProperties(safetySelfInspection,safetySelfInspectionRespDTO); |
| | | //获取所有检查项 |
| | | List<SafetySelfInspectionItem> itemList= safetySelfInspectionItemMapper.getDetailBySafetySelfInspectionId(id,unqualified); |
| | | //获取关联要素 |
| | | List<SafetyInspectionElementA> inspectionElementAList = safetyInspectionElementAService.getBySafetySelfInspectionId(id); |
| | | //获取要素树 |
| | | List<ElementTree> elementTreeList = elementManagementService.getMenuType1Tree(); |
| | | //获取附件 |
| | | List<AttachmentInfo> byBusinessId = attachmentInfoService.findByBusinessId(id); |
| | | safetySelfInspectionRespDTO.setAttachmentList(byBusinessId); |
| | | |
| | | 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); |
| | | if (CollectionUtils.isNotEmpty(elementTreeList)) { |
| | | for (ElementTree elementA : elementTreeList) { |
| | | |
| | | List<SafetySelfInspectionItem> selectElementList = itemList.stream().filter(item -> item.getElementA().equals(elementA.getValue())).collect(Collectors.toList()); |
| | | if (CollectionUtils.isNotEmpty(selectElementList)) { |
| | | SafetySelfInspectionElementRespDTO elementARespDTO = new SafetySelfInspectionElementRespDTO(); |
| | | elementARespDTO.setElementId(otree.getValue()); |
| | | elementARespDTO.setElementName(otree.getLabel()); |
| | | elementARespDTO.setType(otree.getType()); |
| | | elementARespDTO.setElementId(elementA.getValue()); |
| | | elementARespDTO.setElementName(elementA.getLabel()); |
| | | elementARespDTO.setType(elementA.getType()); |
| | | |
| | | List<SafetySelfInspectionElementRespDTO> brespDTOList = new ArrayList<>(); |
| | | //二级要素 |
| | | List<ElementTree> elementBList = otree.getChildren(); |
| | | List<ElementTree> elementBList = elementA.getChildren(); |
| | | if(CollectionUtils.isNotEmpty(elementBList)){ |
| | | for (ElementTree stree : elementBList) { |
| | | SafetySelfInspectionElementRespDTO elementBRespDTO = new SafetySelfInspectionElementRespDTO(); |
| | |
| | | SafetySelfInspectionItem safetySelfInspectionItem = safetySelfInspectionItemMapper.getDetailById(id); |
| | | List<SafetySelfInspectionItemDeduction> selfDeductionList = safetySelfInspectionItemDeductionMapper.getBySafetySelfInspectionItemId(safetySelfInspectionItem.getId()); |
| | | List<InspectionHiddenDanger> inspectionHiddenDangerList = dangerService.getBySafetySelfInspectionItemId(id); |
| | | List<AttachmentInfo> byBusinessId = attachmentInfoService.findByBusinessId(id); |
| | | |
| | | if (CollectionUtils.isNotEmpty(selfDeductionList)){ |
| | | safetySelfInspectionItem.setSelfDeductionList(selfDeductionList); |
| | |
| | | safetySelfInspectionItem.setSelfDeductionList(new ArrayList<>()); |
| | | } |
| | | } |
| | | for (InspectionHiddenDanger inspectionHiddenDanger : inspectionHiddenDangerList) { |
| | | if(StringUtils.isNotBlank(inspectionHiddenDanger.getUrl())){ |
| | | List<Long> attachmentIds = new ArrayList<>(); |
| | | String[] split = inspectionHiddenDanger.getUrl().split(","); |
| | | for (String s : split) { |
| | | attachmentIds.add(Long.valueOf(s)); |
| | | } |
| | | |
| | | List<AttachmentInfo> dangerAttachList = attachmentInfoService.findByIds(attachmentIds); |
| | | inspectionHiddenDanger.setAttachmentList(dangerAttachList); |
| | | } |
| | | |
| | | } |
| | | safetySelfInspectionItem.setAttachmentList(byBusinessId); |
| | | safetySelfInspectionItem.setDangerList(inspectionHiddenDangerList); |
| | | return safetySelfInspectionItem; |
| | | } |
| | |
| | | param.setUpdateTime(date); |
| | | param.setUpdateBy(username); |
| | | safetySelfInspectionItemMapper.updateById(param); |
| | | //附件 |
| | | List<AttachmentInfo> attachmentInfoList = new ArrayList<>(); |
| | | if(CollectionUtils.isNotEmpty(param.getAttachmentList())){ |
| | | for (AttachmentInfo attachmentInfo : param.getAttachmentList()) { |
| | | attachmentInfo.setBusinessId(param.getId()); |
| | | attachmentInfoList.add(attachmentInfo); |
| | | } |
| | | } |
| | | |
| | | if (param.getSafetyInspectionItemResult()==0 || param.getSafetyInspectionItemResult() == 2){ |
| | | //否决 合格--删除扣分记录 |
| | | safetySelfInspectionItemDeductionMapper.delBySafetySelfInspectionItemId(param.getId(),username,date); |
| | | //删除隐患 |
| | | dangerService.delByInspectionItemId(param.getSafetyInspectionItemId(),user); |
| | | //删除附件 |
| | | attachmentInfoService.deleteByBusinessId(param.getId()); |
| | | }else{ |
| | | //扣分 |
| | | List<SafetySelfInspectionItemDeduction> list = safetySelfInspectionItemDeductionMapper.getBySafetySelfInspectionItemId(param.getId()); |
| | |
| | | dangerService.delByIds(idList); |
| | | } |
| | | for (InspectionHiddenDanger inspectionHiddenDanger : param.getDangerList()) { |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | //附件 |
| | | if(CollectionUtils.isNotEmpty(inspectionHiddenDanger.getAttachmentList())){ |
| | | for (AttachmentInfo attachmentInfo : inspectionHiddenDanger.getAttachmentList()) { |
| | | stringBuffer.append(attachmentInfo.getId().toString()).append(","); |
| | | } |
| | | stringBuffer = stringBuffer.deleteCharAt(stringBuffer.length()-1); |
| | | } |
| | | |
| | | 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.setStatus((byte)-1); |
| | | inspectionHiddenDanger.setValidFlag(true); |
| | | inspectionHiddenDanger.setSelfInspectionId(param.getSafetySelfInspectionId()); |
| | | inspectionHiddenDanger.setSelfInspectionItemId(param.getId()); |
| | | inspectionHiddenDanger.setUrl(stringBuffer.toString()); |
| | | dangerService.save(inspectionHiddenDanger); |
| | | //附件 |
| | | if(StringUtils.isNotBlank(inspectionHiddenDanger.getUrl())){ |
| | | for (AttachmentInfo attachmentInfo : inspectionHiddenDanger.getAttachmentList()) { |
| | | attachmentInfo.setBusinessId(inspectionHiddenDanger.getId()); |
| | | attachmentInfoList.add(attachmentInfo); |
| | | } |
| | | } |
| | | }else { |
| | | inspectionHiddenDanger.setUpdateBy(user.getRealname()); |
| | | inspectionHiddenDanger.setUpdateTime(new Date()); |
| | | inspectionHiddenDanger.setUrl(stringBuffer.toString()); |
| | | dangerService.updateById(inspectionHiddenDanger); |
| | | //附件 |
| | | if(CollectionUtils.isNotEmpty(inspectionHiddenDanger.getAttachmentList())){ |
| | | for (AttachmentInfo attachmentInfo : inspectionHiddenDanger.getAttachmentList()) { |
| | | attachmentInfo.setBusinessId(inspectionHiddenDanger.getId()); |
| | | attachmentInfoList.add(attachmentInfo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | //附件信息更新 |
| | | if(CollectionUtils.isNotEmpty(attachmentInfoList)){ |
| | | attachmentInfoService.updateBusinessIdBatch(attachmentInfoList); |
| | | |
| | | } |
| | | } |
| | |
| | | item.setUpdateTime(new Date()); |
| | | }); |
| | | safetySelfInspectionItemMapper.updateBatch(itemList); |
| | | } |
| | | |
| | | @Override |
| | | public void addCheckAttachment(List<AttachmentInfo> attachmentList, UserInfo user) { |
| | | requiredAttachmentVerification(attachmentList); |
| | | for (AttachmentInfo attachmentInfo : attachmentList) { |
| | | attachmentInfo.setUpdateTime(new Date()); |
| | | attachmentInfo.setUpdateUid(user.getId()); |
| | | attachmentInfo.setUpdateUname(user.getRealname()); |
| | | } |
| | | attachmentInfoService.updateBusinessIdBatch(attachmentList); |
| | | } |
| | | |
| | | private void requiredAttachmentVerification(List<AttachmentInfo> attachmentList) { |
| | | if(CollectionUtils.isEmpty(attachmentList)){ |
| | | throw new BusinessException("附件信息为空"); |
| | | } |
| | | for (AttachmentInfo attachmentInfo : attachmentList) { |
| | | if(attachmentInfo.getId() == null){ |
| | | throw new BusinessException("附件主键信息不能为空"); |
| | | } |
| | | if(attachmentInfo.getBusinessId() == null){ |
| | | throw new BusinessException("附件信息关联业务id不能为空"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | 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检查要素"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | host: http://localhost:8006 |
| | | host: http://localhost:8016 |
| | | |
| | | filePath: d:/uploads/ |
| | | fileurl: http://localhost:8006/upload/ |
| | | fileurl: http://localhost:8016/upload/ |
| | | socketport: 504 |
| | | |
| | | sqlPath: /home/dbback/ |
| | | sqlurl: http://nmy.sinanoaq.cn:8006/dbback/ |
| | | sqlurl: http://nmy.sinanoaq.cn:8016/dbback/ |
| | | |
| | | enterprisePath: /home/uploads/enterprise/ |
| | | enterpriseUrl: http://nmy.sinanoaq.cn:8006/upload/enterprise/ |
| | | enterpriseUrl: http://nmy.sinanoaq.cn:8016/upload/enterprise/ |
| | | enterprise: enterprise/ |
| | | |
| | | transportCertificatePath: /home/uploads/transportCertificate/ |
| | | transportCertificateUrl: http://nmy.sinanoaq.cn:8006/upload/transportCertificate/ |
| | | transportCertificateUrl: http://nmy.sinanoaq.cn:8016/upload/transportCertificate/ |
| | | transportCertificate: transportCertificate/ |
| | | |
| | | hiddenDangerPath: /home/uploads/hiddenDanger/ |
| | | hiddenDangerUrl: http://nmy.sinanoaq.cn:8006/upload/hiddenDanger/ |
| | | hiddenDangerUrl: http://nmy.sinanoaq.cn:8016/upload/hiddenDanger/ |
| | | hiddenDanger: hiddenDanger/ |
| | | |
| | | standardPath: /home/uploads/standard/ |
| | | standardUrl: http://nmy.sinanoaq.cn:8006/upload/standard/ |
| | | standardUrl: http://nmy.sinanoaq.cn:8016/upload/standard/ |
| | | standard: standard/ |
| | | |
| | | contractPath: /home/uploads/contract/ |
| | | contractUrl: http://nmy.sinanoaq.cn:8006/upload/contract/ |
| | | contractUrl: http://nmy.sinanoaq.cn:8016/upload/contract/ |
| | | contract: contract/ |
| | | |
| | | patrolPath: /home/uploads/patrol/ |
| | | patrolUrl: http://nmy.sinanoaq.cn:8006/upload/patrol/ |
| | | patrolUrl: http://nmy.sinanoaq.cn:8016/upload/patrol/ |
| | | |
| | | appPath: /home/uploads/app/ |
| | | app: app/ |
| | | appUrl: http://nmy.sinanoaq.cn:8006/upload/app/ |
| | | appUrl: http://nmy.sinanoaq.cn:8016/upload/app/ |
| | | |
| | | productPath: /home/uploads/product/ |
| | | productUrl: http://nmy.sinanoaq.cn:8006/upload/product/ |
| | | productUrl: http://nmy.sinanoaq.cn:8016/upload/product/ |
| | | |
| | | assessApplyPath: /home/uploads/assessApply/ |
| | | assessApplytUrl: http://nmy.sinanoaq.cn:8006/upload/assessApply/ |
| | | assessApplytUrl: http://nmy.sinanoaq.cn:8016/upload/assessApply/ |
| | | assessApply: assessApply/ |
| | | |
| | | workCertPath: /home/uploads/workCert/ |
| | | workCertUrl: http://nmy.sinanoaq.cn:8006/upload/workCert/ |
| | | workCertUrl: http://nmy.sinanoaq.cn:8016/upload/workCert/ |
| | | workCert: workCert/ |
| | | |
| | | nanowebUrl: http://nmy.sinanoaq.cn:8006/nanoweb/api/register |
| | | nanowebUrl: http://nmy.sinanoaq.cn:8016/nanoweb/api/register |
| | | nanowebEnable: true |
| | | |
| | | taskPath: d:/uploads/task/ |
| | | taskPathPrefix: d:/uploads/ |
| | | taskUrl: http://localhost:8006/upload/task/ |
| | | taskUrl: http://localhost:8016/upload/task/ |
| | | task: task/ |
| | | |
| | | emergencyPlanPath: /home/uploads/emergencyPlan/ |
| | | emergencyPlanUrl: http://localhost:8006/upload/emergencyPlan/ |
| | | emergencyPlanUrl: http://localhost:8016/upload/emergencyPlan/ |
| | | emergencyPlan : emergencyPlan/ |
| | | |
| | | safecheckExecImagePath : /home/uploads/safecheck/ |
| | |
| | | name: ali |
| | | key: |
| | | url: |
| | | #windous测试 |
| | | file: |
| | | path: |
| | | #基础路径 |
| | | dcPath: E:\file\gkhy\test\ |
| | | urlRootPath: /uploadfile/ |
| | | module: |
| | | #用户模块 |
| | | accountPath: /account/user/ |
| | | #排查模块 |
| | | checkPath: /check/ |
| | | |
| | | # swagger生产环境中禁止显示 |
| | | swagger: |
| | | show: false |
| | |
| | | tomcat: |
| | | uri-encoding: UTF-8 |
| | | basedir: / |
| | | port: 8016 |
| | | port: 8006 |
| | | servlet: |
| | | context-path: / |
| | | # mysql |
| | |
| | | |
| | | #redis |
| | | redis: |
| | | database: 0 |
| | | database: 14 |
| | | host: 127.0.0.1 |
| | | port: 6379 |
| | | password: akj78avauba789a |
| | |
| | | # enabled: true |
| | | enabled: false |
| | | |
| | | host: http://localhost:8006/zhongtai |
| | | host: http://localhost:8006 |
| | | |
| | | filePath: /home/uploads/ |
| | | fileurl: http://nmy.sinanoaq.cn:8006/upload/ |
| | |
| | | key: |
| | | url: |
| | | |
| | | file: |
| | | path: |
| | | #基础路径 |
| | | dcPath: /home/uploads/hazardInvestigation/ |
| | | urlRootPath: /uploadfile/ |
| | | module: |
| | | #用户模块 |
| | | accountPath: /account/user/ |
| | | #排查模块 |
| | | checkPath: /check/ |
| | | # swagger生产环境中禁止显示 |
| | | swagger: |
| | | show: false |
| | |
| | | # swagger生产环境中禁止显示 |
| | | swagger: |
| | | show: false |
| | | |
| | | # mysql 多数据源 |
| | | spring: |
| | | application: |
| | | # 环境 dev|prod|online |
| | | profiles: |
| | | active: prod |
| | | active: dev |
| | | # active: prod |
| | | # active: test |
| | | # active: online |