Jelajahi Sumber

1、首页接口调整;

zk 2 tahun lalu
induk
melakukan
23e8a9fb80

+ 1 - 1
pom.xml

@@ -367,7 +367,7 @@
             <id>prod</id>
             <properties>
                 <profiles.active>prod</profiles.active>
-                <nacos.server>172.16.156.151:8848</nacos.server>
+                <nacos.server>172.17.0.4:8848</nacos.server>
                 <nacos.namespace>sckw-service-platform</nacos.namespace>
             </properties>
         </profile>

+ 2 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/dao/KwpWantBuyTradingMapper.java

@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @desc: 求购支付方式mapper
@@ -17,4 +18,5 @@ public interface KwpWantBuyTradingMapper extends BaseMapper<KwoWantBuyTrading> {
 
     void insertBatch(@Param(value = "list") List<KwoWantBuyTrading> list);
 
+    List<KwoWantBuyTrading> findWantBuyTrading(KwoWantBuyTrading params);
 }

+ 39 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwpWantBuyService.java

@@ -114,6 +114,15 @@ public class KwpWantBuyService {
         if (CollectionUtils.isEmpty(wantBuyDto)) {
             return new PageRes<>();
         }
+        //数据处理
+        for (WantBuySelectRes wantBuySelectRes:wantBuyDto) {
+            KwoWantBuyTrading findDto = new KwoWantBuyTrading();
+            findDto.setWantBuyId(wantBuySelectRes.getId());
+            List<KwoWantBuyTrading> tradings = kwpWantBuyTradingMapper.findWantBuyTrading(findDto);
+            List<WantBuyTradingRes> wantBuyTradings = BeanUtils.copyToList(tradings, WantBuyTradingRes.class);
+            wantBuySelectRes.setWantBuyTradings(wantBuyTradings);
+        }
+
         List<WantBuyHallRes> res = BeanUtils.copyToList(wantBuyDto, WantBuyHallRes.class);
 
         // 获取供应企业信息
@@ -198,6 +207,15 @@ public class KwpWantBuyService {
         if (CollectionUtils.isEmpty(wantBuyDto)) {
             return new PageRes<>();
         }
+        //数据处理
+        for (WantBuySelectRes wantBuySelectRes:wantBuyDto) {
+            KwoWantBuyTrading findDto = new KwoWantBuyTrading();
+            findDto.setWantBuyId(wantBuySelectRes.getId());
+            List<KwoWantBuyTrading> tradings = kwpWantBuyTradingMapper.findWantBuyTrading(findDto);
+            List<WantBuyTradingRes> wantBuyTradings = BeanUtils.copyToList(tradings, WantBuyTradingRes.class);
+            wantBuySelectRes.setWantBuyTradings(wantBuyTradings);
+        }
+
         // 获取供应企业信息
         List<Long> supplyEntIds = wantBuyDto.stream()
                 .map(WantBuySelectRes::getEntId)
@@ -563,6 +581,17 @@ public class KwpWantBuyService {
 
 //        List<WantBuySelectRes> result = kwpWantBuyMapper.pageSelect(params);
         List<WantBuySelectRes> result = kwpWantBuyMapper.pageSelectAllByManager(params,authEntIdList);
+        if (CollectionUtils.isNotEmpty(result)) {
+            //数据处理
+            for (WantBuySelectRes wantBuySelectRes : result) {
+                KwoWantBuyTrading findDto = new KwoWantBuyTrading();
+                findDto.setWantBuyId(wantBuySelectRes.getId());
+                List<KwoWantBuyTrading> tradings = kwpWantBuyTradingMapper.findWantBuyTrading(findDto);
+                List<WantBuyTradingRes> wantBuyTradings = BeanUtils.copyToList(tradings, WantBuyTradingRes.class);
+                wantBuySelectRes.setWantBuyTradings(wantBuyTradings);
+            }
+        }
+
         Map<Integer, List<WantBuySelectRes>> map = result.stream().collect(Collectors.groupingBy(WantBuySelectRes::getStatus));
         List<TableTop> tableTops = new ArrayList<>();
         TableTop all = new TableTop();
@@ -650,6 +679,16 @@ public class KwpWantBuyService {
         if (CollectionUtils.isEmpty(wantBuyDto)) {
             return Collections.emptyList();
         }
+
+        //数据处理
+        for (WantBuySelectRes wantBuySelectRes : wantBuyDto) {
+            KwoWantBuyTrading findDto = new KwoWantBuyTrading();
+            findDto.setWantBuyId(wantBuySelectRes.getId());
+            List<KwoWantBuyTrading> tradings = kwpWantBuyTradingMapper.findWantBuyTrading(findDto);
+            List<WantBuyTradingRes> wantBuyTradings = BeanUtils.copyToList(tradings, WantBuyTradingRes.class);
+            wantBuySelectRes.setWantBuyTradings(wantBuyTradings);
+        }
+
         // 获取供应企业信息
         Map<Long, EntCacheResDto> entMap = remoteSystemService.queryEntCacheMapByIds(
                 wantBuyDto.stream().map(WantBuySelectRes::getEntId).collect(Collectors.toList()));

+ 6 - 13
sckw-modules/sckw-order/src/main/resources/mapper/KwoWantBuyMapper.xml

@@ -36,10 +36,6 @@
         <result column="remark" property="remark"/>
         <result column="createTime" property="createTime"/>
         <result column="updateTime" property="updateTime"/>
-        <collection property="wantBuyTradings" column="id" ofType="com.sckw.order.model.vo.res.WantBuyTradingRes"  javaType="java.util.List" select="tradingSql">
-            <id column="wantBuyId" property="wantBuyId"/>
-            <result column="trading" property="trading"/>
-        </collection>
     </resultMap>
 
     <sql id="managerWhere">
@@ -194,23 +190,21 @@
     <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_address kba on kb.id = kba.want_buy_id and kba.del_flag = 0
-            left join kwo_want_buy_trading kt on kb.id = kt.want_buy_id and kt.del_flag = 0
+        from kwo_want_buy kb
+        left join kwo_want_buy_address kba on kb.id = kba.want_buy_id and kba.del_flag = 0
         <where>
             <include refid="where" />
         </where>
-        group by kb.id
         order by kb.create_time desc
 
     </select><select id="pageSelectAllByManager" 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_address kba on kb.id = kba.want_buy_id and kba.del_flag = 0
-            left join kwo_want_buy_trading kt on kb.id = kt.want_buy_id and kt.del_flag = 0
+        from kwo_want_buy kb
+        left join kwo_want_buy_address kba on kb.id = kba.want_buy_id and kba.del_flag = 0
         <where>
             <include refid="managerWhere" />
         </where>
-        group by kb.id
         order by kb.create_time desc
     </select>
 
@@ -239,12 +233,11 @@
     <select id="queryBuyHallList"  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_address kba on kb.id = kba.want_buy_id and kba.del_flag = 0
-        left join kwo_want_buy_trading kt on kb.id = kt.want_buy_id and kt.del_flag = 0
+        from kwo_want_buy kb
+        left join kwo_want_buy_address kba on kb.id = kba.want_buy_id and kba.del_flag = 0
         <where>
             <include refid="where" />
         </where>
-        group by kb.id
         order by RAND()
     </select>
 </mapper>

+ 9 - 0
sckw-modules/sckw-order/src/main/resources/mapper/KwoWantBuyTradingMapper.xml

@@ -33,4 +33,13 @@
         </foreach>
     </insert>
 
+    <select id="findWantBuyTrading" resultType="com.sckw.order.model.KwoWantBuyTrading" parameterType="com.sckw.order.model.KwoWantBuyTrading" >
+        SELECT
+        id, want_buy_id wantBuyId, trading, remark, status
+        from kwo_want_buy_trading
+        where del_flag = 0
+        <if test="wantBuyId != null and wantBuyId != ''">
+            and want_buy_id = #{wantBuyId, jdbcType=VARCHAR}
+        </if>
+    </select>
 </mapper>