Commit 130ca818 authored by wanghao's avatar wanghao

1 基础信息维护下 的 天然气用户 和 液化石油气监管下的 液化气用户 由之前的两张表 合并成 一张表处理,实现中。

parent f4231d1a
......@@ -398,7 +398,7 @@ public class TDetectorUserController extends BaseController
* @throws IOException i
*/
@GetMapping("/exportErrorData")
public void exportErrorData(HttpServletResponse response) throws IOException {
public void exportErrorData(HttpServletResponse response,String gasType) throws IOException {
//判断是否是 windows环境,
String osName = System.getProperty("os.name").toLowerCase();
......@@ -418,7 +418,7 @@ public class TDetectorUserController extends BaseController
file = ResourceUtils.getFile("/data/java/baseversion/importTemplate/燃气用户错误导入数据模版.xlsx");
}
List<TDetectorUser> tDetectorUsers = tDetectorUserService.queryErrorDetectorUserList();
List<TDetectorUser> tDetectorUsers = tDetectorUserService.queryErrorDetectorUserList(gasType);
List<UserManageGasUserExportVo> userManageGasUserExportVos = new ArrayList<>();
for (TDetectorUser tDetectorUser : tDetectorUsers) {
......@@ -449,6 +449,62 @@ public class TDetectorUserController extends BaseController
}
}
/**
* 自定义-模版下载
* @param response r
* @throws IOException i
*/
@GetMapping("/downloadLiquefiedGasTemplate")
public void downloadLiquefiedGasTemplate(HttpServletResponse response) {
//判断是否是 windows环境,
String osName = System.getProperty("os.name").toLowerCase();
try {
File file;
//如果是本地或测试环境
if (osName.contains("windows")) {
String filePath = "importTemplate/液化气用户导入模版.xlsx";
//用来读取resources下的文件
Resource resource = new ClassPathResource(filePath);
file = resource.getFile();
} else {
file = ResourceUtils.getFile("/data/java/baseversion/importTemplate/液化气用户导入模版.xlsx");
}
// 获取文件名
String filename = file.getName();
// 将文件写入输入流
FileInputStream fileInputStream = new FileInputStream(file);
InputStream fis = new BufferedInputStream(fileInputStream);
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
fis.close();
// 清空response
response.reset();
// 设置response的Header
response.setCharacterEncoding("UTF-8");
//Content-Disposition的作用:告知浏览器以何种方式显示响应返回的文件,用浏览器打开还是以附件的形式下载到本地保存
//attachment表示以附件方式下载 inline表示在线打开 "Content-Disposition: inline; filename=文件名.mp3"
// filename表示文件的默认名称,因为网络传输只支持URL编码的相关支付,因此需要将文件名URL编码后进行传输,前端收到后需要反编码才能获取到真正的名称
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8"));
// 告知浏览器文件的大小
response.addHeader("Content-Length", "" + file.length());
OutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
response.setContentType("application/octet-stream");
outputStream.write(buffer);
outputStream.flush();
} catch (IOException ex) {
ex.printStackTrace();
}
}
/**
* 自定义-模版下载
* @param response r
......@@ -549,9 +605,9 @@ public class TDetectorUserController extends BaseController
* @return i
*/
@GetMapping("/countImportError")
public AjaxResult countImportError()
public AjaxResult countImportError(String gasType)
{
int i = tDetectorUserService.countByBeyondEnterpriseId();
int i = tDetectorUserService.countByBeyondEnterpriseId(gasType);
return AjaxResult.success(i);
}
......@@ -560,8 +616,8 @@ public class TDetectorUserController extends BaseController
*/
@Log(title = "燃气用户错误导入记录", businessType = BusinessType.EXPORT)
@GetMapping("/clearImportError")
public AjaxResult clearImportError()
public AjaxResult clearImportError(String gasType)
{
return AjaxResult.success(tDetectorUserService.clearImportErrorByEnterpriseId());
return AjaxResult.success(tDetectorUserService.clearImportErrorByEnterpriseId(gasType));
}
}
......@@ -100,7 +100,7 @@ public interface TDetectorUserMapper
*/
public List<TDetectorUser> newSelectTDetectorUserList(TDetectorUser tDetectorUser);
public List<TDetectorUser> queryErrorDetectorUserList(String depId);
public List<TDetectorUser> queryErrorDetectorUserList(@Param("depId") String depId,@Param("gasType") String gasType);
public List<TDetectorUser> selectTDetectorListstatus(TDetectorUser tDetectorUser);
......@@ -177,7 +177,8 @@ public interface TDetectorUserMapper
* @param beyondEnterpriseId id
* @return r
*/
public int countByBeyondEnterpriseId(String beyondEnterpriseId);
public int countByBeyondEnterpriseId(@Param("beyondEnterpriseId") String beyondEnterpriseId,
@Param("gasType") String gasType);
/**
......@@ -185,6 +186,7 @@ public interface TDetectorUserMapper
* @param beyondEnterpriseId id
* @return r
*/
public int clearByBeyondEnterpriseId(String beyondEnterpriseId);
public int clearByBeyondEnterpriseId(@Param("beyondEnterpriseId") String beyondEnterpriseId,
@Param("gasType") String gasType);
}
......@@ -114,7 +114,7 @@ public interface ITDetectorUserService
* 查询导入的错误数据
* @return r
*/
public List<TDetectorUser> queryErrorDetectorUserList();
public List<TDetectorUser> queryErrorDetectorUserList(String gasType);
/**
* 查询燃气用户列表
......@@ -231,12 +231,12 @@ public interface ITDetectorUserService
* 根据企业id统计错误数据
* @return r
*/
public int countByBeyondEnterpriseId();
public int countByBeyondEnterpriseId(String code);
/**
* 根据企业id 清除数据
* @return r
*/
public int clearImportErrorByEnterpriseId();
public int clearImportErrorByEnterpriseId(String code);
}
......@@ -808,12 +808,12 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
* @return r
*/
@Override
public List<TDetectorUser> queryErrorDetectorUserList() {
public List<TDetectorUser> queryErrorDetectorUserList(String gasType) {
LoginUser loginUser = SecurityUtils.getLoginUser();
String deptId = loginUser.getUser().getDeptId();
return tDetectorUserMapper.queryErrorDetectorUserList(deptId);
return tDetectorUserMapper.queryErrorDetectorUserList(deptId,gasType);
}
/**
......@@ -1169,12 +1169,12 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
* @return r
*/
@Override
public int countByBeyondEnterpriseId() {
public int countByBeyondEnterpriseId(String gasType) {
LoginUser loginUser = SecurityUtils.getLoginUser();
String deptId = loginUser.getUser().getDeptId();
return tDetectorUserMapper.countByBeyondEnterpriseId(deptId);
return tDetectorUserMapper.countByBeyondEnterpriseId(deptId,gasType);
}
/**
......@@ -1182,10 +1182,10 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
* @return r
*/
@Override
public int clearImportErrorByEnterpriseId() {
public int clearImportErrorByEnterpriseId(String gasType) {
LoginUser loginUser = SecurityUtils.getLoginUser();
String deptId = loginUser.getUser().getDeptId();
return tDetectorUserMapper.clearByBeyondEnterpriseId(deptId);
return tDetectorUserMapper.clearByBeyondEnterpriseId(deptId,gasType);
}
}
......@@ -90,6 +90,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="depId != null and depId != '' and depId != '-2'">
and beyondEnterpriseId = #{depId}
</if>
<if test="gasType != null and gasType == 1"> and gas_type =#{gasType}</if>
<if test="gasType != null and gasType == 0"> and (gas_type =#{gasType} or gas_type is null)</if>
</select>
<select id="selectForExportTDetectorUserList" parameterType="TDetectorUser" resultMap="TDetectorUserExportResult">
......@@ -114,6 +116,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join t_gasuser_safety_device_info deviceInfo on a.user_id = deviceInfo.f_relation_gasUser_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="gasType != null and gasType == 1"> and a.gas_type =#{gasType}</if>
<if test="gasType != null and gasType == 0"> and (a.gas_type =#{gasType} or a.gas_type is null)</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>
<if test="isInspect != null and isInspect == 0">
......@@ -144,6 +148,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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="gasType != null and gasType == 1"> and a.gas_type =#{gasType}</if>
<if test="gasType != null and gasType == 0"> and (a.gas_type =#{gasType} or a.gas_type is null)</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>
<if test="isInspect != null and isInspect == 0">
......@@ -570,13 +576,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="countByBeyondEnterpriseId" parameterType="String" resultType="int">
select count(*) from t_detector_user where error_msg is not null
<if test="beyondEnterpriseId != null and beyondEnterpriseId != '' and beyondEnterpriseId != '-2'">
beyond_enterprise_id = #{beyondEnterpriseId}
and beyond_enterprise_id = #{beyondEnterpriseId}
</if>
<if test="gasType != null and gasType == 1"> and gas_type =#{gasType}</if>
<if test="gasType != null and gasType == 0"> and (gas_type =#{gasType} or gas_type is null)</if>
</select>
<delete id="clearByBeyondEnterpriseId" parameterType="String">
delete from t_detector_user where error_msg is not null
<if test="beyondEnterpriseId != null and beyondEnterpriseId != '' and beyondEnterpriseId != '-2'">
beyond_enterprise_id = #{beyondEnterpriseId}
and beyond_enterprise_id = #{beyondEnterpriseId}
</if>
<if test="gasType != null and gasType == 1"> and gas_type =#{gasType}</if>
<if test="gasType != null and gasType == 0"> and (gas_type =#{gasType} or gas_type is null)</if>
</delete>
</mapper>
......@@ -152,26 +152,26 @@ export function downloadTemplate() {
// 统计错误数量
export function countImportError() {
export function countImportError(gasType) {
return request({
url: '/supervise/user/countImportError',
url: '/supervise/user/countImportError/' + gasType,
method: 'get'
})
}
// 清除错误数据
export function clearImportError() {
export function clearImportError(gasType) {
return request({
url: '/supervise/user/clearImportError',
url: '/supervise/user/clearImportError/' + gasType,
method: 'get'
})
}
// 导出从业人员信息- 错误数据
export function exportErrorData() {
export function exportErrorData(gasType) {
return request({
url: '/supervise/user/exportErrorData',
url: '/supervise/user/exportErrorData/' + gasType,
method: 'get',
responseType: 'blob'
})
......@@ -185,4 +185,15 @@ export function exportSuccessData(query) {
responseType: 'blob',
params: query
})
}
\ No newline at end of file
}
// 下载用户导入模板 - 液化气用户自定义的模版
export function downloadLiquefiedGasTemplate() {
return request({
url: '/supervise/user/downloadLiquefiedGasTemplate',
method: 'get',
responseType: 'blob'
})
}
......@@ -249,15 +249,15 @@
</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="fDeviceName" />
<el-table-column label="设备型号" align="center" prop="fDeviceModel" />
<el-table-column label="设备类型" align="center" prop="fRelationDeviceType" />
<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="fDetectionMedium" />
<el-table-column label="设备安装时间" width="100" align="center" prop="fDeviceInstallTime" />
<el-table-column label="安装位置" align="center" prop="fDeviceInstallPosition" />
<el-table-column label="负责人" align="center" prop="fHead" />
<el-table-column label="联系电话" align="center" prop="fPhone" />
<el-table-column label="探测介质" align="center" 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
......@@ -429,11 +429,17 @@
</template>
<script>
// import { listUser, getUser, delUser,newExportUser,
// getNoSelectSafetyDetailInfo,addSafetyDetailInfo,deleteSafetyDeviceInfo,
// deleteSafetyDeviceListInfo,queryDeviceInfoByUserId,
// addUserAndSafetyDevice,updateUserAndSafetyDevice,downloadTemplate,
// countImportError,clearImportError,exportErrorData,exportSuccessData} from "@/api/lpgRegulation/user";
import { listUser, getUser, delUser,newExportUser,
getNoSelectSafetyDetailInfo,addSafetyDetailInfo,deleteSafetyDeviceInfo,
deleteSafetyDeviceListInfo,queryDeviceInfoByUserId,
addUserAndSafetyDevice,updateUserAndSafetyDevice,downloadTemplate,
countImportError,clearImportError,exportErrorData,exportSuccessData} from "@/api/lpgRegulation/user";
getNoSelectSafetyDetailInfo,addSafetyDetailInfo,deleteSafetyDeviceInfo,
deleteSafetyDeviceListInfo,selectSafetyDeviceDetailInfo,
addUserAndSafetyDevice,updateUserAndSafetyDevice,downloadTemplate,downloadLiquefiedGasTemplate,
countImportError,clearImportError,exportErrorData,exportSuccessData} from "@/api/regulation/user";
import { selectTEnterprise} from "@/api/regulation/supervise";
import { noPageListVillage} from "@/api/regulation/userManagement/village";
import GetPos from '@/components/GetPos';
......@@ -526,6 +532,7 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
gasType:"1",
username: null,
nickName: null,
},
......@@ -541,7 +548,7 @@ export default {
username: null,
nickName: null,
userType: null,
gasType: null,
gasType: "1",
address: null,
longitude: null,
latitude: null,
......@@ -653,7 +660,7 @@ export default {
// 下载燃气用户错误 按钮
downloadImportError() {
exportErrorData().then((res) =>{
exportErrorData("1").then((res) =>{
let blob = new Blob([res], {type: 'data:application/vnd.ms-excel;base64;charset=utf-8'});
......@@ -698,7 +705,7 @@ export default {
//查询 导入错误数据
countImportError() {
countImportError().then(response => {
countImportError("1").then(response => {
this.importError = response.data;
})
},
......@@ -715,7 +722,7 @@ export default {
/** 下载模板操作 */
importTemplate() {
downloadTemplate().then((res) =>{
downloadLiquefiedGasTemplate().then((res) =>{
let blob = new Blob([res], {type: 'data:application/vnd.ms-excel;base64;charset=utf-8'});
......@@ -751,7 +758,7 @@ export default {
this.$refs.upload.clearFiles();
// this.getDataList();
countImportError().then(response => {
countImportError("gasType").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 });
......@@ -948,7 +955,7 @@ export default {
username: null,
nickName: null,
userType: null,
gasType: null,
gasType: "1",
address: null,
longitude: null,
latitude: null,
......@@ -1012,11 +1019,8 @@ export default {
});
//查询关联设备信息数据
queryDeviceInfoByUserId(userId).then(response => {
console.log("this.detailInfoList before = " + this.detailInfoList);
selectSafetyDeviceDetailInfo(userId).then(response => {
this.detailInfoList = response.data;
console.log("this.detailInfoList after = " + this.detailInfoList);
this.loadings = false;
});
},
......
......@@ -74,10 +74,10 @@
<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="gasType" >
<!-- <el-table-column label="燃气类型" align="center" prop="gasType" >
<span slot-scope="scope" v-if="scope.row.gasType">{{scope.row.gasType}}</span>
<span v-else>-</span>
</el-table-column>
</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>
......@@ -159,13 +159,13 @@
</el-row>
<el-row>
<el-col :span="11">
<!-- <el-col :span="11">
<el-form-item label="燃气类型" prop="gasType">
<el-select v-model="form.gasType" placeholder="请选择燃气类型">
<el-option v-for="dict in gasTypeOpers" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
</el-select>
</el-form-item>
</el-col>
</el-col> -->
<el-col :span="11">
<el-form-item label="用户类型" prop="userType">
......@@ -174,6 +174,16 @@
</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>
......@@ -185,15 +195,6 @@
</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>
......@@ -547,6 +548,7 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
gasType:"0",
username: null,
nickName: null,
},
......@@ -562,7 +564,7 @@ export default {
username: null,
nickName: null,
userType: null,
gasType: null,
gasType: "0",
address: null,
longitude: null,
latitude: null,
......@@ -674,7 +676,7 @@ export default {
// 下载燃气用户错误 按钮
downloadImportError() {
exportErrorData().then((res) =>{
exportErrorData("0").then((res) =>{
let blob = new Blob([res], {type: 'data:application/vnd.ms-excel;base64;charset=utf-8'});
......@@ -719,7 +721,7 @@ export default {
//查询 导入错误数据
countImportError() {
countImportError().then(response => {
countImportError("0").then(response => {
this.importError = response.data;
})
},
......@@ -772,7 +774,7 @@ export default {
this.$refs.upload.clearFiles();
// this.getDataList();
countImportError().then(response => {
countImportError("0").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 });
......@@ -968,7 +970,7 @@ export default {
username: null,
nickName: null,
userType: null,
gasType: null,
gasType: "0",
address: null,
longitude: null,
latitude: null,
......
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