lyhzzz 1 ano atrás
pai
commit
a19d494b0c

+ 2 - 0
src/main/java/com/fdkankan/manage/service/IRtkAccountService.java

@@ -36,4 +36,6 @@ public interface IRtkAccountService extends IService<RtkAccount> {
     Long getCanUseCount();
 
     Integer insExcelList(List<HashMap<Integer, String>> excelRowList);
+
+    Integer insFailureTimeExcelList(List<HashMap<Integer, String>> excelRowList);
 }

+ 1 - 0
src/main/java/com/fdkankan/manage/service/impl/ExcelServiceImpl.java

@@ -100,6 +100,7 @@ public class ExcelServiceImpl implements IExcelService {
             case 2 :return cameraService.companyExcelList(excelRowList);
             case 3 :return rtkDeviceService.insExcelList(excelRowList);
             case 4 :return rtkAccountService.insExcelList(excelRowList);
+            case 5 :return rtkAccountService.insFailureTimeExcelList(excelRowList);
             default:
                 throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }

+ 58 - 0
src/main/java/com/fdkankan/manage/service/impl/RtkAccountServiceImpl.java

@@ -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();
+    }
 }

+ 5 - 0
src/main/java/com/fdkankan/manage/vo/request/RtkAccountInParam.java

@@ -15,4 +15,9 @@ public class RtkAccountInParam {
     private String mountPoint;
     private String port ;
     private Date failureTime ;
+
+    public RtkAccountInParam(String userName, Date failureTime) {
+        this.userName = userName;
+        this.failureTime = failureTime;
+    }
 }