Commit e7c8b6d1 authored by hongguangwu's avatar hongguangwu

事务

parent a5e4688e
......@@ -24,6 +24,10 @@ public class EmployeeConstants {
public static final String MAJOR = "专业必填";
public static final String ADMISSION_DATE = "入学时间必填";
public static final String GRADUTION_DATE = "毕业时间必填";
public static final String ID_ROVINCE_MUST = "更新户籍市,户籍省必填";
public static final String ID_CITY_MUST = "更新户籍县,户籍市必填";
public static final String FILE_ROVINCE_MUST = "更新档案市,档案省必填";
public static final String FILE_CITY_MUST = "更新档案县,档案市必填";
/**
* 无数据可更新
......
......@@ -825,22 +825,12 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
// 调用区域服务,渲染区域值
R<Map<String, Map<String, String>>> areaR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/area/inner/getAreaToName", null, Map.class, SecurityConstants.FROM_IN);
Map<String, Map<String, String>> areaMapR;
Map<String, String> areaMap;
if (areaR == null || Common.isEmpty(areaR.getData())) {
return R.failed("获取区域失败!");
} else {
areaMapR = areaR.getData();
areaMap = areaMapR.get("data");
if (areaMap == null) {
return R.failed("获取区域失败!!");
}
}
/*R<Map<String, Map<String, String>>> areaR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/area/inner/getAreaToName", null, Map.class, SecurityConstants.FROM_IN);*/
TEmployeeInfo checkPhone;
List<TEmployeeInfo> phoneEmpList;
String areaStr;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
// 已有验证报错直接下一个
......@@ -967,46 +957,52 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
// 户籍所在地
if (Common.isNotNull(excel.getIdProvince())) {
if (areaMap.get(excel.getIdProvince()) == null) {
areaStr = ExcelUtil.getRedisAreaValue("area_" + excel.getIdProvince().trim());
if (Common.isEmpty(areaStr)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setIdProvince(Integer.parseInt(areaMap.get(excel.getIdProvince())));
saveEmp.setIdProvince(Integer.parseInt(areaStr));
}
}
if (Common.isNotNull(excel.getIdCity())) {
if (areaMap.get(excel.getIdCity()) == null) {
areaStr = ExcelUtil.getRedisAreaValue("area_" + excel.getIdCity() + CommonConstants.DOWN_LINE_STRING + excel.getIdProvince().trim());
if (Common.isEmpty(areaStr)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setIdCity(Integer.parseInt(areaMap.get(excel.getIdCity())));
saveEmp.setIdCity(Integer.parseInt(areaStr));
}
}
if (Common.isNotNull(excel.getIdTown())) {
if (areaMap.get(excel.getIdTown()) == null) {
areaStr = ExcelUtil.getRedisAreaValue("area_" + excel.getIdTown() + CommonConstants.DOWN_LINE_STRING + excel.getIdCity().trim());
if (Common.isEmpty(areaStr)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setIdTown(Integer.parseInt(areaMap.get(excel.getIdTown())));
saveEmp.setIdTown(Integer.parseInt(areaStr));
}
}
// 档案所在地
if (Common.isNotNull(excel.getFileProvince())) {
if (areaMap.get(excel.getFileProvince()) == null) {
areaStr = ExcelUtil.getRedisAreaValue("area_" + excel.getFileProvince().trim());
if (Common.isEmpty(areaStr)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_FILE_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setFileProvince(Integer.parseInt(areaMap.get(excel.getFileProvince())));
saveEmp.setFileProvince(Integer.parseInt(areaStr));
}
}
if (Common.isNotNull(excel.getFileCity())) {
if (areaMap.get(excel.getFileCity()) == null) {
areaStr = ExcelUtil.getRedisAreaValue("area_" + excel.getFileCity() + CommonConstants.DOWN_LINE_STRING + excel.getFileProvince().trim());
if (Common.isEmpty(areaStr)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_FILE_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setFileCity(Integer.parseInt(areaMap.get(excel.getFileCity())));
saveEmp.setFileCity(Integer.parseInt(areaStr));
}
}
if (Common.isNotNull(excel.getFileTown())) {
if (areaMap.get(excel.getFileTown()) == null) {
areaStr = ExcelUtil.getRedisAreaValue("area_" + excel.getFileTown() + CommonConstants.DOWN_LINE_STRING + excel.getFileCity().trim());
if (Common.isEmpty(areaStr)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_FILE_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setFileTown(Integer.parseInt(areaMap.get(excel.getFileTown())));
saveEmp.setFileTown(Integer.parseInt(areaStr));
}
}
if (Common.isNotNull(excel.getIsCollege())) {
......@@ -1312,6 +1308,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
areaMap = areaMaps.get("data");
}
String areaStr;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
// 已有验证报错直接下一个
......@@ -1408,47 +1405,54 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
}
// 户籍所在地
// 户籍所在地
if (Common.isNotNull(excel.getIdProvince())) {
if (areaMap.get(excel.getIdProvince()) == null) {
areaStr = ExcelUtil.getRedisAreaValue("area_" + excel.getIdProvince().trim());
if (Common.isEmpty(areaStr)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setIdProvince(Integer.parseInt(areaMap.get(excel.getIdProvince())));
saveEmp.setIdProvince(Integer.parseInt(areaStr));
}
}
if (Common.isNotNull(excel.getIdCity())) {
if (areaMap.get(excel.getIdCity()) == null) {
areaStr = ExcelUtil.getRedisAreaValue("area_" + excel.getIdCity() + CommonConstants.DOWN_LINE_STRING + excel.getIdProvince().trim());
if (Common.isEmpty(areaStr)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setIdCity(Integer.parseInt(areaMap.get(excel.getIdCity())));
saveEmp.setIdCity(Integer.parseInt(areaStr));
}
}
if (Common.isNotNull(excel.getIdTown())) {
if (areaMap.get(excel.getIdTown()) == null) {
areaStr = ExcelUtil.getRedisAreaValue("area_" + excel.getIdTown() + CommonConstants.DOWN_LINE_STRING + excel.getIdCity().trim());
if (Common.isEmpty(areaStr)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setIdTown(Integer.parseInt(areaMap.get(excel.getIdTown())));
saveEmp.setIdTown(Integer.parseInt(areaStr));
}
}
// 档案所在地
if (Common.isNotNull(excel.getFileProvince())) {
if (areaMap.get(excel.getFileProvince()) == null) {
areaStr = ExcelUtil.getRedisAreaValue("area_" + excel.getFileProvince().trim());
if (Common.isEmpty(areaStr)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_FILE_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setFileProvince(Integer.parseInt(areaMap.get(excel.getFileProvince())));
saveEmp.setFileProvince(Integer.parseInt(areaStr));
}
}
if (Common.isNotNull(excel.getFileCity())) {
if (areaMap.get(excel.getFileCity()) == null) {
areaStr = ExcelUtil.getRedisAreaValue("area_" + excel.getFileCity() + CommonConstants.DOWN_LINE_STRING + excel.getFileProvince().trim());
if (Common.isEmpty(areaStr)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_FILE_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setFileCity(Integer.parseInt(areaMap.get(excel.getFileCity())));
saveEmp.setFileCity(Integer.parseInt(areaStr));
}
}
if (Common.isNotNull(excel.getFileTown())) {
if (areaMap.get(excel.getFileTown()) == null) {
areaStr = ExcelUtil.getRedisAreaValue("area_" + excel.getFileTown() + CommonConstants.DOWN_LINE_STRING + excel.getFileCity().trim());
if (Common.isEmpty(areaStr)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_FILE_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setFileTown(Integer.parseInt(areaMap.get(excel.getFileTown())));
saveEmp.setFileTown(Integer.parseInt(areaStr));
}
}
if (Common.isNotNull(excel.getIsCollege())) {
......@@ -1619,6 +1623,18 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
}
}
if (Common.isNotNull(employeeInfo.getIdCity()) && Common.isEmpty(employeeInfo.getIdProvince())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.ID_ROVINCE_MUST));
}
if (Common.isNotNull(employeeInfo.getIdTown()) && Common.isEmpty(employeeInfo.getIdCity())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.ID_CITY_MUST));
}
if (Common.isNotNull(employeeInfo.getFileCity()) && Common.isEmpty(employeeInfo.getFileProvince())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.FILE_ROVINCE_MUST));
}
if (Common.isNotNull(employeeInfo.getFileTown()) && Common.isEmpty(employeeInfo.getFileCity())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.FILE_CITY_MUST));
}
}
// 更新学历-房
......
......@@ -458,6 +458,12 @@ public class ExcelUtil <T> implements Serializable {
}
return tempStr;
}
// 简单的获取区域字典value
public static String getRedisAreaValue(String c) {
return String.valueOf(RedisUtil.redis.opsForValue().get(c));
}
private String getDicValue(String c, String tempStr, ExcelAttribute attr,Integer rowNum, ErrorMessage errorTemp) {
Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get(attr.dataType());
boolean flag = true;
......
......@@ -16,7 +16,10 @@
package com.yifu.cloud.plus.v1.yifu.admin.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysAreaService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.tags.Tag;
......@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
......@@ -68,4 +72,17 @@ public class AreaController {
return sysAreaService.getAreaToName();
}
/**
* @param
* @Description: 获取所有区域list
* @Author: hgw
* @Date: 2022-7-6 16:42:39
**/
@Inner
@PostMapping("/inner/getSysAreaList")
public List<SysArea> getSysAreaList() {
return sysAreaService.list(Wrappers.<SysArea>query().lambda()
.eq(SysArea::getStatus, CommonConstants.ZERO_INT).orderByAsc(SysArea::getParentId));
}
}
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