|
|
@@ -24,10 +24,7 @@ import com.cyksj.enums.GatewayResponse;
|
|
|
import com.cyksj.mapper.*;
|
|
|
import com.cyksj.mapper.manage.cms.CmsUserMapper;
|
|
|
import com.cyksj.model.entity.*;
|
|
|
-import com.cyksj.model.excel.ExcelDoubleVerifyAccountData;
|
|
|
-import com.cyksj.model.excel.ExcelImportAccountData;
|
|
|
-import com.cyksj.model.excel.ExcelImportDoubleVerifyAccountData;
|
|
|
-import com.cyksj.model.excel.ExcelManageAccountData;
|
|
|
+import com.cyksj.model.excel.*;
|
|
|
import com.cyksj.model.manage.request.ReqAccountIncrExpiryTime;
|
|
|
import com.cyksj.model.manage.views.AccountView;
|
|
|
import com.cyksj.model.manage.views.GroupsRelationView;
|
|
|
@@ -899,4 +896,48 @@ public class CmsAccountController {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 下载 替换错误账号模板
|
|
|
+ */
|
|
|
+ @GetMapping("/get/replace/banned/template")
|
|
|
+ public void getReplaceBannedTemplate(HttpServletResponse response) {
|
|
|
+ EasyExcelUtils.createTemplateExcel(response, ExcelBannedAccountData.class, "替换被封账号模板", "替换被封账号模板", ExcelTypeEnum.XLSX, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 替换封禁账号
|
|
|
+ */
|
|
|
+ @PostMapping("/replace/banned")
|
|
|
+ public Result<String> replaceBannedAccount(Long goodsId, MultipartFile file) throws IOException {
|
|
|
+ EasyExcel.read(file.getInputStream(), ExcelBannedAccountData.class, new AnalysisEventListener<ExcelBannedAccountData>() {
|
|
|
+ @Override
|
|
|
+ public void invoke(ExcelBannedAccountData data, AnalysisContext analysisContext) {
|
|
|
+ String oldAccount = data.getOldAccount();
|
|
|
+ String account = data.getAccount();
|
|
|
+ String password = data.getPassword();
|
|
|
+ if (StrUtil.isEmpty(oldAccount) || StrUtil.isEmpty(account) || StrUtil.isEmpty(password)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Account dbAccount = accountService.getOne(Wrappers.lambdaQuery(Account.class)
|
|
|
+ .eq(Account::getGoodsId, goodsId)
|
|
|
+ .eq(Account::getAccount, oldAccount.trim())
|
|
|
+ .last("limit 1"));
|
|
|
+ if (dbAccount == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ dbAccount.setAccount(account);
|
|
|
+ dbAccount.setPassword(password);
|
|
|
+ dbAccount.setStartTime(DateTime.now());
|
|
|
+ dbAccount.setExpiryTime(DateUtil.offsetMonth(DateTime.now(), 1));
|
|
|
+ accountService.updateById(dbAccount);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }).sheet().doRead();
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+
|
|
|
}
|