|
@@ -1,6 +1,7 @@
|
|
|
package com.rongwei.sfcommon.sys.service.impl;
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -22,6 +23,7 @@ import org.springframework.stereotype.Service;
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
@@ -64,6 +66,15 @@ public class AspRiskSourceServiceImpl extends ServiceImpl<AspRiskSourceDao, AspR
|
|
|
map4.put(sysUserDo.getName(),sysUserDo.getId());
|
|
|
}
|
|
|
|
|
|
+ //初始化序号短码
|
|
|
+ HashMap<String, String> map5 = new HashMap<>();
|
|
|
+ map5.put("0001S31000000000J0TR","CXBC");
|
|
|
+ map5.put("0001651000000017DRZ1","CXJL");
|
|
|
+ map5.put("0001651000000015EFDD","CXLB");
|
|
|
+
|
|
|
+ //时间 年月
|
|
|
+ String time = DateUtil.format(new Date(),"yyyyMM");
|
|
|
+
|
|
|
List<AspRiskSourceDo> resList = new LinkedList<>();
|
|
|
|
|
|
//读取文件
|
|
@@ -71,6 +82,7 @@ public class AspRiskSourceServiceImpl extends ServiceImpl<AspRiskSourceDao, AspR
|
|
|
Workbook workbook = new HSSFWorkbook(fis)) {
|
|
|
|
|
|
Sheet sheet = workbook.getSheetAt(0); // 读取第一个工作表
|
|
|
+ int i= 1;
|
|
|
for (Row row : sheet) {
|
|
|
String cell0 = row.getCell(0).getStringCellValue().trim();
|
|
|
if(ObjectUtil.isEmpty(cell0)){
|
|
@@ -87,6 +99,8 @@ public class AspRiskSourceServiceImpl extends ServiceImpl<AspRiskSourceDao, AspR
|
|
|
|
|
|
//所属工厂
|
|
|
aspRiskSourceDo.setTenantid(map.get(cell0));
|
|
|
+ //序号
|
|
|
+ aspRiskSourceDo.setSerialnumber(map5.get(aspRiskSourceDo.getTenantid())+"-"+ time+"-AQ-"+String.format("%03d", i));
|
|
|
//名称
|
|
|
aspRiskSourceDo.setName(row.getCell(1).getStringCellValue().trim());
|
|
|
if(haveJob) {
|
|
@@ -142,8 +156,10 @@ public class AspRiskSourceServiceImpl extends ServiceImpl<AspRiskSourceDao, AspR
|
|
|
List<String> userNameList = new LinkedList<>();
|
|
|
List<String> userIdList = new LinkedList<>();
|
|
|
for (String s : split2) {
|
|
|
- userNameList.add(s);
|
|
|
- userIdList.add(map4.get(key2));
|
|
|
+ if(map4.containsKey(s)) {
|
|
|
+ userNameList.add(s);
|
|
|
+ userIdList.add(map4.get(s));
|
|
|
+ }
|
|
|
}
|
|
|
aspRiskSourceDo.setDutyofficername(String.join(",", userNameList));
|
|
|
aspRiskSourceDo.setDutyofficerid(String.join(",", userIdList));
|
|
@@ -151,6 +167,7 @@ public class AspRiskSourceServiceImpl extends ServiceImpl<AspRiskSourceDao, AspR
|
|
|
|
|
|
//合并
|
|
|
resList.add(aspRiskSourceDo);
|
|
|
+ i+=1;
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|