Ver Fonte

fix 新增midJourney填写安全码

zoujiajian há 3 anos atrás
pai
commit
a04270f125

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/Account.java

@@ -55,4 +55,9 @@ public class Account extends BaseEntity {
     private String apiKey;
 
     private String remark;
+
+    /**
+     * midJourney 登录安全码
+     */
+    private String verifyCodes;
 }

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/GroupsRelation.java

@@ -53,6 +53,11 @@ public class GroupsRelation extends BaseEntity {
      */
     private String customerService;
 
+    /**
+     * midJourney 登录安全码
+     */
+    private String verifyCode;
+
     /**
      * 获取权益时的订单id
      */

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/GroupsTrips.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.ejlchina.searcher.bean.DbField;
+import com.ejlchina.searcher.bean.DbIgnore;
 import com.ejlchina.searcher.bean.SearchBean;
 import lombok.AllArgsConstructor;
 import lombok.Getter;
@@ -114,6 +115,10 @@ public class GroupsTrips {
     @DbField("gt.start_time")
     private Date startTime;
 
+    @DbIgnore
+    @TableField(exist = false)
+    private String verifyCodes;
+
     @DbField("gt.created_time")
     @TableField(exist = false)
     private Date createTime;

+ 5 - 1
netflix-dao/src/main/java/com/cyksj/model/excel/ExcelManageAccountData.java

@@ -22,7 +22,7 @@ import java.util.Date;
 		"left join groups_trips gt on gt.account_id = a.id " +
 		"left join groups_relation gr on gr.groups_id = gt.id " +
 		"left join goods_don_sku gdk on gdk.id = gt.sku_id",
-		groupBy = "a.id,g.id,a.bank_card,g.title,a.account,a.password,a.api_key,a.start_time,a.expiry_time,a.amount,a.cn_account,a.us_account,gt.id,a.remark,gdk.id,gdk.spec_val")
+		groupBy = "a.id,g.id,a.bank_card,g.title,a.account,a.password,a.api_key,a.verify_codes,a.start_time,a.expiry_time,a.amount,a.cn_account,a.us_account,gt.id,a.remark,gdk.id,gdk.spec_val")
 public class ExcelManageAccountData {
 
 	@ExcelIgnore
@@ -49,6 +49,10 @@ public class ExcelManageAccountData {
 	@DbField("a.api_key")
 	private String apiKey;
 
+	@ExcelProperty("校验码")
+	@DbField("a.verify_codes")
+	private String verifyCodes;
+
 	@ExcelProperty("银行卡号")
 	@DbField("a.bank_card")
 	private String bankCard;

+ 4 - 1
netflix-dao/src/main/java/com/cyksj/model/manage/views/AccountView.java

@@ -19,7 +19,7 @@ import java.util.Date;
         "left join groups_trips gt on gt.account_id = a.id " +
         "left join groups_relation gr on gr.groups_id = gt.id " +
         "left join goods_don_sku gdk on gdk.id = gt.sku_id",
-        groupBy = "a.id,g.id,a.bank_card,g.title,a.account,a.password,a.api_key,a.start_time,a.expiry_time,a.amount,a.cn_account,a.us_account,gt.id,a.remark,gdk.id,gdk.spec_val,a.customer_service_id")
+        groupBy = "a.id,g.id,a.bank_card,g.title,a.account,a.password,a.api_key,a.verify_codes,a.start_time,a.expiry_time,a.amount,a.cn_account,a.us_account,gt.id,a.remark,gdk.id,gdk.spec_val,a.customer_service_id")
 public class AccountView {
 
     @DbField("a.id")
@@ -43,6 +43,9 @@ public class AccountView {
     @DbField("a.api_key")
     private String apiKey;
 
+    @DbField("a.verify_codes")
+    private String verifyCodes;
+
     @DbField("a.start_time")
     private Date startTime;
 

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/model/request/AccountGroupsReq.java

@@ -54,4 +54,6 @@ public class AccountGroupsReq {
 	private String usAccount;
 
 	private String remark;
+
+	private String verifyCodes;
 }

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/model/views/RenewalView.java

@@ -76,6 +76,9 @@ public class RenewalView {
     @DbField("a.api_key")
     private String apiKey;
 
+    @DbField("gr.verify_code")
+    private String verifyCode;
+
     @DbIgnore
     private GoodsDonViews goodsDonViews;
 }

+ 2 - 1
netflix-dao/src/main/resources/mapper/GroupRelationMapper.xml

@@ -11,7 +11,8 @@
         is_handle = #{entity.isHandle},
         user_id = #{entity.userId},
         account = #{entity.account},
-        customer_service = null
+        customer_service = null,
+        verify_code = null
         where id = #{entity.id}
         <if test="expireTime != null">
             and expiry_time = #{expireTime}

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/mange/CmsGroupService.java

@@ -10,7 +10,7 @@ import com.cyksj.model.request.ReplaceTripsAccountReq;
  */
 public interface CmsGroupService extends IService<GroupsTrips> {
 
-    GroupsTrips issuance(GroupsTrips groups);
+    GroupsTrips issuance(GroupsTrips groups, String verifyCodes);
 
     void close(Long groupId);
 

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/mange/account/CmsAccountServiceImpl.java

@@ -203,7 +203,7 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
 				GroupsTrips groupsTrips = new GroupsTrips();
 				groupsTrips.setSkuId(skuId);
 				groupsTrips.setAccountId(insert.getId());
-				cmsGroupService.issuance(groupsTrips);
+				cmsGroupService.issuance(groupsTrips, null);
 			}
 		});
 	}

