|
|
@@ -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,23 +115,34 @@ public class RDServiceImpl extends BaseMybatisDao<RdDetailsMapper> implements RD
|
|
|
String aid=TokenManager.getAdminId();
|
|
|
Date date =new Date();
|
|
|
Map<String,Object> map=new HashMap<>();
|
|
|
- int count=0;
|
|
|
+ int OkCount=0;
|
|
|
+ int RdCount=0;
|
|
|
List<String>errors=new ArrayList<>();
|
|
|
for (InputExcelRdDetails in : list) {
|
|
|
- int i = rdDetailsMapper.selectByRDName(in.getRdName());
|
|
|
- if (i==0){
|
|
|
- in.setStatus(1);
|
|
|
- in.setAid(aid);
|
|
|
- in.setCreateTime(date);
|
|
|
- count++;
|
|
|
- rdDetailsMapper.insertSelective(in);
|
|
|
- }else {
|
|
|
- errors.add(String.format("名称[%s]导入失败,名称已存在!",in.getRdName()));
|
|
|
+ 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;
|
|
|
+ errors.add(String.format("数据第%s行,项目名称[%s]数据格式不正确,请核对后再上传。",errorsCount,in.getRdName()));
|
|
|
+ OkCount--;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ OkCount--;
|
|
|
+ errors.add(String.format("名称[%s]导入失败,名称已存在!",in.getRdName()));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// if (relust.size()>0)insertBatch(relust);
|
|
|
- map.put("OK",count);
|
|
|
+ map.put("OK",OkCount);
|
|
|
map.put("ERROR",errors);
|
|
|
return map;
|
|
|
}
|