|
|
@@ -6,6 +6,7 @@ import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.dao.RdDetailsMapper;
|
|
|
import com.goafanti.common.model.RdDetails;
|
|
|
+import com.goafanti.common.utils.StringUtils;
|
|
|
import com.goafanti.common.utils.excel.NewExcelUtil;
|
|
|
import com.goafanti.common.utils.pdf.PDFUtils;
|
|
|
import com.goafanti.common.utils.word.WordUtils;
|
|
|
@@ -114,18 +115,38 @@ public class RDServiceImpl extends BaseMybatisDao<RdDetailsMapper> implements RD
|
|
|
String aid=TokenManager.getAdminId();
|
|
|
Date date =new Date();
|
|
|
Map<String,Object> map=new HashMap<>();
|
|
|
- List<InputExcelRdDetails> relust= new ArrayList<>();
|
|
|
+ int OkCount=0;
|
|
|
+ int RdCount=0;
|
|
|
+ int erCount=0;
|
|
|
List<String>errors=new ArrayList<>();
|
|
|
for (InputExcelRdDetails in : list) {
|
|
|
- relust.add(in);
|
|
|
- }
|
|
|
- for (InputExcelRdDetails in : relust) {
|
|
|
- in.setStatus(1);
|
|
|
- in.setAid(aid);
|
|
|
- in.setCreateTime(date);
|
|
|
+ if (StringUtils.isNotEmpty(in.getRdName())){
|
|
|
+ RdCount++;
|
|
|
+ OkCount++;
|
|
|
+ int i = rdDetailsMapper.selectByRDName(in.getRdName());
|
|
|
+ if (i==0){
|
|
|
+ try {
|
|
|
+ in.setStatus(1);
|
|
|
+ in.setAid(aid);
|
|
|
+ in.setCreateTime(date);
|
|
|
+ rdDetailsMapper.insertSelective(in);
|
|
|
+ }catch (Exception e ){
|
|
|
+ int errorsCount=RdCount+3;
|
|
|
+ erCount++;
|
|
|
+ OkCount--;
|
|
|
+ errors.add(String.format("%s.数据第%s行,项目名称[%s]数据异常!",erCount,errorsCount,in.getRdName()));
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ OkCount--;
|
|
|
+ erCount++;
|
|
|
+ int errorsCount=RdCount+3;
|
|
|
+ errors.add(String.format("%s.数据第%s行,名称[%s]导入失败,名称已存在!",erCount,errorsCount,in.getRdName()));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- if (relust.size()>0)insertBatch(relust);
|
|
|
- map.put("OK",relust.size());
|
|
|
+
|
|
|
+// if (relust.size()>0)insertBatch(relust);
|
|
|
+ map.put("OK",OkCount);
|
|
|
map.put("ERROR",errors);
|
|
|
return map;
|
|
|
}
|