|
@@ -56,6 +56,7 @@ import com.steerinfo.meterwork.meterworkrailwayactual.model.MeterWorkRailwayActu
|
|
|
import com.steerinfo.pretrack.pretrackscale.mapper.PreTrackScaleMapper;
|
|
import com.steerinfo.pretrack.pretrackscale.mapper.PreTrackScaleMapper;
|
|
|
import com.steerinfo.pretrack.pretrackscale.model.PreTrackScale;
|
|
import com.steerinfo.pretrack.pretrackscale.model.PreTrackScale;
|
|
|
import com.steerinfo.util.*;
|
|
import com.steerinfo.util.*;
|
|
|
|
|
+import org.apache.http.util.TextUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -63,6 +64,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
import org.springframework.util.Assert;
|
|
import org.springframework.util.Assert;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
+import org.springframework.util.DigestUtils;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import java.lang.reflect.Field;
|
|
import java.lang.reflect.Field;
|
|
@@ -2080,6 +2082,72 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
return deStr;
|
|
return deStr;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String encryptionTest(String carNo) throws Exception {
|
|
|
|
|
+// String deStr = AESUtil.encrypt(str, "abcdefghijklmnop", "0000000000000000");
|
|
|
|
|
+// return deStr;
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmm");
|
|
|
|
|
+ String afl = sdf.format(new Date());
|
|
|
|
|
+ String message = carNo + "jisco2022" + afl;
|
|
|
|
|
+ String key = "jiscosec";
|
|
|
|
|
+ String deStr = DESUtil.toHexString(DESUtil.encrypt(message, key));
|
|
|
|
|
+ //byte[] deStr = DESUtil.encrypt(message, key);
|
|
|
|
|
+// return deStr.toString();s
|
|
|
|
|
+// return new String(deStr);
|
|
|
|
|
+ return deStr;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public RESTfulResult decryptionTest(String str) {
|
|
|
|
|
+ RESTfulResult rm = new RESTfulResult();
|
|
|
|
|
+ rm.setFailed();
|
|
|
|
|
+ try {
|
|
|
|
|
+ String key = "jiscosec";
|
|
|
|
|
+ String destr;
|
|
|
|
|
+ try{
|
|
|
|
|
+ destr = DESUtil.decrypt(str, key);
|
|
|
|
|
+ }catch(Exception e) {
|
|
|
|
|
+ rm.setCode("9");
|
|
|
|
|
+ rm.setMessage("密文错误");
|
|
|
|
|
+ return rm;
|
|
|
|
|
+ }
|
|
|
|
|
+ String carNo = destr.substring(0, 7);
|
|
|
|
|
+ String time = destr.substring(16);
|
|
|
|
|
+
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
|
|
+ SimpleDateFormat sdf01 = new SimpleDateFormat("yyyyMMddHHmm");
|
|
|
|
|
+ Date date = sdf01.parse(time);
|
|
|
|
|
+ Calendar beforeTime = Calendar.getInstance();
|
|
|
|
|
+ beforeTime.add(Calendar.MINUTE, -5);// 5分钟之前的时间
|
|
|
|
|
+ Date startTime = sdf.parse(sdf.format(beforeTime.getTime()));
|
|
|
|
|
+ Date endTime = sdf.parse(sdf.format(new Date()));
|
|
|
|
|
+ if(!(date.compareTo(startTime) > 0 && date.compareTo(endTime) < 0)) {
|
|
|
|
|
+ rm.setMessage("二维码已过期");
|
|
|
|
|
+ rm.setCode("1");
|
|
|
|
|
+ return rm;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ String carnumRegex = "([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-Z]{1}(([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9 挂学警港澳]{1})";
|
|
|
|
|
+ if (!TextUtils.isEmpty(carNo)) {
|
|
|
|
|
+ if(carNo.matches(carnumRegex)) {
|
|
|
|
|
+ rm.setSucceed();
|
|
|
|
|
+ rm.setCode("0");
|
|
|
|
|
+ rm.setMessage(carNo);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ rm.setMessage("车号不正确");
|
|
|
|
|
+ rm.setCode("2");
|
|
|
|
|
+ }
|
|
|
|
|
+ }else {
|
|
|
|
|
+ rm.setMessage("车号为空");
|
|
|
|
|
+ rm.setCode("2");
|
|
|
|
|
+ }
|
|
|
|
|
+ }catch(Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ rm.setMessage("操作异常>>>" + e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return rm;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//两条轨道衡计量实绩的替换
|
|
//两条轨道衡计量实绩的替换
|
|
|
private MeterWorkRailwayActFirst change(MeterWorkRailwayActFirst one, MeterWorkRailwayActFirst two) {
|
|
private MeterWorkRailwayActFirst change(MeterWorkRailwayActFirst one, MeterWorkRailwayActFirst two) {
|
|
|
//1、为有值的数据,2为0的值 进行替换
|
|
//1、为有值的数据,2为0的值 进行替换
|