qt5107 2 tahun lalu
induk
melakukan
8bb52bbf30
14 mengubah file dengan 260 tambahan dan 91 penghapusan
  1. 18 0
      hx-service-api/victoriatourist-api/src/main/java/com/fjhx/constants/common/CommonConstant.java
  2. 18 0
      hx-service-api/victoriatourist-api/src/main/java/com/fjhx/constants/logistics/LogisticsConstant.java
  3. 14 5
      hx-service-api/victoriatourist-api/src/main/java/com/fjhx/entity/logistics/LogisticsInfo.java
  4. 35 7
      hx-service-api/victoriatourist-api/src/main/java/com/fjhx/entity/purchase/Purchase.java
  5. 1 0
      hx-service-api/victoriatourist-api/src/main/java/com/fjhx/params/logistics/LogisticsInfoVo.java
  6. 0 18
      hx-service-api/victoriatourist-api/src/main/java/com/fjhx/params/purchase/PurchaseVo.java
  7. 18 19
      hx-service/victoriatourist/src/main/java/com/fjhx/controller/purchase/PurchaseController.java
  8. 4 4
      hx-service/victoriatourist/src/main/java/com/fjhx/controller/purchase/PurchaseFlowController.java
  9. 17 1
      hx-service/victoriatourist/src/main/java/com/fjhx/service/logistics/LogisticsInfoService.java
  10. 57 2
      hx-service/victoriatourist/src/main/java/com/fjhx/service/logistics/impl/LogisticsInfoServiceImpl.java
  11. 3 4
      hx-service/victoriatourist/src/main/java/com/fjhx/service/purchase/PurchaseFlowService.java
  12. 13 7
      hx-service/victoriatourist/src/main/java/com/fjhx/service/purchase/PurchaseService.java
  13. 5 5
      hx-service/victoriatourist/src/main/java/com/fjhx/service/purchase/impl/PurchaseFlowServiceImpl.java
  14. 57 19
      hx-service/victoriatourist/src/main/java/com/fjhx/service/purchase/impl/PurchaseServiceImpl.java

+ 18 - 0
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/constants/common/CommonConstant.java

@@ -0,0 +1,18 @@
+package com.fjhx.constants.common;
+
+/**
+ * 公共常量
+ */
+public interface CommonConstant {
+
+    /**
+     * 是否
+     */
+    class YesOrNo {
+        //否
+        public static final Integer NO = 0;
+        //是
+        public static final Integer YES = 1;
+    }
+
+}

+ 18 - 0
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/constants/logistics/LogisticsConstant.java

@@ -0,0 +1,18 @@
+package com.fjhx.constants.logistics;
+
+/**
+ * 物流常量
+ */
+public interface LogisticsConstant {
+
+    /**
+     * 状态
+     */
+    class LogisticsStatus {
+        //未完成
+        public static final Integer status_0 = 0;
+        //已完成
+        public static final Integer status_1 = 1;
+    }
+
+}

+ 14 - 5
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/entity/logistics/LogisticsInfo.java

@@ -1,15 +1,15 @@
 package com.fjhx.entity.logistics;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.Version;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.fjhx.base.BaseEntity;
-import com.baomidou.mybatisplus.annotation.TableField;
+import com.fjhx.entity.FileInfo;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.util.List;
+
 /**
  * <p>
  * 物流信息
@@ -22,7 +22,6 @@ import lombok.EqualsAndHashCode;
 @EqualsAndHashCode(callSuper = true)
 public class LogisticsInfo extends BaseEntity {
 
-
     /**
      * 采购单id
      */
@@ -45,5 +44,15 @@ public class LogisticsInfo extends BaseEntity {
     @TableLogic
     private Integer delFlag;
 
+    /**
+     * 物流明细
+     */
+    @TableField(exist = false)
+    private List<LogisticsDetails> details;
 
+    /**
+     * 附件集合
+     */
+    @TableField(exist = false)
+    private List<FileInfo> fileInfos;
 }

+ 35 - 7
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/entity/purchase/Purchase.java

