Commit 17d7ee03 authored by wanghao's avatar wanghao

1 液化石油气监管-液化气用户模块功能开发。

parent 23d69d1a
......@@ -105,4 +105,13 @@ public class TYehuaqiuserSafetyDeviceInfoController extends BaseController
{
return toAjax(tYehuaqiuserSafetyDeviceInfoService.deleteTYehuaqiuserSafetyDeviceInfoByIds(fSafetyDeviceIds));
}
/**
* 删除液化石油气监管-液化气用户-安全装置加装维护-单个删除
*/
@Log(title = "液化石油气监管-液化气用户-安全装置加装维护", businessType = BusinessType.DELETE)
@DeleteMapping("/deleteTYehuaqiuserSafetyDeviceInfoById/{fSafetyDeviceId}")
public AjaxResult deleteTYehuaqiuserSafetyDeviceInfoById(@PathVariable Long fSafetyDeviceId) {
return toAjax(tYehuaqiuserSafetyDeviceInfoService.deleteTYehuaqiuserSafetyDeviceInfoById(fSafetyDeviceId));
}
}
package com.zehong.web.controller.system;
import java.io.*;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.vo.GasUserAndSafetyDeviceVo;
import org.springframework.security.access.prepost.PreAuthorize;
import com.zehong.system.domain.vo.UserManageGasUserExportVo;
import com.zehong.system.domain.vo.UserManageSafetyDeviceExportVo;
import com.zehong.system.domain.vo.YeHuaqiUserManageSafetyDeviceExportVo;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
......@@ -22,6 +39,9 @@ import com.zehong.system.domain.TYehuaqiUser;
import com.zehong.system.service.ITYehuaqiUserService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
/**
* 燃气用户Controller
......@@ -130,4 +150,215 @@ public class TYehuaqiUserController extends BaseController
int i = tYehuaqiUserService.countByBeyondEnterpriseId();
return AjaxResult.success(i);
}
/**
* 自定义-模版下载
* @param response r
* @throws IOException i
*/
@GetMapping("/downloadTemplate")
public void downloadTemplate(HttpServletResponse response) throws IOException {
//判断是否是 windows环境,
String osName = System.getProperty("os.name").toLowerCase();
try {
File file;
//如果是本地或测试环境
if (osName.contains("windows")) {
String filePath = "importTemplate/液化气用户导入模版.xlsx";
//用来读取resources下的文件
Resource resource = new ClassPathResource(filePath);
file = resource.getFile();
} else {
file = ResourceUtils.getFile("/data/java/baseversion/importTemplate/液化气用户导入模版.xlsx");
}
// 获取文件名
String filename = file.getName();
// 将文件写入输入流
FileInputStream fileInputStream = new FileInputStream(file);
InputStream fis = new BufferedInputStream(fileInputStream);
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
fis.close();
// 清空response
response.reset();
// 设置response的Header
response.setCharacterEncoding("UTF-8");
//Content-Disposition的作用:告知浏览器以何种方式显示响应返回的文件,用浏览器打开还是以附件的形式下载到本地保存
//attachment表示以附件方式下载 inline表示在线打开 "Content-Disposition: inline; filename=文件名.mp3"
// filename表示文件的默认名称,因为网络传输只支持URL编码的相关支付,因此需要将文件名URL编码后进行传输,前端收到后需要反编码才能获取到真正的名称
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8"));
// 告知浏览器文件的大小
response.addHeader("Content-Length", "" + file.length());
OutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
response.setContentType("application/octet-stream");
outputStream.write(buffer);
outputStream.flush();
} catch (IOException ex) {
ex.printStackTrace();
}
}
/**
* 自定义-模版下载-带有错误数据
* @param response r
* @throws IOException i
*/
@GetMapping("/exportErrorData")
public void exportErrorData(HttpServletResponse response) throws IOException {
//判断是否是 windows环境,
String osName = System.getProperty("os.name").toLowerCase();
try {
File file;
//如果是本地或测试环境
if (osName.contains("windows")) {
String filePath = "importTemplate/液化气用户错误导入数据模版.xlsx";
//用来读取resources下的文件
Resource resource = new ClassPathResource(filePath);
file = resource.getFile();
} else {
file = ResourceUtils.getFile("/data/java/baseversion/importTemplate/液化气用户错误导入数据模版.xlsx");
}
List<TYehuaqiUser> yehuaqiUsers = tYehuaqiUserService.queryErrorDetectorUserList();
List<UserManageGasUserExportVo> userManageGasUserExportVos = new ArrayList<>();
for (TYehuaqiUser yehuaqiUser : yehuaqiUsers) {
UserManageGasUserExportVo userManageGasUserExportVo = new UserManageGasUserExportVo();
BeanUtils.copyProperties(yehuaqiUser,userManageGasUserExportVo);
userManageGasUserExportVos.add(userManageGasUserExportVo);
}
TemplateExportParams params = new TemplateExportParams(file.getAbsolutePath(), true);
Map<String, Object> total = new HashMap<>();
total.put("maplist",userManageGasUserExportVos);
Workbook workbook = ExcelExportUtil.exportExcel(params, total);
String fileName = "液化气用户错误导入数据模版.xlsx";
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
OutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
outputStream.flush();
outputStream.close();
workbook.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
/**
* 自定义模版的多sheet导入
* @param file f
* @return r
* @throws Exception e
*/
@PostMapping("/moreSheetImportExcel")
public AjaxResult moreSheetImportExcel(MultipartFile file, boolean updateSupport) throws Exception {
String originalFilename = file.getOriginalFilename();
if (originalFilename != null && originalFilename.contains("错误")) {
List<UserManageGasUserExportVo> userManageGasUserobjects = ExcelUtil.moreSheetImportExcel(file, 1, 2, UserManageGasUserExportVo.class, 0);
tYehuaqiUserService.handleCustomMoreSheetImportData(userManageGasUserobjects,null,updateSupport,true);
return AjaxResult.success();
} else{
List<UserManageGasUserExportVo> userManageGasUserobjects = ExcelUtil.moreSheetImportExcel(file, 1, 2, UserManageGasUserExportVo.class, 0);
List<YeHuaqiUserManageSafetyDeviceExportVo> userManageSafetyobjects = ExcelUtil.moreSheetImportExcel(file, 1, 2, YeHuaqiUserManageSafetyDeviceExportVo.class, 1);
tYehuaqiUserService.handleCustomMoreSheetImportData(userManageGasUserobjects,userManageSafetyobjects,updateSupport,false);
return AjaxResult.success();
}
}
/**
* 自定义-模版下载-正确数据导出
* @param response r
* @param yehuaqiUser t
*/
@GetMapping("/exportSuccessData")
public void exportSuccessData(HttpServletResponse response,TYehuaqiUser yehuaqiUser) {
//获取用户信息
SysUser user = SecurityUtils.getLoginUser().getUser();
yehuaqiUser.setBeyondEnterpriseId(user.getDeptId());
List<TYehuaqiUser> yehuaqiUsers = tYehuaqiUserService.selectForExportTYehuaqiUserList(yehuaqiUser);
//判断是否是 windows环境,
String osName = System.getProperty("os.name").toLowerCase();
try {
File file;
//如果是本地或测试环境
if (osName.contains("windows")) {
String filePath = "importTemplate/液化气用户导出模版.xlsx";
//用来读取resources下的文件
Resource resource = new ClassPathResource(filePath);
file = resource.getFile();
} else {
file = ResourceUtils.getFile("/data/java/baseversion/importTemplate/液化气用户导出模版.xlsx");
}
List<YeHuaqiUserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVoList = new ArrayList<>();
for (TYehuaqiUser yehuaqiUser1 : yehuaqiUsers) {
List<YeHuaqiUserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVos = yehuaqiUser1.getUserManageSafetyDeviceExportVos();
if (userManageSafetyDeviceExportVos != null && userManageSafetyDeviceExportVos.size() > 0) {
userManageSafetyDeviceExportVoList.addAll(userManageSafetyDeviceExportVos);
}
}
TemplateExportParams params = new TemplateExportParams(file.getAbsolutePath(), true);
Map<String, Object> total = new HashMap<>();
total.put("gasUserMaplist",yehuaqiUsers);
if(userManageSafetyDeviceExportVoList.size() > 0) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (YeHuaqiUserManageSafetyDeviceExportVo userManageSafetyDeviceExportVo : userManageSafetyDeviceExportVoList) {
if (userManageSafetyDeviceExportVo.getfDeviceInstallTime() != null) {
String format = sdf.format(userManageSafetyDeviceExportVo.getfDeviceInstallTime());
userManageSafetyDeviceExportVo.setfDeviceInstallTimeStr(format);
}
}
}
total.put("safetyDeviceMaplist",userManageSafetyDeviceExportVoList);
Workbook workbook = ExcelExportUtil.exportExcel(params, total);
String fileName = "液化气用户数据.xlsx";
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
OutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
outputStream.flush();
outputStream.close();
workbook.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
......@@ -4,6 +4,7 @@ import java.math.BigDecimal;
import java.util.List;
import com.zehong.system.domain.vo.UserManageSafetyDeviceExportVo;
import com.zehong.system.domain.vo.YeHuaqiUserManageSafetyDeviceExportVo;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
......@@ -22,6 +23,12 @@ public class TYehuaqiUser extends BaseEntity
/** 用户id */
private Long userId;
/**
* 用户自有id - 新版本导入时使用,别的地方不用
*/
private String userOwnId;
/** 用户账号 */
@Excel(name = "用户账号")
private String username;
......@@ -31,8 +38,14 @@ public class TYehuaqiUser extends BaseEntity
private String nickName;
/** 权属单位id */
@Excel(name = "权属单位id")
private Long beyondEnterpriseId;
//@Excel(name = "权属单位id")
private String beyondEnterpriseId;
/**
* 所属企业名称
*/
@Excel(name = "所属企业")
private String beyondEnterpriseName;
/** 用户类型 */
@Excel(name = "用户类型")
......@@ -86,21 +99,17 @@ public class TYehuaqiUser extends BaseEntity
private String errorMsg;
/**
* 所属企业名称
*/
private String beyondEnterpriseName;
/**
* 安全装置集合 导出时使用
*/
private List<UserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVos;
private List<YeHuaqiUserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVos;
public List<UserManageSafetyDeviceExportVo> getUserManageSafetyDeviceExportVos() {
public List<YeHuaqiUserManageSafetyDeviceExportVo> getUserManageSafetyDeviceExportVos() {
return userManageSafetyDeviceExportVos;
}
public void setUserManageSafetyDeviceExportVos(List<UserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVos) {
public void setUserManageSafetyDeviceExportVos(List<YeHuaqiUserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVos) {
this.userManageSafetyDeviceExportVos = userManageSafetyDeviceExportVos;
}
......@@ -163,12 +172,12 @@ public class TYehuaqiUser extends BaseEntity
{
return nickName;
}
public void setBeyondEnterpriseId(Long beyondEnterpriseId)
public void setBeyondEnterpriseId(String beyondEnterpriseId)
{
this.beyondEnterpriseId = beyondEnterpriseId;
}
public Long getBeyondEnterpriseId()
public String getBeyondEnterpriseId()
{
return beyondEnterpriseId;
}
......@@ -270,6 +279,14 @@ public class TYehuaqiUser extends BaseEntity
this.villageName = villageName;
}
public String getUserOwnId() {
return userOwnId;
}
public void setUserOwnId(String userOwnId) {
this.userOwnId = userOwnId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -19,8 +19,8 @@ public class UserManageGasUserExportVo {
@Excel(name = "燃气类型(0-天然气;1-液化气)")
private String gasType;
/** 用户类型(1居民用户,2商业用户,3工业用户) */
@Excel(name = "用户类型(1-居民用户;2-商业用户;3-工业用户;4-餐饮单位用户)")
/** 用户类型(1-居民用户;2-工商业用户;4-餐饮单位用户) */
@Excel(name = "用户类型(1-居民用户;2-工商业用户;4-餐饮单位用户)")
private String userType;
/**
......
package com.zehong.system.domain.vo;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
public class YeHuaqiUserManageSafetyDeviceExportVo {
/** 用户账号 */
@Excel(name = "用户自有编号")
private String userOwnId;
/** 关联设备类型 */
@Excel(name = "设备类型")
private String fRelationDeviceType;
/** 设备名称 */
@Excel(name = "设备名称")
private String fDeviceName;
/** 设备型号 */
@Excel(name = "设备型号")
private String fDeviceModel;
/** 物联网编号 */
@Excel(name = "物联网编号")
private String fIotNo;
/** 探测介质 */
@Excel(name = "探测介质")
private String fDetectionMedium;
/** 设备安装时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "设备安装时间(yyyy-mm-dd)",width = 30,format ="yyyy-MM-dd")
private Date fDeviceInstallTime;
private String fDeviceInstallTimeStr;
/** 安装位置 */
@Excel(name = "安装位置")
private String fDeviceInstallPosition;
/** 负责人 */
@Excel(name = "负责人")
private String fHead;
/** 联系电话 */
@Excel(name = "联系电话")
private String fPhone;
public String getUserOwnId() {
return userOwnId;
}
public void setUserOwnId(String userOwnId) {
this.userOwnId = userOwnId;
}
public String getfRelationDeviceType() {
return fRelationDeviceType;
}
public void setfRelationDeviceType(String fRelationDeviceType) {
this.fRelationDeviceType = fRelationDeviceType;
}
public String getfDeviceName() {
return fDeviceName;
}
public void setfDeviceName(String fDeviceName) {
this.fDeviceName = fDeviceName;
}
public String getfDeviceModel() {
return fDeviceModel;
}
public void setfDeviceModel(String fDeviceModel) {
this.fDeviceModel = fDeviceModel;
}
public String getfIotNo() {
return fIotNo;
}
public void setfIotNo(String fIotNo) {
this.fIotNo = fIotNo;
}
public String getfDetectionMedium() {
return fDetectionMedium;
}
public void setfDetectionMedium(String fDetectionMedium) {
this.fDetectionMedium = fDetectionMedium;
}
public Date getfDeviceInstallTime() {
return fDeviceInstallTime;
}
public void setfDeviceInstallTime(Date fDeviceInstallTime) {
this.fDeviceInstallTime = fDeviceInstallTime;
}
public String getfDeviceInstallTimeStr() {
return fDeviceInstallTimeStr;
}
public void setfDeviceInstallTimeStr(String fDeviceInstallTimeStr) {
this.fDeviceInstallTimeStr = fDeviceInstallTimeStr;
}
public String getfDeviceInstallPosition() {
return fDeviceInstallPosition;
}
public void setfDeviceInstallPosition(String fDeviceInstallPosition) {
this.fDeviceInstallPosition = fDeviceInstallPosition;
}
public String getfHead() {
return fHead;
}
public void setfHead(String fHead) {
this.fHead = fHead;
}
public String getfPhone() {
return fPhone;
}
public void setfPhone(String fPhone) {
this.fPhone = fPhone;
}
}
......@@ -49,6 +49,22 @@ public interface TYehuaqiUserMapper
*/
public int insertTYehuaqiUser(TYehuaqiUser tYehuaqiUser);
/**
* 批量增加
* @param list list
* @return r
*/
public int insertBatch(@Param("list") List<TYehuaqiUser> list);
/**
* 查询燃气用户列表 - 导出使用
*
* @param tDetectorUser 燃气用户
* @return 燃气用户集合
*/
public List<TYehuaqiUser> selectForExportTYehuaqiUserList(TYehuaqiUser tDetectorUser);
public List<TYehuaqiUser> queryErrorDetectorUserList(String depId);
/**
* 修改燃气用户
*
......
......@@ -4,9 +4,7 @@ import java.util.List;
import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.TYehuaqiUser;
import com.zehong.system.domain.vo.GasUserAndSafetyDeviceVo;
import com.zehong.system.domain.vo.TDetectorUserVO;
import com.zehong.system.domain.vo.TYehuaqiUserVO;
import com.zehong.system.domain.vo.*;
/**
* 燃气用户Service接口
......@@ -39,6 +37,32 @@ public interface ITYehuaqiUserService
* @return r
*/
public int countByBeyondEnterpriseId();
/**
* 处理 解析好的 多sheet 导入的数据
* @param gasUserExportVos g
* @param safetyDeviceExportVos s
*/
public void handleCustomMoreSheetImportData(List<UserManageGasUserExportVo> gasUserExportVos,
List<YeHuaqiUserManageSafetyDeviceExportVo> safetyDeviceExportVos,
boolean updateSupport ,boolean reImportOfIncorrectDataFlag) ;
/**
* 查询燃气用户列表 - 导出使用
*
* @param tDetectorUser 燃气用户
* @return 燃气用户集合
*/
public List<TYehuaqiUser> selectForExportTYehuaqiUserList(TYehuaqiUser tDetectorUser);
/**
* 查询导入的错误数据
* @return r
*/
public List<TYehuaqiUser> queryErrorDetectorUserList();
/**
* 新增燃气用户
*
......
package com.zehong.system.service.impl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.*;
import com.zehong.system.domain.vo.GasUserAndSafetyDeviceVo;
import com.zehong.system.mapper.TYehuaqiDeviceMapper;
import com.zehong.system.mapper.TYehuaqiuserSafetyDeviceInfoMapper;
import com.zehong.system.domain.vo.UserManageGasUserExportVo;
import com.zehong.system.domain.vo.UserManageSafetyDeviceExportVo;
import com.zehong.system.domain.vo.YeHuaqiUserManageSafetyDeviceExportVo;
import com.zehong.system.mapper.*;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TYehuaqiUserMapper;
import com.zehong.system.service.ITYehuaqiUserService;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.sql.DataSource;
/**
* 燃气用户Service业务层处理
*
......@@ -24,13 +36,22 @@ import org.springframework.transaction.annotation.Transactional;
@Service
public class TYehuaqiUserServiceImpl implements ITYehuaqiUserService
{
@Autowired
@Resource
private TYehuaqiUserMapper tYehuaqiUserMapper;
@Autowired
@Resource
private TYehuaqiDeviceMapper tYehuaqiDeviceMapper;
@Autowired
private TYehuaqiuserSafetyDeviceInfoMapper yehuaqiuserSafetyDeviceInfoMapperl;
@Resource
private TYehuaqiuserSafetyDeviceInfoMapper yehuaqiuserSafetyDeviceInfoMapper;
@Resource
private DataSource dataSource;
@Resource
private TEnterpriseInfoMapper tEnterpriseInfoMapper;
@Resource
private TUserManageVillageMapper villageMapper;
/**
* 查询燃气用户
......@@ -145,7 +166,7 @@ public class TYehuaqiUserServiceImpl implements ITYehuaqiUserService
for (TYehuaqiuserSafetyDeviceInfo yehuaqiuserSafetyDeviceInfo : yehuaqiuserSafetyDeviceInfos) {
yehuaqiuserSafetyDeviceInfo.setfRelationUserId(yehuaqiUser.getUserId());;
}
yehuaqiuserSafetyDeviceInfoMapperl.insertBatch(yehuaqiuserSafetyDeviceInfos);
yehuaqiuserSafetyDeviceInfoMapper.insertBatch(yehuaqiuserSafetyDeviceInfos);
}
return 1;
}
......@@ -169,10 +190,209 @@ public class TYehuaqiUserServiceImpl implements ITYehuaqiUserService
}
}
yehuaqiuserSafetyDeviceInfoMapperl.deleteYehuaqiuserSafetyDeviceInfoUserId(yehuaqiUser.getUserId());
yehuaqiuserSafetyDeviceInfoMapper.deleteYehuaqiuserSafetyDeviceInfoUserId(yehuaqiUser.getUserId());
if (yehuaqiuserSafetyDeviceInfos != null && yehuaqiuserSafetyDeviceInfos.size() > 0) {
yehuaqiuserSafetyDeviceInfoMapperl.insertBatch(yehuaqiuserSafetyDeviceInfos);
yehuaqiuserSafetyDeviceInfoMapper.insertBatch(yehuaqiuserSafetyDeviceInfos);
}
return 1;
}
/**
* 查询燃气用户列表 - 导出使用
*
* @param yehuaqiUser 液化气用户
* @return 燃气用户集合
*/
@Override
public List<TYehuaqiUser> selectForExportTYehuaqiUserList(TYehuaqiUser yehuaqiUser) {
return tYehuaqiUserMapper.selectForExportTYehuaqiUserList(yehuaqiUser);
}
/**
* 处理解析好的 自定义模版的导入的数据 多sheet
* @param gasUserExportVos d 燃气用户数据
* @param safetyDeviceExportVos s 安全装置信息
* @param reImportOfIncorrectDataFlag r 错误数据重新导入标志 true 表示错误数据重新导入
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void handleCustomMoreSheetImportData(List<UserManageGasUserExportVo> gasUserExportVos,
List<YeHuaqiUserManageSafetyDeviceExportVo> safetyDeviceExportVos,
boolean updateSupport,boolean reImportOfIncorrectDataFlag) {
List<TYehuaqiUser> successDataList = new ArrayList<>();
List<TYehuaqiUser> errorDataList = new ArrayList<>();
// 安全装置 按照 用户自由id 分组
Map<String, List<YeHuaqiUserManageSafetyDeviceExportVo>> safetyDeviceList = null;
if (gasUserExportVos.size() > 0) {
if (safetyDeviceExportVos != null && safetyDeviceExportVos.size() > 0) {
safetyDeviceList = safetyDeviceExportVos.stream().collect(Collectors.groupingBy(YeHuaqiUserManageSafetyDeviceExportVo::getUserOwnId));
}
TYehuaqiUser tYehuaqiUser;
StringBuilder stringBuilder = new StringBuilder();
for (UserManageGasUserExportVo gasUserExportVo : gasUserExportVos) {
String userOwnId = gasUserExportVo.getUserOwnId();
String userType = gasUserExportVo.getUserType();
String beyondEnterpriseName = gasUserExportVo.getBeyondEnterpriseName();
String villageName = gasUserExportVo.getVillageName();
if(!reImportOfIncorrectDataFlag) {
if (StringUtils.isBlank(userOwnId)) {
stringBuilder.append("用户自由id为空|");
}
}
if ((StringUtils.isNotBlank(userType))){
if (!"1".equals(userType) && !"2".equals(userType)&& !"3".equals(userType)&& !"4".equals(userType)) {
stringBuilder.append("用户类型数据没按提示录入|");
}
}
if (StringUtils.isBlank(beyondEnterpriseName)) {
stringBuilder.append("所属企业为空|");
} else {
List<TEnterpriseInfo> tEnterpriseInfos = tEnterpriseInfoMapper.selectTEnterpriseInfoByName(beyondEnterpriseName);
if (tEnterpriseInfos != null && tEnterpriseInfos.size() > 0) {
gasUserExportVo.setBeyondEnterpriseId(tEnterpriseInfos.get(0).getEnterpriseId());
} else {
stringBuilder.append("所属企业不存在|");
}
}
if (StringUtils.isBlank(villageName)) {
stringBuilder.append("居住区(村、庄)为空|");
} else {
TUserManageVillage tUserManageVillage = new TUserManageVillage();
tUserManageVillage.setfVillageName(villageName);
List<TUserManageVillage> tUserManageVillages = villageMapper.selectTUserManageVillageList(tUserManageVillage);
if(tUserManageVillages == null || tUserManageVillages.size() == 0) {
stringBuilder.append("居住区(村、庄)不存在|");
} else{
Long aLong = tUserManageVillages.get(0).getfVillageId();
gasUserExportVo.setVillageId(aLong);
}
}
//说明有错误数据
if (StringUtils.isNotBlank(stringBuilder.toString())) {
tYehuaqiUser = new TYehuaqiUser();
BeanUtils.copyProperties(gasUserExportVo, tYehuaqiUser);
tYehuaqiUser.setErrorMsg(stringBuilder.toString());
stringBuilder = new StringBuilder();
errorDataList.add(tYehuaqiUser);
//正确数据
} else {
TYehuaqiUser yehuaqiUser = new TYehuaqiUser();
BeanUtils.copyProperties(gasUserExportVo,yehuaqiUser);
successDataList.add(yehuaqiUser);
}
}
}
//错误数据批量插入错误表
if (errorDataList.size() > 0) {
tYehuaqiUserMapper.insertBatch(errorDataList);
//安全装置的就直接插入
initYehuaqiuserSafetyDeviceInfo(errorDataList, safetyDeviceList);
}
//正确数据插入后 生成id,再关联 安全装置
if(successDataList.size() > 0) {
//成功的数据里面如果有 userId,那说明是要修改的 要做区分
List<TYehuaqiUser> addCollect = successDataList.stream().filter(item -> item.getUserId() == null).collect(Collectors.toList());
if(addCollect.size() > 0) {
tYehuaqiUserMapper.insertBatch(addCollect);
if(safetyDeviceList != null && safetyDeviceList.size() > 0) {
//安全装置的就直接插入
initYehuaqiuserSafetyDeviceInfo(addCollect, safetyDeviceList);
}
}
//是要修改的
List<TYehuaqiUser> updateCollect = successDataList.stream().filter(item -> item.getUserId() != null).collect(Collectors.toList());
if (updateCollect.size() > 0 && reImportOfIncorrectDataFlag) {
String sql = "UPDATE t_yehuaqi_user \n" +
"SET nick_name = ?,\n" +
"user_type = ?,\n" +
"f_village_id = ?,\n" +
"beyond_enterprise_id = ?,\n" +
"address = ?,\n" +
"linkman = ?,\n" +
"phone = ?,\n" +
"remarks = ?,\n" +
"error_msg = ? \n" +
"WHERE\n" +
"\tuser_id = ?";
try (Connection conn = dataSource.getConnection()) {
PreparedStatement pstmt = conn.prepareStatement(sql);
for (TYehuaqiUser yehuaqiUser : updateCollect) {
pstmt.setString(1,yehuaqiUser.getNickName());
pstmt.setString(2,yehuaqiUser.getUserType());
pstmt.setLong(3,yehuaqiUser.getVillageId());
pstmt.setString(4,yehuaqiUser.getBeyondEnterpriseId());
pstmt.setString(5,yehuaqiUser.getAddress());
pstmt.setString(6,yehuaqiUser.getLinkman());
pstmt.setString(7,yehuaqiUser.getPhone());
pstmt.setString(8,yehuaqiUser.getRemarks());
pstmt.setString(9,null);
pstmt.setLong(10,yehuaqiUser.getUserId());
pstmt.addBatch();
}
pstmt.executeBatch();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
/**
* 导入 单独处理 安全装置
* @param list
*/
private void initYehuaqiuserSafetyDeviceInfo(List<TYehuaqiUser> list, Map<String, List<YeHuaqiUserManageSafetyDeviceExportVo>> listMap) {
List<TYehuaqiuserSafetyDeviceInfo> gasuserSafetyDeviceInfoList = new ArrayList<>();
//正确的 和 错误的 都是先出入 后 再统一处理 安全装置。
for (TYehuaqiUser yehuaqiUser : list) {
String userOwnId = yehuaqiUser.getUserOwnId();
List<YeHuaqiUserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVos = listMap.get(userOwnId);
if (userManageSafetyDeviceExportVos != null && userManageSafetyDeviceExportVos.size() > 0) {
TYehuaqiuserSafetyDeviceInfo yehuaqiuserSafetyDeviceInfo;
for (YeHuaqiUserManageSafetyDeviceExportVo userManageSafetyDeviceExportVo : userManageSafetyDeviceExportVos) {
yehuaqiuserSafetyDeviceInfo = new TYehuaqiuserSafetyDeviceInfo();
BeanUtils.copyProperties(userManageSafetyDeviceExportVo, yehuaqiuserSafetyDeviceInfo);
yehuaqiuserSafetyDeviceInfo.setfRelationUserId(yehuaqiUser.getUserId());
gasuserSafetyDeviceInfoList.add(yehuaqiuserSafetyDeviceInfo);
}
}
}
if (gasuserSafetyDeviceInfoList.size() > 0) {
yehuaqiuserSafetyDeviceInfoMapper.insertBatch(gasuserSafetyDeviceInfoList);
}
}
/**
* 查询导入的错误数据
* @return r
*/
@Override
public List<TYehuaqiUser> queryErrorDetectorUserList() {
LoginUser loginUser = SecurityUtils.getLoginUser();
String deptId = loginUser.getUser().getDeptId();
return tYehuaqiUserMapper.queryErrorDetectorUserList(deptId);
}
}
......@@ -33,7 +33,7 @@ public class TYehuaqiuserSafetyDeviceInfoServiceImpl implements ITYehuaqiuserSaf
@Override
public List<TYehuaqiuserSafetyDeviceInfo> queryDeviceInfoByUserId(Long userId) {
return null;
return tYehuaqiuserSafetyDeviceInfoMapper.queryDeviceInfoByUserId(userId);
}
/**
......
......@@ -22,9 +22,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remarks" column="remarks" />
<result property="deviceNum" column="deviceNum" />
<result property="zxnum" column="zxnum" />
<result property="beyondEnterpriseName" column="enterprise_name" />
<result property="beyondEnterpriseName" column="beyond_enterprise_name" />
<result property="villageId" column="f_village_id" />
<result property="villageName" column="f_village_name" />
<result property="villageName" column="village_name" />
<result property="errorMsg" column="error_msg" />
</resultMap>
......@@ -46,25 +46,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remarks" column="remarks" />
<result property="deviceNum" column="deviceNum" />
<result property="zxnum" column="zxnum" />
<result property="beyondEnterpriseName" column="enterprise_name" />
<result property="beyondEnterpriseName" column="beyond_enterprise_name" />
<result property="villageId" column="f_village_id" />
<result property="villageName" column="f_village_name" />
<result property="villageName" column="village_name" />
<result property="errorMsg" column="error_msg" />
<!-- collection 是用于建立一对多中集合属性的对应关系
ofType 用于指定集合元素的数据类型
-->
<collection property="userManageSafetyDeviceExportVos" ofType="UserManageSafetyDeviceExportVo">
<collection property="userManageSafetyDeviceExportVos" ofType="YeHuaqiUserManageSafetyDeviceExportVo">
<id property="userOwnId" column="user_id"/>
<result property="relationDeviceType" column="f_relation_device_type"/>
<result property="deviceName" column="f_device_name"/>
<result property="deviceModel" column="f_device_model"/>
<result property="fRelationDeviceType" column="f_relation_device_type"/>
<result property="fDeviceName" column="f_device_name"/>
<result property="fDeviceModel" column="f_device_model"/>
<result property="fIotNo" column="f_iot_no"/>
<result property="detectionMedium" column="f_detection_medium"/>
<result property="deviceInstallTime" column="f_device_install_time"/>
<result property="deviceInstallPosition" column="f_device_install_position"/>
<result property="head" column="f_head"/>
<result property="phone" column="f_phone"/>
<result property="fDetectionMedium" column="f_detection_medium"/>
<result property="fDeviceInstallTime" column="f_device_install_time"/>
<result property="fDeviceInstallPosition" column="f_device_install_position"/>
<result property="fHead" column="f_head"/>
<result property="fPhone" column="f_phone"/>
</collection>
</resultMap>
......@@ -88,7 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(CASE a.user_type WHEN '1' THEN '居民用户' WHEN '2' THEN '工商业用户' WHEN '4' THEN '餐饮单位用户'end) as user_type ,
'液化气' as gas_type ,
a.address, a.longitude, a.latitude, a.linkman, a.phone, a.email, a.create_time, a.update_time, a.is_del, a.remarks,
b.enterprise_name,a.f_village_id,v.f_village_name
b.enterprise_name as beyond_enterprise_name,a.f_village_id,v.f_village_name as village_name
from t_yehuaqi_user a left join t_enterprise_info b on a.beyond_enterprise_id=b.enterprise_id
left join t_user_manage_village v on a.f_village_id=v.f_village_id
<where> a.is_del = '0' and a.error_msg is null
......@@ -120,7 +120,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectTYehuaqiUserVo"/>
where user_id = #{userId}
</select>
<select id="queryErrorDetectorUserList" parameterType="string" resultMap="TYehuaqiUserResult">
select * from t_yehuaqi_user where error_msg is not null
<if test="depId != null and depId != '' and depId != '-2'">
and beyondEnterpriseId = #{depId}
</if>
</select>
<select id="selectForExportTYehuaqiUserList" parameterType="TYehuaqiUser" resultMap="TYehuaqiUserExportResult">
select a.user_id,
a.username,
a.nick_name,
(CASE a.user_type WHEN '1' THEN '居民用户' WHEN '2' THEN '工商业用户' WHEN '4' THEN '餐饮单位用户'end) as user_type ,
a.address, a.longitude, a.latitude, a.linkman, a.phone, a.email, a.create_time, a.update_time, a.is_del, a.remarks,
b.enterprise_name as beyond_enterprise_name,a.f_village_id,v.f_village_name as village_name,
deviceInfo.f_relation_device_type,
deviceInfo.f_device_name,
deviceInfo.f_device_model,
deviceInfo.f_iot_no,
deviceInfo.f_detection_medium,
deviceInfo.f_device_install_time,
deviceInfo.f_device_install_position,
deviceInfo.f_head,
deviceInfo.f_phone
from t_yehuaqi_user a left join t_enterprise_info b on a.beyond_enterprise_id=b.enterprise_id
left join t_user_manage_village v on a.f_village_id=v.f_village_id
left join t_yehuaqiuser_safety_device_info deviceInfo on a.user_id = deviceInfo.f_relation_user_id
<where> a.is_del = '0' and a.error_msg is null
<if test="beyondEnterpriseId != null and beyondEnterpriseId != -2"> and a.beyond_enterprise_id =#{beyondEnterpriseId}</if>
<if test="username != null and username != ''"> and a.username like concat('%', #{username}, '%')</if>
<if test="nickName != null and nickName != ''"> and (a.nick_name like concat('%', #{nickName}, '%') or a.username like concat('%', #{nickName}, '%'))</if>
</where>
order by a.user_id desc
</select>
<insert id="insertBatch" 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)
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}
)
</foreach>
</insert>
<insert id="insertTYehuaqiUser" parameterType="TYehuaqiUser" useGeneratedKeys="true" keyProperty="userId">
insert into t_yehuaqi_user
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -138,6 +188,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if>
<if test="villageId != null">f_village_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="username != null">#{username},</if>
......@@ -154,6 +205,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if>
<if test="villageId != null">#{villageId},</if>
</trim>
</insert>
......@@ -174,6 +226,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="remarks != null">remarks = #{remarks},</if>
<if test="villageId != null">f_village_id = #{villageId},</if>
</trim>
where user_id = #{userId}
</update>
......
......@@ -45,9 +45,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where f_safety_device_id = #{fSafetyDeviceId}
</select>
<select id="queryDeviceInfoByUserId" parameterType="Long" resultMap="TYehuaqiuserSafetyDeviceInfoResult">
<include refid="selectTYehuaqiuserSafetyDeviceInfoVo"/>
where fRelationUserId = #{userId}
where f_relation_user_id = #{userId}
</select>
<insert id="insertTYehuaqiuserSafetyDeviceInfo" parameterType="TYehuaqiuserSafetyDeviceInfo" useGeneratedKeys="true" keyProperty="fSafetyDeviceId">
......
......@@ -96,9 +96,8 @@ export function deleteSafetyDeviceListInfo(data) {
// 删除关联设备信息
export function deleteSafetyDeviceInfo(deviceId) {
return request({
url: '/gasUserSafetyDevice/info/deleteSafetyDeviceInfo',
method: 'delete',
data:deviceId
url: '/yehuaqiUserSafetyDeviceInfo/info/deleteTYehuaqiuserSafetyDeviceInfoById/' + deviceId,
method: 'delete'
})
}
......
......@@ -248,16 +248,16 @@
</el-row>
</div>
<el-table v-loading="loadings" ref="multipleTable" :data="DetailInfoList" tooltip-effect="dark" style="width: 100%" max-height="250">
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="设备型号" align="center" prop="deviceModel" />
<el-table-column label="设备类型" align="center" prop="relationDeviceType" />
<el-table v-loading="loadings" ref="multipleTable" :data="detailInfoList" tooltip-effect="dark" style="width: 100%" max-height="250">
<el-table-column label="设备名称" align="center" prop="fDeviceName" />
<el-table-column label="设备型号" align="center" prop="fDeviceModel" />
<el-table-column label="设备类型" align="center" prop="fRelationDeviceType" />
<el-table-column label="物联网编号" width="85" align="center" prop="fIotNo" />
<el-table-column label="探测介质" align="center" prop="detectionMedium" />
<el-table-column label="设备安装时间" width="100" align="center" prop="deviceInstallTime" />
<el-table-column label="安装位置" align="center" prop="deviceInstallPosition" />
<el-table-column label="负责人" align="center" prop="head" />
<el-table-column label="联系电话" align="center" prop="phone" />
<el-table-column label="探测介质" align="center" prop="fDetectionMedium" />
<el-table-column label="设备安装时间" width="100" align="center" prop="fDeviceInstallTime" />
<el-table-column label="安装位置" align="center" prop="fDeviceInstallPosition" />
<el-table-column label="负责人" align="center" prop="fHead" />
<el-table-column label="联系电话" align="center" prop="fPhone" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
......@@ -283,22 +283,22 @@
<el-row>
<el-col :span="11">
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model="formDetailInfo.deviceName" placeholder="请输入设备名称" autocomplete="off"></el-input>
<el-form-item label="设备名称" prop="fDeviceName">
<el-input v-model="formDetailInfo.fDeviceName" placeholder="请输入设备名称" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="设备型号" prop="deviceModel">
<el-input v-model="formDetailInfo.deviceModel" placeholder="请输入设备型号" />
<el-form-item label="设备型号" prop="fDeviceModel">
<el-input v-model="formDetailInfo.fDeviceModel" placeholder="请输入设备型号" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="设备类型" prop="relationDeviceType">
<el-input v-model="formDetailInfo.relationDeviceType" placeholder="请输入设备类型">
<el-form-item label="设备类型" prop="fRelationDeviceType">
<el-input v-model="formDetailInfo.fRelationDeviceType" placeholder="请输入设备类型">
</el-input>
</el-form-item>
</el-col>
......@@ -312,9 +312,9 @@
<el-row>
<el-col :span="11">
<el-form-item label="设备安装时间" prop="deviceInstallTime">
<el-form-item label="设备安装时间" prop="fDeviceInstallTime">
<el-date-picker clearable size="small"
v-model="formDetailInfo.deviceInstallTime"
v-model="formDetailInfo.fDeviceInstallTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择安装时间">
......@@ -323,31 +323,31 @@
</el-col>
<el-col :span="11">
<el-form-item label="安装位置" prop="deviceInstallPosition" >
<el-input v-model="formDetailInfo.deviceInstallPosition" placeholder="请输入安装位置" />
<el-form-item label="安装位置" prop="fDeviceInstallPosition" >
<el-input v-model="formDetailInfo.fDeviceInstallPosition" placeholder="请输入安装位置" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="负责人" prop="head">
<el-input v-model="formDetailInfo.head" placeholder="请输入负责人">
<el-form-item label="负责人" prop="fHead">
<el-input v-model="formDetailInfo.fHead" placeholder="请输入负责人">
</el-input>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="联系电话" prop="phone" >
<el-input v-model="formDetailInfo.phone" placeholder="请输入联系电话" />
<el-form-item label="联系电话" prop="fPhone" >
<el-input v-model="formDetailInfo.fPhone" placeholder="请输入联系电话" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="22">
<el-form-item label="探测介质" prop="detectionMedium" >
<el-input v-model="formDetailInfo.detectionMedium" placeholder="请输入探测介质" />
<el-form-item label="探测介质" prop="fDetectionMedium" >
<el-input v-model="formDetailInfo.fDetectionMedium" placeholder="请输入探测介质" />
</el-form-item>
</el-col>
</el-row>
......@@ -392,17 +392,18 @@
<el-divider v-if="this.importError > 0 " content-position="left">错误数据导出分隔</el-divider>
<br>
<el-badge v-if="this.importError > 0 " :value="importError" class="item">
<el-button
<el-button
type="danger"
icon="el-icon-download"
size="small"
@click="handleImportError"
v-if="this.importError > 0 "
>
<span>下载导入时错误数据</span>
下载导入时错误数据
</el-button>
<el-badge v-if="this.importError > 0 " :value="importError" class="item">
</el-badge>
</div>
</el-upload>
......@@ -456,7 +457,7 @@ export default {
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/supervise/user/moreSheetImportExcel" // todo
url: process.env.VUE_APP_BASE_API + "/system/yehuaqiUser/moreSheetImportExcel" // todo
},
importError: null,
......@@ -470,7 +471,7 @@ export default {
//存储已被选中的下级数据id
DetailInfoListId :[],
//存储已经选中的下级关联数据
DetailInfoList:[],
detailInfoList:[],
/*添加关联设备*/
formDetailInfo:{
gasUserSafetyDeviceId:'',
......@@ -634,7 +635,7 @@ export default {
downloadElement.href = href;
downloadElement.download = '气用户数据'+'.xlsx'; //下载后文件名
downloadElement.download = '液化气用户数据'+'.xlsx'; //下载后文件名
document.body.appendChild(downloadElement);
......@@ -662,7 +663,7 @@ export default {
downloadElement.href = href;
downloadElement.download = '气用户导入错误数据'+'.xlsx'; //下载后文件名
downloadElement.download = '液化气用户导入错误数据'+'.xlsx'; //下载后文件名
document.body.appendChild(downloadElement);
......@@ -708,7 +709,7 @@ export default {
},
handleImport(){
this.upload.title = "气用户导入"; // todo
this.upload.title = "液化气用户导入"; // todo
this.upload.open = true;
},
......@@ -724,7 +725,7 @@ export default {
downloadElement.href = href;
downloadElement.download = '气用户导入模版'+'.xlsx'; //下载后文件名
downloadElement.download = '液化气用户导入模版'+'.xlsx'; //下载后文件名
document.body.appendChild(downloadElement);
......@@ -767,15 +768,15 @@ export default {
/**关联设备已经选中数据删除方法*/
deleteDataListilInfo(row,index){
const deviceIds = row.gasUserSafetyDeviceId;
const deviceIds = row.fSafetyDeviceId;
//判断form表单是否有id来验证是修改的删除还是添加的删除
if (this.form.userId != null) {
deleteSafetyDeviceInfo(deviceIds).then(response => {
this.msgSuccess("删除成功");
this.DetailInfoList.splice(index,1);
this.detailInfoList.splice(index,1);
});
}else {
this.DetailInfoList.splice(index,1);
this.detailInfoList.splice(index,1);
this.msgSuccess("删除成功");
}
......@@ -831,7 +832,8 @@ export default {
},
/**添加关联设备与设备绑定的数据 (存储到数组中)*/
insertListDetailInfo(){
this.DetailInfoList.push(this.formDetailInfo);
console.log("this.detailInfoList" + this);
this.detailInfoList.push(this.formDetailInfo);
//数据表单重置
this.formDetailInfo={
......@@ -984,7 +986,7 @@ export default {
this.reset();
this.devicePos = [];
//清空关联设备数据
this.DetailInfoList=[]
this.detailInfoList=[]
this.open = true;
this.title = "添加燃气用户";
},
......@@ -1011,7 +1013,10 @@ export default {
//查询关联设备信息数据
queryDeviceInfoByUserId(userId).then(response => {
this.DetailInfoList = response.data;
console.log("this.detailInfoList before = " + this.detailInfoList);
this.detailInfoList = response.data;
console.log("this.detailInfoList after = " + this.detailInfoList);
this.loadings = false;
});
},
......@@ -1031,7 +1036,7 @@ export default {
var tDeviceInfon={
yehuaqiUser:this.form,
yehuaqiuserSafetyDeviceInfos:this.DetailInfoList
yehuaqiuserSafetyDeviceInfos:this.detailInfoList
}
updateUserAndSafetyDevice(JSON.stringify(tDeviceInfon)).then(response => {
this.msgSuccess("修改成功");
......@@ -1042,7 +1047,7 @@ export default {
var tDeviceInfon={
yehuaqiUser:this.form,
yehuaqiuserSafetyDeviceInfos:this.DetailInfoList
yehuaqiuserSafetyDeviceInfos:this.detailInfoList
}
addUserAndSafetyDevice(JSON.stringify(tDeviceInfon)).then(response => {
......@@ -1127,14 +1132,10 @@ export default {
padding: 0 15px;
transform: translateX(-50%) translateY(-50%);
}
.el-badge__content.is-fixed {
top: 0 !important;
right: 5px !important;
}
.mb9 {
left: -60px;
bottom: 8px;
}
</style>
\ No newline at end of file
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