Commit 143e9a2d authored by wanghao's avatar wanghao

1 液化石油气监管-安检记录导入-跟液化气用户关联-功能开发

parent 36ace8f5
package com.zehong.web.controller.lpgRegulation; package com.zehong.web.controller.lpgRegulation;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import com.zehong.common.core.domain.entity.SysRole;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.vo.TLpgDeliveryRecordImportVo;
import com.zehong.system.domain.vo.TLpgSafeCheckRecordImportVo;
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;
...@@ -19,6 +26,9 @@ import com.zehong.system.domain.TLpgSafeCheckRecord; ...@@ -19,6 +26,9 @@ import com.zehong.system.domain.TLpgSafeCheckRecord;
import com.zehong.system.service.ITLpgSafeCheckRecordService; import com.zehong.system.service.ITLpgSafeCheckRecordService;
import com.zehong.common.utils.poi.ExcelUtil; import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo; import com.zehong.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
/** /**
* 液化石油安检记录Controller * 液化石油安检记录Controller
...@@ -94,4 +104,52 @@ public class TLpgSafeCheckRecordController extends BaseController ...@@ -94,4 +104,52 @@ public class TLpgSafeCheckRecordController extends BaseController
{ {
return toAjax(tLpgSafeCheckRecordService.deleteTLpgSafeCheckRecordByIds(safeCheckIds)); return toAjax(tLpgSafeCheckRecordService.deleteTLpgSafeCheckRecordByIds(safeCheckIds));
} }
/**
* 模版下载
* @return r
*/
@GetMapping("/importTemplate")
public AjaxResult importTemplate(){
ExcelUtil<TLpgSafeCheckRecordImportVo> util = new ExcelUtil<>(TLpgSafeCheckRecordImportVo.class);
return util.importTemplateExcel("安检记录数据");
}
/**
* 文件导入- 只支持 企业端导入
* @param file f
* @param updateSupport u
* @return r
* @throws Exception r
*/
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport, HttpServletResponse response) throws Exception
{
if(!isEnterprise()) {
return AjaxResult.error("只支持 企业端导入!!!");
}
ExcelUtil<TLpgSafeCheckRecordImportVo> util = new ExcelUtil<>(TLpgSafeCheckRecordImportVo.class);
List<TLpgSafeCheckRecordImportVo> XmbhList = util.importExcel(file.getInputStream());
String deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
HashMap<String, Object> map = tLpgSafeCheckRecordService.importLpgSafeCheckRecordInfo(XmbhList, updateSupport, deptId, response);
return AjaxResult.success(map);
}
/**
* 判断是否为企业
* @return r
*/
private boolean isEnterprise(){
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
List<String> roleKeys = roles.stream().map(item -> item.getRoleKey()).collect(Collectors.toList());
return roleKeys.contains("qy");
}
} }
...@@ -22,7 +22,7 @@ public class TLpgSafeCheckRecord extends BaseEntity ...@@ -22,7 +22,7 @@ public class TLpgSafeCheckRecord extends BaseEntity
/** 储配站 */ /** 储配站 */
@Excel(name = "储配站") @Excel(name = "储配站")
private Long stationName; private String stationName;
/** 用户名 */ /** 用户名 */
@Excel(name = "用户名") @Excel(name = "用户名")
...@@ -117,21 +117,23 @@ public class TLpgSafeCheckRecord extends BaseEntity ...@@ -117,21 +117,23 @@ public class TLpgSafeCheckRecord extends BaseEntity
//@Excel(name = "删除状态:0.否 1.是") //@Excel(name = "删除状态:0.否 1.是")
private String isDel; private String isDel;
private Long userId;
public void setSafeCheckId(Long safeCheckId) public void setSafeCheckId(Long safeCheckId)
{ {
this.safeCheckId = safeCheckId; this.safeCheckId = safeCheckId;
} }
public Long getSafeCheckId() public Long getSafeCheckId()
{ {
return safeCheckId; return safeCheckId;
} }
public void setStationName(Long stationName) public void setStationName(String stationName)
{ {
this.stationName = stationName; this.stationName = stationName;
} }
public Long getStationName() public String getStationName()
{ {
return stationName; return stationName;
} }
...@@ -343,6 +345,14 @@ public class TLpgSafeCheckRecord extends BaseEntity ...@@ -343,6 +345,14 @@ public class TLpgSafeCheckRecord extends BaseEntity
return isDel; return isDel;
} }
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
@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.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zehong.common.annotation.Excel;
import java.util.Date;
/**
* 液化石油安检记录 t_lpg_safe_check_record
*
* @author zehong
* @date 2024-09-11
*/
public class TLpgSafeCheckRecordImportVo {
/** 储配站 */
@Excel(name = "储配站")
private String stationName;
/** 用户账号 */
@Excel(name = "用户自有编号")
private String userOwnId;
/** 用户名 */
@Excel(name = "用户名")
private String gasUser;
/** 联系电话 */
@Excel(name = "联系电话")
private String telNum;
/** 用户地址 */
@Excel(name = "用户地址")
private String gasUserAddress;
/** 0.居民 1.非居民 */
@Excel(name = "用户类型",readConverterExp = "0=居民,1=非居民",combo = "居民,非居民")
private String gasUserType;
/** 安检时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "安检时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date safeCheckDate;
/** 安检人 */
@Excel(name = "安检人")
private String safeCheckPerson;
/** 气瓶数量 */
@Excel(name = "气瓶数量")
private Integer bottleNum;
/** 入户状态:0.正常入户 1.拒绝安检 */
@Excel(name = "入户状态",readConverterExp = "0=正常入户,1=拒绝安检",combo = "正常入户,拒绝安检")
private String checkInStatus;
/** 燃气灶具检查情况:0.合格 1.无3C认证 2.无熄火保护装置 */
@Excel(name = "燃气灶具检查情况",readConverterExp = "0=合格,1=无3C认证,2=无熄火保护装置",combo = "合格,无3C认证,无熄火保护装置",width = 25)
private String stoveCheckStatus;
/** 连接软管检查情况:0.合格 1.普通橡胶软管 2.三通连接软管 3.长度超过两米且未使用硬质钢管链接 4.穿越墙体、门窗顶棚和地面 */
@Excel(name = "连接软管检查情况",readConverterExp = "0=合格,1=普通橡胶软管,2=三通连接软管,3=长度超过两米且未使用硬质钢管链接,4=穿越墙体、门窗顶棚和地面",combo = "合格,普通橡胶软管,三通连接软管,长度超过两米且未使用硬质钢管链接,穿越墙体、门窗顶棚和地面",width = 25)
private String hoseCheckStatus;
/** 减压阀检查情况:0.合格 1.可调节 2.五自闭功能 */
@Excel(name = "减压阀检查情况",readConverterExp = "0=合格,1=可调节,2=五自闭功能",combo = "合格,可调节,五自闭功能",width = 25)
private String valveCheckStatus;
/** 液化气钢瓶检查情况:0.合格 1.部分有码且可追溯 2.有码但不可追溯 3.钢瓶无码 */
@Excel(name = "液化气钢瓶检查情况",readConverterExp = "0=合格,1=部分有码且可追溯,2=有码但不可追溯,3=钢瓶无码",combo = "合格,部分有码且可追溯,有码但不可追溯,钢瓶无码",width = 25)
private String bottleCheckStatus;
/** 报警器加电磁切断阀检查情况:0.合格 1.有但未使用 2.有但未实现联动 3.无 4.非液化气专用报警器 5.安装位置大于0.3米 */
@Excel(name = "报警器加电磁切断阀检查情况",readConverterExp = "0=合格,1=有但未使用,2=有但未实现联动,3=无,4=非液化气专用报警器,5=安装位置大于0.3米",combo = "合格,有但未使用,有但未实现联动,无,非液化气专用报警器,安装位置大于0.3米",width = 25)
private String alarmCheckStatus;
/** 用气场所检查情况:0.合格 1.高层建筑(裙房) 2.地下(半地下)室 3.车库或半地下车库 4.通风不良的场所 5.50公斤钢瓶超过两只或15公斤钢瓶超过七只未设置独立的气瓶间 */
@Excel(name = "用气场所检查情况", readConverterExp = "0=合格,1=高层建筑(裙房),2=地下(半地下)室,3=车库或半地下车库,4=通风不良的场所 5=50公斤钢瓶超过两只或15公斤钢瓶超过七只未设置独立的气瓶间",combo = "合格,高层建筑(裙房),地下(半地下)室,车库或半地下车库,通风不良的场所,50公斤钢瓶超过两只或15公斤钢瓶超过七只未设置独立的气瓶间",width = 25)
private String placeCheckStatus;
public String getStationName() {
return stationName;
}
public void setStationName(String stationName) {
this.stationName = stationName;
}
public String getUserOwnId() {
return userOwnId;
}
public void setUserOwnId(String userOwnId) {
this.userOwnId = userOwnId;
}
public String getGasUser() {
return gasUser;
}
public void setGasUser(String gasUser) {
this.gasUser = gasUser;
}
public String getTelNum() {
return telNum;
}
public void setTelNum(String telNum) {
this.telNum = telNum;
}
public String getGasUserAddress() {
return gasUserAddress;
}
public void setGasUserAddress(String gasUserAddress) {
this.gasUserAddress = gasUserAddress;
}
public String getGasUserType() {
return gasUserType;
}
public void setGasUserType(String gasUserType) {
this.gasUserType = gasUserType;
}
public Date getSafeCheckDate() {
return safeCheckDate;
}
public void setSafeCheckDate(Date safeCheckDate) {
this.safeCheckDate = safeCheckDate;
}
public String getSafeCheckPerson() {
return safeCheckPerson;
}
public void setSafeCheckPerson(String safeCheckPerson) {
this.safeCheckPerson = safeCheckPerson;
}
public Integer getBottleNum() {
return bottleNum;
}
public void setBottleNum(Integer bottleNum) {
this.bottleNum = bottleNum;
}
public String getCheckInStatus() {
return checkInStatus;
}
public void setCheckInStatus(String checkInStatus) {
this.checkInStatus = checkInStatus;
}
public String getStoveCheckStatus() {
return stoveCheckStatus;
}
public void setStoveCheckStatus(String stoveCheckStatus) {
this.stoveCheckStatus = stoveCheckStatus;
}
public String getHoseCheckStatus() {
return hoseCheckStatus;
}
public void setHoseCheckStatus(String hoseCheckStatus) {
this.hoseCheckStatus = hoseCheckStatus;
}
public String getValveCheckStatus() {
return valveCheckStatus;
}
public void setValveCheckStatus(String valveCheckStatus) {
this.valveCheckStatus = valveCheckStatus;
}
public String getBottleCheckStatus() {
return bottleCheckStatus;
}
public void setBottleCheckStatus(String bottleCheckStatus) {
this.bottleCheckStatus = bottleCheckStatus;
}
public String getAlarmCheckStatus() {
return alarmCheckStatus;
}
public void setAlarmCheckStatus(String alarmCheckStatus) {
this.alarmCheckStatus = alarmCheckStatus;
}
public String getPlaceCheckStatus() {
return placeCheckStatus;
}
public void setPlaceCheckStatus(String placeCheckStatus) {
this.placeCheckStatus = placeCheckStatus;
}
}
package com.zehong.system.mapper; package com.zehong.system.mapper;
import java.util.List; import java.util.List;
import com.zehong.system.domain.TLpgSafeCheckRecord; import com.zehong.system.domain.TLpgSafeCheckRecord;
import org.apache.ibatis.annotations.Param;
/** /**
* 液化石油安检记录Mapper接口 * 液化石油安检记录Mapper接口
...@@ -35,6 +37,12 @@ public interface TLpgSafeCheckRecordMapper ...@@ -35,6 +37,12 @@ public interface TLpgSafeCheckRecordMapper
*/ */
public int insertTLpgSafeCheckRecord(TLpgSafeCheckRecord tLpgSafeCheckRecord); public int insertTLpgSafeCheckRecord(TLpgSafeCheckRecord tLpgSafeCheckRecord);
/**
* 批量增加
* @param list list
* @return r
*/
public int insertBatch(@Param("list") List<TLpgSafeCheckRecord> list);
/** /**
* 修改液化石油安检记录 * 修改液化石油安检记录
* *
......
package com.zehong.system.service; package com.zehong.system.service;
import java.util.HashMap;
import java.util.List; import java.util.List;
import com.zehong.system.domain.TLpgSafeCheckRecord; import com.zehong.system.domain.TLpgSafeCheckRecord;
import com.zehong.system.domain.vo.TLpgSafeCheckRecordImportVo;
import javax.servlet.http.HttpServletResponse;
/** /**
* 液化石油安检记录Service接口 * 液化石油安检记录Service接口
...@@ -51,6 +55,14 @@ public interface ITLpgSafeCheckRecordService ...@@ -51,6 +55,14 @@ public interface ITLpgSafeCheckRecordService
*/ */
public int deleteTLpgSafeCheckRecordByIds(Long[] safeCheckIds); public int deleteTLpgSafeCheckRecordByIds(Long[] safeCheckIds);
/**
* 导入
* @param XmbhList data
* @param updateSupport 是否更新
* @param response res
* @return r
*/
public HashMap<String, Object> importLpgSafeCheckRecordInfo(List<TLpgSafeCheckRecordImportVo> XmbhList,boolean updateSupport,String deptId,HttpServletResponse response);
/** /**
* 删除液化石油安检记录信息 * 删除液化石油安检记录信息
* *
......
package com.zehong.system.service.impl; package com.zehong.system.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.TYehuaqiUser;
import com.zehong.system.domain.vo.TLpgSafeCheckRecordImportVo;
import com.zehong.system.mapper.TYehuaqiUserMapper;
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.TLpgSafeCheckRecordMapper; import com.zehong.system.mapper.TLpgSafeCheckRecordMapper;
import com.zehong.system.domain.TLpgSafeCheckRecord; import com.zehong.system.domain.TLpgSafeCheckRecord;
import com.zehong.system.service.ITLpgSafeCheckRecordService; import com.zehong.system.service.ITLpgSafeCheckRecordService;
import sun.swing.StringUIClientPropertyKey;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
/** /**
* 液化石油安检记录Service业务层处理 * 液化石油安检记录Service业务层处理
...@@ -17,9 +27,12 @@ import com.zehong.system.service.ITLpgSafeCheckRecordService; ...@@ -17,9 +27,12 @@ import com.zehong.system.service.ITLpgSafeCheckRecordService;
@Service @Service
public class TLpgSafeCheckRecordServiceImpl implements ITLpgSafeCheckRecordService public class TLpgSafeCheckRecordServiceImpl implements ITLpgSafeCheckRecordService
{ {
@Autowired @Resource
private TLpgSafeCheckRecordMapper tLpgSafeCheckRecordMapper; private TLpgSafeCheckRecordMapper tLpgSafeCheckRecordMapper;
@Resource
private TYehuaqiUserMapper yehuaqiUserMapper;
/** /**
* 查询液化石油安检记录 * 查询液化石油安检记录
* *
...@@ -82,6 +95,95 @@ public class TLpgSafeCheckRecordServiceImpl implements ITLpgSafeCheckRecordServi ...@@ -82,6 +95,95 @@ public class TLpgSafeCheckRecordServiceImpl implements ITLpgSafeCheckRecordServi
return tLpgSafeCheckRecordMapper.deleteTLpgSafeCheckRecordByIds(safeCheckIds); return tLpgSafeCheckRecordMapper.deleteTLpgSafeCheckRecordByIds(safeCheckIds);
} }
/**
* 导入
* @param XmbhList data
* @param updateSupport 是否更新
* @param response res
* @return r
*/
@Override
public HashMap<String, Object> importLpgSafeCheckRecordInfo(List<TLpgSafeCheckRecordImportVo> XmbhList, boolean updateSupport, String deptId,HttpServletResponse response) {
int errorNum = 0;
int successNum = 0;
List<TLpgSafeCheckRecord> lpgSafeCheckRecords = new ArrayList<>();
TLpgSafeCheckRecord lpgSafeCheckRecord = null;
for (TLpgSafeCheckRecordImportVo tLpgSafeCheckRecordImportVo : XmbhList) {
lpgSafeCheckRecord = new TLpgSafeCheckRecord();
if (StringUtils.isBlank(tLpgSafeCheckRecordImportVo.getGasUser())
&& StringUtils.isBlank(tLpgSafeCheckRecordImportVo.getTelNum())
&& StringUtils.isBlank(tLpgSafeCheckRecordImportVo.getGasUserAddress())
&& StringUtils.isBlank(tLpgSafeCheckRecordImportVo.getUserOwnId())) {
errorNum++;
continue;
}
if ((StringUtils.isBlank(tLpgSafeCheckRecordImportVo.getGasUser())
|| StringUtils.isBlank(tLpgSafeCheckRecordImportVo.getTelNum())
|| StringUtils.isBlank(tLpgSafeCheckRecordImportVo.getGasUserAddress()))
&& StringUtils.isBlank(tLpgSafeCheckRecordImportVo.getUserOwnId())) {
errorNum++;
continue;
}
if (StringUtils.isNotBlank(tLpgSafeCheckRecordImportVo.getUserOwnId())) {
TYehuaqiUser yehuaqiUser = yehuaqiUserMapper.selectByUserOwnIdAndBeyondEnterpriseId(deptId,tLpgSafeCheckRecordImportVo.getUserOwnId());
if (yehuaqiUser == null) {
List<TYehuaqiUser> yehuaqiUsers = yehuaqiUserMapper.selectByUsernameAndPhoneAndAddress(tLpgSafeCheckRecordImportVo.getGasUser(),
tLpgSafeCheckRecordImportVo.getTelNum(), tLpgSafeCheckRecordImportVo.getGasUserAddress());
if (yehuaqiUsers==null || yehuaqiUsers.size() == 0) {
errorNum ++;
continue;
}
lpgSafeCheckRecord.setUserId(yehuaqiUsers.get(0).getUserId());
} else {
lpgSafeCheckRecord.setUserId(yehuaqiUser.getUserId());
}
} else {
List<TYehuaqiUser> yehuaqiUsers = yehuaqiUserMapper.selectByUsernameAndPhoneAndAddress(tLpgSafeCheckRecordImportVo.getGasUser(),
tLpgSafeCheckRecordImportVo.getTelNum(), tLpgSafeCheckRecordImportVo.getGasUserAddress());
if (yehuaqiUsers==null || yehuaqiUsers.size() == 0) {
errorNum ++;
continue;
}
lpgSafeCheckRecord.setUserId(yehuaqiUsers.get(0).getUserId());
}
lpgSafeCheckRecord.setStationName(tLpgSafeCheckRecordImportVo.getStationName());
lpgSafeCheckRecord.setGasUserType(tLpgSafeCheckRecordImportVo.getGasUserType());
lpgSafeCheckRecord.setTelNum(tLpgSafeCheckRecordImportVo.getTelNum());
lpgSafeCheckRecord.setGasUserAddress(tLpgSafeCheckRecordImportVo.getGasUserAddress());
lpgSafeCheckRecord.setSafeCheckDate(tLpgSafeCheckRecordImportVo.getSafeCheckDate());
lpgSafeCheckRecord.setSafeCheckPerson(tLpgSafeCheckRecordImportVo.getSafeCheckPerson());
lpgSafeCheckRecord.setBottleNum(tLpgSafeCheckRecordImportVo.getBottleNum());
lpgSafeCheckRecord.setCheckInStatus(tLpgSafeCheckRecordImportVo.getCheckInStatus());
// 六种状态
lpgSafeCheckRecord.setStoveCheckStatus(tLpgSafeCheckRecordImportVo.getStoveCheckStatus());
lpgSafeCheckRecord.setHoseCheckStatus(tLpgSafeCheckRecordImportVo.getHoseCheckStatus());
lpgSafeCheckRecord.setValveCheckStatus(tLpgSafeCheckRecordImportVo.getValveCheckStatus());
lpgSafeCheckRecord.setBottleCheckStatus(tLpgSafeCheckRecordImportVo.getBottleCheckStatus());
lpgSafeCheckRecord.setAlarmCheckStatus(tLpgSafeCheckRecordImportVo.getAlarmCheckStatus());
lpgSafeCheckRecord.setPlaceCheckStatus(tLpgSafeCheckRecordImportVo.getPlaceCheckStatus());
lpgSafeCheckRecords.add(lpgSafeCheckRecord);
successNum++;
}
if (lpgSafeCheckRecords.size() > 0) {
tLpgSafeCheckRecordMapper.insertBatch(lpgSafeCheckRecords);
}
HashMap<String,Object> map = new HashMap<>();
map.put("errorNum",errorNum);
map.put("successNum",successNum);
return map;
}
/** /**
* 删除液化石油安检记录信息 * 删除液化石油安检记录信息
* *
......
...@@ -33,17 +33,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -33,17 +33,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="isDel" column="is_del" /> <result property="isDel" column="is_del" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="userId" column="user_id" />
</resultMap> </resultMap>
<sql id="selectTLpgSafeCheckRecordVo"> <sql id="selectTLpgSafeCheckRecordVo">
select safe_check_id, station_name, gas_user, gas_user_type, gas_user_address, tel_num, safe_check_date, safe_check_person, bottle_num, check_in_status, stove_check_status, stove_check_pic, hose_check_status, hose_check_pic, valve_check_status, valve_check_pic, bottle_check_status, bottle_check_pic, alarm_check_status, alarm_check_pic, place_check_status, place_check_pic, check_person_sign, gas_user_sign, create_time, update_time, is_del, remark from t_lpg_safe_check_record select record.safe_check_id,
record.station_name,
yhqser.nick_name as gas_user,
record.gas_user_type,
record.gas_user_address,
record.tel_num,
record.safe_check_date,
record.safe_check_person,
record.bottle_num,
record.check_in_status,
record.stove_check_status,
record.stove_check_pic,
record.hose_check_status,
record.hose_check_pic,
record.valve_check_status,
record.valve_check_pic,
record.bottle_check_status,
record.bottle_check_pic,
record.alarm_check_status,
record.alarm_check_pic,
record.place_check_status,
record.place_check_pic,
record.check_person_sign,
record.gas_user_sign,
record.create_time,
record.update_time,
record.is_del,
record.remark
from t_lpg_safe_check_record record
left join t_yehuaqi_user yhqser on record.user_id = yhqser.user_id
</sql> </sql>
<select id="selectTLpgSafeCheckRecordList" parameterType="TLpgSafeCheckRecord" resultMap="TLpgSafeCheckRecordResult"> <select id="selectTLpgSafeCheckRecordList" parameterType="TLpgSafeCheckRecord" resultMap="TLpgSafeCheckRecordResult">
<include refid="selectTLpgSafeCheckRecordVo"/> <include refid="selectTLpgSafeCheckRecordVo"/>
<where> <where>
<if test="stationName != null "> and station_name like concat('%', #{stationName}, '%')</if> <if test="stationName != null "> and station_name like concat('%', #{stationName}, '%')</if>
<if test="gasUser != null and gasUser != ''"> and gas_user = #{gasUser}</if> <if test="gasUser != null and gasUser != ''"> and yhqser.nick_name like concat('%',#{gasUser}, '%')</if>
<if test="gasUserType != null and gasUserType != ''"> and gas_user_type = #{gasUserType}</if> <if test="gasUserType != null and gasUserType != ''"> and gas_user_type = #{gasUserType}</if>
<if test="gasUserAddress != null and gasUserAddress != ''"> and gas_user_address = #{gasUserAddress}</if> <if test="gasUserAddress != null and gasUserAddress != ''"> and gas_user_address = #{gasUserAddress}</if>
<if test="telNum != null and telNum != ''"> and tel_num = #{telNum}</if> <if test="telNum != null and telNum != ''"> and tel_num = #{telNum}</if>
...@@ -73,12 +103,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -73,12 +103,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectTLpgSafeCheckRecordVo"/> <include refid="selectTLpgSafeCheckRecordVo"/>
where safe_check_id = #{safeCheckId} where safe_check_id = #{safeCheckId}
</select> </select>
<insert id="insertBatch" parameterType="list">
insert into t_lpg_safe_check_record (station_name, user_id,gas_user_type,gas_user_address,tel_num,safe_check_date,
safe_check_person,bottle_num,check_in_status,stove_check_status,hose_check_status,valve_check_status,bottle_check_status,
alarm_check_status,place_check_status)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.stationName,jdbcType=VARCHAR}, #{item.userId}, #{item.gasUserType,jdbcType=VARCHAR},
#{item.gasUserAddress,jdbcType=VARCHAR}, #{item.telNum,jdbcType=VARCHAR}, #{item.safeCheckDate},
#{item.safeCheckPerson},#{item.bottleNum},#{item.checkInStatus},#{item.stoveCheckStatus},
#{item.hoseCheckStatus},#{item.valveCheckStatus},#{item.bottleCheckStatus},#{item.alarmCheckStatus},#{item.placeCheckStatus}
)
</foreach>
</insert>
<insert id="insertTLpgSafeCheckRecord" parameterType="TLpgSafeCheckRecord" useGeneratedKeys="true" keyProperty="safeCheckId"> <insert id="insertTLpgSafeCheckRecord" parameterType="TLpgSafeCheckRecord" useGeneratedKeys="true" keyProperty="safeCheckId">
insert into t_lpg_safe_check_record insert into t_lpg_safe_check_record
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stationName != null">station_name,</if> <if test="stationName != null">station_name,</if>
<if test="gasUser != null">gas_user,</if> <if test="userId != null">user_id,</if>
<if test="gasUserType != null">gas_user_type,</if> <if test="gasUserType != null">gas_user_type,</if>
<if test="telNum != null">tel_num,</if> <if test="telNum != null">tel_num,</if>
<if test="gasUserAddress != null">gas_user_address,</if> <if test="gasUserAddress != null">gas_user_address,</if>
...@@ -107,7 +152,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -107,7 +152,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stationName != null">#{stationName},</if> <if test="stationName != null">#{stationName},</if>
<if test="gasUser != null">#{gasUser},</if> <if test="userId != null">#{userId},</if>
<if test="gasUserType != null">#{gasUserType},</if> <if test="gasUserType != null">#{gasUserType},</if>
<if test="telNum != null">#{telNum},</if> <if test="telNum != null">#{telNum},</if>
<if test="gasUserAddress != null">#{gasUserAddress},</if> <if test="gasUserAddress != null">#{gasUserAddress},</if>
...@@ -140,7 +185,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -140,7 +185,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update t_lpg_safe_check_record update t_lpg_safe_check_record
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="stationName != null">station_name = #{stationName},</if> <if test="stationName != null">station_name = #{stationName},</if>
<if test="gasUser != null">gas_user = #{gasUser},</if> <if test="userId != null">user_id = #{userId},</if>
<if test="gasUserType != null">gas_user_type = #{gasUserType},</if> <if test="gasUserType != null">gas_user_type = #{gasUserType},</if>
<if test="telNum != null">tel_num = #{telNum},</if> <if test="telNum != null">tel_num = #{telNum},</if>
<if test="gasUserAddress != null">gas_user_address = #{gasUserAddress},</if> <if test="gasUserAddress != null">gas_user_address = #{gasUserAddress},</if>
......
...@@ -51,3 +51,12 @@ export function exportRecord(query) { ...@@ -51,3 +51,12 @@ export function exportRecord(query) {
params: query params: query
}) })
} }
// 下载用户导入模板
export function importTemplate() {
return request({
url: '/lpg/check/importTemplate',
method: 'get'
})
}
\ No newline at end of file
...@@ -80,6 +80,17 @@ ...@@ -80,6 +80,17 @@
@click="handleExport" @click="handleExport"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="info"
icon="el-icon-upload2"
size="mini"
v-if="user.roleId==5"
@click="handleImport">导入</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
...@@ -248,12 +259,44 @@ ...@@ -248,12 +259,44 @@
<!-- 详情 --> <!-- 详情 -->
<DetailInfo ref="detail"/> <DetailInfo ref="detail"/>
<!-- 用户导入对话框 -->
<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>仅允许导入xlsxlsx格式文件。</span>
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
<br>
</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>
</div> </div>
</template> </template>
<script> <script>
import { listRecord, getRecord, delRecord, addRecord, updateRecord, exportRecord } from "@/api/lpgRegulation/check"; import { listRecord, getRecord, delRecord, addRecord, updateRecord, exportRecord,importTemplate} from "@/api/lpgRegulation/check";
import DetailInfo from "./components/DetailInfo"; import DetailInfo from "./components/DetailInfo";
import{getInfo} from "@/api/login"
import { getToken } from "@/utils/auth";
export default { export default {
name: "Record", name: "Record",
components: { components: {
...@@ -261,6 +304,23 @@ export default { ...@@ -261,6 +304,23 @@ export default {
}, },
data() { data() {
return { return {
upload: {
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: "",
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的用户数据
updateSupport: 0,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/lpg/check/importData"
},
user:{},
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 导出遮罩层 // 导出遮罩层
...@@ -317,9 +377,48 @@ export default { ...@@ -317,9 +377,48 @@ export default {
}; };
}, },
created() { created() {
this.getuserInfo();
this.getList(); this.getList();
}, },
methods: { methods: {
getuserInfo(){
getInfo().then(response => {
this.user = response.user.roles[0]
});
},
/** 下载模板操作 */
importTemplate() {
importTemplate().then(response => {
this.download(response.msg);
});
},
handleImport(){
this.upload.title = "配送记录导入"; // todo
this.upload.open = 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.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + "成功:" + response.data.successNum + "条,失败:" + response.data.errorNum + "条" + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.getList();
},
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit();
},
/** 查询液化石油安检记录列表 */ /** 查询液化石油安检记录列表 */
getList() { getList() {
this.loading = true; this.loading = true;
......
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