Commit 87d1d614 authored by wanghao's avatar wanghao

1 燃气用户界面 加入 导入功能 ,实现 两个sheet的导入,已完成 数据的入库和错误数据的维护。

2 燃气用户界面 错误数据导出 再导入功能实现中。
parent d22771fd
......@@ -14,6 +14,7 @@ import com.zehong.system.domain.vo.UserManageGasUserExportVo;
import com.zehong.system.domain.vo.GasUserAndSafetyDeviceVo;
import com.zehong.system.domain.vo.TDetectorUserInspectVo;
import com.zehong.system.domain.vo.UserManageSafetyDeviceExportVo;
import com.zehong.system.service.ITDetectorUserErrorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.core.io.ClassPathResource;
......@@ -57,6 +58,9 @@ public class TDetectorUserController extends BaseController
@Autowired
Environment environment;
@Autowired
private ITDetectorUserErrorService detectorUserErrorService;
/**
* 查询燃气用户列表
*/
......@@ -288,6 +292,67 @@ public class TDetectorUserController extends BaseController
return AjaxResult.success(message);
}
/**
* 自定义-模版下载-带有错误数据
* @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<TDetectorUser> tDetectorUsers = tDetectorUserService.queryErrorDetectorUserList();
// 获取文件名
String filename = file.getName();
// 获取文件后缀名
String ext = filename.substring(filename.lastIndexOf(".") + 1).toLowerCase();
// 将文件写入输入流
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
......@@ -363,9 +428,9 @@ public class TDetectorUserController extends BaseController
/**
* 自定义模版的多sheet导入
* @param file
* @return
* @throws Exception
* @param file f
* @return r
* @throws Exception e
*/
@PostMapping("/moreSheetImportExcel")
public AjaxResult moreSheetImportExcel(MultipartFile file,boolean updateSupport) throws Exception {
......@@ -377,4 +442,25 @@ public class TDetectorUserController extends BaseController
tDetectorUserService.handleCustomMoreSheetImportData(userManageGasUserobjects,userManageSafetyobjects,updateSupport);
return AjaxResult.success();
}
/**
* 查询当前用户导入 燃气用户错误的数据
* @return i
*/
@GetMapping("/countImportError")
public AjaxResult countImportError()
{
int i = tDetectorUserService.countByBeyondEnterpriseId();
return AjaxResult.success(i);
}
/**
* 清除当前用户导入 燃气用户错误的数据
*/
@Log(title = "燃气用户错误导入记录", businessType = BusinessType.EXPORT)
@GetMapping("/clearImportError")
public AjaxResult clearImportError()
{
return AjaxResult.success(tDetectorUserService.clearImportErrorByEnterpriseId());
}
}
......@@ -23,6 +23,11 @@ public class TDetectorUser extends BaseEntity
/** 用户id */
private Long userId;
/**
* 用户自有id - 新版本导入时使用,别的地方不用
*/
private String userOwnId;
/** 用户账号 */
private String username;
......@@ -70,6 +75,8 @@ public class TDetectorUser extends BaseEntity
@Excel(name = "备注")
private String remarks;
private String errorMsg;
/**
* 所属企业名称
*/
......@@ -316,6 +323,22 @@ public class TDetectorUser extends BaseEntity
this.villageName = villageName;
}
public String getUserOwnId() {
return userOwnId;
}
public void setUserOwnId(String userOwnId) {
this.userOwnId = userOwnId;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
@Override
public String toString() {
return "TDetectorUser{" +
......
package com.zehong.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 燃气用户错误导入记录对象 t_detector_user_error
*
* @author zehong
* @date 2024-08-30
*/
public class TDetectorUserError extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 用户id */
private Long userId;
/** 用户名称 */
@Excel(name = "用户名称")
private String nickName;
/** 权属单位名称 */
@Excel(name = "权属单位名称")
private String beyondEnterpriseName;
/**
* 导入数据的企业
*/
private String beyondEnterpriseId;
/** 用户类型(1居民用户,2商业用户,3工业用户,4餐饮单位用户) */
@Excel(name = "用户类型", readConverterExp = "1=居民用户,2商业用户,3工业用户,4餐饮单位用户")
private String userType;
/** 燃气类型(0-天然气,1-液化气) */
@Excel(name = "燃气类型(0-天然气,1-液化气)")
private String gasType;
/** 居住区(村、庄)名称 */
@Excel(name = "居住区(村、庄)名称")
private String villageName;
/** 地址 */
@Excel(name = "地址")
private String address;
/** 联系人 */
@Excel(name = "联系人")
private String linkman;
/** 电话 */
@Excel(name = "电话")
private String phone;
/** 备注 */
@Excel(name = "备注")
private String remarks;
/** 错误信息 */
@Excel(name = "错误信息")
private String errorMsg;
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setNickName(String nickName)
{
this.nickName = nickName;
}
public String getNickName()
{
return nickName;
}
public void setBeyondEnterpriseName(String beyondEnterpriseName)
{
this.beyondEnterpriseName = beyondEnterpriseName;
}
public String getBeyondEnterpriseName()
{
return beyondEnterpriseName;
}
public void setUserType(String userType)
{
this.userType = userType;
}
public String getUserType()
{
return userType;
}
public void setGasType(String gasType)
{
this.gasType = gasType;
}
public String getGasType()
{
return gasType;
}
public void setVillageName(String villageName)
{
this.villageName = villageName;
}
public String getVillageName()
{
return villageName;
}
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
{
return address;
}
public void setLinkman(String linkman)
{
this.linkman = linkman;
}
public String getLinkman()
{
return linkman;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
{
return remarks;
}
public void setErrorMsg(String errorMsg)
{
this.errorMsg = errorMsg;
}
public String getErrorMsg()
{
return errorMsg;
}
public String getBeyondEnterpriseId() {
return beyondEnterpriseId;
}
public void setBeyondEnterpriseId(String beyondEnterpriseId) {
this.beyondEnterpriseId = beyondEnterpriseId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("nickName", getNickName())
.append("beyondEnterpriseName", getBeyondEnterpriseName())
.append("userType", getUserType())
.append("gasType", getGasType())
.append("villageName", getVillageName())
.append("address", getAddress())
.append("linkman", getLinkman())
.append("phone", getPhone())
.append("remarks", getRemarks())
.append("errorMsg", getErrorMsg())
.toString();
}
}
......@@ -8,6 +8,10 @@ public class UserManageGasUserExportVo {
@Excel(name = "用户自有编号", needMerge = true)
private String userOwnId;
/** id */
@Excel(name = "id/此列内容不允许修改")
private Long userId;
/** 用户名称 */
@Excel(name = "用户名称", needMerge = true)
private String nickName;
......@@ -22,15 +26,22 @@ public class UserManageGasUserExportVo {
/**
* 所属企业名称
*/
@Excel(name = "所属单位", needMerge = true)
@Excel(name = "所属企业", needMerge = true)
private String beyondEnterpriseName;
private String beyondEnterpriseId;
/**
* 居住区(村、庄)
*/
@Excel(name = "居住区(村、庄)", needMerge = true)
private String villageName;
/**
* 居住区村庄id
*/
private Long villageId;
/** 地址 */
@Excel(name = "地址", needMerge = true)
private String address;
......@@ -126,4 +137,28 @@ public class UserManageGasUserExportVo {
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public Long getVillageId() {
return villageId;
}
public void setVillageId(Long villageId) {
this.villageId = villageId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBeyondEnterpriseId() {
return beyondEnterpriseId;
}
public void setBeyondEnterpriseId(String beyondEnterpriseId) {
this.beyondEnterpriseId = beyondEnterpriseId;
}
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TDetectorUserError;
import org.apache.ibatis.annotations.Param;
/**
* 燃气用户错误导入记录Mapper接口
*
* @author zehong
* @date 2024-08-30
*/
public interface TDetectorUserErrorMapper
{
/**
* 查询燃气用户错误导入记录
*
* @param userId 燃气用户错误导入记录ID
* @return 燃气用户错误导入记录
*/
public TDetectorUserError selectTDetectorUserErrorById(Long userId);
/**
* 查询燃气用户错误导入记录列表
*
* @param tDetectorUserError 燃气用户错误导入记录
* @return 燃气用户错误导入记录集合
*/
public List<TDetectorUserError> selectTDetectorUserErrorList(TDetectorUserError tDetectorUserError);
/**
* 新增燃气用户错误导入记录
*
* @param tDetectorUserError 燃气用户错误导入记录
* @return 结果
*/
public int insertTDetectorUserError(TDetectorUserError tDetectorUserError);
public int insertBatch(@Param("list") List<TDetectorUserError> list);
/**
* 修改燃气用户错误导入记录
*
* @param tDetectorUserError 燃气用户错误导入记录
* @return 结果
*/
public int updateTDetectorUserError(TDetectorUserError tDetectorUserError);
/**
* 删除燃气用户错误导入记录
*
* @param userId 燃气用户错误导入记录ID
* @return 结果
*/
public int deleteTDetectorUserErrorById(Long userId);
/**
* 批量删除燃气用户错误导入记录
*
* @param userIds 需要删除的数据ID
* @return 结果
*/
public int deleteTDetectorUserErrorByIds(Long[] userIds);
/**
* 根据企业id 统计错误数量
* @param beyondEnterpriseId id
* @return r
*/
public int countByBeyondEnterpriseId(String beyondEnterpriseId);
/**
* 根据企业id 清除错误数量
* @param beyondEnterpriseId id
* @return r
*/
public int clearByBeyondEnterpriseId(String beyondEnterpriseId);
}
......@@ -3,11 +3,11 @@ package com.zehong.system.mapper;
import java.util.List;
import java.util.Map;
import com.zehong.system.domain.TDetectorInfo;
import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.TDetectorUserCount;
import com.zehong.system.domain.vo.TDetectorUserInspectVo;
import com.zehong.system.domain.vo.TDetectorUserVO;
import org.apache.ibatis.annotations.Param;
/**
* 燃气用户Mapper接口
......@@ -70,6 +70,8 @@ public interface TDetectorUserMapper
*/
public List<TDetectorUser> newSelectTDetectorUserList(TDetectorUser tDetectorUser);
public List<TDetectorUser> queryErrorDetectorUserList(String depId);
public List<TDetectorUser> selectTDetectorListstatus(TDetectorUser tDetectorUser);
/**
......@@ -80,6 +82,22 @@ public interface TDetectorUserMapper
*/
public int insertTDetectorUser(TDetectorUser tDetectorUser);
/**
* 批量增加
* @param list list
* @return r
*/
public int insertBatch(@Param("list") List<TDetectorUser> list);
/**
* 批量修改
* @param list l
* @return r
*/
public int updateBatch(@Param("list") List<TDetectorUser> list);
/**
* 修改燃气用户
*
......@@ -122,4 +140,21 @@ public interface TDetectorUserMapper
* @return
*/
List<TDetectorUserInspectVo> getDetectorUserInspectInfo(TDetectorUserInspectVo inspectVo);
/**
* 根据企业id 统计错误数量
* @param beyondEnterpriseId id
* @return r
*/
public int countByBeyondEnterpriseId(String beyondEnterpriseId);
/**
* 根据企业id 清除错误数量
* @param beyondEnterpriseId id
* @return r
*/
public int clearByBeyondEnterpriseId(String beyondEnterpriseId);
}
......@@ -44,6 +44,14 @@ public interface TGasuserSafetyDeviceInfoMapper
*/
public int insertTGasuserSafetyDeviceInfo(TGasuserSafetyDeviceInfo tGasuserSafetyDeviceInfo);
/**
* 批量增加
* @param list list
* @return r
*/
public int insertBatch(@Param("list") List<TGasuserSafetyDeviceInfo> list);
/**
* 修改用户管理-燃气用户-安全装置加装维护
*
......
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TDetectorUserError;
/**
* 燃气用户错误导入记录Service接口
*
* @author zehong
* @date 2024-08-30
*/
public interface ITDetectorUserErrorService
{
/**
* 查询燃气用户错误导入记录
*
* @param userId 燃气用户错误导入记录ID
* @return 燃气用户错误导入记录
*/
public TDetectorUserError selectTDetectorUserErrorById(Long userId);
/**
* 查询燃气用户错误导入记录列表
*
* @param tDetectorUserError 燃气用户错误导入记录
* @return 燃气用户错误导入记录集合
*/
public List<TDetectorUserError> selectTDetectorUserErrorList(TDetectorUserError tDetectorUserError);
/**
* 新增燃气用户错误导入记录
*
* @param tDetectorUserError 燃气用户错误导入记录
* @return 结果
*/
public int insertTDetectorUserError(TDetectorUserError tDetectorUserError);
/**
* 修改燃气用户错误导入记录
*
* @param tDetectorUserError 燃气用户错误导入记录
* @return 结果
*/
public int updateTDetectorUserError(TDetectorUserError tDetectorUserError);
/**
* 批量删除燃气用户错误导入记录
*
* @param userIds 需要删除的燃气用户错误导入记录ID
* @return 结果
*/
public int deleteTDetectorUserErrorByIds(Long[] userIds);
/**
* 删除燃气用户错误导入记录信息
*
* @param userId 燃气用户错误导入记录ID
* @return 结果
*/
public int deleteTDetectorUserErrorById(Long userId);
/**
* 根据企业id统计错误数据
* @return r
*/
public int countByBeyondEnterpriseId();
/**
* 根据企业id 清除数据
* @return r
*/
public int clearImportErrorByEnterpriseId();
}
......@@ -86,6 +86,12 @@ public interface ITDetectorUserService
*/
public List<TDetectorUser> selectTDetectorUserList(TDetectorUser tDetectorUser);
/**
* 查询导入的错误数据
* @return r
*/
public List<TDetectorUser> queryErrorDetectorUserList();
/**
* 查询燃气用户列表
*
......@@ -187,4 +193,17 @@ public interface ITDetectorUserService
public void handleCustomMoreSheetImportData(List<UserManageGasUserExportVo> gasUserExportVos,
List<UserManageSafetyDeviceExportVo> safetyDeviceExportVos,
boolean updateSupport ) ;
/**
* 根据企业id统计错误数据
* @return r
*/
public int countByBeyondEnterpriseId();
/**
* 根据企业id 清除数据
* @return r
*/
public int clearImportErrorByEnterpriseId();
}
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TDetectorUserErrorMapper;
import com.zehong.system.domain.TDetectorUserError;
import com.zehong.system.service.ITDetectorUserErrorService;
/**
* 燃气用户错误导入记录Service业务层处理
*
* @author zehong
* @date 2024-08-30
*/
@Service
public class TDetectorUserErrorServiceImpl implements ITDetectorUserErrorService
{
@Autowired
private TDetectorUserErrorMapper tDetectorUserErrorMapper;
/**
* 查询燃气用户错误导入记录
*
* @param userId 燃气用户错误导入记录ID
* @return 燃气用户错误导入记录
*/
@Override
public TDetectorUserError selectTDetectorUserErrorById(Long userId)
{
return tDetectorUserErrorMapper.selectTDetectorUserErrorById(userId);
}
/**
* 查询燃气用户错误导入记录列表
*
* @param tDetectorUserError 燃气用户错误导入记录
* @return 燃气用户错误导入记录
*/
@Override
public List<TDetectorUserError> selectTDetectorUserErrorList(TDetectorUserError tDetectorUserError)
{
return tDetectorUserErrorMapper.selectTDetectorUserErrorList(tDetectorUserError);
}
/**
* 新增燃气用户错误导入记录
*
* @param tDetectorUserError 燃气用户错误导入记录
* @return 结果
*/
@Override
public int insertTDetectorUserError(TDetectorUserError tDetectorUserError)
{
return tDetectorUserErrorMapper.insertTDetectorUserError(tDetectorUserError);
}
/**
* 修改燃气用户错误导入记录
*
* @param tDetectorUserError 燃气用户错误导入记录
* @return 结果
*/
@Override
public int updateTDetectorUserError(TDetectorUserError tDetectorUserError)
{
return tDetectorUserErrorMapper.updateTDetectorUserError(tDetectorUserError);
}
/**
* 批量删除燃气用户错误导入记录
*
* @param userIds 需要删除的燃气用户错误导入记录ID
* @return 结果
*/
@Override
public int deleteTDetectorUserErrorByIds(Long[] userIds)
{
return tDetectorUserErrorMapper.deleteTDetectorUserErrorByIds(userIds);
}
/**
* 删除燃气用户错误导入记录信息
*
* @param userId 燃气用户错误导入记录ID
* @return 结果
*/
@Override
public int deleteTDetectorUserErrorById(Long userId)
{
return tDetectorUserErrorMapper.deleteTDetectorUserErrorById(userId);
}
/**
* 根据企业id统计错误数据
* @return r
*/
@Override
public int countByBeyondEnterpriseId() {
LoginUser loginUser = SecurityUtils.getLoginUser();
String deptId = loginUser.getUser().getDeptId();
return tDetectorUserErrorMapper.countByBeyondEnterpriseId(deptId);
}
/**
* 根据企业id 清除数据
* @return r
*/
@Override
public int clearImportErrorByEnterpriseId() {
LoginUser loginUser = SecurityUtils.getLoginUser();
String deptId = loginUser.getUser().getDeptId();
return tDetectorUserErrorMapper.clearByBeyondEnterpriseId(deptId);
}
}
......@@ -6,19 +6,17 @@ 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.system.domain.TDetectorUserCount;
import com.zehong.system.domain.TGasuserSafetyDeviceInfo;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.*;
import com.zehong.system.domain.vo.*;
import com.zehong.system.mapper.TDeviceInfoMapper;
import com.zehong.system.mapper.TGasuserSafetyDeviceInfoMapper;
import com.zehong.system.mapper.TSiteStationInfoMapper;
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.TDetectorUserMapper;
import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.service.ITDetectorUserService;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
......@@ -32,15 +30,22 @@ import javax.servlet.http.HttpServletResponse;
@Service
public class TDetectorUserServiceImpl implements ITDetectorUserService
{
@Autowired
@Resource
private TDetectorUserMapper tDetectorUserMapper;
@Autowired
@Resource
private TDeviceInfoMapper tDeviceInfoMapper;
@Autowired
@Resource
private TSiteStationInfoMapper tSiteStationInfoMapper;
@Resource
private TGasuserSafetyDeviceInfoMapper gasuserSafetyDeviceInfoMapper;
@Resource
private TEnterpriseInfoMapper tEnterpriseInfoMapper;
@Resource
private TUserManageVillageMapper villageMapper;
@Resource
private TDetectorUserErrorMapper tDetectorUserErrorMapper;
/**
* 查询探测器用户列表
......@@ -269,6 +274,19 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
return tDetectorUserMapper.selectTDetectorUserList(tDetectorUser);
}
/**
* 查询导入的错误数据
* @return r
*/
@Override
public List<TDetectorUser> queryErrorDetectorUserList() {
LoginUser loginUser = SecurityUtils.getLoginUser();
String deptId = loginUser.getUser().getDeptId();
return tDetectorUserMapper.queryErrorDetectorUserList(deptId);
}
/**
* 查询燃气用户列表-new
*
......@@ -430,19 +448,163 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
/**
* 处理解析好的 自定义模版的导入的数据 多sheet
* @param gasUserExportVos d
* @param safetyDeviceExportVos s
* @param gasUserExportVos d 燃气用户数据
* @param safetyDeviceExportVos s 安全装置信息
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void handleCustomMoreSheetImportData(List<UserManageGasUserExportVo> gasUserExportVos,
List<UserManageSafetyDeviceExportVo> safetyDeviceExportVos,
boolean updateSupport) {
List<TDetectorUser> successDataList = new ArrayList<>();
List<TDetectorUser> errorDataList = new ArrayList<>();
// 安全装置 按照 用户自由id 分组
Map<String, List<UserManageSafetyDeviceExportVo>> safetyDeviceList = null;
if (gasUserExportVos.size() > 0) {
if (safetyDeviceExportVos != null && safetyDeviceExportVos.size() > 0) {
safetyDeviceList = safetyDeviceExportVos.stream().collect(Collectors.groupingBy(UserManageSafetyDeviceExportVo::getUserOwnId));
}
TDetectorUser tDetectorUserError;
StringBuilder stringBuilder = new StringBuilder();
for (UserManageGasUserExportVo gasUserExportVo : gasUserExportVos) {
System.out.println(gasUserExportVo.getAddress());
String userOwnId = gasUserExportVo.getUserOwnId();
String gasType = gasUserExportVo.getGasType();
String userType = gasUserExportVo.getUserType();
String beyondEnterpriseName = gasUserExportVo.getBeyondEnterpriseName();
String villageName = gasUserExportVo.getVillageName();
if (StringUtils.isBlank(userOwnId)) {
stringBuilder.append("用户自由id为空|");
}
if (StringUtils.isNotBlank(gasType)){
if (!"0".equals(gasType) && !"1".equals(gasType)) {
stringBuilder.append("燃气类型数据没按提示录入|");
}
}
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 {
TEnterpriseInfo tEnterpriseInfo = tEnterpriseInfoMapper.selectTEnterpriseInfoByName(beyondEnterpriseName);
if (tEnterpriseInfo == null) {
stringBuilder.append("所属企业不存在|");
} else {
gasUserExportVo.setBeyondEnterpriseId(tEnterpriseInfo.getEnterpriseId());
}
}
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())) {
tDetectorUserError = new TDetectorUser();
BeanUtils.copyProperties(gasUserExportVo, tDetectorUserError);
tDetectorUserError.setErrorMsg(stringBuilder.toString());
stringBuilder = new StringBuilder();
errorDataList.add(tDetectorUserError);
//正确数据
} else {
TDetectorUser detectorUser = new TDetectorUser();
BeanUtils.copyProperties(gasUserExportVo,detectorUser);
successDataList.add(detectorUser);
}
}
}
for (UserManageSafetyDeviceExportVo safetyDeviceExportVo : safetyDeviceExportVos) {
System.out.println(safetyDeviceExportVo.getDeviceModel());
//错误数据批量插入错误表
if (errorDataList.size() > 0) {
tDetectorUserMapper.insertBatch(errorDataList);
}
//正确数据插入后 生成id,再关联 安全装置
if(successDataList.size() > 0) {
//成功的数据里面如果有 userId,那说明是要修改的 要做区分
List<TDetectorUser> addCollect = successDataList.stream().filter(item -> item.getUserId() == null).collect(Collectors.toList());
if(addCollect.size() > 0) {
tDetectorUserMapper.insertBatch(addCollect);
if(safetyDeviceList != null && safetyDeviceList.size() > 0) {
List<TGasuserSafetyDeviceInfo> gasuserSafetyDeviceInfoList = new ArrayList<>();
//正确的 和 错误的 都是先出入 后 再统一处理 安全装置。
if (errorDataList.size() > 0) {
addCollect.addAll(errorDataList);
}
for (TDetectorUser detectorUser : addCollect) {
String userOwnId = detectorUser.getUserOwnId();
List<UserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVos = safetyDeviceList.get(userOwnId);
if (userManageSafetyDeviceExportVos != null && userManageSafetyDeviceExportVos.size() > 0) {
TGasuserSafetyDeviceInfo gasuserSafetyDeviceInfo;
for (UserManageSafetyDeviceExportVo userManageSafetyDeviceExportVo : userManageSafetyDeviceExportVos) {
gasuserSafetyDeviceInfo = new TGasuserSafetyDeviceInfo();
BeanUtils.copyProperties(userManageSafetyDeviceExportVo, gasuserSafetyDeviceInfo);
gasuserSafetyDeviceInfo.setRelationGasuserId(detectorUser.getUserId());
gasuserSafetyDeviceInfoList.add(gasuserSafetyDeviceInfo);
}
}
}
if (gasuserSafetyDeviceInfoList.size() > 0) {
gasuserSafetyDeviceInfoMapper.insertBatch(gasuserSafetyDeviceInfoList);
}
}
}
//是要修改的
List<TDetectorUser> updateCollect = successDataList.stream().filter(item -> item.getUserId() != null).collect(Collectors.toList());
if (updateCollect.size() > 0) {
tDetectorUserMapper.updateBatch(updateCollect);
}
}
}
/**
* 根据企业id统计错误数据
* @return r
*/
@Override
public int countByBeyondEnterpriseId() {
LoginUser loginUser = SecurityUtils.getLoginUser();
String deptId = loginUser.getUser().getDeptId();
return tDetectorUserMapper.countByBeyondEnterpriseId(deptId);
}
/**
* 根据企业id 清除数据
* @return r
*/
@Override
public int clearImportErrorByEnterpriseId() {
LoginUser loginUser = SecurityUtils.getLoginUser();
String deptId = loginUser.getUser().getDeptId();
return tDetectorUserMapper.clearByBeyondEnterpriseId(deptId);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TDetectorUserErrorMapper">
<resultMap type="TDetectorUserError" id="TDetectorUserErrorResult">
<result property="userId" column="user_id" />
<result property="nickName" column="nick_name" />
<result property="beyondEnterpriseName" column="beyond_enterprise_name" />
<result property="beyondEnterpriseId" column="beyond_enterprise_id" />
<result property="userType" column="user_type" />
<result property="gasType" column="gas_type" />
<result property="villageName" column="village_name" />
<result property="address" column="address" />
<result property="linkman" column="linkman" />
<result property="phone" column="phone" />
<result property="remarks" column="remarks" />
<result property="errorMsg" column="error_msg" />
</resultMap>
<sql id="selectTDetectorUserErrorVo">
select user_id, nick_name, beyond_enterprise_name, beyond_enterprise_id,user_type, gas_type, village_name, address, linkman, phone, remarks, error_msg from t_detector_user_error
</sql>
<select id="selectTDetectorUserErrorList" parameterType="TDetectorUserError" resultMap="TDetectorUserErrorResult">
<include refid="selectTDetectorUserErrorVo"/>
<where>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
<if test="beyondEnterpriseName != null and beyondEnterpriseName != ''"> and beyond_enterprise_name like concat('%', #{beyondEnterpriseName}, '%')</if>
<if test="beyondEnterpriseId != null and beyondEnterpriseId != '' and beyondEnterpriseId != '-2'"> and beyond_enterprise_id = #{beyondEnterpriseId}</if>
<if test="userType != null and userType != ''"> and user_type = #{userType}</if>
<if test="gasType != null and gasType != ''"> and gas_type = #{gasType}</if>
<if test="villageName != null and villageName != ''"> and village_name like concat('%', #{villageName}, '%')</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="linkman != null and linkman != ''"> and linkman = #{linkman}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
<if test="errorMsg != null and errorMsg != ''"> and error_msg = #{errorMsg}</if>
</where>
</select>
<select id="selectTDetectorUserErrorById" parameterType="Long" resultMap="TDetectorUserErrorResult">
<include refid="selectTDetectorUserErrorVo"/>
where user_id = #{userId}
</select>
<insert id="insertTDetectorUserError" parameterType="TDetectorUserError" useGeneratedKeys="true" keyProperty="userId">
insert into t_detector_user_error
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="nickName != null">nick_name,</if>
<if test="beyondEnterpriseName != null">beyond_enterprise_name,</if>
<if test="beyondEnterpriseId != null">beyond_enterprise_id,</if>
<if test="userType != null">user_type,</if>
<if test="gasType != null">gas_type,</if>
<if test="villageName != null">village_name,</if>
<if test="address != null">address,</if>
<if test="linkman != null">linkman,</if>
<if test="phone != null">phone,</if>
<if test="remarks != null">remarks,</if>
<if test="errorMsg != null">error_msg,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="nickName != null">#{nickName},</if>
<if test="beyondEnterpriseName != null">#{beyondEnterpriseName},</if>
<if test="beyondEnterpriseId != null">#{beyondEnterpriseId},</if>
<if test="userType != null">#{userType},</if>
<if test="gasType != null">#{gasType},</if>
<if test="villageName != null">#{villageName},</if>
<if test="address != null">#{address},</if>
<if test="linkman != null">#{linkman},</if>
<if test="phone != null">#{phone},</if>
<if test="remarks != null">#{remarks},</if>
<if test="errorMsg != null">#{errorMsg},</if>
</trim>
</insert>
<insert id="insertBatch" parameterType="list">
insert into t_detector_user_error (nick_name, beyond_enterprise_name, user_type, gas_type, village_name,
address, linkman, phone, remarks, error_msg)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.nickName,jdbcType=VARCHAR}, #{item.beyondEnterpriseName,jdbcType=VARCHAR},
#{item.userType,jdbcType=VARCHAR}, #{item.gasType,jdbcType=VARCHAR}, #{item.villageName,jdbcType=VARCHAR},
#{item.address,jdbcType=DECIMAL}, #{item.linkman,jdbcType=DECIMAL}, #{item.phone,jdbcType=VARCHAR},
#{item.remarks,jdbcType=VARCHAR}, #{item.errorMsg,jdbcType=TIMESTAMP}
)
</foreach>
</insert>
<update id="updateTDetectorUserError" parameterType="TDetectorUserError">
update t_detector_user_error
<trim prefix="SET" suffixOverrides=",">
<if test="nickName != null">nick_name = #{nickName},</if>
<if test="beyondEnterpriseName != null">beyond_enterprise_name = #{beyondEnterpriseName},</if>
<if test="userType != null">user_type = #{userType},</if>
<if test="gasType != null">gas_type = #{gasType},</if>
<if test="villageName != null">village_name = #{villageName},</if>
<if test="address != null">address = #{address},</if>
<if test="linkman != null">linkman = #{linkman},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="remarks != null">remarks = #{remarks},</if>
<if test="errorMsg != null">error_msg = #{errorMsg},</if>
</trim>
where user_id = #{userId}
</update>
<delete id="deleteTDetectorUserErrorById" parameterType="Long">
delete from t_detector_user_error where user_id = #{userId}
</delete>
<delete id="deleteTDetectorUserErrorByIds" parameterType="String">
delete from t_detector_user_error where user_id in
<foreach item="userId" collection="array" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<select id="countByBeyondEnterpriseId" parameterType="String" resultType="int">
select count(*) from t_detector_user_error
<where>
<if test="beyondEnterpriseId != null and beyondEnterpriseId != '' and beyondEnterpriseId != '-2'">
beyond_enterprise_id = #{beyondEnterpriseId}
</if>
</where>
</select>
<delete id="clearByBeyondEnterpriseId" parameterType="String">
delete from t_detector_user_error
<where>
<if test="beyondEnterpriseId != null and beyondEnterpriseId != '' and beyondEnterpriseId != '-2'">
beyond_enterprise_id = #{beyondEnterpriseId}
</if>
</where>
</delete>
</mapper>
\ No newline at end of file
......@@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="beyondEnterpriseName" column="enterprise_name" />
<result property="villageId" column="f_village_id" />
<result property="villageName" column="f_village_name" />
<result property="errorMsg" column="error_msg" />
</resultMap>
<resultMap type="TDetectorUserInspectVo" id="TDetectorUserInspectResult">
......@@ -42,9 +43,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectTDetectorUserVo">
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 from t_detector_user
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
</sql>
<select id="queryErrorDetectorUserList" parameterType="string" resultMap="TDetectorUserResult">
select * from t_detector_user where error_msg is not null
<if test="depId != null and depId != '' and depId != '-2'">
and beyondEnterpriseId = #{depId}
</if>
</select>
<select id="selectTDetectorUserList" parameterType="TDetectorUser" resultMap="TDetectorUserResult">
select a.user_id,
a.username,
......@@ -55,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.enterprise_name,a.f_village_id,v.f_village_name
from t_detector_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'
<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>
......@@ -85,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.enterprise_name,a.f_village_id,v.f_village_name
from t_detector_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'
<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>
......@@ -117,7 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE task_id = #{taskId} GROUP BY receive_id) t1
LEFT JOIN t_work_task_inspect t ON t1.inId = t.inspect_id
) inspect ON inspect.receive_id = a.user_id
<where> a.is_del = '0'
<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>
......@@ -131,7 +140,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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
from t_detector_user a left join t_enterprise_info b on a.beyond_enterprise_id=b.enterprise_id
<where>
<where> a.error_msg is null
<if test="isDel != null and isDel != ''"> and a.is_del = #{isDel}</if>
<if test="username != null and username != ''"> and a.username = #{username}</if>
<if test="nickName != null and nickName != ''"> and a.nick_name = #{nickName}</if>
......@@ -144,7 +153,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select a.user_id, a.beyond_enterprise_id,a.username, a.nick_name, a.user_type,a.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
from t_detector_user a left join t_enterprise_info b on a.beyond_enterprise_id=b.enterprise_id
where a.user_id = #{userId}
where a.user_id = #{userId} and a.error_msg is null
</select>
<select id="countTDetectorUserForMassMarks" resultType="TDetectorUserVO" parameterType="TDetectorUser">
......@@ -190,7 +199,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a2.detector_type,
a2.detector_status FROM t_detector_user a1
LEFT JOIN t_detector_info a2 ON a1.user_id = a2.user_id AND a2.is_del = '0'
<where> a1.is_del = '0'
<where> a1.is_del = '0' and a1.error_msg is null
<if test="userId != null and userId != ''"> and a1.user_id = #{userId}</if>
</where>) a
group by a.user_id,a.detector_type
......@@ -205,7 +214,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from t_detector_report_data b1
left join t_detector_info b2 on b1.detector_code = b2.detector_code
right join t_detector_user b3 on b2.user_id = b3.user_id
<where> b2.is_del = '0' and b3.is_del = '0'
<where> b2.is_del = '0' and b3.is_del = '0' and b2.error_msg is null
<if test="userId != null and userId != ''"> and b3.user_id = #{userId}</if>
</where>) b
group by b.user_id,b.detector_type
......@@ -217,7 +226,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select a2.user_id as userId
from t_detector_info a1
right join t_detector_user a2 on a1.user_id = a2.user_id
where a1.is_del = '0' and a2.is_del = '0' and a1.detector_status = '2'
where a1.is_del = '0' and a2.is_del = '0' and a1.detector_status = '2' and a1.error_msg is null
</select>
<insert id="insertTDetectorUser" parameterType="TDetectorUser" useGeneratedKeys="true" keyProperty="userId">
......@@ -237,6 +246,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if>
<if test="villageId != null">f_village_id,</if>
<if test="errorMsg != null">error_msg,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="username != null">#{username},</if>
......@@ -253,8 +263,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if>
<if test="villageId != null">#{villageId},</if>
<if test="errorMsg != null">#{errorMsg},</if>
</trim>
</insert>
<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,
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.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}
)
</foreach>
</insert>
<update id="updateBatch" parameterType="list">
<foreach collection="list" item="item" separator=";">
UPDATE t_detector_user
SET nick_name = #{item.nickName},
user_type = #{item.userType},
gas_type = #{item.gasType},
f_village_id = #{item.villageId},
beyond_enterprise_id = #{item.beyondEnterpriseId},
address = #{item.address},
linkman = #{item.linkman},
phone = #{item.phone},
remarks = #{item.remarks}
WHERE user_id = #{item.userId}
</foreach>
</update>
<update id="updateTDetectorUser" parameterType="TDetectorUser">
update t_detector_user
......@@ -348,7 +391,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE task.inspect_id = last.inspect_id
)recent ON a.user_id = recent.receive_id
LEFT JOIN t_line_patrol_person person ON person.person_id = recent.member_id
<where> a.is_del = '0'
<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}, '%')</if>
......@@ -374,4 +417,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
ORDER BY a.create_time DESC
</select>
<select id="countByBeyondEnterpriseId" parameterType="String" resultType="int">
select count(*) from t_detector_user where error_msg is not null
<if test="beyondEnterpriseId != null and beyondEnterpriseId != '' and beyondEnterpriseId != '-2'">
beyond_enterprise_id = #{beyondEnterpriseId}
</if>
</select>
<delete id="clearByBeyondEnterpriseId" parameterType="String">
delete from t_detector_user where error_msg is not null
<if test="beyondEnterpriseId != null and beyondEnterpriseId != '' and beyondEnterpriseId != '-2'">
beyond_enterprise_id = #{beyondEnterpriseId}
</if>
</delete>
</mapper>
......@@ -93,6 +93,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<insert id="insertBatch" parameterType="list">
insert into t_gasuser_safety_device_info (f_relation_gasUser_id, f_relation_device_type, f_device_name,
f_device_model, f_iot_no,f_detection_medium, f_device_install_time,
f_device_install_position,f_head,f_phone)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.relationGasuserId}, #{item.relationDeviceType,jdbcType=VARCHAR},
#{item.deviceName,jdbcType=VARCHAR}, #{item.deviceModel,jdbcType=VARCHAR}, #{item.fIotNo,jdbcType=VARCHAR},
#{item.detectionMedium,jdbcType=DECIMAL}, #{item.deviceInstallTime,jdbcType=DECIMAL},
#{item.deviceInstallPosition,jdbcType=VARCHAR},#{item.head,jdbcType=VARCHAR}, #{item.phone,jdbcType=TIMESTAMP}
)
</foreach>
</insert>
<update id="updateTGasuserSafetyDeviceInfo" parameterType="TGasuserSafetyDeviceInfo">
update t_gasuser_safety_device_info
<trim prefix="SET" suffixOverrides=",">
......
......@@ -149,3 +149,20 @@ export function downloadTemplate() {
responseType: 'blob'
})
}
// 统计错误数量
export function countImportError() {
return request({
url: '/supervise/user/countImportError',
method: 'get'
})
}
// 清除错误数据
export function clearImportError() {
return request({
url: '/supervise/user/clearImportError',
method: 'get'
})
}
......@@ -74,6 +74,20 @@
@click="handleImport">导入</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-download"
size="mini"
@click="handleImportError"
class="button-with-badge"
>
<span>下载导入时错误数据</span>
<span class="badge" v-if="importError !== 0">{{importError}}</span>
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
......@@ -506,6 +520,17 @@
</div>
</el-dialog>
<!-- 燃气用户错误数据弹出框 -->
<el-dialog :title="importErrorShowTitle" :visible.sync="importErrorShow" width="400px" append-to-body>
<el-form>
<el-form-item>
<div style="width: 100%; text-align: center;">
<el-button type="primary" @click="downloadImportError">下载</el-button>
<el-button type="danger" @click="clearImportErrorMethod">清除错误数据</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
......@@ -514,7 +539,8 @@
import { listUser, getUser, delUser, addUser, updateUser,newExportUser,
getNoSelectSafetyDetailInfo,addSafetyDetailInfo,deleteSafetyDeviceInfo,
deleteSafetyDeviceListInfo,selectSafetyDeviceDetailInfo,
addUserAndSafetyDevice,updateUserAndSafetyDevice,importTemplate,downloadTemplate} from "@/api/regulation/user";
addUserAndSafetyDevice,updateUserAndSafetyDevice,importTemplate,downloadTemplate,
countImportError,clearImportError} from "@/api/regulation/user";
import { selectTEnterprise} from "@/api/regulation/supervise";
import { noPageListVillage} from "@/api/regulation/userManagement/village";
import GetPos from '@/components/GetPos';
......@@ -541,6 +567,10 @@ export default {
url: process.env.VUE_APP_BASE_API + "/supervise/user/moreSheetImportExcel" // todo
},
importError: null,
importErrorShow: false,
importErrorShowTitle: "选择下载错误数据或者是清除错误数据",
relationImg: require('@/assets/project/relation.png'),
//下拉框数据
test:{},
......@@ -680,9 +710,42 @@ export default {
this.gasTypeOpers = response.data;
});
this.getNoPageListVillage();
this.countImportError();
},
methods: {
// 下载燃气用户错误 按钮
downloadImportError() {
// importErrorexportInfo().then(response => {
// this.download(response.msg);
// })
this.importErrorShow = false;
},
// 清除 燃气用户错误 数据
clearImportErrorMethod() {
this.$confirm('是否确认删除导入的燃气用户错误数据?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return clearImportError();
}).then(() => {
this.importErrorShow = false;
this.msgSuccess("删除成功");
this.importError = 0
}).catch(() => {});
},
//查询 导入错误数据
countImportError() {
countImportError().then(response => {
this.importError = response.data;
})
},
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit();
......@@ -731,7 +794,7 @@ export default {
this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.getDataList();
// this.countImportError();
this.countImportError();
// //导入后 刷新 任职岗位字典数据
// this.peopleOccupationOptions = [];
......
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