This commit is contained in:
zhangchenbiao
2023-06-21 15:14:13 +08:00
parent b92e34224c
commit 0750d68809
11 changed files with 106 additions and 58 deletions

View File

@@ -25,6 +25,7 @@ public class CoolDateUtils {
public static final String DATE_FORMAT_SEC_4 = "yyyy.MM.dd HH:mm"; public static final String DATE_FORMAT_SEC_4 = "yyyy.MM.dd HH:mm";
public static final String DATE_FORMAT_SEC_5 = "yyyy.MM.dd HH:mm"; public static final String DATE_FORMAT_SEC_5 = "yyyy.MM.dd HH:mm";
public static final String DATE_FORMAT_SEC_6 = "yyyy.MM.dd"; public static final String DATE_FORMAT_SEC_6 = "yyyy.MM.dd";
public static final String DATE_FORMAT_SEC_7 = "yyyy/MM/dd HH:mm";
/** /**
* 几天后的当前 * 几天后的当前
* @param d * @param d

View File

@@ -10,6 +10,8 @@ import org.springframework.stereotype.Repository;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author zhangchenbiao * @author zhangchenbiao
@@ -98,4 +100,9 @@ public class EnterpriseUserDAO {
} }
return enterpriseUserMapper.getUserListByRegionIds(regionIds); return enterpriseUserMapper.getUserListByRegionIds(regionIds);
} }
public Map<String, String> getUserNameAndMobile(List<String> userIds){
List<EnterpriseUserDO> userList = getUserInfoByUserIds(userIds);
return userList.stream().filter(o->!StringUtils.isAnyBlank(o.getMobile(), o.getName())).collect(Collectors.toMap(k -> k.getUserId(), v -> v.getName() + " " + v.getMobile()));
}
} }

View File

@@ -89,12 +89,12 @@ public class HyOpenAreaInfoDAO {
return hyOpenAreaInfoMapper.selectByIds(ids); return hyOpenAreaInfoMapper.selectByIds(ids);
} }
public Map<Long, String> selectNameMapByIds(List<Long> ids){ public Map<String, String> selectNameMapByIds(List<Long> ids){
if (CollectionUtils.isEmpty(ids)){ if (CollectionUtils.isEmpty(ids)){
return Maps.newHashMap(); return Maps.newHashMap();
} }
List<HyOpenAreaInfoDO> hyOpenAreaInfoDOS = hyOpenAreaInfoMapper.selectByIds(ids); List<HyOpenAreaInfoDO> hyOpenAreaInfoDOS = hyOpenAreaInfoMapper.selectByIds(ids);
return ListUtils.emptyIfNull(hyOpenAreaInfoDOS).stream().collect(Collectors.toMap(k->k.getId(), v->v.getAreaName())); return ListUtils.emptyIfNull(hyOpenAreaInfoDOS).stream().collect(Collectors.toMap(k->String.valueOf(k.getId()), v->v.getAreaName()));
} }

View File

@@ -323,7 +323,7 @@
<include refid="Base_Column_List"></include> <include refid="Base_Column_List"></include>
from hy_partner_line_info from hy_partner_line_info
<where> <where>
<if test="userId"> <if test="userId != null">
and investment_manager = #{userId} and investment_manager = #{userId}
</if> </if>
<if test="lastMonthTodayDate!=null"> <if test="lastMonthTodayDate!=null">

View File

@@ -43,11 +43,10 @@
select select
<include refid="Base_Column_List"></include> <include refid="Base_Column_List"></include>
from hy_partner_user_info from hy_partner_user_info
<if test="partnerIdList!=null and partnerIdList.size>0"> where
<foreach collection="partnerIdList" open="and partner_id in (" close=")" separator="," item="partnerId"> <foreach collection="partnerIdList" open="partner_id in (" close=")" separator="," item="partnerId">
#{partnerId} #{partnerId}
</foreach> </foreach>
</if>
</select> </select>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true"> <insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">

View File

@@ -1,10 +1,19 @@
package com.cool.store.vo; package com.cool.store.vo;
import cn.hutool.core.date.DateUtil;
import com.cool.store.dto.partner.PartnerIntentApplyInfoDTO;
import com.cool.store.entity.HyPartnerUserInfoDO;
import com.cool.store.utils.CoolDateUtils;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Map;
/** /**
@@ -16,7 +25,6 @@ import java.util.Date;
@ApiModel @ApiModel
public class PartnerIntentApplyInfoVO { public class PartnerIntentApplyInfoVO {
@ApiModelProperty("") @ApiModelProperty("")
private Long id; private Long id;
@@ -45,7 +53,7 @@ public class PartnerIntentApplyInfoVO {
private Integer acceptAdjustType; private Integer acceptAdjustType;
@ApiModelProperty("截止时间") @ApiModelProperty("截止时间")
private Date deadline; private String deadline;
@ApiModelProperty("阶段提交时间") @ApiModelProperty("阶段提交时间")
private Date partnerSubmitTime; private Date partnerSubmitTime;
@@ -53,4 +61,31 @@ public class PartnerIntentApplyInfoVO {
@ApiModelProperty("阶段状态") @ApiModelProperty("阶段状态")
private String WorkflowStatus; private String WorkflowStatus;
public static List<PartnerIntentApplyInfoVO> convertList(List<PartnerIntentApplyInfoDTO> list, Map<String, HyPartnerUserInfoDO> infoDOMap, Map<String, String> wantShopAreaNameMap, String workflowStatus){
if(CollectionUtils.isEmpty(list)){
return Lists.newArrayList();
}
List<PartnerIntentApplyInfoVO> resultList = new ArrayList<>();
for (PartnerIntentApplyInfoDTO partnerIntentApplyInfoDTO : list) {
PartnerIntentApplyInfoVO partnerIntentApplyInfoVO = new PartnerIntentApplyInfoVO();
partnerIntentApplyInfoVO.setId(partnerIntentApplyInfoDTO.getId());
partnerIntentApplyInfoVO.setPartnerId(partnerIntentApplyInfoDTO.getPartnerId());
partnerIntentApplyInfoVO.setLineId(partnerIntentApplyInfoDTO.getPartnerLineId());
partnerIntentApplyInfoVO.setPartnerSubmitTime(partnerIntentApplyInfoDTO.getPartnerSubmitTime());
partnerIntentApplyInfoVO.setAcceptAdjustType(partnerIntentApplyInfoDTO.getAcceptAdjustType());
partnerIntentApplyInfoVO.setLiveArea(partnerIntentApplyInfoDTO.getLiveArea());
partnerIntentApplyInfoVO.setWantShopArea(partnerIntentApplyInfoDTO.getWantShopArea());
String deadLine = DateUtil.format(partnerIntentApplyInfoDTO.getDeadline(), CoolDateUtils.DATE_FORMAT_SEC);
partnerIntentApplyInfoVO.setDeadline(deadLine);
HyPartnerUserInfoDO infoDOMapOrDefault = infoDOMap.getOrDefault(partnerIntentApplyInfoDTO.getPartnerId(), new HyPartnerUserInfoDO());
partnerIntentApplyInfoVO.setPartnerUserName(infoDOMapOrDefault.getUsername());
partnerIntentApplyInfoVO.setPartnerUserPhone(infoDOMapOrDefault.getMobile());
partnerIntentApplyInfoVO.setWorkflowStatus(workflowStatus);
partnerIntentApplyInfoVO.setWantShopAreaName(wantShopAreaNameMap.get(partnerIntentApplyInfoDTO.getWantShopArea()));
resultList.add(partnerIntentApplyInfoVO);
}
return resultList;
}
} }

View File

@@ -1,11 +1,15 @@
package com.cool.store.vo; package com.cool.store.vo;
import io.swagger.annotations.Api; import cn.hutool.core.date.DateUtil;
import com.cool.store.entity.HyPartnerLineInfoDO;
import com.cool.store.utils.CoolDateUtils;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/** /**
* @Author suzhuhong * @Author suzhuhong
@@ -19,7 +23,6 @@ public class PartnerLineInfoVO {
@ApiModelProperty("") @ApiModelProperty("")
private Long lineId; private Long lineId;
@ApiModelProperty("hy_partner_user_info.partner_id") @ApiModelProperty("hy_partner_user_info.partner_id")
private String partnerId; private String partnerId;
@@ -42,7 +45,7 @@ public class PartnerLineInfoVO {
private String developmentManager; private String developmentManager;
@ApiModelProperty("截止时间") @ApiModelProperty("截止时间")
private Date deadline; private String deadline;
@ApiModelProperty("通过原因") @ApiModelProperty("通过原因")
private String passReason; private String passReason;
@@ -67,12 +70,45 @@ public class PartnerLineInfoVO {
@ApiModelProperty("加盟商用户手机号") @ApiModelProperty("加盟商用户手机号")
private String partnerUserPhone; private String partnerUserPhone;
@ApiModelProperty("结束操作人ID") @ApiModelProperty("结束操作人ID")
private String closeUserId ; private String closeUserId ;
@ApiModelProperty("结束操作人名称") @ApiModelProperty("结束操作人名称")
private String closeUserName ; private String closeUserName ;
@ApiModelProperty("结束时间") @ApiModelProperty("结束时间")
private Date closeDate ; private String closeDate ;
/**
*
* @param lineList
* @return
*/
public static List<PartnerLineInfoVO> convertList(List<HyPartnerLineInfoDO> lineList, Map<String, String> userNamePhoneMap){
List<PartnerLineInfoVO> resultList = new ArrayList<>();
for (HyPartnerLineInfoDO line : lineList) {
PartnerLineInfoVO result = new PartnerLineInfoVO();
result.setLineId(line.getId());
result.setPartnerId(line.getPartnerId());
result.setCertifyFile(line.getCertifyFile());
result.setWorkflowStage(line.getWorkflowStage());
result.setWorkflowStatus(line.getWorkflowStatus());
result.setLineStatus(line.getLineStatus());
String deadLine = DateUtil.format(line.getDeadline(), CoolDateUtils.DATE_FORMAT_SEC);
result.setDeadline(deadLine);
result.setPassReason(line.getPassReason());
result.setRejectPublicReason(line.getRejectPublicReason());
result.setRejectRealReason(line.getRejectRealReason());
result.setCertifyFile(line.getCertifyFile());
result.setCloseUserId(line.getCloseUserId());
result.setCloseUserName(userNamePhoneMap.get(line.getCloseUserId()));
String closeDate = DateUtil.format(line.getCloseTime(), CoolDateUtils.DATE_FORMAT_SEC_7);
result.setCloseDate(closeDate);
resultList.add(result);
}
return resultList;
}
} }

