Commit 8b6d12db authored by wanghao's avatar wanghao

1 基础信息维护下 的 天然气用户 和 液化石油气监管下的 液化气用户 由之前的两张表 合并成 一张表处理

parent 130ca818
...@@ -8,6 +8,7 @@ import com.zehong.common.core.domain.AjaxResult; ...@@ -8,6 +8,7 @@ import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.StringUtils; import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.*; import com.zehong.system.domain.*;
import com.zehong.system.domain.vo.UserManageSafetyDeviceExportVo;
import com.zehong.system.domain.vo.YeHuaqiUserManageSafetyDeviceExportVo; import com.zehong.system.domain.vo.YeHuaqiUserManageSafetyDeviceExportVo;
import com.zehong.system.mapper.TEnterpriseInfoMapper; import com.zehong.system.mapper.TEnterpriseInfoMapper;
import com.zehong.system.service.*; import com.zehong.system.service.*;
...@@ -61,11 +62,17 @@ public class lpgGasController { ...@@ -61,11 +62,17 @@ public class lpgGasController {
@Resource @Resource
private ITLpgSafeCheckRecordService lpgSafeCheckRecordService; private ITLpgSafeCheckRecordService lpgSafeCheckRecordService;
// /**
// * 燃气用户
// */
// @Resource
// private ITYehuaqiUserService tYehuaqiUserService;
/** /**
* 燃气用户 * 燃气用户
*/ */
@Resource @Resource
private ITYehuaqiUserService tYehuaqiUserService; private ITDetectorUserService itDetectorUserService;
/** /**
* 配送记录 * 配送记录
...@@ -1693,12 +1700,12 @@ public class lpgGasController { ...@@ -1693,12 +1700,12 @@ public class lpgGasController {
// 处理有 userOwnId的 看看 燃气用户表下有没有数据 // 处理有 userOwnId的 看看 燃气用户表下有没有数据
List<String> collect1 = collect.stream().map(TLpgSafeCheckRecord::getUserOwnId).collect(Collectors.toList()); List<String> collect1 = collect.stream().map(TLpgSafeCheckRecord::getUserOwnId).collect(Collectors.toList());
List<TYehuaqiUser> yehuaqiUsers = tYehuaqiUserService.queryByUserOwnIdsAndEnterpriseId(collect1, tEnterpriseInfo.getEnterpriseId()); List<TDetectorUser> yehuaqiUsers = itDetectorUserService.queryByUserOwnIdsAndEnterpriseId(collect1, tEnterpriseInfo.getEnterpriseId());
if (yehuaqiUsers.size() > 0) { if (yehuaqiUsers.size() > 0) {
Map<String, List<TYehuaqiUser>> collect3 = yehuaqiUsers.stream().collect(Collectors.groupingBy(TYehuaqiUser::getUserOwnId)); Map<String, List<TDetectorUser>> collect3 = yehuaqiUsers.stream().collect(Collectors.groupingBy(TDetectorUser::getUserOwnId));
for (TLpgSafeCheckRecord tLpgSafeCheckRecord : collect) { for (TLpgSafeCheckRecord tLpgSafeCheckRecord : collect) {
List<TYehuaqiUser> yehuaqiUsers1 = collect3.get(tLpgSafeCheckRecord.getUserOwnId()); List<TDetectorUser> yehuaqiUsers1 = collect3.get(tLpgSafeCheckRecord.getUserOwnId());
if (yehuaqiUsers1.size() > 0) { if (yehuaqiUsers1.size() > 0) {
successNum ++; successNum ++;
tLpgSafeCheckRecord.setPlaceCheckPic(""); tLpgSafeCheckRecord.setPlaceCheckPic("");
...@@ -1987,11 +1994,12 @@ public class lpgGasController { ...@@ -1987,11 +1994,12 @@ public class lpgGasController {
if (userOwnIdNotBlankList.size() > 0) { if (userOwnIdNotBlankList.size() > 0) {
List<String> collect3 = userOwnIdNotBlankList.stream().map(TLpgDeliveryRecord::getUserOwnId).collect(Collectors.toList()); List<String> collect3 = userOwnIdNotBlankList.stream().map(TLpgDeliveryRecord::getUserOwnId).collect(Collectors.toList());
List<TYehuaqiUser> yehuaqiUsers = tYehuaqiUserService.queryByUserOwnIdsAndEnterpriseId(collect3, tEnterpriseInfo.getEnterpriseId()); // 2024-10-26 调整 基础信息下的天然气用户 和 液化石油气监管下的 石油气用户都用 t_detector_user 这张表
List<TDetectorUser> yehuaqiUsers = itDetectorUserService.queryByUserOwnIdsAndEnterpriseId(collect3, tEnterpriseInfo.getEnterpriseId());
if (yehuaqiUsers.size() > 0) { if (yehuaqiUsers.size() > 0) {
Map<String, List<TYehuaqiUser>> collect2 = yehuaqiUsers.stream().collect(Collectors.groupingBy(TYehuaqiUser::getUserOwnId)); Map<String, List<TDetectorUser>> collect2 = yehuaqiUsers.stream().collect(Collectors.groupingBy(TDetectorUser::getUserOwnId));
for (TLpgDeliveryRecord tLpgDeliveryRecord : userOwnIdNotBlankList) { for (TLpgDeliveryRecord tLpgDeliveryRecord : userOwnIdNotBlankList) {
List<TYehuaqiUser> yehuaqiUsers1 = collect2.get(tLpgDeliveryRecord.getUserOwnId()); List<TDetectorUser> yehuaqiUsers1 = collect2.get(tLpgDeliveryRecord.getUserOwnId());
if (yehuaqiUsers1 != null && yehuaqiUsers1.size() > 0) { if (yehuaqiUsers1 != null && yehuaqiUsers1.size() > 0) {
userOwnIdNotBlackLpgDeliveryRecords.add(tLpgDeliveryRecord); userOwnIdNotBlackLpgDeliveryRecords.add(tLpgDeliveryRecord);
lpgThirdPartyDockingInterfaceRecord = successRecord("createLpgDeliveryRecord", tLpgDeliveryRecord.toString(), encryption.getQybm()); lpgThirdPartyDockingInterfaceRecord = successRecord("createLpgDeliveryRecord", tLpgDeliveryRecord.toString(), encryption.getQybm());
...@@ -2094,21 +2102,23 @@ public class lpgGasController { ...@@ -2094,21 +2102,23 @@ public class lpgGasController {
return AjaxResult.error("每次最多处理200条数据"); return AjaxResult.error("每次最多处理200条数据");
} }
List<TYehuaqiUser> yehuaqiUsers = new ArrayList<>(); // 2024-10-26 基础信息里面的 天然气用户 和 液压石油气监管下的 液化气用户 都使用 t_detector_user 这张表的数据
List<TDetectorUser> yehuaqiUsers = new ArrayList<>();
// 筛出去 userOwnId 重复的 // 筛出去 userOwnId 重复的
List<TYehuaqiUser> noRepeatUserOwnIdList; List<TDetectorUser> noRepeatUserOwnIdList;
// 需要更新的数据 // 需要更新的数据
List<TYehuaqiUser> updateYehuaqiUsers = new ArrayList<>(); List<TDetectorUser> updateYehuaqiUsers = new ArrayList<>();
// 安全装置 集合数据 // 安全装置 集合数据
List<TYehuaqiuserSafetyDeviceInfo> yehuaqiuserSafetyDeviceInfos = new ArrayList<>(); List<TGasuserSafetyDeviceInfo> yehuaqiuserSafetyDeviceInfos = new ArrayList<>();
// 需要修改的燃气用户的 安全装置 集合数据 // 需要修改的燃气用户的 安全装置 集合数据
List<TYehuaqiuserSafetyDeviceInfo> updateYehuaqiuserSafetyDeviceInfos = new ArrayList<>(); List<TGasuserSafetyDeviceInfo> updateYehuaqiuserSafetyDeviceInfos = new ArrayList<>();
TYehuaqiUser yehuaqiUser; TDetectorUser yehuaqiUser;
String dateFormat = "yyyy-MM-dd"; String dateFormat = "yyyy-MM-dd";
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
...@@ -2117,7 +2127,7 @@ public class lpgGasController { ...@@ -2117,7 +2127,7 @@ public class lpgGasController {
List<TLpgThirdPartyDockingInterfaceRecord> lpgThirdPartyDockingInterfaceRecords = new ArrayList<>(); List<TLpgThirdPartyDockingInterfaceRecord> lpgThirdPartyDockingInterfaceRecords = new ArrayList<>();
TLpgThirdPartyDockingInterfaceRecord lpgThirdPartyDockingInterfaceRecord; TLpgThirdPartyDockingInterfaceRecord lpgThirdPartyDockingInterfaceRecord;
for (JSONObject object : list) { for (JSONObject object : list) {
yehuaqiUser = new TYehuaqiUser(); yehuaqiUser = new TDetectorUser();
String userOwnId = object.getString("userOwnId"); String userOwnId = object.getString("userOwnId");
...@@ -2296,10 +2306,12 @@ public class lpgGasController { ...@@ -2296,10 +2306,12 @@ public class lpgGasController {
yehuaqiUser.setPhone(phone); yehuaqiUser.setPhone(phone);
yehuaqiUser.setRemarks(remarks); yehuaqiUser.setRemarks(remarks);
yehuaqiUser.setBeyondEnterpriseId(tEnterpriseInfo.getEnterpriseId()); yehuaqiUser.setBeyondEnterpriseId(tEnterpriseInfo.getEnterpriseId());
// 2024-10-26 液化气和天然气都是用 t_detector_user 这张表,所以接口来的默认传1
yehuaqiUser.setGasType("1");
List<YeHuaqiUserManageSafetyDeviceExportVo> tYehuaqiuserSafetyDeviceInfoList = new ArrayList<>(); List<UserManageSafetyDeviceExportVo> tYehuaqiuserSafetyDeviceInfoList = new ArrayList<>();
JSONArray safetyDeviceList = object.getJSONArray("safetyDeviceList"); JSONArray safetyDeviceList = object.getJSONArray("safetyDeviceList");
YeHuaqiUserManageSafetyDeviceExportVo yehuaqiuserSafetyDeviceInfo; UserManageSafetyDeviceExportVo yehuaqiuserSafetyDeviceInfo;
// 安装装置有错误时只做记录,不做任何错误提示返回。也不入库。 // 安装装置有错误时只做记录,不做任何错误提示返回。也不入库。
if (safetyDeviceList != null) { if (safetyDeviceList != null) {
...@@ -2407,16 +2419,16 @@ public class lpgGasController { ...@@ -2407,16 +2419,16 @@ public class lpgGasController {
|| fDeviceInstallTime.length() > 0 || fDeviceInstallPosition.length() > 0 || fDeviceInstallTime.length() > 0 || fDeviceInstallPosition.length() > 0
|| fHead.length() > 0 || fPhone.length() > 0) { || fHead.length() > 0 || fPhone.length() > 0) {
yehuaqiuserSafetyDeviceInfo = new YeHuaqiUserManageSafetyDeviceExportVo(); yehuaqiuserSafetyDeviceInfo = new UserManageSafetyDeviceExportVo();
yehuaqiuserSafetyDeviceInfo.setfDeviceName(fDeviceName); yehuaqiuserSafetyDeviceInfo.setDeviceName(fDeviceName);
yehuaqiuserSafetyDeviceInfo.setfDeviceModel(fDeviceModel); yehuaqiuserSafetyDeviceInfo.setDeviceModel(fDeviceModel);
yehuaqiuserSafetyDeviceInfo.setfIotNo(fIotNo); yehuaqiuserSafetyDeviceInfo.setfIotNo(fIotNo);
yehuaqiuserSafetyDeviceInfo.setfRelationDeviceType(fRelationDeviceType); yehuaqiuserSafetyDeviceInfo.setRelationDeviceType(fRelationDeviceType);
yehuaqiuserSafetyDeviceInfo.setfDetectionMedium(fDetectionMedium); yehuaqiuserSafetyDeviceInfo.setDetectionMedium(fDetectionMedium);
yehuaqiuserSafetyDeviceInfo.setfDeviceInstallTime(DateUtils.parseDate(fDeviceInstallTime)); yehuaqiuserSafetyDeviceInfo.setDeviceInstallTime(DateUtils.parseDate(fDeviceInstallTime));
yehuaqiuserSafetyDeviceInfo.setfDeviceInstallPosition(fDeviceInstallPosition); yehuaqiuserSafetyDeviceInfo.setDeviceInstallPosition(fDeviceInstallPosition);
yehuaqiuserSafetyDeviceInfo.setfHead(fHead); yehuaqiuserSafetyDeviceInfo.setHead(fHead);
yehuaqiuserSafetyDeviceInfo.setfPhone(fPhone); yehuaqiuserSafetyDeviceInfo.setPhone(fPhone);
tYehuaqiuserSafetyDeviceInfoList.add(yehuaqiuserSafetyDeviceInfo); tYehuaqiuserSafetyDeviceInfoList.add(yehuaqiuserSafetyDeviceInfo);
} }
} }
...@@ -2431,7 +2443,7 @@ public class lpgGasController { ...@@ -2431,7 +2443,7 @@ public class lpgGasController {
//1 封装完数据后 先去重,userOwnId 相同的筛一筛 //1 封装完数据后 先去重,userOwnId 相同的筛一筛
if (yehuaqiUsers.size() > 0) { if (yehuaqiUsers.size() > 0) {
Set<TYehuaqiUser> yehuaqiUsers1 = new HashSet<>(yehuaqiUsers); Set<TDetectorUser> yehuaqiUsers1 = new HashSet<>(yehuaqiUsers);
int i = yehuaqiUsers.size() - yehuaqiUsers1.size(); int i = yehuaqiUsers.size() - yehuaqiUsers1.size();
if (i > 0) { if (i > 0) {
...@@ -2443,13 +2455,13 @@ public class lpgGasController { ...@@ -2443,13 +2455,13 @@ public class lpgGasController {
//2 筛除重复后,再筛下 有村的是否在监管平台存在 //2 筛除重复后,再筛下 有村的是否在监管平台存在
if(noRepeatUserOwnIdList.size() > 0) { if(noRepeatUserOwnIdList.size() > 0) {
List<Long> collect = noRepeatUserOwnIdList.stream().filter(item -> item.getVillageId() != null).map(TYehuaqiUser::getVillageId).collect(Collectors.toList()); List<Long> collect = noRepeatUserOwnIdList.stream().filter(item -> item.getVillageId() != null).map(TDetectorUser::getVillageId).collect(Collectors.toList());
List<TUserManageVillage> userManageVillages = itUserManageVillageService.queryByVillageIds(collect); List<TUserManageVillage> userManageVillages = itUserManageVillageService.queryByVillageIds(collect);
Map<Long, List<TUserManageVillage>> collect1 = userManageVillages.stream().collect(Collectors.groupingBy(TUserManageVillage::getfVillageId)); Map<Long, List<TUserManageVillage>> collect1 = userManageVillages.stream().collect(Collectors.groupingBy(TUserManageVillage::getfVillageId));
Iterator<TYehuaqiUser> iterator = noRepeatUserOwnIdList.iterator(); Iterator<TDetectorUser> iterator = noRepeatUserOwnIdList.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
TYehuaqiUser next = iterator.next(); TDetectorUser next = iterator.next();
Long villageId = next.getVillageId(); Long villageId = next.getVillageId();
if (villageId != null) { if (villageId != null) {
List<TUserManageVillage> userManageVillages1 = collect1.get(villageId); List<TUserManageVillage> userManageVillages1 = collect1.get(villageId);
...@@ -2467,17 +2479,17 @@ public class lpgGasController { ...@@ -2467,17 +2479,17 @@ public class lpgGasController {
//3 根据 userOwnId 和 enterpriseId 查询 数据库是否存在数据 存在则更新 //3 根据 userOwnId 和 enterpriseId 查询 数据库是否存在数据 存在则更新
if (noRepeatUserOwnIdList.size() > 0) { if (noRepeatUserOwnIdList.size() > 0) {
List<String> collect = noRepeatUserOwnIdList.stream().map(TYehuaqiUser::getUserOwnId).collect(Collectors.toList()); List<String> collect = noRepeatUserOwnIdList.stream().map(TDetectorUser::getUserOwnId).collect(Collectors.toList());
List<TYehuaqiUser> yehuaqiUsers2 = tYehuaqiUserService.queryByUserOwnIdAndEnterpriseIdForThirdParty(collect, tEnterpriseInfo.getEnterpriseId()); List<TDetectorUser> yehuaqiUsers2 = itDetectorUserService.queryByUserOwnIdAndEnterpriseIdForThirdParty(collect, tEnterpriseInfo.getEnterpriseId());
Map<String, List<TYehuaqiUser>> collect1 = yehuaqiUsers2.stream().collect(Collectors.groupingBy(TYehuaqiUser::getUserOwnId)); Map<String, List<TDetectorUser>> collect1 = yehuaqiUsers2.stream().collect(Collectors.groupingBy(TDetectorUser::getUserOwnId));
Iterator<TYehuaqiUser> iterator = noRepeatUserOwnIdList.iterator(); Iterator<TDetectorUser> iterator = noRepeatUserOwnIdList.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
TYehuaqiUser next = iterator.next(); TDetectorUser next = iterator.next();
List<TYehuaqiUser> yehuaqiUsers3 = collect1.get(next.getUserOwnId()); List<TDetectorUser> yehuaqiUsers3 = collect1.get(next.getUserOwnId());
if (yehuaqiUsers3 != null && yehuaqiUsers3.size() > 0) { if (yehuaqiUsers3 != null && yehuaqiUsers3.size() > 0) {
next.setUserId(yehuaqiUsers3.get(0).getUserId()); next.setUserId(yehuaqiUsers3.get(0).getUserId());
updateYehuaqiUsers.add(next); updateYehuaqiUsers.add(next);
...@@ -2490,19 +2502,19 @@ public class lpgGasController { ...@@ -2490,19 +2502,19 @@ public class lpgGasController {
// 需要新增的 // 需要新增的
if (noRepeatUserOwnIdList.size() > 0) { if (noRepeatUserOwnIdList.size() > 0) {
successNum+=noRepeatUserOwnIdList.size(); successNum+=noRepeatUserOwnIdList.size();
tYehuaqiUserService.insertBatchForThirdParty(noRepeatUserOwnIdList); itDetectorUserService.insertBatchForThirdParty(noRepeatUserOwnIdList);
for (TYehuaqiUser tYehuaqiUser : noRepeatUserOwnIdList) { for (TDetectorUser tYehuaqiUser : noRepeatUserOwnIdList) {
lpgThirdPartyDockingInterfaceRecord = successRecord("createLpgLiquefiedGasUser", tYehuaqiUser.toString(), encryption.getQybm()); lpgThirdPartyDockingInterfaceRecord = successRecord("createLpgLiquefiedGasUser", tYehuaqiUser.toString(), encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord); lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
List<YeHuaqiUserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVos = tYehuaqiUser.getUserManageSafetyDeviceExportVos(); List<UserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVos = tYehuaqiUser.getUserManageSafetyDeviceExportVos();
if (userManageSafetyDeviceExportVos != null && userManageSafetyDeviceExportVos.size() > 0) { if (userManageSafetyDeviceExportVos != null && userManageSafetyDeviceExportVos.size() > 0) {
for (YeHuaqiUserManageSafetyDeviceExportVo userManageSafetyDeviceExportVo : userManageSafetyDeviceExportVos) { for (UserManageSafetyDeviceExportVo userManageSafetyDeviceExportVo : userManageSafetyDeviceExportVos) {
TYehuaqiuserSafetyDeviceInfo tYehuaqiuserSafetyDeviceInfo = new TYehuaqiuserSafetyDeviceInfo(); TGasuserSafetyDeviceInfo tYehuaqiuserSafetyDeviceInfo = new TGasuserSafetyDeviceInfo();
BeanUtils.copyProperties(userManageSafetyDeviceExportVo,tYehuaqiuserSafetyDeviceInfo); BeanUtils.copyProperties(userManageSafetyDeviceExportVo,tYehuaqiuserSafetyDeviceInfo);
tYehuaqiuserSafetyDeviceInfo.setfRelationUserId(tYehuaqiUser.getUserId()); tYehuaqiuserSafetyDeviceInfo.setRelationGasuserId(tYehuaqiUser.getUserId());
yehuaqiuserSafetyDeviceInfos.add(tYehuaqiuserSafetyDeviceInfo); yehuaqiuserSafetyDeviceInfos.add(tYehuaqiuserSafetyDeviceInfo);
} }
} }
...@@ -2511,35 +2523,35 @@ public class lpgGasController { ...@@ -2511,35 +2523,35 @@ public class lpgGasController {
// 批量插入安全装置 // 批量插入安全装置
if (yehuaqiuserSafetyDeviceInfos.size() > 0) { if (yehuaqiuserSafetyDeviceInfos.size() > 0) {
tYehuaqiUserService.insertBatchSafetyDevice(yehuaqiuserSafetyDeviceInfos); itDetectorUserService.insertBatchSafetyDevice(yehuaqiuserSafetyDeviceInfos);
} }
//5 需要批量修改的 //5 需要批量修改的
if (updateYehuaqiUsers.size() > 0) { if (updateYehuaqiUsers.size() > 0) {
successNum+=updateYehuaqiUsers.size(); successNum+=updateYehuaqiUsers.size();
for (TYehuaqiUser updateYehuaqiUser : updateYehuaqiUsers) { for (TDetectorUser updateYehuaqiUser : updateYehuaqiUsers) {
lpgThirdPartyDockingInterfaceRecord = successRecord("createLpgLiquefiedGasUser", updateYehuaqiUser.toString(), encryption.getQybm()); lpgThirdPartyDockingInterfaceRecord = successRecord("createLpgLiquefiedGasUser", updateYehuaqiUser.toString(), encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord); lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
List<YeHuaqiUserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVos = updateYehuaqiUser.getUserManageSafetyDeviceExportVos(); List<UserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVos = updateYehuaqiUser.getUserManageSafetyDeviceExportVos();
if (userManageSafetyDeviceExportVos != null && userManageSafetyDeviceExportVos.size() > 0) { if (userManageSafetyDeviceExportVos != null && userManageSafetyDeviceExportVos.size() > 0) {
for (YeHuaqiUserManageSafetyDeviceExportVo userManageSafetyDeviceExportVo : userManageSafetyDeviceExportVos) { for (UserManageSafetyDeviceExportVo userManageSafetyDeviceExportVo : userManageSafetyDeviceExportVos) {
TYehuaqiuserSafetyDeviceInfo yehuaqiuserSafetyDeviceInfo = new TYehuaqiuserSafetyDeviceInfo(); TGasuserSafetyDeviceInfo yehuaqiuserSafetyDeviceInfo = new TGasuserSafetyDeviceInfo();
BeanUtils.copyProperties(userManageSafetyDeviceExportVo,yehuaqiuserSafetyDeviceInfo); BeanUtils.copyProperties(userManageSafetyDeviceExportVo,yehuaqiuserSafetyDeviceInfo);
yehuaqiuserSafetyDeviceInfo.setfRelationUserId(updateYehuaqiUser.getUserId()); yehuaqiuserSafetyDeviceInfo.setRelationGasuserId(updateYehuaqiUser.getUserId());
updateYehuaqiuserSafetyDeviceInfos.add(yehuaqiuserSafetyDeviceInfo); updateYehuaqiuserSafetyDeviceInfos.add(yehuaqiuserSafetyDeviceInfo);
} }
} }
} }
// 批量修改 燃气用户 // 批量修改 燃气用户
tYehuaqiUserService.updateBatch(updateYehuaqiUsers); itDetectorUserService.updateBatch(updateYehuaqiUsers);
// 批量修改完 燃气用户后 再处理 燃气用户下的 安全装置。先删除,再新增 // 批量修改完 燃气用户后 再处理 燃气用户下的 安全装置。先删除,再新增
List<Long> collect = updateYehuaqiUsers.stream().map(TYehuaqiUser::getUserId).collect(Collectors.toList()); List<Long> collect = updateYehuaqiUsers.stream().map(TDetectorUser::getUserId).collect(Collectors.toList());
tYehuaqiUserService.deleteBatchSafetyDeviceByUserIds(collect); itDetectorUserService.deleteBatchSafetyDeviceByUserIds(collect);
tYehuaqiUserService.insertBatchSafetyDevice(updateYehuaqiuserSafetyDeviceInfos); itDetectorUserService.insertBatchSafetyDevice(updateYehuaqiuserSafetyDeviceInfos);
} }
} }
// 6 接口记录直接插入 // 6 接口记录直接插入
......
...@@ -344,12 +344,19 @@ public class TDetectorUserController extends BaseController ...@@ -344,12 +344,19 @@ public class TDetectorUserController extends BaseController
if (osName.contains("windows")) { if (osName.contains("windows")) {
String filePath = "importTemplate/燃气用户导出模版.xlsx"; String filePath = "importTemplate/燃气用户导出模版.xlsx";
if ("1".equals(tDetectorUser.getGasType())) {
filePath = "importTemplate/液化气用户导出模版.xlsx";
}
//用来读取resources下的文件 //用来读取resources下的文件
Resource resource = new ClassPathResource(filePath); Resource resource = new ClassPathResource(filePath);
file = resource.getFile(); file = resource.getFile();
} else { } else {
file = ResourceUtils.getFile("/data/java/baseversion/importTemplate/燃气用户导出模版.xlsx"); if ("1".equals(tDetectorUser.getGasType())) {
file = ResourceUtils.getFile("/data/java/baseversion/importTemplate/液化气用户导出模版.xlsx");
} else {
file = ResourceUtils.getFile("/data/java/baseversion/importTemplate/燃气用户导出模版.xlsx");
}
} }
List<UserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVoList = new ArrayList<>(); List<UserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVoList = new ArrayList<>();
...@@ -397,8 +404,8 @@ public class TDetectorUserController extends BaseController ...@@ -397,8 +404,8 @@ public class TDetectorUserController extends BaseController
* @param response r * @param response r
* @throws IOException i * @throws IOException i
*/ */
@GetMapping("/exportErrorData") @GetMapping("/exportErrorData/{gasType}")
public void exportErrorData(HttpServletResponse response,String gasType) throws IOException { public void exportErrorData(HttpServletResponse response,@PathVariable("gasType") String gasType) throws IOException {
//判断是否是 windows环境, //判断是否是 windows环境,
String osName = System.getProperty("os.name").toLowerCase(); String osName = System.getProperty("os.name").toLowerCase();
...@@ -409,13 +416,24 @@ public class TDetectorUserController extends BaseController ...@@ -409,13 +416,24 @@ public class TDetectorUserController extends BaseController
//如果是本地或测试环境 //如果是本地或测试环境
if (osName.contains("windows")) { if (osName.contains("windows")) {
String filePath = "importTemplate/燃气用户错误导入数据模版.xlsx"; String filePath;
if ("1".equals(gasType)) {
filePath = "importTemplate/液化气用户错误导入数据模版.xlsx";
} else {
filePath = "importTemplate/燃气用户错误导入数据模版.xlsx";
}
//用来读取resources下的文件 //用来读取resources下的文件
Resource resource = new ClassPathResource(filePath); Resource resource = new ClassPathResource(filePath);
file = resource.getFile(); file = resource.getFile();
} else { } else {
file = ResourceUtils.getFile("/data/java/baseversion/importTemplate/燃气用户错误导入数据模版.xlsx"); if("1".equals(gasType)) {
file = ResourceUtils.getFile("/data/java/baseversion/importTemplate/液化气用户错误导入数据模版.xlsx");
} else {
file = ResourceUtils.getFile("/data/java/baseversion/importTemplate/燃气用户错误导入数据模版.xlsx");
}
} }
List<TDetectorUser> tDetectorUsers = tDetectorUserService.queryErrorDetectorUserList(gasType); List<TDetectorUser> tDetectorUsers = tDetectorUserService.queryErrorDetectorUserList(gasType);
...@@ -432,7 +450,12 @@ public class TDetectorUserController extends BaseController ...@@ -432,7 +450,12 @@ public class TDetectorUserController extends BaseController
total.put("maplist",userManageGasUserExportVos); total.put("maplist",userManageGasUserExportVos);
Workbook workbook = ExcelExportUtil.exportExcel(params, total); Workbook workbook = ExcelExportUtil.exportExcel(params, total);
String fileName = "燃气用户错误导入数据模版.xlsx"; String fileName;
if("1".equals(gasType)) {
fileName = "天然气用户错误导入数据模版.xlsx";
} else {
fileName = "燃气用户错误导入数据模版.xlsx";
}
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
...@@ -576,36 +599,59 @@ public class TDetectorUserController extends BaseController ...@@ -576,36 +599,59 @@ public class TDetectorUserController extends BaseController
return AjaxResult.success(); return AjaxResult.success();
} }
/** // /**
* 自定义模版的多sheet导入 // * 自定义模版的多sheet导入
* @param file f // * @param file f
* @return r // * @return r
* @throws Exception e // * @throws Exception e
*/ // */
@PostMapping("/moreSheetImportExcel") // @PostMapping("/moreSheetImportExcel")
public AjaxResult moreSheetImportExcel(MultipartFile file,boolean updateSupport) throws Exception { public AjaxResult moreSheetImportExcel(MultipartFile file,boolean updateSupport,String gasType) throws Exception {
String originalFilename = file.getOriginalFilename(); String originalFilename = file.getOriginalFilename();
if (originalFilename != null && originalFilename.contains("错误")) { if (originalFilename != null && originalFilename.contains("错误")) {
List<UserManageGasUserExportVo> userManageGasUserobjects = ExcelUtil.moreSheetImportExcel(file, 1, 2, UserManageGasUserExportVo.class, 0); List<UserManageGasUserExportVo> userManageGasUserobjects = ExcelUtil.moreSheetImportExcel(file, 1, 2, UserManageGasUserExportVo.class, 0);
tDetectorUserService.handleCustomMoreSheetImportData(userManageGasUserobjects,null,updateSupport,true); tDetectorUserService.handleCustomMoreSheetImportData(userManageGasUserobjects,null,updateSupport,true,gasType);
return AjaxResult.success(); return AjaxResult.success();
} else{ } else{
List<UserManageGasUserExportVo> userManageGasUserobjects = ExcelUtil.moreSheetImportExcel(file, 1, 2, UserManageGasUserExportVo.class, 0); List<UserManageGasUserExportVo> userManageGasUserobjects = ExcelUtil.moreSheetImportExcel(file, 1, 2, UserManageGasUserExportVo.class, 0);
List<UserManageSafetyDeviceExportVo> userManageSafetyobjects = ExcelUtil.moreSheetImportExcel(file, 1, 2, UserManageSafetyDeviceExportVo.class, 1); List<UserManageSafetyDeviceExportVo> userManageSafetyobjects = ExcelUtil.moreSheetImportExcel(file, 1, 2, UserManageSafetyDeviceExportVo.class, 1);
tDetectorUserService.handleCustomMoreSheetImportData(userManageGasUserobjects,userManageSafetyobjects,updateSupport,false); tDetectorUserService.handleCustomMoreSheetImportData(userManageGasUserobjects,userManageSafetyobjects,updateSupport,false,gasType);
return AjaxResult.success(); return AjaxResult.success();
} }
} }
/**
* 自定义模版的多sheet导入
* @param file f
* @return r
* @throws Exception e
*/
@PostMapping("/moreSheetImportExcel")
public AjaxResult moreSheetImportExcel(MultipartFile file,boolean updateSupport) throws Exception {
return moreSheetImportExcel(file,updateSupport,"0");
}
/**
* 自定义模版的多sheet导入 液化气有用户导入
* @param file f
* @return r
* @throws Exception e
*/
@PostMapping("/moreSheetImportExcelLpg")
public AjaxResult moreSheetImportExcelLpg(MultipartFile file,boolean updateSupport) throws Exception {
return moreSheetImportExcel(file,updateSupport,"1");
}
/** /**
* 查询当前用户导入 燃气用户错误的数据 * 查询当前用户导入 燃气用户错误的数据
* @return i * @return i
*/ */
@GetMapping("/countImportError") @GetMapping("/countImportError/{gasType}")
public AjaxResult countImportError(String gasType) public AjaxResult countImportError(@PathVariable("gasType") String gasType)
{ {
int i = tDetectorUserService.countByBeyondEnterpriseId(gasType); int i = tDetectorUserService.countByBeyondEnterpriseId(gasType);
return AjaxResult.success(i); return AjaxResult.success(i);
...@@ -615,8 +661,8 @@ public class TDetectorUserController extends BaseController ...@@ -615,8 +661,8 @@ public class TDetectorUserController extends BaseController
* 清除当前用户导入 燃气用户错误的数据 * 清除当前用户导入 燃气用户错误的数据
*/ */
@Log(title = "燃气用户错误导入记录", businessType = BusinessType.EXPORT) @Log(title = "燃气用户错误导入记录", businessType = BusinessType.EXPORT)
@GetMapping("/clearImportError") @GetMapping("/clearImportError/{gasType}")
public AjaxResult clearImportError(String gasType) public AjaxResult clearImportError(@PathVariable("gasType") String gasType)
{ {
return AjaxResult.success(tDetectorUserService.clearImportErrorByEnterpriseId(gasType)); return AjaxResult.success(tDetectorUserService.clearImportErrorByEnterpriseId(gasType));
} }
......
...@@ -26,7 +26,7 @@ spring: ...@@ -26,7 +26,7 @@ spring:
# 国际化资源文件路径 # 国际化资源文件路径
basename: i18n/messages basename: i18n/messages
profiles: profiles:
active: prd active: test
# 文件上传 # 文件上传
servlet: servlet:
multipart: multipart:
......
...@@ -3,6 +3,7 @@ package com.zehong.system.domain; ...@@ -3,6 +3,7 @@ package com.zehong.system.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.zehong.system.domain.vo.UserManageSafetyDeviceExportVo; import com.zehong.system.domain.vo.UserManageSafetyDeviceExportVo;
...@@ -352,6 +353,19 @@ public class TDetectorUser extends BaseEntity ...@@ -352,6 +353,19 @@ public class TDetectorUser extends BaseEntity
this.userManageSafetyDeviceExportVos = userManageSafetyDeviceExportVos; this.userManageSafetyDeviceExportVos = userManageSafetyDeviceExportVos;
} }
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
TDetectorUser detectorUser = (TDetectorUser) obj;
return Objects.equals(userOwnId,detectorUser.getUserOwnId());
}
@Override
public int hashCode() {
return Objects.hash(userOwnId);
}
@Override @Override
public String toString() { public String toString() {
return "TDetectorUser{" + return "TDetectorUser{" +
......
package com.zehong.system.mapper; package com.zehong.system.mapper;
import java.util.List;
import java.util.Map;
import com.zehong.system.domain.TDetectorUser; import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.TDetectorUserCount; import com.zehong.system.domain.TDetectorUserCount;
import com.zehong.system.domain.dto.UserLinkGasBottleIdDTO; import com.zehong.system.domain.dto.UserLinkGasBottleIdDTO;
...@@ -12,6 +9,9 @@ import com.zehong.system.domain.vo.TDetectorUserVO; ...@@ -12,6 +9,9 @@ import com.zehong.system.domain.vo.TDetectorUserVO;
import com.zehong.system.domain.vo.TDetectorUserVillageSafetyDeviceInfoVo; import com.zehong.system.domain.vo.TDetectorUserVillageSafetyDeviceInfoVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/** /**
* 燃气用户Mapper接口 * 燃气用户Mapper接口
* *
...@@ -101,6 +101,20 @@ public interface TDetectorUserMapper ...@@ -101,6 +101,20 @@ public interface TDetectorUserMapper
public List<TDetectorUser> newSelectTDetectorUserList(TDetectorUser tDetectorUser); public List<TDetectorUser> newSelectTDetectorUserList(TDetectorUser tDetectorUser);
public List<TDetectorUser> queryErrorDetectorUserList(@Param("depId") String depId,@Param("gasType") String gasType); public List<TDetectorUser> queryErrorDetectorUserList(@Param("depId") String depId,@Param("gasType") String gasType);
/**
* 根据 userOwnId list 和 enterpriseId 查询数据
* @param userOwnIds userOwnId list
* @param enterpriseId enterpriseId
* @return r
*/
public List<TDetectorUser> queryByUserOwnIdAndEnterpriseIdForThirdParty(@Param("userOwnIds") List<String> userOwnIds,@Param("enterpriseId") String enterpriseId);
/**
* 根据userOwnIds 和 enterpriseId 查询数据
* @param userOwnIds u
* @param enterpriseId e
* @return r
*/
public List<TDetectorUser> queryByUserOwnIdsAndEnterpriseId(@Param("userOwnIds") List<String> userOwnIds, @Param("enterpriseId") String enterpriseId);
public List<TDetectorUser> selectTDetectorListstatus(TDetectorUser tDetectorUser); public List<TDetectorUser> selectTDetectorListstatus(TDetectorUser tDetectorUser);
...@@ -112,6 +126,12 @@ public interface TDetectorUserMapper ...@@ -112,6 +126,12 @@ public interface TDetectorUserMapper
*/ */
public int insertTDetectorUser(TDetectorUser tDetectorUser); public int insertTDetectorUser(TDetectorUser tDetectorUser);
/**
* 提供给第三方接口调用时的批量插入
* @param tYehuaqiUsers r
* @return r
*/
public int insertBatchForThirdParty(@Param("list") List<TDetectorUser> tYehuaqiUsers);
/** /**
* 批量增加 * 批量增加
......
...@@ -92,6 +92,8 @@ public interface TGasuserSafetyDeviceInfoMapper ...@@ -92,6 +92,8 @@ public interface TGasuserSafetyDeviceInfoMapper
public int deleteSafetyDeviceInfo(Long deviceId); public int deleteSafetyDeviceInfo(Long deviceId);
public int deleteBatchSafetyDeviceByUserIds(@Param("userIds") List<Long> userIds);
List<TGasuserSafetyDeviceInfo> selectSafetyDeviceDetailInfoList(Long userId); List<TGasuserSafetyDeviceInfo> selectSafetyDeviceDetailInfoList(Long userId);
/** /**
......
package com.zehong.system.service; package com.zehong.system.service;
import java.util.List;
import java.util.Map;
import com.zehong.common.core.page.TableDataInfo; import com.zehong.common.core.page.TableDataInfo;
import com.zehong.system.domain.TDetectorUser; import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.TDetectorUserCount; import com.zehong.system.domain.TDetectorUserCount;
import com.zehong.system.domain.TGasuserSafetyDeviceInfo;
import com.zehong.system.domain.TYehuaqiuserSafetyDeviceInfo;
import com.zehong.system.domain.vo.*; import com.zehong.system.domain.vo.*;
import org.apache.ibatis.annotations.Param;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/** /**
* 燃气用户Service接口 * 燃气用户Service接口
...@@ -27,14 +29,6 @@ public interface ITDetectorUserService ...@@ -27,14 +29,6 @@ public interface ITDetectorUserService
*/ */
public List<TDetectorUserVO> massMarksDetectorUserList(TDetectorUser tDetectorUser); public List<TDetectorUserVO> massMarksDetectorUserList(TDetectorUser tDetectorUser);
/**
* 查询探测器用户列表 地图使用 massMarks 标注的方式
* @param tDetectorUser tDetectorUser
* @return r
*/
// public Map<String, List<TMassMarksDetectorUserVO>> massMarksDetectorUserList(TDetectorUser tDetectorUser);
/** /**
* 查询探测器用户列表 地图使用 labelsLayerMarks 标注的方式 * 查询探测器用户列表 地图使用 labelsLayerMarks 标注的方式
* @param tDetectorUser tDetectorUser * @param tDetectorUser tDetectorUser
...@@ -116,6 +110,21 @@ public interface ITDetectorUserService ...@@ -116,6 +110,21 @@ public interface ITDetectorUserService
*/ */
public List<TDetectorUser> queryErrorDetectorUserList(String gasType); public List<TDetectorUser> queryErrorDetectorUserList(String gasType);
/**
* 根据 userOwnId list 和 enterpriseId 查询数据
* @param userOwnIds userOwnId list
* @param enterpriseId enterpriseId
* @return r
*/
public List<TDetectorUser> queryByUserOwnIdAndEnterpriseIdForThirdParty(List<String> userOwnIds,String enterpriseId);
/**
* 根据用户自有id 集合 和 企业id 查询数据
* @param userOwnIds u
* @param enterpriseId e
* @return r
*/
public List<TDetectorUser> queryByUserOwnIdsAndEnterpriseId(List<String> userOwnIds, String enterpriseId);
/** /**
* 查询燃气用户列表 * 查询燃气用户列表
* *
...@@ -142,6 +151,18 @@ public interface ITDetectorUserService ...@@ -142,6 +151,18 @@ public interface ITDetectorUserService
*/ */
public int insertTDetectorUser(TDetectorUser tDetectorUser); public int insertTDetectorUser(TDetectorUser tDetectorUser);
/**
* 批量插入 安全装置
* @param gasuserSafetyDeviceInfoList y
* @return r
*/
public int insertBatchSafetyDevice(List<TGasuserSafetyDeviceInfo> gasuserSafetyDeviceInfoList);
/**
* 提供给第三方接口调用时的批量插入
* @param tYehuaqiUsers r
* @return r
*/
public int insertBatchForThirdParty(List<TDetectorUser> tYehuaqiUsers);
/** /**
* 新增燃气用户和安全装置 * 新增燃气用户和安全装置
* @param gasUserAndSafetyDeviceVo gas * @param gasUserAndSafetyDeviceVo gas
...@@ -155,6 +176,19 @@ public interface ITDetectorUserService ...@@ -155,6 +176,19 @@ public interface ITDetectorUserService
* @return r * @return r
*/ */
public int updateUserAndSafetyDevice(GasUserAndSafetyDeviceVo gasUserAndSafetyDeviceVo); public int updateUserAndSafetyDevice(GasUserAndSafetyDeviceVo gasUserAndSafetyDeviceVo);
/**
* 批量修改
* @param list l
* @return r
*/
public int updateBatch(List<TDetectorUser> list);
/**
* 根据 userId 集合批量删除
* @param userIds u
* @return r
*/
public int deleteBatchSafetyDeviceByUserIds(List<Long> userIds);
/** /**
* 修改燃气用户 * 修改燃气用户
...@@ -225,7 +259,7 @@ public interface ITDetectorUserService ...@@ -225,7 +259,7 @@ public interface ITDetectorUserService
*/ */
public void handleCustomMoreSheetImportData(List<UserManageGasUserExportVo> gasUserExportVos, public void handleCustomMoreSheetImportData(List<UserManageGasUserExportVo> gasUserExportVos,
List<UserManageSafetyDeviceExportVo> safetyDeviceExportVos, List<UserManageSafetyDeviceExportVo> safetyDeviceExportVos,
boolean updateSupport ,boolean reImportOfIncorrectDataFlag) ; boolean updateSupport ,boolean reImportOfIncorrectDataFlag,String gasType) ;
/** /**
* 根据企业id统计错误数据 * 根据企业id统计错误数据
......
...@@ -816,6 +816,22 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -816,6 +816,22 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
return tDetectorUserMapper.queryErrorDetectorUserList(deptId,gasType); return tDetectorUserMapper.queryErrorDetectorUserList(deptId,gasType);
} }
@Override
public List<TDetectorUser> queryByUserOwnIdAndEnterpriseIdForThirdParty(List<String> userOwnIds, String enterpriseId) {
return tDetectorUserMapper.queryByUserOwnIdAndEnterpriseIdForThirdParty(userOwnIds,enterpriseId);
}
/**
* 根据userOwnIds 和 enterpriseId 查询数据
* @param userOwnIds u
* @param enterpriseId e
* @return r
*/
@Override
public List<TDetectorUser> queryByUserOwnIdsAndEnterpriseId(List<String> userOwnIds, String enterpriseId) {
return tDetectorUserMapper.queryByUserOwnIdsAndEnterpriseId(userOwnIds,enterpriseId);
}
/** /**
* 查询燃气用户列表-new * 查询燃气用户列表-new
* *
...@@ -853,6 +869,21 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -853,6 +869,21 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
return tDetectorUserMapper.insertTDetectorUser(tDetectorUser); return tDetectorUserMapper.insertTDetectorUser(tDetectorUser);
} }
@Override
public int insertBatchSafetyDevice(List<TGasuserSafetyDeviceInfo> gasuserSafetyDeviceInfoList) {
return gasuserSafetyDeviceInfoMapper.insertBatch(gasuserSafetyDeviceInfoList);
}
/**
* 批量插入 第三方传输来的数据
* @param tYehuaqiUsers r
* @return r
*/
@Override
public int insertBatchForThirdParty(List<TDetectorUser> tYehuaqiUsers) {
return tDetectorUserMapper.insertBatchForThirdParty(tYehuaqiUsers);
}
/** /**
* 新增燃气用户 和 安全装置 * 新增燃气用户 和 安全装置
* @param gasUserAndSafetyDeviceVo gas * @param gasUserAndSafetyDeviceVo gas
...@@ -898,6 +929,26 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -898,6 +929,26 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
return 1; return 1;
} }
/**
* 批量修改
* @param list l
* @return r
*/
@Override
public int updateBatch(List<TDetectorUser> list) {
return tDetectorUserMapper.updateBatch(list);
}
/**
* 根据用户id 集合删除 安全装置
* @param userIds u
* @return
*/
@Override
public int deleteBatchSafetyDeviceByUserIds(List<Long> userIds) {
return gasuserSafetyDeviceInfoMapper.deleteBatchSafetyDeviceByUserIds(userIds);
}
/** /**
* 修改燃气用户 * 修改燃气用户
* *
...@@ -1001,7 +1052,7 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -1001,7 +1052,7 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void handleCustomMoreSheetImportData(List<UserManageGasUserExportVo> gasUserExportVos, public void handleCustomMoreSheetImportData(List<UserManageGasUserExportVo> gasUserExportVos,
List<UserManageSafetyDeviceExportVo> safetyDeviceExportVos, List<UserManageSafetyDeviceExportVo> safetyDeviceExportVos,
boolean updateSupport,boolean reImportOfIncorrectDataFlag) { boolean updateSupport,boolean reImportOfIncorrectDataFlag,String gasType) {
List<TDetectorUser> successDataList = new ArrayList<>(); List<TDetectorUser> successDataList = new ArrayList<>();
...@@ -1019,7 +1070,8 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -1019,7 +1070,8 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
for (UserManageGasUserExportVo gasUserExportVo : gasUserExportVos) { for (UserManageGasUserExportVo gasUserExportVo : gasUserExportVos) {
String userOwnId = gasUserExportVo.getUserOwnId(); String userOwnId = gasUserExportVo.getUserOwnId();
String gasType = gasUserExportVo.getGasType(); // 2024-10-26 基本信息的天然气用户 和 液化气监管的 液化气用户 用一张表
gasUserExportVo.setGasType(gasType);
String userType = gasUserExportVo.getUserType(); String userType = gasUserExportVo.getUserType();
String beyondEnterpriseName = gasUserExportVo.getBeyondEnterpriseName(); String beyondEnterpriseName = gasUserExportVo.getBeyondEnterpriseName();
String villageName = gasUserExportVo.getVillageName(); String villageName = gasUserExportVo.getVillageName();
...@@ -1031,12 +1083,6 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -1031,12 +1083,6 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
} }
} }
if (StringUtils.isNotBlank(gasType)){
if (!"0".equals(gasType) && !"1".equals(gasType)) {
stringBuilder.append("燃气类型数据没按提示录入|");
}
}
if ((StringUtils.isNotBlank(userType))){ if ((StringUtils.isNotBlank(userType))){
if (!"1".equals(userType) && !"2".equals(userType)&& !"3".equals(userType)&& !"4".equals(userType)) { if (!"1".equals(userType) && !"2".equals(userType)&& !"3".equals(userType)&& !"4".equals(userType)) {
stringBuilder.append("用户类型数据没按提示录入|"); stringBuilder.append("用户类型数据没按提示录入|");
......
...@@ -25,6 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -25,6 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="villageId" column="f_village_id" /> <result property="villageId" column="f_village_id" />
<result property="villageName" column="f_village_name" /> <result property="villageName" column="f_village_name" />
<result property="errorMsg" column="error_msg" /> <result property="errorMsg" column="error_msg" />
<result property="userOwnId" column="user_own_id" />
</resultMap> </resultMap>
<resultMap type="TDetectorUser" id="TDetectorUserExportResult"> <resultMap type="TDetectorUser" id="TDetectorUserExportResult">
...@@ -48,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -48,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="villageId" column="f_village_id" /> <result property="villageId" column="f_village_id" />
<result property="villageName" column="f_village_name" /> <result property="villageName" column="f_village_name" />
<result property="errorMsg" column="error_msg" /> <result property="errorMsg" column="error_msg" />
<result property="userOwnId" column="user_own_id" />
<!-- collection 是用于建立一对多中集合属性的对应关系 <!-- collection 是用于建立一对多中集合属性的对应关系
ofType 用于指定集合元素的数据类型 ofType 用于指定集合元素的数据类型
--> -->
...@@ -82,11 +84,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -82,11 +84,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectTDetectorUserVo"> <sql id="selectTDetectorUserVo">
select user_id, username, nick_name, user_type, gas_type,address, longitude, latitude, linkman, phone, email, select user_id, username, nick_name, user_type, gas_type,address, longitude, latitude, linkman, phone, email,
create_time, update_time, is_del, remarks,f_village_id,error_msg from t_detector_user create_time, update_time, is_del, remarks,f_village_id,error_msg,user_own_id from t_detector_user
</sql> </sql>
<select id="queryErrorDetectorUserList" parameterType="string" resultMap="TDetectorUserResult"> <select id="queryErrorDetectorUserList" parameterType="string" resultMap="TDetectorUserResult">
select * from t_detector_user where error_msg is not null select *,beyond_enterprise_name as enterprise_name from t_detector_user where error_msg is not null
<if test="depId != null and depId != '' and depId != '-2'"> <if test="depId != null and depId != '' and depId != '-2'">
and beyondEnterpriseId = #{depId} and beyondEnterpriseId = #{depId}
</if> </if>
...@@ -94,6 +96,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -94,6 +96,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="gasType != null and gasType == 0"> and (gas_type =#{gasType} or gas_type is null)</if> <if test="gasType != null and gasType == 0"> and (gas_type =#{gasType} or gas_type is null)</if>
</select> </select>
<select id="queryByUserOwnIdAndEnterpriseIdForThirdParty" resultMap="TDetectorUserResult">
<include refid="selectTDetectorUserVo"/>
where beyond_enterprise_id = #{enterpriseId} and user_own_id in
<foreach collection="userOwnIds" index="i" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="queryByUserOwnIdsAndEnterpriseId" resultMap="TDetectorUserResult">
<include refid="selectTDetectorUserVo"/>
where beyond_enterprise_id = #{enterpriseId} and user_own_id in
<foreach collection="userOwnIds" close=")" separator="," open="(" item="item" index="i">
#{item}
</foreach>
</select>
<select id="selectForExportTDetectorUserList" parameterType="TDetectorUser" resultMap="TDetectorUserExportResult"> <select id="selectForExportTDetectorUserList" parameterType="TDetectorUser" resultMap="TDetectorUserExportResult">
select a.user_id, select a.user_id,
a.username, a.username,
...@@ -401,6 +418,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -401,6 +418,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remarks != null">remarks,</if> <if test="remarks != null">remarks,</if>
<if test="villageId != null">f_village_id,</if> <if test="villageId != null">f_village_id,</if>
<if test="errorMsg != null">error_msg,</if> <if test="errorMsg != null">error_msg,</if>
<if test="userOwnId != null">user_own_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="username != null">#{username},</if> <if test="username != null">#{username},</if>
...@@ -418,12 +436,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -418,12 +436,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remarks != null">#{remarks},</if> <if test="remarks != null">#{remarks},</if>
<if test="villageId != null">#{villageId},</if> <if test="villageId != null">#{villageId},</if>
<if test="errorMsg != null">#{errorMsg},</if> <if test="errorMsg != null">#{errorMsg},</if>
<if test="userOwnId != null">#{userOwnId},</if>
</trim> </trim>
</insert> </insert>
<insert id="insertBatchForThirdParty" parameterType="list" useGeneratedKeys="true" keyProperty="userId">
insert into t_detector_user (nick_name, beyond_enterprise_name,beyond_enterprise_id, user_type, gas_type, village_name,f_village_id,
address, linkman, phone, remarks, error_msg,user_own_id)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.nickName,jdbcType=VARCHAR}, #{item.beyondEnterpriseName,jdbcType=VARCHAR}, #{item.beyondEnterpriseId,jdbcType=VARCHAR},
#{item.userType,jdbcType=VARCHAR}, #{item.gasType,jdbcType=VARCHAR}, #{item.villageName,jdbcType=VARCHAR},
#{item.villageId,jdbcType=DECIMAL},
#{item.address,jdbcType=VARCHAR}, #{item.linkman,jdbcType=VARCHAR}, #{item.phone,jdbcType=VARCHAR},
#{item.remarks,jdbcType=VARCHAR}, #{item.errorMsg,jdbcType=VARCHAR},#{item.userOwnId,jdbcType=VARCHAR}
)
</foreach>
</insert>
<insert id="insertBatch" parameterType="list" useGeneratedKeys="true" keyProperty="userId"> <insert id="insertBatch" parameterType="list" useGeneratedKeys="true" keyProperty="userId">
insert into t_detector_user (nick_name, beyond_enterprise_name,beyond_enterprise_id, user_type, gas_type, village_name,f_village_id, insert into t_detector_user (nick_name, beyond_enterprise_name,beyond_enterprise_id, user_type, gas_type, village_name,f_village_id,
address, linkman, phone, remarks, error_msg) address, linkman, phone, remarks, error_msg,user_own_id)
values values
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
( (
...@@ -431,7 +466,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -431,7 +466,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.userType,jdbcType=VARCHAR}, #{item.gasType,jdbcType=VARCHAR}, #{item.villageName,jdbcType=VARCHAR}, #{item.userType,jdbcType=VARCHAR}, #{item.gasType,jdbcType=VARCHAR}, #{item.villageName,jdbcType=VARCHAR},
#{item.villageId,jdbcType=DECIMAL}, #{item.villageId,jdbcType=DECIMAL},
#{item.address,jdbcType=VARCHAR}, #{item.linkman,jdbcType=VARCHAR}, #{item.phone,jdbcType=VARCHAR}, #{item.address,jdbcType=VARCHAR}, #{item.linkman,jdbcType=VARCHAR}, #{item.phone,jdbcType=VARCHAR},
#{item.remarks,jdbcType=VARCHAR}, #{item.errorMsg,jdbcType=VARCHAR} #{item.remarks,jdbcType=VARCHAR}, #{item.errorMsg,jdbcType=VARCHAR},#{item.userOwnId,jdbcType=VARCHAR}
) )
</foreach> </foreach>
</insert> </insert>
...@@ -449,7 +484,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -449,7 +484,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
linkman = #{item.linkman}, linkman = #{item.linkman},
phone = #{item.phone}, phone = #{item.phone},
remarks = #{item.remarks}, remarks = #{item.remarks},
error_msg = null error_msg = null,
user_own_id = #{item.userOwnId}
</set> </set>
WHERE user_id = #{item.userId} WHERE user_id = #{item.userId}
</foreach> </foreach>
...@@ -475,6 +511,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -475,6 +511,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDel != null">is_del = #{isDel},</if> <if test="isDel != null">is_del = #{isDel},</if>
<if test="remarks != null">remarks = #{remarks},</if> <if test="remarks != null">remarks = #{remarks},</if>
<if test="villageId != null">f_village_id = #{villageId},</if> <if test="villageId != null">f_village_id = #{villageId},</if>
<if test="userOwnId != null">user_own_id = #{userOwnId},</if>
</trim> </trim>
where user_id = #{userId} where user_id = #{userId}
</update> </update>
......
...@@ -146,6 +146,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -146,6 +146,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{deviceId} #{deviceId}
</foreach> </foreach>
</update> </update>
<update id="deleteBatchSafetyDeviceByUserIds">
update t_gasuser_safety_device_info set is_del='1' where f_relation_gasUser_id in
<foreach item="deviceId" collection="userIds" open="(" separator="," close=")">
#{deviceId}
</foreach>
</update>
<update id="deleteSafetyDeviceInfo"> <update id="deleteSafetyDeviceInfo">
update t_gasuser_safety_device_info set is_del='1' where f_gasUser_safety_device_id = #{deviceId} update t_gasuser_safety_device_info set is_del='1' where f_gasUser_safety_device_id = #{deviceId}
</update> </update>
......
...@@ -39,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -39,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
yequser.nick_name as nickName yequser.nick_name as nickName
FROM FROM
t_lpg_delivery_record delivery t_lpg_delivery_record delivery
left join t_yehuaqi_user yequser on delivery.user_id = yequser.user_id left join t_detector_user yequser on delivery.user_id = yequser.user_id
</sql> </sql>
<select id="selectTLpgDeliveryRecordList" parameterType="TLpgDeliveryRecord" resultMap="TLpgDeliveryRecordResult"> <select id="selectTLpgDeliveryRecordList" parameterType="TLpgDeliveryRecord" resultMap="TLpgDeliveryRecordResult">
......
...@@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
record.is_del, record.is_del,
record.remark record.remark
from t_lpg_safe_check_record record from t_lpg_safe_check_record record
left join t_yehuaqi_user yhqser on record.user_id = yhqser.user_id left join t_detector_user yhqser on record.user_id = yhqser.user_id
</sql> </sql>
<select id="selectTLpgSafeCheckRecordList" parameterType="TLpgSafeCheckRecord" resultMap="TLpgSafeCheckRecordResult"> <select id="selectTLpgSafeCheckRecordList" parameterType="TLpgSafeCheckRecord" resultMap="TLpgSafeCheckRecordResult">
......
...@@ -463,7 +463,7 @@ export default { ...@@ -463,7 +463,7 @@ export default {
// 设置上传的请求头部 // 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() }, headers: { Authorization: "Bearer " + getToken() },
// 上传的地址 // 上传的地址
url: process.env.VUE_APP_BASE_API + "/system/yehuaqiUser/moreSheetImportExcel" // todo url: process.env.VUE_APP_BASE_API + "/supervise/user/moreSheetImportExcelLpg" // todo
}, },
importError: null, importError: null,
...@@ -758,7 +758,7 @@ export default { ...@@ -758,7 +758,7 @@ export default {
this.$refs.upload.clearFiles(); this.$refs.upload.clearFiles();
// this.getDataList(); // this.getDataList();
countImportError("gasType").then(response => { countImportError("1").then(response => {
this.importError = response.data; this.importError = response.data;
if(this.importError === 0) { if(this.importError === 0) {
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.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
...@@ -1039,8 +1039,8 @@ export default { ...@@ -1039,8 +1039,8 @@ export default {
if (this.form.userId != null) { if (this.form.userId != null) {
var tDeviceInfon={ var tDeviceInfon={
yehuaqiUser:this.form, detectorUser:this.form,
yehuaqiuserSafetyDeviceInfos:this.detailInfoList gasuserSafetyDeviceInfoList:this.detailInfoList
} }
updateUserAndSafetyDevice(JSON.stringify(tDeviceInfon)).then(response => { updateUserAndSafetyDevice(JSON.stringify(tDeviceInfon)).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
...@@ -1050,8 +1050,8 @@ export default { ...@@ -1050,8 +1050,8 @@ export default {
} else { } else {
var tDeviceInfon={ var tDeviceInfon={
yehuaqiUser:this.form, detectorUser:this.form,
yehuaqiuserSafetyDeviceInfos:this.detailInfoList gasuserSafetyDeviceInfoList:this.detailInfoList
} }
addUserAndSafetyDevice(JSON.stringify(tDeviceInfon)).then(response => { addUserAndSafetyDevice(JSON.stringify(tDeviceInfon)).then(response => {
......
...@@ -397,7 +397,7 @@ ...@@ -397,7 +397,7 @@
:limit="1" :limit="1"
accept=".xlsx, .xls" accept=".xlsx, .xls"
:headers="upload.headers" :headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport" :action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading" :disabled="upload.isUploading"
:on-progress="handleFileUploadProgress" :on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess" :on-success="handleFileSuccess"
......
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