Commit 23d69d1a authored by wanghao's avatar wanghao

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

parent 90e65fbb
package com.zehong.web.controller.lpgRegulation;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TYehuaqiuserSafetyDeviceInfo;
import com.zehong.system.service.ITYehuaqiuserSafetyDeviceInfoService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 液化石油气监管-液化气用户-安全装置加装维护Controller
*
* @author zehong
* @date 2024-09-09
*/
@RestController
@RequestMapping("/yehuaqiUserSafetyDeviceInfo/info")
public class TYehuaqiuserSafetyDeviceInfoController extends BaseController
{
@Autowired
private ITYehuaqiuserSafetyDeviceInfoService tYehuaqiuserSafetyDeviceInfoService;
/**
* 查询液化石油气监管-液化气用户-安全装置加装维护列表
*/
@GetMapping("/list")
public TableDataInfo list(TYehuaqiuserSafetyDeviceInfo tYehuaqiuserSafetyDeviceInfo)
{
startPage();
List<TYehuaqiuserSafetyDeviceInfo> list = tYehuaqiuserSafetyDeviceInfoService.selectTYehuaqiuserSafetyDeviceInfoList(tYehuaqiuserSafetyDeviceInfo);
return getDataTable(list);
}
/**
* 根据 燃气用户id 查询集合数据
* @param userId i
*/
@GetMapping("/queryDeviceInfoByUserId/{userId}")
public AjaxResult queryDeviceInfoByUserId(@PathVariable("userId") Long userId){
return AjaxResult.success(tYehuaqiuserSafetyDeviceInfoService.queryDeviceInfoByUserId(userId));
}
/**
* 导出液化石油气监管-液化气用户-安全装置加装维护列表
*/
@Log(title = "液化石油气监管-液化气用户-安全装置加装维护", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TYehuaqiuserSafetyDeviceInfo tYehuaqiuserSafetyDeviceInfo)
{
List<TYehuaqiuserSafetyDeviceInfo> list = tYehuaqiuserSafetyDeviceInfoService.selectTYehuaqiuserSafetyDeviceInfoList(tYehuaqiuserSafetyDeviceInfo);
ExcelUtil<TYehuaqiuserSafetyDeviceInfo> util = new ExcelUtil<TYehuaqiuserSafetyDeviceInfo>(TYehuaqiuserSafetyDeviceInfo.class);
return util.exportExcel(list, "液化石油气监管-液化气用户-安全装置加装维护数据");
}
/**
* 获取液化石油气监管-液化气用户-安全装置加装维护详细信息
*/
@GetMapping(value = "/{fSafetyDeviceId}")
public AjaxResult getInfo(@PathVariable("fSafetyDeviceId") Long fSafetyDeviceId)
{
return AjaxResult.success(tYehuaqiuserSafetyDeviceInfoService.selectTYehuaqiuserSafetyDeviceInfoById(fSafetyDeviceId));
}
/**
* 新增液化石油气监管-液化气用户-安全装置加装维护
*/
@Log(title = "液化石油气监管-液化气用户-安全装置加装维护", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TYehuaqiuserSafetyDeviceInfo tYehuaqiuserSafetyDeviceInfo)
{
return toAjax(tYehuaqiuserSafetyDeviceInfoService.insertTYehuaqiuserSafetyDeviceInfo(tYehuaqiuserSafetyDeviceInfo));
}
/**
* 修改液化石油气监管-液化气用户-安全装置加装维护
*/
@Log(title = "液化石油气监管-液化气用户-安全装置加装维护", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TYehuaqiuserSafetyDeviceInfo tYehuaqiuserSafetyDeviceInfo)
{
return toAjax(tYehuaqiuserSafetyDeviceInfoService.updateTYehuaqiuserSafetyDeviceInfo(tYehuaqiuserSafetyDeviceInfo));
}
/**
* 删除液化石油气监管-液化气用户-安全装置加装维护
*/
@Log(title = "液化石油气监管-液化气用户-安全装置加装维护", businessType = BusinessType.DELETE)
@DeleteMapping("/{fSafetyDeviceIds}")
public AjaxResult remove(@PathVariable Long[] fSafetyDeviceIds)
{
return toAjax(tYehuaqiuserSafetyDeviceInfoService.deleteTYehuaqiuserSafetyDeviceInfoByIds(fSafetyDeviceIds));
}
}
...@@ -17,7 +17,6 @@ import com.zehong.system.domain.vo.UserManageGasUserExportVo; ...@@ -17,7 +17,6 @@ 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.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -63,9 +62,6 @@ public class TDetectorUserController extends BaseController ...@@ -63,9 +62,6 @@ public class TDetectorUserController extends BaseController
@Autowired @Autowired
Environment environment; Environment environment;
@Autowired
private ITDetectorUserErrorService detectorUserErrorService;
/** /**
* 查询燃气用户列表 * 查询燃气用户列表
*/ */
......
...@@ -3,6 +3,7 @@ package com.zehong.web.controller.system; ...@@ -3,6 +3,7 @@ package com.zehong.web.controller.system;
import java.util.List; import java.util.List;
import com.zehong.system.domain.TDetectorUser; import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.vo.GasUserAndSafetyDeviceVo;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -77,6 +78,21 @@ public class TYehuaqiUserController extends BaseController ...@@ -77,6 +78,21 @@ public class TYehuaqiUserController extends BaseController
return toAjax(tYehuaqiUserService.insertTYehuaqiUser(tYehuaqiUser)); return toAjax(tYehuaqiUserService.insertTYehuaqiUser(tYehuaqiUser));
} }
/**
* 新增燃气用户和安全装置
*/
@PostMapping("/addUserAndSafetyDevice")
public AjaxResult addUserAndSafetyDevice(@RequestBody GasUserAndSafetyDeviceVo gasUserAndSafetyDeviceVo) {
return toAjax(tYehuaqiUserService.addUserAndSafetyDevice(gasUserAndSafetyDeviceVo));
}
/**
* 修改燃气用户和安全装置
*/
@PostMapping("/updateUserAndSafetyDevice")
public AjaxResult updateUserAndSafetyDevice(@RequestBody GasUserAndSafetyDeviceVo gasUserAndSafetyDeviceVo) {
return toAjax(tYehuaqiUserService.updateUserAndSafetyDevice(gasUserAndSafetyDeviceVo));
}
/** /**
* 修改燃气用户 * 修改燃气用户
*/ */
...@@ -102,4 +118,16 @@ public class TYehuaqiUserController extends BaseController ...@@ -102,4 +118,16 @@ public class TYehuaqiUserController extends BaseController
List<TYehuaqiUser> list = tYehuaqiUserService.selectAllUserList(tYehuaqiUser); List<TYehuaqiUser> list = tYehuaqiUserService.selectAllUserList(tYehuaqiUser);
return getDataTable(list); return getDataTable(list);
} }
/**
* 查询当前用户导入 燃气用户错误的数据
* @return i
*/
@GetMapping("/countImportError")
public AjaxResult countImportError()
{
int i = tYehuaqiUserService.countByBeyondEnterpriseId();
return AjaxResult.success(i);
}
} }
package com.zehong.system.domain; package com.zehong.system.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
import com.zehong.system.domain.vo.UserManageSafetyDeviceExportVo;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel; import com.zehong.common.annotation.Excel;
...@@ -69,6 +72,54 @@ public class TYehuaqiUser extends BaseEntity ...@@ -69,6 +72,54 @@ public class TYehuaqiUser extends BaseEntity
private Integer zxnum; private Integer zxnum;
/**
* 居住区村庄id
*/
private Long villageId;
/**
* 居住区村庄名称
*/
@Excel(name = "居住区(村、庄)")
private String villageName;
private String errorMsg;
/**
* 所属企业名称
*/
private String beyondEnterpriseName;
/**
* 安全装置集合 导出时使用
*/
private List<UserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVos;
public List<UserManageSafetyDeviceExportVo> getUserManageSafetyDeviceExportVos() {
return userManageSafetyDeviceExportVos;
}
public void setUserManageSafetyDeviceExportVos(List<UserManageSafetyDeviceExportVo> userManageSafetyDeviceExportVos) {
this.userManageSafetyDeviceExportVos = userManageSafetyDeviceExportVos;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public String getBeyondEnterpriseName() {
return beyondEnterpriseName;
}
public void setBeyondEnterpriseName(String beyondEnterpriseName) {
this.beyondEnterpriseName = beyondEnterpriseName;
}
public Integer getZxnum() { public Integer getZxnum() {
return zxnum; return zxnum;
} }
...@@ -203,6 +254,22 @@ public class TYehuaqiUser extends BaseEntity ...@@ -203,6 +254,22 @@ public class TYehuaqiUser extends BaseEntity
return remarks; return remarks;
} }
public Long getVillageId() {
return villageId;
}
public void setVillageId(Long villageId) {
this.villageId = villageId;
}
public String getVillageName() {
return villageName;
}
public void setVillageName(String villageName) {
this.villageName = villageName;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
package com.zehong.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
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_yehuaqiuser_safety_device_info
*
* @author zehong
* @date 2024-09-09
*/
public class TYehuaqiuserSafetyDeviceInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 安全装置ID */
private Long fSafetyDeviceId;
/** 用户管理-燃气用户关联id */
@Excel(name = "用户管理-燃气用户关联id")
private Long fRelationUserId;
/** 关联设备类型 */
@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 = "设备安装时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date fDeviceInstallTime;
/** 安装位置 */
@Excel(name = "安装位置")
private String fDeviceInstallPosition;
/** 负责人 */
@Excel(name = "负责人")
private String fHead;
/** 联系电话 */
@Excel(name = "联系电话")
private String fPhone;
/** 是否删除(0正常,1删除) */
@Excel(name = "是否删除(0正常,1删除)")
private String isDel;
public void setfSafetyDeviceId(Long fSafetyDeviceId)
{
this.fSafetyDeviceId = fSafetyDeviceId;
}
public Long getfSafetyDeviceId()
{
return fSafetyDeviceId;
}
public void setfRelationUserId(Long fRelationUserId)
{
this.fRelationUserId = fRelationUserId;
}
public Long getfRelationUserId()
{
return fRelationUserId;
}
public void setfRelationDeviceType(String fRelationDeviceType)
{
this.fRelationDeviceType = fRelationDeviceType;
}
public String getfRelationDeviceType()
{
return fRelationDeviceType;
}
public void setfDeviceName(String fDeviceName)
{
this.fDeviceName = fDeviceName;
}
public String getfDeviceName()
{
return fDeviceName;
}
public void setfDeviceModel(String fDeviceModel)
{
this.fDeviceModel = fDeviceModel;
}
public String getfDeviceModel()
{
return fDeviceModel;
}
public void setfIotNo(String fIotNo)
{
this.fIotNo = fIotNo;
}
public String getfIotNo()
{
return fIotNo;
}
public void setfDetectionMedium(String fDetectionMedium)
{
this.fDetectionMedium = fDetectionMedium;
}
public String getfDetectionMedium()
{
return fDetectionMedium;
}
public void setfDeviceInstallTime(Date fDeviceInstallTime)
{
this.fDeviceInstallTime = fDeviceInstallTime;
}
public Date getfDeviceInstallTime()
{
return fDeviceInstallTime;
}
public void setfDeviceInstallPosition(String fDeviceInstallPosition)
{
this.fDeviceInstallPosition = fDeviceInstallPosition;
}
public String getfDeviceInstallPosition()
{
return fDeviceInstallPosition;
}
public void setfHead(String fHead)
{
this.fHead = fHead;
}
public String getfHead()
{
return fHead;
}
public void setfPhone(String fPhone)
{
this.fPhone = fPhone;
}
public String getfPhone()
{
return fPhone;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
{
return isDel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("fSafetyDeviceId", getfSafetyDeviceId())
.append("fRelationUserId", getfRelationUserId())
.append("fRelationDeviceType", getfRelationDeviceType())
.append("fDeviceName", getfDeviceName())
.append("fDeviceModel", getfDeviceModel())
.append("fIotNo", getfIotNo())
.append("fDetectionMedium", getfDetectionMedium())
.append("fDeviceInstallTime", getfDeviceInstallTime())
.append("fDeviceInstallPosition", getfDeviceInstallPosition())
.append("fHead", getfHead())
.append("fPhone", getfPhone())
.append("isDel", getIsDel())
.toString();
}
}
...@@ -2,6 +2,8 @@ package com.zehong.system.domain.vo; ...@@ -2,6 +2,8 @@ package com.zehong.system.domain.vo;
import com.zehong.system.domain.TDetectorUser; import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.TGasuserSafetyDeviceInfo; import com.zehong.system.domain.TGasuserSafetyDeviceInfo;
import com.zehong.system.domain.TYehuaqiUser;
import com.zehong.system.domain.TYehuaqiuserSafetyDeviceInfo;
import java.util.List; import java.util.List;
...@@ -26,4 +28,25 @@ public class GasUserAndSafetyDeviceVo { ...@@ -26,4 +28,25 @@ public class GasUserAndSafetyDeviceVo {
public void setGasuserSafetyDeviceInfoList(List<TGasuserSafetyDeviceInfo> gasuserSafetyDeviceInfoList) { public void setGasuserSafetyDeviceInfoList(List<TGasuserSafetyDeviceInfo> gasuserSafetyDeviceInfoList) {
this.gasuserSafetyDeviceInfoList = gasuserSafetyDeviceInfoList; this.gasuserSafetyDeviceInfoList = gasuserSafetyDeviceInfoList;
} }
private TYehuaqiUser yehuaqiUser;
private List<TYehuaqiuserSafetyDeviceInfo> yehuaqiuserSafetyDeviceInfos;
public TYehuaqiUser getYehuaqiUser() {
return yehuaqiUser;
}
public void setYehuaqiUser(TYehuaqiUser yehuaqiUser) {
this.yehuaqiUser = yehuaqiUser;
}
public List<TYehuaqiuserSafetyDeviceInfo> getYehuaqiuserSafetyDeviceInfos() {
return yehuaqiuserSafetyDeviceInfos;
}
public void setYehuaqiuserSafetyDeviceInfos(List<TYehuaqiuserSafetyDeviceInfo> yehuaqiuserSafetyDeviceInfos) {
this.yehuaqiuserSafetyDeviceInfos = yehuaqiuserSafetyDeviceInfos;
}
} }
...@@ -26,7 +26,6 @@ public interface TYehuaqiDeviceMapper ...@@ -26,7 +26,6 @@ public interface TYehuaqiDeviceMapper
* @return 【请填写功能名称】集合 * @return 【请填写功能名称】集合
*/ */
public List<TYehuaqiDevice> selectTYehuaqiDeviceList(TYehuaqiDevice tYehuaqiDevice); public List<TYehuaqiDevice> selectTYehuaqiDeviceList(TYehuaqiDevice tYehuaqiDevice);
/** /**
* 新增【请填写功能名称】 * 新增【请填写功能名称】
* *
......
...@@ -6,6 +6,7 @@ import com.zehong.system.domain.TDetectorUser; ...@@ -6,6 +6,7 @@ import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.TYehuaqiUser; import com.zehong.system.domain.TYehuaqiUser;
import com.zehong.system.domain.vo.TDetectorUserVO; import com.zehong.system.domain.vo.TDetectorUserVO;
import com.zehong.system.domain.vo.TYehuaqiUserVO; import com.zehong.system.domain.vo.TYehuaqiUserVO;
import org.apache.ibatis.annotations.Param;
/** /**
* 燃气用户Mapper接口 * 燃气用户Mapper接口
...@@ -32,6 +33,14 @@ public interface TYehuaqiUserMapper ...@@ -32,6 +33,14 @@ public interface TYehuaqiUserMapper
public List<TYehuaqiUser> selectTYehuaqiUserList(TYehuaqiUser tYehuaqiUser); public List<TYehuaqiUser> selectTYehuaqiUserList(TYehuaqiUser tYehuaqiUser);
public List<TYehuaqiUser> selectTYehuaqiUserListTwo(TYehuaqiUser tYehuaqiUser); public List<TYehuaqiUser> selectTYehuaqiUserListTwo(TYehuaqiUser tYehuaqiUser);
/**
* 根据企业id 统计错误数量
* @param beyondEnterpriseId id
* @return r
*/
public int countByBeyondEnterpriseId(String beyondEnterpriseId);
/** /**
* 新增燃气用户 * 新增燃气用户
* *
......
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TYehuaqiuserSafetyDeviceInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;
/**
* 液化石油气监管-液化气用户-安全装置加装维护Mapper接口
*
* @author zehong
* @date 2024-09-09
*/
public interface TYehuaqiuserSafetyDeviceInfoMapper
{
/**
* 查询液化石油气监管-液化气用户-安全装置加装维护
*
* @param fSafetyDeviceId 液化石油气监管-液化气用户-安全装置加装维护ID
* @return 液化石油气监管-液化气用户-安全装置加装维护
*/
public TYehuaqiuserSafetyDeviceInfo selectTYehuaqiuserSafetyDeviceInfoById(Long fSafetyDeviceId);
/**
* 根据userid查询数据
* @param userId u
* @return r
*/
public List<TYehuaqiuserSafetyDeviceInfo> queryDeviceInfoByUserId(Long userId);
/**
* 查询液化石油气监管-液化气用户-安全装置加装维护列表
*
* @param tYehuaqiuserSafetyDeviceInfo 液化石油气监管-液化气用户-安全装置加装维护
* @return 液化石油气监管-液化气用户-安全装置加装维护集合
*/
public List<TYehuaqiuserSafetyDeviceInfo> selectTYehuaqiuserSafetyDeviceInfoList(TYehuaqiuserSafetyDeviceInfo tYehuaqiuserSafetyDeviceInfo);
/**
* 新增液化石油气监管-液化气用户-安全装置加装维护
*
* @param tYehuaqiuserSafetyDeviceInfo 液化石油气监管-液化气用户-安全装置加装维护
* @return 结果
*/
public int insertTYehuaqiuserSafetyDeviceInfo(TYehuaqiuserSafetyDeviceInfo tYehuaqiuserSafetyDeviceInfo);
/**
* 批量插入
* @param tYehuaqiuserSafetyDeviceInfos t
* @return r
*/
public int insertBatch(@Param("list") List<TYehuaqiuserSafetyDeviceInfo> tYehuaqiuserSafetyDeviceInfos);
/**
* 根据 userid删除 数据
* @param userId user
* @return r
*/
public void deleteYehuaqiuserSafetyDeviceInfoUserId(Long userId);
/**
* 修改液化石油气监管-液化气用户-安全装置加装维护
*
* @param tYehuaqiuserSafetyDeviceInfo 液化石油气监管-液化气用户-安全装置加装维护
* @return 结果
*/
public int updateTYehuaqiuserSafetyDeviceInfo(TYehuaqiuserSafetyDeviceInfo tYehuaqiuserSafetyDeviceInfo);
/**
* 删除液化石油气监管-液化气用户-安全装置加装维护
*
* @param fSafetyDeviceId 液化石油气监管-液化气用户-安全装置加装维护ID
* @return 结果
*/
public int deleteTYehuaqiuserSafetyDeviceInfoById(Long fSafetyDeviceId);
/**
* 批量删除液化石油气监管-液化气用户-安全装置加装维护
*
* @param fSafetyDeviceIds 需要删除的数据ID
* @return 结果
*/
public int deleteTYehuaqiuserSafetyDeviceInfoByIds(Long[] fSafetyDeviceIds);
}
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import com.zehong.system.domain.TDetectorUser; import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.TYehuaqiUser; 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.TDetectorUserVO;
import com.zehong.system.domain.vo.TYehuaqiUserVO; import com.zehong.system.domain.vo.TYehuaqiUserVO;
...@@ -33,6 +34,11 @@ public interface ITYehuaqiUserService ...@@ -33,6 +34,11 @@ public interface ITYehuaqiUserService
public List<TYehuaqiUser> selectAllUserList(TYehuaqiUser tYehuaqiUser); public List<TYehuaqiUser> selectAllUserList(TYehuaqiUser tYehuaqiUser);
/**
* 根据企业id统计错误数据
* @return r
*/
public int countByBeyondEnterpriseId();
/** /**
* 新增燃气用户 * 新增燃气用户
* *
...@@ -64,4 +70,19 @@ public interface ITYehuaqiUserService ...@@ -64,4 +70,19 @@ public interface ITYehuaqiUserService
* @return 结果 * @return 结果
*/ */
public int deleteTYehuaqiUserById(Long userId); public int deleteTYehuaqiUserById(Long userId);
/**
* 新增燃气用户和安全装置
* @param gasUserAndSafetyDeviceVo gas
* @return r
*/
public int addUserAndSafetyDevice(GasUserAndSafetyDeviceVo gasUserAndSafetyDeviceVo);
/**
* 修改燃气用户和安全装置
* @param gasUserAndSafetyDeviceVo gas
* @return r
*/
public int updateUserAndSafetyDevice(GasUserAndSafetyDeviceVo gasUserAndSafetyDeviceVo);
} }
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TYehuaqiuserSafetyDeviceInfo;
/**
* 液化石油气监管-液化气用户-安全装置加装维护Service接口
*
* @author zehong
* @date 2024-09-09
*/
public interface ITYehuaqiuserSafetyDeviceInfoService
{
/**
* 查询液化石油气监管-液化气用户-安全装置加装维护
*
* @param fSafetyDeviceId 液化石油气监管-液化气用户-安全装置加装维护ID
* @return 液化石油气监管-液化气用户-安全装置加装维护
*/
public TYehuaqiuserSafetyDeviceInfo selectTYehuaqiuserSafetyDeviceInfoById(Long fSafetyDeviceId);
/**
* 根据要用户id 查询列表
* @param userId user
* @return l
*/
public List<TYehuaqiuserSafetyDeviceInfo> queryDeviceInfoByUserId(Long userId);
/**
* 查询液化石油气监管-液化气用户-安全装置加装维护列表
*
* @param tYehuaqiuserSafetyDeviceInfo 液化石油气监管-液化气用户-安全装置加装维护
* @return 液化石油气监管-液化气用户-安全装置加装维护集合
*/
public List<TYehuaqiuserSafetyDeviceInfo> selectTYehuaqiuserSafetyDeviceInfoList(TYehuaqiuserSafetyDeviceInfo tYehuaqiuserSafetyDeviceInfo);
/**
* 新增液化石油气监管-液化气用户-安全装置加装维护
*
* @param tYehuaqiuserSafetyDeviceInfo 液化石油气监管-液化气用户-安全装置加装维护
* @return 结果
*/
public int insertTYehuaqiuserSafetyDeviceInfo(TYehuaqiuserSafetyDeviceInfo tYehuaqiuserSafetyDeviceInfo);
/**
* 修改液化石油气监管-液化气用户-安全装置加装维护
*
* @param tYehuaqiuserSafetyDeviceInfo 液化石油气监管-液化气用户-安全装置加装维护
* @return 结果
*/
public int updateTYehuaqiuserSafetyDeviceInfo(TYehuaqiuserSafetyDeviceInfo tYehuaqiuserSafetyDeviceInfo);
/**
* 批量删除液化石油气监管-液化气用户-安全装置加装维护
*
* @param fSafetyDeviceIds 需要删除的液化石油气监管-液化气用户-安全装置加装维护ID
* @return 结果
*/
public int deleteTYehuaqiuserSafetyDeviceInfoByIds(Long[] fSafetyDeviceIds);
/**
* 删除液化石油气监管-液化气用户-安全装置加装维护信息
*
* @param fSafetyDeviceId 液化石油气监管-液化气用户-安全装置加装维护ID
* @return 结果
*/
public int deleteTYehuaqiuserSafetyDeviceInfoById(Long fSafetyDeviceId);
}
package com.zehong.system.service.impl; package com.zehong.system.service.impl;
import java.util.List; import java.util.List;
import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.TYehuaqiDevice; 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.TYehuaqiDeviceMapper;
import com.zehong.system.mapper.TYehuaqiuserSafetyDeviceInfoMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TYehuaqiUserMapper; import com.zehong.system.mapper.TYehuaqiUserMapper;
import com.zehong.system.domain.TYehuaqiUser;
import com.zehong.system.service.ITYehuaqiUserService; import com.zehong.system.service.ITYehuaqiUserService;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 燃气用户Service业务层处理 * 燃气用户Service业务层处理
...@@ -24,6 +29,9 @@ public class TYehuaqiUserServiceImpl implements ITYehuaqiUserService ...@@ -24,6 +29,9 @@ public class TYehuaqiUserServiceImpl implements ITYehuaqiUserService
@Autowired @Autowired
private TYehuaqiDeviceMapper tYehuaqiDeviceMapper; private TYehuaqiDeviceMapper tYehuaqiDeviceMapper;
@Autowired
private TYehuaqiuserSafetyDeviceInfoMapper yehuaqiuserSafetyDeviceInfoMapperl;
/** /**
* 查询燃气用户 * 查询燃气用户
* *
...@@ -60,6 +68,18 @@ public class TYehuaqiUserServiceImpl implements ITYehuaqiUserService ...@@ -60,6 +68,18 @@ public class TYehuaqiUserServiceImpl implements ITYehuaqiUserService
return list; return list;
} }
/**
* 根据企业id统计错误数据
* @return r
*/
@Override
public int countByBeyondEnterpriseId() {
LoginUser loginUser = SecurityUtils.getLoginUser();
String deptId = loginUser.getUser().getDeptId();
return tYehuaqiUserMapper.countByBeyondEnterpriseId(deptId);
}
/** /**
* 新增燃气用户 * 新增燃气用户
* *
...@@ -109,4 +129,50 @@ public class TYehuaqiUserServiceImpl implements ITYehuaqiUserService ...@@ -109,4 +129,50 @@ public class TYehuaqiUserServiceImpl implements ITYehuaqiUserService
{ {
return tYehuaqiUserMapper.deleteTYehuaqiUserById(userId); return tYehuaqiUserMapper.deleteTYehuaqiUserById(userId);
} }
/**
* 新增燃气用户 和 安全装置
* @param gasUserAndSafetyDeviceVo gas
* @return r
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int addUserAndSafetyDevice(GasUserAndSafetyDeviceVo gasUserAndSafetyDeviceVo) {
TYehuaqiUser yehuaqiUser = gasUserAndSafetyDeviceVo.getYehuaqiUser();
tYehuaqiUserMapper.insertTYehuaqiUser(yehuaqiUser);
List<TYehuaqiuserSafetyDeviceInfo> yehuaqiuserSafetyDeviceInfos = gasUserAndSafetyDeviceVo.getYehuaqiuserSafetyDeviceInfos();
if (yehuaqiuserSafetyDeviceInfos != null && yehuaqiuserSafetyDeviceInfos.size() > 0) {
for (TYehuaqiuserSafetyDeviceInfo yehuaqiuserSafetyDeviceInfo : yehuaqiuserSafetyDeviceInfos) {
yehuaqiuserSafetyDeviceInfo.setfRelationUserId(yehuaqiUser.getUserId());;
}
yehuaqiuserSafetyDeviceInfoMapperl.insertBatch(yehuaqiuserSafetyDeviceInfos);
}
return 1;
}
/**
* 修改燃气用户 和 安全装置
* @param gasUserAndSafetyDeviceVo gas
* @return r
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int updateUserAndSafetyDevice(GasUserAndSafetyDeviceVo gasUserAndSafetyDeviceVo) {
TYehuaqiUser yehuaqiUser = gasUserAndSafetyDeviceVo.getYehuaqiUser();
tYehuaqiUserMapper.updateTYehuaqiUser(yehuaqiUser);
List<TYehuaqiuserSafetyDeviceInfo> yehuaqiuserSafetyDeviceInfos = gasUserAndSafetyDeviceVo.getYehuaqiuserSafetyDeviceInfos();
if (yehuaqiuserSafetyDeviceInfos != null && yehuaqiuserSafetyDeviceInfos.size() > 0) {
for (TYehuaqiuserSafetyDeviceInfo yehuaqiuserSafetyDeviceInfo : yehuaqiuserSafetyDeviceInfos) {
yehuaqiuserSafetyDeviceInfo.setfRelationUserId(yehuaqiUser.getUserId());
}
}
yehuaqiuserSafetyDeviceInfoMapperl.deleteYehuaqiuserSafetyDeviceInfoUserId(yehuaqiUser.getUserId());
if (yehuaqiuserSafetyDeviceInfos != null && yehuaqiuserSafetyDeviceInfos.size() > 0) {
yehuaqiuserSafetyDeviceInfoMapperl.insertBatch(yehuaqiuserSafetyDeviceInfos);
}
return 1;
}
} }
package com.zehong.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TYehuaqiuserSafetyDeviceInfoMapper;
import com.zehong.system.domain.TYehuaqiuserSafetyDeviceInfo;
import com.zehong.system.service.ITYehuaqiuserSafetyDeviceInfoService;
/**
* 液化石油气监管-液化气用户-安全装置加装维护Service业务层处理
*
* @author zehong
* @date 2024-09-09
*/
@Service
public class TYehuaqiuserSafetyDeviceInfoServiceImpl implements ITYehuaqiuserSafetyDeviceInfoService
{
@Autowired
private TYehuaqiuserSafetyDeviceInfoMapper tYehuaqiuserSafetyDeviceInfoMapper;
/**
* 查询液化石油气监管-液化气用户-安全装置加装维护
*
* @param fSafetyDeviceId 液化石油气监管-液化气用户-安全装置加装维护ID
* @return 液化石油气监管-液化气用户-安全装置加装维护
*/
@Override
public TYehuaqiuserSafetyDeviceInfo selectTYehuaqiuserSafetyDeviceInfoById(Long fSafetyDeviceId)
{
return tYehuaqiuserSafetyDeviceInfoMapper.selectTYehuaqiuserSafetyDeviceInfoById(fSafetyDeviceId);
}
@Override
public List<TYehuaqiuserSafetyDeviceInfo> queryDeviceInfoByUserId(Long userId) {
return null;
}
/**
* 查询液化石油气监管-液化气用户-安全装置加装维护列表
*
* @param tYehuaqiuserSafetyDeviceInfo 液化石油气监管-液化气用户-安全装置加装维护
* @return 液化石油气监管-液化气用户-安全装置加装维护
*/
@Override
public List<TYehuaqiuserSafetyDeviceInfo> selectTYehuaqiuserSafetyDeviceInfoList(TYehuaqiuserSafetyDeviceInfo tYehuaqiuserSafetyDeviceInfo)
{
return tYehuaqiuserSafetyDeviceInfoMapper.selectTYehuaqiuserSafetyDeviceInfoList(tYehuaqiuserSafetyDeviceInfo);
}
/**
* 新增液化石油气监管-液化气用户-安全装置加装维护
*
* @param tYehuaqiuserSafetyDeviceInfo 液化石油气监管-液化气用户-安全装置加装维护
* @return 结果
*/
@Override
public int insertTYehuaqiuserSafetyDeviceInfo(TYehuaqiuserSafetyDeviceInfo tYehuaqiuserSafetyDeviceInfo)
{
return tYehuaqiuserSafetyDeviceInfoMapper.insertTYehuaqiuserSafetyDeviceInfo(tYehuaqiuserSafetyDeviceInfo);
}
/**
* 修改液化石油气监管-液化气用户-安全装置加装维护
*
* @param tYehuaqiuserSafetyDeviceInfo 液化石油气监管-液化气用户-安全装置加装维护
* @return 结果
*/
@Override
public int updateTYehuaqiuserSafetyDeviceInfo(TYehuaqiuserSafetyDeviceInfo tYehuaqiuserSafetyDeviceInfo)
{
return tYehuaqiuserSafetyDeviceInfoMapper.updateTYehuaqiuserSafetyDeviceInfo(tYehuaqiuserSafetyDeviceInfo);
}
/**
* 批量删除液化石油气监管-液化气用户-安全装置加装维护
*
* @param fSafetyDeviceIds 需要删除的液化石油气监管-液化气用户-安全装置加装维护ID
* @return 结果
*/
@Override
public int deleteTYehuaqiuserSafetyDeviceInfoByIds(Long[] fSafetyDeviceIds)
{
return tYehuaqiuserSafetyDeviceInfoMapper.deleteTYehuaqiuserSafetyDeviceInfoByIds(fSafetyDeviceIds);
}
/**
* 删除液化石油气监管-液化气用户-安全装置加装维护信息
*
* @param fSafetyDeviceId 液化石油气监管-液化气用户-安全装置加装维护ID
* @return 结果
*/
@Override
public int deleteTYehuaqiuserSafetyDeviceInfoById(Long fSafetyDeviceId)
{
return tYehuaqiuserSafetyDeviceInfoMapper.deleteTYehuaqiuserSafetyDeviceInfoById(fSafetyDeviceId);
}
}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TYehuaqiUserMapper"> <mapper namespace="com.zehong.system.mapper.TYehuaqiUserMapper">
<resultMap type="TYehuaqiUser" id="TYehuaqiUserResult"> <resultMap type="TYehuaqiUser" id="TYehuaqiUserResult">
<result property="userId" column="user_id" /> <result property="userId" column="user_id" />
<result property="username" column="username" /> <result property="username" column="username" />
...@@ -22,19 +22,82 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -22,19 +22,82 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remarks" column="remarks" /> <result property="remarks" column="remarks" />
<result property="deviceNum" column="deviceNum" /> <result property="deviceNum" column="deviceNum" />
<result property="zxnum" column="zxnum" /> <result property="zxnum" column="zxnum" />
<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="TYehuaqiUser" id="TYehuaqiUserExportResult">
<result property="userId" column="user_id" />
<result property="username" column="username" />
<result property="nickName" column="nick_name" />
<result property="beyondEnterpriseId" column="beyond_enterprise_id" />
<result property="userType" column="user_type" />
<result property="address" column="address" />
<result property="longitude" column="longitude" />
<result property="latitude" column="latitude" />
<result property="linkman" column="linkman" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="isDel" column="is_del" />
<result property="remarks" column="remarks" />
<result property="deviceNum" column="deviceNum" />
<result property="zxnum" column="zxnum" />
<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" />
<!-- collection 是用于建立一对多中集合属性的对应关系
ofType 用于指定集合元素的数据类型
-->
<collection property="userManageSafetyDeviceExportVos" ofType="UserManageSafetyDeviceExportVo">
<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="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"/>
</collection>
</resultMap> </resultMap>
<sql id="selectTYehuaqiUserVo"> <sql id="selectTYehuaqiUserVo">
select user_id, username, nick_name, beyond_enterprise_id, user_type, address, longitude, latitude, linkman, phone, email, create_time, update_time, is_del, remarks from t_yehuaqi_user select user_id, username, nick_name, beyond_enterprise_id, user_type, address, longitude, latitude, linkman,
phone, email, create_time, update_time, is_del, remarks ,f_village_id,error_msg from t_yehuaqi_user
</sql> </sql>
<select id="selectTYehuaqiUserList" parameterType="TYehuaqiUser" resultMap="TYehuaqiUserResult"> <select id="selectTYehuaqiUserList" parameterType="TYehuaqiUser" resultMap="TYehuaqiUserResult">
<include refid="selectTYehuaqiUserVo"/> <!-- <include refid="selectTYehuaqiUserVo"/>-->
<where> <!-- <where> -->
<if test="username != null and username != ''"> and username like concat('%', #{username}, '%')</if> <!-- <if test="username != null and username != ''"> and username like concat('%', #{username}, '%')</if>-->
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if> <!-- <if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>-->
<if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if> <!-- <if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if>-->
<!-- </where>-->
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 ,
'液化气' 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
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
<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> </where>
order by a.user_id desc
</select> </select>
<select id="selectTYehuaqiUserListTwo" parameterType="TYehuaqiUser" resultMap="TYehuaqiUserResult"> <select id="selectTYehuaqiUserListTwo" parameterType="TYehuaqiUser" resultMap="TYehuaqiUserResult">
SELECT t2.zs as deviceNum,t2.zx as zxnum,t1.* FROM t_yehuaqi_user t1 SELECT t2.zs as deviceNum,t2.zx as zxnum,t1.* FROM t_yehuaqi_user t1
...@@ -44,6 +107,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -44,6 +107,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null and userId != ''"> and t1.user_id = #{userId}</if> <if test="userId != null and userId != ''"> and t1.user_id = #{userId}</if>
</where> </where>
</select> </select>
<select id="countByBeyondEnterpriseId" parameterType="String" resultType="int">
select count(*) from t_yehuaqi_user where error_msg is not null
<if test="beyondEnterpriseId != null and beyondEnterpriseId != '' and beyondEnterpriseId != '-2'">
beyond_enterprise_id = #{beyondEnterpriseId}
</if>
</select>
<select id="selectTYehuaqiUserById" parameterType="Long" resultMap="TYehuaqiUserResult"> <select id="selectTYehuaqiUserById" parameterType="Long" resultMap="TYehuaqiUserResult">
<include refid="selectTYehuaqiUserVo"/> <include refid="selectTYehuaqiUserVo"/>
where user_id = #{userId} where user_id = #{userId}
......
<?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.TYehuaqiuserSafetyDeviceInfoMapper">
<resultMap type="TYehuaqiuserSafetyDeviceInfo" id="TYehuaqiuserSafetyDeviceInfoResult">
<result property="fSafetyDeviceId" column="f_safety_device_id" />
<result property="fRelationUserId" column="f_relation_user_id" />
<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="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" />
<result property="isDel" column="is_del" />
</resultMap>
<sql id="selectTYehuaqiuserSafetyDeviceInfoVo">
select f_safety_device_id, f_relation_user_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, is_del from t_yehuaqiuser_safety_device_info
</sql>
<select id="selectTYehuaqiuserSafetyDeviceInfoList" parameterType="TYehuaqiuserSafetyDeviceInfo" resultMap="TYehuaqiuserSafetyDeviceInfoResult">
<include refid="selectTYehuaqiuserSafetyDeviceInfoVo"/>
<where>
<if test="fRelationUserId != null "> and f_relation_user_id = #{fRelationUserId}</if>
<if test="fRelationDeviceType != null and fRelationDeviceType != ''"> and f_relation_device_type = #{fRelationDeviceType}</if>
<if test="fDeviceName != null and fDeviceName != ''"> and f_device_name like concat('%', #{fDeviceName}, '%')</if>
<if test="fDeviceModel != null and fDeviceModel != ''"> and f_device_model = #{fDeviceModel}</if>
<if test="fIotNo != null and fIotNo != ''"> and f_iot_no = #{fIotNo}</if>
<if test="fDetectionMedium != null and fDetectionMedium != ''"> and f_detection_medium = #{fDetectionMedium}</if>
<if test="fDeviceInstallTime != null "> and f_device_install_time = #{fDeviceInstallTime}</if>
<if test="fDeviceInstallPosition != null and fDeviceInstallPosition != ''"> and f_device_install_position = #{fDeviceInstallPosition}</if>
<if test="fHead != null and fHead != ''"> and f_head = #{fHead}</if>
<if test="fPhone != null and fPhone != ''"> and f_phone = #{fPhone}</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
</where>
</select>
<select id="selectTYehuaqiuserSafetyDeviceInfoById" parameterType="Long" resultMap="TYehuaqiuserSafetyDeviceInfoResult">
<include refid="selectTYehuaqiuserSafetyDeviceInfoVo"/>
where f_safety_device_id = #{fSafetyDeviceId}
</select>
<select id="queryDeviceInfoByUserId" parameterType="Long" resultMap="TYehuaqiuserSafetyDeviceInfoResult">
<include refid="selectTYehuaqiuserSafetyDeviceInfoVo"/>
where fRelationUserId = #{userId}
</select>
<insert id="insertTYehuaqiuserSafetyDeviceInfo" parameterType="TYehuaqiuserSafetyDeviceInfo" useGeneratedKeys="true" keyProperty="fSafetyDeviceId">
insert into t_yehuaqiuser_safety_device_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fRelationUserId != null">f_relation_user_id,</if>
<if test="fRelationDeviceType != null">f_relation_device_type,</if>
<if test="fDeviceName != null">f_device_name,</if>
<if test="fDeviceModel != null">f_device_model,</if>
<if test="fIotNo != null">f_iot_no,</if>
<if test="fDetectionMedium != null">f_detection_medium,</if>
<if test="fDeviceInstallTime != null">f_device_install_time,</if>
<if test="fDeviceInstallPosition != null">f_device_install_position,</if>
<if test="fHead != null">f_head,</if>
<if test="fPhone != null">f_phone,</if>
<if test="isDel != null">is_del,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fRelationUserId != null">#{fRelationUserId},</if>
<if test="fRelationDeviceType != null">#{fRelationDeviceType},</if>
<if test="fDeviceName != null">#{fDeviceName},</if>
<if test="fDeviceModel != null">#{fDeviceModel},</if>
<if test="fIotNo != null">#{fIotNo},</if>
<if test="fDetectionMedium != null">#{fDetectionMedium},</if>
<if test="fDeviceInstallTime != null">#{fDeviceInstallTime},</if>
<if test="fDeviceInstallPosition != null">#{fDeviceInstallPosition},</if>
<if test="fHead != null">#{fHead},</if>
<if test="fPhone != null">#{fPhone},</if>
<if test="isDel != null">#{isDel},</if>
</trim>
</insert>
<insert id="insertBatch" parameterType="list">
insert into t_yehuaqiuser_safety_device_info (f_relation_user_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.fRelationUserId}, #{item.fRelationDeviceType,jdbcType=VARCHAR},
#{item.fDeviceName,jdbcType=VARCHAR}, #{item.fDeviceModel,jdbcType=VARCHAR}, #{item.fIotNo,jdbcType=VARCHAR},
#{item.fDetectionMedium,jdbcType=DECIMAL}, #{item.fDeviceInstallTime,jdbcType=DECIMAL},
#{item.fDeviceInstallPosition,jdbcType=VARCHAR},#{item.fHead,jdbcType=VARCHAR}, #{item.fPhone,jdbcType=TIMESTAMP}
)
</foreach>
</insert>
<update id="updateTYehuaqiuserSafetyDeviceInfo" parameterType="TYehuaqiuserSafetyDeviceInfo">
update t_yehuaqiuser_safety_device_info
<trim prefix="SET" suffixOverrides=",">
<if test="fRelationUserId != null">f_relation_user_id = #{fRelationUserId},</if>
<if test="fRelationDeviceType != null">f_relation_device_type = #{fRelationDeviceType},</if>
<if test="fDeviceName != null">f_device_name = #{fDeviceName},</if>
<if test="fDeviceModel != null">f_device_model = #{fDeviceModel},</if>
<if test="fIotNo != null">f_iot_no = #{fIotNo},</if>
<if test="fDetectionMedium != null">f_detection_medium = #{fDetectionMedium},</if>
<if test="fDeviceInstallTime != null">f_device_install_time = #{fDeviceInstallTime},</if>
<if test="fDeviceInstallPosition != null">f_device_install_position = #{fDeviceInstallPosition},</if>
<if test="fHead != null">f_head = #{fHead},</if>
<if test="fPhone != null">f_phone = #{fPhone},</if>
<if test="isDel != null">is_del = #{isDel},</if>
</trim>
where f_safety_device_id = #{fSafetyDeviceId}
</update>
<delete id="deleteTYehuaqiuserSafetyDeviceInfoById" parameterType="Long">
delete from t_yehuaqiuser_safety_device_info where f_safety_device_id = #{fSafetyDeviceId}
</delete>
<select id="deleteYehuaqiuserSafetyDeviceInfoUserId" parameterType="Long">
delete from t_yehuaqiuser_safety_device_info where f_relation_user_id = #{userId}
</select>
<delete id="deleteTYehuaqiuserSafetyDeviceInfoByIds" parameterType="String">
delete from t_yehuaqiuser_safety_device_info where f_safety_device_id in
<foreach item="fSafetyDeviceId" collection="array" open="(" separator="," close=")">
#{fSafetyDeviceId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
import request from '@/utils/request'
// 查询燃气用户列表
export function listUser(query) {
return request({
url: '/system/yehuaqiUser/list',
method: 'get',
params: query
})
}
// 查询燃气用户详细ee
export function getUser(userId) {
return request({
url: '/system/yehuaqiUser/' + userId,
method: 'get'
})
}
// 新增燃气用户
export function addUser(data) {
return request({
url: '/system/yehuaqiUser',
method: 'post',
data: data
})
}
// 修改燃气用户
export function updateUser(data) {
return request({
url: '/system/yehuaqiUser',
method: 'put',
data: data
})
}
// 删除燃气用户
export function delUser(userId) {
return request({
url: '/system/yehuaqiUser/' + userId,
method: 'delete'
})
}
// 导出燃气用户
export function exportUser(query) {
return request({
url: '/system/yehuaqiUser/export',
method: 'get',
params: query
})
}
// 导出燃气用户-新的-有居住区的导出
export function newExportUser(query) {
return request({
url: '/system/yehuaqiUser/newExport',
method: 'get',
params: query
})
}
// 查询 安装加装装置数据
export function getNoSelectSafetyDetailInfo(data) {
return request({
url: '/gasUserSafetyDevice/info/queryNoSelectSafeDeviceInfoList',
method: 'post',
data: data
})
}
// 查询 安装加装装置数据
export function addSafetyDetailInfo(data) {
return request({
url: '/gasUserSafetyDevice/info',
method: 'post',
data: data
})
}
// 关联安装加装装置 批量删除
export function deleteSafetyDeviceListInfo(data) {
return request({
url: '/gasUserSafetyDevice/info/deleteSafetyDeviceListInfo',
method: 'post',
data: data
})
}
// 删除关联设备信息
export function deleteSafetyDeviceInfo(deviceId) {
return request({
url: '/gasUserSafetyDevice/info/deleteSafetyDeviceInfo',
method: 'delete',
data:deviceId
})
}
// 根据燃气用户id 查询 关联 安全装置加装
export function queryDeviceInfoByUserId(userId) {
return request({
url: '/yehuaqiUserSafetyDeviceInfo/info/queryDeviceInfoByUserId/'+ userId,
method: 'get'
})
}
// 新增燃气用户-包含安全装置
export function addUserAndSafetyDevice(data) {
return request({
url: '/system/yehuaqiUser/addUserAndSafetyDevice',
method: 'post',
data: data
})
}
// 修改燃气用户-包含安全装置
export function updateUserAndSafetyDevice(data) {
return request({
url: '/system/yehuaqiUser/updateUserAndSafetyDevice',
method: 'post',
data: data
})
}
// 下载用户导入模板
export function importTemplate() {
return request({
url: '/system/yehuaqiUser/importTemplate',
method: 'get'
})
}
// 下载用户导入模板 - 自定义的模版
export function downloadTemplate() {
return request({
url: '/system/yehuaqiUser/downloadTemplate',
method: 'get',
responseType: 'blob'
})
}
// 统计错误数量
export function countImportError() {
return request({
url: '/system/yehuaqiUser/countImportError',
method: 'get'
})
}
// 清除错误数据
export function clearImportError() {
return request({
url: '/system/yehuaqiUser/clearImportError',
method: 'get'
})
}
// 导出从业人员信息- 错误数据
export function exportErrorData() {
return request({
url: '/system/yehuaqiUser/exportErrorData',
method: 'get',
responseType: 'blob'
})
}
//自定义-模版下载-正确数据导出-燃气用户
export function exportSuccessData(query) {
return request({
url: '/system/yehuaqiUser/exportSuccessData',
method: 'get',
responseType: 'blob',
params: query
})
}
\ No newline at end of file
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="用户名称" prop="nickName">
<el-input
v-model="queryParams.nickName"
placeholder="请输入用户名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="downloadSuccessDataMethod"
>导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
icon="el-icon-upload2"
size="mini"
@click="handleImport">导入</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="用户名称" align="center" prop="nickName" >
<span slot-scope="scope" v-if="scope.row.nickName">{{scope.row.nickName}}</span>
<span v-else>-</span>
</el-table-column>
<el-table-column label="用户类型" align="center" prop="userType" >
<span slot-scope="scope" v-if="scope.row.userType">{{scope.row.userType}}</span>
<span v-else>-</span>
</el-table-column>
<el-table-column label="地址" align="center" prop="address" >
<span slot-scope="scope" v-if="scope.row.address">{{scope.row.address}}</span>
<span v-else>-</span>
</el-table-column>
<el-table-column label="所属企业" align="center" prop="beyondEnterpriseName" >
<span slot-scope="scope" v-if="scope.row.beyondEnterpriseName">{{scope.row.beyondEnterpriseName}}</span>
<span v-else>-</span>
</el-table-column>
<el-table-column label="居住区(村、庄)" width="120" align="center" prop="villageName" >
<span slot-scope="scope" v-if="scope.row.villageName">{{scope.row.villageName}}</span>
<span v-else>-</span>
</el-table-column>
<el-table-column label="经度" align="center" prop="longitude" >
<span slot-scope="scope" v-if="scope.row.longitude">{{scope.row.longitude}}</span>
<span v-else>-</span>
</el-table-column>
<el-table-column label="纬度" align="center" prop="latitude" >
<span slot-scope="scope" v-if="scope.row.latitude">{{scope.row.latitude}}</span>
<span v-else>-</span>
</el-table-column>
<el-table-column label="联系人" align="center" prop="linkman" >
<span slot-scope="scope" v-if="scope.row.linkman">{{scope.row.linkman}}</span>
<span v-else>-</span>
</el-table-column>
<el-table-column label="电话" align="center" prop="phone" >
<span slot-scope="scope" v-if="scope.row.phone">{{scope.row.phone}}</span>
<span v-else>-</span>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改燃气用户对话框 -->
<el-dialog :title="title" :visible.sync="open"width="780px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="11">
<el-form-item label="用户账号" prop="username">
<el-input v-model="form.username" placeholder="请输入用户账号" />
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="用户名称" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入用户名称" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="用户类型" prop="userType">
<el-select v-model="form.userType" placeholder="请选择用户类型">
<el-option v-for="dict in userTypeOpers" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="11" v-if="form.userType === '1'">
<el-form-item label="居住区(村、庄)" prop="villageId">
<el-select v-model="form.villageId" placeholder="请在下拉框中选择名称" maxlength="255" :disabled="false" clearable style="width: 100%;">
<el-option v-for="item in villageList" :key="item.fVillageId" :label="item.fVillageName" :value="item.fVillageId">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="所属企业" prop="beyondEnterpriseId">
<el-select v-model="form.beyondEnterpriseId" placeholder="请在下拉框中选择名称" maxlength="255" :disabled="false" clearable style="width: 100%;">
<el-option v-for="item in test" :key="item.enterpriseId" :label="item.enterpriseName" :value="item.enterpriseId">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="22">
<el-form-item label="地址" prop="address">
<el-input v-model="form.address" placeholder="请输入地址" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="21">
<el-form-item label="经纬度坐标" prop="longitude">
<el-col :span="9">
<el-input v-model="form.longitude" placeholder="请输入经度" />
</el-col>
<el-col :span="9" style="margin-left: 15px">
<el-input v-model="form.latitude" placeholder="请输入纬度"/>
</el-col>
<el-col :span="3" style="margin-left: 33px">
<el-button type="primary" plain @click="MapdialogFun">选择经纬度</el-button>
</el-col>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="联系人" prop="linkman">
<el-input v-model="form.linkman" placeholder="请输入联系人" />
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="电话" prop="phone">
<el-input onkeyup="this.value=this.value.replace(/\D/g,'')" v-model="form.phone" placeholder="请输入电话" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="22">
<el-form-item label="备注" prop="remarks">
<el-input v-model="form.remarks" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="tableTitle">
<img :src="relationImg" style="width: 24px; height: 25px;position: relative; left: -355px; top: -12px; bottom: 8px;"/>
<span class="midText">安全装置</span>
<el-row :gutter="10" class="mb9">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="dialogFormVisible = true"
>新增</el-button>
</el-col>
</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-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" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="deleteDataListilInfo(scope.row,scope.$index)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<!--添加关联设备弹出框-->
<el-dialog title="添加安全装置" :visible.sync="dialogFormVisible">
<el-form ref="formDetailInfo" :model="formDetailInfo" :rules="formDetailInfoRules" label-width="100px">
<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>
</el-col>
<el-col :span="11">
<el-form-item label="设备型号" prop="deviceModel">
<el-input v-model="formDetailInfo.deviceModel" 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-input>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="物联网编号" prop="fIotNo" >
<el-input v-model="formDetailInfo.fIotNo" placeholder="请输入物联网编号" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="设备安装时间" prop="deviceInstallTime">
<el-date-picker clearable size="small"
v-model="formDetailInfo.deviceInstallTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择安装时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="安装位置" prop="deviceInstallPosition" >
<el-input v-model="formDetailInfo.deviceInstallPosition" 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-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>
</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>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="insertListDetailInfo">提 交</el-button>
<el-button @click="dialogFormVisible=false">取 消</el-button>
</div>
</el-dialog>
<GetPos
:dialogVisible.sync="dialogTableVisibles"
device=""
:devicePos="devicePos"
@close="dialogcancelFun"
@getPath="getPath"
/>
<!-- 用户导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<span>仅允许导入xls、xlsx格式文件。</span>
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
<br>
<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
type="danger"
icon="el-icon-download"
size="small"
@click="handleImportError"
v-if="this.importError > 0 "
>
<span>下载导入时错误数据</span>
</el-button>
</el-badge>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
</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>
<script>
import { listUser, getUser, delUser,newExportUser,
getNoSelectSafetyDetailInfo,addSafetyDetailInfo,deleteSafetyDeviceInfo,
deleteSafetyDeviceListInfo,queryDeviceInfoByUserId,
addUserAndSafetyDevice,updateUserAndSafetyDevice,downloadTemplate,
countImportError,clearImportError,exportErrorData,exportSuccessData} from "@/api/lpgRegulation/user";
import { selectTEnterprise} from "@/api/regulation/supervise";
import { noPageListVillage} from "@/api/regulation/userManagement/village";
import GetPos from '@/components/GetPos';
import { getToken } from "@/utils/auth";
export default {
name: "User",
components: {
GetPos
},
data() {
return {
upload: {
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: "",
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的用户数据
updateSupport: 0,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/supervise/user/moreSheetImportExcel" // todo
},
importError: null,
importErrorShow: false,
importErrorShowTitle: "选择下载错误数据或者是清除错误数据",
relationImg: require('@/assets/project/relation.png'),
//下拉框数据
test:{},
dialogTableVisible: false,
//存储已被选中的下级数据id
DetailInfoListId :[],
//存储已经选中的下级关联数据
DetailInfoList:[],
/*添加关联设备*/
formDetailInfo:{
gasUserSafetyDeviceId:'',
relationDeviceType: '',
deviceName:'',
deviceModel:'',
fIotNo:'',
detectionMedium:'',
deviceInstallTime:null,
deviceInstallPosition:'',
head:'',
phone:''
},
dialogFormVisible: false,
/**--------------地图使用数据---------------*/
dialogTableVisibles: false,
devicePos: [],
//下级设备数据数组
tableData: [],
/**--------------地图使用数据---------------*/
// 居住区数据集合
villageList:[],
// 遮罩层
loading: true,
//下级数据的遮罩层
loadings:false,
//下级数据的遮罩层
safetyDeviceManageLoadings:true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 燃气用户表格数据
userList: [],
// 燃气类型
userTypeOpers: [],
// 燃气类型
gasTypeOpers: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
username: null,
nickName: null,
},
// 查询参数
dateQueryParams: {
deviceName: null,
deviceModel: null,
fIotNo: null,
},
// 表单参数
form: {
userId: null,
username: null,
nickName: null,
userType: null,
gasType: null,
address: null,
longitude: null,
latitude: null,
linkman: null,
phone: null,
email: null,
isDel: null,
remarks: null
},
// 表单校验
rules: {
/*username: [
{ required: true, message: "请输入用户账号", trigger: "blur" },
// { min: 0, max: 20, message: "长度20位", trigger: "blur" },
],*/
nickName: [
{ required: true, message: "请输入用户名称", trigger: "blur" },
// { min: 0, max: 20, message: "长度20位", trigger: "blur" },
],
userType: [
{ required: true, message: "请选择用户类型", trigger: "blur" },
],
address: [
{ required: true, message: "请输入地址", trigger: "blur" },
// { min: 0, max: 30, message: "长度30位", trigger: "blur" },
],
gasType: [
{ required: true, message: "请选择燃气类型", trigger: "blur" },
// { min: 0, max: 30, message: "长度30位", trigger: "blur" },
],
},
//关联设备下级数据 表单校验
formDetailInfoRules:{
deviceName:[
{ required: true, message: "请输入设备名称", trigger: "blur" },
{ min: 0, max: 20, message: "长度20位", trigger: "blur" },
],
deviceModel:[
{ required: true, message: "请输入设备型号", trigger: "blur" },
{ min: 0, max: 20, message: "长度20位", trigger: "blur" },
],
relationDeviceType:[
{ required: true, message: "请选择设备类型", trigger: "blur" },
],
fIotNo:[
{ required: true, message: "请输入联网编号", trigger: "blur" },
{ min: 0, max: 20, message: "长度20位", trigger: "blur" },
],
},
};
},
created() {
this.getList();
this.getDicts("yehuaqi_user_type").then(response => {
this.userTypeOpers = response.data;
});
this.getDicts("gas_type").then(response => {
this.gasTypeOpers = response.data;
});
this.getNoPageListVillage();
this.countImportError();
},
methods: {
// 下载燃气用户错误 按钮
handleImportError() {
if(this.importError === 0) {
this.$alert('暂无错误数据', '下载', {
confirmButtonText: '确定',
});
return
} else {
this.importErrorShow = true;
}
},
//自定义-模版下载-正确数据导出-燃气用户
downloadSuccessDataMethod() {
this.$showLoading.show()
exportSuccessData(this.queryParams).then((res) =>{
let blob = new Blob([res], {type: 'data:application/vnd.ms-excel;base64;charset=utf-8'});
let downloadElement = document.createElement('a');
let href = window.URL.createObjectURL(blob); //创建下载的链接
downloadElement.href = href;
downloadElement.download = '燃气用户数据'+'.xlsx'; //下载后文件名
document.body.appendChild(downloadElement);
downloadElement.click(); //点击下载
document.body.removeChild(downloadElement); //下载完成移除元素
window.URL.revokeObjectURL(href); //释放掉blob对象
this.$showLoading.hide()
return true
})
},
// 下载燃气用户错误 按钮
downloadImportError() {
exportErrorData().then((res) =>{
let blob = new Blob([res], {type: 'data:application/vnd.ms-excel;base64;charset=utf-8'});
let downloadElement = document.createElement('a');
let href = window.URL.createObjectURL(blob); //创建下载的链接
downloadElement.href = href;
downloadElement.download = '燃气用户导入错误数据'+'.xlsx'; //下载后文件名
document.body.appendChild(downloadElement);
downloadElement.click(); //点击下载
document.body.removeChild(downloadElement); //下载完成移除元素
window.URL.revokeObjectURL(href); //释放掉blob对象
return true
})
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();
},
handleImport(){
this.upload.title = "燃气用户导入"; // todo
this.upload.open = true;
},
/** 下载模板操作 */
importTemplate() {
downloadTemplate().then((res) =>{
let blob = new Blob([res], {type: 'data:application/vnd.ms-excel;base64;charset=utf-8'});
let downloadElement = document.createElement('a');
let href = window.URL.createObjectURL(blob); //创建下载的链接
downloadElement.href = href;
downloadElement.download = '燃气用户导入模版'+'.xlsx'; //下载后文件名
document.body.appendChild(downloadElement);
downloadElement.click(); //点击下载
document.body.removeChild(downloadElement); //下载完成移除元素
window.URL.revokeObjectURL(href); //释放掉blob对象
return true
})
},
// 文件上传处理中
handleFileUploadProgress(event,file,fileList) {
this.upload.isUploading = true;
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
// this.getDataList();
countImportError().then(response => {
this.importError = response.data;
if(this.importError === 0) {
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
} else {
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + '有错误数据,请点击导入界面查看详情' + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
}
})
listUser(this.queryParams).then(response => {
this.userList = response.rows;
this.total = response.total;
});
},
/**关联设备已经选中数据删除方法*/
deleteDataListilInfo(row,index){
const deviceIds = row.gasUserSafetyDeviceId;
//判断form表单是否有id来验证是修改的删除还是添加的删除
if (this.form.userId != null) {
deleteSafetyDeviceInfo(deviceIds).then(response => {
this.msgSuccess("删除成功");
this.DetailInfoList.splice(index,1);
});
}else {
this.DetailInfoList.splice(index,1);
this.msgSuccess("删除成功");
}
},
/**关联设备单条删除方法*/
deleteDetailInfo(row){
const deviceIds = row.gasUserSafetyDeviceId;
this.$confirm('是否确认删除安全装置编号为"' + deviceIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return deleteSafetyDeviceInfo(deviceIds);
}).then(() => {
// this.tableData.splice(index,1);
this.getDataList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/**关联设备单条删除方法*/
deleteSafetyDeviceInfo(row){
const deviceIds = row.gasUserSafetyDeviceId;
this.$confirm('是否确认删除设备信息编号为"' + deviceIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return deleteSafetyDeviceInfo(deviceIds);
}).then(() => {
// this.tableData.splice(index,1);
this.getDataList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/**
* 批量删除关联设备方法
* @param row
*/
deleteListDetailInfo(row){
const deviceIds = this.ids;
this.$confirm('是否确认删除安全装置为"' + deviceIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return deleteSafetyDeviceListInfo(deviceIds);
}).then(() => {
this.getDataList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/**添加关联设备与设备绑定的数据 (存储到数组中)*/
insertListDetailInfo(){
this.DetailInfoList.push(this.formDetailInfo);
//数据表单重置
this.formDetailInfo={
relationDeviceType: null,
deviceName:null,
deviceModel:null,
fIotNo:null,
detectionMedium:null,
deviceInstallTime:null,
deviceInstallPosition:null,
head:null,
phone:null
};
this.dialogFormVisible = false;
},
/**关联设备添加方法*/
addSafetyDeviceInfo(){
this.$refs["formDetailInfo"].validate(valid => {
if (valid) {
addSafetyDetailInfo(this.formDetailInfo).then(response => {
// this.tableData.push(this.formDetailInfo)
//关闭弹出层
this.dialogFormVisible = false;
//数据表单重置
this.formDetailInfo={
relationDeviceType: null,
deviceName:null,
deviceModel:null,
fIotNo:null,
detectionMedium:null,
deviceInstallTime:null,
deviceInstallPosition:null,
head:null,
phone:null
};
this.getDataList();
this.msgSuccess("新增成功");
});
}
});
},
/** 下级数据搜索*/
handleQueryData(){
this.getDataList();
},
/**查询下级数据列表方法*/
getDataList(){
this.safetyDeviceManageLoadings = true;
// console.log(this.dateQueryParams)
//查询下级设备数据
getNoSelectSafetyDetailInfo(this.dateQueryParams).then(response => {
//下级设备数据 到时候换成下级数据
this.tableData = response.rows;
this.detailTotal = response.total;
this.safetyDeviceManageLoadings = false;
});
},
/** 下级数据重置按钮操作 搜索框重置*/
resetQueryDate(){
this.dateQueryParams={
deviceName: null,
deviceModel: null,
fIotNo: null,
}
this.getDataList();
},
/**
* 选择关联设备查询方法
*/
selectDataListInfo(){
//查询下级设备数据
getNoSelectSafetyDetailInfo(this.dateQueryParams).then(response => {
//下级设备数据 到时候换成下级数据
this.tableData = response.rows;
this.detailTotal = response.total;
this.safetyDeviceManageLoadings = false;
//打开选择关联设备弹出框
this.dialogTableVisible = true
});
},
//获取居住区集合
getNoPageListVillage(){
noPageListVillage(this.queryForm).then(response => {
this.villageList = response;
});
},
/** 查询燃气用户列表 */
getList() {
this.loading = true;
listUser(this.queryParams).then(response => {
this.userList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
userId: null,
username: null,
nickName: null,
userType: null,
gasType: null,
address: null,
longitude: null,
latitude: null,
linkman: null,
phone: null,
email: null,
isDel: null,
remarks: null,
fVillageId:null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.userId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
//查询企业名称下拉框数据
selectTEnterprise().then(response => {
this.test = response.data;
});
this.reset();
this.devicePos = [];
//清空关联设备数据
this.DetailInfoList=[]
this.open = true;
this.title = "添加燃气用户";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.loadings = true;
//查询企业名称下拉框数据
selectTEnterprise().then(response => {
this.test = response.data;
});
this.reset();
const userId = row.userId || this.ids
getUser(userId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改燃气用户";
if (response.data.longitude == null || response.data.latitude == null) {
this.devicePos = [];
} else {
this.devicePos = [response.data.longitude, response.data.latitude];
}
});
//查询关联设备信息数据
queryDeviceInfoByUserId(userId).then(response => {
this.DetailInfoList = response.data;
this.loadings = false;
});
},
/** 提交按钮 */
submitForm() {
if (this.form.userType === '1' && this.form.villageId == null ) {
alert("当用户类型是 ‘居民用户’ 时,居住区(村、庄) 必选");
return
}
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.userId != null) {
var tDeviceInfon={
yehuaqiUser:this.form,
yehuaqiuserSafetyDeviceInfos:this.DetailInfoList
}
updateUserAndSafetyDevice(JSON.stringify(tDeviceInfon)).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
var tDeviceInfon={
yehuaqiUser:this.form,
yehuaqiuserSafetyDeviceInfos:this.DetailInfoList
}
addUserAndSafetyDevice(JSON.stringify(tDeviceInfon)).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const userIds = row.userId || this.ids;
this.$confirm('是否确认删除燃气用户编号为"' + userIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delUser(userIds);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有燃气用户数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return newExportUser(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
},
/**
* 经纬度坐标方法
*/
MapdialogFun() {
this.dialogTableVisibles = true;
},
/**
* 地图关闭方法
*/
dialogcancelFun() {
this.dialogTableVisibles = false;
},
/**
* 经纬度 选择
* @param res
*/
getPath(res){
//确认选择经纬度
this.form.longitude = res[0];
this.form.latitude = res[1];
}
}
};
</script>
<style scoped>
.tableTitle {
position: relative;
margin: 24px auto;
width: 600px;
height: 2px;
background-color: #d4d4d4;
text-align: center;
font-size: 16px;
color: rgba(101, 101, 101, 1);
}
.midText {
position: absolute;
left: 3%;
background-color: #ffffff;
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
...@@ -34,11 +34,11 @@ module.exports = { ...@@ -34,11 +34,11 @@ module.exports = {
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
// target: `http://localhost:8905/gassafety`, target: `http://localhost:8905/gassafety`,
// target: `http://27.128.233.145:8905/gassafety`, // target: `http://27.128.233.145:8905/gassafety`,
// target: `http://36.138.180.82:8905/gassafety`, // target: `http://36.138.180.82:8905/gassafety`,
// 服务器 // 服务器
target: `http://36.138.180.82:8079//gassafety`, // target: `http://36.138.180.82:8079//gassafety`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
["^" + process.env.VUE_APP_BASE_API]: "", ["^" + process.env.VUE_APP_BASE_API]: "",
......
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