parent
ebc6eb5933
commit
8fcee4fe66
12 changed files with 596 additions and 143 deletions
@ -0,0 +1,38 @@ |
||||
package org.springblade.job.processor.device; |
||||
|
||||
import jakarta.annotation.Resource; |
||||
import lombok.Data; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.desk.device.feign.LimsMeaToolTaskClient; |
||||
import org.springframework.stereotype.Component; |
||||
import tech.powerjob.worker.core.processor.ProcessResult; |
||||
import tech.powerjob.worker.core.processor.TaskContext; |
||||
import tech.powerjob.worker.core.processor.sdk.BasicProcessor; |
||||
|
||||
import java.util.concurrent.CompletableFuture; |
||||
|
||||
/** |
||||
* 同步量具计量记录数据任务 |
||||
*/ |
||||
@Data |
||||
@Component |
||||
@Slf4j |
||||
public class LimsMeaToolProcessor implements BasicProcessor { |
||||
|
||||
@Resource |
||||
private LimsMeaToolTaskClient limsMeaToolTaskClient; |
||||
|
||||
@Override |
||||
public ProcessResult process(TaskContext context) throws Exception { |
||||
log.info("同步量具计量记录数据任务开始"); |
||||
CompletableFuture<Void> runFuture = CompletableFuture.runAsync(() -> limsMeaToolTaskClient.syncMeasurementRecordsTask()); |
||||
runFuture.whenComplete((result, exception) -> { |
||||
if (exception != null) { |
||||
log.error("同步量具计量记录数据任务失败", exception); |
||||
} else { |
||||
log.info("同步量具计量记录数据任务完毕"); |
||||
} |
||||
}); |
||||
return new ProcessResult(true); |
||||
} |
||||
} |
||||
@ -0,0 +1,25 @@ |
||||
package org.springblade.desk.device.feign; |
||||
|
||||
import org.springblade.core.launch.constant.AppConstant; |
||||
import org.springframework.cloud.openfeign.FeignClient; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
||||
@FeignClient( |
||||
value = AppConstant.APPLICATION_DESK_NAME |
||||
) |
||||
/** |
||||
* 同步Lims量具相关信息 |
||||
*/ |
||||
public interface LimsMeaToolTaskClient { |
||||
|
||||
String API_PREFIX = "/feign/device/lims-task"; |
||||
|
||||
String SYNC_MEASUREMENT_RECORDS_TASK = API_PREFIX + "/sync-measurement-records-task"; |
||||
|
||||
|
||||
/** |
||||
* 同步量具数据 |
||||
*/ |
||||
@GetMapping(SYNC_MEASUREMENT_RECORDS_TASK) |
||||
void syncMeasurementRecordsTask(); |
||||
} |
||||
@ -1,140 +1,183 @@ |
||||
package org.springblade.desk.device.pojo.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import jakarta.validation.constraints.NotNull; |
||||
import lombok.Data; |
||||
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
import lombok.EqualsAndHashCode; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springblade.core.tenant.mp.TenantEntity; |
||||
|
||||
import java.util.Date; |
||||
import java.io.Serial; |
||||
|
||||
/** |
||||
* 计量记录 实体类 |
||||
* 量具计量记录 实体类 |
||||
* |
||||
* @author qyl |
||||
* @since 2026年1月4日 |
||||
* @since 2026-03-03 |
||||
*/ |
||||
@Data |
||||
@Schema(description = "计量记录对象") |
||||
@TableName("MES_MEASUREMENT_RECORDS") |
||||
@Schema(description = "MeasurementRecords对象") |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class MeasurementRecordsEntity extends BaseEntity { |
||||
@Schema(name = "名称(设备名称)") |
||||
//@Column(name = "MC_NAME")
|
||||
private String mcName; |
||||
|
||||
@Schema(name = "规格") |
||||
//@Column(name = "NORMS")
|
||||
private String norms; |
||||
@Serial |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@Schema(name = "类别(管理类别)") |
||||
//@Column(name = "MC_CLASS")
|
||||
/** |
||||
* 名称(设备名称) |
||||
*/ |
||||
@Schema(description = "名称(设备名称)") |
||||
private String mcName; |
||||
/** |
||||
* 规格 |
||||
*/ |
||||
@Schema(description = "规格") |
||||
private String norms; |
||||
/** |
||||
* 类别(管理类别) |
||||
*/ |
||||
@Schema(description = "类别(管理类别)") |
||||
private String mcClass; |
||||
|
||||
@Schema(name = "计量类型") |
||||
//@Column(name = "LABEL_NO")
|
||||
/** |
||||
* 计量类型 |
||||
*/ |
||||
@Schema(description = "计量类型") |
||||
private String labelNo; |
||||
|
||||
@Schema(name = "计量子类型") |
||||
//@Column(name = "STR2")
|
||||
/** |
||||
* 计量子类型 |
||||
*/ |
||||
@Schema(description = "计量子类型") |
||||
private String str2; |
||||
|
||||
@Schema(name = "编号(测量设备编码)") |
||||
//@Column(name = "MC_CODE")
|
||||
/** |
||||
* 编号(测量设备编码) |
||||
*/ |
||||
@Schema(description = "编号(测量设备编码)") |
||||
@NotNull(message = "编号不能为空") |
||||
private String mcCode; |
||||
|
||||
@Schema(name = "使用单位(试用部门)") |
||||
//@Column(name = "USE_UNIT")
|
||||
/** |
||||
* 使用单位(试用部门) |
||||
*/ |
||||
@Schema(description = "使用单位(试用部门)") |
||||
private String useUnit; |
||||
|
||||
@Schema(name = "精度(精度等级)") |
||||
//@Column(name = "ACCURACY")
|
||||
/** |
||||
* 精度(精度等级) |
||||
*/ |
||||
@Schema(description = "精度(精度等级)") |
||||
private String accuracy; |
||||
|
||||
@Schema(name = "出厂编号") |
||||
//@Column(name = "OEM_CODE")
|
||||
/** |
||||
* 出厂编号 |
||||
*/ |
||||
@Schema(description = "出厂编号") |
||||
private String oemCode; |
||||
|
||||
@Schema(name = "生产厂家(制造厂商)") |
||||
//@Column(name = "MC_OEM")
|
||||
/** |
||||
* 生产厂家(制造厂商) |
||||
*/ |
||||
@Schema(description = "生产厂家(制造厂商)") |
||||
private String mcOem; |
||||
|
||||
@Schema(name = "启用日期") |
||||
//@Column(name = "ENABLE_DATE")
|
||||
/** |
||||
* 启用日期 |
||||
*/ |
||||
@Schema(description = "启用日期") |
||||
private Date enableDate; |
||||
|
||||
@Schema(name = "检定日期") |
||||
//@Column(name = "WHEN_DCCEPT")
|
||||
/** |
||||
* 检定日期 |
||||
*/ |
||||
@Schema(description = "检定日期") |
||||
private String whenDccept; |
||||
|
||||
@Schema(name = "型号(型号)") |
||||
//@Column(name = "MC_TYPE")
|
||||
/** |
||||
* 型号(型号) |
||||
*/ |
||||
@Schema(description = "型号(型号)") |
||||
private String mcType; |
||||
|
||||
@Schema(name = "检定周期(检定周期)") |
||||
//@Column(name = "TEST_CYCLE")
|
||||
/** |
||||
* 检定周期(检定周期) |
||||
*/ |
||||
@Schema(description = "检定周期(检定周期)") |
||||
private Integer testCycle; |
||||
|
||||
@Schema(name = "到期日期(有效日期)") |
||||
//@Column(name = "DUE_DATE")
|
||||
/** |
||||
* 到期日期(有效日期) |
||||
*/ |
||||
@Schema(description = "到期日期(有效日期)") |
||||
private Date dueDate; |
||||
|
||||
@Schema(name = "报废日期") |
||||
//@Column(name = "DATE2")
|
||||
/** |
||||
* 报废日期 |
||||
*/ |
||||
@Schema(description = "报废日期") |
||||
private Date date2; |
||||
|
||||
@Schema(name = "状态") |
||||
//@Column(name = "BELONG")
|
||||
/** |
||||
* 状态 |
||||
*/ |
||||
@Schema(description = "状态") |
||||
private String belong; |
||||
|
||||
@Schema(name = "停用日期") |
||||
//@Column(name = "WHEN_BUY")
|
||||
/** |
||||
* 停用日期 |
||||
*/ |
||||
@Schema(description = "停用日期") |
||||
private Date whenBuy; |
||||
|
||||
@Schema(name = "检定部门") |
||||
//@Column(name = "TEST_DEPT")
|
||||
/** |
||||
* 检定部门 |
||||
*/ |
||||
@Schema(description = "检定部门") |
||||
private String testDept; |
||||
|
||||
@Schema(name = "检定/校验方法(检定校准方法)") |
||||
//@Column(name = "TEST_METHOD")
|
||||
/** |
||||
* 检定/校验方法(检定校准方法) |
||||
*/ |
||||
@Schema(description = "检定/校验方法(检定校准方法)") |
||||
private String testMethod; |
||||
|
||||
@Schema(name = "备注") |
||||
//@Column(name = "STR9")
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
@Schema(description = "备注") |
||||
private String str9; |
||||
|
||||
@Schema(name = "备注2") |
||||
//@Column(name = "STR10")
|
||||
/** |
||||
* 备注2 |
||||
*/ |
||||
@Schema(description = "备注2") |
||||
private String str10; |
||||
|
||||
@Schema(name = "使用人工号") |
||||
//@Column(name = "ASSETS_NO")
|
||||
/** |
||||
* 使用人工号 |
||||
*/ |
||||
@Schema(description = "使用人工号") |
||||
private String assetsNo; |
||||
|
||||
@Schema(name = "责任人") |
||||
//@Column(name = "STR6")
|
||||
/** |
||||
* 责任人 |
||||
*/ |
||||
@Schema(description = "责任人") |
||||
private String str6; |
||||
|
||||
@Schema(name = "用途分类") |
||||
//@Column(name = "PURPOSE_CLASS")
|
||||
/** |
||||
* 用途分类 |
||||
*/ |
||||
@Schema(description = "用途分类") |
||||
private String purposeClass; |
||||
|
||||
@Schema(name = "超期情况") |
||||
//@Column(name = "IS_OVER_STR")
|
||||
/** |
||||
* 超期情况 |
||||
*/ |
||||
@Schema(description = "超期情况") |
||||
private String isOverStr; |
||||
/** |
||||
* 类型1、仪表计量;2、设备计量 |
||||
*/ |
||||
@Schema(description = "类型1、仪表计量;2、设备计量") |
||||
private Integer cmType; |
||||
/** |
||||
* 是否送检1:是,0:否 |
||||
*/ |
||||
@Schema(description = "是否送检1:是,0:否") |
||||
private String censorship; |
||||
/** |
||||
* 检验状态1:在检,0:未检 |
||||
*/ |
||||
@Schema(description = "检验状态1:在检,0:未检") |
||||
private String checkStatus; |
||||
/** |
||||
* 检验结果1:合格,0:不合格 |
||||
*/ |
||||
@Schema(description = "检验结果1:合格,0:不合格") |
||||
private String checkResult; |
||||
|
||||
@Schema(name = "类型", title = "1、仪表计量;2、设备计量") |
||||
//@Column(name = "CM_TYPE")
|
||||
private Short cmType; |
||||
|
||||
@Schema(name = "是否送检", title = "1:是,0:否") |
||||
//@Column(name = "CENSORSHIP")
|
||||
private Boolean censorship; |
||||
|
||||
@Schema(name = "检验状态", title = "1:在检,0:未检") |
||||
//@Column(name = "CHECK_STATUS")
|
||||
private Boolean checkStatus; |
||||
|
||||
@Schema(name = "检验结果", title = "1:合格,0:不合格") |
||||
//@Column(name = "CHECK_RESULT")
|
||||
private Boolean checkResult; |
||||
} |
||||
|
||||
@ -0,0 +1,21 @@ |
||||
package org.springblade.desk.device.pojo.vo; |
||||
|
||||
import org.springblade.desk.device.pojo.entity.MeasurementRecordsEntity; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
import java.io.Serial; |
||||
|
||||
/** |
||||
* 量具计量记录 视图实体类 |
||||
* |
||||
* @author qyl |
||||
* @since 2026-03-03 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class MeasurementRecordsVO extends MeasurementRecordsEntity { |
||||
@Serial |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
} |
||||
@ -0,0 +1,23 @@ |
||||
package org.springblade.desk.device.feign; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import io.swagger.v3.oas.annotations.Hidden; |
||||
import jakarta.annotation.Resource; |
||||
import org.springblade.desk.device.pojo.entity.MeasurementRecordsEntity; |
||||
import org.springblade.desk.device.service.IMeasurementRecordsService; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
@RestController |
||||
@Hidden |
||||
public class LimsMeaToolTaskClientImpl implements LimsMeaToolTaskClient { |
||||
|
||||
@Resource |
||||
private IMeasurementRecordsService measurementRecordsService; |
||||
|
||||
@Override |
||||
public void syncMeasurementRecordsTask() { |
||||
IPage<MeasurementRecordsEntity> page = new Page<>(1, 9999); |
||||
measurementRecordsService.syncMeasurementRecords(page, 1); |
||||
} |
||||
} |
||||
@ -0,0 +1,39 @@ |
||||
package org.springblade.desk.device.mapper; |
||||
|
||||
import org.springblade.desk.device.pojo.entity.MeasurementRecordsEntity; |
||||
import org.springblade.desk.device.pojo.excel.MeasurementRecordsExcel; |
||||
import org.springblade.desk.device.pojo.vo.MeasurementRecordsVO; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 量具计量记录 Mapper 接口 |
||||
* |
||||
* @author qyl |
||||
* @since 2026-03-03 |
||||
*/ |
||||
public interface MeasurementRecordsMapper extends BaseMapper<MeasurementRecordsEntity> { |
||||
|
||||
/** |
||||
* 自定义分页 |
||||
* |
||||
* @param page 分页参数 |
||||
* @param mesMeasurementRecords 查询参数 |
||||
* @return List<MeasurementRecordsVO> |
||||
*/ |
||||
List<MeasurementRecordsVO> selectMeasurementRecordsPage(IPage page, MeasurementRecordsVO mesMeasurementRecords); |
||||
|
||||
|
||||
/** |
||||
* 获取导出数据 |
||||
* |
||||
* @param queryWrapper 查询条件 |
||||
* @return List<MeasurementRecordsExcel> |
||||
*/ |
||||
List<MeasurementRecordsExcel> exportMeasurementRecords(@Param("ew") Wrapper<MeasurementRecordsEntity> queryWrapper); |
||||
|
||||
} |
||||
@ -0,0 +1,62 @@ |
||||
<?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.springblade.desk.device.mapper.MeasurementRecordsMapper"> |
||||
|
||||
<!-- 通用查询映射结果 --> |
||||
<resultMap id="mesMeasurementRecordsResultMap" |
||||
type="org.springblade.desk.device.pojo.entity.MeasurementRecordsEntity"> |
||||
<result column="ID" property="id"/> |
||||
<result column="TENANT_ID" property="tenantId"/> |
||||
<result column="CREATE_USER" property="createUser"/> |
||||
<result column="CREATE_TIME" property="createTime"/> |
||||
<result column="CREATE_DEPT" property="createDept"/> |
||||
<result column="UPDATE_USER" property="updateUser"/> |
||||
<result column="UPDATE_TIME" property="updateTime"/> |
||||
<result column="STATUS" property="status"/> |
||||
<result column="IS_DELETED" property="isDeleted"/> |
||||
<result column="MC_NAME" property="mcName"/> |
||||
<result column="NORMS" property="norms"/> |
||||
<result column="MC_CLASS" property="mcClass"/> |
||||
<result column="LABEL_NO" property="labelNo"/> |
||||
<result column="STR2" property="str2"/> |
||||
<result column="MC_CODE" property="mcCode"/> |
||||
<result column="USE_UNIT" property="useUnit"/> |
||||
<result column="ACCURACY" property="accuracy"/> |
||||
<result column="OEM_CODE" property="oemCode"/> |
||||
<result column="MC_OEM" property="mcOem"/> |
||||
<result column="ENABLE_DATE" property="enableDate"/> |
||||
<result column="WHEN_DCCEPT" property="whenDccept"/> |
||||
<result column="MC_TYPE" property="mcType"/> |
||||
<result column="TEST_CYCLE" property="testCycle"/> |
||||
<result column="DUE_DATE" property="dueDate"/> |
||||
<result column="DATE2" property="date2"/> |
||||
<result column="BELONG" property="belong"/> |
||||
<result column="WHEN_BUY" property="whenBuy"/> |
||||
<result column="TEST_DEPT" property="testDept"/> |
||||
<result column="TEST_METHOD" property="testMethod"/> |
||||
<result column="STR9" property="str9"/> |
||||
<result column="STR10" property="str10"/> |
||||
<result column="ASSETS_NO" property="assetsNo"/> |
||||
<result column="STR6" property="str6"/> |
||||
<result column="PURPOSE_CLASS" property="purposeClass"/> |
||||
<result column="IS_OVER_STR" property="isOverStr"/> |
||||
<result column="CM_TYPE" property="cmType"/> |
||||
<result column="CENSORSHIP" property="censorship"/> |
||||
<result column="CHECK_STATUS" property="checkStatus"/> |
||||
<result column="CHECK_RESULT" property="checkResult"/> |
||||
</resultMap> |
||||
|
||||
|
||||
<select id="selectMeasurementRecordsPage" resultMap="mesMeasurementRecordsResultMap"> |
||||
select * |
||||
from MES_MEASUREMENT_RECORDS |
||||
where is_deleted = 0 |
||||
</select> |
||||
|
||||
|
||||
<select id="exportMeasurementRecords" resultType="org.springblade.desk.device.pojo.excel.MeasurementRecordsExcel"> |
||||
SELECT * |
||||
FROM MES_MEASUREMENT_RECORDS ${ew.customSqlSegment} |
||||
</select> |
||||
|
||||
</mapper> |
||||
@ -0,0 +1,35 @@ |
||||
package org.springblade.desk.device.wrapper; |
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper; |
||||
import org.springblade.core.tool.utils.BeanUtil; |
||||
import org.springblade.desk.device.pojo.entity.MeasurementRecordsEntity; |
||||
import org.springblade.desk.device.pojo.vo.MeasurementRecordsVO; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
/** |
||||
* 量具计量记录 包装类,返回视图层所需的字段 |
||||
* |
||||
* @author qyl |
||||
* @since 2026-03-03 |
||||
*/ |
||||
public class MeasurementRecordsWrapper extends BaseEntityWrapper<MeasurementRecordsEntity, MeasurementRecordsVO> { |
||||
|
||||
public static MeasurementRecordsWrapper build() { |
||||
return new MeasurementRecordsWrapper(); |
||||
} |
||||
|
||||
@Override |
||||
public MeasurementRecordsVO entityVO(MeasurementRecordsEntity mesMeasurementRecords) { |
||||
MeasurementRecordsVO mesMeasurementRecordsVO = Objects.requireNonNull(BeanUtil.copyProperties(mesMeasurementRecords, MeasurementRecordsVO.class)); |
||||
|
||||
//User createUser = UserCache.getUser(mesMeasurementRecords.getCreateUser());
|
||||
//User updateUser = UserCache.getUser(mesMeasurementRecords.getUpdateUser());
|
||||
//mesMeasurementRecordsVO.setCreateUserName(createUser.getName());
|
||||
//mesMeasurementRecordsVO.setUpdateUserName(updateUser.getName());
|
||||
|
||||
return mesMeasurementRecordsVO; |
||||
} |
||||
|
||||
|
||||
} |
||||
Loading…
Reference in new issue