Parcourir la source

合同部分合并

xucaiqin il y a 1 mois
Parent
commit
29ef2dd347

+ 12 - 8
sckw-modules-api/sckw-contract-api/src/main/java/com/sckw/contract/api/RemoteContractService.java

@@ -5,6 +5,7 @@ import com.sckw.contract.api.model.vo.TradeContractGoodsDto;
 import com.sckw.contract.api.model.vo.TradeContractResDto;
 
 import java.math.BigDecimal;
+import java.time.LocalDateTime;
 import java.util.List;
 import java.util.Map;
 
@@ -39,44 +40,47 @@ public interface RemoteContractService {
      * @author: czh
      * @date: 2023/9/8
      */
-    Map<Integer, Integer> queryContractValidCount(Long entId,List<Long> enterpriseIds);
+    Map<Integer, Integer> queryContractValidCount(Long entId, List<Long> enterpriseIds);
 
 
     /**
-     *
      * @param contractNo
-     * @param acceptId 承运企业id
-     * @param consignId 托运企业id
+     * @param acceptId   承运企业id
+     * @param consignId  托运企业id
      * @return
      */
     ContractLogisticsOrderResDto getContractByContractNo(String contractNo, Long acceptId, Long consignId);
 
     /**
      * 根据贸易合同id查询物流合同信息
+     *
      * @param tradeOrderContractId 贸易合同id
      * @return 贸易合同和物流合同信息
      */
-    ContractLogisticsAndTradeOrderResDto queryContractByContractId(Long tradeOrderContractId,Long tradeId);
+    ContractLogisticsAndTradeOrderResDto queryContractByContractId(Long tradeOrderContractId, Long tradeId);
 
     /**
      * 查询贸易合同
+     *
      * @param tradeContractId
      * @return
      */
-    TradeContractResDto queryTradeContract(Long tradeContractId,Long goodsId);
+    TradeContractResDto queryTradeContract(Long tradeContractId, Long goodsId);
 
     /**
      * 查询最新的签约合同
-     * @param entId 买方企业
+     *
+     * @param entId   买方企业
      * @param goodsId
      * @return
      */
-    TradeContractGoodsDto queryTradeContractNew(Long entId, Long goodsId);
+    TradeContractGoodsDto queryTradeContractNew(Long entId, Long goodsId, LocalDateTime time);
 
     /**
      * 查询物流合同信息
      */
     List<ContractLogisticsOrderResDto> queryContractLogisticsOrder(LogisticsOrderDto logisticsOrderDto);
+
     /**
      * 查询贸易合同信息
      */

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

@@ -10,6 +10,7 @@ import com.sckw.contract.model.vo.req.QueryListReqVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.time.LocalDateTime;
 import java.util.List;
 
 /**
@@ -58,7 +59,7 @@ public interface KwcContractTradeMapper extends BaseMapper<KwcContractTrade> {
      * @param goodsId
      * @return
      */
-    TradeContractGoodsDto queryNewSignPrice(@Param("entId") Long entId, @Param("goodsId") Long goodsId);
+    TradeContractGoodsDto queryNewSignPrice(@Param("entId") Long entId, @Param("goodsId") Long goodsId, @Param("time")LocalDateTime time);
 }
 
 

+ 4 - 10
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/dubbo/RemoteContractServiceImpl.java

@@ -15,7 +15,6 @@ import com.sckw.contract.model.entity.*;
 import com.sckw.contract.repository.*;
 import com.sckw.contract.service.KwcContractLogisticsUnitService;
 import com.sckw.contract.service.operateService.KwcContractTradeService;
-import com.sckw.core.exception.BusinessException;
 import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.enums.ContractStatusEnum;
 import com.sckw.core.model.enums.CooperateTypeEnum;
@@ -29,12 +28,11 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.apache.dubbo.config.annotation.DubboService;
-import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.math.BigDecimal;
+import java.time.LocalDateTime;
 import java.util.*;
-import java.util.function.Function;
 import java.util.stream.Collectors;
 
 /**
@@ -277,8 +275,8 @@ public class RemoteContractServiceImpl implements RemoteContractService {
     }
 
     @Override
-    public TradeContractGoodsDto queryTradeContractNew(Long entId, Long goodsId) {
-        return kwcContractTradeMapper.queryNewSignPrice(entId,goodsId);
+    public TradeContractGoodsDto queryTradeContractNew(Long entId, Long goodsId, LocalDateTime time) {
+        return kwcContractTradeMapper.queryNewSignPrice(entId, goodsId, time);
     }
 
     @Override
@@ -289,17 +287,13 @@ public class RemoteContractServiceImpl implements RemoteContractService {
     }
 
 
-
     @Override
     public List<ContractTradeOrderInfo> queryContractTradeOrder(ContractTradeOrderDto contractTradeOrderDto) {
         log.info("查询贸易合同订单,请求:{}", JSON.toJSONString(contractTradeOrderDto));
-       return kwcContractTradeService.queryContractTradeOrder(contractTradeOrderDto);
+        return kwcContractTradeService.queryContractTradeOrder(contractTradeOrderDto);
     }
 
 
-
-
-
     private ContractCommonInfoResDto fillContractLogistics(KwcContractLogistics kwcContractLogistics) {
         ContractCommonInfoResDto contractCommonInfoResDto = new ContractCommonInfoResDto();
         List<EntInfo> entList = new ArrayList<>();

+ 6 - 2
sckw-modules/sckw-contract/src/main/resources/mapper/KwcContractTradeMapper.xml

@@ -285,13 +285,17 @@
     </select>
 
     <select id="queryNewSignPrice" resultType="com.sckw.contract.api.model.vo.TradeContractGoodsDto">
-        select  a.id, b.price
+        select a.id, b.price
         from kwc_contract_trade a
                  left join kwc_contract_trade_goods b on a.id = b.contract_id and b.del_flag = 0
+                 left join kwc_contract_trade_unit c on a.id = c.contract_id and c.del_flag = 0
         <where>
             a.del_flag = 0
               and a.status = 0
-              and a.ent_id = #{entId}
+              and c.unit_type = 2
+            and a.start_time &lt; #{time}
+            and a.end_time &gt; #{time}
+              and c.ent_id = #{entId}
               and b.goods_id = #{goodsId}
             order by a.create_time desc
             limit 1