|
|
@@ -3,6 +3,7 @@ package com.ruoyi.business.service.impl;
|
|
|
import cn.hutool.core.date.DateField;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import com.ruoyi.business.constant.CommonConstants;
|
|
|
import com.ruoyi.business.entity.MachineLicenseAcquireReqDto;
|
|
|
import com.ruoyi.business.service.LicenseService;
|
|
|
import com.ruoyi.business.util.DESUtils;
|
|
|
@@ -19,7 +20,6 @@ import java.io.InputStreamReader;
|
|
|
@Service
|
|
|
public class licenseServiceImpl implements LicenseService {
|
|
|
|
|
|
- public static int DELAY_DAY = 14 ;
|
|
|
|
|
|
@Value("${jsPath}")
|
|
|
private String jsPath;
|
|
|
@@ -37,14 +37,27 @@ public class licenseServiceImpl implements LicenseService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String createLicense(String type,String licenseCode,int delayDay,String remark) {
|
|
|
+ if("DZ".equals(type)){
|
|
|
+ return createLicenseForDZ(licenseCode,delayDay,remark);
|
|
|
+ }else if("SP".equals(type)){
|
|
|
+ return createLicenseForSP(licenseCode,delayDay,remark);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String createLicenseForDZ(String licenseCode){
|
|
|
+ return createLicenseForDZ(licenseCode, CommonConstants.DELAY_HALF_MONTH,"");
|
|
|
+ }
|
|
|
/**
|
|
|
* 调证
|
|
|
* @param licenseCode
|
|
|
* @return
|
|
|
*/
|
|
|
- private String createLicenseForDZ(String licenseCode) {
|
|
|
+ private String createLicenseForDZ(String licenseCode,int delay,String remark) {
|
|
|
String strRobotNum = "999";
|
|
|
- DateTime endTime = DateUtil.offset(DateUtil.date(), DateField.DAY_OF_YEAR, DELAY_DAY);
|
|
|
+ DateTime endTime = DateUtil.offset(DateUtil.date(), DateField.DAY_OF_YEAR, delay);
|
|
|
String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd") + " 23:59:59";
|
|
|
System.out.println("到期时间:" + endTimeStr);
|
|
|
|
|
|
@@ -57,7 +70,7 @@ public class licenseServiceImpl implements LicenseService {
|
|
|
reqDto.setMachineCode(licenseCode);
|
|
|
reqDto.setLicenseType(licenseCode);
|
|
|
reqDto.setMachineType("ALL");
|
|
|
- System.out.println("执行入参:" + reqDto);
|
|
|
+ System.out.println("执行机器码:" + licenseCode);
|
|
|
String license;
|
|
|
try {
|
|
|
license = SM2Utils.generateLicense(reqDto.getLicenseType(), reqDto.getMachineType()
|
|
|
@@ -71,14 +84,17 @@ public class licenseServiceImpl implements LicenseService {
|
|
|
return resultLicense;
|
|
|
}
|
|
|
|
|
|
+ private String createLicenseForSP(String licenseCode){
|
|
|
+ return createLicenseForSP(licenseCode,CommonConstants.DELAY_HALF_MONTH,"");
|
|
|
+ }
|
|
|
/**
|
|
|
* 审批
|
|
|
* @param licenseCode
|
|
|
* @return
|
|
|
*/
|
|
|
- private String createLicenseForSP(String licenseCode) {
|
|
|
+ private String createLicenseForSP(String licenseCode,int delay,String remark) {
|
|
|
try {
|
|
|
- DateTime endTime = DateUtil.offset(DateUtil.date(), DateField.DAY_OF_YEAR, DELAY_DAY);
|
|
|
+ DateTime endTime = DateUtil.offset(DateUtil.date(), DateField.DAY_OF_YEAR, delay);
|
|
|
String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd") + " 23:59:59";
|
|
|
System.out.println("到期时间:" + endTimeStr);
|
|
|
String command = "node".concat(" ").concat(jsPath)
|