Compare commits
2 Commits
8bf9f47d62
...
51bd7ed5d8
Author | SHA1 | Date | |
---|---|---|---|
51bd7ed5d8 | |||
e492c08eef |
2
drone/.gitignore
vendored
2
drone/.gitignore
vendored
@ -45,3 +45,5 @@ nbdist/
|
|||||||
!*/build/*.java
|
!*/build/*.java
|
||||||
!*/build/*.html
|
!*/build/*.html
|
||||||
!*/build/*.xml
|
!*/build/*.xml
|
||||||
|
|
||||||
|
*.lck
|
||||||
|
@ -283,3 +283,6 @@ sparta:
|
|||||||
url: http://119.3.204.120:8040
|
url: http://119.3.204.120:8040
|
||||||
client-id: test
|
client-id: test
|
||||||
client-secret: 115fcb08fa6742a1b086d9bb80a6ad59
|
client-secret: 115fcb08fa6742a1b086d9bb80a6ad59
|
||||||
|
# 身份证加密密钥
|
||||||
|
id-card:
|
||||||
|
encrypt-key: 7ae260d150a14027d2238a1cf80a48ef
|
||||||
|
@ -121,6 +121,7 @@ security:
|
|||||||
- /*/api-docs/**
|
- /*/api-docs/**
|
||||||
- /warm-flow-ui/token-name
|
- /warm-flow-ui/token-name
|
||||||
- /other/ys7Device/webhook
|
- /other/ys7Device/webhook
|
||||||
|
- /facility/matrix/**
|
||||||
|
|
||||||
# 多租户配置
|
# 多租户配置
|
||||||
tenant:
|
tenant:
|
||||||
|
@ -44,7 +44,8 @@ public class IncSyncYs7DeviceCapturePicData {
|
|||||||
private final ExecutorService executorService = Executors.newFixedThreadPool(5);
|
private final ExecutorService executorService = Executors.newFixedThreadPool(5);
|
||||||
|
|
||||||
// 每 30 分钟执行一次
|
// 每 30 分钟执行一次
|
||||||
@Scheduled(cron = "0 */30 7-19 * * ?")
|
// todo 修改为 30 分钟
|
||||||
|
@Scheduled(cron = "0 0 7-19 * * ?")
|
||||||
public void run() {
|
public void run() {
|
||||||
// 查询所有在线的摄像头设备,仅获取必要字段
|
// 查询所有在线的摄像头设备,仅获取必要字段
|
||||||
List<OthYs7Device> deviceList = ys7DeviceService.lambdaQuery()
|
List<OthYs7Device> deviceList = ys7DeviceService.lambdaQuery()
|
||||||
@ -75,6 +76,7 @@ public class IncSyncYs7DeviceCapturePicData {
|
|||||||
if (presets != null && !presets.isEmpty()) {
|
if (presets != null && !presets.isEmpty()) {
|
||||||
for (OthDevicePreset preset : presets) {
|
for (OthDevicePreset preset : presets) {
|
||||||
OthYs7DeviceImgCreateByCapture img = new OthYs7DeviceImgCreateByCapture();
|
OthYs7DeviceImgCreateByCapture img = new OthYs7DeviceImgCreateByCapture();
|
||||||
|
img.setProjectId(ys7Device.getProjectId());
|
||||||
img.setDeviceSerial(deviceSerial);
|
img.setDeviceSerial(deviceSerial);
|
||||||
img.setDeviceName(ys7Device.getDeviceName());
|
img.setDeviceName(ys7Device.getDeviceName());
|
||||||
int channelNo = preset.getChannelNo();
|
int channelNo = preset.getChannelNo();
|
||||||
@ -105,6 +107,7 @@ public class IncSyncYs7DeviceCapturePicData {
|
|||||||
} else {
|
} else {
|
||||||
// 如果没有预置位,则直接对默认通道抓图
|
// 如果没有预置位,则直接对默认通道抓图
|
||||||
OthYs7DeviceImgCreateByCapture img = new OthYs7DeviceImgCreateByCapture();
|
OthYs7DeviceImgCreateByCapture img = new OthYs7DeviceImgCreateByCapture();
|
||||||
|
img.setProjectId(ys7Device.getProjectId());
|
||||||
img.setDeviceSerial(deviceSerial);
|
img.setDeviceSerial(deviceSerial);
|
||||||
img.setDeviceName(ys7Device.getDeviceName());
|
img.setDeviceName(ys7Device.getDeviceName());
|
||||||
try {
|
try {
|
||||||
|
@ -25,7 +25,8 @@ public class IncSyncYs7DeviceData {
|
|||||||
private IOthYs7DeviceService ys7DeviceService;
|
private IOthYs7DeviceService ys7DeviceService;
|
||||||
|
|
||||||
// 每 5 分钟执行一次
|
// 每 5 分钟执行一次
|
||||||
@Scheduled(cron = "0 */5 * * * ?")
|
// todo 修改为 5 分钟
|
||||||
|
@Scheduled(cron = "0 */10 * * * ?")
|
||||||
public void run() {
|
public void run() {
|
||||||
log.info("定时同步摄像头设备数据");
|
log.info("定时同步摄像头设备数据");
|
||||||
List<Ys7QueryDeviceResponseVo> ys7QueryDeviceList = ys7Manager.queryAllDeviceList();
|
List<Ys7QueryDeviceResponseVo> ys7QueryDeviceList = ys7Manager.queryAllDeviceList();
|
||||||
|
@ -12,30 +12,37 @@ import java.util.stream.Collectors;
|
|||||||
@Getter
|
@Getter
|
||||||
public enum SpartaRecTypeEnum {
|
public enum SpartaRecTypeEnum {
|
||||||
|
|
||||||
HAT("安全帽识别", "hat"),
|
HAT("安全帽识别", "hat", ""),
|
||||||
HEAD("不戴安全帽识别", "head"),
|
HEAD("不戴安全帽识别", "head", "1"),
|
||||||
SMOKE("吸烟识别", "smoke"),
|
SMOKE("吸烟识别", "smoke", "3"),
|
||||||
BELT("安全带识别", "belt"),
|
BELT("安全带识别", "belt", "2"),
|
||||||
WASTE("工程垃圾识别(暂无)", "waste"),
|
WASTE("工程垃圾识别(暂无)", "waste", ""),
|
||||||
EXCAVATOR("挖掘机", "excavator"),
|
EXCAVATOR("挖掘机", "excavator", ""),
|
||||||
ROLLER("压路机", "Roller"),
|
ROLLER("压路机", "Roller", ""),
|
||||||
TRUCK_CRANE("汽车吊", "Truck_crane"),
|
TRUCK_CRANE("汽车吊", "Truck_crane", ""),
|
||||||
LOADER("装载机", "Loader"),
|
LOADER("装载机", "Loader", ""),
|
||||||
SUBMERSIBLE_DRILLING_RIG("潜挖钻机", "Submersible_drilling_rig"),
|
SUBMERSIBLE_DRILLING_RIG("潜挖钻机", "Submersible_drilling_rig", ""),
|
||||||
SPRINKLER("洒水车", "Sprinkler"),
|
SPRINKLER("洒水车", "Sprinkler", ""),
|
||||||
TRUCK_MOUNTED_CRANE("随车吊", "Truck_mounted_crane"),
|
TRUCK_MOUNTED_CRANE("随车吊", "Truck_mounted_crane", ""),
|
||||||
TRUCK("货车", "Truck"),
|
TRUCK("货车", "Truck", ""),
|
||||||
PHO("光伏板", "pho"),
|
PHO("光伏板", "pho", ""),
|
||||||
HOLE("洞", "hole"),
|
HOLE("洞", "hole", ""),
|
||||||
SHELVES("架子", "shelves"),
|
SHELVES("架子", "shelves", ""),
|
||||||
PILE("桩", "pile");
|
PILE("桩", "pile", "");
|
||||||
|
|
||||||
private final String text;
|
private final String text;
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
SpartaRecTypeEnum(String text, String value) {
|
/**
|
||||||
|
* 描述:对应字典violation_level_type
|
||||||
|
*/
|
||||||
|
private final String code;
|
||||||
|
|
||||||
|
SpartaRecTypeEnum(String text, String value, String code) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SpartaRecTypeEnum fromValue(String value) {
|
public static SpartaRecTypeEnum fromValue(String value) {
|
||||||
|
@ -16,6 +16,11 @@ public class OthYs7DeviceImgCreateByCapture implements Serializable {
|
|||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 9152300524686055187L;
|
private static final long serialVersionUID = 9152300524686055187L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备序列号
|
* 设备序列号
|
||||||
*/
|
*/
|
||||||
|
@ -27,6 +27,9 @@ import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgQueryReq;
|
|||||||
import org.dromara.other.domain.vo.ys7deviceimg.OthYs7DeviceImgVo;
|
import org.dromara.other.domain.vo.ys7deviceimg.OthYs7DeviceImgVo;
|
||||||
import org.dromara.other.mapper.OthYs7DeviceImgMapper;
|
import org.dromara.other.mapper.OthYs7DeviceImgMapper;
|
||||||
import org.dromara.other.service.IOthYs7DeviceImgService;
|
import org.dromara.other.service.IOthYs7DeviceImgService;
|
||||||
|
import org.dromara.safety.domain.dto.recognizerecord.HseRecognizeRecordCreateDto;
|
||||||
|
import org.dromara.safety.domain.enums.HseRecordCategoryEnum;
|
||||||
|
import org.dromara.safety.service.IHseRecognizeRecordService;
|
||||||
import org.dromara.system.domain.vo.SysOssUploadVo;
|
import org.dromara.system.domain.vo.SysOssUploadVo;
|
||||||
import org.dromara.system.service.ISysOssService;
|
import org.dromara.system.service.ISysOssService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
@ -56,6 +59,9 @@ public class OthYs7DeviceImgServiceImpl extends ServiceImpl<OthYs7DeviceImgMappe
|
|||||||
@Resource
|
@Resource
|
||||||
private SpartaManager spartaManager;
|
private SpartaManager spartaManager;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IHseRecognizeRecordService recognizeRecordService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询萤石摄像头图片
|
* 查询萤石摄像头图片
|
||||||
*
|
*
|
||||||
@ -189,6 +195,7 @@ public class OthYs7DeviceImgServiceImpl extends ServiceImpl<OthYs7DeviceImgMappe
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void saveCapturePic(List<OthYs7DeviceImgCreateByCapture> imgList) {
|
public void saveCapturePic(List<OthYs7DeviceImgCreateByCapture> imgList) {
|
||||||
List<OthYs7DeviceImg> saveList = new ArrayList<>();
|
List<OthYs7DeviceImg> saveList = new ArrayList<>();
|
||||||
|
List<HseRecognizeRecordCreateDto> recordList = new ArrayList<>();
|
||||||
for (OthYs7DeviceImgCreateByCapture img : imgList) {
|
for (OthYs7DeviceImgCreateByCapture img : imgList) {
|
||||||
OthYs7DeviceImg othYs7DeviceImg = new OthYs7DeviceImg();
|
OthYs7DeviceImg othYs7DeviceImg = new OthYs7DeviceImg();
|
||||||
String url = img.getUrl();
|
String url = img.getUrl();
|
||||||
@ -206,12 +213,16 @@ public class OthYs7DeviceImgServiceImpl extends ServiceImpl<OthYs7DeviceImgMappe
|
|||||||
List<SpartaRecTypeEnum> recTypes = List.of(SpartaRecTypeEnum.HEAD, SpartaRecTypeEnum.SMOKE);
|
List<SpartaRecTypeEnum> recTypes = List.of(SpartaRecTypeEnum.HEAD, SpartaRecTypeEnum.SMOKE);
|
||||||
SpartaRecognizeVo recognizeVo = spartaManager.recognize(ossUrl, recTypes);
|
SpartaRecognizeVo recognizeVo = spartaManager.recognize(ossUrl, recTypes);
|
||||||
if (recognizeVo != null && recognizeVo.getHasTarget().equals(SpartaHasTargetEnum.YES.getValue())) {
|
if (recognizeVo != null && recognizeVo.getHasTarget().equals(SpartaHasTargetEnum.YES.getValue())) {
|
||||||
|
// 记录识别信息
|
||||||
|
HseRecognizeRecordCreateDto record = new HseRecognizeRecordCreateDto();
|
||||||
|
record.setCreateTime(new Date());
|
||||||
List<SpartaTargetVo> targets = recognizeVo.getTargets();
|
List<SpartaTargetVo> targets = recognizeVo.getTargets();
|
||||||
othYs7DeviceImg.setTargets(JSONUtil.toJsonStr(targets));
|
othYs7DeviceImg.setTargets(JSONUtil.toJsonStr(targets));
|
||||||
othYs7DeviceImg.setImgSize(JSONUtil.toJsonStr(recognizeVo.getOriginalImgSize()));
|
othYs7DeviceImg.setImgSize(JSONUtil.toJsonStr(recognizeVo.getOriginalImgSize()));
|
||||||
othYs7DeviceImg.setIsRecognize(SpartaHasTargetEnum.YES.getValue());
|
othYs7DeviceImg.setIsRecognize(SpartaHasTargetEnum.YES.getValue());
|
||||||
List<String> recTypeList = targets.stream().map(SpartaTargetVo::getType).distinct().toList();
|
List<String> recTypeList = targets.stream().map(SpartaTargetVo::getType).distinct().toList();
|
||||||
othYs7DeviceImg.setRecType(JSONUtil.toJsonStr(recTypeList));
|
othYs7DeviceImg.setRecType(JSONUtil.toJsonStr(recTypeList));
|
||||||
|
String targetUrl = null;
|
||||||
try {
|
try {
|
||||||
ImageStreamResult imageStreamResult = spartaManager.drawImageToStream(url, targets);
|
ImageStreamResult imageStreamResult = spartaManager.drawImageToStream(url, targets);
|
||||||
InputStream inputStream = imageStreamResult.getInputStream();
|
InputStream inputStream = imageStreamResult.getInputStream();
|
||||||
@ -219,13 +230,20 @@ public class OthYs7DeviceImgServiceImpl extends ServiceImpl<OthYs7DeviceImgMappe
|
|||||||
long length = imageStreamResult.getLength();
|
long length = imageStreamResult.getLength();
|
||||||
String targetImgPath = Ys7DeviceImgConstant.getTargetImgOssPath(originalFilename, deviceSerial);
|
String targetImgPath = Ys7DeviceImgConstant.getTargetImgOssPath(originalFilename, deviceSerial);
|
||||||
SysOssUploadVo drawImageUploadVo = ossService.uploadFileUrlWithNoSave(inputStream, targetImgPath, contentType, length);
|
SysOssUploadVo drawImageUploadVo = ossService.uploadFileUrlWithNoSave(inputStream, targetImgPath, contentType, length);
|
||||||
String targetUrl = drawImageUploadVo.getUrl();
|
targetUrl = drawImageUploadVo.getUrl();
|
||||||
if (StringUtils.isNotBlank(targetUrl)) {
|
if (StringUtils.isNotBlank(targetUrl)) {
|
||||||
othYs7DeviceImg.setRecognizeUrl(targetUrl);
|
othYs7DeviceImg.setRecognizeUrl(targetUrl);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("图片识别失败", e);
|
log.error("图片识别失败", e);
|
||||||
}
|
}
|
||||||
|
record.setTargets(targets);
|
||||||
|
record.setDeviceSerial(deviceSerial);
|
||||||
|
record.setDeviceName(img.getDeviceName());
|
||||||
|
record.setPicture(targetUrl);
|
||||||
|
record.setRecordCategory(HseRecordCategoryEnum.MONITOR.getValue());
|
||||||
|
record.setProjectId(img.getProjectId());
|
||||||
|
recordList.add(record);
|
||||||
}
|
}
|
||||||
saveList.add(othYs7DeviceImg);
|
saveList.add(othYs7DeviceImg);
|
||||||
}
|
}
|
||||||
@ -236,6 +254,9 @@ public class OthYs7DeviceImgServiceImpl extends ServiceImpl<OthYs7DeviceImgMappe
|
|||||||
throw new ServiceException("批量新增图片失败,数据库异常", HttpStatus.ERROR);
|
throw new ServiceException("批量新增图片失败,数据库异常", HttpStatus.ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (CollUtil.isNotEmpty(recordList)) {
|
||||||
|
recognizeRecordService.saveByMonitor(recordList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,8 +22,8 @@ public interface BusProjectConstant {
|
|||||||
String PROJECT_CACHE_REDIS_KEY_PREFIX = "project";
|
String PROJECT_CACHE_REDIS_KEY_PREFIX = "project";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父级项目id
|
* 父级id
|
||||||
*/
|
*/
|
||||||
Long PARENT_PROJECT_ID = 0L;
|
Long PARENT_ID = 0L;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,95 @@
|
|||||||
|
package org.dromara.project.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
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.project.domain.dto.subcontract.BusSubcontractCreateReq;
|
||||||
|
import org.dromara.project.domain.dto.subcontract.BusSubcontractQueryReq;
|
||||||
|
import org.dromara.project.domain.dto.subcontract.BusSubcontractUpdateReq;
|
||||||
|
import org.dromara.project.domain.vo.subcontract.BusSubcontractVo;
|
||||||
|
import org.dromara.project.service.IBusSubcontractService;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包合同
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/project/subcontract")
|
||||||
|
public class BusSubcontractController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBusSubcontractService subcontractService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询分包合同列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("project:subcontract:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<BusSubcontractVo> list(BusSubcontractQueryReq req, PageQuery pageQuery) {
|
||||||
|
return subcontractService.queryPageList(req, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取分包合同详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("project:subcontract:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<BusSubcontractVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(subcontractService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增分包合同
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("project:subcontract:add")
|
||||||
|
@Log(title = "分包合同", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Long> add(@Validated(AddGroup.class) @RequestBody BusSubcontractCreateReq req) {
|
||||||
|
return R.ok(subcontractService.insertByBo(req));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改分包合同
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("project:subcontract:edit")
|
||||||
|
@Log(title = "分包合同", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody BusSubcontractUpdateReq req) {
|
||||||
|
return toAjax(subcontractService.updateByBo(req));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除分包合同
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("project:subcontract:remove")
|
||||||
|
@Log(title = "分包合同", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(subcontractService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
@ -60,6 +60,11 @@ public class BusContractor extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String custodianPhone;
|
private String custodianPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包类型
|
||||||
|
*/
|
||||||
|
private String contractorType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公司相关文件
|
* 公司相关文件
|
||||||
*/
|
*/
|
||||||
|
@ -45,6 +45,11 @@ public class BusProject extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Long pId;
|
private Long pId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(0正常 1停用)
|
* 状态(0正常 1停用)
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,86 @@
|
|||||||
|
package org.dromara.project.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包合同对象 bus_subcontract
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("bus_subcontract")
|
||||||
|
public class BusSubcontract implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包方id
|
||||||
|
*/
|
||||||
|
private Long contractorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同文件id
|
||||||
|
*/
|
||||||
|
private Long contractFileId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同编号
|
||||||
|
*/
|
||||||
|
private String contractNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同名称
|
||||||
|
*/
|
||||||
|
private String contractName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同类型
|
||||||
|
*/
|
||||||
|
private String contractType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同金额
|
||||||
|
*/
|
||||||
|
private BigDecimal contractAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同时间
|
||||||
|
*/
|
||||||
|
private Date contractTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
}
|
@ -51,6 +51,11 @@ public class BusContractorCreateReq implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Map<String, Long> fileMap;
|
private Map<String, Long> fileMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包类型
|
||||||
|
*/
|
||||||
|
private String contractorType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@ -50,6 +50,11 @@ public class BusContractorQueryReq implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String custodianPhone;
|
private String custodianPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包类型
|
||||||
|
*/
|
||||||
|
private String contractorType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@ -51,6 +51,11 @@ public class BusContractorUpdateReq implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String custodianPhone;
|
private String custodianPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包类型
|
||||||
|
*/
|
||||||
|
private String contractorType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公司相关文件
|
* 公司相关文件
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,65 @@
|
|||||||
|
package org.dromara.project.domain.dto.subcontract;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025/6/25 16:36
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BusSubcontractCreateReq implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = -3386090526440868496L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包方id
|
||||||
|
*/
|
||||||
|
private Long contractorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同文件id
|
||||||
|
*/
|
||||||
|
private Long contractFileId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同编号
|
||||||
|
*/
|
||||||
|
private String contractNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同名称
|
||||||
|
*/
|
||||||
|
private String contractName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同类型
|
||||||
|
*/
|
||||||
|
private String contractType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同金额
|
||||||
|
*/
|
||||||
|
private BigDecimal contractAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同时间
|
||||||
|
*/
|
||||||
|
private Date contractTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package org.dromara.project.domain.dto.subcontract;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025/6/25 16:37
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BusSubcontractQueryReq implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 3731492397283570840L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包方id
|
||||||
|
*/
|
||||||
|
private Long contractorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同编号
|
||||||
|
*/
|
||||||
|
private String contractNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同名称
|
||||||
|
*/
|
||||||
|
private String contractName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同类型
|
||||||
|
*/
|
||||||
|
private String contractType;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
package org.dromara.project.domain.dto.subcontract;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025/6/25 16:37
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BusSubcontractUpdateReq implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = -5617446079713109912L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包方id
|
||||||
|
*/
|
||||||
|
private Long contractorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同文件id
|
||||||
|
*/
|
||||||
|
private Long contractFileId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同编号
|
||||||
|
*/
|
||||||
|
private String contractNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同名称
|
||||||
|
*/
|
||||||
|
private String contractName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同类型
|
||||||
|
*/
|
||||||
|
private String contractType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同金额
|
||||||
|
*/
|
||||||
|
private BigDecimal contractAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同时间
|
||||||
|
*/
|
||||||
|
private Date contractTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
@ -68,6 +68,11 @@ public class BusContractorVo implements Serializable {
|
|||||||
@ExcelProperty(value = "管理人联系电话")
|
@ExcelProperty(value = "管理人联系电话")
|
||||||
private String custodianPhone;
|
private String custodianPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包类型
|
||||||
|
*/
|
||||||
|
private String contractorType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公司相关文件
|
* 公司相关文件
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,81 @@
|
|||||||
|
package org.dromara.project.domain.vo.subcontract;
|
||||||
|
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.dromara.project.domain.BusSubcontract;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包合同视图对象 bus_subcontract
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AutoMapper(target = BusSubcontract.class)
|
||||||
|
public class BusSubcontractVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包方id
|
||||||
|
*/
|
||||||
|
private Long contractorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包方名称
|
||||||
|
*/
|
||||||
|
private String contractorName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同文件id
|
||||||
|
*/
|
||||||
|
private Long contractFileId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同编号
|
||||||
|
*/
|
||||||
|
private String contractNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同名称
|
||||||
|
*/
|
||||||
|
private String contractName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同类型
|
||||||
|
*/
|
||||||
|
private String contractType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同金额
|
||||||
|
*/
|
||||||
|
private BigDecimal contractAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同时间
|
||||||
|
*/
|
||||||
|
private Date contractTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.project.mapper;
|
||||||
|
|
||||||
|
import org.dromara.project.domain.BusSubcontract;
|
||||||
|
import org.dromara.project.domain.vo.subcontract.BusSubcontractVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包合同Mapper接口
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
public interface BusSubcontractMapper extends BaseMapperPlus<BusSubcontract, BusSubcontractVo> {
|
||||||
|
|
||||||
|
}
|
@ -14,6 +14,7 @@ import org.dromara.project.domain.vo.project.*;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目Service接口
|
* 项目Service接口
|
||||||
@ -87,6 +88,14 @@ public interface IBusProjectService extends IService<BusProject> {
|
|||||||
*/
|
*/
|
||||||
Long insertSubByProject(BusProjectCreateSubReq dto);
|
Long insertSubByProject(BusProjectCreateSubReq dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建项目需同步的事务
|
||||||
|
*
|
||||||
|
* @param id 项目id
|
||||||
|
* @return 是否同步成功
|
||||||
|
*/
|
||||||
|
CompletableFuture<Boolean> insertProjectSyncThing(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改项目
|
* 修改项目
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,99 @@
|
|||||||
|
package org.dromara.project.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
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.project.domain.BusSubcontract;
|
||||||
|
import org.dromara.project.domain.dto.subcontract.BusSubcontractCreateReq;
|
||||||
|
import org.dromara.project.domain.dto.subcontract.BusSubcontractQueryReq;
|
||||||
|
import org.dromara.project.domain.dto.subcontract.BusSubcontractUpdateReq;
|
||||||
|
import org.dromara.project.domain.vo.subcontract.BusSubcontractVo;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包合同Service接口
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
public interface IBusSubcontractService extends IService<BusSubcontract> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询分包合同
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 分包合同
|
||||||
|
*/
|
||||||
|
BusSubcontractVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询分包合同列表
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 分包合同分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<BusSubcontractVo> queryPageList(BusSubcontractQueryReq req, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的分包合同列表
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @return 分包合同列表
|
||||||
|
*/
|
||||||
|
List<BusSubcontractVo> queryList(BusSubcontractQueryReq req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增分包合同
|
||||||
|
*
|
||||||
|
* @param req 分包合同
|
||||||
|
* @return 新增主键id
|
||||||
|
*/
|
||||||
|
Long insertByBo(BusSubcontractCreateReq req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改分包合同
|
||||||
|
*
|
||||||
|
* @param req 分包合同
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(BusSubcontractUpdateReq req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除分包合同信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取分包合同视图
|
||||||
|
*
|
||||||
|
* @param subcontract 分包合同
|
||||||
|
* @return 分包合同视图
|
||||||
|
*/
|
||||||
|
BusSubcontractVo getVo(BusSubcontract subcontract);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户和项目关联对象查询条件封装
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @return 查询条件封装
|
||||||
|
*/
|
||||||
|
LambdaQueryWrapper<BusSubcontract> buildQueryWrapper(BusSubcontractQueryReq req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取分包合同分页视图
|
||||||
|
*
|
||||||
|
* @param subcontractPage 分包合同分页
|
||||||
|
* @return 分包合同分页视图
|
||||||
|
*/
|
||||||
|
Page<BusSubcontractVo> getVoPage(Page<BusSubcontract> subcontractPage);
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
package org.dromara.project.service.impl;
|
package org.dromara.project.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.IdcardUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@ -23,6 +25,7 @@ import org.dromara.project.service.IBusConstructionBlacklistService;
|
|||||||
import org.dromara.project.service.IBusConstructionUserService;
|
import org.dromara.project.service.IBusConstructionUserService;
|
||||||
import org.dromara.project.service.IBusProjectService;
|
import org.dromara.project.service.IBusProjectService;
|
||||||
import org.dromara.project.service.IBusProjectTeamMemberService;
|
import org.dromara.project.service.IBusProjectTeamMemberService;
|
||||||
|
import org.dromara.utils.IdCardEncryptorUtil;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -51,6 +54,9 @@ public class BusConstructionBlacklistServiceImpl extends ServiceImpl<BusConstruc
|
|||||||
@Resource
|
@Resource
|
||||||
private IBusProjectTeamMemberService projectTeamMemberService;
|
private IBusProjectTeamMemberService projectTeamMemberService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IdCardEncryptorUtil idCardEncryptorUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询黑名单
|
* 查询黑名单
|
||||||
*
|
*
|
||||||
@ -59,7 +65,17 @@ public class BusConstructionBlacklistServiceImpl extends ServiceImpl<BusConstruc
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public BusConstructionBlacklistVo queryById(Long id) {
|
public BusConstructionBlacklistVo queryById(Long id) {
|
||||||
return baseMapper.selectVoById(id);
|
BusConstructionBlacklist constructionBlacklist = this.getById(id);
|
||||||
|
if (constructionBlacklist == null) {
|
||||||
|
throw new ServiceException("查询黑名单用户不存在", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
BusConstructionBlacklistVo vo = new BusConstructionBlacklistVo();
|
||||||
|
BeanUtils.copyProperties(constructionBlacklist, vo);
|
||||||
|
// 解密身份证号码
|
||||||
|
String decrypt = idCardEncryptorUtil.decrypt(constructionBlacklist.getSfzNumber());
|
||||||
|
String hide = IdcardUtil.hide(decrypt, 11, 17);
|
||||||
|
vo.setSfzNumber(hide);
|
||||||
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,8 +88,22 @@ public class BusConstructionBlacklistServiceImpl extends ServiceImpl<BusConstruc
|
|||||||
@Override
|
@Override
|
||||||
public TableDataInfo<BusConstructionBlacklistVo> queryPageList(BusConstructionBlacklistQueryReq req, PageQuery pageQuery) {
|
public TableDataInfo<BusConstructionBlacklistVo> queryPageList(BusConstructionBlacklistQueryReq req, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<BusConstructionBlacklist> lqw = buildQueryWrapper(req);
|
LambdaQueryWrapper<BusConstructionBlacklist> lqw = buildQueryWrapper(req);
|
||||||
Page<BusConstructionBlacklistVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<BusConstructionBlacklist> result = this.page(pageQuery.build(), lqw);
|
||||||
return TableDataInfo.build(result);
|
List<BusConstructionBlacklist> records = result.getRecords();
|
||||||
|
Page<BusConstructionBlacklistVo> resultPage = new Page<>(result.getCurrent(), result.getSize(), result.getTotal());
|
||||||
|
if (CollUtil.isEmpty(records)) {
|
||||||
|
return TableDataInfo.build(resultPage);
|
||||||
|
}
|
||||||
|
List<BusConstructionBlacklistVo> list = records.stream().map(entity -> {
|
||||||
|
BusConstructionBlacklistVo vo = new BusConstructionBlacklistVo();
|
||||||
|
BeanUtils.copyProperties(entity, vo);
|
||||||
|
String decrypt = idCardEncryptorUtil.decrypt(entity.getSfzNumber());
|
||||||
|
String hide = IdcardUtil.hide(decrypt, 11, 17);
|
||||||
|
vo.setSfzNumber(hide);
|
||||||
|
return vo;
|
||||||
|
}).toList();
|
||||||
|
resultPage.setRecords(list);
|
||||||
|
return TableDataInfo.build(resultPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,23 +20,20 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.project.constant.BusConstructionUserConstant;
|
import org.dromara.project.constant.BusConstructionUserConstant;
|
||||||
import org.dromara.project.domain.*;
|
import org.dromara.project.domain.*;
|
||||||
|
import org.dromara.project.domain.dto.constructionuser.*;
|
||||||
import org.dromara.project.domain.enums.BusAttendanceClockStatusEnum;
|
import org.dromara.project.domain.enums.BusAttendanceClockStatusEnum;
|
||||||
import org.dromara.project.domain.enums.BusAttendanceCommuterEnum;
|
import org.dromara.project.domain.enums.BusAttendanceCommuterEnum;
|
||||||
import org.dromara.project.domain.enums.BusConstructionUserAttendanceStatusEnum;
|
import org.dromara.project.domain.enums.BusConstructionUserAttendanceStatusEnum;
|
||||||
import org.dromara.project.domain.enums.BusConstructionUserFileStatusEnum;
|
import org.dromara.project.domain.enums.BusConstructionUserFileStatusEnum;
|
||||||
import org.dromara.project.domain.exportvo.BusConstructionUserExportVo;
|
import org.dromara.project.domain.exportvo.BusConstructionUserExportVo;
|
||||||
import org.dromara.project.domain.dto.constructionuser.*;
|
import org.dromara.project.domain.vo.constructionuser.*;
|
||||||
import org.dromara.project.domain.vo.constructionuser.BusConstructionUserAttendanceByDay;
|
|
||||||
import org.dromara.project.domain.vo.constructionuser.BusConstructionUserAttendanceMonthVo;
|
|
||||||
import org.dromara.project.domain.vo.constructionuser.BusConstructionUserAttendanceTotalVo;
|
|
||||||
import org.dromara.project.domain.vo.constructionuser.BusConstructionUserGisVo;
|
|
||||||
import org.dromara.project.domain.vo.constructionuser.BusConstructionUserVo;
|
|
||||||
import org.dromara.project.domain.vo.contractor.BusContractorVo;
|
import org.dromara.project.domain.vo.contractor.BusContractorVo;
|
||||||
import org.dromara.project.mapper.BusConstructionUserMapper;
|
import org.dromara.project.mapper.BusConstructionUserMapper;
|
||||||
import org.dromara.project.service.*;
|
import org.dromara.project.service.*;
|
||||||
import org.dromara.system.domain.vo.SysOssVo;
|
import org.dromara.system.domain.vo.SysOssVo;
|
||||||
import org.dromara.system.service.ISysDictTypeService;
|
import org.dromara.system.service.ISysDictTypeService;
|
||||||
import org.dromara.system.service.ISysOssService;
|
import org.dromara.system.service.ISysOssService;
|
||||||
|
import org.dromara.utils.IdCardEncryptorUtil;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -89,6 +86,9 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
|||||||
@Resource
|
@Resource
|
||||||
private IBusAttendanceService attendanceService;
|
private IBusAttendanceService attendanceService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IdCardEncryptorUtil idCardEncryptorUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询施工人员
|
* 查询施工人员
|
||||||
*
|
*
|
||||||
@ -180,10 +180,10 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
|||||||
// 填充打卡图片url
|
// 填充打卡图片url
|
||||||
if (day != null) {
|
if (day != null) {
|
||||||
if (day.getUpClockPicId() != null) {
|
if (day.getUpClockPicId() != null) {
|
||||||
day.setUpClockPic(ossIdUrlMap.get(day.getUpClockPicId()).get(0).getUrl());
|
day.setUpClockPic(ossIdUrlMap.get(day.getUpClockPicId()).getFirst().getUrl());
|
||||||
}
|
}
|
||||||
if (day.getDownClockPicId() != null) {
|
if (day.getDownClockPicId() != null) {
|
||||||
day.setDownClockPic(ossIdUrlMap.get(day.getDownClockPicId()).get(0).getUrl());
|
day.setDownClockPic(ossIdUrlMap.get(day.getDownClockPicId()).getFirst().getUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String clockInStatus = null;
|
String clockInStatus = null;
|
||||||
@ -247,7 +247,7 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
|||||||
Long projectId = constructionUserVo.getProjectId();
|
Long projectId = constructionUserVo.getProjectId();
|
||||||
String projectName = null;
|
String projectName = null;
|
||||||
if (projectIdProjectMap.containsKey(projectId)) {
|
if (projectIdProjectMap.containsKey(projectId)) {
|
||||||
projectName = projectService.getVo(projectIdProjectMap.get(projectId).get(0)).getProjectName();
|
projectName = projectService.getVo(projectIdProjectMap.get(projectId).getFirst()).getProjectName();
|
||||||
}
|
}
|
||||||
constructionUserExportVo.setProjectName(projectName);
|
constructionUserExportVo.setProjectName(projectName);
|
||||||
return constructionUserExportVo;
|
return constructionUserExportVo;
|
||||||
@ -299,6 +299,9 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
|||||||
validEntityBeforeSave(constructionUser, true);
|
validEntityBeforeSave(constructionUser, true);
|
||||||
Long userId = LoginHelper.getUserId();
|
Long userId = LoginHelper.getUserId();
|
||||||
projectService.validAuth(req.getProjectId(), userId);
|
projectService.validAuth(req.getProjectId(), userId);
|
||||||
|
// 对身份证号码进行加密
|
||||||
|
String encrypt = idCardEncryptorUtil.encrypt(req.getSfzNumber());
|
||||||
|
constructionUser.setSfzNumber(encrypt);
|
||||||
// 操作数据库
|
// 操作数据库
|
||||||
boolean save = this.save(constructionUser);
|
boolean save = this.save(constructionUser);
|
||||||
if (!save) {
|
if (!save) {
|
||||||
@ -328,6 +331,11 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
|||||||
// 判断当前操作用户是否有权限
|
// 判断当前操作用户是否有权限
|
||||||
Long userId = LoginHelper.getUserId();
|
Long userId = LoginHelper.getUserId();
|
||||||
projectService.validAuth(oldConstructionUser.getProjectId(), userId);
|
projectService.validAuth(oldConstructionUser.getProjectId(), userId);
|
||||||
|
// 对身份证号码进行加密
|
||||||
|
if (req.getSfzNumber() != null) {
|
||||||
|
String encrypt = idCardEncryptorUtil.encrypt(req.getSfzNumber());
|
||||||
|
constructionUser.setSfzNumber(encrypt);
|
||||||
|
}
|
||||||
// 操作数据库
|
// 操作数据库
|
||||||
return this.updateById(constructionUser);
|
return this.updateById(constructionUser);
|
||||||
}
|
}
|
||||||
@ -531,6 +539,9 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
|||||||
if (StringUtils.isEmpty(wageMeasureUnit)) {
|
if (StringUtils.isEmpty(wageMeasureUnit)) {
|
||||||
throw new ServiceException("工资计量单位不能为空", HttpStatus.BAD_REQUEST);
|
throw new ServiceException("工资计量单位不能为空", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isEmpty(sfzNumber)) {
|
||||||
|
throw new ServiceException("身份证不能为空", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (projectService.getById(projectId) == null) {
|
if (projectService.getById(projectId) == null) {
|
||||||
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
||||||
@ -641,6 +652,10 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
|||||||
constructionUserVo.setStandardSalary(workWage.getWage());
|
constructionUserVo.setStandardSalary(workWage.getWage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 解密身份证号码
|
||||||
|
String decrypt = idCardEncryptorUtil.decrypt(constructionUserVo.getSfzNumber());
|
||||||
|
String hide = IdcardUtil.hide(decrypt, 11, 17);
|
||||||
|
constructionUserVo.setSfzNumber(hide);
|
||||||
return constructionUserVo;
|
return constructionUserVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -751,6 +766,17 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
|||||||
(wage1, wage2) -> wage1
|
(wage1, wage2) -> wage1
|
||||||
));
|
));
|
||||||
int fileTypeSize = dictTypeService.selectDictDataByType(BusConstructionUserConstant.USER_FILE_TYPE).size();
|
int fileTypeSize = dictTypeService.selectDictDataByType(BusConstructionUserConstant.USER_FILE_TYPE).size();
|
||||||
|
// 获取用户上传文件数量信息
|
||||||
|
List<Long> userIdList = constructionUserList.stream().map(BusConstructionUser::getId).toList();
|
||||||
|
List<BusConstructionUserFile> fileList = constructionUserFileService.lambdaQuery()
|
||||||
|
.select(BusConstructionUserFile::getId, BusConstructionUserFile::getUserId)
|
||||||
|
.in(BusConstructionUserFile::getUserId, userIdList)
|
||||||
|
.list();
|
||||||
|
Map<Long, Long> fileCountMap = fileList.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
BusConstructionUserFile::getUserId,
|
||||||
|
Collectors.counting()
|
||||||
|
));
|
||||||
// 填充信息
|
// 填充信息
|
||||||
List<BusConstructionUserVo> constructionUserVoList = constructionUserList.stream().map(constructionUser -> {
|
List<BusConstructionUserVo> constructionUserVoList = constructionUserList.stream().map(constructionUser -> {
|
||||||
BusConstructionUserVo constructionUserVo = new BusConstructionUserVo();
|
BusConstructionUserVo constructionUserVo = new BusConstructionUserVo();
|
||||||
@ -759,7 +785,7 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
|||||||
Long contractorId = constructionUser.getContractorId();
|
Long contractorId = constructionUser.getContractorId();
|
||||||
BusContractorVo contractor = null;
|
BusContractorVo contractor = null;
|
||||||
if (contractorIdContractorMap.containsKey(contractorId)) {
|
if (contractorIdContractorMap.containsKey(contractorId)) {
|
||||||
contractor = contractorService.getVo(contractorIdContractorMap.get(contractorId).get(0));
|
contractor = contractorService.getVo(contractorIdContractorMap.get(contractorId).getFirst());
|
||||||
}
|
}
|
||||||
constructionUserVo.setContractorVo(contractor);
|
constructionUserVo.setContractorVo(contractor);
|
||||||
// 关联工资标准
|
// 关联工资标准
|
||||||
@ -770,9 +796,7 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
|||||||
constructionUserVo.setStandardSalary(workWageMap.get(key));
|
constructionUserVo.setStandardSalary(workWageMap.get(key));
|
||||||
}
|
}
|
||||||
// 关联施工人员文件上传状态
|
// 关联施工人员文件上传状态
|
||||||
LambdaQueryWrapper<BusConstructionUserFile> constructionUserFileLqw = Wrappers.lambdaQuery(BusConstructionUserFile.class)
|
long count = fileCountMap.getOrDefault(constructionUser.getId(), 0L);
|
||||||
.eq(BusConstructionUserFile::getUserId, constructionUser.getId());
|
|
||||||
long count = constructionUserFileService.count(constructionUserFileLqw);
|
|
||||||
if (count <= 0) {
|
if (count <= 0) {
|
||||||
constructionUserVo.setFileUploadStatus(BusConstructionUserFileStatusEnum.NOUPLOAD.getValue());
|
constructionUserVo.setFileUploadStatus(BusConstructionUserFileStatusEnum.NOUPLOAD.getValue());
|
||||||
} else if (count < fileTypeSize) {
|
} else if (count < fileTypeSize) {
|
||||||
@ -780,6 +804,10 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
|||||||
} else if (count == fileTypeSize) {
|
} else if (count == fileTypeSize) {
|
||||||
constructionUserVo.setFileUploadStatus(BusConstructionUserFileStatusEnum.UPLOAD.getValue());
|
constructionUserVo.setFileUploadStatus(BusConstructionUserFileStatusEnum.UPLOAD.getValue());
|
||||||
}
|
}
|
||||||
|
// 解密身份证号码
|
||||||
|
String decrypt = idCardEncryptorUtil.decrypt(constructionUserVo.getSfzNumber());
|
||||||
|
String hide = IdcardUtil.hide(decrypt, 11, 17);
|
||||||
|
constructionUserVo.setSfzNumber(hide);
|
||||||
return constructionUserVo;
|
return constructionUserVo;
|
||||||
}).toList();
|
}).toList();
|
||||||
constructionUserVoPage.setRecords(constructionUserVoList);
|
constructionUserVoPage.setRecords(constructionUserVoList);
|
||||||
|
@ -260,6 +260,7 @@ public class BusContractorServiceImpl extends ServiceImpl<BusContractorMapper, B
|
|||||||
String principalPhone = req.getPrincipalPhone();
|
String principalPhone = req.getPrincipalPhone();
|
||||||
String custodian = req.getCustodian();
|
String custodian = req.getCustodian();
|
||||||
String custodianPhone = req.getCustodianPhone();
|
String custodianPhone = req.getCustodianPhone();
|
||||||
|
String contractorType = req.getContractorType();
|
||||||
String remark = req.getRemark();
|
String remark = req.getRemark();
|
||||||
// 模糊查询
|
// 模糊查询
|
||||||
lqw.like(StringUtils.isNotBlank(name), BusContractor::getName, name);
|
lqw.like(StringUtils.isNotBlank(name), BusContractor::getName, name);
|
||||||
@ -271,6 +272,7 @@ public class BusContractorServiceImpl extends ServiceImpl<BusContractorMapper, B
|
|||||||
// 精确查询
|
// 精确查询
|
||||||
lqw.eq(ObjectUtils.isNotEmpty(id), BusContractor::getId, id);
|
lqw.eq(ObjectUtils.isNotEmpty(id), BusContractor::getId, id);
|
||||||
lqw.eq(ObjectUtils.isNotEmpty(projectId), BusContractor::getProjectId, projectId);
|
lqw.eq(ObjectUtils.isNotEmpty(projectId), BusContractor::getProjectId, projectId);
|
||||||
|
lqw.eq(StringUtils.isNotBlank(contractorType), BusContractor::getContractorType, contractorType);
|
||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.github.benmanes.caffeine.cache.Cache;
|
import com.github.benmanes.caffeine.cache.Cache;
|
||||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.common.core.constant.HttpStatus;
|
import org.dromara.common.core.constant.HttpStatus;
|
||||||
import org.dromara.common.core.constant.SystemConstants;
|
import org.dromara.common.core.constant.SystemConstants;
|
||||||
import org.dromara.common.core.domain.vo.IdAndNameVO;
|
import org.dromara.common.core.domain.vo.IdAndNameVO;
|
||||||
@ -46,14 +47,21 @@ import org.dromara.project.service.IBusContractorService;
|
|||||||
import org.dromara.project.service.IBusProjectFileService;
|
import org.dromara.project.service.IBusProjectFileService;
|
||||||
import org.dromara.project.service.IBusProjectService;
|
import org.dromara.project.service.IBusProjectService;
|
||||||
import org.dromara.project.service.IBusUserProjectRelevancyService;
|
import org.dromara.project.service.IBusUserProjectRelevancyService;
|
||||||
|
import org.dromara.quality.service.IQltKnowledgeDocumentService;
|
||||||
|
import org.dromara.safety.service.IHseKnowledgeDocumentService;
|
||||||
|
import org.dromara.system.domain.bo.SysDeptBo;
|
||||||
|
import org.dromara.system.domain.vo.SysDeptVo;
|
||||||
|
import org.dromara.system.service.ISysDeptService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.data.redis.core.ValueOperations;
|
import org.springframework.data.redis.core.ValueOperations;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -63,6 +71,7 @@ import java.util.stream.Collectors;
|
|||||||
* @author lcj
|
* @author lcj
|
||||||
* @date 2025-03-04
|
* @date 2025-03-04
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProject>
|
public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProject>
|
||||||
implements IBusProjectService {
|
implements IBusProjectService {
|
||||||
@ -89,6 +98,21 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj
|
|||||||
@Resource
|
@Resource
|
||||||
private IFacMatrixService matrixService;
|
private IFacMatrixService matrixService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private IHseKnowledgeDocumentService hseKnowledgeDocumentService;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private IQltKnowledgeDocumentService qltKnowledgeDocumentService;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private IBusProjectService self;
|
||||||
|
|
||||||
private final Cache<String, String> WEATHER_CACHE =
|
private final Cache<String, String> WEATHER_CACHE =
|
||||||
Caffeine.newBuilder().initialCapacity(1024)
|
Caffeine.newBuilder().initialCapacity(1024)
|
||||||
.maximumSize(10000L)
|
.maximumSize(10000L)
|
||||||
@ -282,10 +306,32 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj
|
|||||||
project.setPunchRange(punchRange);
|
project.setPunchRange(punchRange);
|
||||||
// 数据校验
|
// 数据校验
|
||||||
validEntityBeforeSave(project, true);
|
validEntityBeforeSave(project, true);
|
||||||
Long count = this.lambdaQuery().eq(BusProject::getProjectName, req.getProjectName()).count();
|
if (this.lambdaQuery().eq(BusProject::getProjectName, req.getProjectName()).count() > 0) {
|
||||||
if (count > 0) {
|
|
||||||
throw new ServiceException("项目名称已存在", HttpStatus.BAD_REQUEST);
|
throw new ServiceException("项目名称已存在", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
if (this.lambdaQuery().eq(BusProject::getShortName, req.getShortName()).count() > 0) {
|
||||||
|
throw new ServiceException("项目简称已存在", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
// 添加新部门
|
||||||
|
SysDeptBo queryBo = new SysDeptBo();
|
||||||
|
queryBo.setParentId(BusProjectConstant.PARENT_ID);
|
||||||
|
// 查询父节点部门
|
||||||
|
SysDeptVo deptVo = deptService.selectDeptList(queryBo).getFirst();
|
||||||
|
Long deptId = deptVo.getDeptId();
|
||||||
|
SysDeptBo createBo = new SysDeptBo();
|
||||||
|
createBo.setParentId(deptId);
|
||||||
|
String shortName = req.getShortName();
|
||||||
|
createBo.setDeptName(shortName != null ? shortName : req.getProjectName());
|
||||||
|
if (!deptService.checkDeptNameUnique(createBo)) {
|
||||||
|
throw new ServiceException("新增项目部门'" + createBo.getDeptName() + "'失败,项目名称已存在");
|
||||||
|
}
|
||||||
|
// 新增部门
|
||||||
|
int dept = deptService.insertDept(createBo);
|
||||||
|
if (dept <= 0) {
|
||||||
|
throw new ServiceException("新增项目部门'" + createBo.getDeptName() + "'失败");
|
||||||
|
}
|
||||||
|
Long newDeptId = deptService.selectIdByDeptName(createBo.getDeptName());
|
||||||
|
project.setDeptId(newDeptId);
|
||||||
// 写入数据库
|
// 写入数据库
|
||||||
boolean save = this.save(project);
|
boolean save = this.save(project);
|
||||||
if (!save) {
|
if (!save) {
|
||||||
@ -305,6 +351,15 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj
|
|||||||
if (!saveRelevancy) {
|
if (!saveRelevancy) {
|
||||||
throw new ServiceException("新增用户与项目关联失败,数据库异常", HttpStatus.ERROR);
|
throw new ServiceException("新增用户与项目关联失败,数据库异常", HttpStatus.ERROR);
|
||||||
}
|
}
|
||||||
|
// 异步执行数据同步
|
||||||
|
self.insertProjectSyncThing(projectId)
|
||||||
|
.thenAccept(result -> {
|
||||||
|
log.info("项目[{}-{}]异步执行数据同步成功", req.getProjectName(), projectId);
|
||||||
|
})
|
||||||
|
.exceptionally(ex -> {
|
||||||
|
log.error("项目[{}-{}]异步执行数据同步失败", req.getProjectName(), projectId, ex);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
// 返回新写入的数据 projectId
|
// 返回新写入的数据 projectId
|
||||||
return projectId;
|
return projectId;
|
||||||
}
|
}
|
||||||
@ -352,6 +407,25 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj
|
|||||||
return subProjectId;
|
return subProjectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建项目需同步的事务
|
||||||
|
*
|
||||||
|
* @param id 项目id
|
||||||
|
* @return 是否同步成功
|
||||||
|
*/
|
||||||
|
@Async
|
||||||
|
@Override
|
||||||
|
public CompletableFuture<Boolean> insertProjectSyncThing(Long id) {
|
||||||
|
BusProject project = this.getById(id);
|
||||||
|
if (project == null) {
|
||||||
|
log.error("同步数据失败,项目[{}]不存在", id);
|
||||||
|
return CompletableFuture.completedFuture(false);
|
||||||
|
}
|
||||||
|
// 安全、质量知识库文件夹模版
|
||||||
|
|
||||||
|
return CompletableFuture.completedFuture(true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改项目
|
* 修改项目
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,279 @@
|
|||||||
|
package org.dromara.project.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.common.core.constant.HttpStatus;
|
||||||
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
|
import org.dromara.common.core.utils.ObjectUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
|
import org.dromara.project.domain.BusContractor;
|
||||||
|
import org.dromara.project.domain.BusProject;
|
||||||
|
import org.dromara.project.domain.BusSubcontract;
|
||||||
|
import org.dromara.project.domain.dto.subcontract.BusSubcontractCreateReq;
|
||||||
|
import org.dromara.project.domain.dto.subcontract.BusSubcontractQueryReq;
|
||||||
|
import org.dromara.project.domain.dto.subcontract.BusSubcontractUpdateReq;
|
||||||
|
import org.dromara.project.domain.vo.subcontract.BusSubcontractVo;
|
||||||
|
import org.dromara.project.mapper.BusSubcontractMapper;
|
||||||
|
import org.dromara.project.service.IBusContractorService;
|
||||||
|
import org.dromara.project.service.IBusProjectService;
|
||||||
|
import org.dromara.project.service.IBusSubcontractService;
|
||||||
|
import org.dromara.system.service.ISysOssService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包合同Service业务层处理
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class BusSubcontractServiceImpl extends ServiceImpl<BusSubcontractMapper, BusSubcontract>
|
||||||
|
implements IBusSubcontractService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBusProjectService projectService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBusContractorService contractorService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISysOssService ossService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询分包合同
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 分包合同
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BusSubcontractVo queryById(Long id) {
|
||||||
|
BusSubcontract subcontract = this.getById(id);
|
||||||
|
if (subcontract == null) {
|
||||||
|
throw new ServiceException("分包合同信息不存在", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
return this.getVo(subcontract);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询分包合同列表
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 分包合同分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<BusSubcontractVo> queryPageList(BusSubcontractQueryReq req, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<BusSubcontract> lqw = buildQueryWrapper(req);
|
||||||
|
Page<BusSubcontract> result = this.page(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(this.getVoPage(result));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的分包合同列表
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @return 分包合同列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BusSubcontractVo> queryList(BusSubcontractQueryReq req) {
|
||||||
|
LambdaQueryWrapper<BusSubcontract> lqw = buildQueryWrapper(req);
|
||||||
|
return this.list(lqw).stream().map(this::getVo).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增分包合同
|
||||||
|
*
|
||||||
|
* @param req 分包合同
|
||||||
|
* @return 新增主键id
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Long insertByBo(BusSubcontractCreateReq req) {
|
||||||
|
BusSubcontract subcontract = new BusSubcontract();
|
||||||
|
BeanUtils.copyProperties(req, subcontract);
|
||||||
|
validEntityBeforeSave(subcontract);
|
||||||
|
Long count = this.lambdaQuery()
|
||||||
|
.eq(BusSubcontract::getProjectId, req.getProjectId())
|
||||||
|
.eq(BusSubcontract::getContractorId, req.getContractorId())
|
||||||
|
.eq(BusSubcontract::getContractFileId, req.getContractFileId())
|
||||||
|
.count();
|
||||||
|
if (count > 0) {
|
||||||
|
throw new ServiceException("已关联该项目合同", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
boolean save = this.save(subcontract);
|
||||||
|
if (!save) {
|
||||||
|
throw new ServiceException("分包合同新增失败", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
return subcontract.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改分包合同
|
||||||
|
*
|
||||||
|
* @param req 分包合同
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(BusSubcontractUpdateReq req) {
|
||||||
|
BusSubcontract subcontract = new BusSubcontract();
|
||||||
|
BeanUtils.copyProperties(req, subcontract);
|
||||||
|
validEntityBeforeSave(subcontract);
|
||||||
|
Long id = req.getId();
|
||||||
|
BusSubcontract oldSubcontract = this.getById(id);
|
||||||
|
if (oldSubcontract == null) {
|
||||||
|
throw new ServiceException("修改分包合同失败,数据不存在", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
Long count = this.lambdaQuery()
|
||||||
|
.eq(BusSubcontract::getProjectId, req.getProjectId())
|
||||||
|
.eq(BusSubcontract::getContractorId, req.getContractorId())
|
||||||
|
.eq(BusSubcontract::getContractFileId, req.getContractFileId())
|
||||||
|
.count();
|
||||||
|
if (count > 0) {
|
||||||
|
throw new ServiceException("已关联该项目合同", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
boolean result = this.updateById(subcontract);
|
||||||
|
if (!result) {
|
||||||
|
throw new ServiceException("修改分包合同失败", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(BusSubcontract entity) {
|
||||||
|
Long projectId = entity.getProjectId();
|
||||||
|
Long contractorId = entity.getContractorId();
|
||||||
|
if (projectId == null) {
|
||||||
|
throw new ServiceException("项目id不能为空", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
if (contractorId == null) {
|
||||||
|
throw new ServiceException("合同方id不能为空", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
BusProject project = projectService.getById(projectId);
|
||||||
|
if (project == null) {
|
||||||
|
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
BusContractor contractor = contractorService.getById(contractorId);
|
||||||
|
if (contractor == null) {
|
||||||
|
throw new ServiceException("对应合同方不存在", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
if (!contractor.getProjectId().equals(projectId)) {
|
||||||
|
throw new ServiceException("分包方不属于当前项目,请重新选择", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除分包合同信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
Long userId = LoginHelper.getUserId();
|
||||||
|
List<BusSubcontract> list = this.listByIds(ids);
|
||||||
|
if (isValid) {
|
||||||
|
List<Long> projectIdList = list.stream().map(BusSubcontract::getProjectId).toList();
|
||||||
|
projectService.validAuth(projectIdList, userId);
|
||||||
|
}
|
||||||
|
// 关联删除文件
|
||||||
|
Set<Long> fileIdList = list.stream().map(BusSubcontract::getContractFileId).collect(Collectors.toSet());
|
||||||
|
Boolean result = ossService.deleteWithValidByIds(fileIdList, false);
|
||||||
|
if (!result) {
|
||||||
|
log.error("删除文件:{}失败", fileIdList);
|
||||||
|
}
|
||||||
|
return this.removeBatchByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取分包合同视图
|
||||||
|
*
|
||||||
|
* @param subcontract 分包合同
|
||||||
|
* @return 分包合同视图
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BusSubcontractVo getVo(BusSubcontract subcontract) {
|
||||||
|
// 封装对象
|
||||||
|
BusSubcontractVo subcontractVo = new BusSubcontractVo();
|
||||||
|
if (subcontract == null) {
|
||||||
|
return subcontractVo;
|
||||||
|
}
|
||||||
|
BeanUtils.copyProperties(subcontract, subcontractVo);
|
||||||
|
return subcontractVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户和项目关联对象查询条件封装
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @return 查询条件封装
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public LambdaQueryWrapper<BusSubcontract> buildQueryWrapper(BusSubcontractQueryReq req) {
|
||||||
|
LambdaQueryWrapper<BusSubcontract> lqw = new LambdaQueryWrapper<>();
|
||||||
|
Long projectId = req.getProjectId();
|
||||||
|
Long contractorId = req.getContractorId();
|
||||||
|
String contractNumber = req.getContractNumber();
|
||||||
|
String contractName = req.getContractName();
|
||||||
|
String contractType = req.getContractType();
|
||||||
|
lqw.like(StringUtils.isNotBlank(contractNumber), BusSubcontract::getContractNumber, contractNumber);
|
||||||
|
lqw.like(StringUtils.isNotBlank(contractName), BusSubcontract::getContractName, contractName);
|
||||||
|
lqw.eq(ObjectUtils.isNotEmpty(projectId), BusSubcontract::getProjectId, projectId);
|
||||||
|
lqw.eq(ObjectUtils.isNotEmpty(contractorId), BusSubcontract::getContractorId, contractorId);
|
||||||
|
lqw.eq(StringUtils.isNotBlank(contractType), BusSubcontract::getContractType, contractType);
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取分包合同分页视图
|
||||||
|
*
|
||||||
|
* @param subcontractPage 分包合同分页
|
||||||
|
* @return 分包合同分页视图
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Page<BusSubcontractVo> getVoPage(Page<BusSubcontract> subcontractPage) {
|
||||||
|
List<BusSubcontract> subcontractList = subcontractPage.getRecords();
|
||||||
|
Page<BusSubcontractVo> subcontractVoPage = new Page<>(
|
||||||
|
subcontractPage.getCurrent(),
|
||||||
|
subcontractPage.getSize(),
|
||||||
|
subcontractPage.getTotal()
|
||||||
|
);
|
||||||
|
if (CollUtil.isEmpty(subcontractList)) {
|
||||||
|
return subcontractVoPage;
|
||||||
|
}
|
||||||
|
// 获取分包商信息
|
||||||
|
Set<Long> contractorIdList = subcontractList.stream().map(BusSubcontract::getContractorId).collect(Collectors.toSet());
|
||||||
|
Map<Long, BusContractor> contractorMap = contractorService.listByIds(contractorIdList)
|
||||||
|
.stream().collect(Collectors.toMap(BusContractor::getId, v -> v));
|
||||||
|
List<BusSubcontractVo> subcontractVoList = subcontractList.stream().map(entity -> {
|
||||||
|
BusSubcontractVo subcontractVo = new BusSubcontractVo();
|
||||||
|
BeanUtils.copyProperties(entity, subcontractVo);
|
||||||
|
Long contractorId = entity.getContractorId();
|
||||||
|
if (contractorMap.containsKey(contractorId)) {
|
||||||
|
BusContractor contractor = contractorMap.get(contractorId);
|
||||||
|
subcontractVo.setContractorName(contractor.getName());
|
||||||
|
}
|
||||||
|
return subcontractVo;
|
||||||
|
}).toList();
|
||||||
|
subcontractVoPage.setRecords(subcontractVoList);
|
||||||
|
return subcontractVoPage;
|
||||||
|
}
|
||||||
|
}
|
@ -212,7 +212,7 @@ public class BusUserProjectRelevancyServiceImpl extends ServiceImpl<BusUserProje
|
|||||||
Map<Long, List<BusProject>> projectMap = projectService.lambdaQuery()
|
Map<Long, List<BusProject>> projectMap = projectService.lambdaQuery()
|
||||||
.select(BusProject::getId, BusProject::getPId, BusProject::getProjectName, BusProject::getShortName)
|
.select(BusProject::getId, BusProject::getPId, BusProject::getProjectName, BusProject::getShortName)
|
||||||
.in(BusProject::getId, projectIdList)
|
.in(BusProject::getId, projectIdList)
|
||||||
.eq(BusProject::getPId, BusProjectConstant.PARENT_PROJECT_ID)
|
.eq(BusProject::getPId, BusProjectConstant.PARENT_ID)
|
||||||
.list()
|
.list()
|
||||||
.stream().collect(Collectors.groupingBy(BusProject::getId));
|
.stream().collect(Collectors.groupingBy(BusProject::getId));
|
||||||
// 获取封装
|
// 获取封装
|
||||||
@ -223,7 +223,7 @@ public class BusUserProjectRelevancyServiceImpl extends ServiceImpl<BusUserProje
|
|||||||
if (projectMap.containsKey(projectId)) {
|
if (projectMap.containsKey(projectId)) {
|
||||||
project = projectMap.get(projectId).getFirst();
|
project = projectMap.get(projectId).getFirst();
|
||||||
}
|
}
|
||||||
if (project != null && project.getPId().equals(BusProjectConstant.PARENT_PROJECT_ID)) {
|
if (project != null && project.getPId().equals(BusProjectConstant.PARENT_ID)) {
|
||||||
BusLoginUserProjectRelevancyVo loginUserProjectRelevancy = new BusLoginUserProjectRelevancyVo();
|
BusLoginUserProjectRelevancyVo loginUserProjectRelevancy = new BusLoginUserProjectRelevancyVo();
|
||||||
loginUserProjectRelevancy.setId(userProjectRelevancy.getId());
|
loginUserProjectRelevancy.setId(userProjectRelevancy.getId());
|
||||||
loginUserProjectRelevancy.setUserId(userProjectRelevancy.getUserId());
|
loginUserProjectRelevancy.setUserId(userProjectRelevancy.getUserId());
|
||||||
|
@ -0,0 +1,104 @@
|
|||||||
|
package org.dromara.quality.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
import org.dromara.quality.domain.vo.knowledgedocument.QltKnowledgeDocumentVo;
|
||||||
|
import org.dromara.quality.domain.bo.QltKnowledgeDocumentBo;
|
||||||
|
import org.dromara.quality.service.IQltKnowledgeDocumentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量知识库
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/quality/knowledgeDocument")
|
||||||
|
public class QltKnowledgeDocumentController extends BaseController {
|
||||||
|
|
||||||
|
private final IQltKnowledgeDocumentService qltKnowledgeDocumentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询质量知识库列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("quality:knowledgeDocument:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public R<List<QltKnowledgeDocumentVo>> list(QltKnowledgeDocumentBo bo) {
|
||||||
|
List<QltKnowledgeDocumentVo> list = qltKnowledgeDocumentService.queryList(bo);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出质量知识库列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("quality:knowledgeDocument:export")
|
||||||
|
@Log(title = "质量知识库", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(QltKnowledgeDocumentBo bo, HttpServletResponse response) {
|
||||||
|
List<QltKnowledgeDocumentVo> list = qltKnowledgeDocumentService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "质量知识库", QltKnowledgeDocumentVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取质量知识库详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("quality:knowledgeDocument:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<QltKnowledgeDocumentVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(qltKnowledgeDocumentService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增质量知识库
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("quality:knowledgeDocument:add")
|
||||||
|
@Log(title = "质量知识库", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody QltKnowledgeDocumentBo bo) {
|
||||||
|
return toAjax(qltKnowledgeDocumentService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改质量知识库
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("quality:knowledgeDocument:edit")
|
||||||
|
@Log(title = "质量知识库", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody QltKnowledgeDocumentBo bo) {
|
||||||
|
return toAjax(qltKnowledgeDocumentService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除质量知识库
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("quality:knowledgeDocument:remove")
|
||||||
|
@Log(title = "质量知识库", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(qltKnowledgeDocumentService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package org.dromara.quality.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量知识库对象 qlt_knowledge_document
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("qlt_knowledge_document")
|
||||||
|
public class QltKnowledgeDocument extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级(0代表顶级)
|
||||||
|
*/
|
||||||
|
private Long pid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名称
|
||||||
|
*/
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件路径
|
||||||
|
*/
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件访问路径
|
||||||
|
*/
|
||||||
|
private String fileUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件类型(1文件夹 2文件 3图片)
|
||||||
|
*/
|
||||||
|
private String fileType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件后缀
|
||||||
|
*/
|
||||||
|
private String fileSuffix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1删除)
|
||||||
|
*/
|
||||||
|
private String fileStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原文件名
|
||||||
|
*/
|
||||||
|
private String originalName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除时间
|
||||||
|
*/
|
||||||
|
private Date deletedAt;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package org.dromara.quality.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.quality.domain.QltKnowledgeDocument;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量知识库业务对象 qlt_knowledge_document
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = QltKnowledgeDocument.class, reverseConvertGenerate = false)
|
||||||
|
public class QltKnowledgeDocumentBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "项目id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级(0代表顶级)
|
||||||
|
*/
|
||||||
|
@NotNull(message = "父级(0代表顶级)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long pid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "文件名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件路径
|
||||||
|
*/
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件访问路径
|
||||||
|
*/
|
||||||
|
private String fileUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件类型(1文件夹 2文件 3图片)
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "文件类型(1文件夹 2文件 3图片)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String fileType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件后缀
|
||||||
|
*/
|
||||||
|
private String fileSuffix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1删除)
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "状态(0正常 1删除)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String fileStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原文件名
|
||||||
|
*/
|
||||||
|
private String originalName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,106 @@
|
|||||||
|
package org.dromara.quality.domain.vo.knowledgedocument;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
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.quality.domain.QltKnowledgeDocument;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量知识库视图对象 qlt_knowledge_document
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = QltKnowledgeDocument.class)
|
||||||
|
public class QltKnowledgeDocumentVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "主键id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "项目id")
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级(0代表顶级)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "父级", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "0=代表顶级")
|
||||||
|
private Long pid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "文件名称")
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件路径
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "文件路径")
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件访问路径
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "文件访问路径")
|
||||||
|
private String fileUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件类型(1文件夹 2文件 3图片)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "文件类型", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "1=文件夹,2=文件,3=图片")
|
||||||
|
private String fileType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件后缀
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "文件后缀")
|
||||||
|
private String fileSuffix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1删除)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "0=正常,1=删除")
|
||||||
|
private String fileStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原文件名
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "原文件名")
|
||||||
|
private String originalName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.quality.mapper;
|
||||||
|
|
||||||
|
import org.dromara.quality.domain.QltKnowledgeDocument;
|
||||||
|
import org.dromara.quality.domain.vo.knowledgedocument.QltKnowledgeDocumentVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量知识库Mapper接口
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
public interface QltKnowledgeDocumentMapper extends BaseMapperPlus<QltKnowledgeDocument, QltKnowledgeDocumentVo> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.dromara.quality.service;
|
||||||
|
|
||||||
|
import org.dromara.quality.domain.vo.knowledgedocument.QltKnowledgeDocumentVo;
|
||||||
|
import org.dromara.quality.domain.bo.QltKnowledgeDocumentBo;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量知识库Service接口
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
public interface IQltKnowledgeDocumentService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询质量知识库
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 质量知识库
|
||||||
|
*/
|
||||||
|
QltKnowledgeDocumentVo queryById(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的质量知识库列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 质量知识库列表
|
||||||
|
*/
|
||||||
|
List<QltKnowledgeDocumentVo> queryList(QltKnowledgeDocumentBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增质量知识库
|
||||||
|
*
|
||||||
|
* @param bo 质量知识库
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(QltKnowledgeDocumentBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改质量知识库
|
||||||
|
*
|
||||||
|
* @param bo 质量知识库
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(QltKnowledgeDocumentBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除质量知识库信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
@ -0,0 +1,122 @@
|
|||||||
|
package org.dromara.quality.service.impl;
|
||||||
|
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.quality.domain.bo.QltKnowledgeDocumentBo;
|
||||||
|
import org.dromara.quality.domain.vo.knowledgedocument.QltKnowledgeDocumentVo;
|
||||||
|
import org.dromara.quality.domain.QltKnowledgeDocument;
|
||||||
|
import org.dromara.quality.mapper.QltKnowledgeDocumentMapper;
|
||||||
|
import org.dromara.quality.service.IQltKnowledgeDocumentService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量知识库Service业务层处理
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class QltKnowledgeDocumentServiceImpl implements IQltKnowledgeDocumentService {
|
||||||
|
|
||||||
|
private final QltKnowledgeDocumentMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询质量知识库
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 质量知识库
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public QltKnowledgeDocumentVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的质量知识库列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 质量知识库列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<QltKnowledgeDocumentVo> queryList(QltKnowledgeDocumentBo bo) {
|
||||||
|
LambdaQueryWrapper<QltKnowledgeDocument> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<QltKnowledgeDocument> buildQueryWrapper(QltKnowledgeDocumentBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<QltKnowledgeDocument> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByAsc(QltKnowledgeDocument::getId);
|
||||||
|
lqw.eq(bo.getProjectId() != null, QltKnowledgeDocument::getProjectId, bo.getProjectId());
|
||||||
|
lqw.eq(bo.getPid() != null, QltKnowledgeDocument::getPid, bo.getPid());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getFileName()), QltKnowledgeDocument::getFileName, bo.getFileName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getFilePath()), QltKnowledgeDocument::getFilePath, bo.getFilePath());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getFileUrl()), QltKnowledgeDocument::getFileUrl, bo.getFileUrl());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getFileType()), QltKnowledgeDocument::getFileType, bo.getFileType());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getFileSuffix()), QltKnowledgeDocument::getFileSuffix, bo.getFileSuffix());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getFileStatus()), QltKnowledgeDocument::getFileStatus, bo.getFileStatus());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getOriginalName()), QltKnowledgeDocument::getOriginalName, bo.getOriginalName());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增质量知识库
|
||||||
|
*
|
||||||
|
* @param bo 质量知识库
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(QltKnowledgeDocumentBo bo) {
|
||||||
|
QltKnowledgeDocument add = MapstructUtils.convert(bo, QltKnowledgeDocument.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改质量知识库
|
||||||
|
*
|
||||||
|
* @param bo 质量知识库
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(QltKnowledgeDocumentBo bo) {
|
||||||
|
QltKnowledgeDocument update = MapstructUtils.convert(bo, QltKnowledgeDocument.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(QltKnowledgeDocument entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除质量知识库信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,104 @@
|
|||||||
|
package org.dromara.safety.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
import org.dromara.safety.domain.vo.knowledgedocument.HseKnowledgeDocumentVo;
|
||||||
|
import org.dromara.safety.domain.bo.HseKnowledgeDocumentBo;
|
||||||
|
import org.dromara.safety.service.IHseKnowledgeDocumentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全知识库
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/safety/knowledgeDocument")
|
||||||
|
public class HseKnowledgeDocumentController extends BaseController {
|
||||||
|
|
||||||
|
private final IHseKnowledgeDocumentService hseKnowledgeDocumentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询安全知识库列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("safety:knowledgeDocument:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public R<List<HseKnowledgeDocumentVo>> list(HseKnowledgeDocumentBo bo) {
|
||||||
|
List<HseKnowledgeDocumentVo> list = hseKnowledgeDocumentService.queryList(bo);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出安全知识库列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("safety:knowledgeDocument:export")
|
||||||
|
@Log(title = "安全知识库", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HseKnowledgeDocumentBo bo, HttpServletResponse response) {
|
||||||
|
List<HseKnowledgeDocumentVo> list = hseKnowledgeDocumentService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "安全知识库", HseKnowledgeDocumentVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取安全知识库详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("safety:knowledgeDocument:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<HseKnowledgeDocumentVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(hseKnowledgeDocumentService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增安全知识库
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("safety:knowledgeDocument:add")
|
||||||
|
@Log(title = "安全知识库", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody HseKnowledgeDocumentBo bo) {
|
||||||
|
return toAjax(hseKnowledgeDocumentService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改安全知识库
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("safety:knowledgeDocument:edit")
|
||||||
|
@Log(title = "安全知识库", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody HseKnowledgeDocumentBo bo) {
|
||||||
|
return toAjax(hseKnowledgeDocumentService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除安全知识库
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("safety:knowledgeDocument:remove")
|
||||||
|
@Log(title = "安全知识库", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(hseKnowledgeDocumentService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,81 @@
|
|||||||
|
package org.dromara.safety.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
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.recognizerecord.HseRecognizeRecordQueryReq;
|
||||||
|
import org.dromara.safety.domain.vo.recognizerecord.HseRecognizeRecordVo;
|
||||||
|
import org.dromara.safety.service.IHseRecognizeRecordService;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 识别记录
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-24
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/safety/recognizeRecord")
|
||||||
|
public class HseRecognizeRecordController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IHseRecognizeRecordService recognizeRecordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询识别记录列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("safety:recognizeRecord:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<HseRecognizeRecordVo> list(HseRecognizeRecordQueryReq req, PageQuery pageQuery) {
|
||||||
|
return recognizeRecordService.queryPageList(req, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出识别记录列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("safety:recognizeRecord:export")
|
||||||
|
@Log(title = "识别记录", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HseRecognizeRecordQueryReq req, HttpServletResponse response) {
|
||||||
|
List<HseRecognizeRecordVo> list = recognizeRecordService.queryList(req);
|
||||||
|
ExcelUtil.exportExcel(list, "识别记录", HseRecognizeRecordVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取识别记录详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("safety:recognizeRecord:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<HseRecognizeRecordVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(recognizeRecordService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除识别记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("safety:recognizeRecord:remove")
|
||||||
|
@Log(title = "识别记录", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return toAjax(recognizeRecordService.deleteById(id));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package org.dromara.safety.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全知识库对象 hse_knowledge_document
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("hse_knowledge_document")
|
||||||
|
public class HseKnowledgeDocument extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级(0代表顶级)
|
||||||
|
*/
|
||||||
|
private Long pid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名称
|
||||||
|
*/
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件路径
|
||||||
|
*/
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件访问路径
|
||||||
|
*/
|
||||||
|
private String fileUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件类型(1文件夹 2文件 3图片)
|
||||||
|
*/
|
||||||
|
private String fileType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件后缀
|
||||||
|
*/
|
||||||
|
private String fileSuffix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1删除)
|
||||||
|
*/
|
||||||
|
private String fileStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原文件名
|
||||||
|
*/
|
||||||
|
private String originalName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除时间
|
||||||
|
*/
|
||||||
|
private Date deletedAt;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,97 @@
|
|||||||
|
package org.dromara.safety.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 识别记录对象 hse_recognize_record
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("hse_recognize_record")
|
||||||
|
public class HseRecognizeRecord implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备序列号
|
||||||
|
*/
|
||||||
|
private String deviceSerial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 识别类别(1无人机识别 2监控拍摄)
|
||||||
|
*/
|
||||||
|
private String recordCategory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 违章类型(多个逗号分隔)
|
||||||
|
*/
|
||||||
|
private String violationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片路径
|
||||||
|
*/
|
||||||
|
private String picture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 违规数量
|
||||||
|
*/
|
||||||
|
private Integer num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除时间
|
||||||
|
*/
|
||||||
|
private Date deletedAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除(0正常 1删除)
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
|
private Long isDelete;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package org.dromara.safety.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.safety.domain.HseKnowledgeDocument;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全知识库业务对象 hse_knowledge_document
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = HseKnowledgeDocument.class, reverseConvertGenerate = false)
|
||||||
|
public class HseKnowledgeDocumentBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "项目id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级(0代表顶级)
|
||||||
|
*/
|
||||||
|
@NotNull(message = "父级(0代表顶级)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long pid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "文件名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件路径
|
||||||
|
*/
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件访问路径
|
||||||
|
*/
|
||||||
|
private String fileUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件类型(1文件夹 2文件 3图片)
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "文件类型(1文件夹 2文件 3图片)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String fileType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件后缀
|
||||||
|
*/
|
||||||
|
private String fileSuffix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1删除)
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "状态(0正常 1删除)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String fileStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原文件名
|
||||||
|
*/
|
||||||
|
private String originalName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package org.dromara.safety.domain.dto.recognizerecord;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.dromara.manager.spartamanager.vo.SpartaTargetVo;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025/6/24 11:48
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class HseRecognizeRecordCreateDto {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备序列号
|
||||||
|
*/
|
||||||
|
private String deviceSerial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 识别类别(1无人机识别 2监控拍摄)
|
||||||
|
*/
|
||||||
|
private String recordCategory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片路径
|
||||||
|
*/
|
||||||
|
private String picture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目标信息
|
||||||
|
*/
|
||||||
|
private List<SpartaTargetVo> targets;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package org.dromara.safety.domain.dto.recognizerecord;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025/6/24 11:05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class HseRecognizeRecordQueryReq implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 8542182388042031320L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 识别类别(1无人机识别 2监控拍摄)
|
||||||
|
*/
|
||||||
|
private String recordCategory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 违章类型(多个逗号分隔)
|
||||||
|
*/
|
||||||
|
private String violationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package org.dromara.safety.domain.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025/6/24 14:37
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum HseRecordCategoryEnum {
|
||||||
|
|
||||||
|
DRONE("无人机识别", "1"),
|
||||||
|
MONITOR("监控设备识别", "2");
|
||||||
|
|
||||||
|
private final String text;
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
HseRecordCategoryEnum(String text, String value) {
|
||||||
|
this.text = text;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,98 @@
|
|||||||
|
package org.dromara.safety.domain.vo.knowledgedocument;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
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.safety.domain.HseKnowledgeDocument;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全知识库视图对象 hse_knowledge_document
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = HseKnowledgeDocument.class)
|
||||||
|
public class HseKnowledgeDocumentVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "主键id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "项目id")
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级(0代表顶级)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "父级", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "0=代表顶级")
|
||||||
|
private Long pid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "文件名称")
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件路径
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "文件路径")
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件访问路径
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "文件访问路径")
|
||||||
|
private String fileUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件类型(1文件夹 2文件 3图片)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "文件类型", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "1=文件夹,2=文件,3=图片")
|
||||||
|
private String fileType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件后缀
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "文件后缀")
|
||||||
|
private String fileSuffix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1删除)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "0=正常,1=删除")
|
||||||
|
private String fileStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原文件名
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "原文件名")
|
||||||
|
private String originalName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package org.dromara.safety.domain.vo.recognizerecord;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
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.safety.domain.HseRecognizeRecord;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 识别记录视图对象 hse_recognize_record
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = HseRecognizeRecord.class)
|
||||||
|
public class HseRecognizeRecordVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@TableId(value = "主键id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "项目id")
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备序列号
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备序列号")
|
||||||
|
private String deviceSerial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备名称")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 识别类别(1无人机识别 2监控拍摄)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "识别类别", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "1=无人机识别,2=监控拍摄")
|
||||||
|
private String recordCategory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 违章类型(多个逗号分隔)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "违章类型", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(dictType = "violation_level_type")
|
||||||
|
private String violationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片路径
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "图片路径")
|
||||||
|
private String picture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障描述
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "故障描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.safety.mapper;
|
||||||
|
|
||||||
|
import org.dromara.safety.domain.HseKnowledgeDocument;
|
||||||
|
import org.dromara.safety.domain.vo.knowledgedocument.HseKnowledgeDocumentVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全知识库Mapper接口
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
public interface HseKnowledgeDocumentMapper extends BaseMapperPlus<HseKnowledgeDocument, HseKnowledgeDocumentVo> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.safety.mapper;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
import org.dromara.safety.domain.HseRecognizeRecord;
|
||||||
|
import org.dromara.safety.domain.vo.recognizerecord.HseRecognizeRecordVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 识别记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-24
|
||||||
|
*/
|
||||||
|
public interface HseRecognizeRecordMapper extends BaseMapperPlus<HseRecognizeRecord, HseRecognizeRecordVo> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.dromara.safety.service;
|
||||||
|
|
||||||
|
import org.dromara.safety.domain.vo.knowledgedocument.HseKnowledgeDocumentVo;
|
||||||
|
import org.dromara.safety.domain.bo.HseKnowledgeDocumentBo;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全知识库Service接口
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
public interface IHseKnowledgeDocumentService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询安全知识库
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 安全知识库
|
||||||
|
*/
|
||||||
|
HseKnowledgeDocumentVo queryById(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的安全知识库列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 安全知识库列表
|
||||||
|
*/
|
||||||
|
List<HseKnowledgeDocumentVo> queryList(HseKnowledgeDocumentBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增安全知识库
|
||||||
|
*
|
||||||
|
* @param bo 安全知识库
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(HseKnowledgeDocumentBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改安全知识库
|
||||||
|
*
|
||||||
|
* @param bo 安全知识库
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(HseKnowledgeDocumentBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除安全知识库信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package org.dromara.safety.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
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.HseRecognizeRecord;
|
||||||
|
import org.dromara.safety.domain.dto.recognizerecord.HseRecognizeRecordCreateDto;
|
||||||
|
import org.dromara.safety.domain.dto.recognizerecord.HseRecognizeRecordQueryReq;
|
||||||
|
import org.dromara.safety.domain.vo.recognizerecord.HseRecognizeRecordVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 识别记录Service接口
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-24
|
||||||
|
*/
|
||||||
|
public interface IHseRecognizeRecordService extends IService<HseRecognizeRecord> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询识别记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 识别记录
|
||||||
|
*/
|
||||||
|
HseRecognizeRecordVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询识别记录列表
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 识别记录分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<HseRecognizeRecordVo> queryPageList(HseRecognizeRecordQueryReq req, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的识别记录列表
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @return 识别记录列表
|
||||||
|
*/
|
||||||
|
List<HseRecognizeRecordVo> queryList(HseRecognizeRecordQueryReq req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建识别记录(摄像头)
|
||||||
|
*
|
||||||
|
* @param recordList 识别记录列表
|
||||||
|
*/
|
||||||
|
void saveByMonitor(List<HseRecognizeRecordCreateDto> recordList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除识别记录信息
|
||||||
|
*
|
||||||
|
* @param id 待删除的主键
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取识别记录视图对象
|
||||||
|
*
|
||||||
|
* @param recognizeRecord 识别记录对象
|
||||||
|
* @return 识别记录视图对象
|
||||||
|
*/
|
||||||
|
HseRecognizeRecordVo getVo(HseRecognizeRecord recognizeRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取识别记录查询条件封装
|
||||||
|
*
|
||||||
|
* @param req 识别记录查询条件
|
||||||
|
* @return 识别记录查询条件封装
|
||||||
|
*/
|
||||||
|
LambdaQueryWrapper<HseRecognizeRecord> buildQueryWrapper(HseRecognizeRecordQueryReq req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取识别记录分页对象视图
|
||||||
|
*
|
||||||
|
* @param recognizeRecordPage 识别记录分页对象
|
||||||
|
* @return 识别记录分页对象视图
|
||||||
|
*/
|
||||||
|
Page<HseRecognizeRecordVo> getVoPage(Page<HseRecognizeRecord> recognizeRecordPage);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,122 @@
|
|||||||
|
package org.dromara.safety.service.impl;
|
||||||
|
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.safety.domain.bo.HseKnowledgeDocumentBo;
|
||||||
|
import org.dromara.safety.domain.vo.knowledgedocument.HseKnowledgeDocumentVo;
|
||||||
|
import org.dromara.safety.domain.HseKnowledgeDocument;
|
||||||
|
import org.dromara.safety.mapper.HseKnowledgeDocumentMapper;
|
||||||
|
import org.dromara.safety.service.IHseKnowledgeDocumentService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全知识库Service业务层处理
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class HseKnowledgeDocumentServiceImpl implements IHseKnowledgeDocumentService {
|
||||||
|
|
||||||
|
private final HseKnowledgeDocumentMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询安全知识库
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 安全知识库
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public HseKnowledgeDocumentVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的安全知识库列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 安全知识库列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<HseKnowledgeDocumentVo> queryList(HseKnowledgeDocumentBo bo) {
|
||||||
|
LambdaQueryWrapper<HseKnowledgeDocument> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<HseKnowledgeDocument> buildQueryWrapper(HseKnowledgeDocumentBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<HseKnowledgeDocument> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByAsc(HseKnowledgeDocument::getId);
|
||||||
|
lqw.eq(bo.getProjectId() != null, HseKnowledgeDocument::getProjectId, bo.getProjectId());
|
||||||
|
lqw.eq(bo.getPid() != null, HseKnowledgeDocument::getPid, bo.getPid());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getFileName()), HseKnowledgeDocument::getFileName, bo.getFileName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getFilePath()), HseKnowledgeDocument::getFilePath, bo.getFilePath());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getFileUrl()), HseKnowledgeDocument::getFileUrl, bo.getFileUrl());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getFileType()), HseKnowledgeDocument::getFileType, bo.getFileType());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getFileSuffix()), HseKnowledgeDocument::getFileSuffix, bo.getFileSuffix());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getFileStatus()), HseKnowledgeDocument::getFileStatus, bo.getFileStatus());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getOriginalName()), HseKnowledgeDocument::getOriginalName, bo.getOriginalName());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增安全知识库
|
||||||
|
*
|
||||||
|
* @param bo 安全知识库
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(HseKnowledgeDocumentBo bo) {
|
||||||
|
HseKnowledgeDocument add = MapstructUtils.convert(bo, HseKnowledgeDocument.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改安全知识库
|
||||||
|
*
|
||||||
|
* @param bo 安全知识库
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(HseKnowledgeDocumentBo bo) {
|
||||||
|
HseKnowledgeDocument update = MapstructUtils.convert(bo, HseKnowledgeDocument.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(HseKnowledgeDocument entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除安全知识库信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,225 @@
|
|||||||
|
package org.dromara.safety.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.dromara.common.core.constant.HttpStatus;
|
||||||
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
|
import org.dromara.common.core.utils.ObjectUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
|
import org.dromara.manager.spartamanager.enums.SpartaRecTypeEnum;
|
||||||
|
import org.dromara.manager.spartamanager.vo.SpartaTargetVo;
|
||||||
|
import org.dromara.project.service.IBusProjectService;
|
||||||
|
import org.dromara.safety.domain.HseRecognizeRecord;
|
||||||
|
import org.dromara.safety.domain.dto.recognizerecord.HseRecognizeRecordCreateDto;
|
||||||
|
import org.dromara.safety.domain.dto.recognizerecord.HseRecognizeRecordQueryReq;
|
||||||
|
import org.dromara.safety.domain.vo.recognizerecord.HseRecognizeRecordVo;
|
||||||
|
import org.dromara.safety.mapper.HseRecognizeRecordMapper;
|
||||||
|
import org.dromara.safety.service.IHseRecognizeRecordService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 识别记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-24
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class HseRecognizeRecordServiceImpl extends ServiceImpl<HseRecognizeRecordMapper, HseRecognizeRecord>
|
||||||
|
implements IHseRecognizeRecordService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBusProjectService projectService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询识别记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 识别记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public HseRecognizeRecordVo queryById(Long id) {
|
||||||
|
HseRecognizeRecord recognizeRecord = this.getById(id);
|
||||||
|
if (recognizeRecord == null) {
|
||||||
|
throw new ServiceException("识别记录信息不存在", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
return this.getVo(recognizeRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询识别记录列表
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 识别记录分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<HseRecognizeRecordVo> queryPageList(HseRecognizeRecordQueryReq req, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<HseRecognizeRecord> lqw = buildQueryWrapper(req);
|
||||||
|
Page<HseRecognizeRecord> result = this.page(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(this.getVoPage(result));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的识别记录列表
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @return 识别记录列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<HseRecognizeRecordVo> queryList(HseRecognizeRecordQueryReq req) {
|
||||||
|
LambdaQueryWrapper<HseRecognizeRecord> lqw = buildQueryWrapper(req);
|
||||||
|
return this.list(lqw).stream().map(this::getVo).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建识别记录(摄像头)
|
||||||
|
*
|
||||||
|
* @param recordList 识别记录列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void saveByMonitor(List<HseRecognizeRecordCreateDto> recordList) {
|
||||||
|
List<HseRecognizeRecord> entityList = new ArrayList<>();
|
||||||
|
for (HseRecognizeRecordCreateDto record : recordList) {
|
||||||
|
HseRecognizeRecord entity = new HseRecognizeRecord();
|
||||||
|
entity.setDeviceSerial(record.getDeviceSerial());
|
||||||
|
entity.setDeviceName(record.getDeviceName());
|
||||||
|
entity.setRecordCategory(record.getRecordCategory());
|
||||||
|
entity.setPicture(record.getPicture());
|
||||||
|
entity.setCreateTime(record.getCreateTime());
|
||||||
|
Long projectId = record.getProjectId();
|
||||||
|
if (projectId == null) {
|
||||||
|
entity.setRemark("该摄像头暂未分配到项目中");
|
||||||
|
}
|
||||||
|
List<SpartaTargetVo> targets = record.getTargets();
|
||||||
|
List<String> codeList = targets.stream()
|
||||||
|
.map(SpartaTargetVo::getType).distinct()
|
||||||
|
.map(SpartaRecTypeEnum::fromValue).filter(Objects::nonNull)
|
||||||
|
.map(SpartaRecTypeEnum::getCode).filter(Objects::nonNull)
|
||||||
|
.toList();
|
||||||
|
String codeStr = String.join(",", codeList);
|
||||||
|
entity.setViolationType(codeStr);
|
||||||
|
entity.setNum(targets.size());
|
||||||
|
entityList.add(entity);
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(entityList)) {
|
||||||
|
boolean result = this.saveBatch(entityList);
|
||||||
|
if (!result) {
|
||||||
|
throw new ServiceException("保存识别记录失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除识别记录信息
|
||||||
|
*
|
||||||
|
* @param id 待删除的主键集合
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteById(Long id) {
|
||||||
|
Long userId = LoginHelper.getUserId();
|
||||||
|
HseRecognizeRecord recognizeRecord = this.getById(id);
|
||||||
|
Long projectId = recognizeRecord.getProjectId();
|
||||||
|
projectService.validAuth(projectId, userId);
|
||||||
|
return this.removeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取识别记录视图对象
|
||||||
|
*
|
||||||
|
* @param recognizeRecord 识别记录对象
|
||||||
|
* @return 识别记录视图对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public HseRecognizeRecordVo getVo(HseRecognizeRecord recognizeRecord) {
|
||||||
|
HseRecognizeRecordVo recognizeRecordVo = new HseRecognizeRecordVo();
|
||||||
|
if (recognizeRecord == null) {
|
||||||
|
return recognizeRecordVo;
|
||||||
|
}
|
||||||
|
BeanUtils.copyProperties(recognizeRecord, recognizeRecordVo);
|
||||||
|
return recognizeRecordVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取识别记录查询条件封装
|
||||||
|
*
|
||||||
|
* @param req 识别记录查询条件
|
||||||
|
* @return 识别记录查询条件封装
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public LambdaQueryWrapper<HseRecognizeRecord> buildQueryWrapper(HseRecognizeRecordQueryReq req) {
|
||||||
|
LambdaQueryWrapper<HseRecognizeRecord> lqw = new LambdaQueryWrapper<>();
|
||||||
|
Long projectId = req.getProjectId();
|
||||||
|
String recordCategory = req.getRecordCategory();
|
||||||
|
String violationType = req.getViolationType();
|
||||||
|
String description = req.getDescription();
|
||||||
|
Date createTime = req.getCreateTime();
|
||||||
|
lqw.eq(ObjectUtils.isNotEmpty(projectId), HseRecognizeRecord::getProjectId, projectId);
|
||||||
|
lqw.eq(StringUtils.isNotBlank(recordCategory), HseRecognizeRecord::getRecordCategory, recordCategory);
|
||||||
|
if (StringUtils.isNotBlank(violationType)) {
|
||||||
|
lqw.likeRight(HseRecognizeRecord::getViolationType, violationType + ",")
|
||||||
|
.or()
|
||||||
|
.likeLeft(HseRecognizeRecord::getViolationType, "," + violationType)
|
||||||
|
.or()
|
||||||
|
.like(HseRecognizeRecord::getViolationType, "," + violationType + ",")
|
||||||
|
.or()
|
||||||
|
.eq(HseRecognizeRecord::getViolationType, violationType);
|
||||||
|
}
|
||||||
|
lqw.like(StringUtils.isNotBlank(description), HseRecognizeRecord::getDescription, description);
|
||||||
|
if (createTime != null) {
|
||||||
|
// 构造当天的起始和结束时间
|
||||||
|
LocalDate localDate = createTime.toInstant()
|
||||||
|
.atZone(ZoneId.systemDefault())
|
||||||
|
.toLocalDate();
|
||||||
|
LocalDateTime startOfDay = localDate.atStartOfDay();
|
||||||
|
LocalDateTime startOfNextDay = localDate.plusDays(1).atStartOfDay();
|
||||||
|
Date start = Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant());
|
||||||
|
Date end = Date.from(startOfNextDay.atZone(ZoneId.systemDefault()).toInstant());
|
||||||
|
lqw.ge(HseRecognizeRecord::getCreateTime, start)
|
||||||
|
.lt(HseRecognizeRecord::getCreateTime, end);
|
||||||
|
}
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取识别记录分页对象视图
|
||||||
|
*
|
||||||
|
* @param recognizeRecordPage 识别记录分页对象
|
||||||
|
* @return 识别记录分页对象视图
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Page<HseRecognizeRecordVo> getVoPage(Page<HseRecognizeRecord> recognizeRecordPage) {
|
||||||
|
List<HseRecognizeRecord> recognizeRecordList = recognizeRecordPage.getRecords();
|
||||||
|
Page<HseRecognizeRecordVo> recognizeRecordVoPage = new Page<>(
|
||||||
|
recognizeRecordPage.getCurrent(),
|
||||||
|
recognizeRecordPage.getSize(),
|
||||||
|
recognizeRecordPage.getTotal());
|
||||||
|
if (CollUtil.isEmpty(recognizeRecordList)) {
|
||||||
|
return recognizeRecordVoPage;
|
||||||
|
}
|
||||||
|
List<HseRecognizeRecordVo> recognizeRecordVoList = recognizeRecordList.stream().map(violationLevel -> {
|
||||||
|
HseRecognizeRecordVo vo = new HseRecognizeRecordVo();
|
||||||
|
BeanUtils.copyProperties(violationLevel, vo);
|
||||||
|
return vo;
|
||||||
|
}).toList();
|
||||||
|
recognizeRecordVoPage.setRecords(recognizeRecordVoList);
|
||||||
|
return recognizeRecordVoPage;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,101 @@
|
|||||||
|
package org.dromara.system.controller.system;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
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.system.domain.dto.userfile.SysUserFileCreateReq;
|
||||||
|
import org.dromara.system.domain.dto.userfile.SysUserFileQueryReq;
|
||||||
|
import org.dromara.system.domain.vo.SysUserFileVo;
|
||||||
|
import org.dromara.system.service.ISysUserFileService;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户文件关联
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/userFile")
|
||||||
|
public class SysUserFileController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISysUserFileService userFileService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户文件关联列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:userFile:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<SysUserFileVo> list(SysUserFileQueryReq req, PageQuery pageQuery) {
|
||||||
|
return userFileService.queryPageList(req, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户文件关联详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:userFile:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<SysUserFileVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(userFileService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id获取用户文件关联列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:userFile:query")
|
||||||
|
@GetMapping("/user/{userId}")
|
||||||
|
public R<List<SysUserFileVo>> getInfoByUserId(@NotNull(message = "用户id不能为空")
|
||||||
|
@PathVariable Long userId) {
|
||||||
|
return R.ok(userFileService.queryListByUserId(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取登录用户文件关联列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:userFile:query")
|
||||||
|
@GetMapping("/login/user")
|
||||||
|
public R<List<SysUserFileVo>> getInfoByLoginUser() {
|
||||||
|
return R.ok(userFileService.queryListByLoginUser());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户文件关联
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:userFile:add")
|
||||||
|
@Log(title = "用户文件关联", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysUserFileCreateReq req) {
|
||||||
|
return toAjax(userFileService.insertByBo(req));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户文件关联
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:userFile:remove")
|
||||||
|
@Log(title = "用户文件关联", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return toAjax(userFileService.deleteById(id));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package org.dromara.system.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户文件关联对象 sys_user_file
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("sys_user_file")
|
||||||
|
public class SysUserFile implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件id
|
||||||
|
*/
|
||||||
|
private Long fileId;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package org.dromara.system.domain.dto.userfile;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025/6/25 16:58
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysUserFileCreateReq implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = -5473752959026971387L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件列表id(,分隔)
|
||||||
|
*/
|
||||||
|
private String fileId;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package org.dromara.system.domain.dto.userfile;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025/6/25 16:58
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysUserFileQueryReq implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 6499152510654651256L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件id
|
||||||
|
*/
|
||||||
|
private Long fileId;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package org.dromara.system.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.dromara.system.domain.SysUserFile;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户文件关联视图对象 sys_user_file
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = SysUserFile.class)
|
||||||
|
public class SysUserFileVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "主键id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "文件id")
|
||||||
|
private Long fileId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -2,13 +2,13 @@ package org.dromara.system.domain.vo;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
import org.dromara.common.sensitive.annotation.Sensitive;
|
import org.dromara.common.sensitive.annotation.Sensitive;
|
||||||
import org.dromara.common.sensitive.core.SensitiveStrategy;
|
import org.dromara.common.sensitive.core.SensitiveStrategy;
|
||||||
import org.dromara.common.translation.annotation.Translation;
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
import org.dromara.common.translation.constant.TransConstant;
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
import org.dromara.system.domain.SysUser;
|
import org.dromara.system.domain.SysUser;
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -53,6 +53,11 @@ public class SysUserVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String nickName;
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户文件列表
|
||||||
|
*/
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户类型(sys_user系统用户)
|
* 用户类型(sys_user系统用户)
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
import org.dromara.system.domain.SysUserFile;
|
||||||
|
import org.dromara.system.domain.vo.SysUserFileVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户文件关联Mapper接口
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
public interface SysUserFileMapper extends BaseMapperPlus<SysUserFile, SysUserFileVo> {
|
||||||
|
|
||||||
|
}
|
@ -52,6 +52,14 @@ public interface ISysDeptService {
|
|||||||
*/
|
*/
|
||||||
SysDeptVo selectDeptById(Long deptId);
|
SysDeptVo selectDeptById(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过部门名称查询部门ID
|
||||||
|
*
|
||||||
|
* @param deptName 部门名称
|
||||||
|
* @return 部门ID
|
||||||
|
*/
|
||||||
|
Long selectIdByDeptName(String deptName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过部门ID串查询部门
|
* 通过部门ID串查询部门
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,103 @@
|
|||||||
|
package org.dromara.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
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.system.domain.SysUserFile;
|
||||||
|
import org.dromara.system.domain.dto.userfile.SysUserFileCreateReq;
|
||||||
|
import org.dromara.system.domain.dto.userfile.SysUserFileQueryReq;
|
||||||
|
import org.dromara.system.domain.vo.SysUserFileVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户文件关联Service接口
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
public interface ISysUserFileService extends IService<SysUserFile> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户文件关联
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 用户文件关联
|
||||||
|
*/
|
||||||
|
SysUserFileVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询用户文件关联列表
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 用户文件关联分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<SysUserFileVo> queryPageList(SysUserFileQueryReq req, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的用户文件关联列表
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @return 用户文件关联列表
|
||||||
|
*/
|
||||||
|
List<SysUserFileVo> queryList(SysUserFileQueryReq req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID查询用户文件关联列表
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 用户文件关联列表
|
||||||
|
*/
|
||||||
|
List<SysUserFileVo> queryListByUserId(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前登录用户文件关联列表
|
||||||
|
*
|
||||||
|
* @return 用户文件关联列表
|
||||||
|
*/
|
||||||
|
List<SysUserFileVo> queryListByLoginUser();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户文件关联
|
||||||
|
*
|
||||||
|
* @param req 用户文件关联
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(SysUserFileCreateReq req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户文件关联信息
|
||||||
|
*
|
||||||
|
* @param id 待删除的主键
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户文件视图
|
||||||
|
*
|
||||||
|
* @param userFile 用户文件
|
||||||
|
* @return 用户文件视图
|
||||||
|
*/
|
||||||
|
SysUserFileVo getVo(SysUserFile userFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户和项目关联对象查询条件封装
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @return 查询条件封装
|
||||||
|
*/
|
||||||
|
LambdaQueryWrapper<SysUserFile> buildQueryWrapper(SysUserFileQueryReq req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户文件分页视图
|
||||||
|
*
|
||||||
|
* @param userFilePage 用户文件分页
|
||||||
|
* @return 用户文件分页视图
|
||||||
|
*/
|
||||||
|
Page<SysUserFileVo> getVoPage(Page<SysUserFile> userFilePage);
|
||||||
|
|
||||||
|
}
|
@ -151,6 +151,20 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
return dept;
|
return dept;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过部门名称查询部门ID
|
||||||
|
*
|
||||||
|
* @param deptName 部门名称
|
||||||
|
* @return 部门ID
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Long selectIdByDeptName(String deptName) {
|
||||||
|
SysDept dept = baseMapper.selectOne(new LambdaQueryWrapper<SysDept>()
|
||||||
|
.select(SysDept::getDeptId)
|
||||||
|
.eq(SysDept::getDeptName, deptName));
|
||||||
|
return dept.getDeptId();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysDeptVo> selectDeptByIds(List<Long> deptIds) {
|
public List<SysDeptVo> selectDeptByIds(List<Long> deptIds) {
|
||||||
return baseMapper.selectDeptList(new LambdaQueryWrapper<SysDept>()
|
return baseMapper.selectDeptList(new LambdaQueryWrapper<SysDept>()
|
||||||
|
@ -0,0 +1,245 @@
|
|||||||
|
package org.dromara.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.dromara.common.core.constant.HttpStatus;
|
||||||
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
|
import org.dromara.common.core.utils.ObjectUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
|
import org.dromara.system.domain.SysUserFile;
|
||||||
|
import org.dromara.system.domain.dto.userfile.SysUserFileCreateReq;
|
||||||
|
import org.dromara.system.domain.dto.userfile.SysUserFileQueryReq;
|
||||||
|
import org.dromara.system.domain.vo.SysUserFileVo;
|
||||||
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
|
import org.dromara.system.mapper.SysUserFileMapper;
|
||||||
|
import org.dromara.system.service.ISysOssService;
|
||||||
|
import org.dromara.system.service.ISysUserFileService;
|
||||||
|
import org.dromara.system.service.ISysUserService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户文件关联Service业务层处理
|
||||||
|
*
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025-06-25
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysUserFileServiceImpl extends ServiceImpl<SysUserFileMapper, SysUserFile>
|
||||||
|
implements ISysUserFileService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISysOssService ossService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户文件关联
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 用户文件关联
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysUserFileVo queryById(Long id) {
|
||||||
|
SysUserFile userFile = getById(id);
|
||||||
|
if (userFile == null) {
|
||||||
|
throw new ServiceException("对应用户文件关联信息不存在", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
return this.getVo(userFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询用户文件关联列表
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 用户文件关联分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<SysUserFileVo> queryPageList(SysUserFileQueryReq req, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<SysUserFile> lqw = buildQueryWrapper(req);
|
||||||
|
Page<SysUserFile> result = this.page(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(this.getVoPage(result));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的用户文件关联列表
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @return 用户文件关联列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysUserFileVo> queryList(SysUserFileQueryReq req) {
|
||||||
|
LambdaQueryWrapper<SysUserFile> lqw = this.buildQueryWrapper(req);
|
||||||
|
return this.list(lqw).stream().map(this::getVo).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID查询用户文件关联列表
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 用户文件关联列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysUserFileVo> queryListByUserId(Long userId) {
|
||||||
|
SysUserVo user = userService.selectUserById(userId);
|
||||||
|
if (user == null) {
|
||||||
|
throw new ServiceException("用户不存在", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
return baseMapper.selectVoList(new LambdaQueryWrapper<SysUserFile>()
|
||||||
|
.eq(SysUserFile::getUserId, userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前登录用户文件关联列表
|
||||||
|
*
|
||||||
|
* @return 用户文件关联列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysUserFileVo> queryListByLoginUser() {
|
||||||
|
Long userId = LoginHelper.getUserId();
|
||||||
|
return baseMapper.selectVoList(new LambdaQueryWrapper<SysUserFile>()
|
||||||
|
.eq(SysUserFile::getUserId, userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户文件关联
|
||||||
|
*
|
||||||
|
* @param req 用户文件关联
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean insertByBo(SysUserFileCreateReq req) {
|
||||||
|
SysUserFile userFile = new SysUserFile();
|
||||||
|
BeanUtils.copyProperties(req, userFile);
|
||||||
|
validEntityBeforeSave(userFile);
|
||||||
|
String fileId = req.getFileId();
|
||||||
|
if (StringUtils.isBlank(fileId)) {
|
||||||
|
throw new ServiceException("用户文件不能为空", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
List<Long> fileIdList = Arrays.stream(fileId.split(",")).map(Long::parseLong).toList();
|
||||||
|
List<SysUserFile> newUserFileList = fileIdList.stream().map(id -> {
|
||||||
|
SysUserFile newUserFile = new SysUserFile();
|
||||||
|
newUserFile.setUserId(userFile.getUserId());
|
||||||
|
newUserFile.setFileId(id);
|
||||||
|
return newUserFile;
|
||||||
|
}).toList();
|
||||||
|
boolean save = this.saveOrUpdateBatch(newUserFileList);
|
||||||
|
if (!save) {
|
||||||
|
throw new ServiceException("保存用户文件关联失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户文件关联信息
|
||||||
|
*
|
||||||
|
* @param id 待删除的主键
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean deleteById(Long id) {
|
||||||
|
SysUserFile userFile = this.getById(id);
|
||||||
|
if (userFile == null) {
|
||||||
|
throw new ServiceException("用户文件关联不存在", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
Long fileId = userFile.getFileId();
|
||||||
|
// 删除文件
|
||||||
|
Boolean result = ossService.deleteWithValidByIds(List.of(fileId), true);
|
||||||
|
if (!result) {
|
||||||
|
throw new ServiceException("用户文件删除失败", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
boolean remove = this.removeById(id);
|
||||||
|
if (!remove) {
|
||||||
|
throw new ServiceException("用户文件关联删除失败", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(SysUserFile entity) {
|
||||||
|
// TODO 做一些数据校验,如唯一约束
|
||||||
|
Long userId = entity.getUserId();
|
||||||
|
if (userId == null) {
|
||||||
|
throw new ServiceException("用户ID不能为空", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
if (userService.selectUserById(userId) == null) {
|
||||||
|
throw new ServiceException("对应用户不存在", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户文件视图
|
||||||
|
*
|
||||||
|
* @param userFile 用户文件
|
||||||
|
* @return 用户文件视图
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysUserFileVo getVo(SysUserFile userFile) {
|
||||||
|
SysUserFileVo userFileVo = new SysUserFileVo();
|
||||||
|
if (userFile == null) {
|
||||||
|
return userFileVo;
|
||||||
|
}
|
||||||
|
BeanUtils.copyProperties(userFile, userFileVo);
|
||||||
|
return userFileVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户和项目关联对象查询条件封装
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @return 查询条件封装
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public LambdaQueryWrapper<SysUserFile> buildQueryWrapper(SysUserFileQueryReq req) {
|
||||||
|
LambdaQueryWrapper<SysUserFile> lqw = new LambdaQueryWrapper<>();
|
||||||
|
if (req == null) {
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
Long userId = req.getUserId();
|
||||||
|
Long fileId = req.getFileId();
|
||||||
|
lqw.eq(ObjectUtils.isNotEmpty(userId), SysUserFile::getUserId, userId);
|
||||||
|
lqw.eq(ObjectUtils.isNotEmpty(fileId), SysUserFile::getFileId, fileId);
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户文件分页视图
|
||||||
|
*
|
||||||
|
* @param userFilePage 用户文件分页
|
||||||
|
* @return 用户文件分页视图
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Page<SysUserFileVo> getVoPage(Page<SysUserFile> userFilePage) {
|
||||||
|
List<SysUserFile> userFileList = userFilePage.getRecords();
|
||||||
|
Page<SysUserFileVo> userFileVoPage = new Page<>(
|
||||||
|
userFilePage.getCurrent(),
|
||||||
|
userFilePage.getSize(),
|
||||||
|
userFilePage.getTotal());
|
||||||
|
if (CollUtil.isEmpty(userFileList)) {
|
||||||
|
return userFileVoPage;
|
||||||
|
}
|
||||||
|
List<SysUserFileVo> userFileVoList = userFileList.stream().map(userFile -> {
|
||||||
|
SysUserFileVo userFileVo = new SysUserFileVo();
|
||||||
|
BeanUtils.copyProperties(userFile, userFileVo);
|
||||||
|
return userFileVo;
|
||||||
|
}).toList();
|
||||||
|
userFileVoPage.setRecords(userFileVoList);
|
||||||
|
return userFileVoPage;
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.common.core.constant.CacheNames;
|
import org.dromara.common.core.constant.CacheNames;
|
||||||
@ -29,9 +30,11 @@ import org.dromara.system.domain.vo.SysRoleVo;
|
|||||||
import org.dromara.system.domain.vo.SysUserExportVo;
|
import org.dromara.system.domain.vo.SysUserExportVo;
|
||||||
import org.dromara.system.domain.vo.SysUserVo;
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
import org.dromara.system.mapper.*;
|
import org.dromara.system.mapper.*;
|
||||||
|
import org.dromara.system.service.ISysUserFileService;
|
||||||
import org.dromara.system.service.ISysUserService;
|
import org.dromara.system.service.ISysUserService;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@ -39,6 +42,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户 业务层处理
|
* 用户 业务层处理
|
||||||
@ -57,9 +61,32 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
private final SysUserRoleMapper userRoleMapper;
|
private final SysUserRoleMapper userRoleMapper;
|
||||||
private final SysUserPostMapper userPostMapper;
|
private final SysUserPostMapper userPostMapper;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private ISysUserFileService userFileService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysUserVo> selectPageUserList(SysUserBo user, PageQuery pageQuery) {
|
public TableDataInfo<SysUserVo> selectPageUserList(SysUserBo user, PageQuery pageQuery) {
|
||||||
Page<SysUserVo> page = baseMapper.selectPageUserList(pageQuery.build(), this.buildQueryWrapper(user));
|
Page<SysUserVo> page = baseMapper.selectPageUserList(pageQuery.build(), this.buildQueryWrapper(user));
|
||||||
|
List<SysUserVo> userVoList = page.getRecords();
|
||||||
|
List<Long> userIdList = userVoList.stream().map(SysUserVo::getUserId).toList();
|
||||||
|
if (CollUtil.isNotEmpty(userIdList)) {
|
||||||
|
List<SysUserFile> userFileList = userFileService.lambdaQuery()
|
||||||
|
.in(SysUserFile::getUserId, userIdList)
|
||||||
|
.list();
|
||||||
|
Map<Long, List<SysUserFile>> userFileMap = userFileList.stream().collect(Collectors.groupingBy(SysUserFile::getUserId));
|
||||||
|
userVoList.forEach(userVo -> {
|
||||||
|
Long userId = userVo.getUserId();
|
||||||
|
if (userFileMap.containsKey(userId)) {
|
||||||
|
List<SysUserFile> fileList = userFileMap.get(userId);
|
||||||
|
String fileIdStr = fileList.stream()
|
||||||
|
.map(file -> String.valueOf(file.getFileId()))
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
userVo.setFilePath(fileIdStr);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
page.setRecords(userVoList);
|
||||||
|
}
|
||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
package org.dromara.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.HexUtil;
|
||||||
|
import cn.hutool.crypto.SecureUtil;
|
||||||
|
import cn.hutool.crypto.symmetric.AES;
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lcj
|
||||||
|
* @date 2025/6/25 10:57
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class IdCardEncryptorUtil {
|
||||||
|
|
||||||
|
@Value("${id-card.encrypt-key}")
|
||||||
|
private String encryptKeyHex;
|
||||||
|
|
||||||
|
private AES aes;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
byte[] keyBytes = HexUtil.decodeHex(encryptKeyHex);
|
||||||
|
this.aes = SecureUtil.aes(keyBytes);
|
||||||
|
log.info("身份证 AES 加解密工具初始化成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加密
|
||||||
|
*
|
||||||
|
* @param idCard 身份证号码
|
||||||
|
* @return 加密后的身份证号码
|
||||||
|
*/
|
||||||
|
public String encrypt(String idCard) {
|
||||||
|
return aes.encryptBase64(idCard);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解密
|
||||||
|
*
|
||||||
|
* @param encrypted 密文
|
||||||
|
* @return 解密后的身份证号码
|
||||||
|
*/
|
||||||
|
public String decrypt(String encrypted) {
|
||||||
|
return aes.decryptStr(encrypted);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?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="org.dromara.project.mapper.BusSubcontractMapper">
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?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="org.dromara.quality.mapper.QltKnowledgeDocumentMapper">
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?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="org.dromara.safety.mapper.HseKnowledgeDocumentMapper">
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?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="org.dromara.safety.mapper.HseRecognizeRecordMapper">
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?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="org.dromara.system.mapper.SysUserFileMapper">
|
||||||
|
|
||||||
|
</mapper>
|
@ -717,3 +717,83 @@ values(1937100268151767046, '进度类别删除', 1937100268151767042, '4', '#'
|
|||||||
|
|
||||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
values(1937100268151767047, '进度类别导出', 1937100268151767042, '5', '#', '', 1, 0, 'F', '0', '0', 'progress:progressCategory:export', '#', 103, 1, sysdate(), null, null, '');
|
values(1937100268151767047, '进度类别导出', 1937100268151767042, '5', '#', '', 1, 0, 'F', '0', '0', 'progress:progressCategory:export', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
-- 菜单 SQL
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937338721300996098, '识别记录', '1935597155897143297', '1', 'recognizeRecord', 'safety/recognizeRecord/index', 1, 0, 'C', '0', '0', 'safety:recognizeRecord:list', '#', 103, 1, sysdate(), null, null, '识别记录菜单');
|
||||||
|
|
||||||
|
-- 按钮 SQL
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937338721300996099, '识别记录查询', 1937338721300996098, '1', '#', '', 1, 0, 'F', '0', '0', 'safety:recognizeRecord:query', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937338721300996100, '识别记录新增', 1937338721300996098, '2', '#', '', 1, 0, 'F', '0', '0', 'safety:recognizeRecord:add', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937338721300996101, '识别记录修改', 1937338721300996098, '3', '#', '', 1, 0, 'F', '0', '0', 'safety:recognizeRecord:edit', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937338721300996102, '识别记录删除', 1937338721300996098, '4', '#', '', 1, 0, 'F', '0', '0', 'safety:recognizeRecord:remove', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937338721300996103, '识别记录导出', 1937338721300996098, '5', '#', '', 1, 0, 'F', '0', '0', 'safety:recognizeRecord:export', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
-- 菜单 SQL
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937790795423707138, '分包合同', '1937684147828957185', '1', 'subcontract', 'project/subcontract/index', 1, 0, 'C', '0', '0', 'project:subcontract:list', '#', 103, 1, sysdate(), null, null, '分包合同菜单');
|
||||||
|
|
||||||
|
-- 按钮 SQL
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937790795423707139, '分包合同查询', 1937790795423707138, '1', '#', '', 1, 0, 'F', '0', '0', 'project:subcontract:query', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937790795423707140, '分包合同新增', 1937790795423707138, '2', '#', '', 1, 0, 'F', '0', '0', 'project:subcontract:add', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937790795423707141, '分包合同修改', 1937790795423707138, '3', '#', '', 1, 0, 'F', '0', '0', 'project:subcontract:edit', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937790795423707142, '分包合同删除', 1937790795423707138, '4', '#', '', 1, 0, 'F', '0', '0', 'project:subcontract:remove', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937790795423707143, '分包合同导出', 1937790795423707138, '5', '#', '', 1, 0, 'F', '0', '0', 'project:subcontract:export', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
-- 菜单 SQL
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937825328848191490, '安全知识库', '1902191175640604673', '1', 'knowledgeDocument', 'safety/knowledgeDocument/index', 1, 0, 'C', '0', '0', 'safety:knowledgeDocument:list', '#', 103, 1, sysdate(), null, null, '安全知识库菜单');
|
||||||
|
|
||||||
|
-- 按钮 SQL
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937825328848191491, '安全知识库查询', 1937825328848191490, '1', '#', '', 1, 0, 'F', '0', '0', 'safety:knowledgeDocument:query', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937825328848191492, '安全知识库新增', 1937825328848191490, '2', '#', '', 1, 0, 'F', '0', '0', 'safety:knowledgeDocument:add', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937825328848191493, '安全知识库修改', 1937825328848191490, '3', '#', '', 1, 0, 'F', '0', '0', 'safety:knowledgeDocument:edit', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937825328848191494, '安全知识库删除', 1937825328848191490, '4', '#', '', 1, 0, 'F', '0', '0', 'safety:knowledgeDocument:remove', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937825328848191495, '安全知识库导出', 1937825328848191490, '5', '#', '', 1, 0, 'F', '0', '0', 'safety:knowledgeDocument:export', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
-- 菜单 SQL
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937825131464245250, '质量知识库', '1912336811971096577', '1', 'knowledgeDocument', 'quality/knowledgeDocument/index', 1, 0, 'C', '0', '0', 'quality:knowledgeDocument:list', '#', 103, 1, sysdate(), null, null, '质量知识库菜单');
|
||||||
|
|
||||||
|
-- 按钮 SQL
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937825131464245251, '质量知识库查询', 1937825131464245250, '1', '#', '', 1, 0, 'F', '0', '0', 'quality:knowledgeDocument:query', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937825131464245252, '质量知识库新增', 1937825131464245250, '2', '#', '', 1, 0, 'F', '0', '0', 'quality:knowledgeDocument:add', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937825131464245253, '质量知识库修改', 1937825131464245250, '3', '#', '', 1, 0, 'F', '0', '0', 'quality:knowledgeDocument:edit', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937825131464245254, '质量知识库删除', 1937825131464245250, '4', '#', '', 1, 0, 'F', '0', '0', 'quality:knowledgeDocument:remove', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
|
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||||
|
values(1937825131464245255, '质量知识库导出', 1937825131464245250, '5', '#', '', 1, 0, 'F', '0', '0', 'quality:knowledgeDocument:export', '#', 103, 1, sysdate(), null, null, '');
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use xinnengyuan;
|
use xinnengyuandev;
|
||||||
|
|
||||||
drop table if exists bus_project;
|
drop table if exists bus_project;
|
||||||
create table `bus_project`
|
create table `bus_project`
|
||||||
@ -1144,3 +1144,100 @@ CREATE TABLE `hse_violation_level_post`
|
|||||||
`post` bigint not null comment '岗位',
|
`post` bigint not null comment '岗位',
|
||||||
primary key (`level`, `post`) using btree
|
primary key (`level`, `post`) using btree
|
||||||
) comment = '等级与岗位关联' collate = utf8mb4_unicode_ci;
|
) comment = '等级与岗位关联' collate = utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `hse_recognize_record`;
|
||||||
|
CREATE TABLE `hse_recognize_record`
|
||||||
|
(
|
||||||
|
`id` bigint not null auto_increment comment '主键id',
|
||||||
|
`project_id` bigint null comment '项目id',
|
||||||
|
`device_serial` varchar(255) null comment '设备序列号',
|
||||||
|
`device_name` varchar(255) null comment '设备名称',
|
||||||
|
`record_category` char(1) null comment '识别类别(1无人机识别 2监控拍摄)',
|
||||||
|
`violation_type` varchar(255) null comment '违章类型(多个逗号分隔)',
|
||||||
|
`picture` varchar(512) null comment '图片路径',
|
||||||
|
`num` int default 0 null comment '违规数量',
|
||||||
|
`description` varchar(512) null comment '故障描述',
|
||||||
|
`remark` varchar(512) null comment '备注',
|
||||||
|
`create_time` datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||||||
|
`update_time` datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||||
|
`deleted_at` datetime null comment '删除时间',
|
||||||
|
`is_delete` tinyint(4) default 0 not null comment '是否删除(0正常 1删除)',
|
||||||
|
primary key (`id`) using btree,
|
||||||
|
index `idx_project_id` (`project_id` asc) using btree comment '项目id'
|
||||||
|
) comment = '识别记录' collate = utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `sys_user_file`;
|
||||||
|
CREATE TABLE `sys_user_file`
|
||||||
|
(
|
||||||
|
`id` bigint not null auto_increment comment '主键id',
|
||||||
|
`user_id` bigint not null comment '用户id',
|
||||||
|
`file_id` bigint not null comment '文件id',
|
||||||
|
primary key (`id`) using btree,
|
||||||
|
unique index `idx_user_file` (`user_id`, `file_id`) using btree comment '用户id_文件id'
|
||||||
|
) comment = '用户文件关联' collate = utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `bus_subcontract`;
|
||||||
|
CREATE TABLE `bus_subcontract`
|
||||||
|
(
|
||||||
|
`id` bigint not null auto_increment comment '主键id',
|
||||||
|
`project_id` bigint not null comment '项目id',
|
||||||
|
`contractor_id` bigint not null comment '分包方id',
|
||||||
|
`contract_file_id` bigint not null comment '合同文件id',
|
||||||
|
`contract_number` varchar(255) null comment '合同编号',
|
||||||
|
`contract_name` varchar(255) null comment '合同名称',
|
||||||
|
`contract_type` char(1) not null comment '合同类型',
|
||||||
|
`contract_amount` decimal(12, 2) null comment '合同金额',
|
||||||
|
`contract_time` datetime null comment '合同时间',
|
||||||
|
`remark` varchar(512) null comment '备注',
|
||||||
|
`create_time` datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||||||
|
`update_time` datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||||
|
primary key (`id`) using btree,
|
||||||
|
index `idx_project_id` (`project_id` asc) using btree comment '项目id',
|
||||||
|
index `idx_contractor_id` (`contractor_id` asc) using btree comment '分包方id'
|
||||||
|
) comment = '分包合同' collate = utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `hse_knowledge_document`;
|
||||||
|
CREATE TABLE `hse_knowledge_document`
|
||||||
|
(
|
||||||
|
`id` bigint not null auto_increment comment '主键id',
|
||||||
|
`project_id` bigint not null comment '项目id',
|
||||||
|
`pid` bigint default 0 not null comment '父级(0代表顶级)',
|
||||||
|
`file_name` varchar(255) not null comment '文件名称',
|
||||||
|
`file_path` varchar(512) null comment '文件路径',
|
||||||
|
`file_url` varchar(512) null comment '文件访问路径',
|
||||||
|
`file_type` char(1) not null comment '文件类型(1文件夹 2文件 3图片)',
|
||||||
|
`file_suffix` varchar(20) null comment '文件后缀',
|
||||||
|
`file_status` char(1) default '0' not null comment '状态(0正常 1删除)',
|
||||||
|
`original_name` varchar(255) null comment '原文件名',
|
||||||
|
`remark` varchar(512) null comment '备注',
|
||||||
|
`create_by` varchar(64) null comment '创建者',
|
||||||
|
`update_by` varchar(64) null comment '更新者',
|
||||||
|
`create_time` datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||||||
|
`update_time` datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||||
|
`deleted_at` datetime null comment '删除时间',
|
||||||
|
primary key (`id`) using btree,
|
||||||
|
index `idx_project_id` (`project_id` asc) using btree comment '项目id'
|
||||||
|
) comment '安全知识库' collate = utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `qlt_knowledge_document`;
|
||||||
|
CREATE TABLE `qlt_knowledge_document`
|
||||||
|
(
|
||||||
|
`id` bigint not null auto_increment comment '主键id',
|
||||||
|
`project_id` bigint not null comment '项目id',
|
||||||
|
`pid` bigint default 0 not null comment '父级(0代表顶级)',
|
||||||
|
`file_name` varchar(255) not null comment '文件名称',
|
||||||
|
`file_path` varchar(512) null comment '文件路径',
|
||||||
|
`file_url` varchar(512) null comment '文件访问路径',
|
||||||
|
`file_type` char(1) not null comment '文件类型(1文件夹 2文件 3图片)',
|
||||||
|
`file_suffix` varchar(20) null comment '文件后缀',
|
||||||
|
`file_status` char(1) default '0' not null comment '状态(0正常 1删除)',
|
||||||
|
`original_name` varchar(255) null comment '原文件名',
|
||||||
|
`remark` varchar(512) null comment '备注',
|
||||||
|
`create_by` varchar(64) null comment '创建者',
|
||||||
|
`update_by` varchar(64) null comment '更新者',
|
||||||
|
`create_time` datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||||||
|
`update_time` datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||||
|
`deleted_at` datetime null comment '删除时间',
|
||||||
|
primary key (`id`) using btree,
|
||||||
|
index `idx_project_id` (`project_id` asc) using btree comment '项目id'
|
||||||
|
) comment '质量知识库' collate = utf8mb4_unicode_ci;
|
||||||
|
Reference in New Issue
Block a user