|
@@ -1,14 +1,17 @@
|
|
|
package com.ytpm.middle.service.impl;
|
|
package com.ytpm.middle.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
|
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
|
|
|
|
+import com.ytpm.agent.model.YtPlatformUserApp;
|
|
|
import com.ytpm.general.RepMessage;
|
|
import com.ytpm.general.RepMessage;
|
|
|
import com.ytpm.general.Result;
|
|
import com.ytpm.general.Result;
|
|
|
import com.ytpm.general.ResultTable;
|
|
import com.ytpm.general.ResultTable;
|
|
|
import com.ytpm.handle.CustomerException;
|
|
import com.ytpm.handle.CustomerException;
|
|
|
import com.ytpm.middle.dao.AgentMapper;
|
|
import com.ytpm.middle.dao.AgentMapper;
|
|
|
|
|
+import com.ytpm.middle.dao.AppMapper;
|
|
|
import com.ytpm.middle.dao.EnterpriseMapper;
|
|
import com.ytpm.middle.dao.EnterpriseMapper;
|
|
|
import com.ytpm.middle.model.YtMiddleEnterprise;
|
|
import com.ytpm.middle.model.YtMiddleEnterprise;
|
|
|
import com.ytpm.middle.param.AgentBaseInfoParam;
|
|
import com.ytpm.middle.param.AgentBaseInfoParam;
|
|
@@ -29,7 +32,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
@RefreshScope
|
|
@RefreshScope
|
|
@@ -44,6 +50,8 @@ public class AgentServiceImpl implements AgentService {
|
|
|
private TencentSmsUtil smsUtil;
|
|
private TencentSmsUtil smsUtil;
|
|
|
@Resource
|
|
@Resource
|
|
|
private RedisUtil redisUtil;
|
|
private RedisUtil redisUtil;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private AppMapper appMapper;
|
|
|
|
|
|
|
|
@Value("${tencent.sms.registryTemplateId}")
|
|
@Value("${tencent.sms.registryTemplateId}")
|
|
|
private String registryTemplateId;
|
|
private String registryTemplateId;
|
|
@@ -56,7 +64,18 @@ public class AgentServiceImpl implements AgentService {
|
|
|
@Override
|
|
@Override
|
|
|
public ResultTable<AgentBaseInfoListVO> getBaseInfoList(AgentBaseInfoParam param) {
|
|
public ResultTable<AgentBaseInfoListVO> getBaseInfoList(AgentBaseInfoParam param) {
|
|
|
PageHelper.startPage(param.getPage(), param.getLimit());
|
|
PageHelper.startPage(param.getPage(), param.getLimit());
|
|
|
- return ResultTable.resultTableOk(new PageInfo<AgentBaseInfoListVO>(agentMapper.getBaseInfoList(param)));
|
|
|
|
|
|
|
+ List<AgentBaseInfoListVO> vos = agentMapper.getBaseInfoList(param);
|
|
|
|
|
+ if(CollUtil.isEmpty(vos)){
|
|
|
|
|
+ return ResultTable.resultTableOk(new PageInfo<AgentBaseInfoListVO>(vos));
|
|
|
|
|
+ }
|
|
|
|
|
+ String userIds = vos.stream().map(AgentBaseInfoListVO::getUserId).collect(Collectors.joining(","));
|
|
|
|
|
+ //查询企业用户是否存在授权的包,存在则显示重置密码
|
|
|
|
|
+ List<YtPlatformUserApp> apps = appMapper.getAppListByUserIds(userIds);
|
|
|
|
|
+ Map<String, List<YtPlatformUserApp>> userAppMap = apps.stream().collect(Collectors.groupingBy(YtPlatformUserApp::getUserId));
|
|
|
|
|
+ for (AgentBaseInfoListVO vo : vos) {
|
|
|
|
|
+ vo.setShowResetPwd(CollUtil.isNotEmpty(userAppMap.get(vo.getUserId())));
|
|
|
|
|
+ }
|
|
|
|
|
+ return ResultTable.resultTableOk(new PageInfo<AgentBaseInfoListVO>(vos));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -73,6 +92,8 @@ public class AgentServiceImpl implements AgentService {
|
|
|
String accountId = IDUtil.generateFlowID("yt_agent_");
|
|
String accountId = IDUtil.generateFlowID("yt_agent_");
|
|
|
generateLoginAccount(form,accountId);
|
|
generateLoginAccount(form,accountId);
|
|
|
addEnterprise(form,accountId);
|
|
addEnterprise(form,accountId);
|
|
|
|
|
+ //根据企业类型创建缴费单
|
|
|
|
|
+
|
|
|
return Result.resultOk(RepMessage.ADD_SUCCESS);
|
|
return Result.resultOk(RepMessage.ADD_SUCCESS);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -161,10 +182,10 @@ public class AgentServiceImpl implements AgentService {
|
|
|
agentMapper.addOneUser(user);
|
|
agentMapper.addOneUser(user);
|
|
|
//缓存企业负责人电话:账号密码
|
|
//缓存企业负责人电话:账号密码
|
|
|
redisUtil.setTimeOutMinutesStr(form.getConcatPhone(), generatedPassword, 30);
|
|
redisUtil.setTimeOutMinutesStr(form.getConcatPhone(), generatedPassword, 30);
|
|
|
- try {
|
|
|
|
|
- smsUtil.sendLoginPwd(form.getConcatPhone(), generatedPassword,registryTemplateId);
|
|
|
|
|
- } catch (TencentCloudSDKException e) {
|
|
|
|
|
- throw new CustomerException(e.getMessage());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// try {
|
|
|
|
|
+// smsUtil.sendLoginPwd(form.getConcatPhone(), generatedPassword,registryTemplateId);
|
|
|
|
|
+// } catch (TencentCloudSDKException e) {
|
|
|
|
|
+// throw new CustomerException(e.getMessage());
|
|
|
|
|
+// }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|