|
@@ -1,5 +1,6 @@
|
|
package cn.iocoder.yudao.module.member.service.userinformation;
|
|
package cn.iocoder.yudao.module.member.service.userinformation;
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
import cn.iocoder.yudao.framework.dict.core.AiFrameworkUtils;
|
|
import cn.iocoder.yudao.framework.dict.core.AiFrameworkUtils;
|
|
@@ -17,6 +18,11 @@ import jakarta.annotation.Resource;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.Set;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.USER_INFORMATION_NOT_EXISTS;
|
|
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.USER_INFORMATION_NOT_EXISTS;
|
|
|
|
|
|
@@ -73,39 +79,90 @@ public class UserInformationServiceImpl implements UserInformationService {
|
|
return userInformationMapper.selectById(id);
|
|
return userInformationMapper.selectById(id);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public UserInformationDO getUserInfo() {
|
|
|
|
+ return userInformationMapper.selectOne(UserInformationDO::getUserId,
|
|
|
|
+ SecurityFrameworkUtils.getLoginUserId());
|
|
|
|
+ }
|
|
@Override
|
|
@Override
|
|
public UserInformationDO getAi() {
|
|
public UserInformationDO getAi() {
|
|
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
|
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
|
+
|
|
|
|
+ return userInformation(userId, false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private UserInformationDO userInformation(Long userId, Boolean updateFlag) {
|
|
UserInformationDO userInformation = userInformationMapper.selectOne(UserInformationDO::getUserId,
|
|
UserInformationDO userInformation = userInformationMapper.selectOne(UserInformationDO::getUserId,
|
|
SecurityFrameworkUtils.getLoginUserId());
|
|
SecurityFrameworkUtils.getLoginUserId());
|
|
|
|
|
|
if (userInformation != null) {
|
|
if (userInformation != null) {
|
|
|
|
+ Long id = userInformation.getId();
|
|
|
|
+ if (updateFlag) {
|
|
|
|
+ userInformation = userAiInformation(userId);
|
|
|
|
+ userInformation.setId(id);
|
|
|
|
+ userInformation.setUserHtml(AiFrameworkUtils.getHtml("个人征信HTML",
|
|
|
|
+ "个人征信" + userInformation.getCreditInformation()
|
|
|
|
+ + "营业执照" + userInformation.getCreditInformation()));
|
|
|
|
+ userInformationMapper.updateById(userInformation);
|
|
|
|
+ }
|
|
return userInformation;
|
|
return userInformation;
|
|
} else {
|
|
} else {
|
|
- userInformation = new UserInformationDO();
|
|
|
|
- UserPersonalCreditDO userPersonalCreditDO =
|
|
|
|
- userPersonalCreditMapper.selectOne(new QueryWrapper<UserPersonalCreditDO>()
|
|
|
|
- .eq("user_id", userId)
|
|
|
|
- .orderByDesc("create_time")
|
|
|
|
- .last("limit 1"));
|
|
|
|
- if (userPersonalCreditDO != null) {
|
|
|
|
- userInformation.setCreditInformation(AiFrameworkUtils.getAi("个人征信MD", userPersonalCreditDO.toString()));
|
|
|
|
- }
|
|
|
|
- UserBusinessLicenseDO userBusinessLicenseDO =
|
|
|
|
- userBusinessLicenseMapper.selectOne(new QueryWrapper<UserBusinessLicenseDO>()
|
|
|
|
- .eq("creator", userId)
|
|
|
|
- .orderByDesc("create_time")
|
|
|
|
- .last("limit 1"));
|
|
|
|
- if (userBusinessLicenseDO != null) {
|
|
|
|
- userInformation.setBusinessLicenseInformation(AiFrameworkUtils.getAi("营业执照MD",
|
|
|
|
- userBusinessLicenseDO.toString()));
|
|
|
|
|
|
+ UserInformationDO insertUserInformation = new UserInformationDO();
|
|
|
|
+ insertUserInformation = userAiInformation(userId);
|
|
|
|
+ insertUserInformation.setUserId(SecurityFrameworkUtils.getLoginUserId());
|
|
|
|
+ if (updateFlag) {
|
|
|
|
+ insertUserInformation.setUserHtml(AiFrameworkUtils.getHtml("个人征信HTML",
|
|
|
|
+ "个人征信" + insertUserInformation.getCreditInformation()
|
|
|
|
+ + "营业执照" + insertUserInformation.getCreditInformation()));
|
|
}
|
|
}
|
|
- userInformation.setUserId(SecurityFrameworkUtils.getLoginUserId());
|
|
|
|
- userInformationMapper.insert(userInformation);
|
|
|
|
|
|
+ userInformationMapper.insert(insertUserInformation);
|
|
|
|
+// AiFrameworkUtils.getHtml("个人征信HTML", userInformation.getCreditInformation());
|
|
|
|
+ return insertUserInformation;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private UserInformationDO userAiInformation(Long userId) {
|
|
|
|
+ UserInformationDO userInformation = new UserInformationDO();
|
|
|
|
+ UserPersonalCreditDO userPersonalCreditDO =
|
|
|
|
+ userPersonalCreditMapper.selectOne(new QueryWrapper<UserPersonalCreditDO>()
|
|
|
|
+ .eq("user_id", userId)
|
|
|
|
+ .orderByDesc("create_time")
|
|
|
|
+ .last("limit 1"));
|
|
|
|
+ if (userPersonalCreditDO != null) {
|
|
|
|
+ userInformation.setCreditInformation(AiFrameworkUtils.getAi("个人征信MD", userPersonalCreditDO.toString()));
|
|
|
|
+ }
|
|
|
|
+ UserBusinessLicenseDO userBusinessLicenseDO =
|
|
|
|
+ userBusinessLicenseMapper.selectOne(new QueryWrapper<UserBusinessLicenseDO>()
|
|
|
|
+ .eq("creator", userId)
|
|
|
|
+ .orderByDesc("create_time")
|
|
|
|
+ .last("limit 1"));
|
|
|
|
+ if (userBusinessLicenseDO != null) {
|
|
|
|
+ userInformation.setBusinessLicenseInformation(AiFrameworkUtils.getAi("营业执照MD",
|
|
|
|
+ userBusinessLicenseDO.toString()));
|
|
}
|
|
}
|
|
return userInformation;
|
|
return userInformation;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void init() {
|
|
|
|
+ //查询当日所有的 征信-
|
|
|
|
+ List<Map<String, Object>> userList = userBusinessLicenseMapper.setletUserList();
|
|
|
|
+ List<Map<String, Object>> userListCred = userPersonalCreditMapper.setletUserList();
|
|
|
|
+ Set<String> userIds = userList.stream().map(map -> map.get("userId").toString()).collect(Collectors.toSet());
|
|
|
|
+ Set<String> cuserIds =
|
|
|
|
+ userListCred.stream().map(map -> map.get("userId").toString()).collect(Collectors.toSet());
|
|
|
|
+ userIds.addAll(cuserIds);
|
|
|
|
+ if (userIds.size() > 0) {
|
|
|
|
+ for (String userId : userIds) {
|
|
|
|
+ if (StrUtil.isNotBlank(userId) && !StrUtil.equals(userId, "null")) {
|
|
|
|
+ userInformation(Long.parseLong(userId), true);
|
|
|
|
+ }
|
|
|
|
+ ;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public PageResult<UserInformationDO> getUserInformationPage(UserInformationPageReqVO pageReqVO) {
|
|
public PageResult<UserInformationDO> getUserInformationPage(UserInformationPageReqVO pageReqVO) {
|
|
return userInformationMapper.selectPage(pageReqVO);
|
|
return userInformationMapper.selectPage(pageReqVO);
|