|
@@ -32,6 +32,7 @@ import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesSumEntity;
|
|
|
import com.ydtech.modules.order.dao.InsAreaCompanyMapper;
|
|
import com.ydtech.modules.order.dao.InsAreaCompanyMapper;
|
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
|
import com.ydtech.utils.StringUtils;
|
|
import com.ydtech.utils.StringUtils;
|
|
|
|
|
+import io.swagger.annotations.ApiModelProperty;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -711,34 +712,26 @@ public class UserReportServiceImpl implements UserReportService {
|
|
|
public QxFrontlineAgentDto getByUserId(String userId) {
|
|
public QxFrontlineAgentDto getByUserId(String userId) {
|
|
|
SysUserBaseVO sysUserBaseVO = sysUserMapper.selectUserById(userId);
|
|
SysUserBaseVO sysUserBaseVO = sysUserMapper.selectUserById(userId);
|
|
|
QxFrontlineAgentDto qxFrontlineAgentDto = new QxFrontlineAgentDto();
|
|
QxFrontlineAgentDto qxFrontlineAgentDto = new QxFrontlineAgentDto();
|
|
|
-
|
|
|
|
|
- HashMap<String, List<String>> humanResourcesIdList = new HashMap<>();
|
|
|
|
|
- HashMap<String, Integer> humanResources = new HashMap<>();
|
|
|
|
|
-
|
|
|
|
|
if(ObjectUtils.isNotEmpty(sysUserBaseVO)){
|
|
if(ObjectUtils.isNotEmpty(sysUserBaseVO)){
|
|
|
qxFrontlineAgentDto.setName(sysUserBaseVO.getName());
|
|
qxFrontlineAgentDto.setName(sysUserBaseVO.getName());
|
|
|
qxFrontlineAgentDto.setUserId(sysUserBaseVO.getUserId());
|
|
qxFrontlineAgentDto.setUserId(sysUserBaseVO.getUserId());
|
|
|
- qxFrontlineAgentDto.setUserPhone(sysUserBaseVO.getPDeptId());
|
|
|
|
|
- qxFrontlineAgentDto.setUserDate(sysUserBaseVO.getSubmitTime());
|
|
|
|
|
|
|
+ qxFrontlineAgentDto.setUserPhone(sysUserBaseVO.getMobile());
|
|
|
|
|
+ qxFrontlineAgentDto.setUserDate(sysUserBaseVO.getCreateTime());
|
|
|
}
|
|
}
|
|
|
- List<EsmUserReferrerDTO> employeeIncreaseReportDtos = esmUserReferrerMapper.getbyUserNextLevel(null);
|
|
|
|
|
- Map<String, EsmUserReferrerDTO> collect = employeeIncreaseReportDtos.stream().collect(Collectors.toMap(EsmUserReferrerDTO::getId, Function.identity()));
|
|
|
|
|
- Set<String> visited = new HashSet<>();
|
|
|
|
|
- for (EsmUserReferrerDTO item : employeeIncreaseReportDtos) {
|
|
|
|
|
- Integer count = this.nextLevelUser(item.getId(), collect, visited);
|
|
|
|
|
- humanResources.put(item.getId(), count);
|
|
|
|
|
- List<String> ids = new ArrayList<>();
|
|
|
|
|
- humanResourcesIdList.put(item.getId(), this.nextLevelUserList(item.getId(), collect, visited, ids));
|
|
|
|
|
|
|
+ //查询出单人力
|
|
|
|
|
+ List<SysUserTeamDto> users = esmUserReferrerMapper.getUserIdsByUserId(userId);
|
|
|
|
|
+ List<String> userIds =new ArrayList<String>();
|
|
|
|
|
+ if(users!=null && users.size()>0){
|
|
|
|
|
+ userIds = users.stream().map(SysUserTeamDto::getId).collect(Collectors.toList());
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- if (humanResourcesIdList.containsKey(userId)) {
|
|
|
|
|
- if (!CollectionUtils.isEmpty(humanResourcesIdList.get(userId))) {
|
|
|
|
|
- //出单人力
|
|
|
|
|
- List<String> ids = humanResourcesIdList.get(userId);
|
|
|
|
|
- QxFrontlineAgentDto orderManpower = insAreaCompanyService.getOrderManpower(ids);
|
|
|
|
|
- String orderManpower1 = orderManpower.getOrderManpower();//出单人力
|
|
|
|
|
- qxFrontlineAgentDto.setOrderManpower(orderManpower1);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ userIds.add(userId);
|
|
|
|
|
+ QxFrontlineAgentDto orderManpower = insAreaCompanyService.getOrderManpower(userIds);
|
|
|
|
|
+ if(orderManpower==null){
|
|
|
|
|
+ qxFrontlineAgentDto.setOrderManpower("0");
|
|
|
|
|
+ qxFrontlineAgentDto.setTotalPremium("0");
|
|
|
|
|
+ }else{
|
|
|
|
|
+ qxFrontlineAgentDto.setOrderManpower(orderManpower.getOrderManpower());
|
|
|
|
|
+ qxFrontlineAgentDto.setTotalPremium(orderManpower.getTotalPremium());
|
|
|
}
|
|
}
|
|
|
return qxFrontlineAgentDto;
|
|
return qxFrontlineAgentDto;
|
|
|
}
|
|
}
|
|
@@ -766,29 +759,57 @@ public class UserReportServiceImpl implements UserReportService {
|
|
|
List<QxFrontlineAgentDto> resultList = new ArrayList<>();
|
|
List<QxFrontlineAgentDto> resultList = new ArrayList<>();
|
|
|
HashMap<String, String> map = getDateMapByType(qxFrontlineAgentVo.getDays(), qxFrontlineAgentVo.getCreatetimeStart(), qxFrontlineAgentVo.getCreatetimeEnd());
|
|
HashMap<String, String> map = getDateMapByType(qxFrontlineAgentVo.getDays(), qxFrontlineAgentVo.getCreatetimeStart(), qxFrontlineAgentVo.getCreatetimeEnd());
|
|
|
String userId = qxFrontlineAgentVo.getUserId();
|
|
String userId = qxFrontlineAgentVo.getUserId();
|
|
|
-// 判断是否是团队长
|
|
|
|
|
|
|
+ qxFrontlineAgentVo.setCreatetimeStart(map.get("startDate"));
|
|
|
|
|
+ qxFrontlineAgentVo.setCreatetimeEnd(map.get("endDate"));
|
|
|
|
|
+ // 判断是否是团队长
|
|
|
QueryWrapper<SysUserRole> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<SysUserRole> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("user_id", userId);
|
|
queryWrapper.eq("user_id", userId);
|
|
|
SysUserRole sysUserRole = sysUserRoleMapper.selectOne(queryWrapper);
|
|
SysUserRole sysUserRole = sysUserRoleMapper.selectOne(queryWrapper);
|
|
|
|
|
+ SysUser sysUser = sysUserMapper.selectById(userId);
|
|
|
if (ObjectUtils.isNotEmpty(sysUserRole) && StringUtils.isNotEmpty(sysUserRole.getRoleId().toString()) && "21".equals(sysUserRole.getRoleId().toString())) { //负责人
|
|
if (ObjectUtils.isNotEmpty(sysUserRole) && StringUtils.isNotEmpty(sysUserRole.getRoleId().toString()) && "21".equals(sysUserRole.getRoleId().toString())) { //负责人
|
|
|
QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
|
|
QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
|
|
|
wrapper.eq("operatorCode", userId);
|
|
wrapper.eq("operatorCode", userId);
|
|
|
wrapper.eq("status", "1");
|
|
wrapper.eq("status", "1");
|
|
|
List<SysUser> sysUsers = sysUserMapper.selectList(wrapper);
|
|
List<SysUser> sysUsers = sysUserMapper.selectList(wrapper);
|
|
|
- SysUser sysUser = new SysUser();
|
|
|
|
|
- sysUser.setId(userId);
|
|
|
|
|
|
|
+ if(sysUsers==null){
|
|
|
|
|
+ sysUsers =new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
sysUsers.add(sysUser);
|
|
sysUsers.add(sysUser);
|
|
|
- if (!sysUsers.isEmpty()) {
|
|
|
|
|
- for (SysUser itemUser :sysUsers){
|
|
|
|
|
- QxFrontlineAgentDto qxFrontlineAgentDto = new QxFrontlineAgentDto();
|
|
|
|
|
- qxFrontlineAgentDto.setIds(new ArrayList<>());
|
|
|
|
|
- qxFrontlineAgentDto.setCreatetimeEnd(qxFrontlineAgentVo.getCreatetimeEnd());
|
|
|
|
|
- qxFrontlineAgentDto.setCreatetimeStart(qxFrontlineAgentVo.getCreatetimeStart());
|
|
|
|
|
- qxFrontlineAgentDto.getIds().add(itemUser.getId());
|
|
|
|
|
- QxFrontlineAgentDto taskStatisticsDto = insAreaCompanyMapper.getChannelOrderManpowerNew(qxFrontlineAgentDto);
|
|
|
|
|
- resultList.add(taskStatisticsDto);
|
|
|
|
|
|
|
+ for (SysUser user :sysUsers){
|
|
|
|
|
+ QxFrontlineAgentDto qxFrontlineAgentDto = new QxFrontlineAgentDto();
|
|
|
|
|
+ qxFrontlineAgentDto.setIds(new ArrayList<>());
|
|
|
|
|
+ qxFrontlineAgentDto.setCreatetimeEnd(qxFrontlineAgentVo.getCreatetimeEnd());
|
|
|
|
|
+ qxFrontlineAgentDto.setCreatetimeStart(qxFrontlineAgentVo.getCreatetimeStart());
|
|
|
|
|
+ qxFrontlineAgentDto.getIds().add(user.getId());
|
|
|
|
|
+ QxFrontlineAgentDto taskStatisticsDto = insAreaCompanyMapper.getChannelOrderManpowerNew(qxFrontlineAgentDto);
|
|
|
|
|
+ if(taskStatisticsDto==null){
|
|
|
|
|
+ taskStatisticsDto =new QxFrontlineAgentDto();
|
|
|
|
|
+ taskStatisticsDto.setName(user.getName());
|
|
|
|
|
+ taskStatisticsDto.setUserId(user.getId());
|
|
|
|
|
+ taskStatisticsDto.setUnderwritingCount("0");
|
|
|
|
|
+ taskStatisticsDto.setOrderNumber("0");
|
|
|
|
|
+ taskStatisticsDto.setQutationInsureCount(new BigDecimal("0"));
|
|
|
|
|
+ taskStatisticsDto.setTotalPremium("0");
|
|
|
}
|
|
}
|
|
|
|
|
+ resultList.add(taskStatisticsDto);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else{
|
|
|
|
|
+ QxFrontlineAgentDto qxFrontlineAgentDto = new QxFrontlineAgentDto();
|
|
|
|
|
+ qxFrontlineAgentDto.setIds(new ArrayList<>());
|
|
|
|
|
+ qxFrontlineAgentDto.setCreatetimeEnd(qxFrontlineAgentVo.getCreatetimeEnd());
|
|
|
|
|
+ qxFrontlineAgentDto.setCreatetimeStart(qxFrontlineAgentVo.getCreatetimeStart());
|
|
|
|
|
+ qxFrontlineAgentDto.getIds().add(userId);
|
|
|
|
|
+ QxFrontlineAgentDto taskStatisticsDto = insAreaCompanyMapper.getChannelOrderManpowerNew(qxFrontlineAgentDto);
|
|
|
|
|
+ if(taskStatisticsDto==null){
|
|
|
|
|
+ taskStatisticsDto =new QxFrontlineAgentDto();
|
|
|
|
|
+ taskStatisticsDto.setName(sysUser.getName());
|
|
|
|
|
+ taskStatisticsDto.setUserId(sysUser.getId());
|
|
|
|
|
+ taskStatisticsDto.setUnderwritingCount("0");
|
|
|
|
|
+ taskStatisticsDto.setOrderNumber("0");
|
|
|
|
|
+ taskStatisticsDto.setQutationInsureCount(new BigDecimal("0"));
|
|
|
|
|
+ taskStatisticsDto.setTotalPremium("0");
|
|
|
}
|
|
}
|
|
|
|
|
+ resultList.add(taskStatisticsDto);
|
|
|
}
|
|
}
|
|
|
return HttpResult.ok(resultList);
|
|
return HttpResult.ok(resultList);
|
|
|
}
|
|
}
|