Commit 87d1d614 authored by wanghao's avatar wanghao

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

2 燃气用户界面 错误数据导出 再导入功能实现中。
parent d22771fd
...@@ -14,6 +14,7 @@ import com.zehong.system.domain.vo.UserManageGasUserExportVo; ...@@ -14,6 +14,7 @@ import com.zehong.system.domain.vo.UserManageGasUserExportVo;
import com.zehong.system.domain.vo.GasUserAndSafetyDeviceVo; import com.zehong.system.domain.vo.GasUserAndSafetyDeviceVo;
import com.zehong.system.domain.vo.TDetectorUserInspectVo; import com.zehong.system.domain.vo.TDetectorUserInspectVo;
import com.zehong.system.domain.vo.UserManageSafetyDeviceExportVo; import com.zehong.system.domain.vo.UserManageSafetyDeviceExportVo;
import com.zehong.system.service.ITDetectorUserErrorService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
...@@ -57,6 +58,9 @@ public class TDetectorUserController extends BaseController ...@@ -57,6 +58,9 @@ public class TDetectorUserController extends BaseController
@Autowired @Autowired
Environment environment; Environment environment;
@Autowired
private ITDetectorUserErrorService detectorUserErrorService;
/** /**
* 查询燃气用户列表 * 查询燃气用户列表
*/ */
...@@ -288,6 +292,67 @@ public class TDetectorUserController extends BaseController ...@@ -288,6 +292,67 @@ public class TDetectorUserController extends BaseController
return AjaxResult.success(message); 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 * @param response r
...@@ -363,9 +428,9 @@ public class TDetectorUserController extends BaseController ...@@ -363,9 +428,9 @@ public class TDetectorUserController extends BaseController
/** /**
* 自定义模版的多sheet导入 * 自定义模版的多sheet导入
* @param file * @param file f
* @return * @return r
* @throws Exception * @throws Exception e
*/ */
@PostMapping("/moreSheetImportExcel") @PostMapping("/moreSheetImportExcel")
public AjaxResult moreSheetImportExcel(MultipartFile file,boolean updateSupport) throws Exception { public AjaxResult moreSheetImportExcel(MultipartFile file,boolean updateSupport) throws Exception {
...@@ -377,4 +442,25 @@ public class TDetectorUserController extends BaseController ...@@ -377,4 +442,25 @@ public class TDetectorUserController extends BaseController
tDetectorUserService.handleCustomMoreSheetImportData(userManageGasUserobjects,userManageSafetyobjects,updateSupport); tDetectorUserService.handleCustomMoreSheetImportData(userManageGasUserobjects,userManageSafetyobjects,updateSupport);
return AjaxResult.success(); 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 ...@@ -23,6 +23,11 @@ public class TDetectorUser extends BaseEntity
/** 用户id */ /** 用户id */
private Long userId; private Long userId;
/**
* 用户自有id - 新版本导入时使用,别的地方不用
*/
private String userOwnId;
/** 用户账号 */ /** 用户账号 */
private String username; private String username;
...@@ -70,6 +75,8 @@ public class TDetectorUser extends BaseEntity ...@@ -70,6 +75,8 @@ public class TDetectorUser extends BaseEntity
@Excel(name = "备注") @Excel(name = "备注")
private String remarks; private String remarks;
private String errorMsg;
/** /**
* 所属企业名称 * 所属企业名称
*/ */
...@@ -316,6 +323,22 @@ public class TDetectorUser extends BaseEntity ...@@ -316,6 +323,22 @@ public class TDetectorUser extends BaseEntity
this.villageName = villageName; 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 @Override
public String toString() { public String toString() {
return "TDetectorUser{" + 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 { ...@@ -8,6 +8,10 @@ public class UserManageGasUserExportVo {
@Excel(name = "用户自有编号", needMerge = true) @Excel(name = "用户自有编号", needMerge = true)
private String userOwnId; private String userOwnId;
/** id */
@Excel(name = "id/此列内容不允许修改")
private Long userId;
/** 用户名称 */ /** 用户名称 */
@Excel(name = "用户名称", needMerge = true) @Excel(name = "用户名称", needMerge = true)
private String nickName; private String nickName;
...@@ -22,15 +26,22 @@ public class UserManageGasUserExportVo { ...@@ -22,15 +26,22 @@ public class UserManageGasUserExportVo {
/** /**
* 所属企业名称 * 所属企业名称
*/ */
@Excel(name = "所属单位", needMerge = true) @Excel(name = "所属企业", needMerge = true)
private String beyondEnterpriseName; private String beyondEnterpriseName;
private String beyondEnterpriseId;
/** /**
* 居住区(村、庄) * 居住区(村、庄)
*/ */
@Excel(name = "居住区(村、庄)", needMerge = true) @Excel(name = "居住区(村、庄)", needMerge = true)
private String villageName; private String villageName;
/**
* 居住区村庄id
*/
private Long villageId;
/** 地址 */ /** 地址 */
@Excel(name = "地址", needMerge = true) @Excel(name = "地址", needMerge = true)
private String address; private String address;
...@@ -126,4 +137,28 @@ public class UserManageGasUserExportVo { ...@@ -126,4 +137,28 @@ public class UserManageGasUserExportVo {
public void setRemarks(String remarks) { public void setRemarks(String remarks) {
this.remarks = 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; ...@@ -3,11 +3,11 @@ package com.zehong.system.mapper;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.zehong.system.domain.TDetectorInfo;
import com.zehong.system.domain.TDetectorUser; import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.TDetectorUserCount; import com.zehong.system.domain.TDetectorUserCount;
import com.zehong.system.domain.vo.TDetectorUserInspectVo; import com.zehong.system.domain.vo.TDetectorUserInspectVo;
import com.zehong.system.domain.vo.TDetectorUserVO; import com.zehong.system.domain.vo.TDetectorUserVO;
import org.apache.ibatis.annotations.Param;
/** /**
* 燃气用户Mapper接口 * 燃气用户Mapper接口
...@@ -70,6 +70,8 @@ public interface TDetectorUserMapper ...@@ -70,6 +70,8 @@ public interface TDetectorUserMapper
*/ */
public List<TDetectorUser> newSelectTDetectorUserList(TDetectorUser tDetectorUser); public List<TDetectorUser> newSelectTDetectorUserList(TDetectorUser tDetectorUser);
public List<TDetectorUser> queryErrorDetectorUserList(String depId);
public List<TDetectorUser> selectTDetectorListstatus(TDetectorUser tDetectorUser); public List<TDetectorUser> selectTDetectorListstatus(TDetectorUser tDetectorUser);
/** /**
...@@ -80,6 +82,22 @@ public interface TDetectorUserMapper ...@@ -80,6 +82,22 @@ public interface TDetectorUserMapper
*/ */
public int insertTDetectorUser(TDetectorUser tDetectorUser); 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 ...@@ -122,4 +140,21 @@ public interface TDetectorUserMapper
* @return * @return
*/ */
List<TDetectorUserInspectVo> getDetectorUserInspectInfo(TDetectorUserInspectVo inspectVo); 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 ...@@ -44,6 +44,14 @@ public interface TGasuserSafetyDeviceInfoMapper
*/ */
public int insertTGasuserSafetyDeviceInfo(TGasuserSafetyDeviceInfo tGasuserSafetyDeviceInfo); 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 ...@@ -86,6 +86,12 @@ public interface ITDetectorUserService
*/ */
public List<TDetectorUser> selectTDetectorUserList(TDetectorUser tDetectorUser); public List<TDetectorUser> selectTDetectorUserList(TDetectorUser tDetectorUser);
/**
* 查询导入的错误数据
* @return r
*/
public List<TDetectorUser> queryErrorDetectorUserList();
/** /**
* 查询燃气用户列表 * 查询燃气用户列表
* *
...@@ -187,4 +193,17 @@ public interface ITDetectorUserService ...@@ -187,4 +193,17 @@ public interface ITDetectorUserService
public void handleCustomMoreSheetImportData(List<UserManageGasUserExportVo> gasUserExportVos, public void handleCustomMoreSheetImportData(List<UserManageGasUserExportVo> gasUserExportVos,
List<UserManageSafetyDeviceExportVo> safetyDeviceExportVos, List<UserManageSafetyDeviceExportVo> safetyDeviceExportVos,
boolean updateSupport ) ; 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);
}
}
<?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
...@@ -93,6 +93,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -93,6 +93,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
</insert> </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 id="updateTGasuserSafetyDeviceInfo" parameterType="TGasuserSafetyDeviceInfo">
update t_gasuser_safety_device_info update t_gasuser_safety_device_info
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
......
...@@ -148,4 +148,21 @@ export function downloadTemplate() { ...@@ -148,4 +148,21 @@ export function downloadTemplate() {
method: 'get', method: 'get',
responseType: 'blob' responseType: 'blob'
}) })
} }
\ No newline at end of file
// 统计错误数量
export function countImportError() {
return request({
url: '/supervise/user/countImportError',
method: 'get'
})
}
// 清除错误数据
export function clearImportError() {
return request({
url: '/supervise/user/clearImportError',
method: 'get'
})
}
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