@@ -1,16 +1,16 @@
 package com.fjhx.entity.purchase;
 
-import java.math.BigDecimal;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.Version;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.fjhx.base.BaseEntity;
-import com.baomidou.mybatisplus.annotation.TableField;
+import com.fjhx.entity.apply.ApplyPurchase;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.math.BigDecimal;
+import java.util.List;
+
 /**
  * <p>
  * 采购
@@ -39,12 +39,12 @@ public class Purchase extends BaseEntity {
     private BigDecimal price;
 
     /**
-     * 状态:10、审批中;20、待发货;30、已发货;40、已完成
+     * 状态:10、审批中;20、驳回;30、待发货;40、已发货;50、已完成
      */
     private Integer status;
 
     /**
-     * 流程ID
+     * 流程实例ID
      */
     private Long flowId;
 
@@ -65,5 +65,33 @@ public class Purchase extends BaseEntity {
     @TableLogic
     private Integer delFlag;
 
+    /**
+     * 采购人名称
+     */
+    @TableField(exist = false)
+    private String createName;
+
+    /**
+     * 物流单号
+     */
+    @TableField(exist = false)
+    private String logisticsCode;
+
+    /**
+     * 按钮ID
+     */
+    @TableField(exist = false)
+    private Long buttonId;
 
+    /**
+     * 办理说明
+     */
+    @TableField(exist = false)
+    private String flowRemark;
+
+    /**
+     * 物品集合
+     */
+    @TableField(exist = false)
+    private List<ApplyPurchase> goodsList;
 }

+ 1 - 0
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/params/logistics/LogisticsInfoVo.java

@@ -14,4 +14,5 @@ import lombok.EqualsAndHashCode;
 @EqualsAndHashCode(callSuper = true)
 public class LogisticsInfoVo extends LogisticsInfo {
 
+
 }

+ 0 - 18
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/params/purchase/PurchaseVo.java

@@ -17,22 +17,4 @@ import java.util.List;
 @Data
 @EqualsAndHashCode(callSuper = true)
 public class PurchaseVo extends Purchase {
-
-    /**
-     * 按钮ID
-     */
-    @TableField(exist = false)
-    private Long buttonId;
-
-    /**
-     * 办理说明
-     */
-    @TableField(exist = false)
-    private String flowRemark;
-
-    /**
-     * 物品集合
-     */
-    @TableField(exist = false)
-    private List<ApplyPurchase> goodsList;
 }

+ 18 - 19
hx-service/victoriatourist/src/main/java/com/fjhx/controller/purchase/PurchaseController.java

@@ -3,7 +3,6 @@ package com.fjhx.controller.purchase;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.entity.apply.ApplyPurchase;
 import com.fjhx.entity.purchase.Purchase;
-import com.fjhx.params.purchase.PurchaseVo;
 import com.fjhx.service.purchase.PurchaseService;
 import org.springblade.core.tool.api.R;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -29,30 +28,18 @@ public class PurchaseController {
     @Autowired
     private PurchaseService purchaseService;
 
+    /**
+     * 待发货列表
+     *
+     * @param condition 查询条件
+     * @return
+     */
     @PostMapping("/page")
     public R page(@RequestBody Map<String, Object> condition) {
         Page<Purchase> result = purchaseService.getPage(condition);
         return R.success(result);
     }
 
-    @PostMapping("/add")
-    public R add(@RequestBody PurchaseVo purchaseVo) {
-        purchaseService.add(purchaseVo);
-        return R.success();
-    }
-
-    @PostMapping("/edit")
-    public R edit(@RequestBody PurchaseVo purchaseVo) {
-        purchaseService.edit(purchaseVo);
-        return R.success();
-    }
-
-    @PostMapping("/delete")
-    public R delete(@RequestBody PurchaseVo purchaseVo) {
-        purchaseService.delete(purchaseVo);
-        return R.success();
-    }
-
     /**
      * 待采购列表
      *
@@ -64,5 +51,17 @@ public class PurchaseController {
         Page<ApplyPurchase> result = purchaseService.stayPurchasePage(condition);
         return R.success(result);
     }
+
+    /**
+     * 完成
+     *
+     * @param entity
+     * @return
+     */
+    @PostMapping("/complete")
+    public R complete(@RequestBody Purchase entity) {
+        purchaseService.complete(entity.getId());
+        return R.success();
+    }
 }
 

