Explorar o código

运营端合同

czh %!s(int64=2) %!d(string=hai) anos
pai
achega
4b126e1d3f
Modificáronse 14 ficheiros con 754 adicións e 85 borrados
  1. 41 3
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/controller/KwcCheckedController.java
  2. 39 1
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/controller/KwcContractSaleController.java
  3. 11 0
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/dao/KwcContractLogisticsMapper.java
  4. 9 1
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/dao/KwcContractTradeMapper.java
  5. 40 0
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/dto/res/QueryListResDto.java
  6. 133 0
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/report/LogisticsListExport.java
  7. 133 0
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/report/TradeListExport.java
  8. 6 0
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/vo/req/QueryListReqVo.java
  9. 102 5
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractLogisticsService.java
  10. 99 0
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractTradeService.java
  11. 59 37
      sckw-modules/sckw-contract/src/main/resources/mapper/KwcContractLogisticsMapper.xml
  12. 60 35
      sckw-modules/sckw-contract/src/main/resources/mapper/KwcContractTradeMapper.xml
  13. 17 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteBaseService.java
  14. 5 3
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java

+ 41 - 3
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/controller/KwcCheckedController.java

@@ -2,17 +2,24 @@ package com.sckw.contract.controller;
 
 import com.sckw.contract.model.vo.req.*;
 import com.sckw.contract.service.*;
+import com.sckw.core.exception.BusinessException;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.enums.EntTypeEnum;
+import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
+import com.sckw.excel.utils.ExcelUtil;
+import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.Valid;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 /**
  * @author czh
  * @desc 托运合同
@@ -166,8 +173,39 @@ public class KwcCheckedController {
     }
 
 
-    @PostMapping("test")
-    public HttpResult test() {
-        return HttpResult.ok(kwcContractLogisticsService.test());
+    /**
+     * @param reqVo 分页查询
+     * @return HttpResult
+     * @desc: 运营端查物流合同
+     * @author: czh
+     * @date: 2023/9/13
+     */
+    @PostMapping("queryLogisticsByPage")
+    public HttpResult queryLogisticsByPage(@RequestBody QueryListReqVo reqVo) {
+        return HttpResult.ok(kwcContractLogisticsService.queryLogisticsByPage(reqVo));
     }
+
+    /**
+     * @return HttpResult
+     * @desc: 分组查询
+     * @author: czh
+     * @date: 2023/9/13
+     */
+    @PostMapping("findLogisticsListGroup")
+    public HttpResult findLogisticsListGroup(@RequestBody QueryListReqVo reqVo) {
+        return HttpResult.ok(kwcContractLogisticsService.findLogisticsListGroup(reqVo));
+    }
+
+    /**
+     * @param reqVo 查询参数
+     * @desc: 运营端查物流合同导出
+     * @author: czh
+     * @date: 2023/9/13
+     */
+    @PostMapping(value = "/exportLogisticsList", produces = MediaType.APPLICATION_JSON_VALUE)
+    public void exportLogisticsList(@RequestBody QueryListReqVo reqVo, HttpServletResponse response) {
+        kwcContractLogisticsService.exportLogisticsList(reqVo, response);
+    }
+
+
 }

+ 39 - 1
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/controller/KwcContractSaleController.java

