Commit 4bce0607 by 杨林龙

优化存储数据逻辑

1 parent bbc77ce7
......@@ -33,7 +33,7 @@ public class DeviceLocationService {
* @param deviceLocationDtoList
*/
public void saveOrUpdateDeviceLocationData(Collection<DeviceLocationDto> deviceLocationDtoList) {
deviceLocationDtoList.forEach(deviceLocationDto -> {
for (DeviceLocationDto deviceLocationDto : deviceLocationDtoList) {
DeviceLocation locationBySn = deviceLocationMapper.getDeviceLocationBySn(deviceLocationDto.getSn());
if (ObjectUtil.isNull(locationBySn)) {
DeviceLocation deviceLocation = new DeviceLocation();
......@@ -44,7 +44,7 @@ public class DeviceLocationService {
mergeData(locationBySn, deviceLocationDto);
deviceLocationMapper.updateByPrimaryKeySelective(locationBySn);
}
});
}
}
private void mergeData(DeviceLocation locationBySn, DeviceLocationDto deviceLocationDto) {
......
package cn.com.glsx.stdinterface.modules;
import cn.com.glsx.stdinterface.modules.model.CommonApiRequest;
import cn.com.glsx.stdinterface.modules.model.InstallWorkOrderBO;
//import cn.com.glsx.stdinterface.modules.model.InstallWorkOrderBO;
import cn.com.glsx.stdinterface.modules.util.Sm4EncryptUtils;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
......@@ -12,50 +12,50 @@ import org.springframework.util.DigestUtils;
public class MainTest {
public static void main(String[] args) {
InstallWorkOrderBO orderBO = new InstallWorkOrderBO();
orderBO.setWorkOrderNo(SnowFlake.nextSerialNumber());
orderBO.setVin("LB888" + orderBO.getWorkOrderNo());
orderBO.setVinHash(DigestUtils.md5DigestAsHex(orderBO.getVin().getBytes()));
orderBO.setLesseeName("张三");
orderBO.setLesseePhone("13800138000");
orderBO.setColor("红色");
orderBO.setInnerColor("黑色");
orderBO.setPlateNo("粤B12345");
orderBO.setEngineNo("6411973");
orderBO.setDistrict("广东");
orderBO.setShopName("上海融玉汽车服务有限公司");
orderBO.setShopContactor("门店联系人");
orderBO.setShopTelephone("13800138001");
orderBO.setRemark("备注");
orderBO.setServicePeriod(24);
orderBO.setFundProvider("仲利租赁");
orderBO.setPurchaseType("自采");
orderBO.setRentType("回租");
orderBO.setNeedInstall("Y");
orderBO.setInstallCompose("00011");
orderBO.setInstallExplain(null);
orderBO.setInstallTime(DateUtils.parse("2021-12-08 12:24:57"));
orderBO.setInstallAddress("上海融玉总部普陀店");
orderBO.setNeedInsure("N");
String originData = JSONUtil.toJsonStr(orderBO);
System.out.println(originData);
String encryptData = Sm4EncryptUtils.encryptCbc("E76F7D9A27F63E6BA5F4282D81BA9E50", originData);
System.out.println(encryptData);
CommonApiRequest request = new CommonApiRequest();
request.setTimestamp(System.currentTimeMillis());
request.setOrganization("zlgj");
request.setData(encryptData);
request.setDataType(1);
String requestData = JSONUtil.toJsonStr(request);
System.out.println(requestData);
String url = "http://192.168.3.152:8387/stdinterface/workorder/create";
String result = HttpUtil.createPost(url).body(requestData).execute().body();
System.out.println(result);
// InstallWorkOrderBO orderBO = new InstallWorkOrderBO();
// orderBO.setWorkOrderNo(SnowFlake.nextSerialNumber());
// orderBO.setVin("LB888" + orderBO.getWorkOrderNo());
//
// orderBO.setVinHash(DigestUtils.md5DigestAsHex(orderBO.getVin().getBytes()));
// orderBO.setLesseeName("张三");
// orderBO.setLesseePhone("13800138000");
// orderBO.setColor("红色");
// orderBO.setInnerColor("黑色");
// orderBO.setPlateNo("粤B12345");
// orderBO.setEngineNo("6411973");
// orderBO.setDistrict("广东");
// orderBO.setShopName("上海融玉汽车服务有限公司");
// orderBO.setShopContactor("门店联系人");
// orderBO.setShopTelephone("13800138001");
// orderBO.setRemark("备注");
// orderBO.setServicePeriod(24);
// orderBO.setFundProvider("仲利租赁");
// orderBO.setPurchaseType("自采");
// orderBO.setRentType("回租");
// orderBO.setNeedInstall("Y");
//
// orderBO.setInstallCompose("00011");
// orderBO.setInstallExplain(null);
// orderBO.setInstallTime(DateUtils.parse("2021-12-08 12:24:57"));
// orderBO.setInstallAddress("上海融玉总部普陀店");
// orderBO.setNeedInsure("N");
//
// String originData = JSONUtil.toJsonStr(orderBO);
// System.out.println(originData);
// String encryptData = Sm4EncryptUtils.encryptCbc("E76F7D9A27F63E6BA5F4282D81BA9E50", originData);
// System.out.println(encryptData);
//
// CommonApiRequest request = new CommonApiRequest();
// request.setTimestamp(System.currentTimeMillis());
// request.setOrganization("zlgj");
// request.setData(encryptData);
// request.setDataType(1);
// String requestData = JSONUtil.toJsonStr(request);
// System.out.println(requestData);
//
// String url = "http://192.168.3.152:8387/stdinterface/workorder/create";
// String result = HttpUtil.createPost(url).body(requestData).execute().body();
// System.out.println(result);
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!