|
|
@@ -19,7 +19,9 @@ import com.cyksj.mapper.manage.cms.SysLogMapper;
|
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.manage.views.AccountView;
|
|
|
import com.cyksj.model.manage.views.GroupsRelationView;
|
|
|
+import com.cyksj.model.request.NfUpdatePwdReq;
|
|
|
import com.cyksj.model.request.ReplaceTripsAccountReq;
|
|
|
+import com.cyksj.model.response.NfStatusResp;
|
|
|
import com.cyksj.model.views.GroupsAccountView;
|
|
|
import com.cyksj.redis.RedisService;
|
|
|
import com.cyksj.service.chatgpt.GptUserRechargeRecordService;
|
|
|
@@ -102,6 +104,10 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
|
|
|
|
|
|
private final SysLogMapper sysLogMapper;
|
|
|
|
|
|
+ private final NetflixAccountUpdatePwdTaskRecordMapper netflixAccountUpdatePwdTaskRecordMapper;
|
|
|
+
|
|
|
+ private final AccountUpdatePasswordRecordMapper accountUpdatePasswordRecordMapper;
|
|
|
+
|
|
|
private static final GlobalThreadPoolTaskExecutor TASK_EXECUTOR = GlobalThreadPoolTaskExecutor.getInstance();
|
|
|
|
|
|
|
|
|
@@ -546,6 +552,72 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public NfStatusResp updateNfAccount(NfUpdatePwdReq req) throws Exception {
|
|
|
+ Long accountId = req.getAccountId();
|
|
|
+ Long operateUserId = req.getOperateUserId();
|
|
|
+ Account account = accountMapper.selectById(accountId);
|
|
|
+ if (account == null || account.getGoodsId() != 18) {
|
|
|
+ throw BusinessRuntimeException.getInstance("非奈飞账号");
|
|
|
+ }
|
|
|
+ NetflixAccountUpdatePwdTaskRecord existsProgressingTaskRecord = netflixAccountUpdatePwdTaskRecordMapper.selectOne(Wrappers.lambdaQuery(NetflixAccountUpdatePwdTaskRecord.class).eq(NetflixAccountUpdatePwdTaskRecord::getAccount, account).eq(NetflixAccountUpdatePwdTaskRecord::getStatus, 0).last("limit 1"));
|
|
|
+ if (existsProgressingTaskRecord != null) {
|
|
|
+ String transId = existsProgressingTaskRecord.getTransId();
|
|
|
+ NfStatusResp resp = groupsRelationNetflixService.getNfTaskStatus(transId);
|
|
|
+ Integer status = resp.getStatus();
|
|
|
+ if (status == 0) {
|
|
|
+ throw BusinessRuntimeException.getInstance("已有正在执行中的任务");
|
|
|
+ }
|
|
|
+ if (status == 2) {
|
|
|
+ existsProgressingTaskRecord.setFailReason(resp.getErrorInfo());
|
|
|
+ }
|
|
|
+ existsProgressingTaskRecord.setStatus(status);
|
|
|
+ if (status == 1) {
|
|
|
+ saveAccountUpdateShowRecord(existsProgressingTaskRecord);
|
|
|
+ }
|
|
|
+ netflixAccountUpdatePwdTaskRecordMapper.updateById(existsProgressingTaskRecord);
|
|
|
+ }
|
|
|
+
|
|
|
+ CmsUser cmsUser = cmsUserMapper.selectById(operateUserId);
|
|
|
+
|
|
|
+ String newPWd = req.getNewPwd();
|
|
|
+ NfStatusResp resp = groupsRelationNetflixService.updateNfAccount(account.getAccount(), account.getPassword(), newPWd);
|
|
|
+ //任务id
|
|
|
+ String transId = resp.getTransId();
|
|
|
+ Integer status = resp.getStatus();
|
|
|
+
|
|
|
+ NetflixAccountUpdatePwdTaskRecord taskRecord = new NetflixAccountUpdatePwdTaskRecord();
|
|
|
+ taskRecord.setTransId(transId);
|
|
|
+ taskRecord.setStatus(status);
|
|
|
+ taskRecord.setAccountId(accountId);
|
|
|
+ taskRecord.setAccount(account.getAccount());
|
|
|
+ taskRecord.setOldPwd(account.getPassword());
|
|
|
+ taskRecord.setNewPwd(newPWd);
|
|
|
+ taskRecord.setOperator(cmsUser.getNickname());
|
|
|
+ taskRecord.setFailReason(resp.getErrorInfo());
|
|
|
+ netflixAccountUpdatePwdTaskRecordMapper.insert(taskRecord);
|
|
|
+
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public NfStatusResp getNfAccountTaskStatusByTid(String transId) throws Exception {
|
|
|
+ NfStatusResp resp = groupsRelationNetflixService.getNfTaskStatus(transId);
|
|
|
+ Integer status = resp.getStatus();
|
|
|
+ if (status != 0) {
|
|
|
+ NetflixAccountUpdatePwdTaskRecord taskRecord = netflixAccountUpdatePwdTaskRecordMapper.selectOne(Wrappers.lambdaQuery(NetflixAccountUpdatePwdTaskRecord.class).eq(NetflixAccountUpdatePwdTaskRecord::getTransId, transId).last("limit 1"));
|
|
|
+ taskRecord.setStatus(status);
|
|
|
+ if (status == 1) {
|
|
|
+ saveAccountUpdateShowRecord(taskRecord);
|
|
|
+ }
|
|
|
+ if (status == 2) {
|
|
|
+ taskRecord.setFailReason(resp.getErrorInfo());
|
|
|
+ }
|
|
|
+ netflixAccountUpdatePwdTaskRecordMapper.updateById(taskRecord);
|
|
|
+ }
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
public Integer getAvailableAfterPreAccount(Integer available, Long skuId, Integer maxNum, Long goodsId) {
|
|
|
MapBuilder builder = MapUtils.builder();
|
|
|
if (goodsId == 26) {
|
|
|
@@ -663,4 +735,14 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public void saveAccountUpdateShowRecord(NetflixAccountUpdatePwdTaskRecord taskRecord) {
|
|
|
+ AccountUpdatePasswordRecord record = new AccountUpdatePasswordRecord();
|
|
|
+ record.setAccountId(taskRecord.getAccountId());
|
|
|
+ record.setOperator(taskRecord.getOperator());
|
|
|
+ record.setOldPassword(taskRecord.getOldPwd());
|
|
|
+ record.setNewPassword(taskRecord.getNewPwd());
|
|
|
+ record.setType("通过奈飞API修改密码");
|
|
|
+ accountUpdatePasswordRecordMapper.insert(record);
|
|
|
+ }
|
|
|
}
|