+ 40 - 22
netflix-service/src/main/java/com/cyksj/service/mange/group/CmsGroupServiceImpl.java

@@ -58,11 +58,15 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
 
 
     @Override
-    public GroupsTrips issuance(GroupsTrips groups) {
+    public GroupsTrips issuance(GroupsTrips groups, String verifyCodes) {
         GoodsDonSku sku = skuMapper.selectById(groups.getSkuId());
         if (sku == null) {
             throw new BusinessRuntimeException("该商品规格不存在!");
         }
+        String[] verifyCodeArray = null;
+        if (StrUtil.isNotBlank(verifyCodes)) {
+            verifyCodeArray = verifyCodes.split(",");
+        }
         groups.setNum(sku.getNum());
         groups.setAvailableNum(sku.getNum());
         if (groups.getAccountId() == null || accountMapper.selectById(groups.getAccountId()) == null) {
@@ -76,6 +80,9 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
             relation.setGroupsId(groups.getId());
             relation.setStatus(GroupsRelation.Status.none);
             relation.setNum(i);
+            if (verifyCodeArray != null && verifyCodeArray.length > 0 && verifyCodeArray.length >= i) {
+                relation.setVerifyCode(verifyCodeArray[i - 1]);
+            }
             relationMapper.insert(relation);
         }
         return groups;
@@ -112,27 +119,38 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
             title = trips.getTitle();
         }
         String msg = String.format(Constant.CHANGE_GROUPS_TRIPS_ACCOUNT, title);
-       groupsRelations.forEach((relation)->{
-           if (relation.getExpiryTime() == null) {
-               List<OrderDon> orderDonList = orderDonMapper.selectList(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getUserId, relation.getUserId()).eq(OrderDon::getRelationId, relation.getId()).eq(OrderDon::getStatus, OrderDon.Status.hasPayment));
-               orderDonList.forEach((orderDon)->{
-                   //如果续费增加时间,如果首次则设置当前时间为初始时间
-                   Date expiryTime = Optional.ofNullable(relation.getExpiryTime()).orElse(new Date());
-                   log.info("设置账号,该用户 {} 初始时间:{} ",orderDon.getUserId(),DateUtil.format(expiryTime,"yyyy-MM-dd HH:mm:ss"));
-                   GoodsDonSku donSku = skuMapper.selectById(orderDon.getSkuId());
-
-                   Date newDate = DateUtil.offset(expiryTime, DateField.MONTH, donSku.getMonths() * orderDon.getNum());
-                   relation.setExpiryTime(newDate);
-                   log.info("设置账号,该用户 {} 过期时间:{} ",orderDon.getUserId(),DateUtil.format(newDate,"yyyy-MM-dd HH:mm:ss"));
-                   relation.setStartTime(relation.getStartTime() == null ? new Date() : null);
-                   relationMapper.updateById(relation);
-                   orderDon.setStatus(OrderDon.Status.complete);
-                   orderDonMapper.updateById(orderDon);
-               });
-           }
-           //发送短信
-           smsService.sendSmsToRelationUser(relation.getUserId(), msg);
-       });
+        //配置midJourney安全码
+        String verifyCodes = groupsTrips.getVerifyCodes();
+        String[] verifyCodeArray = null;
+        if (StrUtil.isNotBlank(verifyCodes)) {
+            verifyCodeArray = verifyCodes.split(",");
+        }
+        for (int i = 0; i < groupsRelations.size(); i++) {
+            GroupsRelation relation = groupsRelations.get(i);
+            if (relation.getExpiryTime() == null) {
+                List<OrderDon> orderDonList = orderDonMapper.selectList(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getUserId, relation.getUserId()).eq(OrderDon::getRelationId, relation.getId()).eq(OrderDon::getStatus, OrderDon.Status.hasPayment));
+                orderDonList.forEach((orderDon) -> {
+                    //如果续费增加时间,如果首次则设置当前时间为初始时间
+                    Date expiryTime = Optional.ofNullable(relation.getExpiryTime()).orElse(new Date());
+                    log.info("设置账号,该用户 {} 初始时间:{} ", orderDon.getUserId(), DateUtil.format(expiryTime, "yyyy-MM-dd HH:mm:ss"));
+                    GoodsDonSku donSku = skuMapper.selectById(orderDon.getSkuId());
+
+                    Date newDate = DateUtil.offset(expiryTime, DateField.MONTH, donSku.getMonths() * orderDon.getNum());
+                    relation.setExpiryTime(newDate);
+                    log.info("设置账号,该用户 {} 过期时间:{} ", orderDon.getUserId(), DateUtil.format(newDate, "yyyy-MM-dd HH:mm:ss"));
+                    relation.setStartTime(relation.getStartTime() == null ? new Date() : null);
+                    relationMapper.updateById(relation);
+                    orderDon.setStatus(OrderDon.Status.complete);
+                    orderDonMapper.updateById(orderDon);
+                });
+            }
+            //发送短信
+            smsService.sendSmsToRelationUser(relation.getUserId(), msg);
+            if (verifyCodeArray != null && verifyCodeArray.length > 0 && i < verifyCodeArray.length) {
+                relation.setVerifyCode(verifyCodeArray[i]);
+                relationMapper.updateById(relation);
+            }
+        }
        groupsTrips.setStatus(GroupsTrips.Status.validity);
        updateById(groupsTrips);
 

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationClearServiceImpl.java