+ 4 - 4
hx-service/victoriatourist/src/main/java/com/fjhx/controller/purchase/PurchaseFlowController.java

@@ -1,6 +1,6 @@
 package com.fjhx.controller.purchase;
 
-import com.fjhx.params.purchase.PurchaseVo;
+import com.fjhx.entity.purchase.Purchase;
 import com.fjhx.service.purchase.PurchaseFlowService;
 import org.springblade.core.tool.api.R;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -31,7 +31,7 @@ public class PurchaseFlowController {
      * @return
      */
     @PostMapping(value = "/start")
-    public R start(@RequestBody PurchaseVo entity) {
+    public R start(@RequestBody Purchase entity) {
         purchaseFlowService.start(entity);
         return R.success();
     }
@@ -43,7 +43,7 @@ public class PurchaseFlowController {
      * @return
      */
     @PostMapping(value = "/examine")
-    public R examine(@RequestBody PurchaseVo entity) {
+    public R examine(@RequestBody Purchase entity) {
         purchaseFlowService.examine(entity);
         return R.success();
     }
@@ -55,7 +55,7 @@ public class PurchaseFlowController {
      * @return
      */
     @PostMapping(value = "/details")
-    public R details(@RequestBody PurchaseVo entity) {
+    public R details(@RequestBody Purchase entity) {
         purchaseFlowService.details(entity);
         return R.success();
     }

+ 17 - 1
hx-service/victoriatourist/src/main/java/com/fjhx/service/logistics/LogisticsInfoService.java

@@ -1,10 +1,11 @@
 package com.fjhx.service.logistics;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.base.BaseService;
 import com.fjhx.entity.logistics.LogisticsInfo;
 import com.fjhx.params.logistics.LogisticsInfoVo;
-import com.fjhx.base.BaseService;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -25,4 +26,19 @@ public interface LogisticsInfoService extends BaseService<LogisticsInfo> {
 
     void delete(LogisticsInfoVo logisticsInfoVo);
 
+    /**
+     * 根据采购ID查询
+     *
+     * @param purchaseIds 采购ID集合
+     * @return
+     */
+    List<LogisticsInfo> getByPurchaseIds(List<Long> purchaseIds);
+
+    /**
+     * 根据采购ID查询
+     *
+     * @param purchaseIds 采购ID集合
+     * @return
+     */
+    Map<Long, List<LogisticsInfo>> getByPurchaseIdsToMap(List<Long> purchaseIds);
 }

+ 57 - 2
hx-service/victoriatourist/src/main/java/com/fjhx/service/logistics/impl/LogisticsInfoServiceImpl.java

@@ -1,15 +1,26 @@
 package com.fjhx.service.logistics.impl;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.constants.logistics.LogisticsConstant;
 import com.fjhx.entity.logistics.LogisticsInfo;
-import com.fjhx.params.logistics.LogisticsInfoVo;
 import com.fjhx.mapper.logistics.LogisticsInfoMapper;
+import com.fjhx.params.logistics.LogisticsInfoVo;
+import com.fjhx.service.logistics.LogisticsDetailsService;
 import com.fjhx.service.logistics.LogisticsInfoService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.utils.FileClientUtil;
 import com.fjhx.utils.wrapperUtil.IWrapper;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -22,6 +33,9 @@ import java.util.Map;
 @Service
 public class LogisticsInfoServiceImpl extends ServiceImpl<LogisticsInfoMapper, LogisticsInfo> implements LogisticsInfoService {
 
+    @Autowired
+    private LogisticsDetailsService logisticsDetailsService;
+
     @Override
     public Page<LogisticsInfo> getPage(Map<String, Object> condition) {
 
@@ -30,9 +44,22 @@ public class LogisticsInfoServiceImpl extends ServiceImpl<LogisticsInfoMapper, L
         return page(condition, wrapper);
     }
 
+    @Transactional(rollbackFor = {Exception.class})
     @Override
     public void add(LogisticsInfoVo logisticsInfoVo) {
+        logisticsInfoVo.setStatus(LogisticsConstant.LogisticsStatus.status_0);
         save(logisticsInfoVo);
+
+        logisticsInfoVo.getDetails().forEach(o -> {
+            o.setLogisticsInfoId(logisticsInfoVo.getId());
+            o.setLogisticsInfoCode(logisticsInfoVo.getCode());
+            o.setReceiptQuantity(new BigDecimal(BigDecimal.ZERO.intValue()));
+        });
+
+        //保存附件
+        FileClientUtil.bindingFile(logisticsInfoVo.getId(), logisticsInfoVo.getFileInfos());
+
+        logisticsDetailsService.saveBatch(logisticsInfoVo.getDetails());
     }
 
     @Override
@@ -45,4 +72,32 @@ public class LogisticsInfoServiceImpl extends ServiceImpl<LogisticsInfoMapper, L
         removeById(logisticsInfoVo.getId());
     }
 
+    /**
+     * 根据采购ID查询
+     *
+     * @param purchaseIds 采购ID集合
+     * @return
+     */
+    @Override
+    public List<LogisticsInfo> getByPurchaseIds(List<Long> purchaseIds) {
+        if (Func.isEmpty(purchaseIds)) {
+            return new ArrayList<>();
+        }
+        return lambdaQuery().in(LogisticsInfo::getPurchaseId, purchaseIds).list();
+    }
+
+    /**
+     * 根据采购ID查询
+     *
+     * @param purchaseIds 采购ID集合
+     * @return
+     */
+    @Override
+    public Map<Long, List<LogisticsInfo>> getByPurchaseIdsToMap(List<Long> purchaseIds) {
+        List<LogisticsInfo> list = getByPurchaseIds(purchaseIds);
+        if (Func.isEmpty(list)) {
+            return new HashMap<>();
+        }
+        return list.stream().collect(Collectors.groupingBy(LogisticsInfo::getPurchaseId));
+    }
 }

+ 3 - 4
hx-service/victoriatourist/src/main/java/com/fjhx/service/purchase/PurchaseFlowService.java

@@ -1,7 +1,6 @@
 package com.fjhx.service.purchase;
 
 import com.fjhx.entity.purchase.Purchase;
-import com.fjhx.params.purchase.PurchaseVo;
 
 /**
  * <p>
@@ -19,7 +18,7 @@ public interface PurchaseFlowService {
      * @param entity
      * @return
      */
-    void start(PurchaseVo entity);
+    void start(Purchase entity);
 
     /**
      * 审批
@@ -27,7 +26,7 @@ public interface PurchaseFlowService {
      * @param entity
      * @return
      */
-    void examine(PurchaseVo entity);
+    void examine(Purchase entity);
 
     /**
      * 详情
@@ -35,5 +34,5 @@ public interface PurchaseFlowService {
      * @param entity
      * @return
      */
-    Purchase details(PurchaseVo entity);
+    Purchase details(Purchase entity);
 }

+ 13 - 7
hx-service/victoriatourist/src/main/java/com/fjhx/service/purchase/PurchaseService.java

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.base.BaseService;
 import com.fjhx.entity.apply.ApplyPurchase;
 import com.fjhx.entity.purchase.Purchase;
-import com.fjhx.params.purchase.PurchaseVo;
 
 import java.util.Map;
 
@@ -18,14 +17,14 @@ import java.util.Map;
  */
 public interface PurchaseService extends BaseService<Purchase> {
 
+    /**
+     * 待发货列表
+     *
+     * @param condition 查询条件
+     * @return
+     */
     Page<Purchase> getPage(Map<String, Object> condition);
 
-    void add(PurchaseVo purchaseVo);
-
-    void edit(PurchaseVo purchaseVo);
-
-    void delete(PurchaseVo purchaseVo);
-
     /**
      * 待采购列表
      *
@@ -41,4 +40,11 @@ public interface PurchaseService extends BaseService<Purchase> {
      * @return
      */
     Purchase getFlowDetailsById(Long id);
+
+    /**
+     * 完成采购
+     *
+     * @param id 采购ID
+     */
+    void complete(Long id);
 }

+ 5 - 5
hx-service/victoriatourist/src/main/java/com/fjhx/service/purchase/impl/PurchaseFlowServiceImpl.java

@@ -2,6 +2,7 @@ package com.fjhx.service.purchase.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.fjhx.constants.common.CommonConstant;
 import com.fjhx.entity.apply.ApplyPurchase;
 import com.fjhx.entity.purchase.Purchase;
 import com.fjhx.enums.apply.ApplyPurchaseStatusEnum;
@@ -9,7 +10,6 @@ import com.fjhx.enums.flow.FlowCodeEnum;
 import com.fjhx.enums.purchase.PurchaseStatusEnum;
 import com.fjhx.feign.IFlowClient;
 import com.fjhx.params.ExampleResult;
-import com.fjhx.params.purchase.PurchaseVo;
 import com.fjhx.service.apply.ApplyPurchaseService;
 import com.fjhx.service.purchase.PurchaseFlowService;
 import com.fjhx.service.purchase.PurchaseService;
@@ -103,7 +103,7 @@ public class PurchaseFlowServiceImpl implements PurchaseFlowService {
                     public boolean deleteLogic() {
                         Long id = getCacheData(Long.class);
                         //修改采购状态
-                        purchaseService.lambdaUpdate().set(Purchase::getStatus, PurchaseStatusEnum.STATUS_20.getKey()).set(Purchase::getDelFlag, 1).eq(Purchase::getId, id).update();
+                        purchaseService.lambdaUpdate().set(Purchase::getStatus, PurchaseStatusEnum.STATUS_20.getKey()).set(Purchase::getDelFlag, CommonConstant.YesOrNo.YES).eq(Purchase::getId, id).update();
                         //修改申购状态
                         applyPurchaseService.lambdaUpdate()
                                 .set(ApplyPurchase::getStatus, ApplyPurchaseStatusEnum.STATUS_10.getKey())
@@ -126,7 +126,7 @@ public class PurchaseFlowServiceImpl implements PurchaseFlowService {
      */
     @Transactional(rollbackFor = {Exception.class})
     @Override
-    public void start(PurchaseVo entity) {
+    public void start(Purchase entity) {
         if (!redisLockClient.lockFair(REDIS_LOCK_CACHE_KEY, () -> {
             if (Func.isEmpty(entity.getId())) {
                 entity.setId(IdWorker.getId());
@@ -192,7 +192,7 @@ public class PurchaseFlowServiceImpl implements PurchaseFlowService {
      * @return
      */
     @Override
-    public void examine(PurchaseVo entity) {
+    public void examine(Purchase entity) {
         Purchase purchase = purchaseService.getById(entity.getId());
         if (Func.isEmpty(purchase)) {
             throw new ServiceException("操作异常,业务数据不存在!");
@@ -225,7 +225,7 @@ public class PurchaseFlowServiceImpl implements PurchaseFlowService {
      * @return
      */
     @Override
-    public Purchase details(PurchaseVo entity) {
+    public Purchase details(Purchase entity) {
         return purchaseService.getFlowDetailsById(entity.getId());
     }
 }

+ 57 - 19
hx-service/victoriatourist/src/main/java/com/fjhx/service/purchase/impl/PurchaseServiceImpl.java

@@ -3,20 +3,25 @@ package com.fjhx.service.purchase.impl;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.entity.apply.ApplyPurchase;
+import com.fjhx.entity.logistics.LogisticsInfo;
 import com.fjhx.entity.purchase.Purchase;
+import com.fjhx.enums.apply.ApplyPurchaseStatusEnum;
+import com.fjhx.enums.purchase.PurchaseStatusEnum;
 import com.fjhx.mapper.purchase.PurchaseMapper;
-import com.fjhx.params.purchase.PurchaseVo;
 import com.fjhx.service.apply.ApplyPurchaseService;
+import com.fjhx.service.logistics.LogisticsInfoService;
 import com.fjhx.service.purchase.PurchaseService;
+import com.fjhx.utils.UserClientUtil;
 import com.fjhx.utils.wrapperUtil.IWrapper;
 import org.springblade.core.log.exception.ServiceException;
-import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -32,27 +37,48 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> i
     @Autowired
     private ApplyPurchaseService applyPurchaseService;
 
+    @Autowired
+    private LogisticsInfoService logisticsInfoService;
+
+    /**
+     * 待发货列表
+     *
+     * @param condition 查询条件
+     * @return
+     */
     @Override
     public Page<Purchase> getPage(Map<String, Object> condition) {
 
         IWrapper<Purchase> wrapper = IWrapper.getWrapper(condition);
 
-        return page(condition, wrapper);
-    }
+        wrapper.ge(Purchase::getStatus, PurchaseStatusEnum.STATUS_30.getKey())
+                .eq(Purchase::getStatus)
+                .apply("instr(`code`, '" + condition.get("keyword") + "') > 0")
+                .orderByDesc(ApplyPurchase::getId);
 
-    @Override
-    public void add(PurchaseVo purchaseVo) {
-        save(purchaseVo);
-    }
+        Page<Purchase> page = page(condition, wrapper);
+        if (Func.isNotEmpty(page.getRecords())) {
+            //采购ID集合
+            List<Long> purchaseIds = page.getRecords().stream().map(Purchase::getId).distinct().collect(Collectors.toList());
+            //查询物流信息
+            Map<Long, List<LogisticsInfo>> logisticsInfoMap = logisticsInfoService.getByPurchaseIdsToMap(purchaseIds);
 
-    @Override
-    public void edit(PurchaseVo purchaseVo) {
-        updateById(purchaseVo);
-    }
+            //采购人名称map
+            Map<Long, String> userNameMap = UserClientUtil.getUserNameMap(page.getRecords(), Purchase::getCreateUser);
 
-    @Override
-    public void delete(PurchaseVo purchaseVo) {
-        removeById(purchaseVo.getId());
+            for (Purchase record : page.getRecords()) {
+                if (Func.isNotEmpty(logisticsInfoMap) && Func.isNotEmpty(logisticsInfoMap.get(record.getId()))) {
+                    List<LogisticsInfo> infos = logisticsInfoMap.get(record.getId());
+                    record.setLogisticsCode(infos.stream().map(LogisticsInfo::getCode).distinct().collect(Collectors.joining(",")));
+                }
+
+                if (Func.isNotEmpty(userNameMap) && Func.isNotEmpty(userNameMap.get(record.getCreateUser()))) {
+                    record.setCreateName(userNameMap.get(record.getCreateUser()));
+                }
+            }
+        }
+
+        return page;
     }
 
     /**
@@ -81,9 +107,21 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> i
 
         //获取物品详情
         List<ApplyPurchase> applyPurchases = applyPurchaseService.getByPurchaseId(id);
-        PurchaseVo vo = new PurchaseVo();
-        BeanUtil.copy(purchase, vo);
-        vo.setGoodsList(applyPurchases);
-        return vo;
+        purchase.setGoodsList(applyPurchases);
+        return purchase;
+    }
+
+    /**
+     * 完成采购
+     *
+     * @param id 采购ID
+     */
+    @Transactional(rollbackFor = {Exception.class})
+    @Override
+    public void complete(Long id) {
+        //修改采购状态
+        lambdaUpdate().set(Purchase::getStatus, PurchaseStatusEnum.STATUS_50.getKey()).eq(Purchase::getId, id).update();
+        //修改申购状态
+        applyPurchaseService.lambdaUpdate().set(ApplyPurchase::getStatus, ApplyPurchaseStatusEnum.STATUS_50.getKey()).eq(ApplyPurchase::getPurchaseId, id).update();
     }
 }