Commit 0f799cc3 authored by wanghao's avatar wanghao

1 基础信息维护-液化气用户新增-外部对接接口开发

parent 7cc5be28
......@@ -5,15 +5,15 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.*;
import com.zehong.system.domain.vo.YeHuaqiUserManageSafetyDeviceExportVo;
import com.zehong.system.mapper.TEnterpriseInfoMapper;
import com.zehong.system.service.*;
import com.zehong.web.controller.tool.DESEncoder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
......@@ -91,6 +91,7 @@ public class lpgGasController {
@Resource
private TEnterpriseInfoMapper tEnterpriseInfoMapper;
/**
* 创建 气瓶档案接口
* @return r
......@@ -2056,6 +2057,7 @@ public class lpgGasController {
* @return r
*/
@PostMapping("/createLpgLiquefiedGasUser")
@Transactional(rollbackFor = Exception.class)
public AjaxResult createLpgLiquefiedGasUser(@RequestBody Encryption encryption) {
keyInformation selectkey = decryptService.selectkey(encryption.getQybm());
......@@ -2078,6 +2080,7 @@ public class lpgGasController {
int successNum = 0;
int errorNum = 0;
int repeatNum = 0;
if (StringUtils.isNotBlank(decrypt)) {
......@@ -2087,15 +2090,27 @@ public class lpgGasController {
List<JSONObject> list = JSONObject.parseArray(js, JSONObject.class);
if (list.size() > 500) {
return AjaxResult.error("每次最多处理500条数据");
if (list.size() > 200) {
return AjaxResult.error("每次最多处理200条数据");
}
List<TYehuaqiUser> yehuaqiUsers = new ArrayList<>();
// 筛出去 userOwnId 重复的
List<TYehuaqiUser> noRepeatUserOwnIdList;
// 需要更新的数据
List<TYehuaqiUser> updateYehuaqiUsers = new ArrayList<>();
// 安全装置 集合数据
List<TYehuaqiuserSafetyDeviceInfo> yehuaqiuserSafetyDeviceInfos = new ArrayList<>();
// 需要修改的燃气用户的 安全装置 集合数据
List<TYehuaqiuserSafetyDeviceInfo> updateYehuaqiuserSafetyDeviceInfos = new ArrayList<>();
TYehuaqiUser yehuaqiUser;
String dateFormat = "yyyy-MM-dd HH:mm:ss";
String dateFormat = "yyyy-MM-dd";
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
// 接口保存记录
......@@ -2107,7 +2122,7 @@ public class lpgGasController {
String userOwnId = object.getString("userOwnId");
if (StringUtils.isBlank(userOwnId)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgDeliveryRecord", object.toJSONString(),
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"用户自有编号不许为空!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
......@@ -2115,32 +2130,426 @@ public class lpgGasController {
}
if(userOwnId.length() > 50) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgDeliveryRecord", object.toJSONString(),
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"用户自有编号不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 用户名称
String nickName = object.getString("nickName");
if(StringUtils.isBlank(nickName)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgDeliveryRecord", object.toJSONString(),
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"用户名称不许为空!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
if(nickName.length() > 50) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"用户名称不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 用户类型
String userType = object.getString("userType");
if(StringUtils.isBlank(userType)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"用户类型不许为空!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
if(!"1".equals(userType) && !"2".equals(userType) && !"4".equals(userType)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"用户类型不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 居住区村庄id
String villageId = object.getString("villageId");
long villageIdl = 0L;
if ("1".equals(userType)) {
if (StringUtils.isBlank(villageId)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"用户类型为居民用户时,居住区村庄不许为空!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
}
if (StringUtils.isNotBlank(villageId)) {
try {
villageIdl = Long.parseLong(villageId);
}catch (NumberFormatException e) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"居住区村庄id 不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
}
// 用户地址
String address = object.getString("address");
if(StringUtils.isBlank(address)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"用户地址不许为空!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
if(address.length() > 255) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"用户地址不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 经度
String longitude = object.getString("longitude");
BigDecimal bigDecimalLongitude = BigDecimal.ZERO;
if(StringUtils.isNotBlank(longitude)) {
try {
bigDecimalLongitude = new BigDecimal(longitude);
}catch (NumberFormatException e) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"经度 不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
}
// 纬度
String latitude = object.getString("latitude");
BigDecimal bigDecimalLatitude = BigDecimal.ZERO;
if(StringUtils.isNotBlank(longitude)) {
try {
bigDecimalLatitude = new BigDecimal(latitude);
}catch (NumberFormatException e) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"纬度 不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
}
// 联系人
String linkman = object.getString("linkman") == null ? "" : object.getString("linkman");
if(linkman.length() > 100) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"联系人不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 电话
String phone = object.getString("phone") == null ? "" : object.getString("phone");
if(phone.length() > 20) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"电话不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 备注
String remarks = object.getString("remarks") == null ? "" : object.getString("remarks");
if(remarks.length() > 4000) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"备注不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
yehuaqiUser.setUserOwnId(userOwnId);
yehuaqiUser.setNickName(nickName);
yehuaqiUser.setUserType(userType);
if (villageIdl > 0) {
yehuaqiUser.setVillageId(villageIdl);
}
yehuaqiUser.setAddress(address);
if(!BigDecimal.ZERO.equals(bigDecimalLongitude)) {
yehuaqiUser.setLongitude(bigDecimalLongitude);
}
if (!BigDecimal.ZERO.equals(bigDecimalLatitude)) {
yehuaqiUser.setLatitude(bigDecimalLatitude);
}
yehuaqiUser.setLinkman(linkman);
yehuaqiUser.setPhone(phone);
yehuaqiUser.setRemarks(remarks);
yehuaqiUser.setBeyondEnterpriseId(tEnterpriseInfo.getEnterpriseId());
List<YeHuaqiUserManageSafetyDeviceExportVo> tYehuaqiuserSafetyDeviceInfoList = new ArrayList<>();
JSONArray safetyDeviceList = object.getJSONArray("safetyDeviceList");
YeHuaqiUserManageSafetyDeviceExportVo yehuaqiuserSafetyDeviceInfo;
// 安装装置有错误时只做记录,不做任何错误提示返回。也不入库。
if (safetyDeviceList != null) {
String safetyDeviceListSr = JSONObject.toJSONString(safetyDeviceList, SerializerFeature.WriteClassName);
List<JSONObject> safetyDeviceJsonList = JSONObject.parseArray(safetyDeviceListSr, JSONObject.class);
for (JSONObject jsonObject : safetyDeviceJsonList) {
// 设备名称
String fDeviceName = jsonObject.getString("fDeviceName") == null ?
"" : jsonObject.getString("fDeviceName");
if(fDeviceName.length() > 50) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"设备名称不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
break;
}
// 设备型号
String fDeviceModel = jsonObject.getString("fDeviceModel") == null ?
"" : jsonObject.getString("fDeviceModel");
if(fDeviceModel.length() > 100) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"设备型号不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
break;
}
// 物联网编号
String fIotNo = jsonObject.getString("fIotNo") == null ?
"" : jsonObject.getString("fIotNo");
if(fIotNo.length() > 100) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"物联网编号不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
break;
}
// 设备类型
String fRelationDeviceType = jsonObject.getString("fRelationDeviceType") == null ?
"" : jsonObject.getString("fRelationDeviceType");
if(fRelationDeviceType.length() > 50) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"设备类型不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
break;
}
// 探测介质
String fDetectionMedium = jsonObject.getString("fDetectionMedium") == null ?
"" : jsonObject.getString("fDetectionMedium");
if(fDetectionMedium.length() > 255) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"探测介质不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
break;
}
// 设备安装时间
String fDeviceInstallTime = jsonObject.getString("fDeviceInstallTime") == null ?
"" : jsonObject.getString("fDeviceInstallTime");
if(fDeviceInstallTime.length() > 0 && !isValidDate(sdf,fDeviceInstallTime)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"设备安装时间不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
break;
}
// 设备安装位置
String fDeviceInstallPosition = jsonObject.getString("fDeviceInstallPosition") == null ?
"" : jsonObject.getString("fDeviceInstallPosition");
if(fDeviceInstallPosition.length() > 100) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"设备安装位置不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
break;
}
// 负责人
String fHead = jsonObject.getString("fHead") == null ?
"" : jsonObject.getString("fHead");
if(fHead.length() > 20) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"负责人不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
break;
}
// 联系电话
String fPhone = jsonObject.getString("fPhone") == null ?
"" : jsonObject.getString("fPhone");
if(fPhone.length() > 20) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", object.toJSONString(),
"电话不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
break;
}
if (fDeviceName.length() > 0 || fDeviceModel.length() > 0 || fIotNo.length() > 0
|| fRelationDeviceType.length() > 0 || fDetectionMedium.length() > 0
|| fDeviceInstallTime.length() > 0 || fDeviceInstallPosition.length() > 0
|| fHead.length() > 0 || fPhone.length() > 0) {
yehuaqiuserSafetyDeviceInfo = new YeHuaqiUserManageSafetyDeviceExportVo();
yehuaqiuserSafetyDeviceInfo.setfDeviceName(fDeviceName);
yehuaqiuserSafetyDeviceInfo.setfDeviceModel(fDeviceModel);
yehuaqiuserSafetyDeviceInfo.setfIotNo(fIotNo);
yehuaqiuserSafetyDeviceInfo.setfRelationDeviceType(fRelationDeviceType);
yehuaqiuserSafetyDeviceInfo.setfDetectionMedium(fDetectionMedium);
yehuaqiuserSafetyDeviceInfo.setfDeviceInstallTime(DateUtils.parseDate(fDeviceInstallTime));
yehuaqiuserSafetyDeviceInfo.setfDeviceInstallPosition(fDeviceInstallPosition);
yehuaqiuserSafetyDeviceInfo.setfHead(fHead);
yehuaqiuserSafetyDeviceInfo.setfPhone(fPhone);
tYehuaqiuserSafetyDeviceInfoList.add(yehuaqiuserSafetyDeviceInfo);
}
}
}
if(tYehuaqiuserSafetyDeviceInfoList.size() > 0) {
yehuaqiUser.setUserManageSafetyDeviceExportVos(tYehuaqiuserSafetyDeviceInfoList);
}
yehuaqiUsers.add(yehuaqiUser);
}
}
//1 封装完数据后 先去重,userOwnId 相同的筛一筛
if (yehuaqiUsers.size() > 0) {
Set<TYehuaqiUser> yehuaqiUsers1 = new HashSet<>(yehuaqiUsers);
int i = yehuaqiUsers.size() - yehuaqiUsers1.size();
if (i > 0) {
repeatNum = i;
}
// 筛除重复后
noRepeatUserOwnIdList = new ArrayList<>(yehuaqiUsers1);
//2 筛除重复后,再筛下 有村的是否在监管平台存在
if(noRepeatUserOwnIdList.size() > 0) {
List<Long> collect = noRepeatUserOwnIdList.stream().filter(item -> item.getVillageId() != null).map(TYehuaqiUser::getVillageId).collect(Collectors.toList());
List<TUserManageVillage> userManageVillages = itUserManageVillageService.queryByVillageIds(collect);
Map<Long, List<TUserManageVillage>> collect1 = userManageVillages.stream().collect(Collectors.groupingBy(TUserManageVillage::getfVillageId));
Iterator<TYehuaqiUser> iterator = noRepeatUserOwnIdList.iterator();
while (iterator.hasNext()) {
TYehuaqiUser next = iterator.next();
Long villageId = next.getVillageId();
if (villageId != null) {
List<TUserManageVillage> userManageVillages1 = collect1.get(villageId);
if (userManageVillages1 == null || userManageVillages1.size() == 0) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgLiquefiedGasUser", next.toString(),
"居住区村庄id在监管平台无信息!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum ++;
iterator.remove();
}
}
}
}
//3 根据 userOwnId 和 enterpriseId 查询 数据库是否存在数据 存在则更新
if (noRepeatUserOwnIdList.size() > 0) {
List<String> collect = noRepeatUserOwnIdList.stream().map(TYehuaqiUser::getUserOwnId).collect(Collectors.toList());
List<TYehuaqiUser> yehuaqiUsers2 = tYehuaqiUserService.queryByUserOwnIdAndEnterpriseIdForThirdParty(collect, tEnterpriseInfo.getEnterpriseId());
Map<String, List<TYehuaqiUser>> collect1 = yehuaqiUsers2.stream().collect(Collectors.groupingBy(TYehuaqiUser::getUserOwnId));
Iterator<TYehuaqiUser> iterator = noRepeatUserOwnIdList.iterator();
while (iterator.hasNext()) {
TYehuaqiUser next = iterator.next();
List<TYehuaqiUser> yehuaqiUsers3 = collect1.get(next.getUserOwnId());
if (yehuaqiUsers3 != null && yehuaqiUsers3.size() > 0) {
next.setUserId(yehuaqiUsers3.get(0).getUserId());
updateYehuaqiUsers.add(next);
iterator.remove();
}
}
}
//4 判断那些是 新增的,那些是 修改的后,进行 批量插入 和 批量更新操作。
// 需要新增的
if (noRepeatUserOwnIdList.size() > 0) {
successNum+=noRepeatUserOwnIdList.size();
tYehuaqiUserService.insertBatchForThirdParty(noRepeatUserOwnIdList);
for (TYehuaqiUser tYehuaqiUser : noRepeatUserOwnIdList) {
lpgThirdPartyDockingInterfaceRecord = successRecord("createLpgLiquefiedGasUser", tYehuaqiUser.toString(), encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
List<YeHuaqiUserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVos = tYehuaqiUser.getUserManageSafetyDeviceExportVos();
if (userManageSafetyDeviceExportVos != null && userManageSafetyDeviceExportVos.size() > 0) {
for (YeHuaqiUserManageSafetyDeviceExportVo userManageSafetyDeviceExportVo : userManageSafetyDeviceExportVos) {
TYehuaqiuserSafetyDeviceInfo tYehuaqiuserSafetyDeviceInfo = new TYehuaqiuserSafetyDeviceInfo();
BeanUtils.copyProperties(userManageSafetyDeviceExportVo,tYehuaqiuserSafetyDeviceInfo);
tYehuaqiuserSafetyDeviceInfo.setfRelationUserId(tYehuaqiUser.getUserId());
yehuaqiuserSafetyDeviceInfos.add(tYehuaqiuserSafetyDeviceInfo);
}
}
}
}
// 批量插入安全装置
if (yehuaqiuserSafetyDeviceInfos.size() > 0) {
tYehuaqiUserService.insertBatchSafetyDevice(yehuaqiuserSafetyDeviceInfos);
}
//5 需要批量修改的
if (updateYehuaqiUsers.size() > 0) {
successNum+=updateYehuaqiUsers.size();
for (TYehuaqiUser updateYehuaqiUser : updateYehuaqiUsers) {
lpgThirdPartyDockingInterfaceRecord = successRecord("createLpgLiquefiedGasUser", updateYehuaqiUser.toString(), encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
List<YeHuaqiUserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVos = updateYehuaqiUser.getUserManageSafetyDeviceExportVos();
if (userManageSafetyDeviceExportVos != null && userManageSafetyDeviceExportVos.size() > 0) {
for (YeHuaqiUserManageSafetyDeviceExportVo userManageSafetyDeviceExportVo : userManageSafetyDeviceExportVos) {
TYehuaqiuserSafetyDeviceInfo yehuaqiuserSafetyDeviceInfo = new TYehuaqiuserSafetyDeviceInfo();
BeanUtils.copyProperties(userManageSafetyDeviceExportVo,yehuaqiuserSafetyDeviceInfo);
yehuaqiuserSafetyDeviceInfo.setfRelationUserId(updateYehuaqiUser.getUserId());
updateYehuaqiuserSafetyDeviceInfos.add(yehuaqiuserSafetyDeviceInfo);
}
}
}
// 批量修改 燃气用户
tYehuaqiUserService.updateBatch(updateYehuaqiUsers);
// 批量修改完 燃气用户后 再处理 燃气用户下的 安全装置。先删除,再新增
List<Long> collect = updateYehuaqiUsers.stream().map(TYehuaqiUser::getUserId).collect(Collectors.toList());
tYehuaqiUserService.deleteBatchSafetyDeviceByUserIds(collect);
tYehuaqiUserService.insertBatchSafetyDevice(updateYehuaqiuserSafetyDeviceInfos);
}
}
// 6 接口记录直接插入
if (lpgThirdPartyDockingInterfaceRecords.size() > 0) {
lpgThirdPartyDockingInterfaceRecordService.insertBatch(lpgThirdPartyDockingInterfaceRecords);
}
}
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("条");
......
......@@ -160,38 +160,152 @@ public class DESEncoder {
String lpggasdata = "[\n" +
"\t{\n" +
"\t\t\"fVillageName\":\"村庄名称-接口来的-01\",\n" +
"\t\t\"fTotalNumHouse\":\"49\",\n" +
"\t\t\"countyCode\":\"130104\",\n" +
"\t\t\"fBottledGasUsers\":\"15\",\n" +
"\t\t\"fPipeGasUsers\":\"14\",\n" +
"\t\t\"userOwnId\":\"用户自有编号-接口来的-01\",\n" +
"\t\t\"nickName\":\"用户名称-接口来的-01\",\n" +
"\t\t\"userType\":\"1\",\n" +
"\t\t\"villageId\":\"3\",\n" +
"\t\t\"address\":\"地址-接口来的-01\",\n" +
"\t\t\"longitude\":\"14.56\",\n" +
"\t\t\"latitude\":\"18.96\",\n" +
"\t\t\"remarks\":\"备注-接口来的-01\"\n" +
"\t\t\"linkman\":\"联系人-接口来的-01\",\n" +
"\t\t\"phone\":\"电话-接口来的-01\",\n" +
"\t\t\"remarks\":\"备注-接口来的-01\",\n" +
"\t\t\"safetyDeviceList\":[\n" +
"\t\t\t{\n" +
"\t\t\t\t\"fDeviceName\":\"设备名称-接口来的-01-01\",\n" +
"\t\t\t\t\"fDeviceModel\":\"设备型号-接口来的-01-01\",\n" +
"\t\t\t\t\"fIotNo\":\"物联网编号-接口来的-01-01\",\n" +
"\t\t\t\t\"fRelationDeviceType\":\"设备类型-接口来的-01-01\",\n" +
"\t\t\t\t\"fDetectionMedium\":\"探测介质-接口来的-01-01\",\n" +
"\t\t\t\t\"fDeviceInstallTime\":\"2024-09-20\",\n" +
"\t\t\t\t\"fDeviceInstallPosition\":\"设备安装位置-接口来的-01-01\",\n" +
"\t\t\t\t\"fHead\":\"负责人-接口来的-01-01\",\n" +
"\t\t\t\t\"fPhone\":\"联系电话-接口来的-01-01\"\n" +
"\t\t\t},\n" +
"\t\t\t{\n" +
"\t\t\t\t\"fDeviceName\":\"设备名称-接口来的-01-02\",\n" +
"\t\t\t\t\"fDeviceModel\":\"设备型号-接口来的-01-02\",\n" +
"\t\t\t\t\"fIotNo\":\"物联网编号-接口来的-01-02\",\n" +
"\t\t\t\t\"fRelationDeviceType\":\"设备类型-接口来的-01-02\",\n" +
"\t\t\t\t\"fDetectionMedium\":\"探测介质-接口来的-01-02\",\n" +
"\t\t\t\t\"fDeviceInstallTime\":\"2024-09-20\",\n" +
"\t\t\t\t\"fDeviceInstallPosition\":\"设备安装位置-接口来的-01-02\",\n" +
"\t\t\t\t\"fHead\":\"负责人-接口来的-01-02\",\n" +
"\t\t\t\t\"fPhone\":\"联系电话-接口来的-01-02\"\n" +
"\t\t\t},\n" +
"\t\t\t{\n" +
"\n" +
"\t\t\t\t\"fDeviceName\":\"设备名称-接口来的-01-03\",\n" +
"\t\t\t\t\"fDeviceModel\":\"设备型号-接口来的-01-03\",\n" +
"\t\t\t\t\"fIotNo\":\"物联网编号-接口来的-01-03\",\n" +
"\t\t\t\t\"fRelationDeviceType\":\"设备类型-接口来的-01-03\",\n" +
"\t\t\t\t\"fDetectionMedium\":\"探测介质-接口来的-01-03\",\n" +
"\t\t\t\t\"fDeviceInstallTime\":\"2024-09-20\",\n" +
"\t\t\t\t\"fDeviceInstallPosition\":\"设备安装位置-接口来的-01-03\",\n" +
"\t\t\t\t\"fHead\":\"负责人-接口来的-01-03\",\n" +
"\t\t\t\t\"fPhone\":\"联系电话-接口来的-01-03\"\n" +
"\t\t\t}\n" +
"\t\t]\n" +
"\t},\n" +
"\t{\n" +
"\n" +
"\t\t\"fVillageName\":\"村庄名称-接口来的-02\",\n" +
"\t\t\"fTotalNumHouse\":\"49\",\n" +
"\t\t\"countyCode\":\"130105\",\n" +
"\t\t\"fBottledGasUsers\":\"15\",\n" +
"\t\t\"fPipeGasUsers\":\"14\",\n" +
"\t\t\"userOwnId\":\"用户自有编号-接口来的-02\",\n" +
"\t\t\"nickName\":\"用户名称-接口来的-02\",\n" +
"\t\t\"userType\":\"2\",\n" +
"\t\t\"villageId\":\"\",\n" +
"\t\t\"address\":\"地址-接口来的-02\",\n" +
"\t\t\"longitude\":\"14.56\",\n" +
"\t\t\"latitude\":\"18.96\",\n" +
"\t\t\"remarks\":\"备注-接口来的-01\"\n" +
"\t\t\"linkman\":\"联系人-接口来的-02\",\n" +
"\t\t\"phone\":\"电话-接口来的-02\",\n" +
"\t\t\"remarks\":\"备注-接口来的-02\",\n" +
"\t\t\"safetyDeviceList\":[\n" +
"\t\t\t{\n" +
"\t\t\t\t\"fDeviceName\":\"设备名称-接口来的-02-01\",\n" +
"\t\t\t\t\"fDeviceModel\":\"设备型号-接口来的-02-01\",\n" +
"\t\t\t\t\"fIotNo\":\"物联网编号-接口来的-02-01\",\n" +
"\t\t\t\t\"fRelationDeviceType\":\"设备类型-接口来的-02-01\",\n" +
"\t\t\t\t\"fDetectionMedium\":\"探测介质-接口来的-02-01\",\n" +
"\t\t\t\t\"fDeviceInstallTime\":\"2024-09-21\",\n" +
"\t\t\t\t\"fDeviceInstallPosition\":\"设备安装位置-接口来的-02-01\",\n" +
"\t\t\t\t\"fHead\":\"负责人-接口来的-02-01\",\n" +
"\t\t\t\t\"fPhone\":\"联系电话-接口来的-02-01\"\n" +
"\t\t\t},\n" +
"\t\t\t{\n" +
"\t\t\t\t\"fDeviceName\":\"设备名称-接口来的-02-02\",\n" +
"\t\t\t\t\"fDeviceModel\":\"设备型号-接口来的-02-02\",\n" +
"\t\t\t\t\"fIotNo\":\"物联网编号-接口来的-02-02\",\n" +
"\t\t\t\t\"fRelationDeviceType\":\"设备类型-接口来的-02-02\",\n" +
"\t\t\t\t\"fDetectionMedium\":\"探测介质-接口来的-02-02\",\n" +
"\t\t\t\t\"fDeviceInstallTime\":\"2024-09-21\",\n" +
"\t\t\t\t\"fDeviceInstallPosition\":\"设备安装位置-接口来的-02-02\",\n" +
"\t\t\t\t\"fHead\":\"负责人-接口来的-02-02\",\n" +
"\t\t\t\t\"fPhone\":\"联系电话-接口来的-02-02\"\n" +
"\t\t\t},\n" +
"\t\t\t{\n" +
"\n" +
"\t\t\t\t\"fDeviceName\":\"设备名称-接口来的-02-03\",\n" +
"\t\t\t\t\"fDeviceModel\":\"设备型号-接口来的-02-03\",\n" +
"\t\t\t\t\"fIotNo\":\"物联网编号-接口来的-02-03\",\n" +
"\t\t\t\t\"fRelationDeviceType\":\"设备类型-接口来的-02-03\",\n" +
"\t\t\t\t\"fDetectionMedium\":\"探测介质-接口来的-02-03\",\n" +
"\t\t\t\t\"fDeviceInstallTime\":\"2024-09-21\",\n" +
"\t\t\t\t\"fDeviceInstallPosition\":\"设备安装位置-接口来的-02-03\",\n" +
"\t\t\t\t\"fHead\":\"负责人-接口来的-02-03\",\n" +
"\t\t\t\t\"fPhone\":\"联系电话-接口来的-02-03\"\n" +
"\t\t\t}\n" +
"\t\t]\n" +
"\t},\n" +
"\t{\n" +
"\n" +
"\t\t\"fVillageName\":\"村庄名称-接口来的-02\",\n" +
"\t\t\"fTotalNumHouse\":\"49\",\n" +
"\t\t\"countyCode\":\"130107\",\n" +
"\t\t\"fBottledGasUsers\":\"15\",\n" +
"\t\t\"fPipeGasUsers\":\"14\",\n" +
"\t\t\"userOwnId\":\"用户自有编号-接口来的-03\",\n" +
"\t\t\"nickName\":\"用户名称-接口来的-03\",\n" +
"\t\t\"userType\":\"4\",\n" +
"\t\t\"villageId\":\"\",\n" +
"\t\t\"address\":\"地址-接口来的-03\",\n" +
"\t\t\"longitude\":\"14.56\",\n" +
"\t\t\"latitude\":\"18.96\",\n" +
"\t\t\"remarks\":\"备注-接口来的-01\"\n" +
"\t\t\"linkman\":\"联系人-接口来的-03\",\n" +
"\t\t\"phone\":\"电话-接口来的-03\",\n" +
"\t\t\"remarks\":\"备注-接口来的-03\",\n" +
"\t\t\"safetyDeviceList\":[\n" +
"\t\t\t{\n" +
"\t\t\t\t\"fDeviceName\":\"设备名称-接口来的-03-01\",\n" +
"\t\t\t\t\"fDeviceModel\":\"设备型号-接口来的-03-01\",\n" +
"\t\t\t\t\"fIotNo\":\"物联网编号-接口来的-03-01\",\n" +
"\t\t\t\t\"fRelationDeviceType\":\"设备类型-接口来的-03-01\",\n" +
"\t\t\t\t\"fDetectionMedium\":\"探测介质-接口来的-03-01\",\n" +
"\t\t\t\t\"fDeviceInstallTime\":\"2024-09-22\",\n" +
"\t\t\t\t\"fDeviceInstallPosition\":\"设备安装位置-接口来的-03-01\",\n" +
"\t\t\t\t\"fHead\":\"负责人-接口来的-03-01\",\n" +
"\t\t\t\t\"fPhone\":\"联系电话-接口来的-03-01\"\n" +
"\t\t\t},\n" +
"\t\t\t{\n" +
"\t\t\t\t\"fDeviceName\":\"设备名称-接口来的-03-02\",\n" +
"\t\t\t\t\"fDeviceModel\":\"设备型号-接口来的-03-02\",\n" +
"\t\t\t\t\"fIotNo\":\"物联网编号-接口来的-03-02\",\n" +
"\t\t\t\t\"fRelationDeviceType\":\"设备类型-接口来的-03-02\",\n" +
"\t\t\t\t\"fDetectionMedium\":\"探测介质-接口来的-03-02\",\n" +
"\t\t\t\t\"fDeviceInstallTime\":\"2024-09-22\",\n" +
"\t\t\t\t\"fDeviceInstallPosition\":\"设备安装位置-接口来的-03-02\",\n" +
"\t\t\t\t\"fHead\":\"负责人-接口来的-03-02\",\n" +
"\t\t\t\t\"fPhone\":\"联系电话-接口来的-03-02\"\n" +
"\t\t\t},\n" +
"\t\t\t{\n" +
"\n" +
"\t\t\t\t\"fDeviceName\":\"设备名称-接口来的-03-03\",\n" +
"\t\t\t\t\"fDeviceModel\":\"设备型号-接口来的-03-03\",\n" +
"\t\t\t\t\"fIotNo\":\"物联网编号-接口来的-03-03\",\n" +
"\t\t\t\t\"fRelationDeviceType\":\"设备类型-接口来的-03-03\",\n" +
"\t\t\t\t\"fDetectionMedium\":\"探测介质-接口来的-03-03\",\n" +
"\t\t\t\t\"fDeviceInstallTime\":\"2024-09-22\",\n" +
"\t\t\t\t\"fDeviceInstallPosition\":\"设备安装位置-接口来的-03-03\",\n" +
"\t\t\t\t\"fHead\":\"负责人-接口来的-03-03\",\n" +
"\t\t\t\t\"fPhone\":\"联系电话-接口来的-03-03\"\n" +
"\t\t\t}\n" +
"\t\t]\n" +
"\t}\n" +
"]";
"]\n";
JSONArray objects = JSON.parseArray(lpggasdata);
System.out.println(objects);
......
......@@ -2,6 +2,7 @@ package com.zehong.system.domain;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
import com.zehong.system.domain.vo.UserManageSafetyDeviceExportVo;
import com.zehong.system.domain.vo.YeHuaqiUserManageSafetyDeviceExportVo;
......@@ -287,6 +288,19 @@ public class TYehuaqiUser extends BaseEntity
this.userOwnId = userOwnId;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
TYehuaqiUser yehuaqiUser = (TYehuaqiUser) obj;
return Objects.equals(userOwnId,yehuaqiUser.getUserOwnId());
}
@Override
public int hashCode() {
return Objects.hash(userOwnId);
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -4,6 +4,11 @@ import java.math.BigDecimal;
public class TUserManageVillageThirdPartyVo {
/**
* id
*/
private Long fVillageId;
/**
* 名称
*/
......@@ -36,6 +41,14 @@ public class TUserManageVillageThirdPartyVo {
/** 备注 */
private String remarks;
public Long getfVillageId() {
return fVillageId;
}
public void setfVillageId(Long fVillageId) {
this.fVillageId = fVillageId;
}
public String getfVillageName() {
return fVillageName;
}
......
......@@ -48,6 +48,13 @@ public interface TUserManageVillageMapper
* @return r
*/
List<TUserManageVillage> queryByVillageNames(@Param("list") List<String> list);
/**
* 根据id集合查询
* @param villageIds s
* @return r
*/
List<TUserManageVillage> queryByVillageIds(@Param("list") List<Long> villageIds);
/**
* 新增基本信息维护-用户管理-居住区(村庄)
*
......
......@@ -51,6 +51,14 @@ public interface TYehuaqiUserMapper
* @return 燃气用户集合
*/
public List<TYehuaqiUser> selectTYehuaqiUserList(TYehuaqiUser tYehuaqiUser);
/**
* 根据 userOwnId list 和 enterpriseId 查询数据
* @param userOwnIds userOwnId list
* @param enterpriseId enterpriseId
* @return r
*/
public List<TYehuaqiUser> queryByUserOwnIdAndEnterpriseIdForThirdParty(@Param("userOwnIds") List<String> userOwnIds,@Param("enterpriseId") String enterpriseId);
public List<TYehuaqiUser> selectTYehuaqiUserListTwo(TYehuaqiUser tYehuaqiUser);
......@@ -76,6 +84,13 @@ public interface TYehuaqiUserMapper
*/
public int insertBatch(@Param("list") List<TYehuaqiUser> list);
/**
* 提供给第三方接口调用时的批量插入
* @param tYehuaqiUsers r
* @return r
*/
public int insertBatchForThirdParty(List<TYehuaqiUser> tYehuaqiUsers);
/**
* 查询燃气用户列表 - 导出使用
*
......@@ -101,6 +116,12 @@ public interface TYehuaqiUserMapper
*/
public int updateTYehuaqiUser(TYehuaqiUser tYehuaqiUser);
/**批量修改
* @param list list
* @return r
*/
public int updateBatch(@Param("list") List<TYehuaqiUser> list);
/**
* 删除燃气用户
*
......
......@@ -51,6 +51,12 @@ public interface TYehuaqiuserSafetyDeviceInfoMapper
*/
public int insertBatch(@Param("list") List<TYehuaqiuserSafetyDeviceInfo> tYehuaqiuserSafetyDeviceInfos);
/**
* 批量删除
* @param list list
* @return r
*/
public int deleteBatchSafetyDeviceByUserIds(@Param("list") List<Long> list);
/**
* 根据 userid删除 数据
......
......@@ -49,6 +49,13 @@ public interface ITUserManageVillageService
* @return r
*/
public List<TUserManageVillage> queryByVillageNames(List<String> villageNames);
/**
* 根据 id集合查询
* @param villageIds v
* @return r
*/
public List<TUserManageVillage> queryByVillageIds(List<Long> villageIds);
/**
* 新增基本信息维护-用户管理-居住区(村庄)
*
......
......@@ -4,6 +4,7 @@ import java.util.List;
import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.TYehuaqiUser;
import com.zehong.system.domain.TYehuaqiuserSafetyDeviceInfo;
import com.zehong.system.domain.vo.*;
/**
......@@ -32,6 +33,14 @@ public interface ITYehuaqiUserService
public List<TYehuaqiUser> selectAllUserList(TYehuaqiUser tYehuaqiUser);
/**
* 根据 userOwnId list 和 enterpriseId 查询数据
* @param userOwnIds userOwnId list
* @param enterpriseId enterpriseId
* @return r
*/
public List<TYehuaqiUser> queryByUserOwnIdAndEnterpriseIdForThirdParty(List<String> userOwnIds,String enterpriseId);
/**
* 根据企业id统计错误数据
* @return r
......@@ -65,6 +74,20 @@ public interface ITYehuaqiUserService
*/
public List<TYehuaqiUser> queryByUserOwnIdsAndEnterpriseId(List<String> userOwnIds,String enterpriseId);
/**
* 批量插入 安全装置
* @param yehuaqiuserSafetyDeviceInfos y
* @return r
*/
public int insertBatchSafetyDevice(List<TYehuaqiuserSafetyDeviceInfo> yehuaqiuserSafetyDeviceInfos);
/**
* 根据 userId 集合批量删除
* @param userIds u
* @return r
*/
public int deleteBatchSafetyDeviceByUserIds(List<Long> userIds);
/**
* 查询导入的错误数据
* @return r
......@@ -79,6 +102,19 @@ public interface ITYehuaqiUserService
*/
public int insertTYehuaqiUser(TYehuaqiUser tYehuaqiUser);
/**
* 批量插入
* @param tYehuaqiUsers t
* @return r
*/
public int insertBatch(List<TYehuaqiUser> tYehuaqiUsers);
/**
* 提供给第三方接口调用时的批量插入
* @param tYehuaqiUsers r
* @return r
*/
public int insertBatchForThirdParty(List<TYehuaqiUser> tYehuaqiUsers);
/**
* 修改燃气用户
*
......@@ -87,6 +123,13 @@ public interface ITYehuaqiUserService
*/
public int updateTYehuaqiUser(TYehuaqiUser tYehuaqiUser);
/**
* 批量修改
* @param tYehuaqiUsers t
* @return r
*/
public int updateBatch(List<TYehuaqiUser> tYehuaqiUsers);
/**
* 批量删除燃气用户
*
......
......@@ -92,6 +92,16 @@ public class TUserManageVillageServiceImpl implements ITUserManageVillageService
return tUserManageVillageMapper.queryByVillageNames(villageNames);
}
/**
* 根据 id 集合查询
* @param villageIds v
* @return r
*/
@Override
public List<TUserManageVillage> queryByVillageIds(List<Long> villageIds) {
return tUserManageVillageMapper.queryByVillageIds(villageIds);
}
/**
* 新增基本信息维护-用户管理-居住区(村庄)
*
......
......@@ -76,6 +76,18 @@ public class TYehuaqiUserServiceImpl implements ITYehuaqiUserService
{
return tYehuaqiUserMapper.selectTYehuaqiUserList(tYehuaqiUser);
}
/**
* 根据 userOwnId list 和 enterpriseId 查询数据
* @param userOwnIds userOwnId list
* @param enterpriseId enterpriseId
* @return r
*/
@Override
public List<TYehuaqiUser> queryByUserOwnIdAndEnterpriseIdForThirdParty(List<String> userOwnIds, String enterpriseId) {
return tYehuaqiUserMapper.queryByUserOwnIdAndEnterpriseIdForThirdParty(userOwnIds,enterpriseId);
}
@Override
public List<TYehuaqiUser> selectAllUserList(TYehuaqiUser tYehuaqiUser)
{
......@@ -114,6 +126,25 @@ public class TYehuaqiUserServiceImpl implements ITYehuaqiUserService
return tYehuaqiUserMapper.insertTYehuaqiUser(tYehuaqiUser);
}
/**
* 批量插入
* @param tYehuaqiUsers t
* @return r
*/
@Override
public int insertBatch(List<TYehuaqiUser> tYehuaqiUsers) {
return tYehuaqiUserMapper.insertBatch(tYehuaqiUsers);
}
/**
* 提供给第三方接口调用时的批量插入
* @param tYehuaqiUsers r
* @return r
*/
public int insertBatchForThirdParty(List<TYehuaqiUser> tYehuaqiUsers){
return tYehuaqiUserMapper.insertBatchForThirdParty(tYehuaqiUsers);
}
/**
* 修改燃气用户
*
......@@ -127,6 +158,16 @@ public class TYehuaqiUserServiceImpl implements ITYehuaqiUserService
return tYehuaqiUserMapper.updateTYehuaqiUser(tYehuaqiUser);
}
/**
* 批量修改
* @param tYehuaqiUsers t
* @return r
*/
@Override
public int updateBatch(List<TYehuaqiUser> tYehuaqiUsers) {
return tYehuaqiUserMapper.updateBatch(tYehuaqiUsers);
}
/**
* 批量删除燃气用户
*
......@@ -219,6 +260,26 @@ public class TYehuaqiUserServiceImpl implements ITYehuaqiUserService
return tYehuaqiUserMapper.queryByUserOwnIdsAndEnterpriseId(userOwnIds,enterpriseId);
}
/**
* 批量插入 安全装置
* @param yehuaqiuserSafetyDeviceInfos y
* @return r
*/
@Override
public int insertBatchSafetyDevice(List<TYehuaqiuserSafetyDeviceInfo> yehuaqiuserSafetyDeviceInfos) {
return yehuaqiuserSafetyDeviceInfoMapper.insertBatch(yehuaqiuserSafetyDeviceInfos);
}
/**
* 根据 用户userId 集合删除数据
* @param userIds u
* @return r
*/
@Override
public int deleteBatchSafetyDeviceByUserIds(List<Long> userIds) {
return 0;
}
/**
* 处理解析好的 自定义模版的导入的数据 多sheet
* @param gasUserExportVos d 燃气用户数据
......
......@@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<resultMap type="TUserManageVillageThirdPartyVo" id="TUserManageVillageThirdPartyVoResult">
<result property="fVillageId" column="f_village_id" />
<result property="fVillageName" column="f_village_name" />
<result property="fRegionName" column="fRegionName" />
<result property="countyCode" column="countyCode" />
......@@ -121,6 +122,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</select>
<select id="queryByVillageIds" parameterType="list" resultMap="TUserManageVillageResult">
<include refid="selectTUserManageVillageVo"></include>
where village.f_village_id in
<foreach collection="list" index="i" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectTUserManageVillageById" parameterType="Long" resultMap="TUserManageVillageResult">
<include refid="selectTUserManageVillageVo"/>
where f_village_id = #{fVillageId}
......
......@@ -75,6 +75,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
phone, email, create_time, update_time, is_del, remarks ,f_village_id,error_msg,user_own_id from t_yehuaqi_user
</sql>
<select id="queryByUserOwnIdAndEnterpriseIdForThirdParty" resultMap="TYehuaqiUserResult">
<include refid="selectTYehuaqiUserVo"/>
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="selectTYehuaqiUserList" parameterType="TYehuaqiUser" resultMap="TYehuaqiUserResult">
select a.user_id,
......@@ -181,6 +189,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</foreach>
</insert>
<insert id="insertBatchForThirdParty" parameterType="list" useGeneratedKeys="true" keyProperty="userId">
insert into t_yehuaqi_user (nick_name, beyond_enterprise_name,beyond_enterprise_id, user_type, village_name,f_village_id,
address, linkman, phone, remarks, error_msg,user_own_id,longitude,latitude)
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.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}, #{item.longitude}, #{item.latitude}
)
</foreach>
</insert>
<insert id="insertTYehuaqiUser" parameterType="TYehuaqiUser" useGeneratedKeys="true" keyProperty="userId">
insert into t_yehuaqi_user
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -219,6 +241,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<update id="updateBatch" parameterType="list">
<foreach collection="list" item="item" index="index" separator=";">
UPDATE t_yehuaqi_user
<trim prefix="SET" suffixOverrides=",">
<if test="item.nickName != null">nick_name = #{item.nickName},</if>
<if test="item.userType != null">user_type = #{item.userType},</if>
<if test="item.villageId != null">f_village_id = #{item.villageId},</if>
<if test="item.address != null">address = #{item.address},</if>
<if test="item.longitude != null">longitude = #{item.longitude},</if>
<if test="item.latitude != null">latitude = #{item.latitude},</if>
<if test="item.linkman != null">linkman = #{item.linkman},</if>
<if test="item.phone != null">phone = #{item.phone},</if>
<if test="item.remarks != null">remarks = #{item.remarks},</if>
</trim>
WHERE user_id = #{item.userId}
</foreach>
</update>
<update id="updateTYehuaqiUser" parameterType="TYehuaqiUser">
update t_yehuaqi_user
<trim prefix="SET" suffixOverrides=",">
......
......@@ -93,6 +93,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</foreach>
</insert>
<delete id="deleteBatchSafetyDeviceByUserIds" parameterType="list">
delete from t_yehuaqiuser_safety_device_info where f_relation_user_id in
<foreach collection="list" close=")" separator="," open="(" item="item" index="i">
#{item}
</foreach>
</delete>
<update id="updateTYehuaqiuserSafetyDeviceInfo" parameterType="TYehuaqiuserSafetyDeviceInfo">
update t_yehuaqiuser_safety_device_info
......
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