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

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

parent e6239ff1
...@@ -17,6 +17,8 @@ import com.zehong.common.utils.poi.ExcelUtil; ...@@ -17,6 +17,8 @@ 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 org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
/** /**
* 从业人员信息Controller * 从业人员信息Controller
...@@ -144,15 +146,17 @@ public class TEmployedPeopleInfoController extends BaseController ...@@ -144,15 +146,17 @@ public class TEmployedPeopleInfoController extends BaseController
* @throws Exception * @throws Exception
*/ */
@PostMapping("/importData") @PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception public AjaxResult importData(MultipartFile file, boolean updateSupport, HttpServletResponse response) throws Exception
{ {
ExcelUtil<TEmployedPeopleInfo> util = new ExcelUtil<>(TEmployedPeopleInfo.class); ExcelUtil<TEmployedPeopleInfo> util = new ExcelUtil<>(TEmployedPeopleInfo.class);
List<TEmployedPeopleInfo> XmbhList = util.importExcel(file.getInputStream()); List<TEmployedPeopleInfo> XmbhList = util.importExcel(file.getInputStream());
String operName = SecurityUtils.getLoginUser().getUsername(); String operName = SecurityUtils.getLoginUser().getUsername();
String message = tEmployedPeopleInfoService.importEmployedPeopleInfo(XmbhList, updateSupport, operName); String message = tEmployedPeopleInfoService.importEmployedPeopleInfo(XmbhList, updateSupport, operName,response);
return AjaxResult.success(message); return AjaxResult.success(message);
} }
/** /**
* 模版下载 * 模版下载
* @return * @return
...@@ -163,4 +167,16 @@ public class TEmployedPeopleInfoController extends BaseController ...@@ -163,4 +167,16 @@ public class TEmployedPeopleInfoController extends BaseController
ExcelUtil<TEmployedPeopleInfo> util = new ExcelUtil<>(TEmployedPeopleInfo.class); ExcelUtil<TEmployedPeopleInfo> util = new ExcelUtil<>(TEmployedPeopleInfo.class);
return util.importTemplateExcel("从业人员数据"); return util.importTemplateExcel("从业人员数据");
} }
/**
* 查询当前用户导入 从业人员的错误数据总数
* @return
*/
@GetMapping("/countImportError")
public AjaxResult countImportError()
{
int i = tEmployedPeopleInfoService.countImportError();
return AjaxResult.success(i);
}
} }
package com.zehong.web.controller.supervise;
import java.util.List;
import com.zehong.common.utils.SecurityUtils;
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.TEmployedPeopleInfoError;
import com.zehong.system.service.ITEmployedPeopleInfoErrorService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 从业人员错误导入记录Controller
*
* @author zehong
* @date 2024-06-01
*/
@RestController
@RequestMapping("/supervise/error")
public class TEmployedPeopleInfoErrorController extends BaseController
{
@Autowired
private ITEmployedPeopleInfoErrorService tEmployedPeopleInfoErrorService;
/**
* 查询从业人员错误导入记录列表
*/
@GetMapping("/list")
public TableDataInfo list(TEmployedPeopleInfoError tEmployedPeopleInfoError)
{
startPage();
List<TEmployedPeopleInfoError> list = tEmployedPeopleInfoErrorService.selectTEmployedPeopleInfoErrorList(tEmployedPeopleInfoError);
return getDataTable(list);
}
/**
* 导出从业人员错误导入记录列表
*/
@Log(title = "从业人员错误导入记录", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TEmployedPeopleInfoError tEmployedPeopleInfoError)
{
tEmployedPeopleInfoError.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserId() + "");
List<TEmployedPeopleInfoError> list = tEmployedPeopleInfoErrorService.selectTEmployedPeopleInfoErrorList(tEmployedPeopleInfoError);
ExcelUtil<TEmployedPeopleInfoError> util = new ExcelUtil<TEmployedPeopleInfoError>(TEmployedPeopleInfoError.class);
return util.exportExcel(list, "从业人员错误导入记录数据");
}
/**
* 获取从业人员错误导入记录详细信息
*/
@GetMapping(value = "/{employedPeopleErrorId}")
public AjaxResult getInfo(@PathVariable("employedPeopleErrorId") Long employedPeopleErrorId)
{
return AjaxResult.success(tEmployedPeopleInfoErrorService.selectTEmployedPeopleInfoErrorById(employedPeopleErrorId));
}
/**
* 新增从业人员错误导入记录
*/
@Log(title = "从业人员错误导入记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TEmployedPeopleInfoError tEmployedPeopleInfoError)
{
return toAjax(tEmployedPeopleInfoErrorService.insertTEmployedPeopleInfoError(tEmployedPeopleInfoError));
}
/**
* 修改从业人员错误导入记录
*/
@Log(title = "从业人员错误导入记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TEmployedPeopleInfoError tEmployedPeopleInfoError)
{
return toAjax(tEmployedPeopleInfoErrorService.updateTEmployedPeopleInfoError(tEmployedPeopleInfoError));
}
/**
* 删除从业人员错误导入记录
*/
@Log(title = "从业人员错误导入记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{employedPeopleErrorIds}")
public AjaxResult remove(@PathVariable Long[] employedPeopleErrorIds)
{
return toAjax(tEmployedPeopleInfoErrorService.deleteTEmployedPeopleInfoErrorByIds(employedPeopleErrorIds));
}
}
...@@ -22,6 +22,53 @@ public class FileUtils extends org.apache.commons.io.FileUtils ...@@ -22,6 +22,53 @@ public class FileUtils extends org.apache.commons.io.FileUtils
{ {
public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+"; public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
/**
* 输出指定文件的byte数组
*
* @param filePath 文件路径
* @param os 输出流
* @return
*/
public static FileInputStream writeBytesReturnInputStream(String filePath, OutputStream os) throws IOException
{
FileInputStream fis = null;
try
{
File file = new File(filePath);
if (!file.exists())
{
throw new FileNotFoundException(filePath);
}
fis = new FileInputStream(file);
byte[] b = new byte[1024];
int length;
while ((length = fis.read(b)) > 0)
{
os.write(b, 0, length);
}
}
catch (IOException e)
{
throw e;
}
finally
{
if (os != null)
{
try
{
os.close();
}
catch (IOException e1)
{
e1.printStackTrace();
}
}
}
return fis;
}
/** /**
* 输出指定文件的byte数组 * 输出指定文件的byte数组
* *
......
...@@ -350,6 +350,54 @@ public class ExcelUtil<T> ...@@ -350,6 +350,54 @@ public class ExcelUtil<T>
return exportExcel(); return exportExcel();
} }
/**
* 对list数据源将其里面的数据导入到excel表单 - 只返回 outputstream
*
* @return 结果
*/
public OutputStream importTemplateExcelOutputStream()
{
this.init(null, sheetName, Type.IMPORT);
return exportExcelOutputStream();
}
/**
* 对list数据源将其里面的数据导入到excel表单- 只返回 outputstream
*
* @return 结果
*/
public OutputStream exportExcelOutputStream(){
OutputStream out = null;
try {
// 取出一共有多少个sheet.
double sheetNo = Math.ceil(list.size() / sheetSize);
for (int index = 0; index <= sheetNo; index++) {
createSheet(sheetNo, index);
// 产生一行
Row row = sheet.createRow(0);
int column = 0;
// 写入各个字段的列头名称
for (Object[] os : fields) {
Excel excel = (Excel) os[1];
this.createCell(excel, row, column++);
}
if (Type.EXPORT.equals(type)) {
fillExcelData(index, row);
addStatisticsRow();
}
}
String filename = encodingFilename(sheetName);
out = new FileOutputStream(getAbsoluteFile(filename));
} catch (Exception e) {
log.error("导出Excel异常{}", e.getMessage());
throw new CustomException("导出Excel失败,请联系网站管理员!");
}
return out;
}
/** /**
* 对list数据源将其里面的数据导入到excel表单 * 对list数据源将其里面的数据导入到excel表单
* *
......
package com.zehong.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 从业人员错误导入记录对象 t_employed_people_info_error
*
* @author zehong
* @date 2024-06-01
*/
public class TEmployedPeopleInfoError extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
@Excel(name = "id/此列内容不允许修改")
private Long employedPeopleErrorId;
/** 姓名 */
@Excel(name = "姓名")
private String employedPeopleName;
/** 身份证号 */
@Excel(name = "身份证号")
private String idCard;
/** 职业技能岗位证书编号 */
@Excel(name = "职业技能岗位证书编号")
private String certificateNum;
/** 受聘企业名称 */
@Excel(name = "受聘企业名称")
private String beyondEnterpriseName;
/** 报考类型 */
@Excel(name = "报考类型")
private String registerExaminationType;
/** 人员类型:1.主要负责人 2.安全管理人员3.运行维护和抢修人员 */
@Excel(name = "人员类型:1.主要负责人 2.安全管理人员3.运行维护和抢修人员")
private String peopleOccupation;
/** 发证日期 */
@Excel(name = "发证日期")
private String issueDate;
/** 复检日期 */
@Excel(name = "复检日期")
private String certificateChange;
/** 错误信息 */
@Excel(name = "错误信息")
private String errorMsg;
public void setEmployedPeopleErrorId(Long employedPeopleErrorId)
{
this.employedPeopleErrorId = employedPeopleErrorId;
}
public Long getEmployedPeopleErrorId()
{
return employedPeopleErrorId;
}
public void setEmployedPeopleName(String employedPeopleName)
{
this.employedPeopleName = employedPeopleName;
}
public String getEmployedPeopleName()
{
return employedPeopleName;
}
public void setIdCard(String idCard)
{
this.idCard = idCard;
}
public String getIdCard()
{
return idCard;
}
public void setCertificateNum(String certificateNum)
{
this.certificateNum = certificateNum;
}
public String getCertificateNum()
{
return certificateNum;
}
public void setBeyondEnterpriseName(String beyondEnterpriseName)
{
this.beyondEnterpriseName = beyondEnterpriseName;
}
public String getBeyondEnterpriseName()
{
return beyondEnterpriseName;
}
public void setRegisterExaminationType(String registerExaminationType)
{
this.registerExaminationType = registerExaminationType;
}
public String getRegisterExaminationType()
{
return registerExaminationType;
}
public void setPeopleOccupation(String peopleOccupation)
{
this.peopleOccupation = peopleOccupation;
}
public String getPeopleOccupation()
{
return peopleOccupation;
}
public void setIssueDate(String issueDate)
{
this.issueDate = issueDate;
}
public String getIssueDate()
{
return issueDate;
}
public void setCertificateChange(String certificateChange)
{
this.certificateChange = certificateChange;
}
public String getCertificateChange()
{
return certificateChange;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("employedPeopleErrorId", getEmployedPeopleErrorId())
.append("employedPeopleName", getEmployedPeopleName())
.append("idCard", getIdCard())
.append("certificateNum", getCertificateNum())
.append("beyondEnterpriseName", getBeyondEnterpriseName())
.append("registerExaminationType", getRegisterExaminationType())
.append("peopleOccupation", getPeopleOccupation())
.append("issueDate", getIssueDate())
.append("certificateChange", getCertificateChange())
.append("createBy", getCreateBy())
.toString();
}
}
package com.zehong.system.domain.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 导入时错误数据存储
*/
@Data
public class TEmployedPeopleInfoErrorDTO extends BaseEntity {
/** 姓名 */
@Excel(name = "姓名")
private String employedPeopleName;
/** 身份证号 */
@Excel(name = "身份证号")
private String idCard;
/** 证书编号 */
@Excel(name = "技能岗位证书编号")
private String certificateNum;
/** 受聘企业名称 */
@Excel(name = "受聘企业名称")
private String beyondEnterpriseName;
/** 受聘企业id */
private String beyondEnterpriseId;
/** 发证部门 */
@Excel(name = "发证部门")
private String registerExaminationType;
/** 任职岗位:1.主要负责人 2.安全管理人员3.运行维护和抢修人员 */
@Excel(name = "任职岗位",dictType = "enterprise_type")
private String peopleOccupation;
/** 发证日期 */
@Excel(name = "发证日期")
@JsonFormat(pattern="yyyy-MM-dd")
private String issueDate;
/** 复检日期 */
@Excel(name = "复检日期")
private String certificateChange;
/** 是否删除(0正常,1删除) */
private String isDel;
/** 备注 */
@Excel(name = "备注")
private String remarks;
/** 备注 */
@Excel(name = "错误数据")
private String importFailReason;
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TEmployedPeopleInfoError;
import org.apache.ibatis.annotations.Param;
/**
* 从业人员错误导入记录Mapper接口
*
* @author zehong
* @date 2024-06-01
*/
public interface TEmployedPeopleInfoErrorMapper
{
/**
* 查询从业人员错误导入记录
*
* @param employedPeopleErrorId 从业人员错误导入记录ID
* @return 从业人员错误导入记录
*/
public TEmployedPeopleInfoError selectTEmployedPeopleInfoErrorById(Long employedPeopleErrorId);
/**
* 查询从业人员错误导入记录列表
*
* @param tEmployedPeopleInfoError 从业人员错误导入记录
* @return 从业人员错误导入记录集合
*/
public List<TEmployedPeopleInfoError> selectTEmployedPeopleInfoErrorList(TEmployedPeopleInfoError tEmployedPeopleInfoError);
/**
* 新增从业人员错误导入记录
*
* @param tEmployedPeopleInfoError 从业人员错误导入记录
* @return 结果
*/
public int insertTEmployedPeopleInfoError(TEmployedPeopleInfoError tEmployedPeopleInfoError);
/**
* 批量新增从业人员错误导入记录
*
* @param tEmployedPeopleInfoErrors 从业人员错误导入记录
* @return 结果
*/
public int batchInsertTEmployedPeopleInfoError(@Param(value = "tEmployedPeopleInfoErrors") List<TEmployedPeopleInfoError> tEmployedPeopleInfoErrors);
/**
* 修改从业人员错误导入记录
*
* @param tEmployedPeopleInfoError 从业人员错误导入记录
* @return 结果
*/
public int updateTEmployedPeopleInfoError(TEmployedPeopleInfoError tEmployedPeopleInfoError);
/**
* 删除从业人员错误导入记录
*
* @param employedPeopleErrorId 从业人员错误导入记录ID
* @return 结果
*/
public int deleteTEmployedPeopleInfoErrorById(Long employedPeopleErrorId);
/**
* 批量删除从业人员错误导入记录
*
* @param employedPeopleErrorIds 需要删除的数据ID
* @return 结果
*/
public int deleteTEmployedPeopleInfoErrorByIds(Long[] employedPeopleErrorIds);
public int countByCreateByInt(String createBy);
}
...@@ -19,6 +19,14 @@ public interface TEnterpriseInfoMapper ...@@ -19,6 +19,14 @@ public interface TEnterpriseInfoMapper
*/ */
public TEnterpriseInfo selectTEnterpriseInfoById(String enterpriseId); public TEnterpriseInfo selectTEnterpriseInfoById(String enterpriseId);
/**
* 查询企业信息
*
* @param enterpriseName 企业信息名称
* @return 企业信息
*/
public TEnterpriseInfo selectTEnterpriseInfoByName(String enterpriseName);
/** /**
* 查询企业信息列表 * 查询企业信息列表
* *
......
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TEmployedPeopleInfoError;
/**
* 从业人员错误导入记录Service接口
*
* @author zehong
* @date 2024-06-01
*/
public interface ITEmployedPeopleInfoErrorService
{
/**
* 查询从业人员错误导入记录
*
* @param employedPeopleErrorId 从业人员错误导入记录ID
* @return 从业人员错误导入记录
*/
public TEmployedPeopleInfoError selectTEmployedPeopleInfoErrorById(Long employedPeopleErrorId);
/**
* 查询从业人员错误导入记录列表
*
* @param tEmployedPeopleInfoError 从业人员错误导入记录
* @return 从业人员错误导入记录集合
*/
public List<TEmployedPeopleInfoError> selectTEmployedPeopleInfoErrorList(TEmployedPeopleInfoError tEmployedPeopleInfoError);
/**
* 新增从业人员错误导入记录
*
* @param tEmployedPeopleInfoError 从业人员错误导入记录
* @return 结果
*/
public int insertTEmployedPeopleInfoError(TEmployedPeopleInfoError tEmployedPeopleInfoError);
/**
* 批量插入错误记录
* @param employedPeopleInfoErrors e
* @return r
*/
public int batchInsertTEmployedPeopleInfoError(List<TEmployedPeopleInfoError> employedPeopleInfoErrors);
/**
* 修改从业人员错误导入记录
*
* @param tEmployedPeopleInfoError 从业人员错误导入记录
* @return 结果
*/
public int updateTEmployedPeopleInfoError(TEmployedPeopleInfoError tEmployedPeopleInfoError);
/**
* 批量删除从业人员错误导入记录
*
* @param employedPeopleErrorIds 需要删除的从业人员错误导入记录ID
* @return 结果
*/
public int deleteTEmployedPeopleInfoErrorByIds(Long[] employedPeopleErrorIds);
/**
* 删除从业人员错误导入记录信息
*
* @param employedPeopleErrorId 从业人员错误导入记录ID
* @return 结果
*/
public int deleteTEmployedPeopleInfoErrorById(Long employedPeopleErrorId);
}
...@@ -4,6 +4,8 @@ import java.util.List; ...@@ -4,6 +4,8 @@ import java.util.List;
import com.zehong.system.domain.TEmployedPeopleInfo; import com.zehong.system.domain.TEmployedPeopleInfo;
import com.zehong.system.domain.TEnterpriseInfo; import com.zehong.system.domain.TEnterpriseInfo;
import javax.servlet.http.HttpServletResponse;
/** /**
* 从业人员信息Service接口 * 从业人员信息Service接口
* *
...@@ -80,5 +82,11 @@ public interface ITEmployedPeopleInfoService ...@@ -80,5 +82,11 @@ public interface ITEmployedPeopleInfoService
* @param operName 操作用户 * @param operName 操作用户
* @return 结果 * @return 结果
*/ */
public String importEmployedPeopleInfo(List<TEmployedPeopleInfo> XmbhList, Boolean isUpdateSupport, String operName); public String importEmployedPeopleInfo(List<TEmployedPeopleInfo> XmbhList, Boolean isUpdateSupport, String operName, HttpServletResponse response);
/**
* 查询当前用户导入 从业人员的错误数据总数
* @return
*/
public int countImportError();
} }
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.TEmployedPeopleInfoErrorMapper;
import com.zehong.system.domain.TEmployedPeopleInfoError;
import com.zehong.system.service.ITEmployedPeopleInfoErrorService;
/**
* 从业人员错误导入记录Service业务层处理
*
* @author zehong
* @date 2024-06-01
*/
@Service
public class TEmployedPeopleInfoErrorServiceImpl implements ITEmployedPeopleInfoErrorService
{
@Autowired
private TEmployedPeopleInfoErrorMapper tEmployedPeopleInfoErrorMapper;
/**
* 查询从业人员错误导入记录
*
* @param employedPeopleErrorId 从业人员错误导入记录ID
* @return 从业人员错误导入记录
*/
@Override
public TEmployedPeopleInfoError selectTEmployedPeopleInfoErrorById(Long employedPeopleErrorId)
{
return tEmployedPeopleInfoErrorMapper.selectTEmployedPeopleInfoErrorById(employedPeopleErrorId);
}
/**
* 查询从业人员错误导入记录列表
*
* @param tEmployedPeopleInfoError 从业人员错误导入记录
* @return 从业人员错误导入记录
*/
@Override
public List<TEmployedPeopleInfoError> selectTEmployedPeopleInfoErrorList(TEmployedPeopleInfoError tEmployedPeopleInfoError)
{
return tEmployedPeopleInfoErrorMapper.selectTEmployedPeopleInfoErrorList(tEmployedPeopleInfoError);
}
/**
* 新增从业人员错误导入记录
*
* @param tEmployedPeopleInfoError 从业人员错误导入记录
* @return 结果
*/
@Override
public int insertTEmployedPeopleInfoError(TEmployedPeopleInfoError tEmployedPeopleInfoError)
{
return tEmployedPeopleInfoErrorMapper.insertTEmployedPeopleInfoError(tEmployedPeopleInfoError);
}
/**
* 批量插入 错误数据
* @param employedPeopleInfoErrors e
* @return r
*/
@Override
public int batchInsertTEmployedPeopleInfoError(List<TEmployedPeopleInfoError> employedPeopleInfoErrors) {
if (employedPeopleInfoErrors == null || employedPeopleInfoErrors.size() == 0) {
return 0;
}
return tEmployedPeopleInfoErrorMapper.batchInsertTEmployedPeopleInfoError(employedPeopleInfoErrors);
}
/**
* 修改从业人员错误导入记录
*
* @param tEmployedPeopleInfoError 从业人员错误导入记录
* @return 结果
*/
@Override
public int updateTEmployedPeopleInfoError(TEmployedPeopleInfoError tEmployedPeopleInfoError)
{
return tEmployedPeopleInfoErrorMapper.updateTEmployedPeopleInfoError(tEmployedPeopleInfoError);
}
/**
* 批量删除从业人员错误导入记录
*
* @param employedPeopleErrorIds 需要删除的从业人员错误导入记录ID
* @return 结果
*/
@Override
public int deleteTEmployedPeopleInfoErrorByIds(Long[] employedPeopleErrorIds)
{
return tEmployedPeopleInfoErrorMapper.deleteTEmployedPeopleInfoErrorByIds(employedPeopleErrorIds);
}
/**
* 删除从业人员错误导入记录信息
*
* @param employedPeopleErrorId 从业人员错误导入记录ID
* @return 结果
*/
@Override
public int deleteTEmployedPeopleInfoErrorById(Long employedPeopleErrorId)
{
return tEmployedPeopleInfoErrorMapper.deleteTEmployedPeopleInfoErrorById(employedPeopleErrorId);
}
}
package com.zehong.system.service.impl; package com.zehong.system.service.impl;
import java.util.Date; import java.util.*;
import java.util.List;
import com.zehong.common.core.domain.entity.SysUser; import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.exception.BaseException; import com.zehong.common.exception.BaseException;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils; import com.zehong.common.utils.SecurityUtils;
import com.zehong.common.utils.uuid.UUID; import com.zehong.common.utils.bean.BeanUtils;
import com.zehong.system.domain.TEmployedPeopleInfoError;
import com.zehong.system.domain.TEnterpriseInfo; import com.zehong.system.domain.TEnterpriseInfo;
import com.zehong.system.mapper.TEmployedPeopleInfoErrorMapper;
import com.zehong.system.mapper.TEnterpriseInfoMapper;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -16,6 +17,8 @@ import com.zehong.system.mapper.TEmployedPeopleInfoMapper; ...@@ -16,6 +17,8 @@ import com.zehong.system.mapper.TEmployedPeopleInfoMapper;
import com.zehong.system.domain.TEmployedPeopleInfo; import com.zehong.system.domain.TEmployedPeopleInfo;
import com.zehong.system.service.ITEmployedPeopleInfoService; import com.zehong.system.service.ITEmployedPeopleInfoService;
import javax.servlet.http.HttpServletResponse;
/** /**
* 从业人员信息Service业务层处理 * 从业人员信息Service业务层处理
* *
...@@ -28,6 +31,12 @@ public class TEmployedPeopleInfoServiceImpl implements ITEmployedPeopleInfoServi ...@@ -28,6 +31,12 @@ public class TEmployedPeopleInfoServiceImpl implements ITEmployedPeopleInfoServi
@Autowired @Autowired
private TEmployedPeopleInfoMapper tEmployedPeopleInfoMapper; private TEmployedPeopleInfoMapper tEmployedPeopleInfoMapper;
@Autowired
private TEnterpriseInfoMapper enterpriseInfoMapper;
@Autowired
private TEmployedPeopleInfoErrorMapper employedPeopleInfoErrorMapper;
/** /**
* 查询从业人员信息 * 查询从业人员信息
* *
...@@ -123,57 +132,71 @@ public class TEmployedPeopleInfoServiceImpl implements ITEmployedPeopleInfoServi ...@@ -123,57 +132,71 @@ public class TEmployedPeopleInfoServiceImpl implements ITEmployedPeopleInfoServi
} }
@Override @Override
public String importEmployedPeopleInfo(List<TEmployedPeopleInfo> employedPeopleInfos, Boolean isUpdateSupport, String operName) { public String importEmployedPeopleInfo(List<TEmployedPeopleInfo> employedPeopleInfos, Boolean isUpdateSupport, String operName, HttpServletResponse response) {
if (CollectionUtils.isEmpty(employedPeopleInfos)) { if (CollectionUtils.isEmpty(employedPeopleInfos)) {
throw new BaseException("导入数据不能为空! "); throw new BaseException("导入数据不能为空! ");
} }
int successNum = 0; List<TEmployedPeopleInfoError> failList = new ArrayList<>();
int failureNum = 0; TEmployedPeopleInfoError employedPeopleInfoError;
StringBuilder successMsg = new StringBuilder(); StringBuilder stringBuilder;
StringBuilder failureMsg = new StringBuilder(); for (TEmployedPeopleInfo tEmployedPeopleInfo : employedPeopleInfos){
for (TEmployedPeopleInfo tEmployedPeopleInfo : employedPeopleInfos) { stringBuilder = new StringBuilder();
try { try {
checkUploadRequired(tEmployedPeopleInfo); if (tEmployedPeopleInfo.getEmployedPeopleName() == null || "".equals(tEmployedPeopleInfo.getEmployedPeopleName())) {
stringBuilder.append("姓名为空|");
}
if (tEmployedPeopleInfo.getIdCard() == null || "".equals(tEmployedPeopleInfo.getIdCard())) {
stringBuilder.append("身份证为空|");
}
if (tEmployedPeopleInfo.getBeyondEnterpriseName() == null || "".equals(tEmployedPeopleInfo.getBeyondEnterpriseName())) {
stringBuilder.append("企业信息为空|");
}
TEnterpriseInfo enterpriseInfo = enterpriseInfoMapper.selectTEnterpriseInfoByName(tEmployedPeopleInfo.getBeyondEnterpriseName());
if (enterpriseInfo == null) {
stringBuilder.append("关联企业信息为空|");
}
if(!"".equals(stringBuilder.toString())) {
employedPeopleInfoError = new TEmployedPeopleInfoError();
BeanUtils.copyProperties(tEmployedPeopleInfo, employedPeopleInfoError);
employedPeopleInfoError.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserId() + "");
employedPeopleInfoError.setErrorMsg(stringBuilder.toString());
failList.add(employedPeopleInfoError);
continue;
}
SysUser user = SecurityUtils.getLoginUser().getUser(); SysUser user = SecurityUtils.getLoginUser().getUser();
tEmployedPeopleInfo.setCreateBy(user.getUserName()); tEmployedPeopleInfo.setCreateBy(user.getUserName());
tEmployedPeopleInfo.setCreateTime(new Date()); tEmployedPeopleInfo.setCreateTime(new Date());
tEmployedPeopleInfo.setUpdateTime(new Date()); tEmployedPeopleInfo.setUpdateTime(new Date());
tEmployedPeopleInfo.setUpdateBy(user.getUserName()); tEmployedPeopleInfo.setUpdateBy(user.getUserName());
this.insertTEmployedPeopleInfo(tEmployedPeopleInfo); this.insertTEmployedPeopleInfo(tEmployedPeopleInfo);
successNum++;
successMsg.append("<br/>" + successNum + "、姓名为 " + tEmployedPeopleInfo.getEmployedPeopleName() + " 导入成功");
} catch (Exception e) { } catch (Exception e) {
failureNum++; throw new BaseException("导入出错");
String msg = "<br/>" + failureNum + "、姓名为 " + tEmployedPeopleInfo.getEmployedPeopleName() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
} }
} }
if (failureNum > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); if (failList.size() > 0) {
throw new BaseException(failureMsg.toString()); employedPeopleInfoErrorMapper.batchInsertTEmployedPeopleInfoError(failList);
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
} }
return successMsg.toString();
}
return "导入完成";
}
/** /**
* 校验导入必填 * 查询当前用户导入 从业人员的错误数据总数
* @param employedPeopleInfo t * @return int
*/ */
public void checkUploadRequired(TEmployedPeopleInfo employedPeopleInfo) { @Override
if (employedPeopleInfo.getEmployedPeopleName() == null || "".equals(employedPeopleInfo.getEmployedPeopleName())) { public int countImportError() {
throw new BaseException("姓名!!!");
}
if (employedPeopleInfo.getIdCard() == null || "".equals(employedPeopleInfo.getIdCard())) { Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
throw new BaseException("身份证号必传!!!");
}
if (employedPeopleInfo.getBeyondEnterpriseName() == null || "".equals(employedPeopleInfo.getBeyondEnterpriseName())) { return employedPeopleInfoErrorMapper.countByCreateByInt(userId + "");
throw new BaseException("受聘企业名称不许为空!!!");
}
} }
} }
<?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.TEmployedPeopleInfoErrorMapper">
<resultMap type="TEmployedPeopleInfoError" id="TEmployedPeopleInfoErrorResult">
<result property="employedPeopleErrorId" column="employed_people_error_id" />
<result property="employedPeopleName" column="employed_people_name" />
<result property="idCard" column="id_card" />
<result property="certificateNum" column="certificate_num" />
<result property="beyondEnterpriseName" column="beyond_enterprise_name" />
<result property="registerExaminationType" column="register_examination_type" />
<result property="peopleOccupation" column="people_occupation" />
<result property="issueDate" column="issue_date" />
<result property="certificateChange" column="certificate_change" />
<result property="createBy" column="create_by" />
<result property="errorMsg" column="error_msg" />
</resultMap>
<sql id="selectTEmployedPeopleInfoErrorVo">
select employed_people_error_id, employed_people_name, id_card, certificate_num, beyond_enterprise_name, register_examination_type, people_occupation, issue_date, certificate_change, create_by,error_msg from t_employed_people_info_error
</sql>
<select id="selectTEmployedPeopleInfoErrorList" parameterType="TEmployedPeopleInfoError" resultMap="TEmployedPeopleInfoErrorResult">
<include refid="selectTEmployedPeopleInfoErrorVo"/>
<where>
<if test="employedPeopleName != null and employedPeopleName != ''"> and employed_people_name like concat('%', #{employedPeopleName}, '%')</if>
<if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
<if test="certificateNum != null and certificateNum != ''"> and certificate_num = #{certificateNum}</if>
<if test="beyondEnterpriseName != null and beyondEnterpriseName != ''"> and beyond_enterprise_name like concat('%', #{beyondEnterpriseName}, '%')</if>
<if test="registerExaminationType != null and registerExaminationType != ''"> and register_examination_type = #{registerExaminationType}</if>
<if test="peopleOccupation != null and peopleOccupation != ''"> and people_occupation = #{peopleOccupation}</if>
<if test="issueDate != null and issueDate != ''"> and issue_date = #{issueDate}</if>
<if test="certificateChange != null and certificateChange != ''"> and certificate_change = #{certificateChange}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="errorMsg != null and errorMsg != ''"> and error_msg = #{errorMsg}</if>
</where>
</select>
<select id="selectTEmployedPeopleInfoErrorById" parameterType="Long" resultMap="TEmployedPeopleInfoErrorResult">
<include refid="selectTEmployedPeopleInfoErrorVo"/>
where employed_people_error_id = #{employedPeopleErrorId}
</select>
<insert id="insertTEmployedPeopleInfoError" parameterType="TEmployedPeopleInfoError" useGeneratedKeys="true" keyProperty="employedPeopleErrorId">
insert into t_employed_people_info_error
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="employedPeopleName != null">employed_people_name,</if>
<if test="idCard != null">id_card,</if>
<if test="certificateNum != null">certificate_num,</if>
<if test="beyondEnterpriseName != null">beyond_enterprise_name,</if>
<if test="registerExaminationType != null">register_examination_type,</if>
<if test="peopleOccupation != null">people_occupation,</if>
<if test="issueDate != null">issue_date,</if>
<if test="certificateChange != null">certificate_change,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="errorMsg != null and errorMsg != ''">error_msg,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="employedPeopleName != null">#{employedPeopleName},</if>
<if test="idCard != null">#{idCard},</if>
<if test="certificateNum != null">#{certificateNum},</if>
<if test="beyondEnterpriseName != null">#{beyondEnterpriseName},</if>
<if test="registerExaminationType != null">#{registerExaminationType},</if>
<if test="peopleOccupation != null">#{peopleOccupation},</if>
<if test="issueDate != null">#{issueDate},</if>
<if test="certificateChange != null">#{certificateChange},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="errorMsg != null and errorMsg != ''">#{errorMsg},</if>
</trim>
</insert>
<insert id="batchInsertTEmployedPeopleInfoError" parameterType="list">
insert into t_employed_people_info_error (employed_people_name,
id_card, certificate_num, beyond_enterprise_name,
register_examination_type, people_occupation, issue_date,
certificate_change, create_by,error_msg)
values
<foreach collection="tEmployedPeopleInfoErrors" separator="," item="item">
(#{item.employedPeopleName,jdbcType=VARCHAR}, #{item.idCard,jdbcType=VARCHAR},
#{item.certificateNum,jdbcType=CHAR},#{item.beyondEnterpriseName,jdbcType=VARCHAR},
#{item.registerExaminationType,jdbcType=VARCHAR}, #{item.peopleOccupation,jdbcType=VARCHAR},
#{item.issueDate,jdbcType=TIMESTAMP}, #{item.certificateChange,jdbcType=VARCHAR},
#{item.createBy,jdbcType=VARCHAR},#{item.errorMsg,jdbcType=VARCHAR})
</foreach>
</insert>
<update id="updateTEmployedPeopleInfoError" parameterType="TEmployedPeopleInfoError">
update t_employed_people_info_error
<trim prefix="SET" suffixOverrides=",">
<if test="employedPeopleName != null">employed_people_name = #{employedPeopleName},</if>
<if test="idCard != null">id_card = #{idCard},</if>
<if test="certificateNum != null">certificate_num = #{certificateNum},</if>
<if test="beyondEnterpriseName != null">beyond_enterprise_name = #{beyondEnterpriseName},</if>
<if test="registerExaminationType != null">register_examination_type = #{registerExaminationType},</if>
<if test="peopleOccupation != null">people_occupation = #{peopleOccupation},</if>
<if test="issueDate != null">issue_date = #{issueDate},</if>
<if test="certificateChange != null">certificate_change = #{certificateChange},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="errorMsg != null and errorMsg != ''">error_msg = #{errorMsg},</if>
</trim>
where employed_people_error_id = #{employedPeopleErrorId}
</update>
<delete id="deleteTEmployedPeopleInfoErrorById" parameterType="Long">
delete from t_employed_people_info_error where employed_people_error_id = #{employedPeopleErrorId}
</delete>
<delete id="deleteTEmployedPeopleInfoErrorByIds" parameterType="String">
delete from t_employed_people_info_error where employed_people_error_id in
<foreach item="employedPeopleErrorId" collection="array" open="(" separator="," close=")">
#{employedPeopleErrorId}
</foreach>
</delete>
<select id="countByCreateByInt" parameterType="String" resultType="int">
select count(*) from t_employed_people_info_error where create_by = #{createBy}
</select>
</mapper>
\ No newline at end of file
...@@ -57,6 +57,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -57,6 +57,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectTEnterpriseInfoVo"/> <include refid="selectTEnterpriseInfoVo"/>
where enterprise_id = #{enterpriseId} and is_del='0' where enterprise_id = #{enterpriseId} and is_del='0'
</select> </select>
<select id="selectTEnterpriseInfoByName" parameterType="String" resultMap="TEnterpriseInfoResult">
<include refid="selectTEnterpriseInfoVo"/>
where enterprise_name = #{enterpriseName} and is_del='0'
</select>
<insert id="insertTEnterpriseInfo" parameterType="TEnterpriseInfo" useGeneratedKeys="true" keyProperty="enterpriseId"> <insert id="insertTEnterpriseInfo" parameterType="TEnterpriseInfo" useGeneratedKeys="true" keyProperty="enterpriseId">
insert into t_enterprise_info insert into t_enterprise_info
......
...@@ -89,4 +89,23 @@ export function importTemplate() { ...@@ -89,4 +89,23 @@ export function importTemplate() {
url: '/regulation/supervise/importTemplate', url: '/regulation/supervise/importTemplate',
method: 'get' method: 'get'
}) })
} }
\ No newline at end of file
// 下载用户导入模板
export function countImportError() {
return request({
url: '/regulation/supervise/countImportError',
method: 'get'
})
}
// 导出从业人员信息- 错误数据
export function importErrorexportInfo() {
return request({
url: '/supervise/error/export',
method: 'get'
})
}
...@@ -81,6 +81,19 @@ ...@@ -81,6 +81,19 @@
size="mini" size="mini"
@click="handleImport">导入</el-button> @click="handleImport">导入</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-download"
size="mini"
@click="handleImportError"
class="button-with-badge"
>
<span>下载从业人员(错误)</span>
<span class="badge" v-if="importError !== 0">{{importError}}</span>
</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>
...@@ -305,11 +318,23 @@ ...@@ -305,11 +318,23 @@
<el-button @click="upload.open = false">取 消</el-button> <el-button @click="upload.open = false">取 消</el-button>
</div> </div>
</el-dialog> </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="clearImportError">清除错误数据</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listInfo, getInfo, delInfo, addInfo, updateInfo, exportInfo, selectTEnterprise,addFile,importTemplate} from "@/api/regulation/supervise"; import { listInfo, getInfo, delInfo, addInfo, updateInfo, exportInfo,importErrorexportInfo, selectTEnterprise,addFile,importTemplate,countImportError} from "@/api/regulation/supervise";
import FileUpload from '@/components/FileSuperviseUpload'; import FileUpload from '@/components/FileSuperviseUpload';
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
...@@ -334,6 +359,9 @@ export default { ...@@ -334,6 +359,9 @@ export default {
// 上传的地址 // 上传的地址
url: process.env.VUE_APP_BASE_API + "/regulation/supervise/importData" // todo url: process.env.VUE_APP_BASE_API + "/regulation/supervise/importData" // todo
}, },
importError: null,
importErrorShow: false,
importErrorShowTitle: "选择下载错误数据或者是清除错误数据",
//头像 //头像
fileList: [], fileList: [],
//头像数据 //头像数据
...@@ -395,6 +423,7 @@ export default { ...@@ -395,6 +423,7 @@ export default {
this.getDicts("dict_people_occupation").then(response => { this.getDicts("dict_people_occupation").then(response => {
this.peopleOccupationOptions = response.data; this.peopleOccupationOptions = response.data;
}); });
this.countImportError();
}, },
methods: { methods: {
// 任务组名字典翻译 // 任务组名字典翻译
...@@ -431,13 +460,36 @@ export default { ...@@ -431,13 +460,36 @@ export default {
this.$refs.upload.clearFiles(); this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true }); this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.getList(); this.getList();
this.countImportError();
}, },
// 提交上传文件 // 提交上传文件
submitFileForm() { submitFileForm() {
this.$refs.upload.submit(); this.$refs.upload.submit();
}, },
//查询 导入错误数据
countImportError() {
countImportError().then(response => {
this.importError = response.data;
})
},
// 下载从业人员错误 按钮
handleImportError() {
this.importErrorShow = true;
},
// 下载从业人员错误 按钮
downloadImportError() {
// return importErrorexportInfo();
importErrorexportInfo().then(response => {
this.download(response.msg);
})
},
// 清除 从业人员错误 数据
clearImportError() {
},
/**上传头像*/ /**上传头像*/
getFileInfo(res){ getFileInfo(res){
this.form.dealPlan = res.fileName; this.form.dealPlan = res.fileName;
...@@ -612,5 +664,21 @@ export default { ...@@ -612,5 +664,21 @@ export default {
border-width: 1px; border-width: 1px;
border-color: rgb(48, 180, 107); border-color: rgb(48, 180, 107);
} }
.button-with-badge {
position: relative; /* 设置相对定位 */
padding-right: 30px; /* 为角标预留空间 */
}
.badge {
position: absolute; /* 绝对定位 */
top: 0; /* 放置在按钮的顶部 */
right: 0; /* 放置在按钮的右侧 */
background-color: red; /* 角标背景颜色 */
color: white; /* 角标文字颜色 */
border-radius: 50%; /* 角标是圆形的 */
padding: 2px 5px; /* 角标内部填充 */
font-size: 12px; /* 角标字体大小 */
}
</style> </style>
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