|
|
@@ -1,5 +1,7 @@
|
|
|
package com.sckw.contract.service;
|
|
|
+import java.util.Date;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
@@ -10,6 +12,7 @@ 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;
|
|
|
+import com.sckw.contract.model.report.LogisticsListExport;
|
|
|
import com.sckw.contract.model.vo.req.*;
|
|
|
import com.sckw.contract.model.vo.res.*;
|
|
|
import com.sckw.core.common.enums.enums.DictEnum;
|
|
|
@@ -26,12 +29,14 @@ import com.sckw.core.utils.*;
|
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.excel.utils.EasyExcelUtil;
|
|
|
+import com.sckw.excel.utils.ExcelUtil;
|
|
|
import com.sckw.product.api.dubbo.GoodsInfoService;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
import com.sckw.system.api.RemoteUserService;
|
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
|
import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -696,11 +701,6 @@ public class KwcContractLogisticsService {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
- public String test() {
|
|
|
- remoteUserService.checkUserBase("123123asdgasdg", 2);
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
@Transactional(rollbackFor = {})
|
|
|
public void approval(Long id, Integer status, String remark) {
|
|
|
LambdaQueryWrapper<KwcContractLogistics> wrapper = new LambdaQueryWrapper<>();
|
|
|
@@ -719,8 +719,105 @@ public class KwcContractLogisticsService {
|
|
|
if (kwcContractLogisticsMapper.updateById(kwcContractLogistics) <= 0) {
|
|
|
throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param reqVo 分页查询
|
|
|
+ * @return PageResult
|
|
|
+ * @desc: 运营端查物流合同
|
|
|
+ * @author: czh
|
|
|
+ * @date: 2023/9/13
|
|
|
+ */
|
|
|
+ public PageResult queryLogisticsByPage(QueryListReqVo reqVo) {
|
|
|
+ PageHelper.startPage(reqVo.getPage(), reqVo.getPageSize());
|
|
|
+ List<QueryListResDto> queryListResDtos = kwcContractLogisticsMapper.queryLogisticsList(reqVo);
|
|
|
+ if (CollectionUtils.isEmpty(queryListResDtos)) {
|
|
|
+ return PageHelperUtil.getPageResult(new PageInfo<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<QueryListResVo> list = getLogisticsResVo(queryListResDtos);
|
|
|
+ return PageHelperUtil.getPageResult(new PageInfo<>(list), queryListResDtos, reqVo.getPageSize());
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 转换为vo
|
|
|
+ */
|
|
|
+ private List<QueryListResVo> getLogisticsResVo(List<QueryListResDto> queryListResDtos) {
|
|
|
+ Map<Long, UserCacheResDto> longUserCacheResDtoMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
+ 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();
|
|
|
+ BeanUtils.copyProperties(queryListResDto, queryListResVo);
|
|
|
+ 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(Objects.requireNonNull(ContractStatusEnum.getName(queryListResDto.getStatus())).getName());
|
|
|
+ queryListResVo.setSigningWayName(DictEnum.getLabel(DictTypeEnum.SIGNING_TYPE.getType(), queryListResDto.getSigningWay()));
|
|
|
+ queryListResVo.setSigningWay(queryListResDto.getSigningWay());
|
|
|
+ queryListResVo.setPerformedAmount(queryListResDto.getPerformedAmount());
|
|
|
+ queryListResVo.setAmount(queryListResDto.getAmount());
|
|
|
+ list.add(queryListResVo);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @return HttpResult
|
|
|
+ * @desc: 分组查询
|
|
|
+ * @author: czh
|
|
|
+ * @date: 2023/9/13
|
|
|
+ */
|
|
|
+ public List<FindListGroupResVo> findLogisticsListGroup(QueryListReqVo reqVo) {
|
|
|
+ ContractStatusEnum[] values = ContractStatusEnum.values();
|
|
|
+ List<FindListGroupResVo> list = new ArrayList<>();
|
|
|
+ FindListGroupResVo total = new FindListGroupResVo();
|
|
|
+ total.setCount(0);
|
|
|
+ list.add(total);
|
|
|
+ for (ContractStatusEnum contractStatusEnum : values) {
|
|
|
+ FindListGroupResVo findListGroupResVo = new FindListGroupResVo();
|
|
|
+ findListGroupResVo.setStatus(contractStatusEnum.getCode());
|
|
|
+ findListGroupResVo.setStatusName(contractStatusEnum.getName());
|
|
|
+ findListGroupResVo.setCount(0);
|
|
|
+ list.add(findListGroupResVo);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<QueryListResDto> queryListResDtoList = kwcContractLogisticsMapper.queryLogisticsList(reqVo);
|
|
|
+ if (CollectionUtils.isNotEmpty(queryListResDtoList)) {
|
|
|
+ Map<Integer, List<QueryListResDto>> collect = queryListResDtoList.stream().collect(Collectors.groupingBy(QueryListResDto::getStatus));
|
|
|
+ for (FindListGroupResVo findListGroupResVo : list) {
|
|
|
+ List<QueryListResDto> queryListResDtos = collect.get(findListGroupResVo.getStatus());
|
|
|
+ findListGroupResVo.setCount(CollectionUtils.isEmpty(queryListResDtos) ? Global.NUMERICAL_ZERO : queryListResDtos.size());
|
|
|
+ }
|
|
|
+ //给汇总项求和
|
|
|
+ list.get(0).setCount(queryListResDtoList.size());
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param reqVo 查询参数
|
|
|
+ * @desc: 运营端查物流合同导出
|
|
|
+ * @author: czh
|
|
|
+ * @date: 2023/9/13
|
|
|
+ */
|
|
|
+ public void exportLogisticsList(QueryListReqVo reqVo, HttpServletResponse response) {
|
|
|
+ List<QueryListResDto> queryListResDtos = kwcContractLogisticsMapper.queryLogisticsList(reqVo);
|
|
|
+ if (CollectionUtils.isEmpty(queryListResDtos)) {
|
|
|
+ throw new SystemException("导出数据为空");
|
|
|
+ }
|
|
|
+ List<QueryListResVo> list = getLogisticsResVo(queryListResDtos);
|
|
|
+ List<LogisticsListExport> dataList = BeanUtils.copyToList(list, LogisticsListExport.class);
|
|
|
+ ExcelUtil.downData(response, LogisticsListExport.class, dataList);
|
|
|
}
|
|
|
|
|
|
}
|