|
|
@@ -1,6 +1,9 @@
|
|
|
package com.fs.live.service.impl;
|
|
|
|
|
|
|
|
|
+import com.fs.common.exception.ServiceException;
|
|
|
+import com.fs.common.utils.DateUtils;
|
|
|
+import com.fs.his.domain.FsInquiryDisease;
|
|
|
import com.fs.live.domain.LiveSensitiveWords;
|
|
|
import com.fs.live.mapper.LiveSensitiveWordsMapper;
|
|
|
import com.fs.live.service.ILiveSensitiveWordsService;
|
|
|
@@ -102,4 +105,45 @@ public class LiveSensitiveWordsServiceImpl implements ILiveSensitiveWordsService
|
|
|
public List<String> selectAllWords() {
|
|
|
return baseMapper.selectAllWords();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String importData(List<LiveSensitiveWords> list) {
|
|
|
+ if (com.fs.common.utils.StringUtils.isNull(list) || list.size() == 0)
|
|
|
+ {
|
|
|
+ throw new ServiceException("导入数据不能为空!");
|
|
|
+ }
|
|
|
+ int successNum = 0;
|
|
|
+ int failureNum = 0;
|
|
|
+ StringBuilder successMsg = new StringBuilder();
|
|
|
+ StringBuilder failureMsg = new StringBuilder();
|
|
|
+ for (LiveSensitiveWords vo : list)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ vo.setCreateTime(DateUtils.getNowDate());
|
|
|
+ int i = baseMapper.insertLiveSensitiveWords(vo);
|
|
|
+
|
|
|
+ successNum++;
|
|
|
+ successMsg.append("<br/>" + successNum + "、名称 " + vo.getWord() + " 导入成功");
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+
|
|
|
+ failureNum++;
|
|
|
+ String msg = "<br/>" + failureNum + "、名称 " +vo.getWord() + " 导入失败:";
|
|
|
+ failureMsg.append(msg + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (failureNum > 0)
|
|
|
+ {
|
|
|
+ failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
|
|
+ throw new ServiceException(failureMsg.toString());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
|
|
+ }
|
|
|
+ return successMsg.toString();
|
|
|
+ }
|
|
|
}
|