@@ -6,8 +6,10 @@ import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.enums.EntTypeEnum;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
+import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.Valid;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -34,7 +36,7 @@ public class KwcContractSaleController {
      * @return HttpResult
      */
     @RequestMapping("queryListByPage")
-    public HttpResult queryListByPage(@Valid @RequestBody QueryListReqVo reqVo) {
+    public HttpResult queryListByPage(@RequestBody QueryListReqVo reqVo) {
         reqVo.setEntType(EntTypeEnum.SUPPLIER.getCode());
         return HttpResult.ok(kwcContractTradeService.queryListByPage(reqVo));
     }
@@ -165,4 +167,40 @@ public class KwcContractSaleController {
         reqVo.setEntType(EntTypeEnum.SUPPLIER.getCode());
         return HttpResult.ok(kwcContractTradeService.findListGroup(reqVo));
     }
+
+
+    /**
+     * @param reqVo 分页查询
+     * @return HttpResult
+     * @desc: 运营端查贸易合同
+     * @author: czh
+     * @date: 2023/9/13
+     */
+    @PostMapping("queryTradeByPage")
+    public HttpResult queryTradeByPage(@RequestBody QueryListReqVo reqVo) {
+        return HttpResult.ok(kwcContractTradeService.queryTradeByPage(reqVo));
+    }
+
+    /**
+     * @return HttpResult
+     * @desc: 分组查询
+     * @author: czh
+     * @date: 2023/7/18
+     */
+    @PostMapping("findTradeListGroup")
+    public HttpResult findTradeListGroup(@RequestBody QueryListReqVo reqVo) {
+        return HttpResult.ok(kwcContractTradeService.findTradeListGroup(reqVo));
+    }
+
+    /**
+     * @param reqVo 查询参数
+     * @desc: 运营端查贸易合同导出
+     * @author: czh
+     * @date: 2023/9/13
+     */
+    @PostMapping(value = "/exportTradeList", produces = MediaType.APPLICATION_JSON_VALUE)
+    public void exportTradeList(@RequestBody QueryListReqVo reqVo, HttpServletResponse response) {
+        kwcContractTradeService.exportTradeList(reqVo, response);
+    }
+
 }

+ 11 - 0
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/dao/KwcContractLogisticsMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 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.vo.req.QueryListReqVo;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
@@ -25,6 +26,16 @@ public interface KwcContractLogisticsMapper extends BaseMapper<KwcContractLogist
      * @return QueryListResDto
      */
     List<QueryListResDto> queryList(QueryListReqDto reqVo);
+
+    /**
+     * @param reqVo 查询
+     * @return QueryListResDto
+     * @desc: 运营端查物流合同
+     * @author: czh
+     * @date: 2023/9/13
+     */
+    List<QueryListResDto> queryLogisticsList(QueryListReqVo reqVo);
+
 }
 
 

+ 9 - 1
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/dao/KwcContractTradeMapper.java

@@ -10,7 +10,6 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
-import java.util.Map;
 
 /**
 * @author PC
@@ -39,6 +38,15 @@ public interface KwcContractTradeMapper extends BaseMapper<KwcContractTrade> {
      * @date: 2023/9/11
      */
     List<QueryContractValidCountResDto> queryContractValidCount(@Param(value = "list") List<Long> entIdList);
+
+    /**
+     * @param reqVo 查询
+     * @return QueryListResDto
+     * @desc: 运营端查贸易合同
+     * @author: czh
+     * @date: 2023/9/13
+     */
+    List<QueryListResDto> queryTradeList(QueryListReqVo reqVo);
 }
 
 

+ 40 - 0
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/dto/res/QueryListResDto.java

@@ -123,4 +123,44 @@ public class QueryListResDto {
      */
     private BigDecimal performedAmount;
 
+    /**
+     * 托运企业id
+     */
+    private Long checkedEntId;
+
+    /**
+     * 托运企业名
+     */
+    private String checkedEntName;
+
+    /**
+     * 承运企业id
+     */
+    private Long carrierEntId;
+
+    /**
+     * 承运企业名
+     */
+    private String carrierEntName;
+
+    /**
+     * 供应企业id
+     */
+    private Long provideEntId;
+
+    /**
+     * 供应企业名
+     */
+    private String provideEntName;
+
+    /**
+     * 采购企业id
+     */
+    private Long purchaseEntId;
+
+    /**
+     * 采购企业名
+     */
+    private String purchaseEntName;
+
 }

+ 133 - 0
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/report/LogisticsListExport.java

