Răsfoiți Sursa

1.运需广场列表不返回联系信息,新增查看联系方式信息接口
2.求购列表不返回联系信息,新增查看联系方式信息接口

yzc 2 ani în urmă
părinte
comite
262a29262b

+ 11 - 1
sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwoTransportDemandController.java

@@ -176,5 +176,15 @@ public class KwoTransportDemandController {
         return HttpResult.ok(kwoTransportDemandService.demandSquaresList(param));
     }
 
-
+    /**
+     * @desc: 查看联系方式
+     * @author: yzc
+     * @date: 2023-09-12 9:05
+     * @Param id:
+     * @return: com.sckw.core.web.response.HttpResult
+     */
+    @GetMapping("/getContactInfo")
+    public HttpResult getContactInfo(@RequestParam Long id) {
+        return HttpResult.ok(kwoTransportDemandService.getContactInfo(id));
+    }
 }

+ 12 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwpWantBuyController.java

@@ -48,6 +48,18 @@ public class KwpWantBuyController {
         return HttpResult.ok(kwpWantBuyService.buyHallList(wantBuySelectParam));
     }
 
+    /**
+     * @desc: 查看联系方式
+     * @author: yzc
+     * @date: 2023-09-12 9:05
+     * @Param id:
+     * @return: com.sckw.core.web.response.HttpResult
+     */
+    @GetMapping("/getContactInfo")
+    public HttpResult getContactInfo(@RequestParam Long id) {
+        return HttpResult.ok(kwpWantBuyService.getContactInfo(id));
+    }
+
     /**
      * @desc: 新增求购草稿
      * @author: yzc

+ 36 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/res/TransportDemandContactInfoRes.java

@@ -0,0 +1,36 @@
+package com.sckw.order.model.vo.res;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @desc: 运需联系方式信息
+ * @author: yzc
+ * @date: 2023-09-12 9:02
+ */
+@Getter
+@Setter
+@ToString
+@Accessors(chain = true)
+public class TransportDemandContactInfoRes implements Serializable {
+    @Serial
+    private static final long serialVersionUID = -3167424826112844192L;
+
+    private Long id;
+
+    /**
+     * 联系人姓名
+     */
+    private String contacts;
+
+    /**
+     * 联系电话
+     */
+    private String phone;
+
+}

+ 0 - 11
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/res/TransportDemandSquaresListRes.java

@@ -85,17 +85,6 @@ public class TransportDemandSquaresListRes implements Serializable {
      */
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private LocalDate deadline;
-
-    /**
-     * 联系人姓名
-     */
-    private String contacts;
-
-    /**
-     * 联系电话
-     */
-    private String phone;
-
     /**
      * 创建时间
      */

+ 36 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/res/WantBuyContactInfoRes.java

@@ -0,0 +1,36 @@
+package com.sckw.order.model.vo.res;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @desc: 求购联系方式信息
+ * @author: yzc
+ * @date: 2023-09-12 9:02
+ */
+@Getter
+@Setter
+@ToString
+@Accessors(chain = true)
+public class WantBuyContactInfoRes implements Serializable {
+    @Serial
+    private static final long serialVersionUID = -3167424826112844192L;
+
+    private Long id;
+
+    /**
+     * 联系人姓名
+     */
+    private String contacts;
+
+    /**
+     * 联系电话
+     */
+    private String phone;
+
+}

+ 101 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/res/WantBuyHallRes.java

@@ -0,0 +1,101 @@
+package com.sckw.order.model.vo.res;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author: lt
+ * @Date: 2023-07-26-15:48
+ */
+@Getter
+@Setter
+@ToString
+public class WantBuyHallRes implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 8658159273205687254L;
+
+    private Long id;
+
+    /**
+     * 商品名称
+     */
+    private String name;
+
+    private Long entId;
+
+
+    private String entName;
+
+    /**
+     * 商品分类
+     */
+    private String goodsType;
+
+    /**
+     * 商品分类label
+     */
+    private String goodsTypeLabel;
+
+    /**
+     * 规格
+     */
+    private String spec;
+
+    /**
+     * 地址信息
+     */
+    private String addressName;
+    private String cityName;
+    private String detailAddress;
+
+    /**
+     * 支付方式
+     */
+    private String tradings;
+
+    /**
+     * 求购单价
+     */
+    private String price;
+
+    /**
+     * 求购总量
+     */
+    private String amount;
+
+    /**
+     * 常见时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
+    private Date createTime;
+    /**
+     * 更新时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
+    private Date updateTime;
+
+    /**
+     * 状态
+     */
+    private Integer status;
+    private String statusLabel;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    //private List<KwoWantBuyTrading> wantBuyTradings;
+    private List<WantBuyTradingRes> wantBuyTradings;
+
+
+}

