安全日志、ai工单接口

This commit is contained in:
lcj
2025-09-03 15:44:13 +08:00
parent 8c412d033b
commit f1aed20560
24 changed files with 528 additions and 92 deletions

View File

@ -89,7 +89,7 @@ public class SubConstructionUserController extends BaseController {
@GetMapping("/{id}")
public R<SubConstructionUserVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(constructionUserService.queryById(id));
return R.ok(constructionUserService.queryById(id, true));
}
/**

View File

@ -47,7 +47,7 @@ public class SubConstructionUserAppController {
@GetMapping("/loginUser")
public R<SubConstructionUserVo> getLoginUserInfo() {
SubConstructionUser constructionUser = constructionUserService.getBySysUserId(LoginHelper.getUserId());
return R.ok(constructionUserService.getVo(constructionUser));
return R.ok(constructionUserService.getVo(constructionUser, false));
}
/**
@ -60,7 +60,7 @@ public class SubConstructionUserAppController {
if (constructionUser == null) {
return R.fail("查询施工人员不存在");
}
return R.ok(constructionUserService.getVo(constructionUser));
return R.ok(constructionUserService.getVo(constructionUser, true));
}
/**
@ -69,7 +69,7 @@ public class SubConstructionUserAppController {
@GetMapping("/{id}")
public R<SubConstructionUserVo> queryById(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(constructionUserService.queryById(id));
return R.ok(constructionUserService.queryById(id, true));
}
/**

View File

@ -0,0 +1,39 @@
package org.dromara.contractor.controller.app;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotNull;
import org.dromara.common.core.domain.R;
import org.dromara.common.web.core.BaseController;
import org.dromara.contractor.domain.vo.contractor.SubContractorManagerVo;
import org.dromara.contractor.service.ISubContractorService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 分包单位 app 接口
*
* @author lilemy
* @date 2025-09-03 15:09
*/
@Validated
@RestController
@RequestMapping("/app/contractor/contractor")
public class SubContractorAppController extends BaseController {
@Resource
private ISubContractorService contractorService;
/**
* 根据项目id查询分包方管理人员信息列表
*/
@GetMapping("/listManager/{projectId}")
public R<List<SubContractorManagerVo>> listManager(@NotNull(message = "项目id不能为空")
@PathVariable Long projectId) {
return R.ok(contractorService.queryManagerListByProjectId(projectId));
}
}

View File

@ -55,11 +55,66 @@ public class SubConstructionUserCreateReq implements Serializable {
*/
private String nation;
/**
* 身份证正面图片
*/
private String sfzFrontPic;
/**
* 身份证反面图片
*/
private String sfzBackPic;
/**
* 身份证号码
*/
private String sfzNumber;
/**
* 身份证有效开始期
*/
private String sfzStart;
/**
* 身份证有效结束期
*/
private String sfzEnd;
/**
* 身份证地址
*/
private String sfzSite;
/**
* 身份证出生日期
*/
private String sfzBirth;
/**
* 籍贯
*/
private String nativePlace;
/**
* 银行卡图片
*/
private String yhkPic;
/**
* 银行卡号
*/
private String yhkNumber;
/**
* 开户行
*/
private String yhkOpeningBank;
/**
* 持卡人
*/
private String yhkCardholder;
/**
* 工种(字典type_of_work)
*/

View File

@ -6,6 +6,8 @@ import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.contractor.domain.SubConstructionUser;
import org.dromara.contractor.domain.vo.contractor.SubContractorVo;
@ -118,12 +120,24 @@ public class SubConstructionUserVo implements Serializable {
@ExcelProperty(value = "身份证正面图片")
private String sfzFrontPic;
/**
* 身份证正面图片URL
*/
@Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "sfzFrontPic")
private String sfzFrontPicUrl;
/**
* 身份证反面图片
*/
@ExcelProperty(value = "身份证反面图片")
private String sfzBackPic;
/**
* 身份证反面图片URL
*/
@Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "sfzBackPic")
private String sfzBackPicUrl;
/**
* 身份证号码
*/
@ -166,6 +180,12 @@ public class SubConstructionUserVo implements Serializable {
@ExcelProperty(value = "银行卡图片")
private String yhkPic;
/**
* 银行卡图片地址
*/
@Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "yhkPic")
private String yhkPicUrl;
/**
* 银行卡号
*/

View File

