|
@@ -21,7 +21,9 @@ import com.cyksj.enums.GatewayResponse;
|
|
|
import com.cyksj.mapper.*;
|
|
import com.cyksj.mapper.*;
|
|
|
import com.cyksj.mapper.manage.cms.CmsUserMapper;
|
|
import com.cyksj.mapper.manage.cms.CmsUserMapper;
|
|
|
import com.cyksj.model.entity.*;
|
|
import com.cyksj.model.entity.*;
|
|
|
|
|
+import com.cyksj.model.excel.ExcelDoubleVerifyAccountData;
|
|
|
import com.cyksj.model.excel.ExcelImportAccountData;
|
|
import com.cyksj.model.excel.ExcelImportAccountData;
|
|
|
|
|
+import com.cyksj.model.excel.ExcelImportDoubleVerifyAccountData;
|
|
|
import com.cyksj.model.excel.ExcelManageAccountData;
|
|
import com.cyksj.model.excel.ExcelManageAccountData;
|
|
|
import com.cyksj.model.manage.request.ReqAccountIncrExpiryTime;
|
|
import com.cyksj.model.manage.request.ReqAccountIncrExpiryTime;
|
|
|
import com.cyksj.model.manage.views.AccountView;
|
|
import com.cyksj.model.manage.views.AccountView;
|
|
@@ -664,4 +666,58 @@ public class CmsAccountController {
|
|
|
}
|
|
}
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 导出双重验证账号列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/doubleVerify/export")
|
|
|
|
|
+ public void exportDoubleVerifyAccount(HttpServletResponse response) {
|
|
|
|
|
+ List<ExcelDoubleVerifyAccountData> dataList = beanSearcher.searchAll(ExcelDoubleVerifyAccountData.class, MapUtils.flatBuilder(request.getParameterMap()).build());
|
|
|
|
|
+ EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelDoubleVerifyAccountData.class, dataList, "账号待开启双重验证列表", "账号待开启双重验证列表", ExcelTypeEnum.XLS, null);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 批量导入账号双重账号验证码
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/doubleVerify/import")
|
|
|
|
|
+ public Result<String> importDoubleVerifyCode(MultipartFile file) throws Exception {
|
|
|
|
|
+ EasyExcel.read(file.getInputStream(), ExcelDoubleVerifyAccountData.class, new AnalysisEventListener<ExcelDoubleVerifyAccountData>() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void invoke(ExcelDoubleVerifyAccountData data, AnalysisContext analysisContext) {
|
|
|
|
|
+ String account = data.getAccount();
|
|
|
|
|
+ String apiSecret = data.getApiSecret();
|
|
|
|
|
+ if (StrUtil.isBlank(account) || StrUtil.isBlank(apiSecret)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ Account ac = accountService.getOne(Wrappers.lambdaQuery(Account.class)
|
|
|
|
|
+ .in(Account::getGoodsId, List.of(18, 26))
|
|
|
|
|
+ .eq(Account::getAccount, account.trim())
|
|
|
|
|
+ .eq(Account::getApiSecret, "")
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (ac == null) return;
|
|
|
|
|
+ ac.setApiSecret(apiSecret.trim());
|
|
|
|
|
+ accountService.updateById(ac);
|
|
|
|
|
+
|
|
|
|
|
+ doubleVerifyRecordMapper.update(null, Wrappers.lambdaUpdate(AccountDoubleVerifyRecord.class)
|
|
|
|
|
+ .set(AccountDoubleVerifyRecord::getGroupsId, false)
|
|
|
|
|
+ .eq(AccountDoubleVerifyRecord::getAccountId, ac.getId())
|
|
|
|
|
+ .eq(AccountDoubleVerifyRecord::getDeleted, true));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }).sheet().doRead();
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 双重认证导入模板
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/export/doubleVerify/template")
|
|
|
|
|
+ public void exportDoubleVerifyAccountTemplate(HttpServletResponse response) {
|
|
|
|
|
+ EasyExcelUtils.createTemplateExcel(response, ExcelImportDoubleVerifyAccountData.class, "账号双重认证码导入模板", "账号双重认证码导入模板", ExcelTypeEnum.XLS, null);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|