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;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
......@@ -122,5 +123,11 @@ public class TEmpBadRecord extends BaseEntity {
@ExcelProperty("其他损失")
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 {
@ExcelProperty(value = "邮箱")
private String empEmail;
@ExcelAttribute(name = "户籍所在省", isDataId = true, isArea = true)
@ExcelAttribute(name = "户籍所在省", isArea = true)
@ExcelProperty(value = "户籍所在省")
private String idProvince;
@ExcelAttribute(name = "户籍所在市", isDataId = true, isArea = true, parentField = "idProvince")
@ExcelAttribute(name = "户籍所在市", isArea = true, parentField = "idProvince")
@ExcelProperty(value = "户籍所在市")
private String idCity;
@ExcelAttribute(name = "户籍所在县", isDataId = true, isArea = true, parentField = "idCity")
@ExcelAttribute(name = "户籍所在县", isArea = true, parentField = "idCity")
@ExcelProperty(value = "户籍所在县")
private String idTown;
......
......@@ -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.TEmployeeInfo;
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.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper;
......@@ -66,7 +67,7 @@ import java.util.List;
@RequiredArgsConstructor
@Service
public class TEmpBadRecordServiceImpl extends ServiceImpl<TEmpBadRecordMapper, TEmpBadRecord> implements TEmpBadRecordService {
private final TAttaInfoMapper attaInfoMapper;
private final TEmployeeInfoMapper employeeInfoMapper;
private final TEmployeeProjectMapper projectMapper;
......@@ -128,7 +129,17 @@ public class TEmpBadRecordServiceImpl extends ServiceImpl<TEmpBadRecordMapper, T
@Override
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) {
......
......@@ -790,7 +790,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeProject::getProjectStatus,CommonConstants.ZERO_STRING)
.eq(TEmployeeProject::getEmpIdcard,empIdCard));
Map<String,String> projectMap = new HashMap<>();
if (Common.isEmpty(projects)){
if (Common.isNotNull(projects)){
for (TEmployeeProject project:projects){
projectMap.put(project.getDeptName(),project.getDeptNo());
}
......
......@@ -39,6 +39,8 @@ public class ExcelUtil <T> implements Serializable {
private Field[] fields;
public void convertEntity(T vo, String[] exportFields, Map<String,String> diyDicMap, String dateFormat) {
String provinceTemp;
String cityTemp;
// 得到所有定义字段
Field[] allFields = clazz.getDeclaredFields();
List<Field> fields = new ArrayList<>();
......@@ -129,12 +131,7 @@ public class ExcelUtil <T> implements Serializable {
}
} else if (attr.isArea()){
//区域字段处理 TODO
if (!Common.isNotNull(attr.parentField())) {
value = getAreaLabel("area_"+field.get(vo) + "_0", attr);
} else {
// TODO
value = getAreaLabel("area_"+field.get(vo)+ "_" + getFieldValueByName(attr.parentField(), vo, null), attr);
}
value = getAreaLabel("area_"+field.get(vo));
}
field.set(vo, Common.isNotNull(value)?value:field.get(vo));
}catch (Exception e){
......@@ -224,6 +221,7 @@ public class ExcelUtil <T> implements Serializable {
String tempStr = "";
ErrorMessage errorTemp = null;
errorMessageHashMap = new HashMap<>();
Map<String,Field> mapArea = new HashMap<>();
// 参数校验
ExcelAttribute attr = null;
try{
......@@ -272,7 +270,8 @@ public class ExcelUtil <T> implements Serializable {
tempStr = dicMap.get(attr.dataType() + "_" + c.trim());
}*/
} else {
}
}else {
if (attr.isArea()) {
//区域字段处理 TODO
if (!Common.isNotNull(attr.parentField())) {
......@@ -303,14 +302,17 @@ public class ExcelUtil <T> implements Serializable {
}
if (Common.isNotNull(tempStr)){
c = tempStr;
}
mapArea.put(tempStr,field);
}
// 取得类型,并根据对象类型设置值.
fieldType = field.getType();
if (fieldType == null) {
continue;
}
if (String.class == fieldType) {
if (attr.isArea()){
// 区域字段单独处理
continue;
}else if (String.class == fieldType) {
field.set(data, c);
} else if (BigDecimal.class == fieldType) {
c = c.indexOf('%') != -1 ? c.replace("%", "") : c;
......@@ -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){
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, attr.name() + ":" + c.trim() + "校验异常,请联系管理人员"), errorTemp);
}finally {
......@@ -432,12 +439,12 @@ public class ExcelUtil <T> implements Serializable {
}
return propertyValue;
}
private String getAreaLabel(String c, ExcelAttribute attr) {
private String getAreaLabel(String c) {
return (String)RedisUtil.redis.opsForValue().get(c);
}
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)){
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, attr.name() + ":" + c.trim() + "校验异常,请联系管理人员"), errorTemp);
return CommonConstants.EMPTY_STRING;
......
......@@ -49,15 +49,13 @@ public class DictItemRedisInit {
if (Common.isNotNull(allAreas)){
Map<String,SysArea> areaMap = new HashMap<>();
for (SysArea area:allAreas){
redisUtil.set("area_" + area.getId()
+ CommonConstants.DOWN_LINE_STRING
+(Common.isEmpty(area.getParentId())?"0":area.getParentId()),area.getAreaName());
redisUtil.set("area_" + area.getId(),area.getAreaName());
areaMap.put(area.getId().toString(),area);
}
SysArea temp;
for (SysArea area:allAreas){
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()
+ CommonConstants.DOWN_LINE_STRING
+(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