@ -25,10 +25,11 @@ public interface ISubConstructionUserService extends IService<SubConstructionUse
/**
* 查询施工人员
*
* @param id 主键
* @param id 主键
* @param isHidden 是否隐藏字段
* @return 施工人员
*/
SubConstructionUserVo queryById(Long id);
SubConstructionUserVo queryById(Long id, Boolean isHidden);
/**
* 分页查询施工人员列表
@ -141,9 +142,10 @@ public interface ISubConstructionUserService extends IService<SubConstructionUse
* 获取施工人员视图对象
*
* @param constructionUser 施工人员对象
* @param isHidden 是否隐藏手机号、身份证号码
* @return 施工人员视图对象
*/
SubConstructionUserVo getVo(SubConstructionUser constructionUser);
SubConstructionUserVo getVo(SubConstructionUser constructionUser, Boolean isHidden);
/**
* 获取施工人员查询条件封装

View File

@ -52,8 +52,10 @@ import org.dromara.project.domain.enums.BusAttendanceCommuterEnum;
import org.dromara.project.domain.enums.BusConstructionUserAttendanceStatusEnum;
import org.dromara.project.service.*;
import org.dromara.system.domain.vo.SysOssVo;
import org.dromara.system.domain.vo.SysUserVo;
import org.dromara.system.service.ISysDictTypeService;
import org.dromara.system.service.ISysOssService;
import org.dromara.system.service.ISysUserService;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
@ -122,19 +124,23 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
@Resource
private BaiDuFace baiDuFace;
@Resource
private ISysUserService userService;
/**
* 查询施工人员
*
* @param id 主键
* @param id 主键
* @param isHidden 是否隐藏字段
* @return 施工人员
*/
@Override
public SubConstructionUserVo queryById(Long id) {
public SubConstructionUserVo queryById(Long id, Boolean isHidden) {
SubConstructionUser constructionUser = this.getById(id);
if (constructionUser == null) {
throw new ServiceException("施工人员信息不存在", HttpStatus.NOT_FOUND);
}
return this.getVo(constructionUser);
return this.getVo(constructionUser, isHidden);
}
/**
@ -263,7 +269,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
@Override
public List<BusConstructionUserExportVo> queryList(SubConstructionUserQueryReq req) {
LambdaQueryWrapper<SubConstructionUser> lqw = this.buildQueryWrapper(req);
List<SubConstructionUserVo> constructionUserVoList = this.list(lqw).stream().map(this::getVo).toList();
List<SubConstructionUserVo> constructionUserVoList = this.list(lqw).stream().map(user -> getVo(user, false)).toList();
// 关联项目信息
Set<Long> projectIdList = constructionUserVoList.stream().map(SubConstructionUserVo::getProjectId)
.collect(Collectors.toSet());
@ -332,6 +338,16 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
validEntityBeforeSave(constructionUser, true);
Long userId = LoginHelper.getUserId();
projectService.validAuth(req.getProjectId(), userId);
String phone = constructionUser.getPhone();
SysUserVo userVo = userService.selectUserByPhonenumber(phone);
if (userVo == null) {
throw new ServiceException("当前用户未在系统注册", HttpStatus.BAD_REQUEST);
}
constructionUser.setSysUserId(userVo.getUserId());
String sfzNumber = req.getSfzNumber();
// 对身份证号码进行加密
String encrypt = idCardEncryptorUtil.encrypt(sfzNumber);
constructionUser.setSfzNumber(encrypt);
// 操作数据库
boolean save = this.save(constructionUser);
if (!save) {
@ -550,6 +566,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
String typeOfWork = entity.getTypeOfWork();
String wageMeasureUnit = entity.getWageMeasureUnit();
String phone = entity.getPhone();
String sfzNumber = entity.getSfzNumber();
if (projectId == null) {
throw new ServiceException("项目 id 不能为空", HttpStatus.BAD_REQUEST);
}
@ -590,6 +607,9 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
if (StringUtils.isNotEmpty(phone) && !PhoneUtil.isPhone(phone)) {
throw new ServiceException("手机号码格式不正确", HttpStatus.BAD_REQUEST);
}
if (StringUtils.isNotEmpty(sfzNumber) && !IdcardUtil.isValidCard(sfzNumber)) {
throw new ServiceException("身份证号码格式不正确", HttpStatus.BAD_REQUEST);
}
}
/**
@ -636,10 +656,11 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
* 获取施工人员视图对象
*
* @param constructionUser 施工人员对象
* @param isHidden 是否隐藏手机号、身份证号码
* @return 施工人员视图对象
*/
@Override
public SubConstructionUserVo getVo(SubConstructionUser constructionUser) {
public SubConstructionUserVo getVo(SubConstructionUser constructionUser, Boolean isHidden) {
// 对象转封装类
SubConstructionUserVo constructionUserVo = new SubConstructionUserVo();
if (constructionUser == null) {
@ -678,15 +699,22 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
String decrypt = idCardEncryptorUtil.decrypt(constructionUserVo.getSfzNumber());
String hide = "";
if (StringUtils.isNotEmpty(decrypt)) {
hide = DesensitizedUtil.idCardNum(decrypt, 1, 2);
if (isHidden) {
hide = DesensitizedUtil.idCardNum(decrypt, 1, 2);
} else {
hide = decrypt;
}
}
constructionUserVo.setSfzNumber(hide);
// 隐藏手机号码
String hidePhone = DesensitizedUtil.mobilePhone(constructionUserVo.getPhone());
constructionUserVo.setPhone(hidePhone);
// 隐藏银行卡号
String hideBank = DesensitizedUtil.bankCard(constructionUserVo.getYhkNumber());
constructionUserVo.setYhkNumber(hideBank);
// 隐藏
if (isHidden) {
// 隐藏手机号码
String hidePhone = DesensitizedUtil.mobilePhone(constructionUserVo.getPhone());
constructionUserVo.setPhone(hidePhone);
// 隐藏银行卡号
String hideBank = DesensitizedUtil.bankCard(constructionUserVo.getYhkNumber());
constructionUserVo.setYhkNumber(hideBank);
}
return constructionUserVo;
}

View File

@ -29,11 +29,9 @@ import org.dromara.contractor.service.ISubContractorService;
import org.dromara.project.domain.BusProject;
import org.dromara.project.domain.enums.SubConstructionUserRoleEnum;
import org.dromara.project.service.IBusProjectService;
import org.dromara.system.mapper.SysDeptMapper;
import org.dromara.tender.domain.TenderSupplierInput;
import org.dromara.tender.service.ITenderSupplierInputService;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -56,10 +54,6 @@ public class SubContractorServiceImpl extends ServiceImpl<SubContractorMapper, S
@Resource
private IBusProjectService projectService;
@Lazy
@Resource
private SysDeptMapper deptMapper;
@Resource
private ITenderSupplierInputService supplierInputService;

View File

@ -28,6 +28,9 @@ public class BusConstructionUserExitAppController extends BaseController {
@Resource
private IBusConstructionUserExitService constructionUserExitService;
/**
* 新增施工人员退场记录信息
*/
@Log(title = "施工人员入场退场记录信息", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()

View File

@ -0,0 +1,82 @@
package org.dromara.safety.controller.app;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotNull;
import org.dromara.common.core.domain.R;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController;
import org.dromara.safety.domain.dto.safetyinspection.HseSafetyInspectionCreateReq;
import org.dromara.safety.domain.dto.safetyinspection.HseSafetyInspectionQueryReq;
import org.dromara.safety.domain.dto.safetyinspection.HseSafetyInspectionRectificationReq;
import org.dromara.safety.domain.dto.safetyinspection.HseSafetyInspectionReviewReq;
import org.dromara.safety.domain.vo.safetyinspection.HseSafetyInspectionVo;
import org.dromara.safety.service.IHseSafetyInspectionService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 安全巡检工单 app 接口
*
* @author lilemy
* @date 2025-09-03 14:19
*/
@Validated
@RestController
@RequestMapping("/app/safety/safetyInspection")
public class HseSafetyInspectionAppController extends BaseController {
@Resource
private IHseSafetyInspectionService safetyInspectionService;
/**
* 查询安全巡检工单记录列表
*/
@GetMapping("/list")
public TableDataInfo<HseSafetyInspectionVo> queryPageList(HseSafetyInspectionQueryReq req, PageQuery pageQuery) {
return safetyInspectionService.queryPageList(req, pageQuery);
}
/**
* 获取安全巡检工单详细信息
*/
@GetMapping("/{id}")
public R<HseSafetyInspectionVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(safetyInspectionService.queryById(id));
}
/**
* 新增安全巡检工单
*/
@Log(title = "安全巡检工单", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Long> add(@Validated @RequestBody HseSafetyInspectionCreateReq req) {
return R.ok(safetyInspectionService.insertByBo(req));
}
/**
* 新增安全巡检工单整改
*/
@Log(title = "安全巡检工单", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping("/rectification")
public R<Void> insertRectification(@Validated @RequestBody HseSafetyInspectionRectificationReq req) {
return toAjax(safetyInspectionService.insertRectification(req));
}
/**
* 新增安全巡检工单复查
*/
@Log(title = "安全巡检工单", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping("/review")
public R<Void> insertReview(@Validated @RequestBody HseSafetyInspectionReviewReq req) {
return toAjax(safetyInspectionService.insertReview(req));
}
}

View File

@ -12,6 +12,7 @@ import org.dromara.common.web.core.BaseController;
import org.dromara.safety.domain.dto.violationrecord.HseViolationRecordCreateHandlerReq;
import org.dromara.safety.domain.dto.violationrecord.HseViolationRecordQueryReq;
import org.dromara.safety.domain.dto.violationrecord.HseViolationRecordRectificationReq;
import org.dromara.safety.domain.dto.violationrecord.HseViolationRecordReviewReq;
import org.dromara.safety.domain.vo.violationrecord.HseViolationRecordVo;
import org.dromara.safety.service.IHseViolationRecordService;
import org.springframework.validation.annotation.Validated;
@ -67,4 +68,14 @@ public class HseViolationRecordAppController extends BaseController {
public R<Void> insertRectification(@Validated @RequestBody HseViolationRecordRectificationReq req) {
return toAjax(violationRecordService.insertRectification(req));
}
/**
* 新增违规记录复查
*/
@Log(title = "违规记录", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping("/review")
public R<Void> insertReview(@Validated @RequestBody HseViolationRecordReviewReq req) {
return toAjax(violationRecordService.insertReview(req));
}
}

View File

@ -7,6 +7,7 @@ import lombok.EqualsAndHashCode;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import java.io.Serial;
import java.time.LocalDate;
import java.util.Date;
/**
@ -34,6 +35,11 @@ public class HseSafetyInspection extends BaseEntity {
*/
private Long projectId;
/**
* 检查项目
*/
private String checkProject;
/**
* 检查类型
*/
@ -72,7 +78,7 @@ public class HseSafetyInspection extends BaseEntity {
/**
* 整改期限
*/
private Date rectificationDeadline;
private LocalDate rectificationDeadline;
/**
* 回复日期

View File

@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import java.io.Serial;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* 站班会对象 hse_team_meeting
@ -47,7 +47,7 @@ public class HseTeamMeeting extends BaseEntity {
/**
* 开会时间
*/
private LocalDate meetingDate;
private LocalDateTime meetingDate;
/**
* 宣讲人

View File

@ -1,12 +1,12 @@
package org.dromara.safety.domain.dto.safetyinspection;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Date;
/**
@ -25,19 +25,28 @@ public class HseSafetyInspectionCreateReq implements Serializable {
@NotNull(message = "项目id不能为空")
private Long projectId;
/**
* 检查项目
*/
@NotBlank(message = "检查项目不能为空")
private String checkProject;
/**
* 检查类型
*/
@NotBlank(message = "检查类型不能为空")
private String checkType;
/**
* 违章类型
*/
@NotBlank(message = "违章类型不能为空")
private String violationType;
/**
* 巡检结果
*/
@NotBlank(message = "巡检结果不能为空")
private String inspectionResult;
/**
@ -58,8 +67,7 @@ public class HseSafetyInspectionCreateReq implements Serializable {
/**
* 整改期限
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
private Date rectificationDeadline;
private LocalDate rectificationDeadline;
/**
* 是否回复1回复 2不回复
@ -67,31 +75,11 @@ public class HseSafetyInspectionCreateReq implements Serializable {
@NotBlank(message = "是否回复不能为空")
private String isReply;
/**
* 回复日期
*/
private String replyDate;
/**
* 工单状态1通知 2整改 3复查
*/
private String status;
/**
* 问题隐患
*/
private String hiddenDanger;
/**
* 检查时间
*/
private Date checkTime;
/**
* 整改时间
*/
private Date rectificationTime;
/**
* 检查附件
*/

View File

@ -0,0 +1,42 @@
package org.dromara.safety.domain.dto.safetyinspection;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* @author lilemy
* @date 2025-09-03 14:41
*/
@Data
public class HseSafetyInspectionRectificationReq implements Serializable {
@Serial
private static final long serialVersionUID = 892746807506646837L;
/**
* 主键ID
*/
@NotNull(message = "主键不能为空")
private Long id;
/**
* 问题隐患
*/
private String hiddenDanger;
/**
* 整改措施
*/
@NotBlank(message = "整改措施不能为空")
private String measure;
/**
* 整改附件
*/
private String rectificationFile;
}

View File

@ -0,0 +1,37 @@
package org.dromara.safety.domain.dto.safetyinspection;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* @author lilemy
* @date 2025-09-03 14:42
*/
@Data
public class HseSafetyInspectionReviewReq implements Serializable {
@Serial
private static final long serialVersionUID = 4562927673208783521L;
/**
* 主键ID
*/
@NotNull(message = "主键不能为空")
private Long id;
/**
* 复查情况
*/
@NotBlank(message = "复查情况不能为空")
private String review;
/**
* 复查状态1通过 2未通过
*/
@NotBlank(message = "复查状态不能为空")
private String reviewType;
}

View File

@ -1,6 +1,7 @@
package org.dromara.safety.domain.dto.safetyinspection;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serial;
@ -20,6 +21,7 @@ public class HseSafetyInspectionUpdateReq implements Serializable {
/**
* 主键ID
*/
@NotNull(message = "主键不能为空")
private Long id;
/**

View File

@ -6,7 +6,7 @@ import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
@ -41,7 +41,7 @@ public class HseTeamMeetingCreateReq implements Serializable {
* 开会时间
*/
@NotNull(message = "开会时间不能为空")
private LocalDate meetingDate;
private LocalDateTime meetingDate;
/**
* 宣讲人

View File

@ -0,0 +1,42 @@
package org.dromara.safety.domain.dto.violationrecord;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* @author lilemy
* @date 2025-09-03 11:35
*/
@Data
public class HseViolationRecordReviewReq implements Serializable {
@Serial
private static final long serialVersionUID = 250013725990078581L;
/**
* 主键id
*/
@NotNull(message = "主键不能为空")
private Long id;
/**
* 复查情况
*/
@NotBlank(message = "复查情况不能为空")
private String review;
/**
* 复查状态1通过 2未通过
*/
@NotBlank(message = "复查状态不能为空")
private String reviewType;
/**
* 备注
*/
private String remark;
}

View File

@ -11,6 +11,7 @@ import org.dromara.safety.domain.HseTeamMeeting;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
@ -67,7 +68,7 @@ public class HseTeamMeetingVo implements Serializable {
* 开会时间
*/
@ExcelProperty(value = "开会时间")
private Date meetingDate;
private LocalDateTime meetingDate;
/**
* 宣讲人

View File

@ -7,10 +7,7 @@ import jakarta.servlet.http.HttpServletResponse;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.safety.domain.HseSafetyInspection;
import org.dromara.safety.domain.dto.safetyinspection.HseSafetyInspectionCreateReq;
import org.dromara.safety.domain.dto.safetyinspection.HseSafetyInspectionGisReq;
import org.dromara.safety.domain.dto.safetyinspection.HseSafetyInspectionQueryReq;
import org.dromara.safety.domain.dto.safetyinspection.HseSafetyInspectionUpdateReq;
import org.dromara.safety.domain.dto.safetyinspection.*;
import org.dromara.safety.domain.vo.safetyinspection.HseSafetyInspectionListGisVo;
import org.dromara.safety.domain.vo.safetyinspection.HseSafetyInspectionVo;
@ -114,4 +111,19 @@ public interface IHseSafetyInspectionService extends IService<HseSafetyInspectio
*/
void exportWordById(Long id, HttpServletResponse response);
/**
* 添加整改
*
* @param req 添加整改参数
* @return 是否添加成功
*/
Boolean insertRectification(HseSafetyInspectionRectificationReq req);
/**
* 添加复查
*
* @param req 添加复查参数
* @return 是否添加成功
*/
Boolean insertReview(HseSafetyInspectionReviewReq req);
}

View File

@ -6,10 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.safety.domain.HseViolationRecord;
import org.dromara.safety.domain.dto.violationrecord.HseViolationRecordCreateDto;
import org.dromara.safety.domain.dto.violationrecord.HseViolationRecordCreateHandlerReq;
import org.dromara.safety.domain.dto.violationrecord.HseViolationRecordQueryReq;
import org.dromara.safety.domain.dto.violationrecord.HseViolationRecordRectificationReq;
import org.dromara.safety.domain.dto.violationrecord.*;
import org.dromara.safety.domain.vo.violationrecord.HseViolationRecordVo;
import java.util.Collection;
@ -102,4 +99,12 @@ public interface IHseViolationRecordService extends IService<HseViolationRecord>
* @return 是否新增成功
*/
Boolean insertRectification(HseViolationRecordRectificationReq req);
/**
* 新增违章复查信息
*
* @param req 违章复查信息
* @return 是否新增成功
*/
Boolean insertReview(HseViolationRecordReviewReq req);
}

View File

@ -22,6 +22,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.oss.core.OssClient;
import org.dromara.common.oss.exception.OssException;
import org.dromara.common.oss.factory.OssFactory;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.utils.DocumentUtil;
import org.dromara.contractor.domain.SubContractor;
import org.dromara.contractor.service.ISubContractorService;
@ -31,10 +32,8 @@ import org.dromara.project.service.IBusProjectTeamService;
import org.dromara.safety.constant.HseSafetyConstant;
import org.dromara.safety.domain.HseSafetyInspection;
import org.dromara.safety.domain.HseTeamMeeting;
import org.dromara.safety.domain.dto.safetyinspection.HseSafetyInspectionCreateReq;
import org.dromara.safety.domain.dto.safetyinspection.HseSafetyInspectionGisReq;
import org.dromara.safety.domain.dto.safetyinspection.HseSafetyInspectionQueryReq;
import org.dromara.safety.domain.dto.safetyinspection.HseSafetyInspectionUpdateReq;
import org.dromara.safety.domain.HseViolationRecord;
import org.dromara.safety.domain.dto.safetyinspection.*;
import org.dromara.safety.domain.enums.HseSafetyInspectionReviewTypeEnum;
import org.dromara.safety.domain.enums.HseSafetyInspectionStatusEnum;
import org.dromara.safety.domain.vo.safetyinspection.HseSafetyInspectionListGisVo;
@ -203,7 +202,7 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
HseSafetyInspection safetyInspection = new HseSafetyInspection();
BeanUtils.copyProperties(req, safetyInspection);
// 数据校验
validEntityBeforeSave(safetyInspection, true);
validEntityBeforeSave(safetyInspection);
// 写入数据库
boolean save = this.save(safetyInspection);
if (!save) {
@ -225,7 +224,7 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
HseSafetyInspection safetyInspection = new HseSafetyInspection();
BeanUtils.copyProperties(req, safetyInspection);
// 数据校验
validEntityBeforeSave(safetyInspection, false);
validEntityBeforeSave(safetyInspection);
// 判断是否存在
HseSafetyInspection oldSafetyInspection = this.getById(safetyInspection.getId());
if (oldSafetyInspection == null) {
@ -238,27 +237,10 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(HseSafetyInspection entity, Boolean create) {
private void validEntityBeforeSave(HseSafetyInspection entity) {
// TODO 做一些数据校验,如唯一约束
Long projectId = entity.getProjectId();
Long correctorId = entity.getCorrectorId();
String checkType = entity.getCheckType();
String violationType = entity.getViolationType();
// 创建时校验
if (create) {
if (projectId == null) {
throw new ServiceException("项目id不能为空", HttpStatus.BAD_REQUEST);
}
if (correctorId == null) {
throw new ServiceException("整改人id不能为空", HttpStatus.BAD_REQUEST);
}
if (StringUtils.isBlank(checkType)) {
throw new ServiceException("检查类型不能为空", HttpStatus.BAD_REQUEST);
}
if (StringUtils.isBlank(violationType)) {
throw new ServiceException("违规类型不能为空", HttpStatus.BAD_REQUEST);
}
}
if (projectId != null && projectService.getById(projectId) == null) {
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
}
@ -471,6 +453,62 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
}
}
/**
* 添加整改
*
* @param req 添加整改参数
* @return 是否添加成功
*/
@Override
public Boolean insertRectification(HseSafetyInspectionRectificationReq req) {
Long id = req.getId();
HseSafetyInspection safetyInspection = this.getById(id);
if (safetyInspection == null) {
throw new ServiceException("安全巡检工单信息不存在", HttpStatus.BAD_REQUEST);
}
Long correctorId = safetyInspection.getCorrectorId();
// 只有指定用户可以整改
Long userId = LoginHelper.getUserId();
if (!correctorId.equals(userId)) {
throw new ServiceException("当前用户不是指定整改人", HttpStatus.BAD_REQUEST);
}
HseSafetyInspection updateInspection = new HseSafetyInspection();
BeanUtils.copyProperties(req, updateInspection);
// 填充默认值
updateInspection.setId(id);
updateInspection.setRectificationTime(new Date());
updateInspection.setStatus(HseSafetyInspectionStatusEnum.RECTIFICATION.getValue());
// 操作数据库
return this.updateById(updateInspection);
}
/**
* 添加复查
*
* @param req 添加复查参数
* @return 是否添加成功
*/
@Override
public Boolean insertReview(HseSafetyInspectionReviewReq req) {
Long id = req.getId();
HseSafetyInspection safetyInspection = this.getById(id);
if (safetyInspection == null) {
throw new ServiceException("安全巡检工单信息不存在", HttpStatus.NOT_FOUND);
}
// 校验是否已整改
if (!safetyInspection.getStatus().equals(HseSafetyInspectionStatusEnum.RECTIFICATION.getValue())) {
throw new ServiceException("该安全巡检工单信息未整改,无法进行复查", HttpStatus.BAD_REQUEST);
}
HseSafetyInspection updateRecord = new HseSafetyInspection();
BeanUtils.copyProperties(req, updateRecord);
// 填充默认值
updateRecord.setId(id);
updateRecord.setReviewTime(new Date());
updateRecord.setStatus(HseSafetyInspectionStatusEnum.REVIEW.getValue());
// 操作数据库
return this.updateById(updateRecord);
}
/**
* 根据实体获取Word的文本Map
*

View File

@ -23,10 +23,8 @@ import org.dromara.safety.domain.HseRecognizeRecord;
import org.dromara.safety.domain.HseViolationLevel;
import org.dromara.safety.domain.HseViolationLevelPost;
import org.dromara.safety.domain.HseViolationRecord;
import org.dromara.safety.domain.dto.violationrecord.HseViolationRecordCreateDto;
import org.dromara.safety.domain.dto.violationrecord.HseViolationRecordCreateHandlerReq;
import org.dromara.safety.domain.dto.violationrecord.HseViolationRecordQueryReq;
import org.dromara.safety.domain.dto.violationrecord.HseViolationRecordRectificationReq;
import org.dromara.safety.domain.dto.violationrecord.*;
import org.dromara.safety.domain.enums.HseSafetyInspectionStatusEnum;
import org.dromara.safety.domain.vo.violationrecord.HseViolationRecordVo;
import org.dromara.safety.mapper.HseViolationRecordMapper;
import org.dromara.safety.service.IHseRecognizeRecordService;
@ -382,9 +380,40 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
if (!correctorId.equals(userId)) {
throw new ServiceException("当前用户不是指定整改人", HttpStatus.BAD_REQUEST);
}
HseViolationRecord updateRecord = new HseViolationRecord();
BeanUtils.copyProperties(req, updateRecord);
// 填充默认值
violationRecord.setRectificationTime(new Date());
updateRecord.setId(id);
updateRecord.setRectificationTime(new Date());
updateRecord.setStatus(HseSafetyInspectionStatusEnum.RECTIFICATION.getValue());
// 操作数据库
return this.updateById(violationRecord);
return this.updateById(updateRecord);
}
/**
* 新增违章复查信息
*
* @param req 违章复查信息
* @return 是否新增成功
*/
@Override
public Boolean insertReview(HseViolationRecordReviewReq req) {
Long id = req.getId();
HseViolationRecord violationRecord = this.getById(id);
if (violationRecord == null) {
throw new ServiceException("违章信息不存在", HttpStatus.NOT_FOUND);
}
// 校验是否已整改
if (!violationRecord.getStatus().equals(HseSafetyInspectionStatusEnum.RECTIFICATION.getValue())) {
throw new ServiceException("该违章信息未整改,无法进行复查", HttpStatus.BAD_REQUEST);
}
HseViolationRecord updateRecord = new HseViolationRecord();
BeanUtils.copyProperties(req, updateRecord);
// 填充默认值
updateRecord.setId(id);
updateRecord.setReviewTime(new Date());
updateRecord.setStatus(HseSafetyInspectionStatusEnum.REVIEW.getValue());
// 操作数据库
return this.updateById(updateRecord);
}
}