Commit 9bfb0294 authored by wanghao's avatar wanghao

液化石油气监管-车辆信息-导入和外部对接接口加上 企业信息涉及到功能模块调整 - 开发中

parent f71f6cbd
......@@ -571,4 +571,128 @@ public class lpgGasController {
sb.append("成功:").append(successNum).append("条");
return AjaxResult.success(sb.toString());
}
/**
* 创建 车辆信息接口
* @return r
*/
@PostMapping("/createLpgVehicleInfo")
public AjaxResult createLpgVehicleInfo(@RequestBody Encryption encryption) {
keyInformation selectkey = decryptService.selectkey(encryption.getQybm());
DESEncoder desEncoder = new DESEncoder();
String data = encryption.getData();
String decrypt = desEncoder.decrypt(data, selectkey.getSecretKey());
TEnterpriseInfo tEnterpriseInfo = tEnterpriseInfoMapper.selectTEnterpriseInfoById(selectkey.getEnterpriseId());
if (tEnterpriseInfo == null) {
return AjaxResult.error("监管平台配置企业信息不存在!!!");
}
int successNum = 0;
int errorNum = 0;
if (StringUtils.isNotBlank(decrypt)) {
JSONArray jsonArray = JSON.parseArray(decrypt);
String js = JSONObject.toJSONString(jsonArray, SerializerFeature.WriteClassName);
List<JSONObject> list = JSONObject.parseArray(js, JSONObject.class);
List<TLpgVehicleInfo> lpgAirChargeFiles = new ArrayList<>();
TLpgVehicleInfo lpgVehicleInfo;
for (int i = 0; i < list.size(); i++) {
lpgVehicleInfo = new TLpgVehicleInfo();
String dateFormat = "yyyy-MM-dd";
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
JSONObject jsonObject = list.get(i);
// 车牌号
String carNum = jsonObject.getString("carNum");
if(StringUtils.isBlank(carNum)) {
errorNum++;
continue;
}
lpgVehicleInfo.setCarNum(carNum);
// 储备站
String stationName = jsonObject.getString("stationName") == null ? "" : jsonObject.getString("stationName");
lpgVehicleInfo.setStationName(stationName);
// 车辆编号
String carNumber = jsonObject.getString("carNumber") == null ? "" : jsonObject.getString("carNumber");
lpgVehicleInfo.setCarNumber(carNumber);
// 代码
String vehicleCode = jsonObject.getString("vehicleCode") == null ? "" : jsonObject.getString("vehicleCode");
lpgVehicleInfo.setVehicleCode(vehicleCode);
// 品牌型号
String brandModel = jsonObject.getString("brandModel") == null ? "" : jsonObject.getString("brandModel");
lpgVehicleInfo.setBrandModel(brandModel);
// 车辆类型
String vehicleType = jsonObject.getString("vehicleType") == null ? "" : jsonObject.getString("vehicleType");
lpgVehicleInfo.setVehicleType(vehicleType);
// 车辆载重
String vehicleLoad = jsonObject.getString("vehicleLoad") == null ? "" : jsonObject.getString("vehicleLoad");
lpgVehicleInfo.setVehicleLoad(vehicleLoad);
// 车辆大小
String vehicleSize = jsonObject.getString("vehicleSize") == null ? "" : jsonObject.getString("vehicleSize");
lpgVehicleInfo.setVehicleSize(vehicleSize);
// 车辆限乘
String vehicleLimt = jsonObject.getString("vehicleLimt") == null ? "" : jsonObject.getString("vehicleLimt");
lpgVehicleInfo.setVehicleLimt(vehicleLimt);
// 车辆限乘
String vehicleInspect = jsonObject.getString("vehicleInspect") == null ? "" : jsonObject.getString("vehicleInspect");
lpgVehicleInfo.setVehicleInspect(vehicleInspect);
// 责任人
String personLiable = jsonObject.getString("personLiable") == null ? "" : jsonObject.getString("personLiable");
lpgVehicleInfo.setPersonLiable(personLiable);
// 使用状态
String onState = jsonObject.getString("onState") == null ? "" : jsonObject.getString("onState");
lpgVehicleInfo.setOnState(onState);
// 使用人
String vehicleUser = jsonObject.getString("vehicleUser") == null ? "" : jsonObject.getString("vehicleUser");
lpgVehicleInfo.setVehicleUser(vehicleUser);
// 联系电话
String phone = jsonObject.getString("phone") == null ? "" : jsonObject.getString("phone");
lpgVehicleInfo.setPhone(phone);
lpgAirChargeFiles.add(lpgVehicleInfo);
}
}
StringBuilder sb = new StringBuilder();
if (errorNum > 0) {
sb.append("成功:").append(successNum).append("条;失败:").append(errorNum).append("条");
return AjaxResult.success(sb.toString());
}
sb.append("成功:").append(successNum).append("条");
return AjaxResult.success(sb.toString());
}
}
......@@ -116,8 +116,7 @@ public class TLpgVehicleInfoController extends BaseController
ExcelUtil<TLpgVehicleInfo> util = new ExcelUtil<>(TLpgVehicleInfo.class);
List<TLpgVehicleInfo> XmbhList = util.importExcel(file.getInputStream());
tLpgVehicleInfoService.importLpgSafeCheckRecordInfo(XmbhList, updateSupport, response);
return AjaxResult.success();
return tLpgVehicleInfoService.importLpgSafeCheckRecordInfo(XmbhList, updateSupport, response);
}
}
......@@ -18,6 +18,17 @@ public class TLpgVehicleInfo extends BaseEntity
/** 车辆主键 */
private Long vehicleId;
/**
* 燃气企业id
*/
private String enterpriseId;
/**
* 燃气企业
*/
@Excel(name = "燃气企业")
private String enterpriseName;
/** 储配站 */
@Excel(name = "储配站")
private String stationName;
......@@ -72,7 +83,7 @@ public class TLpgVehicleInfo extends BaseEntity
/** 使用人 */
@Excel(name = "使用人")
private Long vehicleUser;
private String vehicleUser;
/** 联系电话 */
@Excel(name = "联系电话")
......@@ -86,7 +97,23 @@ public class TLpgVehicleInfo extends BaseEntity
@Excel(name = "备注")
private String remarks;
public void setVehicleId(Long vehicleId)
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getEnterpriseName() {
return enterpriseName;
}
public void setEnterpriseName(String enterpriseName) {
this.enterpriseName = enterpriseName;
}
public void setVehicleId(Long vehicleId)
{
this.vehicleId = vehicleId;
}
......@@ -212,12 +239,12 @@ public class TLpgVehicleInfo extends BaseEntity
{
return onState;
}
public void setVehicleUser(Long vehicleUser)
public void setVehicleUser(String vehicleUser)
{
this.vehicleUser = vehicleUser;
}
public Long getVehicleUser()
public String getVehicleUser()
{
return vehicleUser;
}
......
......@@ -2,6 +2,8 @@ package com.zehong.system.service;
import java.util.HashMap;
import java.util.List;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.system.domain.TLpgVehicleInfo;
import com.zehong.system.domain.vo.TLpgSafeCheckRecordImportVo;
......@@ -69,5 +71,5 @@ public interface ITLpgVehicleInfoService
* @param response res
* @return r
*/
public void importLpgSafeCheckRecordInfo(List<TLpgVehicleInfo> XmbhList, boolean updateSupport, HttpServletResponse response);
public AjaxResult importLpgSafeCheckRecordInfo(List<TLpgVehicleInfo> XmbhList, boolean updateSupport, HttpServletResponse response);
}
package com.zehong.system.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.TEnterpriseInfo;
import com.zehong.system.mapper.TEnterpriseInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TLpgVehicleInfoMapper;
import com.zehong.system.domain.TLpgVehicleInfo;
import com.zehong.system.service.ITLpgVehicleInfoService;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
/**
......@@ -19,9 +28,12 @@ import javax.servlet.http.HttpServletResponse;
@Service
public class TLpgVehicleInfoServiceImpl implements ITLpgVehicleInfoService
{
@Autowired
@Resource
private TLpgVehicleInfoMapper tLpgVehicleInfoMapper;
@Resource
private TEnterpriseInfoMapper tEnterpriseInfoMapper;
/**
* 查询液化石油车辆信息
*
......@@ -102,10 +114,43 @@ public class TLpgVehicleInfoServiceImpl implements ITLpgVehicleInfoService
* @return r
*/
@Override
public void importLpgSafeCheckRecordInfo(List<TLpgVehicleInfo> XmbhList, boolean updateSupport, HttpServletResponse response) {
public AjaxResult importLpgSafeCheckRecordInfo(List<TLpgVehicleInfo> XmbhList, boolean updateSupport, HttpServletResponse response) {
int successNum = 0;
int errorNum = 0;
if(XmbhList.size() > 0) {
tLpgVehicleInfoMapper.insertBatch(XmbhList);
List<TLpgVehicleInfo> successDataList = new ArrayList<>();
// 2024-09-14 加上企业信息
List<TLpgVehicleInfo> collect = XmbhList.stream().filter(item -> StringUtils.isNotBlank(item.getEnterpriseName()) && StringUtils.isNotBlank(item.getCarNum())).collect(Collectors.toList());
errorNum += (XmbhList.size() - collect.size());
List<String> collect1 = collect.stream().map(TLpgVehicleInfo::getEnterpriseName).collect(Collectors.toList());
List<TEnterpriseInfo> tEnterpriseInfos = tEnterpriseInfoMapper.queryAllByEnterpriseNameList(collect1);
// 按照企业名称分组
Map<String, List<TEnterpriseInfo>> collect2 = tEnterpriseInfos.stream().collect(Collectors.groupingBy(TEnterpriseInfo::getEnterpriseName));
for (TLpgVehicleInfo tLpgVehicleInfo : collect) {
List<TEnterpriseInfo> tEnterpriseInfos1 = collect2.get(tLpgVehicleInfo.getEnterpriseName());
if (tEnterpriseInfos1 != null && tEnterpriseInfos1.size() > 0) {
tLpgVehicleInfo.setEnterpriseId(tEnterpriseInfos1.get(0).getEnterpriseId());
successDataList.add(tLpgVehicleInfo);
successNum++;
} else {
errorNum++;
}
}
if (successDataList.size() > 0) {
tLpgVehicleInfoMapper.insertBatch(successDataList);
}
}
HashMap<String,Object> map = new HashMap<>();
map.put("successNum",successNum);
map.put("errorNum",errorNum);
return AjaxResult.success(map);
}
}
......@@ -23,10 +23,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="phone" column="phone" />
<result property="isDel" column="is_del" />
<result property="remarks" column="remarks" />
<result property="enterpriseId" column="enterprise_id" />
<result property="enterpriseName" column="enterpriseName" />
</resultMap>
<sql id="selectTLpgVehicleInfoVo">
select vehicle_id, station_name, car_number, beyond_enterprise_id, vehicle_code, car_num, brand_model, vehicle_type, vehicle_load, vehicle_size, vehicle_limt, vehicle_inspect, person_liable, on_state, vehicle_user, phone, is_del, remarks from t_lpg_vehicle_info
select vehicle.vehicle_id, vehicle.station_name, vehicle.car_number, vehicle.beyond_enterprise_id, vehicle.vehicle_code, vehicle.car_num,
vehicle.brand_model, vehicle.vehicle_type, vehicle.vehicle_load, vehicle.vehicle_size, vehicle.vehicle_limt, vehicle.vehicle_inspect,
vehicle.person_liable, vehicle.on_state, vehicle.vehicle_user, vehicle.phone, vehicle.is_del, vehicle.remarks,enterprise.enterprise_name as enterpriseName
from t_lpg_vehicle_info vehicle
left join t_enterprise_info enterprise on vehicle.enterprise_id = enterprise.enterprise_id
</sql>
<select id="selectTLpgVehicleInfoList" parameterType="TLpgVehicleInfo" resultMap="TLpgVehicleInfoResult">
......@@ -61,13 +67,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into t_lpg_vehicle_info (station_name, car_number,vehicle_code,car_num,brand_model,vehicle_type,
vehicle_load,vehicle_size,vehicle_limt,vehicle_inspect,person_liable,on_state,vehicle_user,
phone,remarks)
phone,remarks,enterprise_id)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.stationName,jdbcType=VARCHAR}, #{item.carNumber}, #{item.vehicleCode,jdbcType=VARCHAR},
#{item.carNum,jdbcType=VARCHAR}, #{item.brandModel,jdbcType=VARCHAR}, #{item.vehicleType},
#{item.vehicleLoad},#{item.vehicleSize},#{item.vehicleLimt},#{item.vehicleInspect},
#{item.personLiable},#{item.onState},#{item.vehicleUser},#{item.phone},#{item.remarks})
#{item.personLiable},#{item.onState},#{item.vehicleUser},#{item.phone},#{item.remarks},#{item.enterpriseId})
</foreach>
</insert>
......@@ -91,6 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phone != null">phone,</if>
<if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if>
<if test="enterpriseId != null">enterprise_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stationName != null">#{stationName},</if>
......@@ -110,6 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phone != null">#{phone},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if>
<if test="enterpriseId != null">#{enterpriseId},</if>
</trim>
</insert>
......@@ -133,6 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phone != null">phone = #{phone},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="remarks != null">remarks = #{remarks},</if>
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
</trim>
where vehicle_id = #{vehicleId}
</update>
......
......@@ -3,6 +3,13 @@
<el-form label-width="120px">
<el-row class="el-row-table">
<el-col :span="12">
<el-form-item label="燃气企业">
<span v-if="detailInfo.enterpriseName">{{ detailInfo.enterpriseName }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="车辆编号">
<span v-if="detailInfo.carNumber">{{ detailInfo.carNumber }}</span>
......
......@@ -88,6 +88,7 @@
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="燃气企业" align="center" prop="enterpriseName" :show-overflow-tooltip="true" />
<el-table-column label="储配站" align="center" prop="stationName" />
<el-table-column label="车辆编号" align="center" prop="carNumber" />
<el-table-column label="车牌" align="center" prop="carNum" />
......@@ -335,7 +336,7 @@ export default {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + "成功:" + response.data.successNum + "条,失败:" + response.data.errorNum + "条" + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.getList();
},
......
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