|
@@ -14,6 +14,7 @@ import com.fdkankan.common.util.Base64Converter;
|
|
|
import com.fdkankan.common.util.PasswordUtils;
|
|
|
import com.fdkankan.openApi.common.PageInfo;
|
|
|
import com.fdkankan.openApi.constant.CountType;
|
|
|
+import com.fdkankan.openApi.dto.AccountDTO;
|
|
|
import com.fdkankan.openApi.entity.system.Account;
|
|
|
import com.fdkankan.openApi.entity.system.UserAuthInfo;
|
|
|
import com.fdkankan.openApi.entity.www.User;
|
|
@@ -32,6 +33,8 @@ import com.fdkankan.web.response.ResultData;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
|
|
@@ -40,13 +43,13 @@ import java.util.Objects;
|
|
|
* 账号表 服务实现类
|
|
|
* </p>
|
|
|
*
|
|
|
- * @author
|
|
|
+ * @author
|
|
|
* @since 2023-05-18
|
|
|
*/
|
|
|
@Service
|
|
|
public class AccountServiceImpl extends ServiceImpl<IAccountMapper, Account> implements IAccountService {
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private FdKKClient fdKKClient;
|
|
|
@Autowired
|
|
|
private IUserAuthInfoService userAuthService;
|
|
@@ -115,7 +118,8 @@ public class AccountServiceImpl extends ServiceImpl<IAccountMapper, Account> imp
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResultData createApp(CreateAppUserParamVo param) {
|
|
|
+ public ResultData createApp(AccountDTO param) {
|
|
|
+
|
|
|
Account account = this.getOne(new LambdaQueryWrapper<Account>().eq(Account::getUserName, param.getUserName()));
|
|
|
if(Objects.nonNull(account)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_10002);
|
|
@@ -124,37 +128,34 @@ public class AccountServiceImpl extends ServiceImpl<IAccountMapper, Account> imp
|
|
|
if(Objects.isNull(user)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3021);
|
|
|
}
|
|
|
- if(param.getState() != CommonStatus.NO.code().intValue()
|
|
|
- && param.getState() != CommonStatus.YES.code().intValue()){
|
|
|
- throw new BusinessException(ErrorCode.PARAM_ERROR);
|
|
|
- }
|
|
|
- Integer count = param.getCount();
|
|
|
- if(CountType.NO_LIMIT.code() != param.getCountType() && (Objects.isNull(count) || count < 1)){
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_10004);
|
|
|
- }else{
|
|
|
- count = -1;
|
|
|
- }
|
|
|
account = new Account();
|
|
|
account.setUserId(user.getId());
|
|
|
account.setUserName(user.getUserName());
|
|
|
account.setCustomerName(param.getCustomerName());
|
|
|
account.setDescription(param.getDescription());
|
|
|
account.setCreaterId(param.getCreaterId());
|
|
|
+ account.setUseType(param.getUseType());
|
|
|
+ account.setCompanyName(param.getCompanyName());
|
|
|
+ account.setBusinessDept(param.getBusinessDept());
|
|
|
+ account.setCustomerType(param.getCustomerType());
|
|
|
+ account.setEndCustomer(param.getEndCustomer());
|
|
|
+ account.setRemark(param.getRemark());
|
|
|
+ account.setBusinessName(param.getBusinessName());
|
|
|
this.save(account);
|
|
|
|
|
|
UserAuthInfo userAuthInfo = new UserAuthInfo();
|
|
|
userAuthInfo.setAccountId(account.getId());
|
|
|
userAuthInfo.setUserId(user.getId());
|
|
|
userAuthInfo.setAppKey(TokenUtil.createToken());
|
|
|
- userAuthInfo.setTotalCount(count);
|
|
|
+ userAuthInfo.setTotalCount(-1);
|
|
|
userAuthInfo.setCallCount(0);
|
|
|
- userAuthInfo.setState(param.getState());
|
|
|
- userAuthInfo.setEffectTime(param.getEffectTime());
|
|
|
+ userAuthInfo.setState(CommonStatus.YES.code().intValue());
|
|
|
+ userAuthInfo.setEffectTime(new Date());
|
|
|
userAuthInfo.setCreaterId(param.getCreaterId());
|
|
|
userAuthService.save(userAuthInfo);
|
|
|
|
|
|
//设置redis缓存
|
|
|
- userAuthService.setReidsCount(userAuthInfo.getAppKey(), param.getCountType(), count);
|
|
|
+ userAuthService.setReidsCount(userAuthInfo.getAppKey(), CountType.NO_LIMIT.code(), -1);
|
|
|
|
|
|
return ResultData.ok();
|
|
|
}
|
|
@@ -241,4 +242,29 @@ public class AccountServiceImpl extends ServiceImpl<IAccountMapper, Account> imp
|
|
|
|
|
|
this.removeById(account.getId());
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateStatus(AccountDTO accountDTO) {
|
|
|
+
|
|
|
+ Account account = this.getById(accountDTO.getId());
|
|
|
+ if(Objects.isNull(account)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ account.setUpdaterId(accountDTO.getUpdaterId());
|
|
|
+ account.setUpdateTime(new Date());
|
|
|
+ this.updateById(account);
|
|
|
+
|
|
|
+ UserAuthInfo userAuthInfo = userAuthService.findByAccountId(account.getId());
|
|
|
+ userAuthInfo.setState(accountDTO.getStatus());
|
|
|
+ userAuthInfo.setUpdateTime(new Date());
|
|
|
+ userAuthInfo.setUpdaterId(accountDTO.getUpdaterId());
|
|
|
+ userAuthService.updateById(userAuthInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PageInfo page(AccountDTO accountDTO) {
|
|
|
+ Page<AccountVO> page = this.baseMapper.page(new Page<>(accountDTO.getPageNum(), accountDTO.getPageSize()), accountDTO);
|
|
|
+ return PageInfo.PageInfo(page);
|
|
|
+ }
|
|
|
}
|