@@ -0,0 +1,133 @@
+package com.sckw.contract.model.report;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.sckw.excel.annotation.ExcelContext;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @desc: 物流合同列表导出对象
+ * @author: czh
+ * @date: 2023-07-06 9:15
+ */
+@Data
+@Accessors(chain = true)
+@ExcelContext(fileName = "物流合同列表信息", sheetName = "物流合同列表信息")
+public class LogisticsListExport implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = -7804227640473193219L;
+
+    /**
+     * 合同状态中文名
+     */
+    @ExcelProperty(value = "合同状态")
+    private String statusName;
+
+    /**
+     * 托运单位名
+     */
+    @ExcelProperty(value = "托运单位")
+    private String checkedEntName;
+
+    /**
+     * 承运单位名
+     */
+    @ExcelProperty(value = "承运单位")
+    private String carrierEntName;
+
+    /**
+     * 合同编号
+     */
+    @ExcelProperty(value = "合同编号")
+    private String contractNo;
+
+    /**
+     * 合同名称
+     */
+    @ExcelProperty(value = "合同名称")
+    private String contractName;
+
+    /**
+     * 签约方式中文名
+     */
+    @ExcelProperty(value = "签约方式")
+    private String signingWayName;
+
+    /**
+     * 计费方式中文名
+     */
+    @ExcelProperty(value = "计费方式")
+    private String chargingName;
+
+    /**
+     * 合同总量
+     */
+    @ExcelProperty(value = "合同总量")
+    private String amount;
+
+    /**
+     * 已履约量
+     */
+    @ExcelProperty(value = "已履约量")
+    private String performedAmount;
+
+    /**
+     * 起始日期
+     */
+    @ExcelProperty(value = "起始日期")
+    @JsonFormat(locale="zh", pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date startTime;
+
+    /**
+     * 终止日期
+     */
+    @ExcelProperty(value = "终止日期")
+    @JsonFormat(locale="zh", pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date endTime;
+
+    /**
+     * 发起人
+     */
+    @ExcelProperty(value = "发起人")
+    private String initiateName;
+
+    /**
+     * 发起单位
+     */
+    @ExcelProperty(value = "发起单位")
+    private String initiateEntName;
+
+    /**
+     * 发起时间
+     */
+    @ExcelProperty(value = "发起时间")
+    @JsonFormat(locale="zh", pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date initiateTime;
+
+    /**
+     * 签约时间
+     */
+    @ExcelProperty(value = "签约时间")
+    @JsonFormat(locale="zh", pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date signTime;
+
+    /**
+     * 创建时间
+     */
+    @ExcelProperty(value = "创建时间")
+    @JsonFormat(locale="zh", pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+    /**
+     * 备注
+     */
+    @ExcelProperty(value = "备注")
+    private String remark;
+
+}

+ 133 - 0
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/report/TradeListExport.java

@@ -0,0 +1,133 @@
+package com.sckw.contract.model.report;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.sckw.excel.annotation.ExcelContext;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @desc: 物流合同列表导出对象
+ * @author: czh
+ * @date: 2023-07-06 9:15
+ */
+@Data
+@Accessors(chain = true)
+@ExcelContext(fileName = "物流合同列表信息", sheetName = "物流合同列表信息")
+public class TradeListExport implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = -7804227640473193219L;
+
+    /**
+     * 合同状态中文名
+     */
+    @ExcelProperty(value = "合同状态")
+    private String statusName;
+
+    /**
+     * 采购单位
+     */
+    @ExcelProperty(value = "采购单位")
+    private String purchaseEntName;
+
+    /**
+     * 供应单位
+     */
+    @ExcelProperty(value = "供应单位")
+    private String provideEntName;
+
+    /**
+     * 合同编号
+     */
+    @ExcelProperty(value = "合同编号")
+    private String contractNo;
+
+    /**
+     * 合同名称
+     */
+    @ExcelProperty(value = "合同名称")
+    private String contractName;
+
+    /**
+     * 签约方式中文名
+     */
+    @ExcelProperty(value = "签约方式")
+    private String signingWayName;
+
+    /**
+     * 支付方式中文名
+     */
+    @ExcelProperty(value = "支付方式")
+    private String tradingName;
+
+    /**
+     * 合同总量
+     */
+    @ExcelProperty(value = "合同总量")
+    private String amount;
+
+    /**
+     * 已履约量
+     */
+    @ExcelProperty(value = "已履约量")
+    private String performedAmount;
+
+    /**
+     * 起始日期
+     */
+    @ExcelProperty(value = "起始日期")
+    @JsonFormat(locale="zh", pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date startTime;
+
+    /**
+     * 终止日期
+     */
+    @ExcelProperty(value = "终止日期")
+    @JsonFormat(locale="zh", pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date endTime;
+
+    /**
+     * 发起人
+     */
+    @ExcelProperty(value = "发起人")
+    private String initiateName;
+
+    /**
+     * 发起单位
+     */
+    @ExcelProperty(value = "发起单位")
+    private String initiateEntName;
+
+    /**
+     * 发起时间
+     */
+    @ExcelProperty(value = "发起时间")
+    @JsonFormat(locale="zh", pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date initiateTime;
+
+    /**
+     * 签约时间
+     */
+    @ExcelProperty(value = "签约时间")
+    @JsonFormat(locale="zh", pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date signTime;
+
+    /**
+     * 创建时间
+     */
+    @ExcelProperty(value = "创建时间")
+    @JsonFormat(locale="zh", pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+    /**
+     * 备注
+     */
+    @ExcelProperty(value = "备注")
+    private String remark;
+
+}

+ 6 - 0
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/vo/req/QueryListReqVo.java

@@ -8,6 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat;
 import java.io.Serial;
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 
 /**
  * @author czh
@@ -25,6 +26,11 @@ public class QueryListReqVo extends PageRequest implements Serializable {
      */
     private String ids;
 
+    /**
+     * ID集合
+     */
+    private List<Long> idList;
+
     /**
      * 单位名称、联系人、联系电话
      */

+ 102 - 5
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractLogisticsService.java

@@ -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);
     }
 
 }

+ 99 - 0
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractTradeService.java

@@ -9,6 +9,7 @@ import com.github.pagehelper.PageInfo;
 import com.sckw.contract.model.dto.req.QueryListReqDto;
 import com.sckw.contract.model.dto.res.QueryListResDto;
 import com.sckw.contract.model.entity.*;
+import com.sckw.contract.model.report.TradeListExport;
 import com.sckw.contract.model.vo.req.*;
 
 import com.sckw.contract.model.vo.res.*;
@@ -24,6 +25,7 @@ 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.order.api.dubbo.TradeOrderInfoService;
 import com.sckw.order.api.model.ContractSignCompletedParam;
 import com.sckw.product.api.dubbo.GoodsInfoService;
@@ -31,6 +33,7 @@ import com.sckw.product.api.model.KwpGoods;
 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;
@@ -717,4 +720,100 @@ public class KwcContractTradeService {
         }
     }
 
+    /**
+     * @param reqVo 分页查询
+     * @return PageResult
+     * @desc: 运营端查贸易合同
+     * @author: czh
+     * @date: 2023/9/13
+     */
+    public PageResult queryTradeByPage(QueryListReqVo reqVo) {
+        PageHelper.startPage(reqVo.getPage(), reqVo.getPageSize());
+        List<QueryListResDto> queryListResDtos = kwcContractTradeMapper.queryTradeList(reqVo);
+        if (CollectionUtils.isEmpty(queryListResDtos)) {
+            return PageHelperUtil.getPageResult(new PageInfo<>());
+        }
+
+        List<QueryListResVo> list = getTradeListResVo(queryListResDtos);
+        return PageHelperUtil.getPageResult(new PageInfo<>(list), queryListResDtos, reqVo.getPageSize());
+    }
+
+    private List<QueryListResVo> getTradeListResVo(List<QueryListResDto> queryListResDtos) {
+        Map<Long, UserCacheResDto> longUserCacheResDtoMap = new HashMap<>(8);
+        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.setTradingName(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), String.valueOf(queryListResDto.getTrading())));
+            queryListResVo.setStatusName(Objects.requireNonNull(ContractStatusEnum.getName(queryListResDto.getStatus())).getName());
+            queryListResVo.setSigningWayName(DictEnum.getLabel(DictTypeEnum.SIGNING_TYPE.getType(), queryListResDto.getSigningWay()));
+            queryListResVo.setSigningWay(queryListResDto.getSigningWay());
+            queryListResVo.setAmount(queryListResDto.getAmount());
+            queryListResVo.setPerformedAmount(queryListResDto.getPerformedAmount());
+            list.add(queryListResVo);
+        }
+        return list;
+    }
+
+    /**
+     * @return HttpResult
+     * @desc: 分组查询
+     * @author: czh
+     * @date: 2023/7/18
+     */
+    public List<FindListGroupResVo> findTradeListGroup(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 = kwcContractTradeMapper.queryTradeList(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 exportTradeList(QueryListReqVo reqVo, HttpServletResponse response) {
+        List<QueryListResDto> queryListResDtos = kwcContractTradeMapper.queryTradeList(reqVo);
+        if (CollectionUtils.isEmpty(queryListResDtos)) {
+            throw new SystemException("导出数据为空");
+        }
+        List<QueryListResVo> list = getTradeListResVo(queryListResDtos);
+        List<TradeListExport> dataList = BeanUtils.copyToList(list, TradeListExport.class);
+        ExcelUtil.downData(response, TradeListExport.class, dataList);
+    }
+
 }

+ 59 - 37
sckw-modules/sckw-contract/src/main/resources/mapper/KwcContractLogisticsMapper.xml

@@ -4,42 +4,6 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.contract.dao.KwcContractLogisticsMapper">
 
-    <resultMap id="BaseResultMap" type="com.sckw.contract.model.entity.KwcContractLogistics">
-            <id property="id" column="id" jdbcType="BIGINT"/>
-            <result property="ent_id" column="ent_id" jdbcType="BIGINT"/>
-            <result property="contract_no" column="contract_no" jdbcType="VARCHAR"/>
-            <result property="name" column="name" jdbcType="VARCHAR"/>
-            <result property="signing_way" column="signing_way" jdbcType="VARCHAR"/>
-            <result property="charging" column="charging" jdbcType="BIGINT"/>
-            <result property="trading" column="trading" jdbcType="BIGINT"/>
-            <result property="start_time" column="start_time" jdbcType="TIMESTAMP"/>
-            <result property="end_time" column="end_time" jdbcType="TIMESTAMP"/>
-            <result property="amount" column="amount" jdbcType="DECIMAL"/>
-            <result property="performed_amount" column="performed_amount" jdbcType="DECIMAL"/>
-            <result property="signing_url" column="signing_url" jdbcType="VARCHAR"/>
-            <result property="signed_url" column="signed_url" jdbcType="VARCHAR"/>
-            <result property="signing_no" column="signing_no" jdbcType="VARCHAR"/>
-            <result property="contract_pid" column="contract_pid" jdbcType="BIGINT"/>
-            <result property="remark" column="remark" jdbcType="VARCHAR"/>
-            <result property="status" column="status" jdbcType="INTEGER"/>
-            <result property="create_by" column="create_by" jdbcType="BIGINT"/>
-            <result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
-            <result property="update_by" column="update_by" jdbcType="BIGINT"/>
-            <result property="update_time" column="update_time" jdbcType="TIMESTAMP"/>
-            <result property="del_flag" column="del_flag" jdbcType="INTEGER"/>
-    </resultMap>
-
-    <sql id="Base_Column_List">
-        id,ent_id,contract_no,
-        name,signing_way,charging,
-        trading,start_time,end_time,
-        amount,performed_amount,signing_url,
-        signed_url,signing_no,contract_pid,
-        remark,status,create_by,
-        create_time,update_by,update_time,
-        del_flag
-    </sql>
-
     <select id="queryList" resultType="com.sckw.contract.model.dto.res.QueryListResDto">
          select a.amount,
                 a.charging,
@@ -88,7 +52,7 @@
               and a.create_time >= #{startTime}
           </if>
           <if test="endTime != null">
-              and a.create_time &lt; date_add(#{endTime}, INTERVAL 1 DAY)
+              and a.create_time &lt;= #{endTime}
           </if>
           <if test="status != null">
               and a.status = #{status}
@@ -114,4 +78,62 @@
         order by a.create_time desc
     </select>
 
+    <select id="queryLogisticsList" resultType="com.sckw.contract.model.dto.res.QueryListResDto">
+        select a.amount,
+               a.charging,
+               a.name contractName,
+               a.contract_no,
+               c.create_by initiateBy,
+               c.create_time initiateTime,
+               a.create_time,
+               a.start_time,
+               a.end_time,
+               a.id,
+               a.remark,
+               a.signing_way,
+               d.create_time signTime,
+               a.status,
+               b.unit_type,
+               b.ent_id checkedEntId,
+               b.firm_name checkedEntName,
+               e.ent_id carrierEntId,
+               e.firm_name carrierEntName,
+               a.performed_amount performedAmount,
+               a.contract_pid contractPid
+          from kwc_contract_logistics a
+          left join kwc_contract_logistics_unit b on a.id = b.contract_id and b.del_flag = 0 and b.unit_type = 3
+          left join kwc_contract_logistics_unit e on a.id = e.contract_id and e.del_flag = 0 and e.unit_type = 4
+          left join kwc_contract_logistics_track c on a.id = c.contract_id and c.del_flag = 0 and c.type = 1
+          left join kwc_contract_logistics_track d on a.id = d.contract_id and d.del_flag = 0 and d.type = 0
+         where a.del_flag = 0
+           and a.status != 3
+        <if test="startTime != null">
+            and a.create_time >= #{startTime}
+        </if>
+        <if test="endTime != null">
+            and a.create_time &lt;= #{endTime}
+        </if>
+        <if test="status != null">
+            and a.status = #{status}
+        </if>
+        <if test="signingWay != null">
+            and a.signing_way = #{signingWay}
+        </if>
+        <if test="keywords != null and keywords != ''">
+            and (b.firm_name like concat('%', #{keywords}, '%') or
+                 e.firm_name like concat('%', #{keywords}, '%') or
+                 b.contacts like concat('%', #{keywords}, '%') or
+                 e.contacts like concat('%', #{keywords}, '%') or
+                 a.contract_no like concat('%', #{keywords}, '%') or
+                 a.name like concat('%', #{keywords}, '%'))
+        </if>
+        <if test="idList != null and idList.size() > 0">
+            and a.id in
+            <foreach collection="idList" open="(" close=")" separator="," item="item">
+                #{item}
+            </foreach>
+        </if>
+        order by a.create_time desc
+    </select>
+
 </mapper>

+ 60 - 35
sckw-modules/sckw-contract/src/main/resources/mapper/KwcContractTradeMapper.xml

@@ -4,41 +4,6 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.contract.dao.KwcContractTradeMapper">
 
-    <resultMap id="BaseResultMap" type="com.sckw.contract.model.entity.KwcContractTrade">
-            <id property="id" column="id" jdbcType="BIGINT"/>
-            <result property="ent_id" column="ent_id" jdbcType="BIGINT"/>
-            <result property="contract_no" column="contract_no" jdbcType="VARCHAR"/>
-            <result property="name" column="name" jdbcType="VARCHAR"/>
-            <result property="signing_way" column="signing_way" jdbcType="BIGINT"/>
-            <result property="trading" column="trading" jdbcType="BIGINT"/>
-            <result property="start_time" column="start_time" jdbcType="TIMESTAMP"/>
-            <result property="end_time" column="end_time" jdbcType="TIMESTAMP"/>
-            <result property="amount" column="amount" jdbcType="DECIMAL"/>
-            <result property="performed_amount" column="performed_amount" jdbcType="DECIMAL"/>
-            <result property="signing_url" column="signing_url" jdbcType="VARCHAR"/>
-            <result property="signed_url" column="signed_url" jdbcType="VARCHAR"/>
-            <result property="signing_no" column="signing_no" jdbcType="VARCHAR"/>
-            <result property="contract_pid" column="contract_pid" jdbcType="BIGINT"/>
-            <result property="remark" column="remark" jdbcType="VARCHAR"/>
-            <result property="status" column="status" jdbcType="INTEGER"/>
-            <result property="create_by" column="create_by" jdbcType="BIGINT"/>
-            <result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
-            <result property="update_by" column="update_by" jdbcType="BIGINT"/>
-            <result property="update_time" column="update_time" jdbcType="TIMESTAMP"/>
-            <result property="del_flag" column="del_flag" jdbcType="INTEGER"/>
-    </resultMap>
-
-    <sql id="Base_Column_List">
-        id,ent_id,contract_no,
-        name,signing_way,trading,
-        start_time,end_time,amount,
-        performed_amount,signing_url,signed_url,
-        signing_no,contract_pid,remark,
-        status,create_by,create_time,
-        update_by,update_time,del_flag
-    </sql>
-
-
     <select id="queryList" resultType="com.sckw.contract.model.dto.res.QueryListResDto">
         select a.amount,
                a.trading,
@@ -146,4 +111,64 @@
          GROUP BY b.unit_type
     </select>
 
+    <select id="queryTradeList" resultType="com.sckw.contract.model.dto.res.QueryListResDto">
+         select a.amount,
+                a.trading,
+                a.name contractName,
+                a.contract_no,
+                c.create_by initiateBy,
+                c.create_time initiateTime,
+                a.create_time,
+                a.start_time,
+                a.end_time,
+                a.id,
+                a.remark,
+                a.signing_way,
+                d.create_time signTime,
+                a.status,
+                b.ent_id provideEntId,
+                b.firm_name provideEntName,
+                e.ent_id purchaseEntId,
+                e.firm_name purchaseEntName,
+                a.contract_pid contractPid,
+                a.performed_amount performedAmount
+        from kwc_contract_trade a
+        left join kwc_contract_trade_unit b on a.id = b.contract_id and b.del_flag = 0 and b.unit_type = 1
+        left join kwc_contract_trade_unit e on a.id = e.contract_id and e.del_flag = 0 and e.unit_type = 2
+        left join kwc_contract_trade_track c on a.id = c.contract_id and c.del_flag = 0 and c.type = 1
+        left join kwc_contract_trade_track d on a.id = d.contract_id and d.del_flag = 0 and d.type = 0
+        where a.del_flag = 0
+          and a.status != 3
+        <if test="startTime != null">
+            and a.create_time >= #{startTime}
+        </if>
+        <if test="endTime != null">
+            and a.create_time &lt;= #{endTime}
+        </if>
+        <if test="status != null">
+            and a.status = #{status}
+        </if>
+        <if test="keywords != null and keywords != ''">
+            and (b.firm_name like concat('%', #{keywords}, '%') or
+                 e.firm_name like concat('%', #{keywords}, '%') or
+                 b.contacts like concat('%', #{keywords}, '%') or
+                 e.contacts like concat('%', #{keywords}, '%') or
+                 a.contract_no like concat('%', #{keywords}, '%') or
+                 a.name like concat('%', #{keywords}, '%'))
+        </if>
+        <if test="idList != null and idList.size() > 0">
+            and a.id in
+            <foreach collection="idList" open="(" close=")" separator="," item="item">
+                #{item}
+            </foreach>
+        </if>
+        <if test="trading != null">
+            and a.trading = #{trading}
+        </if>
+        <if test="signingWay != null">
+            and a.signing_way = #{signingWay}
+        </if>
+        order by a.create_time desc
+    </select>
+
 </mapper>

+ 17 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteBaseService.java

@@ -9,7 +9,9 @@ import com.sckw.system.api.model.pojo.DeptInfoPojo;
 import com.sckw.system.dao.KwsAuthorityDao;
 import com.sckw.system.dao.KwsEntDeptDao;
 import com.sckw.system.dao.KwsEntTypeDao;
+import com.sckw.system.dao.KwsEnterpriseDao;
 import com.sckw.system.model.*;
+import com.sckw.system.model.pojo.FindManagePojo;
 import com.sckw.system.model.vo.res.CertificateResVo;
 import com.sckw.system.model.vo.res.KwsDeptResVo;
 import com.sckw.system.model.vo.res.KwsUserResVo;
@@ -53,6 +55,9 @@ public class RemoteBaseService {
     @Resource
     private KwsEntTypeDao kwsEntTypeDao;
 
+    @Resource
+    private KwsEnterpriseDao kwsEnterpriseDao;
+
 
     public KwsEnterpriseResDto queryEnterpriseById(Long id) {
         KwsEnterprise kwsEnterprise = kwsEnterpriseService.queryKwsEnterpriseById(id);
@@ -221,4 +226,16 @@ public class RemoteBaseService {
     public List<KwsUser> queryUserByDeptIds(List<Long> deptIds) {
         return kwsUserService.queryUserByDeptIds(deptIds);
     }
+
+    /**
+     * @param entId 企业id
+     * @return KwsUser
+     * @desc: 查管理员
+     * @author: czh
+     * @date: 2023/9/13
+     */
+    public KwsUser queryManageByEntId(Long entId) {
+        FindManagePojo manageInfoByEntId = kwsEnterpriseDao.findManageInfoByEntId(entId);
+        return kwsUserService.selectByKey(manageInfoByEntId.getUserId());
+    }
 }

+ 5 - 3
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java

@@ -310,9 +310,11 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
         BeanUtils.copyProperties(kwsEnterpriseResDto, entCacheResDto);
         entCacheResDto.setDeptInfo(remoteBaseService.queryDeftInfoByEntId(entId));
         entCacheResDto.setCertificateInfo(remoteBaseService.queryCertificateByEntId(entId));
-        KwsUserResDto userByAccount = remoteBaseService.getUserByAccount(kwsEnterpriseResDto.getPhone());
-        if (Objects.nonNull(userByAccount)) {
-            entCacheResDto.setContactsId(userByAccount.getId());
+        KwsUser kwsUser = remoteBaseService.queryManageByEntId(entId);
+        if (Objects.nonNull(kwsUser)) {
+            entCacheResDto.setContactsId(kwsUser.getId());
+            entCacheResDto.setContacts(kwsUser.getName());
+            entCacheResDto.setPhone(kwsUser.getPhone());
         }
         List<EntTypeResDto> entTypeResDtos = remoteBaseService.queryEntTypeById(entId);
         if (CollectionUtils.isNotEmpty(entTypeResDtos)) {