Commit 527db5f1 authored by wanghao's avatar wanghao

1 模拟数据测试 液化石油气-气瓶档案,充装记录,车辆信息 外部接口。

parent 9a5b46db
......@@ -577,6 +577,7 @@ public class lpgGasController {
int i1 = lpgGasBottleFiles.size() - set.size();
if (i1 > 0) {
repeatNum = i1;
successNum = successNum - repeatNum;
}
List<TLpgGasBottleFiles> notRepeatList = new ArrayList<>(set);
......@@ -590,7 +591,7 @@ public class lpgGasController {
while (iterator.hasNext()) {
TLpgGasBottleFiles next = iterator.next();
List<TLpgGasBottleFiles> lpgGasBottleFiles2 = collect1.get(next.getQrcode());
if (lpgGasBottleFiles2.size() > 0) {
if (lpgGasBottleFiles2 != null && lpgGasBottleFiles2.size() > 0) {
updateLpgGasBottleFiles.add(next);
iterator.remove();
}
......@@ -598,19 +599,12 @@ public class lpgGasController {
// 不重复的该新增的新增
if (notRepeatList.size() > 0){
int i = tLpgGasBottleFilesService.externalDockingCreateLpgGasBottleFiles(notRepeatList);
if (i < 1) {
return AjaxResult.error("入库异常!!!");
}
tLpgGasBottleFilesService.externalDockingCreateLpgGasBottleFiles(notRepeatList);
}
// 不重复的该修改的修改
if(updateLpgGasBottleFiles.size() > 0) {
int i = tLpgGasBottleFilesService.externalDockingUpdateLpgGasBottleFiles(updateLpgGasBottleFiles);
if (i < 1) {
return AjaxResult.error("入库异常!!!");
}
tLpgGasBottleFilesService.externalDockingUpdateLpgGasBottleFiles(updateLpgGasBottleFiles);
}
}
......@@ -943,45 +937,42 @@ public class lpgGasController {
}
}
// 把正确数据里面的 如果 气瓶条码 和 充装记录编号重复的去去重
Set<TLpgAirChargeFiles> uniqueList = new HashSet<>(successLpgAirChargeFiles);
if (successLpgAirChargeFiles.size() > 0) {
// 把正确数据里面的 如果 气瓶条码 和 充装记录编号重复的去去重
Set<TLpgAirChargeFiles> uniqueList = new HashSet<>(successLpgAirChargeFiles);
int i1 = successLpgAirChargeFiles.size() - uniqueList.size();
int i1 = successLpgAirChargeFiles.size() - uniqueList.size();
if(i1> 0) {
repeatNum = i1;
}
if(i1> 0) {
repeatNum = i1;
successNum = successNum - repeatNum;
}
List<TLpgAirChargeFiles> successNoRepeatLpgAirChargeFilesList = new ArrayList<>(uniqueList);
// 气瓶条码都符合规则后 并且去重 后 ,再根据 企业id 气瓶条码 充装记录编码判断唯一,如果已存在,则修改。不存在 则新增
List<TLpgAirChargeFiles> lpgAirChargeFiles1 = itLpgAirChargeFilesService.queryALlByBarcodeAndGizId(successNoRepeatLpgAirChargeFilesList);
Map<String, List<TLpgAirChargeFiles>> collect = lpgAirChargeFiles1.stream().collect(Collectors.groupingBy(item -> item.getBarCode() + ":" + item.getGzId()));
Iterator<TLpgAirChargeFiles> iterator = successNoRepeatLpgAirChargeFilesList.iterator();
while (iterator.hasNext()) {
TLpgAirChargeFiles next = iterator.next();
String key = next.getBarCode() + ":" + next.getGzId();
List<TLpgAirChargeFiles> lpgAirChargeFiles2 = collect.get(key);
// 说明是要修改的
if (lpgAirChargeFiles2.size() > 0) {
updateLpgAirChargeFiles.add(next);
iterator.remove();
List<TLpgAirChargeFiles> successNoRepeatLpgAirChargeFilesList = new ArrayList<>(uniqueList);
// 气瓶条码都符合规则后 并且去重 后 ,再根据 企业id 气瓶条码 充装记录编码判断唯一,如果已存在,则修改。不存在 则新增
List<TLpgAirChargeFiles> lpgAirChargeFiles1 = itLpgAirChargeFilesService.queryALlByBarcodeAndGizId(successNoRepeatLpgAirChargeFilesList);
Map<String, List<TLpgAirChargeFiles>> collect = lpgAirChargeFiles1.stream().collect(Collectors.groupingBy(item -> item.getBarCode() + ":" + item.getGzId()));
Iterator<TLpgAirChargeFiles> iterator = successNoRepeatLpgAirChargeFilesList.iterator();
while (iterator.hasNext()) {
TLpgAirChargeFiles next = iterator.next();
String key = next.getBarCode() + ":" + next.getGzId();
List<TLpgAirChargeFiles> lpgAirChargeFiles2 = collect.get(key);
// 说明是要修改的
if (lpgAirChargeFiles2 != null && lpgAirChargeFiles2.size() > 0) {
updateLpgAirChargeFiles.add(next);
iterator.remove();
}
}
}
// 插入新增的
if (successNoRepeatLpgAirChargeFilesList.size() > 0) {
int i = itLpgAirChargeFilesService.externalDockingCreateLpgAirChargeFileInfo(successNoRepeatLpgAirChargeFilesList);
if (i < 1) {
return AjaxResult.error("监管平台入库异常!!!");
// 插入新增的
if (successNoRepeatLpgAirChargeFilesList.size() > 0) {
itLpgAirChargeFilesService.externalDockingCreateLpgAirChargeFileInfo(successNoRepeatLpgAirChargeFilesList);
}
}
// 修改要修改的
if (updateLpgAirChargeFiles.size() > 0) {
int i = itLpgAirChargeFilesService.externalDockingUpdateLpgAirChargeFileInfo(updateLpgAirChargeFiles);
if (i < 1) {
return AjaxResult.error("监管平台入库异常!!!");
// 修改要修改的
if (updateLpgAirChargeFiles.size() > 0) {
itLpgAirChargeFilesService.externalDockingUpdateLpgAirChargeFileInfo(updateLpgAirChargeFiles);
}
}
......@@ -1028,6 +1019,7 @@ public class lpgGasController {
int successNum = 0;
int errorNum = 0;
int repeatNum = 0;
if (StringUtils.isNotBlank(decrypt)) {
......@@ -1041,9 +1033,9 @@ public class lpgGasController {
return AjaxResult.error("每次最多处理500条数据");
}
List<TLpgVehicleInfo> lpgAirChargeFiles = new ArrayList<>();
List<TLpgVehicleInfo> lpgVehicleInfos = new ArrayList<>();
// 需要更新的数据
List<TLpgVehicleInfo> updateLpgAirChargeFiles = new ArrayList<>();
List<TLpgVehicleInfo> updateLpgVehicleInfos = new ArrayList<>();
TLpgVehicleInfo lpgVehicleInfo;
// 接口保存记录
......@@ -1235,35 +1227,46 @@ public class lpgGasController {
lpgVehicleInfo.setRemarks(remarks);
lpgVehicleInfo.setEnterpriseId(tEnterpriseInfo.getEnterpriseId());
lpgAirChargeFiles.add(lpgVehicleInfo);
lpgVehicleInfos.add(lpgVehicleInfo);
lpgThirdPartyDockingInterfaceRecord = successRecord("createLpgVehicleInfo", jsonObject.toJSONString(), encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
successNum++;
}
if (lpgAirChargeFiles.size() > 0) {
if (lpgVehicleInfos.size() > 0) {
// 先把数据自身重复的去去重
Set<TLpgVehicleInfo> set = new HashSet<>(lpgVehicleInfos);
int i = lpgVehicleInfos.size() - set.size();
if (i > 0) {
repeatNum = i;
successNum = successNum - repeatNum;
}
// 去重后的数据
List<TLpgVehicleInfo> neRepeatVehicleInfoList = new ArrayList<>(set);
//目前拿到的数据还都再判断下 车牌号 是否重复 重复直接更新
List<String> collect = lpgAirChargeFiles.stream().map(TLpgVehicleInfo::getCarNum).collect(Collectors.toList());
List<String> collect = neRepeatVehicleInfoList.stream().map(TLpgVehicleInfo::getCarNum).collect(Collectors.toList());
List<TLpgVehicleInfo> tLpgVehicleInfos = lpgVehicleInfoService.queryByCarNumsAndEnterpriseId(collect, tEnterpriseInfo.getEnterpriseId());
Map<String, List<TLpgVehicleInfo>> collect1 = tLpgVehicleInfos.stream().collect(Collectors.groupingBy(TLpgVehicleInfo::getCarNum));
Iterator<TLpgVehicleInfo> iterator = lpgAirChargeFiles.iterator();
Iterator<TLpgVehicleInfo> iterator = neRepeatVehicleInfoList.iterator();
while (iterator.hasNext()) {
TLpgVehicleInfo next = iterator.next();
List<TLpgVehicleInfo> tLpgVehicleInfos1 = collect1.get(next.getCarNum());
if (tLpgVehicleInfos1.size() > 0) {
updateLpgAirChargeFiles.add(next);
if (tLpgVehicleInfos1 != null && tLpgVehicleInfos1.size() > 0) {
updateLpgVehicleInfos.add(next);
iterator.remove();
}
}
// 新增的新增
if (lpgAirChargeFiles.size() > 0) {
lpgVehicleInfoService.insertBatch(lpgAirChargeFiles);
if (neRepeatVehicleInfoList.size() > 0) {
lpgVehicleInfoService.insertBatch(neRepeatVehicleInfoList);
}
// 修改的修改
if (updateLpgAirChargeFiles.size() > 0) {
lpgVehicleInfoService.updateBatch(updateLpgAirChargeFiles);
if (updateLpgVehicleInfos.size() > 0) {
lpgVehicleInfoService.updateBatch(updateLpgVehicleInfos);
}
}
......@@ -1273,8 +1276,8 @@ public class lpgGasController {
}
StringBuilder sb = new StringBuilder();
if (errorNum > 0) {
sb.append("成功:").append(successNum).append("条;失败:").append(errorNum).append("条");
if (errorNum > 0 || repeatNum > 0) {
sb.append("成功:").append(successNum).append("条;失败:").append(errorNum).append("条;重复").append(repeatNum).append("条");
return AjaxResult.success(sb.toString());
}
sb.append("成功:").append(successNum).append("条");
......
......@@ -158,81 +158,10 @@ public class DESEncoder {
// System.out.println(DESEncoder.encrypt(skcs1,"23546324"));
String lpggasdata = "[\n" +
" {\n" +
" \"nchkDate\": \"2024-12-18\",\n" +
" \"discardDate\": \"2024-12-20\",\n" +
" \"wpressure\": \"15.96\",\n" +
" \"thickness\": \"15.46\",\n" +
" \"holeCode\": \"孔洞码-接口来的-01\",\n" +
" \"qrcode\": \"111111\",\n" +
" \"regCode\": \"登记证号-接口来的-01\",\n" +
" \"selfWeight\": \"15.98\",\n" +
" \"medium\": \"充装介质-接口来的-01\",\n" +
" \"bottleStorageType\": \"存储类型(气相/液相)-接口来的-01\",\n" +
" \"pchkDate\": \"2024-12-17\",\n" +
" \"batchImage\": \"一串base64数据\",\n" +
" \"safeJudgeDate\": \"2024-12-21\",\n" +
" \"checkImage\": \"一串base64数据\",\n" +
" \"appId\": \"电子标签-接口来的-01\",\n" +
" \"makeInfo\": \"生产(制造单位)\",\n" +
" \"gpressure\": \"12.56\",\n" +
" \"makeDate\": \"2024-12-16\",\n" +
" \"botSpecName\": \"钢瓶规格名称-接口来的-01\",\n" +
" \"payImage\": \"一串base64数据\",\n" +
" \"equType\": \"设备类型-接口来的-01\",\n" +
" \"inspectionLabel\": \"检验标牌(有/无)-接口来的-01\",\n" +
" \"botImage\": \"一串base64数据\",\n" +
" \"buildUser\": \"使用单位-接口来的-01\",\n" +
" \"pressure\": \"12.5\",\n" +
" \"productDate\": \"2024-12-19\",\n" +
" \"equNo\": \"产品编号-接口来的-01\",\n" +
" \"permitNo\": \"气瓶许可证号-接口来的-01\",\n" +
" \"volume\": \"30.6\",\n" +
" \"inspectedTimes\": \"14\",\n" +
" \"valveManuFacturer\": \"阀厂家-接口来的-01\",\n" +
" \"thirdPartyLabel\": \"第三方标签-接口来的-01\",\n" +
" \"valveName\": \"阀类型名称-接口来的-01\",\n" +
" \"deviceImage\": \"一串base64数据\",\n" +
" \"selfId\": \"单位内编号-接口来的-01\"\n" +
" },\n" +
" {\n" +
" \"nchkDate\": \"2024-12-23\",\n" +
" \"discardDate\": \"2024-12-25\",\n" +
" \"wpressure\": \"15.96\",\n" +
" \"thickness\": \"15.46\",\n" +
" \"holeCode\": \"孔洞码-接口来的-02\",\n" +
" \"qrcode\": \"222222\",\n" +
" \"regCode\": \"登记证号-接口来的-02\",\n" +
" \"selfWeight\": \"15.98\",\n" +
" \"medium\": \"充装介质-接口来的-02\",\n" +
" \"bottleStorageType\": \"存储类型(气相/液相)-接口来的-02\",\n" +
" \"pchkDate\": \"2024-12-22\",\n" +
" \"batchImage\": \"一串base64数据\",\n" +
" \"safeJudgeDate\": \"2024-12-26\",\n" +
" \"checkImage\": \"一串base64数据\",\n" +
" \"appId\": \"电子标签-接口来的-02\",\n" +
" \"makeInfo\": \"生产(制造单位)\",\n" +
" \"gpressure\": \"14.56\",\n" +
" \"makeDate\": \"2024-12-21\",\n" +
" \"botSpecName\": \"钢瓶规格名称-接口来的-02\",\n" +
" \"payImage\": \"一串base64数据\",\n" +
" \"equType\": \"设备类型-接口来的-02\",\n" +
" \"inspectionLabel\": \"检验标牌(有/无)-接口来的-02\",\n" +
" \"botImage\": \"一串base64数据\",\n" +
" \"buildUser\": \"使用单位-接口来的-02\",\n" +
" \"pressure\": \"12.5\",\n" +
" \"productDate\": \"2024-12-24\",\n" +
" \"equNo\": \"产品编号-接口来的-02\",\n" +
" \"permitNo\": \"气瓶许可证号-接口来的-02\",\n" +
" \"volume\": \"30.6\",\n" +
" \"inspectedTimes\": \"14\",\n" +
" \"valveManuFacturer\": \"阀厂家-接口来的-02\",\n" +
" \"thirdPartyLabel\": \"第三方标签-接口来的-02\",\n" +
" \"valveName\": \"阀类型名称-接口来的-02\",\n" +
" \"deviceImage\": \"一串base64数据\",\n" +
" \"selfId\": \"单位内编号-接口来的-02\"\n" +
" }\n" +
"]\n";
"{\"onState\":\"1\",\"vehicleLimt\":\"车辆限乘01\",\"vehicleLoad\":\"车辆载重01\",\"carNum\":\"SE123\",\"vehicleCode\":\"代码01\",\"brandModel\":\"品牌型号01\",\"vehicleInspect\":\"车辆检查信息01\",\"vehicleUser\":\"使用人01\",\"carNumber\":\"车辆编号01\",\"phone\":\"888888888\",\"personLiable\":\"责任人88888888\",\"stationName\":\"储备站88888888\",\"vehicleSize\":\"车辆大小01\",\"vehicleType\":\"车辆类型01\",\"remarks\":\"备注01\"},\n" +
"{\"onState\":\"0\",\"vehicleLimt\":\"车辆限乘02\",\"vehicleLoad\":\"车辆载重02\",\"carNum\":\"SE456\",\"vehicleCode\":\"代码02\",\"brandModel\":\"品牌型号02\",\"vehicleInspect\":\"车辆检查信息02\",\"vehicleUser\":\"使用人02\",\"carNumber\":\"车辆编号02\",\"phone\":\"联系电话02\",\"personLiable\":\"责任人02\",\"stationName\":\"储备站02\",\"vehicleSize\":\"车辆大小02\",\"vehicleType\":\"车辆类型02\",\"remarks\":\"备注02\"}\n" +
"{\"onState\":\"1\",\"vehicleLimt\":\"车辆限乘01\",\"vehicleLoad\":\"车辆载重01\",\"carNum\":\"SE123\",\"vehicleCode\":\"代码01\",\"brandModel\":\"品牌型号01\",\"vehicleInspect\":\"车辆检查信息01\",\"vehicleUser\":\"使用人01\",\"carNumber\":\"车辆编号01\",\"phone\":\"888888888\",\"personLiable\":\"责任人88888888\",\"stationName\":\"储备站88888888\",\"vehicleSize\":\"车辆大小01\",\"vehicleType\":\"车辆类型01\",\"remarks\":\"备注01\"},\n" +
"]";
JSONArray objects = JSON.parseArray(lpggasdata);
System.out.println(objects);
......
......@@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/ze_base_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://localhost:3306/ze_base_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
username: root
password: Zh@123456
# 从库数据源
......
......@@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3309/ze_base_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://localhost:3309/ze_base_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
username: ze_base_db
password: 6JfrWG6Lcd4kWnfb
# 从库数据源
......
......@@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://36.138.180.82:3309/ze_base_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://36.138.180.82:3309/ze_base_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
username: ze_base_db
password: 6JfrWG6Lcd4kWnfb
# 从库数据源
......
......@@ -80,6 +80,3 @@ xss:
excludes: /system/notice/*
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
# 第三方对接 液化气 des 加解密 编码
externalDockingLpgGas: zhy@123.
......@@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
import java.util.Objects;
/**
* 液化石油车辆信息对象 t_lpg_vehicle_info
*
......@@ -276,6 +278,19 @@ public class TLpgVehicleInfo extends BaseEntity
return remarks;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
TLpgVehicleInfo lpgVehicleInfo = (TLpgVehicleInfo) obj;
return Objects.equals(carNum,lpgVehicleInfo.getCarNum());
}
@Override
public int hashCode() {
return Objects.hash(carNum);
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -84,16 +84,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
UPDATE t_lpg_air_charge_files
<set>
f_station_name = #{item.stationName},
f_vase_code = #{item.vehicleCode},
f_scale_num = #{item.brandModel},
f_fill_statr_time = #{item.vehicleType},
f_fill_end_time = #{item.vehicleLoad},
f_set_weight = #{item.vehicleSize},
f_wt_net = #{item.vehicleLimt},
f_set_bottle_weight = #{item.vehicleInspect},
f_vase_code = #{item.vaseCode},
f_scale_num = #{item.scaleNum},
f_fill_statr_time = #{item.fillStatrTime},
f_fill_end_time = #{item.fillEndTime},
f_set_weight = #{item.setWeight},
f_wt_net = #{item.wtNet},
f_set_bottle_weight = #{item.setBottleWeight},
f_bottle_weight = #{item.bottleWeight},
f_wt_gross = #{item.onState},
f_oprate_name = #{item.vehicleUser},
f_wt_gross = #{item.wtGross},
f_oprate_name = #{item.oprateName},
</set>
WHERE f_bar_code = #{item.barCode} and f_gz_id = #{item.gzId} and enterprise_id = #{item.enterpriseId}
</foreach>
......
......@@ -144,10 +144,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<foreach collection="list" item="item" index="index" separator=";">
UPDATE t_lpg_gas_bottle_files
<set>
f_reg_code = #{item.regCode},
f_equ_no = #{item.equNo},
f_equ_type = #{item.equType},
f_medium = #{item.medium},
f_reg_code = #{item.regCode,jdbcType=VARCHAR},
f_equ_no = #{item.equNo,jdbcType=VARCHAR},
f_equ_type = #{item.equType,jdbcType=VARCHAR},
f_medium = #{item.medium,jdbcType=VARCHAR},
f_make_date = #{item.makeDate},
f_make_info = #{item.makeInfo},
f_self_id = #{item.selfId},
......@@ -184,7 +184,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
f_check_image = #{item.checkImage},
f_bot_image = #{item.botImage},
</set>
WHERE f_gas_bottle_files_id = #{item.gasBottleFilesId}
WHERE f_q_rcode = #{item.qrcode} and enterprise_id = #{item.enterpriseId}
</foreach>
</update>
<insert id="insertBatch" parameterType="list">
......
......@@ -60,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryByCarNumsAndEnterpriseId" resultMap="TLpgVehicleInfoResult">
<include refid="selectTLpgVehicleInfoVo"/>
where enterprise_id = #{enterpriseId} and carNum in
where vehicle.enterprise_id = #{enterpriseId} and vehicle.car_num in
<foreach collection="carNums" index="i" item="item" open="(" separator="," close=")">
#{item}
</foreach>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment