|
|
@@ -318,7 +318,6 @@ public class CmsAccountController {
|
|
|
* 下载批量修改密码模板
|
|
|
*/
|
|
|
@GetMapping("/get/account/template")
|
|
|
- @SaCheckPermission("account:batchUpdatePwd")
|
|
|
public void getAccountTemplate(HttpServletResponse response) {
|
|
|
EasyExcelUtils.createTemplateExcel(response, ExcelImportAccountData.class, "账号批量修改密码模板", "账号批量修改密码模板", ExcelTypeEnum.XLSX, null);
|
|
|
}
|
|
|
@@ -459,12 +458,14 @@ public class CmsAccountController {
|
|
|
@SaCheckPermission("account:add")
|
|
|
@Log(module = "平台管理/新增账号", businessType = BusinessType.POST, isSaveRequestData = true)
|
|
|
public Result<String> add(@RequestBody Account account){
|
|
|
- account.setAccount(account.getAccount().trim());
|
|
|
- account.setPassword(account.getPassword().trim());
|
|
|
- //账号是否已经添加过
|
|
|
- if (!account.getAccount().contains("客服")) {
|
|
|
- if (accountCommonService.checkIsDupAccount(account.getGoodsId(), account.getAccount())) {
|
|
|
- throw BusinessRuntimeException.getInstance("该平台下已生成该账号");
|
|
|
+ if (StrUtil.isNotBlank(account.getAccount())) {
|
|
|
+ account.setAccount(account.getAccount().trim());
|
|
|
+ account.setPassword(account.getPassword().trim());
|
|
|
+ //账号是否已经添加过
|
|
|
+ if (!account.getAccount().contains("客服")) {
|
|
|
+ if (accountCommonService.checkIsDupAccount(account.getGoodsId(), account.getAccount())) {
|
|
|
+ throw BusinessRuntimeException.getInstance("该平台下已生成该账号");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
accountService.save(account);
|
|
|
@@ -512,6 +513,7 @@ public class CmsAccountController {
|
|
|
@Override
|
|
|
public void invoke(ExcelImportAccountData data, AnalysisContext analysisContext) {
|
|
|
String account = data.getAccount(), password = data.getPassword(), startTime = data.getStartTime(), expiryTime = data.getExpiryTime(), bankCard = data.getBankCard();
|
|
|
+ Account at = new Account();
|
|
|
if (StrUtil.isNotBlank(data.getAccount())) {
|
|
|
//账号是否已经添加过
|
|
|
if (!account.contains("客服")) {
|
|
|
@@ -520,52 +522,53 @@ public class CmsAccountController {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- Account at = new Account();
|
|
|
at.setAccount(account.trim());
|
|
|
at.setPassword(password.trim());
|
|
|
- at.setGoodsId(goodsId);
|
|
|
- at.setSkuId(skuId);
|
|
|
- at.setBankCard(bankCard);
|
|
|
- String isMonth = data.getIsMonth();
|
|
|
- if (StrUtil.isNotBlank(isMonth)) {
|
|
|
- at.setIsMonth(true);
|
|
|
- }
|
|
|
- String outsidePurchase = data.getOutsidePurchase();
|
|
|
- if (StrUtil.isNotEmpty(outsidePurchase)) {
|
|
|
- if (outsidePurchase.equals("是") || outsidePurchase.equals("1")) {
|
|
|
- at.setOutsidePurchase(true);
|
|
|
- }
|
|
|
- }
|
|
|
- at.setVerifyLink(data.getVerifyLink());
|
|
|
- at.setRelateEmail(data.getRelateEmail());
|
|
|
- at.setEmail(data.getSecondEmail());
|
|
|
- if (StrUtil.isNotBlank(startTime)) {
|
|
|
- at.setStartTime(DateUtil.parse(startTime));
|
|
|
- } else {
|
|
|
- at.setStartTime(DateTime.now());
|
|
|
+ }
|
|
|
+ at.setGoodsId(goodsId);
|
|
|
+ at.setSkuId(skuId);
|
|
|
+ at.setBankCard(bankCard);
|
|
|
+ //激活码
|
|
|
+ at.setActCode(data.getActCode());
|
|
|
+ String isMonth = data.getIsMonth();
|
|
|
+ if (StrUtil.isNotBlank(isMonth)) {
|
|
|
+ at.setIsMonth(true);
|
|
|
+ }
|
|
|
+ String outsidePurchase = data.getOutsidePurchase();
|
|
|
+ if (StrUtil.isNotEmpty(outsidePurchase)) {
|
|
|
+ if (outsidePurchase.equals("是") || outsidePurchase.equals("1")) {
|
|
|
+ at.setOutsidePurchase(true);
|
|
|
}
|
|
|
- if (StrUtil.isNotBlank(expiryTime)) {
|
|
|
- at.setExpiryTime(DateUtil.parse(expiryTime));
|
|
|
- } else {
|
|
|
- at.setExpiryTime(DateUtil.offsetMonth(at.getStartTime(), 1));
|
|
|
+ }
|
|
|
+ at.setVerifyLink(data.getVerifyLink());
|
|
|
+ at.setRelateEmail(data.getRelateEmail());
|
|
|
+ at.setEmail(data.getSecondEmail());
|
|
|
+ if (StrUtil.isNotBlank(startTime)) {
|
|
|
+ at.setStartTime(DateUtil.parse(startTime));
|
|
|
+ } else {
|
|
|
+ at.setStartTime(DateTime.now());
|
|
|
+ }
|
|
|
+ if (StrUtil.isNotBlank(expiryTime)) {
|
|
|
+ at.setExpiryTime(DateUtil.parse(expiryTime));
|
|
|
+ } else {
|
|
|
+ at.setExpiryTime(DateUtil.offsetMonth(at.getStartTime(), 1));
|
|
|
+ }
|
|
|
+ accountService.save(at);
|
|
|
+ if (at.getSkuId() != null) {
|
|
|
+ //自动配置车队
|
|
|
+ GroupsTrips groupsTrips = new GroupsTrips();
|
|
|
+ //限制每天新车队前3天 停车数量
|
|
|
+ Integer availableParkingNum = 0;
|
|
|
+ if (at.getSkuId() == 161l) {
|
|
|
+ availableParkingNum = 10;
|
|
|
}
|
|
|
- accountService.save(at);
|
|
|
- if (at.getSkuId() != null) {
|
|
|
- //自动配置车队
|
|
|
- GroupsTrips groupsTrips = new GroupsTrips();
|
|
|
- //限制每天新车队前3天 停车数量
|
|
|
- Integer availableParkingNum = 0;
|
|
|
- if (at.getSkuId() == 161l) {
|
|
|
- availableParkingNum = 10;
|
|
|
- }
|
|
|
- if (at.getSkuId() == 178l) {
|
|
|
- availableParkingNum = 4;
|
|
|
- }
|
|
|
- groupsTrips.setAvailableParkingNum(availableParkingNum);
|
|
|
- groupsTrips.setSkuId(at.getSkuId());
|
|
|
- groupsTrips.setAccountId(at.getId());
|
|
|
- cmsGroupService.issuance(groupsTrips, null);
|
|
|
+ if (at.getSkuId() == 178l) {
|
|
|
+ availableParkingNum = 4;
|
|
|
}
|
|
|
+ groupsTrips.setAvailableParkingNum(availableParkingNum);
|
|
|
+ groupsTrips.setSkuId(at.getSkuId());
|
|
|
+ groupsTrips.setAccountId(at.getId());
|
|
|
+ cmsGroupService.issuance(groupsTrips, null);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -586,29 +589,33 @@ public class CmsAccountController {
|
|
|
throw BusinessRuntimeException.getInstance("该账号不存在");
|
|
|
}
|
|
|
Boolean isClear = false;
|
|
|
+ String updateAccount = account.getAccount();
|
|
|
String dbAccount = db.getAccount();
|
|
|
- long userId = StpUtil.getLoginIdAsLong();
|
|
|
- if (!db.getPassword().equals(account.getPassword())) {
|
|
|
- account.setCustomerServiceId(0l);
|
|
|
- accountService.saveRecord(userId, account.getId(), db.getPassword(), account.getPassword(), "操作编辑");
|
|
|
-
|
|
|
- //清空过期账号 逻辑删除
|
|
|
- userTicketClearedRecordMapper.update(null, Wrappers.lambdaUpdate(UserTicketClearedRecord.class)
|
|
|
- .set(UserTicketClearedRecord::getDeleted, false)
|
|
|
- .eq(UserTicketClearedRecord::getAccountId, account.getId()));
|
|
|
- isClear = true;
|
|
|
- }
|
|
|
- if (!db.getAccount().equals(account.getAccount())){
|
|
|
- account.setAccount(account.getAccount().trim());
|
|
|
- //账号是否已经添加过
|
|
|
- if (!account.getAccount().contains("客服")) {
|
|
|
- if (accountCommonService.checkIsDupAccount(account.getGoodsId(), account.getAccount())) {
|
|
|
- throw BusinessRuntimeException.getInstance("该平台下已生成该账号");
|
|
|
+ //排除不需要填写账号的平台
|
|
|
+ if (StrUtil.isNotBlank(updateAccount)){
|
|
|
+ long userId = StpUtil.getLoginIdAsLong();
|
|
|
+ if (!db.getPassword().equals(account.getPassword())) {
|
|
|
+ account.setCustomerServiceId(0l);
|
|
|
+ accountService.saveRecord(userId, account.getId(), db.getPassword(), account.getPassword(), "操作编辑");
|
|
|
+
|
|
|
+ //清空过期账号 逻辑删除
|
|
|
+ userTicketClearedRecordMapper.update(null, Wrappers.lambdaUpdate(UserTicketClearedRecord.class)
|
|
|
+ .set(UserTicketClearedRecord::getDeleted, false)
|
|
|
+ .eq(UserTicketClearedRecord::getAccountId, account.getId()));
|
|
|
+ isClear = true;
|
|
|
+ }
|
|
|
+ if (!db.getAccount().equals(account.getAccount())){
|
|
|
+ account.setAccount(account.getAccount().trim());
|
|
|
+ //账号是否已经添加过
|
|
|
+ if (!account.getAccount().contains("客服")) {
|
|
|
+ if (accountCommonService.checkIsDupAccount(account.getGoodsId(), account.getAccount())) {
|
|
|
+ throw BusinessRuntimeException.getInstance("该平台下已生成该账号");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!dbAccount.equals(account.getAccount())) {
|
|
|
+ isClear = true;
|
|
|
}
|
|
|
}
|
|
|
- if (!dbAccount.equals(account.getAccount())) {
|
|
|
- isClear = true;
|
|
|
- }
|
|
|
}
|
|
|
if (StrUtil.isNotBlank(account.getPassword())){
|
|
|
account.setPassword(account.getPassword().trim());
|