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

@@ -34,7 +34,7 @@ public class CustomExceptionHandler {
@ExceptionHandler(value = ServiceException.class)
public void handleCustomException(ServiceException e, HttpServletResponse httpServletResponse) {
log.error(e.getMessage(), e);
ResponseResult responseResult = new ResponseResult(e.getErrorCode(), e.getMessage());
ResponseResult responseResult = new ResponseResult(e.getErrorCode(), e.getErrorMessage());
responseResult(httpServletResponse, responseResult);
}
@@ -52,7 +52,6 @@ public class CustomExceptionHandler {
responseResult(httpServletResponse, responseResult);
}
private void responseResult(HttpServletResponse response, ResponseResult result) {
response.setCharacterEncoding("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.dao.*;
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.HyPartnerIntentInfoDO;
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<HyPartnerUserInfoDO> hyPartnerUserInfoDOS = hyPartnerUserInfoDAO.selectByPartnerIds(partnerIds);
Map<String, HyPartnerUserInfoDO> infoDOMap = hyPartnerUserInfoDOS.stream().collect(Collectors.toMap(HyPartnerUserInfoDO::getPartnerId, data -> data));
List<PartnerIntentApplyInfoVO> result = new ArrayList<>();
String finalWorkflowStatus = workflowStatus;
list.stream().forEach(x->{
PartnerIntentApplyInfoVO pat = partnerIntentApplyInfoDTOToVo(x);
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);
List<Long> wantShopAreaList = list.stream().map(PartnerIntentApplyInfoDTO::getWantShopArea).map(Long::parseLong).distinct().collect(Collectors.toList());
Map<String, String> wantShopAreaNameMap = hyOpenAreaInfoDAO.selectNameMapByIds(wantShopAreaList);
List<PartnerIntentApplyInfoVO> resultList = PartnerIntentApplyInfoVO.convertList(list, infoDOMap, wantShopAreaNameMap, workflowStatus);
partnerIntentApplyInfo.setList(resultList);
return partnerIntentApplyInfo;
}
@@ -193,23 +187,6 @@ public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoServic
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);
String lastMonthTodayDate = DateUtil.format(CoolDateUtils.getDateBefore(new Date(),-30), CoolDateUtils.DATE_FORMAT_SEC);
PageInfo hyPartnerLineInfoDOPageInfo = new PageInfo(hyPartnerLineInfoDAO.lastMonthCloseLine(userId, lastMonthTodayDate));
List<HyPartnerLineInfoDO> list = hyPartnerLineInfoDOPageInfo.getList();
List<PartnerLineInfoVO> result = new ArrayList<>();
list.stream().forEach(x->{
PartnerLineInfoVO partnerLineInfoVO = new PartnerLineInfoVO();
BeanUtils.copyProperties(x,partnerLineInfoVO);
partnerLineInfoVO.setLineId(x.getId());
result.add(partnerLineInfoVO);
});
hyPartnerLineInfoDOPageInfo.setList(result);
List<String> closeUserIds = list.stream().filter(o -> Objects.nonNull(o.getCloseUserId())).map(HyPartnerLineInfoDO::getCloseUserId).distinct().collect(Collectors.toList());
Map<String, String> userNamePhoneMap = enterpriseUserDAO.getUserNameAndMobile(closeUserIds);
List<PartnerLineInfoVO> resultList = PartnerLineInfoVO.convertList(list, userNamePhoneMap);
hyPartnerLineInfoDOPageInfo.setList(resultList);
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()));
List<PartnerBlackListDTO> list = blackListDTOPageInfo.getList();
List<String> closeUserIdList = list.stream().map(PartnerBlackListDTO::getCloseUserId).collect(Collectors.toList());
List<EnterpriseUserDO> userInfoByUserIds = enterpriseUserDAO.getUserInfoByUserIds(closeUserIdList);
Map<String, String> userPhoneMap = userInfoByUserIds.stream().collect(Collectors.toMap(EnterpriseUserDO::getUserId, EnterpriseUserDO::getMobile));
Map<String, String> userPhoneMap = enterpriseUserDAO.getUserNameAndMobile(closeUserIdList);
List<BlackListVO> result = new ArrayList<>();
list.stream().forEach(x->{
BlackListVO blackListVO = convertPartnerBlackListDTOToVo(x);
@@ -342,7 +336,7 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
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());
Map<Long, String> wantShopAreaNameMap = hyOpenAreaInfoDAO.selectNameMapByIds(wantShopAreaList);
Map<String, String> wantShopAreaNameMap = hyOpenAreaInfoDAO.selectNameMapByIds(wantShopAreaList);
List<PrivateSeaLineListVo> result = PrivateSeaLineListVo.convertList(list, devManagerMap, wantShopAreaNameMap);
privateLineList.setList(result);
return privateLineList;