Kaynağa Gözat

push0731105408

ltt 2 yıl önce
ebeveyn
işleme
95471e6640

+ 21 - 5
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/WantBuySelectParam.java

@@ -31,10 +31,6 @@ public class WantBuySelectParam extends PageRequest {
      * 状态 来自com.sckw.core.common.enums.enums.DictEnum.GOODS_STATUS_0
      */
     private String status;
-    /**
-     * (雷总说的集合都用字符串)页面搜索筛选的时候专用
-     */
-    private List<String> statuss;
 
     /**
      * 支付集合字符串
@@ -43,11 +39,31 @@ public class WantBuySelectParam extends PageRequest {
     /**
      * 字符串转集合进行筛选
      */
-    private List<Long> tradings;
+    private List<String> tradings;
 
+    /**
+     * 地区编码
+     */
     private String areaCode;
+
+    /**
+     * 地区级别
+     */
     private String areaLevel;
 
+
+    /**
+     * 商品类型
+     */
+    private String goodsType;
+
+    /**
+     * 商品类型type值
+     */
+    private String goodsTypeValue;
+
+    private List<String> goodsTypeValueSearch;
+
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @NotNull(message = "生成开始时间不能为空")
     private LocalDateTime startCreateTime;

+ 12 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/res/WantBuySelectRes.java

@@ -24,6 +24,8 @@ public class WantBuySelectRes {
      */
     private String name;
 
+    private Long entId;
+
 
     private String entName;
 
@@ -32,11 +34,21 @@ public class WantBuySelectRes {
      */
     private String goodsType;
 
+    /**
+     * 商品分类label
+     */
+    private String goodsTypeLabel;
+
     /**
      * 规格
      */
     private String spec;
 
+    /**
+     * 地址信息
+     */
+    private String addressName;
+
     /**
      * 支付方式
      */

+ 20 - 20
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java

@@ -25,10 +25,10 @@ import com.sckw.order.model.vo.res.AddressInfoDetailRes;
 import com.sckw.order.model.vo.res.GoodsInfoDetailRes;
 import com.sckw.order.model.vo.res.OrderDetailRes;
 import com.sckw.order.model.vo.res.UnitInfoDetailRes;
-import com.sckw.payment.api.dubbo.PayCenterDubboService;
-import com.sckw.payment.api.model.constant.ChannelEnum;
-import com.sckw.payment.api.model.dto.WalletDto;
-import com.sckw.payment.api.model.dto.common.R;
+//import com.sckw.payment.api.dubbo.PayCenterDubboService;
+//import com.sckw.payment.api.model.constant.ChannelEnum;
+//import com.sckw.payment.api.model.dto.WalletDto;
+//import com.sckw.payment.api.model.dto.common.R;
 import com.sckw.product.api.dubbo.GoodsInfoService;
 import com.sckw.product.api.model.KwpGoods;
 import com.sckw.stream.model.SckwBusSum;
@@ -63,8 +63,8 @@ public class KwoTradeOrderService {
     @DubboReference(version = "2.0.0", group = "design", check = false)
     private RemoteContractService remoteContractService;
 
-    @DubboReference(version = "2.0.0", group = "design", check = false)
-    private PayCenterDubboService payCenterDubboService;
+//    @DubboReference(version = "2.0.0", group = "design", check = false)
+//    private PayCenterDubboService payCenterDubboService;
 
     private final KwoTradeOrderMapper kwoTradeOrderMapper;
     private final StreamBridge streamBridge;
@@ -287,20 +287,20 @@ public class KwoTradeOrderService {
         if (!isAcceptanceOrder && trading.startsWith("0") && price.compareTo(advancePrice) < 0) {
             throw new BusinessException("您的订单总额未达到预付限额,请确认");
         }
-        if (trading.startsWith("0")) {
-            R<List<WalletDto>> wallet = payCenterDubboService.wallet(param.getProcureTopEntId(), ChannelEnum.getByCode(trading), param.getSupplyTopEntId());
-            if (Objects.isNull(wallet) || Objects.equals(wallet.getCode(), 0)) {
-                throw new BusinessException("校验预付钱包异常,请联系管理员!");
-            }
-            List<WalletDto> data = wallet.getData();
-            if (CollectionUtils.isEmpty(data)) {
-                throw new BusinessException("检测尚未创建对应预付款清单,请先创建!");
-            }
-            long money = data.get(0).getMoney();
-            if (money < advancePrice.multiply(new BigDecimal("10000")).longValueExact()) {
-                throw new BusinessException("您的预付清单可用余额不足,请先充值!");
-            }
-        }
+//        if (trading.startsWith("0")) {
+//            R<List<WalletDto>> wallet = payCenterDubboService.wallet(param.getProcureTopEntId(), ChannelEnum.getByCode(trading), param.getSupplyTopEntId());
+//            if (Objects.isNull(wallet) || Objects.equals(wallet.getCode(), 0)) {
+//                throw new BusinessException("校验预付钱包异常,请联系管理员!");
+//            }
+//            List<WalletDto> data = wallet.getData();
+//            if (CollectionUtils.isEmpty(data)) {
+//                throw new BusinessException("检测尚未创建对应预付款清单,请先创建!");
+//            }
+//            long money = data.get(0).getMoney();
+//            if (money < advancePrice.multiply(new BigDecimal("10000")).longValueExact()) {
+//                throw new BusinessException("您的预付清单可用余额不足,请先充值!");
+//            }
+//        }
     }
 
     /**

+ 76 - 22
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwpWantBuyService.java

@@ -23,8 +23,12 @@ import com.sckw.order.model.vo.req.UpdateWantBuyParam;
 import com.sckw.order.model.vo.req.WantBuyDels;
 import com.sckw.order.model.vo.req.WantBuySelectParam;
 import com.sckw.order.model.vo.res.*;
+import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.model.dto.res.EntCacheResDto;
+import com.sckw.system.api.model.dto.res.SysDictResDto;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -41,6 +45,9 @@ import java.util.stream.Collectors;
 @RequiredArgsConstructor
 public class KwpWantBuyService {
 
+    @DubboReference(version = "2.0.0", group = "design", check = false)
+    private RemoteSystemService remoteSystemService;
+
     private final KwpWantBuyMapper kwpWantBuyMapper;
 
     private final KwpWantBuyTradingMapper kwpWantBuyTradingMapper;
@@ -49,65 +56,108 @@ public class KwpWantBuyService {
     private final KwoWantBuyTradingService kwoWantBuyTradingService;
 
     public PageRes<WantBuySelectRes> buyHallList(WantBuySelectParam wantBuySelectParam){
-        //如果有求购方式的查询条件,需要先查询出求购方式的id
+        // 如果有求购方式的查询条件,需要先查询出求购方式的id
         if (StringUtils.isNotBlank(wantBuySelectParam.getTrading())) {
-            List<Long> longList = stringToLongList(wantBuySelectParam.getTrading());
+            List<String> longList = stringToLongList(wantBuySelectParam.getTrading());
             wantBuySelectParam.setTradings(longList);
         }
+        // 商品分类筛选处理
+        if (StringUtils.isNotBlank(wantBuySelectParam.getGoodsType()) && StringUtils.isNotBlank(wantBuySelectParam.getGoodsTypeValue())) {
+            List<String> goodsTypes = goodsTypeHandle(wantBuySelectParam);
+            wantBuySelectParam.setGoodsTypeValueSearch(goodsTypes);
+        }
+
+        // 分页查询求购列表
         PageHelper.startPage(wantBuySelectParam.getPage(), wantBuySelectParam.getPageSize());
         List<WantBuySelectRes> wantBuyDto = kwpWantBuyMapper.queryBuyHallList(wantBuySelectParam);
+
         if (CollectionUtils.isEmpty(wantBuyDto)) {
             return new PageRes<>();
         }
+
+        // 获取供应企业信息
+        List<Long> supplyEntIds = wantBuyDto.stream()
+                .map(WantBuySelectRes::getEntId)
+                .collect(Collectors.toList());
+        // 通过企业id查询企业信息
+        List<EntCacheResDto> entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
+        Map<Long, String> entMap = entList.stream()
+                .collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
+
+        // 对求购列表进行数据处理
         wantBuyDto.forEach(wantBuySelectRes -> {
             List<String> tradings = wantBuySelectRes.getWantBuyTradings().stream()
                     .map(wantBuyTradingRes -> DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), wantBuyTradingRes.getTrading()))
                     .collect(Collectors.toList());
-            String tradingsString = String.join(Global.COMMA, tradings);
-            wantBuySelectRes.setTradings(tradingsString);
-
-            String statusLabel = DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(wantBuySelectRes.getStatus()));
-            wantBuySelectRes.setStatusLabel(statusLabel);
+            wantBuySelectRes.setTradings(String.join(Global.COMMA, tradings));
+            wantBuySelectRes.setGoodsType(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), wantBuySelectRes.getGoodsType()));
+            wantBuySelectRes.setStatusLabel(DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(wantBuySelectRes.getStatus())));
+            wantBuySelectRes.setEntName(Objects.nonNull(entMap.get(wantBuySelectRes.getEntId())) ? entMap.get(wantBuySelectRes.getEntId()) : null);
         });
+
         return new PageRes<>(new PageInfo<>(wantBuyDto));
     }
 
     public PageRes<WantBuySelectRes> select(WantBuySelectParam wantBuySelectParam) {
+
         if (StringUtils.isNotBlank(wantBuySelectParam.getTrading())) {
-            List<Long> longList = stringToLongList(wantBuySelectParam.getTrading());
+            List<String> longList = stringToLongList(wantBuySelectParam.getTrading());
             wantBuySelectParam.setTradings(longList);
         }
         if (StringUtils.isNotBlank(wantBuySelectParam.getStatus())) {
-            List<String> stringList = Arrays.asList(wantBuySelectParam.getStatus().split(","));
-            wantBuySelectParam.setStatuss(stringList);
+            wantBuySelectParam.setStatus(wantBuySelectParam.getStatus());
+        }
+
+        //商品分类筛选处理
+        if (StringUtils.isNotBlank(wantBuySelectParam.getGoodsType()) && StringUtils.isNotBlank(wantBuySelectParam.getGoodsTypeValue())) {
+            List<String> goodsTypes = goodsTypeHandle(wantBuySelectParam);
+            wantBuySelectParam.setGoodsTypeValueSearch(goodsTypes);
         }
         PageHelper.startPage(wantBuySelectParam.getPage(), wantBuySelectParam.getPageSize());
         List<WantBuySelectRes> wantBuyDto = kwpWantBuyMapper.pageSelect(wantBuySelectParam);
+        System.out.println(wantBuyDto);
         if (CollectionUtils.isEmpty(wantBuyDto)) {
             return new PageRes<>();
         }
+        // 获取供应企业信息
+        List<Long> supplyEntIds = wantBuyDto.stream()
+                .map(WantBuySelectRes::getEntId)
+                .collect(Collectors.toList());
+        // 通过企业id查询企业信息
+        List<EntCacheResDto> entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
+        Map<Long, String> entMap = entList.stream()
+                .collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
         //把查询出来的集合wantBuyTradings里面对的tranding 转成字符串放在String里面
         wantBuyDto.forEach(wantBuySelectRes -> {
             List<String> tradings = wantBuySelectRes.getWantBuyTradings().stream()
                     .map(wantBuyTradingRes -> DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), wantBuyTradingRes.getTrading()))
                     .collect(Collectors.toList());
-            String tradingsString = String.join(Global.COMMA, tradings);
-            wantBuySelectRes.setTradings(tradingsString);
-
-            String statusLabel = DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(wantBuySelectRes.getStatus()));
-            wantBuySelectRes.setStatusLabel(statusLabel);
+            wantBuySelectRes.setTradings(String.join(Global.COMMA, tradings));
+            wantBuySelectRes.setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), wantBuySelectRes.getGoodsType()));
+            wantBuySelectRes.setStatusLabel(DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(wantBuySelectRes.getStatus())));
+            wantBuySelectRes.setEntName(Objects.nonNull(entMap.get(wantBuySelectRes.getEntId())) ? entMap.get(wantBuySelectRes.getEntId()) : null);
         });
 
         return new PageRes<>(new PageInfo<>(wantBuyDto));
     }
 
-    private List<Long> stringToLongList(String str) {
+    private List<String> goodsTypeHandle(WantBuySelectParam wantBuySelectParam)
+    {
+        List<SysDictResDto> goodsTypeList = remoteSystemService.queryDictBottom(wantBuySelectParam.getGoodsType(), wantBuySelectParam.getGoodsTypeValue());
+        if (CollectionUtils.isNotEmpty(goodsTypeList)) {
+            return  goodsTypeList.stream().map(SysDictResDto::getValue).toList();
+        }
+        return null;
+    }
+
+    private List<String> stringToLongList(String str) {
         if (StringUtils.isBlank(str)) {
             return null;
         }
-        return Arrays.stream(str.split(","))
-                .map(Long::parseLong)
-                .collect(Collectors.toList());
+// 使用逗号分隔字符串,并去除两端空格
+        String[] stringArray = str.split(Global.COMMA);
+        return Arrays.asList(stringArray);
+
     }
 
 
@@ -376,12 +426,16 @@ public class KwpWantBuyService {
      */
     public Map statistic(WantBuySelectParam params) {
         if (StringUtils.isNotBlank(params.getTrading())) {
-            List<Long> longList = stringToLongList(params.getTrading());
+            List<String> longList = stringToLongList(params.getTrading());
             params.setTradings(longList);
         }
         if (StringUtils.isNotBlank(params.getStatus())) {
-            List<String> stringList = Arrays.asList(params.getStatus().split(","));
-            params.setStatuss(stringList);
+            params.setStatus(params.getStatus());
+        }
+        //商品分类筛选处理
+        if (StringUtils.isNotBlank(params.getGoodsType()) && StringUtils.isNotBlank(params.getGoodsTypeValue())) {
+            List<String> goodsTypes = goodsTypeHandle(params);
+            params.setGoodsTypeValueSearch(goodsTypes);
         }
         /**统计数据**/
         List<TableTopRes> counts = kwpWantBuyMapper.statisticsCount(params);

+ 2 - 2
sckw-modules/sckw-order/src/main/resources/bootstrap-dev.yml

@@ -5,7 +5,7 @@ spring:
         # 服务注册地址
         server-addr: 10.10.10.230:8848
         # 命名空间
-        namespace: sckw-lt
+        namespace: sckw-service-platform-dev
         # 共享配置
         group: sckw-service-platform
       config:
@@ -14,7 +14,7 @@ spring:
         # 配置文件格式
         file-extension: yaml
         # 命名空间
-        namespace: sckw-lt
+        namespace: sckw-service-platform-dev
         # 共享配置
         group: sckw-service-platform
         #可以读多个配置文件  需要在同一个命名空间下面可以是不同的组

+ 1 - 1
sckw-modules/sckw-order/src/main/resources/bootstrap.yml

@@ -5,7 +5,7 @@ spring:
   application:
     name: sckw-order
   profiles:
-    active: @profiles.active@
+    active: dev
   main:
     allow-bean-definition-overriding: true
     allow-circular-references: true

+ 39 - 59
sckw-modules/sckw-order/src/main/resources/mapper/KwoWantBuyMapper.xml

@@ -5,7 +5,7 @@
     <sql id="Base_Column_List">
         kb.id
         ,kb.`name`
-        , kb.ent_name entName
+        ,kb.ent_id
         , kb.goods_type goodsType
         , kb.spec
         , kb.price
@@ -15,12 +15,12 @@
         , kb.create_time createTime
         , kt.want_buy_id wantBuyId
         , kt.trading trading
+        , kba.name addressName
     </sql>
 
     <resultMap id="wangBuyResultMap" type="com.sckw.order.model.vo.res.WantBuySelectRes">
         <id column="id" property="id"/>
         <result column="name" property="name"/>
-        <result column="entName" property="entName"/>
         <result column="goodsType" property="goodsType"/>
         <result column="spec" property="spec"/>
         <result column="price" property="price"/>
@@ -35,33 +35,44 @@
         </collection>
     </resultMap>
 
+    <sql id="where">
+        kb.del_flag = 0 and kt.del_flag = 0
+        <if test="wantBuyReq.startCreateTime != null and wantBuyReq.endCreateTime != null">
+            and kb.create_time between #{wantBuyReq.startCreateTime,jdbcType=TIMESTAMP} and
+            #{wantBuyReq.endCreateTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="wantBuyReq.tradings != null and wantBuyReq.tradings.size() > 0">
+            and kt.trading in
+            <foreach collection="wantBuyReq.tradings" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=VARCHAR}
+            </foreach>
+        </if>
+        <if test="wantBuyReq.status != null and wantBuyReq.status != ''">
+            and kb.status = #{wantBuyReq.status}
+        </if>
+        <if test="wantBuyReq.keywords != null and wantBuyReq.keywords != ''">
+            and (
+            kb.`name` like concat('%', #{wantBuyReq.keywords,jdbcType=VARCHAR}, '%')
+            )
+        </if>
+        <if test="wantBuyReq.goodsTypeValueSearch != null and wantBuyReq.goodsTypeValueSearch.size() > 0">
+            and kb.goods_type in
+            <foreach collection="wantBuyReq.goodsTypeValueSearch" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="wantBuyReq.areaCode != null and wantBuyReq.areaCode != ''">
+            and kba.city_code = #{wantBuyReq.areaCode}
+        </if>
+    </sql>
+
     <select id="pageSelect" resultMap="wangBuyResultMap" resultType="com.sckw.order.model.vo.res.WantBuySelectRes">
         select
         <include refid="Base_Column_List" />
         from kwo_want_buy kb left join kwo_want_buy_trading kt on kb.id = kt.want_buy_id
+        join kwo_want_buy_address kba on kb.id = kba.want_buy_id
         <where>
-            kb.del_flag = 0 and kt.del_flag = 0
-            <if test="wantBuyReq.startCreateTime != null and wantBuyReq.endCreateTime != null">
-                and kb.create_time between #{wantBuyReq.startCreateTime,jdbcType=TIMESTAMP} and
-                #{wantBuyReq.endCreateTime,jdbcType=TIMESTAMP}
-            </if>
-            <if test="wantBuyReq.tradings != null and wantBuyReq.tradings.size() > 0">
-                and kt.trading in
-                <foreach collection="wantBuyReq.tradings" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="wantBuyReq.statuss != null and wantBuyReq.statuss.size() > 0">
-                and kb.status in
-                <foreach collection="wantBuyReq.statuss" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="wantBuyReq.keywords != null and wantBuyReq.keywords != ''">
-                and (
-                kb.`name` like concat('%', #{wantBuyReq.keywords,jdbcType=VARCHAR}, '%')
-                )
-            </if>
+            <include refid="where" />
         </where>
         group by kb.id
         order by kb.create_time desc
@@ -86,26 +97,9 @@
         select kb.`status` value
         from kwo_want_buy kb left join kwo_want_buy_trading kt on kb.id = kt.want_buy_id
         <where>
-            kb.del_flag = 0 and kt.del_flag = 0
-            <if test="wantBuyReq.statuss != null">
-                and kb.status = #{wantBuyReq.statuss}
-            </if>
-            <if test="wantBuyReq.startCreateTime != null and wantBuyReq.endCreateTime != null">
-                and kb.create_time between #{wantBuyReq.startCreateTime,jdbcType=TIMESTAMP} and
-                #{wantBuyReq.endCreateTime,jdbcType=TIMESTAMP}
-            </if>
-            <if test="wantBuyReq.tradings != null and wantBuyReq.tradings.size() > 0">
-                and kt.trading in
-                <foreach collection="wantBuyReq.tradings" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="wantBuyReq.keywords != null and wantBuyReq.keywords != ''">
-                and (
-                kb.`name` like concat('%', #{wantBuyReq.keywords,jdbcType=VARCHAR}, '%')
-                )
-            </if>
+            <include refid="where" />
         </where>
+        group by kb.id
         order by kb.create_time desc
     </select>
 
@@ -114,23 +108,9 @@
         select
             <include refid="Base_Column_List" />
         from kwo_want_buy kb left join kwo_want_buy_trading kt on kb.id = kt.want_buy_id
+        join kwo_want_buy_address kba on kb.id = kba.want_buy_id
         <where>
-            kb.del_flag = 0 and kt.del_flag = 0
-            <if test="wantBuyReq.startCreateTime != null and wantBuyReq.endCreateTime != null">
-                and kb.create_time between #{wantBuyReq.startCreateTime,jdbcType=TIMESTAMP} and
-                #{wantBuyReq.endCreateTime,jdbcType=TIMESTAMP}
-            </if>
-            <if test="wantBuyReq.tradings != null and wantBuyReq.tradings.size() > 0">
-                and kt.trading in
-                <foreach collection="wantBuyReq.tradings" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="wantBuyReq.keywords != null and wantBuyReq.keywords != ''">
-                and (
-                kb.`name` like concat('%', #{wantBuyReq.keywords,jdbcType=VARCHAR}, '%')
-                )
-            </if>
+            <include refid="where" />
         </where>
         group by kb.id
         order by kb.create_time desc

+ 1 - 1
sckw-modules/sckw-system/src/main/resources/bootstrap.yml

@@ -5,7 +5,7 @@ spring:
   application:
     name: sckw-system
   profiles:
-    active: @profiles.active@
+    active: dev
   main:
     allow-bean-definition-overriding: true
     allow-circular-references: true