|
|
@@ -1,5 +1,7 @@
|
|
|
package com.sckw.contract.service;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
@@ -9,6 +11,7 @@ import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.sckw.contract.dao.KwcContractLogisticsMapper;
|
|
|
import com.sckw.contract.model.dto.req.QueryListReqDto;
|
|
|
+import com.sckw.contract.model.dto.res.QueryListResDto;
|
|
|
import com.sckw.contract.model.entity.KwcContractLogistics;
|
|
|
import com.sckw.contract.model.entity.KwcContractLogisticsGoods;
|
|
|
import com.sckw.contract.model.entity.KwcContractLogisticsUnit;
|
|
|
@@ -19,6 +22,7 @@ import com.sckw.contract.model.vo.res.ContractLogisticsDetailResVo;
|
|
|
import com.sckw.contract.model.vo.res.LogisticsBaseInfoResVo;
|
|
|
import com.sckw.contract.model.vo.res.LogisticsGoodsInfoResVo;
|
|
|
import com.sckw.contract.model.vo.res.QueryListResVo;
|
|
|
+import com.sckw.core.common.enums.enums.DictEnum;
|
|
|
import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
|
import com.sckw.core.exception.SystemException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
@@ -37,6 +41,7 @@ import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.excel.utils.EasyExcelUtil;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
|
+import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -146,9 +151,9 @@ public class KwcContractLogisticsService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * @param id 主键
|
|
|
* @return ContractLogisticsDetailResVo
|
|
|
* @desc 合同详情
|
|
|
- * @param id 主键
|
|
|
* @author czh
|
|
|
* @date 2023/7/16
|
|
|
*/
|
|
|
@@ -360,29 +365,68 @@ public class KwcContractLogisticsService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * @return PageResult
|
|
|
* @desc: 分页查询
|
|
|
- * @param: reqVo
|
|
|
+ * @param: reqVo
|
|
|
* @author: czh
|
|
|
* @date 2023/7/17
|
|
|
- * @return PageResult
|
|
|
*/
|
|
|
public PageResult queryListByPage(QueryListReqVo reqVo) {
|
|
|
PageHelper.startPage(reqVo.getPage(), reqVo.getPageSize());
|
|
|
QueryListReqDto queryListReqDto = new QueryListReqDto();
|
|
|
BeanUtils.copyProperties(reqVo, queryListReqDto);
|
|
|
- List<QueryListResVo> list = kwcContractLogisticsMapper.queryList(queryListReqDto);
|
|
|
+ queryListReqDto.setEntId(LoginUserHolder.getEntId());
|
|
|
+ List<QueryListResVo> list = getQueryListResVos(queryListReqDto);
|
|
|
return PageHelperUtil.getPageResult(new PageInfo<>(list));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param queryListReqDto 入参
|
|
|
+ * @return QueryListResVo
|
|
|
+ * @desc: 抽取公共部分
|
|
|
+ * @author: czh
|
|
|
+ * @date: 2023/7/18
|
|
|
+ */
|
|
|
+ private List<QueryListResVo> getQueryListResVos(QueryListReqDto queryListReqDto) {
|
|
|
+ List<QueryListResDto> queryListResDtos = kwcContractLogisticsMapper.queryList(queryListReqDto);
|
|
|
+ Map<Long, UserCacheResDto> longUserCacheResDtoMap = new HashMap<>();
|
|
|
+ List<Long> initiateByList = queryListResDtos.stream().map(QueryListResDto::getInitiateBy).toList();
|
|
|
+ if (CollectionUtils.isNotEmpty(initiateByList)) {
|
|
|
+ longUserCacheResDtoMap = remoteSystemService.queryUserCacheMapByIds(initiateByList);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<QueryListResVo> list = new ArrayList<>();
|
|
|
+ for (QueryListResDto queryListResDto : queryListResDtos) {
|
|
|
+ QueryListResVo queryListResVo = new QueryListResVo();
|
|
|
+ queryListResVo.setCheckedEntName(queryListResDto.getUnitType().compareTo(EntTypeEnum.LOGISTICS3.getCode()) == 0 ? queryListResDto.getEntName() : queryListResDto.getTargetEntName());
|
|
|
+ queryListResVo.setCarrierEntName(queryListResDto.getUnitType().compareTo(EntTypeEnum.LOGISTICS3.getCode()) == 0 ? queryListResDto.getTargetEntName() : queryListResDto.getEntName());
|
|
|
+
|
|
|
+ UserCacheResDto userCacheResDto = longUserCacheResDtoMap.get(queryListResDto.getInitiateBy());
|
|
|
+ if (Objects.nonNull(userCacheResDto)) {
|
|
|
+ queryListResVo.setInitiateName(userCacheResDto.getName());
|
|
|
+ queryListResVo.setInitiateEntName(Objects.isNull(userCacheResDto.getEntInfo()) ? "" : userCacheResDto.getEntInfo().getFirmName());
|
|
|
+ }
|
|
|
+ queryListResVo.setChargingName(DictEnum.getLabel(DictTypeEnum.CHARGING_TYPE.getType(), String.valueOf(queryListResDto.getCharging())));
|
|
|
+ queryListResVo.setStatusName(ContractStatusEnum.getName(queryListResDto.getStatus()).getName());
|
|
|
+
|
|
|
+ // todo
|
|
|
+ queryListResVo.setPerformedAmount(new BigDecimal("0"));
|
|
|
+ list.add(queryListResVo);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
public void export(QueryListReqVo reqVo) {
|
|
|
QueryListReqDto queryListReqDto = new QueryListReqDto();
|
|
|
BeanUtils.copyProperties(reqVo, queryListReqDto);
|
|
|
-
|
|
|
+ queryListReqDto.setEntId(LoginUserHolder.getEntId());
|
|
|
if (StringUtils.isNotBlank(reqVo.getIds())) {
|
|
|
List<Long> idList = Arrays.stream(reqVo.getIds().split(Global.COMMA)).map(Long::parseLong).toList();
|
|
|
queryListReqDto.setIdList(idList);
|
|
|
}
|
|
|
- List<QueryListResVo> queryListResVos = kwcContractLogisticsMapper.queryList(queryListReqDto);
|
|
|
+
|
|
|
+ List<QueryListResVo> queryListResVos = getQueryListResVos(queryListReqDto);
|
|
|
try {
|
|
|
EasyExcelUtil.writeSingleExcel("物流合同.xlsx", "sheet1", queryListResVos, QueryListResVo.class);
|
|
|
} catch (IOException e) {
|
|
|
@@ -404,7 +448,7 @@ public class KwcContractLogisticsService {
|
|
|
queryListReqDto.setEntId(entId);
|
|
|
queryListReqDto.setStatus(ContractStatusEnum.SIGNED.getCode());
|
|
|
queryListReqDto.setEntType(EntTypeEnum.LOGISTICS3.getCode());
|
|
|
- return kwcContractLogisticsMapper.queryList(queryListReqDto);
|
|
|
+ return getQueryListResVos(queryListReqDto);
|
|
|
}
|
|
|
|
|
|
}
|