Commit 827b9246 authored by huyuchen's avatar huyuchen

Merge branch 'develop' of http://git.yifucenter.com/fangxinjiang/yifu into develop

parents 5b6dcb8a 904b9763
...@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.entity; ...@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.entity;
import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
...@@ -122,5 +123,11 @@ public class TEmpBadRecord extends BaseEntity { ...@@ -122,5 +123,11 @@ public class TEmpBadRecord extends BaseEntity {
@ExcelProperty("其他损失") @ExcelProperty("其他损失")
private BigDecimal loseFeeOther; private BigDecimal loseFeeOther;
/**
* @Author fxj
* @Description 附件ID
* @Date 14:53 2022/6/21
**/
@TableField(exist = false)
private String attaIds;
} }
...@@ -75,15 +75,15 @@ public class EmployeeExportVO extends BaseEntity { ...@@ -75,15 +75,15 @@ public class EmployeeExportVO extends BaseEntity {
@ExcelProperty(value = "邮箱") @ExcelProperty(value = "邮箱")
private String empEmail; private String empEmail;
@ExcelAttribute(name = "户籍所在省", isDataId = true, isArea = true) @ExcelAttribute(name = "户籍所在省", isArea = true)
@ExcelProperty(value = "户籍所在省") @ExcelProperty(value = "户籍所在省")
private String idProvince; private String idProvince;
@ExcelAttribute(name = "户籍所在市", isDataId = true, isArea = true, parentField = "idProvince") @ExcelAttribute(name = "户籍所在市", isArea = true, parentField = "idProvince")
@ExcelProperty(value = "户籍所在市") @ExcelProperty(value = "户籍所在市")
private String idCity; private String idCity;
@ExcelAttribute(name = "户籍所在县", isDataId = true, isArea = true, parentField = "idCity") @ExcelAttribute(name = "户籍所在县", isArea = true, parentField = "idCity")
@ExcelProperty(value = "户籍所在县") @ExcelProperty(value = "户籍所在县")
private String idTown; private String idTown;
......
...@@ -34,6 +34,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpBadRecord; ...@@ -34,6 +34,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpBadRecord;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpWorkRecording; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpWorkRecording;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TAttaInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmpBadRecordMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmpBadRecordMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper;
...@@ -66,7 +67,7 @@ import java.util.List; ...@@ -66,7 +67,7 @@ import java.util.List;
@RequiredArgsConstructor @RequiredArgsConstructor
@Service @Service
public class TEmpBadRecordServiceImpl extends ServiceImpl<TEmpBadRecordMapper, TEmpBadRecord> implements TEmpBadRecordService { public class TEmpBadRecordServiceImpl extends ServiceImpl<TEmpBadRecordMapper, TEmpBadRecord> implements TEmpBadRecordService {
private final TAttaInfoMapper attaInfoMapper;
private final TEmployeeInfoMapper employeeInfoMapper; private final TEmployeeInfoMapper employeeInfoMapper;
private final TEmployeeProjectMapper projectMapper; private final TEmployeeProjectMapper projectMapper;
...@@ -128,7 +129,17 @@ public class TEmpBadRecordServiceImpl extends ServiceImpl<TEmpBadRecordMapper, T ...@@ -128,7 +129,17 @@ public class TEmpBadRecordServiceImpl extends ServiceImpl<TEmpBadRecordMapper, T
@Override @Override
public R<Boolean> saveDiy(TEmpBadRecord tEmpBadRecord) { public R<Boolean> saveDiy(TEmpBadRecord tEmpBadRecord) {
return R.ok(baseMapper.insert(tEmpBadRecord) > 0); int res = baseMapper.insert(tEmpBadRecord);
if (res < 0){
return R.failed();
}
//更新附件信息
List<String> ids;
if (Common.isNotNull(tEmpBadRecord.getAttaIds())){
ids = Common.initStrToList(tEmpBadRecord.getAttaIds(),CommonConstants.COMMA_STRING);
attaInfoMapper.updateDomainId(tEmpBadRecord.getId(),ids);
}
return R.ok();
} }
private void importEmpBadRecord(List<EmpBadRecordVo> excelVOList, List<ErrorMessage> errorMessageList) { private void importEmpBadRecord(List<EmpBadRecordVo> excelVOList, List<ErrorMessage> errorMessageList) {
......
...@@ -790,7 +790,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -790,7 +790,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeProject::getProjectStatus,CommonConstants.ZERO_STRING) .eq(TEmployeeProject::getProjectStatus,CommonConstants.ZERO_STRING)
.eq(TEmployeeProject::getEmpIdcard,empIdCard)); .eq(TEmployeeProject::getEmpIdcard,empIdCard));
Map<String,String> projectMap = new HashMap<>(); Map<String,String> projectMap = new HashMap<>();
if (Common.isEmpty(projects)){ if (Common.isNotNull(projects)){
for (TEmployeeProject project:projects){ for (TEmployeeProject project:projects){
projectMap.put(project.getDeptName(),project.getDeptNo()); projectMap.put(project.getDeptName(),project.getDeptNo());
} }
......
...@@ -39,6 +39,8 @@ public class ExcelUtil <T> implements Serializable { ...@@ -39,6 +39,8 @@ public class ExcelUtil <T> implements Serializable {
private Field[] fields; private Field[] fields;
public void convertEntity(T vo, String[] exportFields, Map<String,String> diyDicMap, String dateFormat) { public void convertEntity(T vo, String[] exportFields, Map<String,String> diyDicMap, String dateFormat) {
String provinceTemp;
String cityTemp;
// 得到所有定义字段 // 得到所有定义字段
Field[] allFields = clazz.getDeclaredFields(); Field[] allFields = clazz.getDeclaredFields();
List<Field> fields = new ArrayList<>(); List<Field> fields = new ArrayList<>();
...@@ -129,12 +131,7 @@ public class ExcelUtil <T> implements Serializable { ...@@ -129,12 +131,7 @@ public class ExcelUtil <T> implements Serializable {
} }
} else if (attr.isArea()){ } else if (attr.isArea()){
//区域字段处理 TODO //区域字段处理 TODO
if (!Common.isNotNull(attr.parentField())) { value = getAreaLabel("area_"+field.get(vo));
value = getAreaLabel("area_"+field.get(vo) + "_0", attr);
} else {
// TODO
value = getAreaLabel("area_"+field.get(vo)+ "_" + getFieldValueByName(attr.parentField(), vo, null), attr);
}
} }
field.set(vo, Common.isNotNull(value)?value:field.get(vo)); field.set(vo, Common.isNotNull(value)?value:field.get(vo));
}catch (Exception e){ }catch (Exception e){
...@@ -224,6 +221,7 @@ public class ExcelUtil <T> implements Serializable { ...@@ -224,6 +221,7 @@ public class ExcelUtil <T> implements Serializable {
String tempStr = ""; String tempStr = "";
ErrorMessage errorTemp = null; ErrorMessage errorTemp = null;
errorMessageHashMap = new HashMap<>(); errorMessageHashMap = new HashMap<>();
Map<String,Field> mapArea = new HashMap<>();
// 参数校验 // 参数校验
ExcelAttribute attr = null; ExcelAttribute attr = null;
try{ try{
...@@ -272,45 +270,49 @@ public class ExcelUtil <T> implements Serializable { ...@@ -272,45 +270,49 @@ public class ExcelUtil <T> implements Serializable {
tempStr = dicMap.get(attr.dataType() + "_" + c.trim()); tempStr = dicMap.get(attr.dataType() + "_" + c.trim());
}*/ }*/
} else { }
if (attr.isArea()) { }else {
//区域字段处理 TODO if (attr.isArea()) {
if (!Common.isNotNull(attr.parentField())) { //区域字段处理 TODO
tempStr = getAreaValue("area_"+c.trim(), tempStr, attr,rowNum,errorTemp); if (!Common.isNotNull(attr.parentField())) {
} else { tempStr = getAreaValue("area_"+c.trim(), tempStr, attr,rowNum,errorTemp);
// TODO
tempStr = getAreaValue("area_"+c.trim()+ "_" + getFieldValueByName(attr.parentField(), data, DateUtil.ISO_EXPANDED_DATE_FORMAT), tempStr, attr,rowNum,errorTemp);
}
} else { } else {
//直接按值去找数据 TODO // TODO
tempStr = getDicValue(c.trim() , tempStr, attr,rowNum,errorTemp); tempStr = getAreaValue("area_"+c.trim()+ "_" + getFieldValueByName(attr.parentField(), data, DateUtil.ISO_EXPANDED_DATE_FORMAT), tempStr, attr,rowNum,errorTemp);
} }
} else {
//直接按值去找数据 TODO
tempStr = getDicValue(c.trim() , tempStr, attr,rowNum,errorTemp);
} }
if (!StringUtils.isNotBlank(tempStr)) { }
if (attr.isOrgan()) { if (!StringUtils.isNotBlank(tempStr)) {
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, "未找到:" + c + "的单位或结算主体数据,请确认存在结算主体权限"), errorTemp); if (attr.isOrgan()) {
} errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, "未找到:" + c + "的单位或结算主体数据,请确认存在结算主体权限"), errorTemp);
if (attr.isArea()) { }
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, "未找到:" + c + "的区域数据"), errorTemp); if (attr.isArea()) {
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, "未找到:" + c + "的区域数据"), errorTemp);
} else {
if (Common.isNotNull(attr.errorInfoImport())) {
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, "数据'" + c + "':" + attr.errorInfoImport()), errorTemp);
} else { } else {
if (Common.isNotNull(attr.errorInfoImport())) { errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, "未找到:" + c + "的字典数据"), errorTemp);
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, "数据'" + c + "':" + attr.errorInfoImport()), errorTemp);
} else {
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, "未找到:" + c + "的字典数据"), errorTemp);
}
} }
continue;
}
if (Common.isNotNull(tempStr)){
c = tempStr;
} }
continue;
}
if (Common.isNotNull(tempStr)){
c = tempStr;
mapArea.put(tempStr,field);
} }
// 取得类型,并根据对象类型设置值. // 取得类型,并根据对象类型设置值.
fieldType = field.getType(); fieldType = field.getType();
if (fieldType == null) { if (fieldType == null) {
continue; continue;
} }
if (String.class == fieldType) { if (attr.isArea()){
// 区域字段单独处理
continue;
}else if (String.class == fieldType) {
field.set(data, c); field.set(data, c);
} else if (BigDecimal.class == fieldType) { } else if (BigDecimal.class == fieldType) {
c = c.indexOf('%') != -1 ? c.replace("%", "") : c; c = c.indexOf('%') != -1 ? c.replace("%", "") : c;
...@@ -363,6 +365,11 @@ public class ExcelUtil <T> implements Serializable { ...@@ -363,6 +365,11 @@ public class ExcelUtil <T> implements Serializable {
} }
} }
} }
if (Common.isNotNull(mapArea)){
for (Map.Entry<String, Field> entry: mapArea.entrySet()){
entry.getValue().set(data,entry.getKey());
}
}
}catch (Exception e){ }catch (Exception e){
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, attr.name() + ":" + c.trim() + "校验异常,请联系管理人员"), errorTemp); errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, attr.name() + ":" + c.trim() + "校验异常,请联系管理人员"), errorTemp);
}finally { }finally {
...@@ -432,12 +439,12 @@ public class ExcelUtil <T> implements Serializable { ...@@ -432,12 +439,12 @@ public class ExcelUtil <T> implements Serializable {
} }
return propertyValue; return propertyValue;
} }
private String getAreaLabel(String c, ExcelAttribute attr) { private String getAreaLabel(String c) {
return (String)RedisUtil.redis.opsForValue().get(c); return (String)RedisUtil.redis.opsForValue().get(c);
} }
private String getAreaValue(String c, String tempStr, ExcelAttribute attr,Integer rowNum, ErrorMessage errorTemp) { private String getAreaValue(String c, String tempStr, ExcelAttribute attr,Integer rowNum, ErrorMessage errorTemp) {
tempStr = (String)RedisUtil.redis.opsForValue().get(c); tempStr = String.valueOf(RedisUtil.redis.opsForValue().get(c));
if (Common.isEmpty(tempStr)){ if (Common.isEmpty(tempStr)){
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, attr.name() + ":" + c.trim() + "校验异常,请联系管理人员"), errorTemp); errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, attr.name() + ":" + c.trim() + "校验异常,请联系管理人员"), errorTemp);
return CommonConstants.EMPTY_STRING; return CommonConstants.EMPTY_STRING;
......
...@@ -49,15 +49,13 @@ public class DictItemRedisInit { ...@@ -49,15 +49,13 @@ public class DictItemRedisInit {
if (Common.isNotNull(allAreas)){ if (Common.isNotNull(allAreas)){
Map<String,SysArea> areaMap = new HashMap<>(); Map<String,SysArea> areaMap = new HashMap<>();
for (SysArea area:allAreas){ for (SysArea area:allAreas){
redisUtil.set("area_" + area.getId() redisUtil.set("area_" + area.getId(),area.getAreaName());
+ CommonConstants.DOWN_LINE_STRING
+(Common.isEmpty(area.getParentId())?"0":area.getParentId()),area.getAreaName());
areaMap.put(area.getId().toString(),area); areaMap.put(area.getId().toString(),area);
} }
SysArea temp; SysArea temp;
for (SysArea area:allAreas){ for (SysArea area:allAreas){
if (Common.isNotNull(area.getParentId()) && area.getParentId().intValue() > 0){ if (Common.isNotNull(area.getParentId()) && area.getParentId().intValue() > 0){
temp = areaMap.get(area.getParentId()); temp = areaMap.get(area.getParentId().toString());
redisUtil.set("area_" + area.getAreaName() redisUtil.set("area_" + area.getAreaName()
+ CommonConstants.DOWN_LINE_STRING + CommonConstants.DOWN_LINE_STRING
+(Common.isNotNull(temp)?temp.getAreaName():""),area.getId()); +(Common.isNotNull(temp)?temp.getAreaName():""),area.getId());
......
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