Commit b0347b04 authored by 军师中郎将's avatar 军师中郎将

1 从业人员 - 导入后-有错误数据时界面有提示按钮,点击 提示按钮 弹出 可以下载 或 清除错误数据。下载错误数据,按照错误信息 修改后,能再次导入 - 此功能完成

2 从业人员 - 任职岗位 - 由原来的字典配置 调整成 可手动输入形式
parent 82692786
...@@ -5,6 +5,7 @@ import java.util.List; ...@@ -5,6 +5,7 @@ import java.util.List;
import com.zehong.common.config.GassafetyProgressConfig; import com.zehong.common.config.GassafetyProgressConfig;
import com.zehong.common.core.domain.entity.SysUser; import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.SecurityUtils; import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TEmployedPeopleInfoError;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.zehong.common.annotation.Log; import com.zehong.common.annotation.Log;
...@@ -148,15 +149,14 @@ public class TEmployedPeopleInfoController extends BaseController ...@@ -148,15 +149,14 @@ public class TEmployedPeopleInfoController extends BaseController
@PostMapping("/importData") @PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport, HttpServletResponse response) throws Exception public AjaxResult importData(MultipartFile file, boolean updateSupport, HttpServletResponse response) throws Exception
{ {
ExcelUtil<TEmployedPeopleInfo> util = new ExcelUtil<>(TEmployedPeopleInfo.class); ExcelUtil<TEmployedPeopleInfoError> util = new ExcelUtil<>(TEmployedPeopleInfoError.class);
List<TEmployedPeopleInfo> XmbhList = util.importExcel(file.getInputStream()); List<TEmployedPeopleInfoError> XmbhList = util.importExcel(file.getInputStream());
String operName = SecurityUtils.getLoginUser().getUsername(); String operName = SecurityUtils.getLoginUser().getUsername();
String message = tEmployedPeopleInfoService.importEmployedPeopleInfo(XmbhList, updateSupport, operName,response); String message = tEmployedPeopleInfoService.importEmployedPeopleInfo(XmbhList, updateSupport, operName,response);
return AjaxResult.success(message); return AjaxResult.success(message);
} }
/** /**
* 模版下载 * 模版下载
* @return * @return
...@@ -179,4 +179,16 @@ public class TEmployedPeopleInfoController extends BaseController ...@@ -179,4 +179,16 @@ public class TEmployedPeopleInfoController extends BaseController
int i = tEmployedPeopleInfoService.countImportError(); int i = tEmployedPeopleInfoService.countImportError();
return AjaxResult.success(i); return AjaxResult.success(i);
} }
/**
* 查询当前用户导入 从业人员的错误数据总数
* @return
*/
@GetMapping("/queryPeopleOccupationByGroupBy")
public AjaxResult queryPeopleOccupationByGroupBy()
{
List<String> strings = tEmployedPeopleInfoService.queryPeopleOccupationByGroupBy();
return AjaxResult.success(strings);
}
} }
...@@ -59,6 +59,16 @@ public class TEmployedPeopleInfoErrorController extends BaseController ...@@ -59,6 +59,16 @@ public class TEmployedPeopleInfoErrorController extends BaseController
return util.exportExcel(list, "从业人员错误导入记录数据"); return util.exportExcel(list, "从业人员错误导入记录数据");
} }
/**
* 导出从业人员错误导入记录列表
*/
@Log(title = "从业人员错误导入记录", businessType = BusinessType.EXPORT)
@GetMapping("/clearImportError")
public AjaxResult clearImportError()
{
return AjaxResult.success(tEmployedPeopleInfoErrorService.clearImportError());
}
/** /**
* 获取从业人员错误导入记录详细信息 * 获取从业人员错误导入记录详细信息
*/ */
......
package com.zehong.system.domain; package com.zehong.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat; 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.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity; import com.zehong.common.core.domain.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/** /**
* 从业人员信息对象 t_employed_people_info * 从业人员信息对象 t_employed_people_info
...@@ -46,7 +41,7 @@ public class TEmployedPeopleInfo extends BaseEntity ...@@ -46,7 +41,7 @@ public class TEmployedPeopleInfo extends BaseEntity
private String registerExaminationType; private String registerExaminationType;
/** 任职岗位:1.主要负责人 2.安全管理人员3.运行维护和抢修人员 */ /** 任职岗位:1.主要负责人 2.安全管理人员3.运行维护和抢修人员 */
@Excel(name = "任职岗位",dictType = "enterprise_type") @Excel(name = "任职岗位")
private String peopleOccupation; private String peopleOccupation;
/** 发证日期 */ /** 发证日期 */
......
...@@ -40,7 +40,7 @@ public class TEmployedPeopleInfoError extends BaseEntity ...@@ -40,7 +40,7 @@ public class TEmployedPeopleInfoError extends BaseEntity
private String registerExaminationType; private String registerExaminationType;
/** 人员类型:1.主要负责人 2.安全管理人员3.运行维护和抢修人员 */ /** 人员类型:1.主要负责人 2.安全管理人员3.运行维护和抢修人员 */
@Excel(name = "人员类型:1.主要负责人 2.安全管理人员3.运行维护和抢修人员") @Excel(name = "人员类型")
private String peopleOccupation; private String peopleOccupation;
/** 发证日期 */ /** 发证日期 */
......
...@@ -69,4 +69,6 @@ public interface TEmployedPeopleInfoErrorMapper ...@@ -69,4 +69,6 @@ public interface TEmployedPeopleInfoErrorMapper
public int deleteTEmployedPeopleInfoErrorByIds(Long[] employedPeopleErrorIds); public int deleteTEmployedPeopleInfoErrorByIds(Long[] employedPeopleErrorIds);
public int countByCreateByInt(String createBy); public int countByCreateByInt(String createBy);
public int clearImportError(String createBy);
} }
...@@ -72,4 +72,7 @@ public interface TEmployedPeopleInfoMapper ...@@ -72,4 +72,7 @@ public interface TEmployedPeopleInfoMapper
* @return * @return
*/ */
String selectEnterpriseName(String bId); String selectEnterpriseName(String bId);
public List<String> queryPeopleOccupationByGroupBy();
} }
...@@ -65,4 +65,10 @@ public interface ITEmployedPeopleInfoErrorService ...@@ -65,4 +65,10 @@ public interface ITEmployedPeopleInfoErrorService
* @return 结果 * @return 结果
*/ */
public int deleteTEmployedPeopleInfoErrorById(Long employedPeopleErrorId); public int deleteTEmployedPeopleInfoErrorById(Long employedPeopleErrorId);
/**
* 清除从业人员错误数据
* @return r
*/
public int clearImportError();
} }
...@@ -2,6 +2,7 @@ package com.zehong.system.service; ...@@ -2,6 +2,7 @@ package com.zehong.system.service;
import java.util.List; import java.util.List;
import com.zehong.system.domain.TEmployedPeopleInfo; import com.zehong.system.domain.TEmployedPeopleInfo;
import com.zehong.system.domain.TEmployedPeopleInfoError;
import com.zehong.system.domain.TEnterpriseInfo; import com.zehong.system.domain.TEnterpriseInfo;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -82,11 +83,18 @@ public interface ITEmployedPeopleInfoService ...@@ -82,11 +83,18 @@ public interface ITEmployedPeopleInfoService
* @param operName 操作用户 * @param operName 操作用户
* @return 结果 * @return 结果
*/ */
public String importEmployedPeopleInfo(List<TEmployedPeopleInfo> XmbhList, Boolean isUpdateSupport, String operName, HttpServletResponse response); public String importEmployedPeopleInfo(List<TEmployedPeopleInfoError> XmbhList, Boolean isUpdateSupport, String operName, HttpServletResponse response);
/** /**
* 查询当前用户导入 从业人员的错误数据总数 * 查询当前用户导入 从业人员的错误数据总数
* @return * @return
*/ */
public int countImportError(); public int countImportError();
/**
* 查询 人员类型 分组
* @return r
*/
public List<String> queryPeopleOccupationByGroupBy();
} }
package com.zehong.system.service.impl; package com.zehong.system.service.impl;
import java.util.List; import java.util.List;
import com.zehong.common.utils.SecurityUtils;
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.TEmployedPeopleInfoErrorMapper; import com.zehong.system.mapper.TEmployedPeopleInfoErrorMapper;
...@@ -104,4 +106,10 @@ public class TEmployedPeopleInfoErrorServiceImpl implements ITEmployedPeopleInfo ...@@ -104,4 +106,10 @@ public class TEmployedPeopleInfoErrorServiceImpl implements ITEmployedPeopleInfo
{ {
return tEmployedPeopleInfoErrorMapper.deleteTEmployedPeopleInfoErrorById(employedPeopleErrorId); return tEmployedPeopleInfoErrorMapper.deleteTEmployedPeopleInfoErrorById(employedPeopleErrorId);
} }
@Override
public int clearImportError() {
Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
return tEmployedPeopleInfoErrorMapper.countByCreateByInt(userId + "");
}
} }
...@@ -132,15 +132,16 @@ public class TEmployedPeopleInfoServiceImpl implements ITEmployedPeopleInfoServi ...@@ -132,15 +132,16 @@ public class TEmployedPeopleInfoServiceImpl implements ITEmployedPeopleInfoServi
} }
@Override @Override
public String importEmployedPeopleInfo(List<TEmployedPeopleInfo> employedPeopleInfos, Boolean isUpdateSupport, String operName, HttpServletResponse response) { public String importEmployedPeopleInfo(List<TEmployedPeopleInfoError> employedPeopleInfos, Boolean isUpdateSupport, String operName, HttpServletResponse response) {
if (CollectionUtils.isEmpty(employedPeopleInfos)) { if (CollectionUtils.isEmpty(employedPeopleInfos)) {
throw new BaseException("导入数据不能为空! "); throw new BaseException("导入数据不能为空! ");
} }
List<TEmployedPeopleInfoError> failList = new ArrayList<>(); List<TEmployedPeopleInfoError> failList = new ArrayList<>();
TEmployedPeopleInfoError employedPeopleInfoError; TEmployedPeopleInfoError employedPeopleInfoError;
TEmployedPeopleInfo tEmployedPeopleInfoForInsert;
StringBuilder stringBuilder; StringBuilder stringBuilder;
for (TEmployedPeopleInfo tEmployedPeopleInfo : employedPeopleInfos){ for (TEmployedPeopleInfoError tEmployedPeopleInfo : employedPeopleInfos){
stringBuilder = new StringBuilder(); stringBuilder = new StringBuilder();
try { try {
...@@ -158,9 +159,13 @@ public class TEmployedPeopleInfoServiceImpl implements ITEmployedPeopleInfoServi ...@@ -158,9 +159,13 @@ public class TEmployedPeopleInfoServiceImpl implements ITEmployedPeopleInfoServi
TEnterpriseInfo enterpriseInfo = enterpriseInfoMapper.selectTEnterpriseInfoByName(tEmployedPeopleInfo.getBeyondEnterpriseName()); TEnterpriseInfo enterpriseInfo = enterpriseInfoMapper.selectTEnterpriseInfoByName(tEmployedPeopleInfo.getBeyondEnterpriseName());
if (enterpriseInfo == null) { if (enterpriseInfo == null) {
stringBuilder.append("关联企业信息为空|"); stringBuilder.append("关联企业信息不存在|");
} }
// 如果没有错误信息,则判断是否是之前错误的数据,如果是的话,则把之前错误的数据删除
if (tEmployedPeopleInfo.getEmployedPeopleErrorId() != null) {
employedPeopleInfoErrorMapper.deleteTEmployedPeopleInfoErrorById(tEmployedPeopleInfo.getEmployedPeopleErrorId());
}
if(!"".equals(stringBuilder.toString())) { if(!"".equals(stringBuilder.toString())) {
employedPeopleInfoError = new TEmployedPeopleInfoError(); employedPeopleInfoError = new TEmployedPeopleInfoError();
BeanUtils.copyProperties(tEmployedPeopleInfo, employedPeopleInfoError); BeanUtils.copyProperties(tEmployedPeopleInfo, employedPeopleInfoError);
...@@ -170,12 +175,15 @@ public class TEmployedPeopleInfoServiceImpl implements ITEmployedPeopleInfoServi ...@@ -170,12 +175,15 @@ public class TEmployedPeopleInfoServiceImpl implements ITEmployedPeopleInfoServi
continue; continue;
} }
tEmployedPeopleInfoForInsert = new TEmployedPeopleInfo();
BeanUtils.copyProperties(tEmployedPeopleInfo,tEmployedPeopleInfoForInsert);
SysUser user = SecurityUtils.getLoginUser().getUser(); SysUser user = SecurityUtils.getLoginUser().getUser();
tEmployedPeopleInfo.setCreateBy(user.getUserName()); tEmployedPeopleInfoForInsert.setCreateBy(user.getUserName());
tEmployedPeopleInfo.setCreateTime(new Date()); tEmployedPeopleInfoForInsert.setCreateTime(new Date());
tEmployedPeopleInfo.setUpdateTime(new Date()); tEmployedPeopleInfoForInsert.setUpdateTime(new Date());
tEmployedPeopleInfo.setUpdateBy(user.getUserName()); tEmployedPeopleInfoForInsert.setUpdateBy(user.getUserName());
this.insertTEmployedPeopleInfo(tEmployedPeopleInfo);
this.insertTEmployedPeopleInfo(tEmployedPeopleInfoForInsert);
} catch (Exception e) { } catch (Exception e) {
throw new BaseException("导入出错"); throw new BaseException("导入出错");
} }
...@@ -187,7 +195,6 @@ public class TEmployedPeopleInfoServiceImpl implements ITEmployedPeopleInfoServi ...@@ -187,7 +195,6 @@ public class TEmployedPeopleInfoServiceImpl implements ITEmployedPeopleInfoServi
return "导入完成"; return "导入完成";
} }
/** /**
* 查询当前用户导入 从业人员的错误数据总数 * 查询当前用户导入 从业人员的错误数据总数
* @return int * @return int
...@@ -199,4 +206,15 @@ public class TEmployedPeopleInfoServiceImpl implements ITEmployedPeopleInfoServi ...@@ -199,4 +206,15 @@ public class TEmployedPeopleInfoServiceImpl implements ITEmployedPeopleInfoServi
return employedPeopleInfoErrorMapper.countByCreateByInt(userId + ""); return employedPeopleInfoErrorMapper.countByCreateByInt(userId + "");
} }
/**
* 查询人员类型分组
* @return r
*/
@Override
public List<String> queryPeopleOccupationByGroupBy() {
return tEmployedPeopleInfoMapper.queryPeopleOccupationByGroupBy();
}
} }
...@@ -116,4 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -116,4 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="countByCreateByInt" parameterType="String" resultType="int"> <select id="countByCreateByInt" parameterType="String" resultType="int">
select count(*) from t_employed_people_info_error where create_by = #{createBy} select count(*) from t_employed_people_info_error where create_by = #{createBy}
</select> </select>
<delete id="clearImportError" parameterType="String">
delete from t_employed_people_info_error where create_by = #{createBy}
</delete>
</mapper> </mapper>
\ No newline at end of file
...@@ -152,4 +152,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -152,4 +152,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectEnterpriseName" resultType="String"> <select id="selectEnterpriseName" resultType="String">
select enterprise_name from t_enterprise_info where enterprise_id=#{bId} and is_del='0' select enterprise_name from t_enterprise_info where enterprise_id=#{bId} and is_del='0'
</select> </select>
<select id="queryPeopleOccupationByGroupBy" resultType="String">
SELECT
people_occupation
FROM
t_employed_people_info
where COALESCE(people_occupation, '') <![CDATA[<>]]> '' and is_del='0'
GROUP BY
people_occupation
</select>
</mapper> </mapper>
...@@ -109,3 +109,21 @@ export function importErrorexportInfo() { ...@@ -109,3 +109,21 @@ export function importErrorexportInfo() {
method: 'get' method: 'get'
}) })
} }
// 导出从业人员信息- 错误数据
export function clearImportError() {
return request({
url: '/supervise/error/clearImportError',
method: 'get'
})
}
// 导出从业人员信息- 错误数据
export function queryPeopleOccupationByGroupBy() {
return request({
url: '/regulation/supervise/queryPeopleOccupationByGroupBy',
method: 'get'
})
}
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
@click="handleImportError" @click="handleImportError"
class="button-with-badge" class="button-with-badge"
> >
<span>下载从业人员(错误)</span> <span>下载导入时错误数据</span>
<span class="badge" v-if="importError !== 0">{{importError}}</span> <span class="badge" v-if="importError !== 0">{{importError}}</span>
</el-button> </el-button>
</el-col> </el-col>
...@@ -241,7 +241,10 @@ ...@@ -241,7 +241,10 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="任职岗位" prop="peopleOccupation"> <el-form-item label="任职岗位" prop="peopleOccupation">
<el-select v-model="form.peopleOccupation" placeholder="请选择任职岗位" style="width: 100%;"> <el-select v-model="form.peopleOccupation"
filterable clearable allow-create
placeholder="请选择任职岗位"
style="width: 100%;">
<el-option <el-option
v-for="item in peopleOccupationOptions" v-for="item in peopleOccupationOptions"
:key="item.dictValue" :key="item.dictValue"
...@@ -325,7 +328,7 @@ ...@@ -325,7 +328,7 @@
<el-form-item> <el-form-item>
<div style="width: 100%; text-align: center;"> <div style="width: 100%; text-align: center;">
<el-button type="primary" @click="downloadImportError">下载</el-button> <el-button type="primary" @click="downloadImportError">下载</el-button>
<el-button type="danger" @click="clearImportError">清除错误数据</el-button> <el-button type="danger" @click="clearImportErrorMethod">清除错误数据</el-button>
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -334,7 +337,7 @@ ...@@ -334,7 +337,7 @@
</template> </template>
<script> <script>
import { listInfo, getInfo, delInfo, addInfo, updateInfo, exportInfo,importErrorexportInfo, selectTEnterprise,addFile,importTemplate,countImportError} from "@/api/regulation/supervise"; import { listInfo, getInfo, delInfo, addInfo, updateInfo, exportInfo,importErrorexportInfo, selectTEnterprise,queryPeopleOccupationByGroupBy,importTemplate,countImportError,clearImportError} from "@/api/regulation/supervise";
import FileUpload from '@/components/FileSuperviseUpload'; import FileUpload from '@/components/FileSuperviseUpload';
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
...@@ -420,12 +423,31 @@ export default { ...@@ -420,12 +423,31 @@ export default {
}, },
created() { created() {
this.getList(); this.getList();
this.getDicts("dict_people_occupation").then(response => { // 去掉字典配置,用户和灵活增加任职岗位
this.peopleOccupationOptions = response.data; // this.getDicts("dict_people_occupation").then(response => {
}); // this.peopleOccupationOptions = response.data;
// });
this.queryPeopleOccupationByGroupByMethod();
this.countImportError(); this.countImportError();
}, },
methods: { methods: {
//初始化 任职岗位下拉框
queryPeopleOccupationByGroupByMethod() {
queryPeopleOccupationByGroupBy().then(response => {
let peopleOccupationArr = response.data;
if(peopleOccupationArr != null && peopleOccupationArr.length > 0) {
for (const item of peopleOccupationArr) {
let obj = {
"dictValue": item,
"dictLabel": item
}
this.peopleOccupationOptions.push(obj);
}
}
})
},
// 任务组名字典翻译 // 任务组名字典翻译
peopleOccupationTypeFormat(row) { peopleOccupationTypeFormat(row) {
var label = this.selectDictLabel(this.peopleOccupationOptions, row.peopleOccupation); var label = this.selectDictLabel(this.peopleOccupationOptions, row.peopleOccupation);
...@@ -462,6 +484,9 @@ export default { ...@@ -462,6 +484,9 @@ export default {
this.getList(); this.getList();
this.countImportError(); this.countImportError();
//导入后 刷新 任职岗位字典数据
this.peopleOccupationOptions = [];
this.queryPeopleOccupationByGroupByMethod();
}, },
// 提交上传文件 // 提交上传文件
submitFileForm() { submitFileForm() {
...@@ -477,7 +502,14 @@ export default { ...@@ -477,7 +502,14 @@ export default {
// 下载从业人员错误 按钮 // 下载从业人员错误 按钮
handleImportError() { handleImportError() {
if(this.importError === 0) {
this.$alert('暂无错误数据', '下载', {
confirmButtonText: '确定',
});
return
} else {
this.importErrorShow = true; this.importErrorShow = true;
}
}, },
// 下载从业人员错误 按钮 // 下载从业人员错误 按钮
downloadImportError() { downloadImportError() {
...@@ -485,10 +517,22 @@ export default { ...@@ -485,10 +517,22 @@ export default {
importErrorexportInfo().then(response => { importErrorexportInfo().then(response => {
this.download(response.msg); this.download(response.msg);
}) })
this.importErrorShow = false;
}, },
// 清除 从业人员错误 数据 // 清除 从业人员错误 数据
clearImportError() { clearImportErrorMethod() {
this.$confirm('是否确认删除导入的从业人员错误数据?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return clearImportError();
}).then(() => {
this.importErrorShow = false;
this.msgSuccess("删除成功");
this.importError = 0
}).catch(() => {});
}, },
/**上传头像*/ /**上传头像*/
getFileInfo(res){ getFileInfo(res){
...@@ -614,6 +658,10 @@ export default { ...@@ -614,6 +658,10 @@ export default {
} }
} }
}); });
//新增后 刷新 任职岗位字典数据
this.peopleOccupationOptions = [];
this.queryPeopleOccupationByGroupByMethod();
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
...@@ -628,6 +676,10 @@ export default { ...@@ -628,6 +676,10 @@ export default {
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {});
//删除后 刷新 任职岗位字典数据
this.peopleOccupationOptions = [];
this.queryPeopleOccupationByGroupByMethod();
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
......
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