+ 9 - 1
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/res/WantBuySelectRes.java

@@ -3,7 +3,10 @@ package com.sckw.order.model.vo.res;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Getter;
 import lombok.Setter;
+import lombok.ToString;
 
+import java.io.Serial;
+import java.io.Serializable;
 import java.util.Date;
 import java.util.List;
 
@@ -14,7 +17,12 @@ import java.util.List;
  */
 @Getter
 @Setter
-public class WantBuySelectRes {
+@ToString
+public class WantBuySelectRes implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 5987208615378442044L;
+
 
     private Long id;
 

+ 26 - 5
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTransportDemandService.java

@@ -23,6 +23,7 @@ import com.sckw.order.dao.KwoTransportDemandMapper;
 import com.sckw.order.model.KwoTransportDemand;
 import com.sckw.order.model.dto.TransportDemandExport;
 import com.sckw.order.model.vo.req.*;
+import com.sckw.order.model.vo.res.TransportDemandContactInfoRes;
 import com.sckw.order.model.vo.res.TransportDemandDetailRes;
 import com.sckw.order.model.vo.res.TransportDemandListRes;
 import com.sckw.order.model.vo.res.TransportDemandSquaresListRes;
@@ -88,7 +89,7 @@ public class KwoTransportDemandService {
      * @return: com.sckw.order.model.vo.res.TransportDemandDetailRes
      */
     public TransportDemandDetailRes detail(Long id) {
-        KwoTransportDemand transportDemand = getById(id);
+        KwoTransportDemand transportDemand = getById(id, Boolean.FALSE);
         if (Objects.isNull(transportDemand)) {
             throw new BusinessException("数据不存在!");
         }
@@ -106,10 +107,13 @@ public class KwoTransportDemandService {
      * @Param id:
      * @return: com.sckw.order.model.KwoTransportDemand
      */
-    private KwoTransportDemand getById(Long id) {
+    private KwoTransportDemand getById(Long id, Boolean needPermissions) {
         LambdaQueryWrapper<KwoTransportDemand> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(KwoTransportDemand::getId, id).eq(KwoTransportDemand::getEntId,LoginUserHolder.getEntId())
-                .eq(KwoTransportDemand::getDelFlag, Global.NO).last("LIMIT 1");
+        wrapper.eq(KwoTransportDemand::getId, id);
+        if (needPermissions) {
+            wrapper.eq(KwoTransportDemand::getEntId, LoginUserHolder.getEntId());
+        }
+        wrapper.eq(KwoTransportDemand::getDelFlag, Global.NO).last("LIMIT 1");
         return kwoTransportDemandMapper.selectOne(wrapper);
     }
 
@@ -121,7 +125,7 @@ public class KwoTransportDemandService {
      * @return: void
      */
     public void update(UpdateTransportDemandParam param) {
-        KwoTransportDemand demand = getById(param.getId());
+        KwoTransportDemand demand = getById(param.getId(), true);
         if (Objects.isNull(demand)) {
             throw new BusinessException("数据不存在!");
         }
@@ -435,4 +439,21 @@ public class KwoTransportDemandService {
         });
         return PageResult.build(param.getPage(), param.getPageSize(), kwpGoodsPage.getTotal(), result);
     }
+
+    /**
+     * @desc: 查看联系方式
+     * @author: yzc
+     * @date: 2023-09-12 9:06
+     * @Param id:
+     * @return: com.sckw.order.model.vo.res.TransportDemandContactInfoRes
+     */
+    public TransportDemandContactInfoRes getContactInfo(Long id) {
+        KwoTransportDemand transportDemand = getById(id, Boolean.FALSE);
+        if (Objects.isNull(transportDemand)) {
+            throw new BusinessException("数据不存在!");
+        }
+        TransportDemandContactInfoRes res = new TransportDemandContactInfoRes();
+        res.setId(id).setContacts(transportDemand.getContacts()).setPhone(transportDemand.getPhone());
+        return res;
+    }
 }

+ 34 - 14
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwpWantBuyService.java

@@ -25,9 +25,7 @@ import com.sckw.order.model.KwoWantBuyAddress;
 import com.sckw.order.model.KwoWantBuyTrading;
 import com.sckw.order.model.dto.WantBuyExport;
 import com.sckw.order.model.vo.req.*;
-import com.sckw.order.model.vo.res.WantBuyAddressDetailRes;
-import com.sckw.order.model.vo.res.WantBuyDetailRes;
-import com.sckw.order.model.vo.res.WantBuySelectRes;
+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;
@@ -63,7 +61,7 @@ public class KwpWantBuyService {
      * @author lt
      * @Date 11:50 2023/8/1 0001
      **/
-    public PageRes<WantBuySelectRes> buyHallList(WantBuySelectParam wantBuySelectParam) {
+    public PageRes<WantBuyHallRes> buyHallList(WantBuySelectParam wantBuySelectParam) {
         // 如果有求购方式的查询条件,需要先查询出求购方式的id
         if (StringUtils.isNotBlank(wantBuySelectParam.getTrading())) {
             List<String> longList = stringToLongList(wantBuySelectParam.getTrading());
@@ -102,10 +100,11 @@ public class KwpWantBuyService {
         if (CollectionUtils.isEmpty(wantBuyDto)) {
             return new PageRes<>();
         }
+        List<WantBuyHallRes> res = BeanUtils.copyToList(wantBuyDto, WantBuyHallRes.class);
 
         // 获取供应企业信息
-        List<Long> supplyEntIds = wantBuyDto.stream()
-                .map(WantBuySelectRes::getEntId)
+        List<Long> supplyEntIds = res.stream()
+                .map(WantBuyHallRes::getEntId)
                 .collect(Collectors.toList());
         // 通过企业id查询企业信息
         List<EntCacheResDto> entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
@@ -113,17 +112,17 @@ public class KwpWantBuyService {
                 .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()))
+        res.forEach(e -> {
+            List<String> tradings = e.getWantBuyTradings().stream()
+                    .map(f -> DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), f.getTrading()))
                     .collect(Collectors.toList());
-            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);
+            e.setTradings(String.join(Global.COMMA, tradings));
+            e.setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), e.getGoodsType()));
+            e.setStatusLabel(DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(e.getStatus())));
+            e.setEntName(Objects.nonNull(entMap.get(e.getEntId())) ? entMap.get(e.getEntId()) : null);
         });
 
-        return new PageRes<>(new PageInfo<>(wantBuyDto));
+        return new PageRes<>(new PageInfo<>(res));
     }
 
     /**
@@ -504,4 +503,25 @@ public class KwpWantBuyService {
         });
         return result;
     }
+
+    /**
+     * @desc: 查看联系方式
+     * @author: yzc
+     * @date: 2023-09-12 9:24
+     * @Param id:
+     * @return: com.sckw.order.model.vo.res.WantBuyContactInfoRes
+     */
+    public WantBuyContactInfoRes getContactInfo(Long id) {
+        LambdaQueryWrapper<KwoWantBuy> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(KwoWantBuy::getId, id)
+                .eq(KwoWantBuy::getDelFlag, Global.NO)
+                .last("LIMIT 1");
+        KwoWantBuy wantBuy = kwpWantBuyMapper.selectOne(wrapper);
+        if (Objects.isNull(wantBuy)){
+            throw new BusinessException("求购信息不存在");
+        }
+        WantBuyContactInfoRes res = new WantBuyContactInfoRes();
+        res.setId(id).setContacts(wantBuy.getContacts()).setPhone(wantBuy.getPhone());
+        return res;
+    }
 }