Commit 32ca5b5e authored by wanghao's avatar wanghao

1 液化石油气监管-气瓶档案-导入和外部对接接口加上 企业信息涉及到功能模块调整。

parent 3a3e1d4a
......@@ -7,16 +7,20 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.Encryption;
import com.zehong.system.domain.TEnterpriseInfo;
import com.zehong.system.domain.TLpgGasBottleFiles;
import com.zehong.system.domain.keyInformation;
import com.zehong.system.mapper.TEnterpriseInfoMapper;
import com.zehong.system.service.DecryptService;
import com.zehong.system.service.ITLpgGasBottleFilesService;
import com.zehong.web.controller.tool.DESEncoder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
......@@ -42,8 +46,11 @@ public class lpgGasController {
@Autowired
private ITLpgGasBottleFilesService tLpgGasBottleFilesService;
@Value("${externalDockingLpgGas}")
private String externalDockingLpgGas;
@Autowired
DecryptService decryptService;
@Resource
private TEnterpriseInfoMapper tEnterpriseInfoMapper;
/**
* 创建 气瓶档案接口
......@@ -52,11 +59,19 @@ public class lpgGasController {
@PostMapping("/createLpgGasBottleFiles")
public AjaxResult createLpgGasBottleFiles(@RequestBody Encryption encryption){
keyInformation selectkey = decryptService.selectkey(encryption.getQybm());
DESEncoder desEncoder=new DESEncoder();
String data = encryption.getData();
String decrypt = desEncoder.decrypt(data, externalDockingLpgGas);
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;
......@@ -302,6 +317,9 @@ public class lpgGasController {
lpgGasBottleFiles1.setBotImage(botImage);
}
// 设置 企业id
lpgGasBottleFiles1.setEnterpriseId(tEnterpriseInfo.getEnterpriseId());
successNum++;
lpgGasBottleFiles.add(lpgGasBottleFiles1);
}
......
......@@ -121,8 +121,7 @@ public class TLpgGasBottleFilesController extends BaseController
ExcelUtil<TLpgGasBottleFiles> util = new ExcelUtil<>(TLpgGasBottleFiles.class);
List<TLpgGasBottleFiles> XmbhList = util.importExcel(file.getInputStream());
tLpgGasBottleFilesService.importLpgGasBottleFilesInfo(XmbhList, updateSupport, response);
return AjaxResult.success();
return tLpgGasBottleFilesService.importLpgGasBottleFilesInfo(XmbhList, updateSupport, response);
}
}
......@@ -19,6 +19,13 @@ public class TLpgGasBottleFiles extends BaseEntity
/** id */
private Long gasBottleFilesId;
/**
* 燃气企业名称
*/
/** 燃气企业 */
@Excel(name = "燃气企业")
private String enterpriseName;
/** 生产(制造单位) */
@Excel(name = "生产(制造单位) ", width = 30 )
private String makeInfo;
......@@ -199,6 +206,11 @@ public class TLpgGasBottleFiles extends BaseEntity
private String rowVersion;
/**
* 燃气企业id
*/
private String enterpriseId;
public Long getGasBottleFilesId() {
return gasBottleFilesId;
}
......@@ -566,6 +578,22 @@ public class TLpgGasBottleFiles extends BaseEntity
this.wpressure = wpressure;
}
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;
}
@Override
public String toString() {
return "TLpgGasBottleFiles{" +
......
......@@ -13,4 +13,6 @@ public class keyInformation {
private String qybm;
private String secretKey;
private String enterpriseId;
}
......@@ -2,6 +2,8 @@ package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TEnterpriseInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.PathVariable;
/**
* 企业信息Mapper接口
......@@ -27,6 +29,13 @@ public interface TEnterpriseInfoMapper
*/
public List<TEnterpriseInfo> selectTEnterpriseInfoByName(String enterpriseName);
/**
* 根据企业名称集合 查询 企业集合数据
* @param list list
* @return r
*/
public List<TEnterpriseInfo> queryAllByEnterpriseNameList(@Param("list") List<String> list);
/**
* 查询企业信息列表
*
......
......@@ -77,7 +77,7 @@ public interface ITLpgGasBottleFilesService
* @param response res
* @return r
*/
public void importLpgGasBottleFilesInfo(List<TLpgGasBottleFiles> xmbhList, boolean updateSupport, HttpServletResponse response);
public AjaxResult importLpgGasBottleFilesInfo(List<TLpgGasBottleFiles> xmbhList, boolean updateSupport, HttpServletResponse response);
/**
......
......@@ -77,7 +77,7 @@ public class TLpgDeliveryRecordServiceImpl implements ITLpgDeliveryRecordService
continue;
}
// 如果都为空 则 返回
// 如果都为空 则 返回 2024-09-14 如果没有 userOwnId的话,也可以入库。
if (StringUtils.isBlank(tLpgDeliveryRecordImportVo.getNickName())
&& StringUtils.isBlank(tLpgDeliveryRecordImportVo.getPhone())
&& StringUtils.isBlank(tLpgDeliveryRecordImportVo.getAddress())
......@@ -86,16 +86,6 @@ public class TLpgDeliveryRecordServiceImpl implements ITLpgDeliveryRecordService
continue;
}
// 如果 用户名 + 电话 + 地址 其中一个为空,则 userOwnId 不许为空
if((StringUtils.isBlank(tLpgDeliveryRecordImportVo.getNickName()) ||
StringUtils.isBlank(tLpgDeliveryRecordImportVo.getPhone()) ||
StringUtils.isBlank(tLpgDeliveryRecordImportVo.getAddress()))
&& StringUtils.isBlank(tLpgDeliveryRecordImportVo.getUserOwnId())) {
errorNum ++;
continue;
}
// 气瓶条码处理
TLpgGasBottleFiles tLpgGasBottleFiles = new TLpgGasBottleFiles();
tLpgGasBottleFiles.setQrcode(tLpgDeliveryRecordImportVo.getBottleCode());
......@@ -113,24 +103,11 @@ public class TLpgDeliveryRecordServiceImpl implements ITLpgDeliveryRecordService
TYehuaqiUser yehuaqiUser = yehuaqiUserMapper.selectByUserOwnIdAndBeyondEnterpriseId(deptId, tLpgDeliveryRecordImportVo.getUserOwnId());
if (yehuaqiUser == null) {
List<TYehuaqiUser> yehuaqiUsers = yehuaqiUserMapper.selectByUsernameAndPhoneAndAddress(tLpgDeliveryRecordImportVo.getNickName(),
tLpgDeliveryRecordImportVo.getPhone(), tLpgDeliveryRecordImportVo.getAddress());
if (yehuaqiUsers == null || yehuaqiUsers.size() == 0) {
errorNum ++;
continue;
}
lpgDeliveryRecord.setUserId(yehuaqiUsers.get(0).getUserId());
errorNum++;
continue;
} else {
lpgDeliveryRecord.setUserId(yehuaqiUser.getUserId());
}
} else {
List<TYehuaqiUser> yehuaqiUsers = yehuaqiUserMapper.selectByUsernameAndPhoneAndAddress(tLpgDeliveryRecordImportVo.getNickName(),
tLpgDeliveryRecordImportVo.getPhone(), tLpgDeliveryRecordImportVo.getAddress());
if (yehuaqiUsers == null || yehuaqiUsers.size() == 0) {
errorNum ++;
continue;
}
lpgDeliveryRecord.setUserId(yehuaqiUsers.get(0).getUserId());
}
lpgDeliveryRecord.setStationName(tLpgDeliveryRecordImportVo.getStationName());
......
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.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -26,6 +32,9 @@ public class TLpgGasBottleFilesServiceImpl implements ITLpgGasBottleFilesService
@Resource
private TLpgGasBottleFilesMapper tLpgGasBottleFilesMapper;
@Resource
private TEnterpriseInfoMapper enterpriseInfoMapper;
/**
* 查询液化石油气-气瓶档案
......@@ -117,10 +126,49 @@ public class TLpgGasBottleFilesServiceImpl implements ITLpgGasBottleFilesService
* @return r
*/
@Override
public void importLpgGasBottleFilesInfo(List<TLpgGasBottleFiles> xmbhList, boolean updateSupport, HttpServletResponse response) {
public AjaxResult importLpgGasBottleFilesInfo(List<TLpgGasBottleFiles> xmbhList, boolean updateSupport, HttpServletResponse response) {
int successNum = 0;
int errorNum = 0;
Map<String ,Object> map = new HashMap<>();
if (xmbhList.size() > 0) {
tLpgGasBottleFilesMapper.insertBatch(xmbhList);
// 2024-09-14 加上企业信息了
List<TLpgGasBottleFiles> successDataList = new ArrayList<>();
// 过滤下有 企业名称的
List<TLpgGasBottleFiles> collect = xmbhList.stream().filter(item -> StringUtils.isNotBlank(item.getEnterpriseName())).collect(Collectors.toList());
errorNum += (xmbhList.size() - collect.size());
// 企业名称集合 根据企业名称集合查询 企业是否存在
List<String> collect1 = collect.stream().map(item -> item.getEnterpriseName()).collect(Collectors.toList());
// 企业集合
List<TEnterpriseInfo> tEnterpriseInfos = enterpriseInfoMapper.queryAllByEnterpriseNameList(collect1);
// 根据企业名称分组
Map<String, List<TEnterpriseInfo>> collect2 = tEnterpriseInfos.stream().collect(Collectors.groupingBy(TEnterpriseInfo::getEnterpriseName));
for (TLpgGasBottleFiles tLpgGasBottleFiles : collect) {
List<TEnterpriseInfo> tEnterpriseInfos1 = collect2.get(tLpgGasBottleFiles.getEnterpriseName());
if (tEnterpriseInfos1 != null) {
successDataList.add(tLpgGasBottleFiles);
successNum++;
} else {
errorNum ++;
}
}
if (successDataList.size() > 0) {
tLpgGasBottleFilesMapper.insertBatch(successDataList);
}
}
map.put("errorNum",errorNum);
map.put("successNum",successNum);
return AjaxResult.success(map);
}
/**
......
......@@ -9,6 +9,7 @@
<result property="keyId" column="key_id" />
<result property="qybm" column="qybm" />
<result property="secretKey" column="secret_key" />
<result property="enterpriseId" column="enterprise_id" />
</resultMap>
<!--查询企业秘钥-->
......
......@@ -64,6 +64,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectTEnterpriseInfoVo"/>
where enterprise_name = #{enterpriseName} and is_del='0'
</select>
<select id="queryAllByEnterpriseNameList" parameterType="list" resultMap="TEnterpriseInfoResult">
select * from t_enterprise_info where enterprise_name in
<foreach collection="list" separator="," open="(" item="item" index="i" close=")">
#{item}
</foreach>
</select>
<insert id="insertTEnterpriseInfo" parameterType="TEnterpriseInfo" useGeneratedKeys="true" keyProperty="enterpriseId">
insert into t_enterprise_info
......
......@@ -51,22 +51,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="holeCode" column="f_hole_code" />
<result property="bottleStorageType" column="f_bottle_storage_type" />
<result property="rowVersion" column="f_row_version" />
<result property="rowVersion" column="f_row_version" />
<result property="enterpriseId" column="enterprise_id" />
<result property="enterpriseName" column="enterpriseName" />
</resultMap>
<sql id="selectTLpgGasBottleFilesVo">
select f_gas_bottle_files_id, f_reg_code, f_equ_no, f_equ_type, f_medium, f_make_date, f_make_info, f_self_id,f_pressure, f_volume, f_app_id, f_q_rcode,f_build_user,f_p_chk_date, f_n_chk_date, f_product_date, f_discard_date, f_safe_judge_date, f_g_pressure, f_w_pressure, f_self_weight, f_thickness, f_permit_no, f_valve_name, f_pay_image, f_batch_image, f_device_image, f_check_image, f_equ_no_image, f_self_id_image, f_bot_image, f_bot_spec_name, f_bottle_type, f_inspected_times,
( CASE f_is_specialized WHEN '1' THEN '专用' WHEN '2' THEN '托管' ELSE '-' END ) AS f_is_specialized,
f_valve_manu_facturer, f_inspection_label, f_third_party_label, f_hole_code, f_bottle_storage_type,
( CASE f_state WHEN '1' THEN '新增' WHEN '2' THEN '修改' WHEN '-1' THEN '删除' ELSE '-' END ) AS f_state,
f_opt_name, f_add_time, f_up_time, f_up_opt_name, f_row_version from t_lpg_gas_bottle_files
select files.f_gas_bottle_files_id, files.f_reg_code, files.f_equ_no, files.f_equ_type, files.f_medium, files.f_make_date, files.f_make_info,
files.f_self_id,files.f_pressure, files.f_volume, files.f_app_id, files.f_q_rcode,files.f_build_user,files.f_p_chk_date, files.f_n_chk_date,
files.f_product_date, files.f_discard_date, files.f_safe_judge_date, files.f_g_pressure, files.f_w_pressure, files.f_self_weight,
files.f_thickness, files.f_permit_no, files.f_valve_name, files.f_pay_image, files.f_batch_image, files.f_device_image, files.f_check_image,
files.f_equ_no_image, files.f_self_id_image, files.f_bot_image, files.f_bot_spec_name, files.f_bottle_type, files.f_inspected_times,
( CASE files.f_is_specialized WHEN '1' THEN '专用' WHEN '2' THEN '托管' ELSE '-' END ) AS f_is_specialized,
files.f_valve_manu_facturer, files.f_inspection_label, files.f_third_party_label, files.f_hole_code, files.f_bottle_storage_type,
( CASE files.f_state WHEN '1' THEN '新增' WHEN '2' THEN '修改' WHEN '-1' THEN '删除' ELSE '-' END ) AS f_state,
files.f_opt_name, files.f_add_time, files.f_up_time, files.f_up_opt_name, files.f_row_version,enterprise.enterprise_name as enterpriseName
from t_lpg_gas_bottle_files files
left join t_enterprise_info enterprise on files.enterprise_id = enterprise.enterprise_id
</sql>
<sql id="exportTLpgGasBottleFilesVo">
select f_gas_bottle_files_id, f_reg_code, f_equ_no, f_equ_type, f_medium, f_make_date, f_make_info, f_self_id,f_pressure, f_volume, f_app_id, f_q_rcode,f_build_user,f_p_chk_date, f_n_chk_date, f_product_date, f_discard_date, f_safe_judge_date, f_g_pressure, f_w_pressure, f_self_weight, f_thickness, f_permit_no, f_valve_name, f_pay_image, f_batch_image, f_device_image, f_check_image, f_equ_no_image, f_self_id_image, f_bot_image, f_bot_spec_name, f_bottle_type, f_inspected_times,
f_is_specialized,
f_valve_manu_facturer, f_inspection_label, f_third_party_label, f_hole_code, f_bottle_storage_type,
f_state,
f_opt_name, f_add_time, f_up_time, f_up_opt_name, f_row_version from t_lpg_gas_bottle_files
select files.f_gas_bottle_files_id, files.f_reg_code, files.f_equ_no, files.f_equ_type, files.f_medium, files.f_make_date,
files.f_make_info, files.f_self_id,files.f_pressure, files.f_volume, files.f_app_id, files.f_q_rcode,files.f_build_user,
files.f_p_chk_date, files.f_n_chk_date, files.f_product_date, files.f_discard_date, files.f_safe_judge_date,
files.f_g_pressure, files.f_w_pressure, files.f_self_weight, files.f_thickness, files.f_permit_no, files.f_valve_name,
files.f_pay_image, files.f_batch_image, files.f_device_image, files.f_check_image, files.f_equ_no_image,
files.f_self_id_image, files.f_bot_image, files.f_bot_spec_name, files.f_bottle_type, files.f_inspected_times,
files.f_is_specialized,files.f_valve_manu_facturer, files.f_inspection_label, files.f_third_party_label,
files.f_hole_code, files.f_bottle_storage_type,files.f_state,files.f_opt_name, files.f_add_time, files.f_up_time,
files.f_up_opt_name, files.f_row_version,enterprise.enterprise_name as enterpriseName
from t_lpg_gas_bottle_files files
left join t_enterprise_info enterprise on files.enterprise_id = enterprise.enterprise_id
</sql>
<select id="selectTLpgGasBottleFilesList" parameterType="TLpgGasBottleFiles" resultMap="TLpgGasBottleFilesResult">
......@@ -122,7 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
f_discard_date,f_safe_judge_date,f_g_pressure,f_w_pressure,f_self_weight,f_thickness,f_permit_no,
f_valve_name,f_bot_spec_name,f_bottle_type,f_inspected_times,f_is_specialized,f_valve_manu_facturer,
f_inspection_label, f_third_party_label,f_hole_code,f_bottle_storage_type,f_state,f_opt_name,f_add_time,
f_up_time,f_up_opt_name,f_row_version)
f_up_time,f_up_opt_name,f_row_version,enterprise_id)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.regCode,jdbcType=VARCHAR}, #{item.equNo}, #{item.equType,jdbcType=VARCHAR},
......@@ -135,7 +150,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.inspectedTimes},#{item.isSpecialized},#{item.valveManuFacturer},#{item.inspectionLabel},#{item.thirdPartyLabel},
#{item.holeCode,jdbcType=VARCHAR}, #{item.bottleStorageType}, #{item.state,jdbcType=VARCHAR},
#{item.optName,jdbcType=VARCHAR}, #{item.addTime}, #{item.upTime},
#{item.upOptName},#{item.rowVersion})
#{item.upOptName},#{item.rowVersion},#{item.enterpriseId})
</foreach>
</insert>
......@@ -189,6 +204,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="upTime != null">f_up_time,</if>
<if test="upOptName != null">f_up_opt_name,</if>
<if test="rowVersion != null">f_row_version,</if>
<if test="enterpriseId != null">enterprise_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="regCode != null">#{regCode},</if>
......@@ -238,6 +254,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="upOptName != null">#{upOptName},</if>
<if test="rowVersion != null">#{rowVersion},</if>
<if test="enterpriseId != null">#{enterpriseId},</if>
</trim>
</insert>
......@@ -290,6 +307,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="upTime != null">f_up_time = #{upTime},</if>
<if test="upOptName != null">f_up_opt_name = #{upOptName},</if>
<if test="rowVersion != null">f_row_version = #{rowVersion},</if>
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
</trim>
where f_gas_bottle_files_id = #{fGasBottleFilesId}
</update>
......
......@@ -5,6 +5,15 @@
<el-form label-width="180px">
<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.makeInfo">{{ detailInfo.makeInfo }}</span>
......
......@@ -63,6 +63,7 @@
<el-table v-loading="loading" :data="filesList" @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="makeInfo" :show-overflow-tooltip="true"/>
<el-table-column label="气瓶条码" align="center" prop="qrcode" :show-overflow-tooltip="true"/>
<el-table-column label="钢瓶规格名称" align="center" prop="botSpecName" :show-overflow-tooltip="true"/>
......@@ -263,7 +264,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();
this.$showLoading.hide();
},
......
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