@@ -97,7 +97,7 @@ public class GroupRelationClearServiceImpl implements GroupRelationClearService
 						GroupsTrips gt = new GroupsTrips();
 						gt.setSkuId(account.getSkuId());
 						gt.setAccountId(account.getId());
-						groupService.issuance(gt);
+						groupService.issuance(gt, null);
 
 						GroupsTripsDeleteRecord record = new GroupsTripsDeleteRecord();
 						record.setAccountId(gt.getAccountId());

+ 25 - 7
netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsAccountController.java

@@ -2,6 +2,7 @@ package com.cyksj.web.controller.manage.account;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.dev33.satoken.stp.StpUtil;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
@@ -17,10 +18,7 @@ import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.dto.Result;
 import com.cyksj.enums.BusinessType;
 import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GroupsMapper;
-import com.cyksj.mapper.HomeGroupMapper;
-import com.cyksj.mapper.UserMapper;
-import com.cyksj.mapper.UserTicketClearedRecordMapper;
+import com.cyksj.mapper.*;
 import com.cyksj.mapper.manage.cms.CmsUserMapper;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.excel.ExcelImportAccountData;
@@ -92,6 +90,8 @@ public class CmsAccountController {
 
 	private final CmsUserManager cmsUserManager;
 
+	private final GroupsRelationMapper groupsRelationMapper;
+
     @GetMapping("/get")
     @SaCheckPermission("account:view")
     public Result<SearchResult<AccountView>> get(Long userId ,String nickName ,String submitAccount ,String expiryStartTime, String expiryEndTime) {
@@ -264,7 +264,7 @@ public class CmsAccountController {
 	    GroupsTrips groupsTrips = new GroupsTrips();
 	    groupsTrips.setSkuId(account.getSkuId());
 	    groupsTrips.setAccountId(account.getId());
-	    cmsGroupService.issuance(groupsTrips);
+	    cmsGroupService.issuance(groupsTrips, account.getVerifyCodes());
         return GatewayResponse.SUCCESS.newBuilder().toResult();
     }
 
@@ -318,7 +318,7 @@ public class CmsAccountController {
 					GroupsTrips groupsTrips = new GroupsTrips();
 					groupsTrips.setSkuId(at.getSkuId());
 					groupsTrips.setAccountId(at.getId());
-					cmsGroupService.issuance(groupsTrips);
+					cmsGroupService.issuance(groupsTrips, null);
 				}
 			}
 
@@ -364,7 +364,25 @@ public class CmsAccountController {
 	    if (StrUtil.isNotBlank(account.getPassword())){
 		    account.setPassword(account.getPassword().trim());
 	    }
-        accountService.updateById(account);
+	    String verifyCodes = account.getVerifyCodes();
+	    if (StrUtil.isNotBlank(verifyCodes) && !StrUtil.equals(verifyCodes, db.getVerifyCodes())) {
+		    String[] verifyCodesArray = verifyCodes.split(",");
+		    List<GroupsRelationView> relationViews = beanSearcher.searchAll(GroupsRelationView.class, MapUtils.builder()
+				    .field(GroupsRelationView::getAccountId, account.getId())
+				    .onlySelect(GroupsRelationView::getId)
+				    .build());
+		    if (CollUtil.isNotEmpty(relationViews)) {
+			    for (int i = 0; i < verifyCodesArray.length; i++) {
+				    if (i < relationViews.size()) {
+					    GroupsRelationView groupsRelationView = relationViews.get(i);
+					    groupsRelationMapper.update(null, Wrappers.lambdaUpdate(GroupsRelation.class)
+							    .set(GroupsRelation::getVerifyCode, verifyCodesArray[i])
+							    .eq(GroupsRelation::getId, groupsRelationView.getId()));
+				    }
+			    }
+		    }
+	    }
+	    accountService.updateById(account);
         return GatewayResponse.SUCCESS.newBuilder().toResult();
     }
 

+ 2 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/group/CmsGroupController.java

@@ -92,7 +92,7 @@ public class CmsGroupController {
     @Log(module = "发布车票/新增车队", businessType = BusinessType.POST, isSaveRequestData = true)
     public Result<GroupsTrips> add(@RequestBody GroupsTrips groups){
 
-        GroupsTrips groupsTrips = groupService.issuance(groups);
+        GroupsTrips groupsTrips = groupService.issuance(groups, null);
 
         return GatewayResponse.SUCCESS.newBuilder().toResult(groupsTrips);
     }
@@ -156,6 +156,7 @@ public class CmsGroupController {
         }
         accountService.save(account);
         groupsTrips.setAccountId(account.getId());
+        groupsTrips.setVerifyCodes(account.getVerifyCodes());
         groupService.setAccount(groupsTrips);
         return GatewayResponse.SUCCESS.newBuilder().toResult("车队配置新账号成功");
     }