|
@@ -319,4 +319,62 @@ public class RtkAccountServiceImpl extends ServiceImpl<IRtkAccountMapper, RtkAcc
|
|
|
this.saveBatch(dbs);
|
|
|
return dbs.size();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Integer insFailureTimeExcelList(List<HashMap<Integer, String>> excelRowList) {
|
|
|
+ List<RtkAccountInParam> params = new ArrayList<>();
|
|
|
+ List<Integer> errorIndex = new ArrayList<>();
|
|
|
+ Integer index = 0;
|
|
|
+ for (HashMap<Integer, String> map : excelRowList) {
|
|
|
+ index++;
|
|
|
+ if (map.isEmpty()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (index == 0 && !map.get(0).equals("差分账号批量导入模板")) {
|
|
|
+ throw new BusinessException(ResultCode.TEMPLATE_TYPE_ERROR);
|
|
|
+ }
|
|
|
+ if (index < 4) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String userName = map.get(0);
|
|
|
+ String failureTimeStr = map.get(1);
|
|
|
+ if(StringUtils.isBlank(userName) && StringUtils.isBlank(failureTimeStr)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ log.info("rtkAccount-excel-in--userName:{},failureTime:{}",userName,failureTimeStr);
|
|
|
+ if(StringUtils.isBlank(userName) || StringUtils.isBlank(failureTimeStr)){
|
|
|
+ errorIndex.add(index -3);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ RtkAccount rtkAccount = this.getByUserName(userName);
|
|
|
+ if(rtkAccount ==null){
|
|
|
+ errorIndex.add(index -3);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Date failureTime = null;
|
|
|
+ if(StringUtils.isNotBlank(failureTimeStr)){
|
|
|
+ try {
|
|
|
+ failureTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(failureTimeStr);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ errorIndex.add(index -3);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ RtkAccountInParam param = new RtkAccountInParam(userName,failureTime);
|
|
|
+ params.add(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ excelService.toExcelError(errorIndex);
|
|
|
+
|
|
|
+ if(params.size() <=0){
|
|
|
+ throw new BusinessException(ResultCode.RTK_DEVICEIN_TEMPLATE_EMPTY);
|
|
|
+ }
|
|
|
+ return this.updateFailureTime(params);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Integer updateFailureTime(List<RtkAccountInParam> params) {
|
|
|
+
|
|
|
+ return params.size();
|
|
|
+ }
|
|
|
}
|