Merge remote-tracking branch 'origin/master'

This commit is contained in:
sxu 2024-09-04 09:34:53 +08:00
commit 4120111a98
6 changed files with 47 additions and 4 deletions

View File

@ -21,7 +21,7 @@ public class MaMachineIntelligentVO extends BaseEntity {
private String remarks; private String remarks;
@ApiModelProperty(value = "工器具编码") @ApiModelProperty(value = "工器具编码")
private String deviceCode; private String deviceCode; //like CSG-A101-2024061900001
@ApiModelProperty(value = "规格型号") @ApiModelProperty(value = "规格型号")
private String specificationType; private String specificationType;
@ -41,6 +41,9 @@ public class MaMachineIntelligentVO extends BaseEntity {
@ApiModelProperty(value = "所属单位") @ApiModelProperty(value = "所属单位")
private String affiliatedUnitName; private String affiliatedUnitName;
@ApiModelProperty(value = "企业机构代码(统一社会信用代码)")
private String socialCreditCode; //公司信息必填
@ApiModelProperty(value = "默认1:智慧工程系统 2:第三方数据") @ApiModelProperty(value = "默认1:智慧工程系统 2:第三方数据")
private Integer source; private Integer source;

View File

@ -108,6 +108,11 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
return DateFormatUtils.format(now, "yyyyMMdd"); return DateFormatUtils.format(now, "yyyyMMdd");
} }
public static final String getDateTimeString(Date date)
{
return DateFormatUtils.format(date, "yyyyMMdd");
}
/** /**
* 日期型字符串转化为日期 格式 * 日期型字符串转化为日期 格式
*/ */

View File

@ -1,11 +1,13 @@
package com.bonus.sgzb.common.core.utils; package com.bonus.sgzb.common.core.utils;
import java.security.SecureRandom;
import java.util.Collection; import java.util.Collection;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.bonus.sgzb.common.core.constant.Constants; import com.bonus.sgzb.common.core.constant.Constants;
import com.bonus.sgzb.common.core.text.StrFormatter; import com.bonus.sgzb.common.core.text.StrFormatter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.AntPathMatcher; import org.springframework.util.AntPathMatcher;
/** /**
@ -13,6 +15,7 @@ import org.springframework.util.AntPathMatcher;
* *
* @author ruoyi * @author ruoyi
*/ */
@Slf4j
public class StringUtils extends org.apache.commons.lang3.StringUtils public class StringUtils extends org.apache.commons.lang3.StringUtils
{ {
/** 空字符串 */ /** 空字符串 */
@ -21,6 +24,8 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** 下划线 */ /** 下划线 */
private static final char SEPARATOR = '_'; private static final char SEPARATOR = '_';
private static SecureRandom random = null;
/** /**
* 获取参数不为空值 * 获取参数不为空值
* *
@ -551,4 +556,30 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
} }
return sb.toString(); return sb.toString();
} }
// public static String getDeviceCode() {
// String randomNum = null;
// try {
// random = SecureRandom.getInstance("SHA1PRNG");
// randomNum = String.format("%02d", random.nextInt(100));
// } catch (NoSuchAlgorithmException e) {
// log.error("生成随机数失败,", e);
// }
// String deviceCode = "CSG-A101-" + DateUtils.dateTime() + randomNum; //like CSG-A101-2024061900001, need save it
// return deviceCode;
// }
public static String getDeviceCode(Date date, String maId) {
int number = Integer.parseInt(maId);
if (number > 50000) {
number = number % 50000;
}
String numberStr = String.format("%05d", number);
String deviceCode = "CSG-A101-" + DateUtils.getDateTimeString(date) + numberStr; //like CSG-A101-2024061900001
return deviceCode;
}
// public static void main(String[] args) {
// System.out.println(getDeviceCode(new Date(), "500322"));
// }
} }

View File

@ -278,4 +278,7 @@ public class TmTask implements Serializable {
private String outFacCode; private String outFacCode;
@ApiModelProperty(value = "本次检验日期") @ApiModelProperty(value = "本次检验日期")
private Date thisCheckTime; private Date thisCheckTime;
@ApiModelProperty(value = "工器具编码")
private String deviceCode; //like CSG-A101-2024061900001
} }

View File

@ -1414,7 +1414,7 @@ public class TmTaskServiceImpl implements TmTaskService {
intelVO.setSpecificationType(""); intelVO.setSpecificationType("");
intelVO.setValidityDate(new Date()); intelVO.setValidityDate(new Date());
//每个设备不同点的设置 //每个设备不同点的设置
intelVO.setDeviceCode(subTask.getMaCode()); intelVO.setDeviceCode(StringUtils.getDeviceCode(subTask.getCreateTime(), subTask.getMaId()));
intelVO.setFactoryDate(subTask.getOutFacTime()); intelVO.setFactoryDate(subTask.getOutFacTime());
intelVO.setMachineryCode(subTask.getMaId()); intelVO.setMachineryCode(subTask.getMaId());
intelVO.setTrialDate(subTask.getThisCheckTime()); intelVO.setTrialDate(subTask.getThisCheckTime());

View File

@ -1180,7 +1180,8 @@
mam.ma_code as maCode, mam.ma_code as maCode,
mam.out_fac_time as outFacTime, mam.out_fac_time as outFacTime,
mam.out_fac_code as outFacCode, mam.out_fac_code as outFacCode,
mam.this_check_time as thisCheckTime mam.this_check_time as thisCheckTime,
mam.create_time as createTime
from lease_out_details lod from lease_out_details lod
left join ma_machine mam on mam.ma_id = lod.ma_id left join ma_machine mam on mam.ma_id = lod.ma_id
where parent_id = #{id} where parent_id = #{id}