fix: 后端丢失class
This commit is contained in:
+25
-1
@@ -39,7 +39,7 @@ public class OldSystemController {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/importExcel")
|
||||
@PostMapping("/importOldDeptRelationExcel")
|
||||
@ApiOperation(value = "老法规系统-老部门现部门关系导入", notes = "老法规系统-老部门现部门关系导入")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@AutoLog(value = "老法规系统-老部门现部门关系导入")
|
||||
@@ -67,6 +67,30 @@ public class OldSystemController {
|
||||
enterpriseStandardService.importExcelOldSystem(file, type, response);
|
||||
}
|
||||
|
||||
@PostMapping("/importOldESAuthAllExcel")
|
||||
@AutoLog(value = "老法规系统-老法规企标所有人权限数据导入")
|
||||
@ApiOperation(value="老法规系统-老法规企标所有人权限数据导入", notes="老法规系统-老法规企标所有人权限数据导入", produces = "application/octet-stream")
|
||||
@ApiOperationSupport(order = 3)
|
||||
public void importOldESAuthAllExcel(@RequestParam("file") MultipartFile file,
|
||||
HttpServletResponse response) {
|
||||
enterpriseStandardService.importOldESAuthAllExcel(file, response);
|
||||
}
|
||||
|
||||
@PostMapping("/importOldESAuthUserExcel")
|
||||
@AutoLog(value = "老法规系统-老法规企标个人权限数据导入")
|
||||
@ApiOperation(value="老法规系统-老法规企标个人权限数据导入", notes="老法规系统-老法规企标个人权限数据导入", produces = "application/octet-stream")
|
||||
@ApiOperationSupport(order = 4)
|
||||
public void importOldESAuthUserExcel(@RequestParam("file") MultipartFile file,
|
||||
HttpServletResponse response) {
|
||||
enterpriseStandardService.importOldESAuthUserExcel(file, response);
|
||||
}
|
||||
@PostMapping("/importOldESAuthDeptExcel")
|
||||
@AutoLog(value = "老法规系统-老法规企标部门权限数据导入")
|
||||
@ApiOperation(value="老法规系统-老法规企标部门权限数据导入", notes="老法规系统-老法规企标部门权限数据导入", produces = "application/octet-stream")
|
||||
@ApiOperationSupport(order = 5)
|
||||
public void importOldESAuthDeptExcel(@RequestParam("file") MultipartFile file,
|
||||
HttpServletResponse response) {
|
||||
enterpriseStandardService.importOldESAuthDeptExcel(file, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.jero.modules.laws.oldSystem.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @author: Mzaxd
|
||||
* @Date: 2023/11/29 11:47
|
||||
*
|
||||
* 对应标准权限-1所有人.xlsx
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ESAuthAll {
|
||||
|
||||
@Excel(name = "标准ID")
|
||||
@ApiModelProperty(value = "标准ID")
|
||||
private String standardId;
|
||||
|
||||
@Excel(name = "标准号")
|
||||
@ApiModelProperty(value = "标准号")
|
||||
private String standardNumber;
|
||||
|
||||
@Excel(name = "标准名称")
|
||||
@ApiModelProperty(value = "标准名称")
|
||||
private String standardName;
|
||||
|
||||
@Excel(name = "标准分类")
|
||||
@ApiModelProperty(value = "标准分类")
|
||||
private String standardType;
|
||||
|
||||
@Excel(name = "权限")
|
||||
@ApiModelProperty(value = "权限")
|
||||
private String standardLevel;
|
||||
|
||||
public boolean isEmptyRow() {
|
||||
return standardId == null &&
|
||||
standardNumber == null &&
|
||||
standardName == null &&
|
||||
standardType == null &&
|
||||
standardLevel == null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.jero.modules.laws.oldSystem.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @author: Mzaxd
|
||||
* @Date: 2023/11/29 11:48
|
||||
* 对应标准权限-1部门.xlsx
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ESAuthDept {
|
||||
|
||||
@Excel(name = "标准ID")
|
||||
@ApiModelProperty(value = "标准ID")
|
||||
private String standardId;
|
||||
|
||||
@Excel(name = "标准号")
|
||||
@ApiModelProperty(value = "标准号")
|
||||
private String standardNumber;
|
||||
|
||||
@Excel(name = "标准名称")
|
||||
@ApiModelProperty(value = "标准名称")
|
||||
private String standardName;
|
||||
|
||||
@Excel(name = "标准分类")
|
||||
@ApiModelProperty(value = "标准分类")
|
||||
private String standardType;
|
||||
|
||||
@Excel(name = "上级组织")
|
||||
@ApiModelProperty(value = "上级组织")
|
||||
private String higherDeptName;
|
||||
|
||||
@Excel(name = "组织部门")
|
||||
@ApiModelProperty(value = "组织部门")
|
||||
private String deptName;
|
||||
|
||||
public boolean isEmptyRow() {
|
||||
return standardId == null &&
|
||||
standardNumber == null &&
|
||||
standardName == null &&
|
||||
standardType == null &&
|
||||
higherDeptName == null &&
|
||||
deptName == null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.jero.modules.laws.oldSystem.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @author: Mzaxd
|
||||
* @Date: 2023/11/29 11:48
|
||||
* 对应标准权限-3个人.xlsx
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ESAuthUser {
|
||||
|
||||
@Excel(name = "标准ID")
|
||||
@ApiModelProperty(value = "标准ID")
|
||||
private String standardId;
|
||||
|
||||
@Excel(name = "标准号")
|
||||
@ApiModelProperty(value = "标准号")
|
||||
private String standardNumber;
|
||||
|
||||
@Excel(name = "标准名称")
|
||||
@ApiModelProperty(value = "标准名称")
|
||||
private String standardName;
|
||||
|
||||
@Excel(name = "标准分类")
|
||||
@ApiModelProperty(value = "标准分类")
|
||||
private String standardType;
|
||||
|
||||
@Excel(name = "工号")
|
||||
@ApiModelProperty(value = "工号")
|
||||
private String workNumber;
|
||||
|
||||
@Excel(name = "姓名")
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String realName;
|
||||
|
||||
public boolean isEmptyRow() {
|
||||
return standardId == null &&
|
||||
standardNumber == null &&
|
||||
standardName == null &&
|
||||
standardType == null &&
|
||||
workNumber == null &&
|
||||
realName == null;
|
||||
}
|
||||
|
||||
}
|
||||
+22
-1
@@ -57,13 +57,34 @@ public class OldSystemDepartRelation implements Serializable {
|
||||
private String curOrgName;
|
||||
|
||||
/**
|
||||
* 上级组织
|
||||
* 现上级组织
|
||||
*/
|
||||
@Excel(name = "现上级组织", width = 15)
|
||||
@ApiModelProperty(value = "现上级组织")
|
||||
private String curOrgSuperior;
|
||||
|
||||
/**
|
||||
* 现组织部门Id
|
||||
*/
|
||||
@ApiModelProperty(value = "现组织部门Id")
|
||||
private String curOrgId;
|
||||
|
||||
/**
|
||||
* 现上级组织Id
|
||||
*/
|
||||
@ApiModelProperty(value = "现上级组织Id")
|
||||
private String curOrgSuperiorId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public boolean isEmptyRow() {
|
||||
return oldOrgName == null &&
|
||||
oldOrgSuperior == null &&
|
||||
orgLevel == null &&
|
||||
curOrgName == null &&
|
||||
curOrgSuperior == null &&
|
||||
curOrgId == null &&
|
||||
curOrgSuperiorId == null;
|
||||
}
|
||||
}
|
||||
+15
-11
@@ -1,14 +1,19 @@
|
||||
package com.jero.modules.laws.oldSystem.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.SysDictItemCore;
|
||||
import com.jero.modules.activiti.process.esAnnualInit.entity.ProcessEsAnnualInit;
|
||||
import com.jero.modules.activiti.util.ExcelUtils;
|
||||
import com.jero.modules.laws.oldSystem.entity.ESAuthDept;
|
||||
import com.jero.modules.laws.oldSystem.entity.OldSystemDepartRelation;
|
||||
import com.jero.modules.laws.oldSystem.service.OldSystemDepartRelationService;
|
||||
import com.jero.modules.laws.oldSystem.mapper.OldSystemDepartRelationMapper;
|
||||
import com.jero.modules.system.entity.SysDepart;
|
||||
import com.jero.modules.system.service.ISysDepartService;
|
||||
import lombok.Cleanup;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
@@ -16,11 +21,11 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
@@ -33,6 +38,9 @@ import java.util.Map;
|
||||
public class OldSystemDepartRelationServiceImpl extends ServiceImpl<OldSystemDepartRelationMapper, OldSystemDepartRelation>
|
||||
implements OldSystemDepartRelationService {
|
||||
|
||||
@Resource
|
||||
private ISysDepartService sysDepartService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> importData(MultipartFile file) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
@@ -44,19 +52,15 @@ public class OldSystemDepartRelationServiceImpl extends ServiceImpl<OldSystemDep
|
||||
params.setNeedSave(true);
|
||||
|
||||
try {
|
||||
List<OldSystemDepartRelation> list = ExcelImportUtil.importExcel(file.getInputStream(), OldSystemDepartRelation.class, params);
|
||||
@Cleanup
|
||||
InputStream inputStream = file.getInputStream();
|
||||
List<OldSystemDepartRelation> list = ExcelImportUtil.importExcel(inputStream, OldSystemDepartRelation.class, params);
|
||||
saveBatch(list, list.size());
|
||||
} catch (Exception e) {
|
||||
errorMsgs.add("文件导入异常:" + e.getMessage());
|
||||
resultMap.put("msg", errorMsgs);
|
||||
resultMap.put("flag", YesOrNoEnum.NO.getValue());
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
+27
@@ -26,4 +26,31 @@ public interface ILawsEnterpriseStandardService extends IService<LawsEnterpriseS
|
||||
* @return
|
||||
*/
|
||||
void importExcelOldSystem(MultipartFile file, String type, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 老法规企标所有人权限数据导入
|
||||
*
|
||||
* @param file
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
void importOldESAuthAllExcel(MultipartFile file, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 老法规企标个人权限数据导入
|
||||
*
|
||||
* @param file
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
void importOldESAuthUserExcel(MultipartFile file, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 老法规企标部门权限数据导入
|
||||
*
|
||||
* @param file
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
void importOldESAuthDeptExcel(MultipartFile file, HttpServletResponse response);
|
||||
}
|
||||
|
||||
+54
-24
@@ -115,6 +115,9 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
|
||||
@Resource
|
||||
private ILawsHomeSearchService lawsHomeSearchService;
|
||||
|
||||
@Resource
|
||||
private ISysDepartService sysDepartService;
|
||||
|
||||
@Override
|
||||
public LawsEnterpriseStandard queryByStandardNumber(String standardNumber) {
|
||||
if (StringUtils.isBlank(standardNumber)) {
|
||||
@@ -210,7 +213,7 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
|
||||
}
|
||||
// 导入国标
|
||||
// 判断是否需要跳过
|
||||
if (gbDatalist.isEmpty()) {
|
||||
if (gbDatalist.isEmpty()) {
|
||||
log.info("国标数据为空,跳过导入");
|
||||
} else {
|
||||
this.oldSysGBImport(gbDatalist, errImportList);
|
||||
@@ -391,29 +394,56 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
|
||||
List<LawsEnterpriseStandard> esList = this.list(esWrapper.isNotNull(LawsEnterpriseStandard::getOldSystemId));
|
||||
Map<String, LawsEnterpriseStandard> esMap = esList.stream().collect(Collectors.toMap(LawsEnterpriseStandard::getOldSystemId, o -> o));
|
||||
Map<String, List<ESAuthDept>> auMap = datalist.stream().collect(Collectors.groupingBy(ESAuthDept::getStandardId));
|
||||
List<SysDepart> deptlist = departService.list();
|
||||
// Map<String, SysDepart> deptMap = deptlist.stream().collect(Collectors.toMap(SysDepart::getUsername, o -> o));
|
||||
//
|
||||
// List<EnterpriseStandardAuthUser> authUserList = new ArrayList<>();
|
||||
// // 遍历esMap
|
||||
// for (Map.Entry<String, LawsEnterpriseStandard> entry : esMap.entrySet()) {
|
||||
// LawsEnterpriseStandard es = entry.getValue();
|
||||
// String standardId = es.getId();
|
||||
// List<ESAuthUser> auList = auMap.get(standardId);
|
||||
// if (auList != null) {
|
||||
// for (ESAuthUser au : auList) {
|
||||
// EnterpriseStandardAuthUser authUser = new EnterpriseStandardAuthUser();
|
||||
// authUser.setStandardId(es.getId());
|
||||
// String userId = userMap.get(au.getWorkNumber()).getId();
|
||||
// authUser.setAuthUser(userId);
|
||||
// authUser.setAuthExpireDate(date);
|
||||
// authUserList.add(authUser);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// esAuthUserService.saveBatch(authUserList, authUserList.size());
|
||||
|
||||
log.info("企标所有人权限导入成功");
|
||||
// 将Excel中涉及到的老部门名称和老上级部门名称找出来
|
||||
Set<String> oldDeptNameList = new HashSet<>();
|
||||
for (ESAuthDept ad : datalist) {
|
||||
oldDeptNameList.add(ad.getDeptName());
|
||||
oldDeptNameList.add(ad.getHigherDeptName());
|
||||
}
|
||||
|
||||
// 根据老部门名称获取新部门Id
|
||||
LambdaQueryWrapper<OldSystemDepartRelation> oldDeptWrapper = new LambdaQueryWrapper<>();
|
||||
oldDeptWrapper.in(OldSystemDepartRelation::getOldOrgName, oldDeptNameList);
|
||||
List<OldSystemDepartRelation> oldDeptList = oldDeptService.list(oldDeptWrapper);
|
||||
|
||||
// 获取所有有关联的新部门
|
||||
LambdaQueryWrapper<SysDepart> sysDeptWrapper = new LambdaQueryWrapper<>();
|
||||
sysDeptWrapper.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
|
||||
sysDeptWrapper.eq(SysDepart::getStatus, 1);
|
||||
List<SysDepart> curDeptList = sysDepartService.list(sysDeptWrapper);
|
||||
curDeptList.add(sysDepartService.getById("0"));
|
||||
Map<String, SysDepart> allCurDeptMap = curDeptList.stream().collect(Collectors.toMap(SysDepart::getId, o -> o));
|
||||
|
||||
Map<String, SysDepart> curDeptNameMap = new HashMap<>();
|
||||
for (SysDepart d : curDeptList) {
|
||||
if (StrUtil.isNotBlank(d.getParentId())) {
|
||||
String departName = d.getDepartName();
|
||||
SysDepart sysDepart = allCurDeptMap.get(d.getParentId());
|
||||
if (sysDepart != null) {
|
||||
departName = departName + "-" + sysDepart.getDepartName();
|
||||
}
|
||||
curDeptNameMap.put(departName, d);
|
||||
}
|
||||
}
|
||||
|
||||
for (ESAuthDept ad : datalist) {
|
||||
try {
|
||||
EnterpriseStandardAuthDept authDept = new EnterpriseStandardAuthDept();
|
||||
authDept.setStandardId(esMap.get(ad.getStandardId()).getId());
|
||||
String curDeptId = curDeptNameMap.get(ad.getDeptName() + "-" + ad.getHigherDeptName()).getId();
|
||||
if (StrUtil.isBlank(curDeptId)) {
|
||||
log.error("导入部门对应出现错误:{}", "找不到对应的新部门");
|
||||
log.error("错误数据:{}", ad.toString());
|
||||
continue;
|
||||
}
|
||||
authDept.setAuthDept(curDeptId);
|
||||
esAuthDeptService.save(authDept);
|
||||
} catch (Exception e) {
|
||||
log.error("导入部门对应出现错误:{}", e.getMessage());
|
||||
log.error("错误数据:{}", ad.toString());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("导入失败;{}", e.getMessage());
|
||||
}
|
||||
@@ -501,7 +531,7 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
|
||||
String zrr = dto.getZrr();
|
||||
String zrrid = dto.getZrrid();
|
||||
if (StrUtil.isNotBlank(zrr) && StrUtil.isNotBlank(zrrid)) {
|
||||
gb.setResponsibleDepartment(allUserMap.get(zrr + zrrid).getId());
|
||||
gb.setResponsibleDepartmentUser(allUserMap.get(zrr + zrrid).getId());
|
||||
}
|
||||
|
||||
// 根据文件路径获取文件Id
|
||||
|
||||
Reference in New Issue
Block a user