refactor(dms): 序列生成类Seq新增6个并修改String getId(String type,String code),dms模块新增工具类并在pom添加依赖

— 将"物料"统一更正为"设备"
master
zch 5 days ago
parent 5f343b86c7
commit 75b347940e

@ -34,6 +34,26 @@ public class Seq {
// 计划编号标识
public static final String mesPlanCodeCode = "PL";
// 润滑计划序列类型
public static final String dmsPlanLubeSeqType = "PLANLUBE";
// 润滑计划接口序列数
private static AtomicInteger dmsPlanLubeSeq = new AtomicInteger(1);
// 润滑记录标识
public static final String dmsPlanLubeCode = "PL";
// 润滑工单序列类型
public static final String dmsLubeInstanceSeqType = "LUBEINSTANCE";
// 润滑工单接口序列数
private static AtomicInteger dmsLubeInstanceSeq = new AtomicInteger(1);
// 润滑工单标识
public static final String dmsLubeInstanceCode = "LI";
/**
*
*
@ -98,6 +118,10 @@ public class Seq {
AtomicInteger atomicInt = commSeq;
if (mesPlanCodeSeqType.equals(type)) {
atomicInt = mesPlanCodeSeq;
}else if (dmsPlanLubeSeqType.equals(type)) {
atomicInt = dmsPlanLubeSeq;
}else if (dmsLubeInstanceSeqType.equals(type)) {
atomicInt = dmsLubeInstanceSeq;
}
return getId(atomicInt, 4, code);
}

@ -114,6 +114,20 @@
<artifactId>mssql-jdbc</artifactId>
</dependency>
<dependency>
<groupId>net.sf.jxls</groupId>
<artifactId>jxls-core</artifactId>
<version>1.0.3</version>
</dependency>
<!--用于cron表达式工具类CronUtils-->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
</dependency>
</dependencies>
<build>

@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
*
* 访:/dms/dmsBaseMachineInfo
*
* @author zangch
@ -39,7 +39,7 @@ public class DmsBaseMachineInfoController extends BaseController {
private final IDmsBaseMachineInfoService dmsBaseMachineInfoService;
/**
*
*
*/
@SaCheckPermission("dms:dmsBaseMachineInfo:list")
@GetMapping("/list")
@ -48,18 +48,18 @@ public class DmsBaseMachineInfoController extends BaseController {
}
/**
*
*
*/
@SaCheckPermission("dms:dmsBaseMachineInfo:export")
@Log(title = "机台信息", businessType = BusinessType.EXPORT)
@Log(title = "设备信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(DmsBaseMachineInfoBo bo, HttpServletResponse response) {
List<DmsBaseMachineInfoVo> list = dmsBaseMachineInfoService.queryList(bo);
ExcelUtil.exportExcel(list, "机台信息", DmsBaseMachineInfoVo.class, response);
ExcelUtil.exportExcel(list, "设备信息", DmsBaseMachineInfoVo.class, response);
}
/**
*
*
*
* @param machineId
*/
@ -71,10 +71,10 @@ public class DmsBaseMachineInfoController extends BaseController {
}
/**
*
*
*/
/* @SaCheckPermission("dms:dmsBaseMachineInfo:add")
@Log(title = "机台信息", businessType = BusinessType.INSERT)
@Log(title = "设备信息", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody DmsBaseMachineInfoBo bo) {
@ -82,10 +82,10 @@ public class DmsBaseMachineInfoController extends BaseController {
}*/
/**
*
*
*/
/* @SaCheckPermission("dms:dmsBaseMachineInfo:edit")
@Log(title = "机台信息", businessType = BusinessType.UPDATE)
@Log(title = "设备信息", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DmsBaseMachineInfoBo bo) {
@ -93,12 +93,12 @@ public class DmsBaseMachineInfoController extends BaseController {
}*/
/**
*
*
*
* @param machineIds
*/
/* @SaCheckPermission("dms:dmsBaseMachineInfo:remove")
@Log(title = "机台信息", businessType = BusinessType.DELETE)
@Log(title = "设备信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{machineIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] machineIds) {
@ -107,7 +107,7 @@ public class DmsBaseMachineInfoController extends BaseController {
/**
*
*
*/
@GetMapping("getDmsBaseMachineInfoList")

@ -23,7 +23,7 @@ import org.dromara.dms.service.IDmsInspectProjectDeviceService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
*
*
* 访:/dms/dmsInspectProjectDevice
*
* @author zch
@ -38,7 +38,7 @@ public class DmsInspectProjectDeviceController extends BaseController {
private final IDmsInspectProjectDeviceService dmsInspectProjectDeviceService;
/**
*
*
*/
@SaCheckPermission("dms:dmsInspectProjectDevice:list")
@GetMapping("/list")
@ -47,18 +47,18 @@ public class DmsInspectProjectDeviceController extends BaseController {
}
/**
*
*
*/
@SaCheckPermission("dms:dmsInspectProjectDevice:export")
@Log(title = "点巡检项目关联物料信息", businessType = BusinessType.EXPORT)
@Log(title = "点巡检项目关联设备信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(DmsInspectProjectDeviceBo bo, HttpServletResponse response) {
List<DmsInspectProjectDeviceVo> list = dmsInspectProjectDeviceService.queryList(bo);
ExcelUtil.exportExcel(list, "点巡检项目关联物料信息", DmsInspectProjectDeviceVo.class, response);
ExcelUtil.exportExcel(list, "点巡检项目关联设备信息", DmsInspectProjectDeviceVo.class, response);
}
/**
*
*
*
* @param inspectProjectId
*/
@ -70,10 +70,10 @@ public class DmsInspectProjectDeviceController extends BaseController {
}
/**
*
*
*/
@SaCheckPermission("dms:dmsInspectProjectDevice:add")
@Log(title = "点巡检项目关联物料信息", businessType = BusinessType.INSERT)
@Log(title = "点巡检项目关联设备信息", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody DmsInspectProjectDeviceBo bo) {
@ -81,10 +81,10 @@ public class DmsInspectProjectDeviceController extends BaseController {
}
/**
*
*
*/
@SaCheckPermission("dms:dmsInspectProjectDevice:edit")
@Log(title = "点巡检项目关联物料信息", businessType = BusinessType.UPDATE)
@Log(title = "点巡检项目关联设备信息", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DmsInspectProjectDeviceBo bo) {
@ -92,12 +92,12 @@ public class DmsInspectProjectDeviceController extends BaseController {
}
/**
*
*
*
* @param inspectProjectIds
*/
@SaCheckPermission("dms:dmsInspectProjectDevice:remove")
@Log(title = "点巡检项目关联物料信息", businessType = BusinessType.DELETE)
@Log(title = "点巡检项目关联设备信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{inspectProjectIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] inspectProjectIds) {
@ -106,7 +106,7 @@ public class DmsInspectProjectDeviceController extends BaseController {
/**
*
*
*/
@GetMapping("/getDmsInspectProjectDeviceList")

@ -25,7 +25,7 @@ public class BaseDeviceType extends TenantEntity {
private static final long serialVersionUID = 1L;
/**
* ID
* ID
*/
@TableId(value = "device_type_id", type = IdType.AUTO)
private Long deviceTypeId;

@ -60,7 +60,7 @@ public class DmsBaseDeviceBom extends TenantEntity {
/**
*
*
*/
@TableField(exist = false)
private String machineName;//join映射字段

@ -60,7 +60,7 @@ public class DmsBaseDeviceDebugging extends TenantEntity {
private String remark;
/**
*
*
*/
@TableField(exist = false)
private String machineName;//JOIN

@ -72,7 +72,7 @@ public class DmsBaseDeviceDepreciation extends TenantEntity {
private String activeFlag;
/**
*
*
*/
@TableField(exist = false)
private String machineName;//join

@ -58,7 +58,7 @@ public class DmsBaseDeviceFiles extends TenantEntity {
private String remark;
/**
*
*
*/
@TableField(exist = false)
private String machineName;//JOIN

@ -56,7 +56,7 @@ public class DmsBaseDeviceInstall extends TenantEntity {
/**
*
*
*/
@TableField(exist = false)
private String machineName;//join

@ -60,7 +60,7 @@ public class DmsBaseDevicePurchase extends TenantEntity {
private String remark;
/**
*
*
*/
@TableField(exist = false)
private String machineName;//JOIN

@ -54,7 +54,7 @@ public class DmsBaseDeviceSupplies extends TenantEntity {
private String remark;
/**
*
*
*/
@TableField(exist = false)
private String machineName;//JOIN

@ -11,7 +11,7 @@ import org.dromara.common.tenant.core.TenantEntity;
import java.io.Serial;
/**
* prod_base_machine_info
* prod_base_machine_info
*
* @author zangch
* @date 2025-01-20
@ -31,12 +31,12 @@ public class DmsBaseMachineInfo extends TenantEntity {
private Long machineId;
/**
*
*
*/
private String machineCode;
/**
*
*
*/
private String machineName;
@ -46,17 +46,17 @@ public class DmsBaseMachineInfo extends TenantEntity {
private String assetNumber;
/**
*
*
*/
private String machineLocation;
/**
*
*
*/
private String machineType;
/**
*
*
*/
private String machineSpec;
@ -66,7 +66,7 @@ public class DmsBaseMachineInfo extends TenantEntity {
private String supplierId;
/**
* (0 1 2)
* (0 1 2)
*/
private String machineStatus;

@ -58,7 +58,7 @@ public class DmsBaseShutReason extends BaseEntity {
private String remark;
/**
*
*
*/
@TableField(exist = false)
private String machineName;//JOIN

@ -70,7 +70,7 @@ public class DmsBaseTransferInfo extends TenantEntity {
private String activeFlag;
/**
*
*
*/
@TableField(exist = false)
private String machineName;//JOIN

@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* dms_inspect_project_device
* dms_inspect_project_device
*
* @author zch
* @date 2025-03-24

@ -59,7 +59,7 @@ public class DmsInspectRouteDetail extends TenantEntity {
private String routeName;//JOIN
/**
*
*
*/
@TableField(exist = false)
private String machineName;//JOIN

@ -70,7 +70,7 @@ public class DmsPlanMaintDetail extends TenantEntity {
private String maintStandardCode;//JOIN
/**
*
*
*/
@TableField(exist = false)
private String machineName;//JOIN

@ -48,7 +48,7 @@ public class DmsRealtimeStatus extends TenantEntity {
private String statusValue;
/**
*
*
*/
@TableField(exist = false)
private String machineName;//JOIN

@ -82,7 +82,7 @@ public class DmsRecordShutDown extends TenantEntity {
private String remark;
/**
*
*
*/
@TableField(exist = false)
private String machineName;//JOIN

@ -18,9 +18,9 @@ import org.dromara.dms.domain.BaseDeviceType;
public class BaseDeviceTypeBo extends BaseEntity {
/**
* ID
* ID
*/
/* @NotNull(message = "物料类型ID不能为空", groups = { AddGroup.class, EditGroup.class })*/
/* @NotNull(message = "设备类型ID不能为空", groups = { AddGroup.class, EditGroup.class })*/
private Long deviceTypeId;
/**

@ -13,7 +13,7 @@ import org.dromara.dms.domain.DmsBaseMachineInfo;
import java.util.List;
/**
* prod_base_machine_info
* prod_base_machine_info
*
* @author zangch
* @date 2025-01-20
@ -29,15 +29,15 @@ public class DmsBaseMachineInfoBo extends BaseEntity {
private Long machineId;
/**
*
*
*/
@NotBlank(message = "机台编号不能为空", groups = { AddGroup.class, EditGroup.class })
@NotBlank(message = "设备编号不能为空", groups = { AddGroup.class, EditGroup.class })
private String machineCode;
/**
*
*
*/
@NotBlank(message = "机台名称不能为空", groups = { AddGroup.class, EditGroup.class })
@NotBlank(message = "设备名称不能为空", groups = { AddGroup.class, EditGroup.class })
private String machineName;
/**
@ -46,17 +46,17 @@ public class DmsBaseMachineInfoBo extends BaseEntity {
private String assetNumber;
/**
*
*
*/
private String machineLocation;
/**
*
*
*/
private String machineType;
/**
*
*
*/
private String machineSpec;
@ -66,7 +66,7 @@ public class DmsBaseMachineInfoBo extends BaseEntity {
private String supplierId;
/**
* (0 1 2)
* (0 1 2)
*/
private String machineStatus;

@ -10,7 +10,7 @@ import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
/**
* dms_inspect_project_device
* dms_inspect_project_device
*
* @author zch
* @date 2025-03-24

@ -27,9 +27,9 @@ public class BaseDeviceTypeVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
* ID
*/
@ExcelProperty(value = "物料类型ID")
@ExcelProperty(value = "设备类型ID")
private Long deviceTypeId;
/**

@ -72,9 +72,9 @@ public class DmsBaseDeviceBomVo implements Serializable {
private String remark;
/**
*
*
*/
@ExcelProperty(value = "机台名称")
@ExcelProperty(value = "设备名称")
private String machineName;//join映射字段
}

@ -74,7 +74,7 @@ public class DmsBaseDeviceDebuggingVo implements Serializable {
private String remark;
/**
*
*
*/
private String machineName;//JOIN

@ -87,9 +87,9 @@ public class DmsBaseDeviceDepreciationVo implements Serializable {
private String activeFlag;
/**
*
*
*/
@ExcelProperty(value = "机台名称")
@ExcelProperty(value = "设备名称")
private String machineName;//join
}

@ -72,7 +72,7 @@ public class DmsBaseDeviceFilesVo implements Serializable {
private String remark;
/**
*
*
*/
private String machineName;//JOIN

@ -68,9 +68,9 @@ public class DmsBaseDeviceInstallVo implements Serializable {
private String activeFlag;
/**
*
*
*/
@ExcelProperty(value = "机台名称")
@ExcelProperty(value = "设备名称")
private String machineName;//join
}

@ -73,9 +73,9 @@ public class DmsBaseDevicePurchaseVo implements Serializable {
private String remark;
/**
*
*
*/
@ExcelProperty(value = "机台名称")
@ExcelProperty(value = "设备名称")
private String machineName;//JOIN
}

@ -66,7 +66,7 @@ public class DmsBaseDeviceSuppliesVo implements Serializable {
private String remark;
/**
*
*
*/
private String machineName;//JOIN

@ -15,7 +15,7 @@ import java.util.List;
/**
* prod_base_machine_info
* prod_base_machine_info
*
* @author zangch
* @date 2025-01-20
@ -41,15 +41,15 @@ public class DmsBaseMachineInfoVo implements Serializable {
private String tenantId;
/**
*
*
*/
@ExcelProperty(value = "机台编号")
@ExcelProperty(value = "设备编号")
private String machineCode;
/**
*
*
*/
@ExcelProperty(value = "机台名称")
@ExcelProperty(value = "设备名称")
private String machineName;
/**
@ -59,21 +59,21 @@ public class DmsBaseMachineInfoVo implements Serializable {
private String assetNumber;
/**
*
*
*/
@ExcelProperty(value = "机台位置")
@ExcelProperty(value = "设备位置")
private String machineLocation;
/**
*
*
*/
@ExcelProperty(value = "机台类型")
@ExcelProperty(value = "设备类型")
private String machineType;
/**
*
*
*/
@ExcelProperty(value = "机台规格")
@ExcelProperty(value = "设备规格")
private String machineSpec;
/**
@ -83,9 +83,9 @@ public class DmsBaseMachineInfoVo implements Serializable {
private String supplierId;
/**
* (0 1 2)
* (0 1 2)
*/
@ExcelProperty(value = "机台状态(0停用 1启用 2报废)", converter = ExcelDictConvert.class)
@ExcelProperty(value = "设备状态(0停用 1启用 2报废)", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "machine_status")
private String machineStatus;

@ -72,7 +72,7 @@ public class DmsBaseShutReasonVo implements Serializable {
private String remark;
/**
*
*
*/
private String machineName;//JOIN

@ -86,9 +86,9 @@ public class DmsBaseTransferInfoVo implements Serializable {
private String activeFlag;
/**
*
*
*/
@ExcelProperty(value = "机台名称")
@ExcelProperty(value = "设备名称")
private String machineName;//JOIN
}

@ -15,7 +15,7 @@ import java.util.Date;
/**
* dms_inspect_project_device
* dms_inspect_project_device
*
* @author zch
* @date 2025-03-24

@ -71,7 +71,7 @@ public class DmsInspectRouteDetailVo implements Serializable {
private String routeName;//JOIN
/**
*
*
*/
private String machineName;//JOIN

@ -81,7 +81,7 @@ public class DmsPlanMaintDetailVo implements Serializable {
private String maintStandardCode;//JOIN
/**
*
*
*/
private String machineName;//JOIN

@ -59,7 +59,7 @@ public class DmsRealtimeStatusVo implements Serializable {
private String statusValue;
/**
*
*
*/
private String machineName;//JOIN

@ -97,7 +97,7 @@ public class DmsRecordShutDownVo implements Serializable {
private String remark;
/**
*
*
*/
private String machineName;//JOIN

@ -5,7 +5,7 @@ import org.dromara.dms.domain.DmsBaseMachineInfo;
import org.dromara.dms.domain.vo.DmsBaseMachineInfoVo;
/**
* Mapper
* Mapper
*
* @author zangch
* @date 2025-01-20

@ -4,7 +4,7 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.dms.domain.DmsBaseMachineInfo;
/**
* ()Mapper
* ()Mapper
*
* @author Yinq
* @date 2025-03-11

@ -5,7 +5,7 @@ import org.dromara.dms.domain.vo.DmsInspectProjectDeviceVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* Mapper
* Mapper
*
* @author zch
* @date 2025-03-24

@ -9,7 +9,7 @@ import java.util.Collection;
import java.util.List;
/**
* Service
* Service
*
* @author zangch
* @date 2025-01-20
@ -17,48 +17,48 @@ import java.util.List;
public interface IDmsBaseMachineInfoService {
/**
*
*
*
* @param machineId
* @return
* @return
*/
DmsBaseMachineInfoVo queryById(Long machineId);
/**
*
*
*
* @param bo
* @param pageQuery
* @return
* @return
*/
TableDataInfo<DmsBaseMachineInfoVo> queryPageList(DmsBaseMachineInfoBo bo, PageQuery pageQuery);
/**
*
*
*
* @param bo
* @return
* @return
*/
List<DmsBaseMachineInfoVo> queryList(DmsBaseMachineInfoBo bo);
/* *//**
*
*
*
* @param bo
* @param bo
* @return
*//*
Boolean insertByBo(DmsBaseMachineInfoBo bo);
*//**
*
*
*
* @param bo
* @param bo
* @return
*//*
Boolean updateByBo(DmsBaseMachineInfoBo bo);
*//**
*
*
*
* @param ids
* @param isValid

@ -1,13 +1,9 @@
package org.dromara.dms.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -15,16 +11,14 @@ import org.dromara.dms.domain.DmsBaseMachineInfo;
import org.dromara.dms.domain.bo.DmsBaseMachineInfoBo;
import org.dromara.dms.domain.vo.DmsBaseMachineInfoVo;
import org.dromara.dms.mapper.DmsBaseMachineInfoMapper;
import org.dromara.dms.service.IDmsBaseMachineInfoService;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* Service
* Service
*
* @author zangch
* @date 2025-01-20
@ -37,10 +31,10 @@ public class DmsBaseMachineInfoServiceImpl implements IDmsBaseMachineInfoService
/**
*
*
*
* @param machineId
* @return
* @return
*/
@Override
public DmsBaseMachineInfoVo queryById(Long machineId) {
@ -48,16 +42,22 @@ public class DmsBaseMachineInfoServiceImpl implements IDmsBaseMachineInfoService
bo.setMachineId(machineId);
MPJLambdaWrapper<DmsBaseMachineInfo> lqw = buildQueryWrapper(bo);
DmsBaseMachineInfoVo prodBaseMachineInfoVo = baseMapper.selectVoOne(lqw);
//机台关联工序
/* MPJLambdaWrapper<ProdBaseMachineProcess> lqwRelation = JoinWrappers.lambda(ProdBaseMachineProcess.class)
.selectAll(ProdBaseMachineProcess.class)
.eq(bo.getMachineId() != null, ProdBaseMachineProcess::getMachineId, bo.getMachineId())
.orderByAsc(ProdBaseMachineProcess::getCreateTime);
List<ProdBaseMachineProcess> prodBaseMachineProcesses = prodBaseMachineProcessMapper.selectList(lqwRelation);
prodBaseMachineInfoVo.setBaseMachineProcessList(prodBaseMachineProcesses);*/
return prodBaseMachineInfoVo;
}
/**
*
*
*
* @param bo
* @param pageQuery
* @return
* @return
*/
@Override
public TableDataInfo<DmsBaseMachineInfoVo> queryPageList(DmsBaseMachineInfoBo bo, PageQuery pageQuery) {
@ -67,10 +67,10 @@ public class DmsBaseMachineInfoServiceImpl implements IDmsBaseMachineInfoService
}
/**
*
*
*
* @param bo
* @return
* @return
*/
@Override
public List<DmsBaseMachineInfoVo> queryList(DmsBaseMachineInfoBo bo) {
@ -83,6 +83,10 @@ public class DmsBaseMachineInfoServiceImpl implements IDmsBaseMachineInfoService
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<DmsBaseMachineInfo> lqw = JoinWrappers.lambda(DmsBaseMachineInfo.class)
.selectAll(DmsBaseMachineInfo.class)
/* .select(ProdBaseWorkshopInfo::getWorkshopName)
.select(ProdBaseDeviceMode::getDeviceModeName)
.leftJoin(ProdBaseWorkshopInfo.class, ProdBaseWorkshopInfo::getWorkshopId, ProdBaseMachineInfo::getWorkshopId)
.leftJoin(ProdBaseDeviceMode.class, ProdBaseDeviceMode::getDeviceModeId, ProdBaseMachineInfo::getDeviceModeId)*/
.eq(bo.getMachineId() != null, DmsBaseMachineInfo::getMachineId, bo.getMachineId())
.like(StringUtils.isNotBlank(bo.getMachineCode()), DmsBaseMachineInfo::getMachineCode, bo.getMachineCode())
.like(StringUtils.isNotBlank(bo.getMachineName()), DmsBaseMachineInfo::getMachineName, bo.getMachineName())
@ -97,9 +101,9 @@ public class DmsBaseMachineInfoServiceImpl implements IDmsBaseMachineInfoService
}
/* *//**
*
*
*
* @param bo
* @param bo
* @return
*//*
@Override
@ -114,9 +118,9 @@ public class DmsBaseMachineInfoServiceImpl implements IDmsBaseMachineInfoService
}
*//**
*
*
*
* @param bo
* @param bo
* @return
*//*
@Override
@ -145,7 +149,7 @@ public class DmsBaseMachineInfoServiceImpl implements IDmsBaseMachineInfoService
}
*//**
*
*
*
* @param ids
* @param isValid

@ -1,33 +1,31 @@
package org.dromara.dms.service.impl;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
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.dms.domain.DmsBaseDeviceInstall;
import org.dromara.dms.domain.DmsBaseMachineInfo;
import org.dromara.dms.mapper.DmsBaseDeviceInstallMapper;
import org.dromara.dms.mapper.DmsBaseMachineInfoMapper;
import org.springframework.stereotype.Service;
import org.dromara.dms.domain.DmsBaseTransferInfo;
import org.dromara.dms.domain.bo.DmsBaseTransferInfoBo;
import org.dromara.dms.domain.vo.DmsBaseTransferInfoVo;
import org.dromara.dms.domain.DmsBaseTransferInfo;
import org.dromara.dms.mapper.DmsBaseDeviceInstallMapper;
import org.dromara.dms.mapper.DmsBaseMachineInfoMapper;
import org.dromara.dms.mapper.DmsBaseTransferInfoMapper;
import org.dromara.dms.service.IDmsBaseTransferInfoService;
import org.dromara.common.core.exception.ServiceException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.stream.Collectors;
/**
* Service
@ -153,6 +151,7 @@ public class DmsBaseTransferInfoServiceImpl implements IDmsBaseTransferInfoServi
}
// 2. 校验转移前必须有安装位置
//设备安装时会赋值给设备信息表的设备位置;新增或修改转移信息时,前端会将设备信息的设备位置赋值给转移信息的旧位置(自动赋值,不可编辑)
if (StringUtils.isBlank(entity.getDevicePosition())) {
throw new ServiceException("转移前必须有安装位置");
}
@ -161,11 +160,12 @@ public class DmsBaseTransferInfoServiceImpl implements IDmsBaseTransferInfoServi
if (entity.getDeviceTransferTime() != null) {
//校验转移时间不能小于之前记录的安装时间
//理论上安装记录只有一条,即使不止一条,只是查询时间最晚的实体也可以完成逻辑,保险点用列表,后续影响性能再优化
List<DmsBaseDeviceInstall> installRecords = dmsBaseDeviceInstallMapper.selectList(
JoinWrappers.lambda(DmsBaseDeviceInstall.class)
.eq(DmsBaseDeviceInstall::getMachineId, entity.getMachineId())
.select(DmsBaseDeviceInstall::getInstallTime)
.orderByAsc(DmsBaseDeviceInstall::getInstallTime)
.orderByDesc(DmsBaseDeviceInstall::getInstallTime)
);
boolean hasInvalidInstallTime = installRecords.stream()
@ -178,7 +178,7 @@ public class DmsBaseTransferInfoServiceImpl implements IDmsBaseTransferInfoServi
}
// 使用分页功能限制记录数量
Page<DmsBaseTransferInfo> page = new Page<>(1, 100);
Page<DmsBaseTransferInfo> page = new Page<>(1, 30);
IPage<DmsBaseTransferInfo> resultPage = baseMapper.selectPage(page,
Wrappers.<DmsBaseTransferInfo>lambdaQuery()
.select(DmsBaseTransferInfo::getDeviceTransferTime)

@ -21,7 +21,7 @@ import java.util.Map;
import java.util.Collection;
/**
* Service
* Service
*
* @author zch
* @date 2025-03-24
@ -33,10 +33,10 @@ public class DmsInspectProjectDeviceServiceImpl implements IDmsInspectProjectDev
private final DmsInspectProjectDeviceMapper baseMapper;
/**
*
*
*
* @param inspectProjectId
* @return
* @return
*/
@Override
public DmsInspectProjectDeviceVo queryById(Long inspectProjectId){
@ -44,11 +44,11 @@ public class DmsInspectProjectDeviceServiceImpl implements IDmsInspectProjectDev
}
/**
*
*
*
* @param bo
* @param pageQuery
* @return
* @return
*/
@Override
public TableDataInfo<DmsInspectProjectDeviceVo> queryPageList(DmsInspectProjectDeviceBo bo, PageQuery pageQuery) {
@ -58,10 +58,10 @@ public class DmsInspectProjectDeviceServiceImpl implements IDmsInspectProjectDev
}
/**
*
*
*
* @param bo
* @return
* @return
*/
@Override
public List<DmsInspectProjectDeviceVo> queryList(DmsInspectProjectDeviceBo bo) {
@ -81,9 +81,9 @@ public class DmsInspectProjectDeviceServiceImpl implements IDmsInspectProjectDev
}
/**
*
*
*
* @param bo
* @param bo
* @return
*/
@Override
@ -98,9 +98,9 @@ public class DmsInspectProjectDeviceServiceImpl implements IDmsInspectProjectDev
}
/**
*
*
*
* @param bo
* @param bo
* @return
*/
@Override
@ -118,7 +118,7 @@ public class DmsInspectProjectDeviceServiceImpl implements IDmsInspectProjectDev
}
/**
*
*
*
* @param ids
* @param isValid

@ -0,0 +1,63 @@
package org.dromara.dms.utils;
import org.quartz.CronExpression;
import java.text.ParseException;
import java.util.Date;
/**
* cron
*
* @author ruoyi
*
*/
public class CronUtils
{
/**
* Cron
*
* @param cronExpression Cron
* @return boolean
*/
public static boolean isValid(String cronExpression)
{
return CronExpression.isValidExpression(cronExpression);
}
/**
* ,Cron
*
* @param cronExpression Cron
* @return String ,null
*/
public static String getInvalidMessage(String cronExpression)
{
try
{
new CronExpression(cronExpression);
return null;
}
catch (ParseException pe)
{
return pe.getMessage();
}
}
/**
* Cron
*
* @param cronExpression Cron
* @return Date Cron
*/
public static Date getNextExecution(String cronExpression)
{
try
{
CronExpression cron = new CronExpression(cronExpression);
return cron.getNextValidTimeAfter(new Date(System.currentTimeMillis()));
}
catch (ParseException e)
{
throw new IllegalArgumentException(e.getMessage());
}
}
}

@ -0,0 +1,73 @@
package org.dromara.dms.utils;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.poi.ss.usermodel.Workbook;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.Map;
import net.sf.jxls.transformer.XLSTransformer;
public class TemplateExcelUtils {
/**
*
* @param fileName
* @param sourcePath resource/template
* @param beanParams
* @param response HTTP
* @throws Exception
*/
public static void downLoadExcel(String fileName, String sourcePath, Map<String, Object> beanParams, HttpServletResponse response)
throws Exception {
try{
// 获取输出流用于写入生成的Excel文件
OutputStream os = getOutputStream(fileName,response);
// 读取模板文件
InputStream is = TemplateExcelUtils.class.getResourceAsStream("/weixiu.xlsx");
XLSTransformer transformer = new XLSTransformer();
// 向模板中写入内容生成新的Workbook对象
Workbook workbook = transformer.transformXLS(is, beanParams);
// 将生成的Workbook对象写入输出流
workbook.write(os);
}catch (Exception e){
// 捕获并打印异常信息
e.printStackTrace();
// 抛出异常
throw e;
}
}
/**
* WriterOutputStream.
* @param fileName
* @param response response
* @return ""
*/
private static OutputStream getOutputStream(String fileName,
HttpServletResponse response) throws Exception {
try {
// 对文件名进行URL编码防止特殊字符导致的问题
fileName = URLEncoder.encode(fileName, "UTF-8");
// 设置响应内容类型为Excel文件格式
response.setContentType("application/vnd.ms-excel");
// 设置响应的字符编码为UTF-8
response.setCharacterEncoding("utf8");
// 设置响应头,指示浏览器以附件形式下载文件,并指定文件名
response.setHeader("Content-Disposition", "attachment; filename=" + fileName + ".xls");
// 设置响应头,指示缓存策略为公共缓存
response.setHeader("Pragma", "public");
// 设置响应头,指示不缓存
response.setHeader("Cache-Control", "no-store");
// 添加响应头指示缓存的最大年龄为0
response.addHeader("Cache-Control", "max-age=0");
// 返回响应的输出流,用于写入数据到客户端
return response.getOutputStream();
} catch (IOException e) {
// 捕获IO异常抛出自定义异常信息
throw new Exception("导出excel表格失败!", e);
}
}
}
Loading…
Cancel
Save