View File

@@ -84,7 +84,7 @@ public class PrivateSeaLineListVo {
private String recommendPartnerName; private String recommendPartnerName;
public static List<PrivateSeaLineListVo> convertList(List<PrivateSeaLineDTO> list, Map<String, String> finalDevManagerMap, Map<Long, String> wantShopAreaNameMap){ public static List<PrivateSeaLineListVo> convertList(List<PrivateSeaLineDTO> list, Map<String, String> finalDevManagerMap, Map<String, String> wantShopAreaNameMap){
List<PrivateSeaLineListVo> resultList = new ArrayList<>(); List<PrivateSeaLineListVo> resultList = new ArrayList<>();
for (PrivateSeaLineDTO x : list) { for (PrivateSeaLineDTO x : list) {
PrivateSeaLineListVo privateSeaLineListVo = new PrivateSeaLineListVo(); PrivateSeaLineListVo privateSeaLineListVo = new PrivateSeaLineListVo();

View File

@@ -34,7 +34,7 @@ public class CustomExceptionHandler {
@ExceptionHandler(value = ServiceException.class) @ExceptionHandler(value = ServiceException.class)
public void handleCustomException(ServiceException e, HttpServletResponse httpServletResponse) { public void handleCustomException(ServiceException e, HttpServletResponse httpServletResponse) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
ResponseResult responseResult = new ResponseResult(e.getErrorCode(), e.getMessage()); ResponseResult responseResult = new ResponseResult(e.getErrorCode(), e.getErrorMessage());
responseResult(httpServletResponse, responseResult); responseResult(httpServletResponse, responseResult);
} }
@@ -52,7 +52,6 @@ public class CustomExceptionHandler {
responseResult(httpServletResponse, responseResult); responseResult(httpServletResponse, responseResult);
} }
private void responseResult(HttpServletResponse response, ResponseResult result) { private void responseResult(HttpServletResponse response, ResponseResult result) {
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
response.setHeader("Content-type", "application/json;charset=UTF-8"); response.setHeader("Content-type", "application/json;charset=UTF-8");

View File

@@ -6,6 +6,7 @@ import com.cool.store.constants.CommonConstants;
import com.cool.store.constants.RedisConstant; import com.cool.store.constants.RedisConstant;
import com.cool.store.dao.*; import com.cool.store.dao.*;
import com.cool.store.dto.partner.PartnerIntentApplyInfoDTO; import com.cool.store.dto.partner.PartnerIntentApplyInfoDTO;
import com.cool.store.dto.partner.PrivateSeaLineDTO;
import com.cool.store.entity.HyOpenAreaInfoDO; import com.cool.store.entity.HyOpenAreaInfoDO;
import com.cool.store.entity.HyPartnerIntentInfoDO; import com.cool.store.entity.HyPartnerIntentInfoDO;
import com.cool.store.entity.HyPartnerUserInfoDO; import com.cool.store.entity.HyPartnerUserInfoDO;
@@ -78,17 +79,10 @@ public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoServic
List<String> partnerIds = list.stream().map(PartnerIntentApplyInfoDTO::getPartnerId).collect(Collectors.toList()); List<String> partnerIds = list.stream().map(PartnerIntentApplyInfoDTO::getPartnerId).collect(Collectors.toList());
List<HyPartnerUserInfoDO> hyPartnerUserInfoDOS = hyPartnerUserInfoDAO.selectByPartnerIds(partnerIds); List<HyPartnerUserInfoDO> hyPartnerUserInfoDOS = hyPartnerUserInfoDAO.selectByPartnerIds(partnerIds);
Map<String, HyPartnerUserInfoDO> infoDOMap = hyPartnerUserInfoDOS.stream().collect(Collectors.toMap(HyPartnerUserInfoDO::getPartnerId, data -> data)); Map<String, HyPartnerUserInfoDO> infoDOMap = hyPartnerUserInfoDOS.stream().collect(Collectors.toMap(HyPartnerUserInfoDO::getPartnerId, data -> data));
List<PartnerIntentApplyInfoVO> result = new ArrayList<>(); List<Long> wantShopAreaList = list.stream().map(PartnerIntentApplyInfoDTO::getWantShopArea).map(Long::parseLong).distinct().collect(Collectors.toList());
String finalWorkflowStatus = workflowStatus; Map<String, String> wantShopAreaNameMap = hyOpenAreaInfoDAO.selectNameMapByIds(wantShopAreaList);
list.stream().forEach(x->{ List<PartnerIntentApplyInfoVO> resultList = PartnerIntentApplyInfoVO.convertList(list, infoDOMap, wantShopAreaNameMap, workflowStatus);
PartnerIntentApplyInfoVO pat = partnerIntentApplyInfoDTOToVo(x); partnerIntentApplyInfo.setList(resultList);
HyPartnerUserInfoDO infoDOMapOrDefault = infoDOMap.getOrDefault(x.getPartnerId(), new HyPartnerUserInfoDO());
pat.setPartnerUserName(infoDOMapOrDefault.getUsername());
pat.setPartnerUserPhone(infoDOMapOrDefault.getMobile());
pat.setWorkflowStatus(finalWorkflowStatus);
result.add(pat);
});
partnerIntentApplyInfo.setList(result);
return partnerIntentApplyInfo; return partnerIntentApplyInfo;
} }
@@ -193,23 +187,6 @@ public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoServic
intentInfoDO.setWeakness(request.getWeakness()); intentInfoDO.setWeakness(request.getWeakness());
} }
/**
* partnerIntentApplyInfoDTOToVo
* @param partnerIntentApplyInfoDTO
* @return
*/
private PartnerIntentApplyInfoVO partnerIntentApplyInfoDTOToVo(PartnerIntentApplyInfoDTO partnerIntentApplyInfoDTO){
PartnerIntentApplyInfoVO partnerIntentApplyInfoVO = new PartnerIntentApplyInfoVO();
partnerIntentApplyInfoVO.setId(partnerIntentApplyInfoDTO.getId());
partnerIntentApplyInfoVO.setPartnerId(partnerIntentApplyInfoDTO.getPartnerId());
partnerIntentApplyInfoVO.setLineId(partnerIntentApplyInfoDTO.getPartnerLineId());
partnerIntentApplyInfoVO.setPartnerSubmitTime(partnerIntentApplyInfoDTO.getPartnerSubmitTime());
partnerIntentApplyInfoVO.setAcceptAdjustType(partnerIntentApplyInfoDTO.getAcceptAdjustType());
partnerIntentApplyInfoVO.setLiveArea(partnerIntentApplyInfoDTO.getLiveArea());
partnerIntentApplyInfoVO.setWantShopArea(partnerIntentApplyInfoDTO.getWantShopArea());
partnerIntentApplyInfoVO.setDeadline(partnerIntentApplyInfoDTO.getDeadline());
return partnerIntentApplyInfoVO;
}
/** /**

View File

@@ -106,16 +106,11 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
PageHelper.startPage(pageNumber,pageSize); PageHelper.startPage(pageNumber,pageSize);
String lastMonthTodayDate = DateUtil.format(CoolDateUtils.getDateBefore(new Date(),-30), CoolDateUtils.DATE_FORMAT_SEC); String lastMonthTodayDate = DateUtil.format(CoolDateUtils.getDateBefore(new Date(),-30), CoolDateUtils.DATE_FORMAT_SEC);
PageInfo hyPartnerLineInfoDOPageInfo = new PageInfo(hyPartnerLineInfoDAO.lastMonthCloseLine(userId, lastMonthTodayDate)); PageInfo hyPartnerLineInfoDOPageInfo = new PageInfo(hyPartnerLineInfoDAO.lastMonthCloseLine(userId, lastMonthTodayDate));
List<HyPartnerLineInfoDO> list = hyPartnerLineInfoDOPageInfo.getList(); List<HyPartnerLineInfoDO> list = hyPartnerLineInfoDOPageInfo.getList();
List<PartnerLineInfoVO> result = new ArrayList<>(); List<String> closeUserIds = list.stream().filter(o -> Objects.nonNull(o.getCloseUserId())).map(HyPartnerLineInfoDO::getCloseUserId).distinct().collect(Collectors.toList());
list.stream().forEach(x->{ Map<String, String> userNamePhoneMap = enterpriseUserDAO.getUserNameAndMobile(closeUserIds);
PartnerLineInfoVO partnerLineInfoVO = new PartnerLineInfoVO(); List<PartnerLineInfoVO> resultList = PartnerLineInfoVO.convertList(list, userNamePhoneMap);
BeanUtils.copyProperties(x,partnerLineInfoVO); hyPartnerLineInfoDOPageInfo.setList(resultList);
partnerLineInfoVO.setLineId(x.getId());
result.add(partnerLineInfoVO);
});
hyPartnerLineInfoDOPageInfo.setList(result);
return hyPartnerLineInfoDOPageInfo; return hyPartnerLineInfoDOPageInfo;
} }
@@ -166,8 +161,7 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
PageInfo blackListDTOPageInfo = new PageInfo(hyPartnerLineInfoDAO.getBlackList(LineRequest.getUserNameKeyword(), LineRequest.getPhoneKeyword(),LineRequest.getIntentArea(), LineRequest.getAcceptAdjustType())); PageInfo blackListDTOPageInfo = new PageInfo(hyPartnerLineInfoDAO.getBlackList(LineRequest.getUserNameKeyword(), LineRequest.getPhoneKeyword(),LineRequest.getIntentArea(), LineRequest.getAcceptAdjustType()));
List<PartnerBlackListDTO> list = blackListDTOPageInfo.getList(); List<PartnerBlackListDTO> list = blackListDTOPageInfo.getList();
List<String> closeUserIdList = list.stream().map(PartnerBlackListDTO::getCloseUserId).collect(Collectors.toList()); List<String> closeUserIdList = list.stream().map(PartnerBlackListDTO::getCloseUserId).collect(Collectors.toList());
List<EnterpriseUserDO> userInfoByUserIds = enterpriseUserDAO.getUserInfoByUserIds(closeUserIdList); Map<String, String> userPhoneMap = enterpriseUserDAO.getUserNameAndMobile(closeUserIdList);
Map<String, String> userPhoneMap = userInfoByUserIds.stream().collect(Collectors.toMap(EnterpriseUserDO::getUserId, EnterpriseUserDO::getMobile));
List<BlackListVO> result = new ArrayList<>(); List<BlackListVO> result = new ArrayList<>();
list.stream().forEach(x->{ list.stream().forEach(x->{
BlackListVO blackListVO = convertPartnerBlackListDTOToVo(x); BlackListVO blackListVO = convertPartnerBlackListDTOToVo(x);
@@ -342,7 +336,7 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
devManagerMap = devManagerList.stream().collect(Collectors.toMap(EnterpriseUserDO::getUserId, EnterpriseUserDO::getName)); devManagerMap = devManagerList.stream().collect(Collectors.toMap(EnterpriseUserDO::getUserId, EnterpriseUserDO::getName));
} }
List<Long> wantShopAreaList = list.stream().map(PrivateSeaLineDTO::getWantShopArea).map(Long::parseLong).distinct().collect(Collectors.toList()); List<Long> wantShopAreaList = list.stream().map(PrivateSeaLineDTO::getWantShopArea).map(Long::parseLong).distinct().collect(Collectors.toList());
Map<Long, String> wantShopAreaNameMap = hyOpenAreaInfoDAO.selectNameMapByIds(wantShopAreaList); Map<String, String> wantShopAreaNameMap = hyOpenAreaInfoDAO.selectNameMapByIds(wantShopAreaList);
List<PrivateSeaLineListVo> result = PrivateSeaLineListVo.convertList(list, devManagerMap, wantShopAreaNameMap); List<PrivateSeaLineListVo> result = PrivateSeaLineListVo.convertList(list, devManagerMap, wantShopAreaNameMap);
privateLineList.setList(result); privateLineList.setList(result);
return privateLineList; return privateLineList;