Przeglądaj źródła

Merge remote-tracking branch 'origin/dev' into dev

Mechrevo 2 lat temu
rodzic
commit
873e7dc857

+ 7 - 30
sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/GoodsTransitAppController.java

@@ -13,10 +13,7 @@ import com.pj.utils.sg.AjaxJson;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -33,8 +30,6 @@ public class GoodsTransitAppController {
     @Autowired
     private TbGoodsTransitService tbGoodsTransitService;
 
-    @Autowired
-    TbOrderService tbOrderService;
 
     /**
      * 查 - 根据id
@@ -88,33 +83,15 @@ public class GoodsTransitAppController {
     }
 
     /**
-     * 改    enterprise_confirm:'商铺确认情况[0=待确认,1=已确认,2=拒绝]',
+     * 改    商铺确认情况[0=待确认,1=已确认,2=拒绝]
      */
-    @RequestMapping("updateEnterpriseConfirm")
-//	@SaCheckPermission(TbGoodsTransit.PERMISSION_CODE_EDIT)
+    @PostMapping("updateEnterpriseConfirm")
     public AjaxJson updateEnterpriseConfirm(Long id, Integer enterpriseConfirm) {
-        TbGoodsTransit t = new TbGoodsTransit();
-        t.setId(id);
-        t.setEnterpriseConfirm(enterpriseConfirm);
-        // 商户拒绝接单后把订单状态恢复为未被下单
-        if (2 == enterpriseConfirm) {
-            t.setIsOrders(0);
-        }
-        tbGoodsTransitService.update(t);
-
-        // 商户确认接单后修改订单表的‘商家确认状态’为已确认
-        if (1 == enterpriseConfirm) {
-            LambdaUpdateWrapper<TbOrder> wrapper = new LambdaUpdateWrapper();
-            //一级市场商户确认(0=待确认,1=是,2=否)
-            wrapper.set(TbOrder::getEnterpriseConfirm, 1);
-            // TODO: 申报[0=待申报,1=申报通过,2=申报不通过]
-            //wrapper.set(TbOrder::getApply, 1);
+        TbGoodsTransit tbGoodsTransit = new TbGoodsTransit();
+        tbGoodsTransit.setId(id);
+        tbGoodsTransit.setEnterpriseConfirm(enterpriseConfirm);
 
-            wrapper.eq(TbOrder::getGoodsId, id);
-            tbOrderService.update(wrapper);
-        }
-
-        return AjaxJson.getSuccess();
+        return AjaxJson.toAjax(tbGoodsTransitService.updateEnterpriseConfirm(tbGoodsTransit));
     }
 
     /**

+ 27 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/TbGoodsTransitService.java

@@ -9,6 +9,7 @@ import java.util.List;
 
 import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.pj.common.core.exception.ServiceException;
 import com.pj.current.dto.APPLoginUserInfo;
 import com.pj.current.satoken.StpAPPUserUtil;
@@ -24,6 +25,7 @@ import com.pj.tb_goods_transit.param.PurchaseLevelOneGoodsTransitParam;
 import com.pj.tb_goods_transit.param.TransactionGoodsParam;
 import com.pj.tb_order.TbOrder;
 import com.pj.tb_order.TbOrderMapper;
+import com.pj.tb_order.TbOrderService;
 import com.pj.tb_people.TbPeople;
 import com.pj.tb_people.TbPeopleMapper;
 import com.pj.tb_trade_area.TbTradeArea;
@@ -77,6 +79,9 @@ public class TbGoodsTransitService extends ServiceImpl<TbGoodsTransitMapper, TbG
 	@Autowired
 	private TbGoodsCartMapper tbGoodsCartMapper;
 
+	@Autowired
+	TbOrderService orderService;
+
 	/** 增 */
 	void add(TbGoodsTransit t){
 		//获取当前登录人
@@ -302,6 +307,28 @@ public class TbGoodsTransitService extends ServiceImpl<TbGoodsTransitMapper, TbG
 		throw new RuntimeException("订单预创建异常!");
 	}
 
+	boolean updateEnterpriseConfirm(TbGoodsTransit tbGoodsTransit) {
+
+		// 商户拒绝接单后把订单状态恢复为默认值
+		if (2 == tbGoodsTransit.getEnterpriseConfirm()) {
+			tbGoodsTransit.setIsOrders(0);//是否已被下单[0=未被下单,1=已被下单]
+			tbGoodsTransit.setGoodsStatus(1);//商品状态(0=下架,1=在售)
+		}
+		updateById(tbGoodsTransit);
+
+		// 商户确认接单后修改订单表的‘商家确认状态’为已确认
+		if (1 == tbGoodsTransit.getEnterpriseConfirm()) {
+			LambdaUpdateWrapper<TbOrder> wrapper = new LambdaUpdateWrapper();
+			//一级市场商户确认(0=待确认,1=是,2=否)
+			wrapper.set(TbOrder::getEnterpriseConfirm, 1);
+			// TODO: 申报[0=待申报,1=申报通过,2=申报不通过]
+			//wrapper.set(TbOrder::getApply, 1);
+
+			wrapper.eq(TbOrder::getGoodsId, tbGoodsTransit.getId());
+			orderService.update(wrapper);
+		}
+		return true;
+	}
 
 	/**
 	 * 导入

+ 114 - 81
sp-service/level-two-server/src/main/java/com/pj/tb_goods_demand/AppTbGoodsDemandController.java

@@ -1,10 +1,12 @@
 package com.pj.tb_goods_demand;
 
+import com.pj.enummj.DeleteStatus;
 import com.pj.project4sp.SP;
 import com.pj.tb_goods_demand.vo.GoodsDemandVo;
 import com.pj.utils.sg.AjaxJson;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
@@ -14,93 +16,124 @@ import java.util.List;
 
 /**
  * Controller: tb_goods_demand -- 二级收购商需求发布表
+ *
  * @author yzs
  */
 @RestController
 @RequestMapping("/app/TbGoodsDemand/")
 public class AppTbGoodsDemandController {
 
-	/** 底层 Service 对象 */
-	@Autowired
-	TbGoodsDemandService tbGoodsDemandService;
-
-	/** 增 */
-	@RequestMapping("add")
-	public AjaxJson add(TbGoodsDemand t){
-		tbGoodsDemandService.add(t);
-		return AjaxJson.getSuccess();
-	}
-
-	/** 删 */
-	@RequestMapping("delete")
-	public AjaxJson delete(Long id){
-		 tbGoodsDemandService.delete(id);
-		return AjaxJson.getSuccess();
-	}
-
-	/** 删 - 根据id列表 */
-	@RequestMapping("deleteByIds")
-	public AjaxJson deleteByIds(){
-		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
-		int line = SP.publicMapper.deleteByIds(TbGoodsDemand.TABLE_NAME, ids);
-		return AjaxJson.getByLine(line);
-	}
-
-	/** 改 */
-	@RequestMapping("update")
-	public AjaxJson update(TbGoodsDemand t){
-		tbGoodsDemandService.update(t);
-		return AjaxJson.getSuccess();
-	}
-
-	/** 查 - 根据id */
-	@RequestMapping("getById")
-	public AjaxJson getById(Long id){
-		TbGoodsDemand t = tbGoodsDemandService.getById(id);
-		return AjaxJson.getSuccessData(t);
-	}
-
-	/** app端:专供给一级市场查看的需求列表*/
-	@RequestMapping("getAppList")
-	public AjaxJson getAppList() {
-		SoMap so = SoMap.getRequestSoMap();
-		List<TbGoodsDemand> list = tbGoodsDemandService.getAppList(so.startPage());
-		return AjaxJson.getPageData(so.getDataCount(), list);
-	}
-
-	/** app端:二级收购商查看需求发布列表(包括报价信息)*/
-	@RequestMapping("goodsDemandDetail")
-	public AjaxJson goodsDemandDetail(Long id) {
-		SoMap so = SoMap.getRequestSoMap();
-		so.put("id",id);
-		GoodsDemandVo goodsDemandVos = tbGoodsDemandService.goodsDemandList(so.startPage());
-		return AjaxJson.getPageData(so.getDataCount(), goodsDemandVos);
-	}
-
-	/** app端:  二级市场收购商处理已被报价的需求
-	 * @param disposeStatus 商家处理状态,只能是1或者2,其他值会抛异常 , 1=同意,2=拒绝
-	 * @param goodsDemandId  需求表主键
-	 * @param demandQuotationId  报价表主键
-	 * @param purchaserRemark 商家的备注,非必填
-	 * @return true/false
-	 */
-	@RequestMapping("disposeOrders")
-	public AjaxJson disposeOrders(@RequestParam(value = "disposeStatus")Integer disposeStatus,
-								  @RequestParam("goodsDemandId") Long goodsDemandId,
-								  @RequestParam("demandQuotationId") Long demandQuotationId,
-								  @RequestParam(value = "purchaserRemark",required = false) String purchaserRemark) {
-		boolean disposed = tbGoodsDemandService.disposeOrders(disposeStatus, goodsDemandId, demandQuotationId, purchaserRemark);
-		if(disposed)return AjaxJson.getSuccess("处理报价结果成功!");
-		return AjaxJson.getError("处理报价结果失败!");
-	}
-
-
-
-
-
-
-
-
+    /**
+     * 底层 Service 对象
+     */
+    @Autowired
+    TbGoodsDemandService tbGoodsDemandService;
+
+    /**
+     * 二级市场
+     */
+    @RequestMapping("getList")
+    public AjaxJson getList() {
+        SoMap so = SoMap.getRequestSoMap();
+        so.put("isOrders", 0);
+        so.put("isRelease", 1);
+        so.put("deleteStatus", DeleteStatus.DELETE_STATUS_ON.getCode());
+        List<TbGoodsDemand> list = tbGoodsDemandService.getList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
+    }
+
+    /**
+     * 增
+     */
+    @RequestMapping("add")
+    public AjaxJson add(TbGoodsDemand t) {
+        tbGoodsDemandService.add(t);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 发布|取消发布
+     */
+    @PostMapping("changeState")
+    public AjaxJson changeState(TbGoodsDemand dto) {
+        TbGoodsDemand t = new TbGoodsDemand();
+        t.setId(dto.getId());
+        t.setIsRelease(dto.getIsRelease());
+        return AjaxJson.toAjax(tbGoodsDemandService.updateById(t));
+    }
+
+    /**
+     * 删
+     */
+    @RequestMapping("delete")
+    public AjaxJson delete(Long id) {
+        tbGoodsDemandService.delete(id);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 删 - 根据id列表
+     */
+    @RequestMapping("deleteByIds")
+    public AjaxJson deleteByIds() {
+        List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
+        int line = SP.publicMapper.deleteByIds(TbGoodsDemand.TABLE_NAME, ids);
+        return AjaxJson.getByLine(line);
+    }
+
+    /**
+     * 改
+     */
+    @RequestMapping("update")
+    public AjaxJson update(TbGoodsDemand t) {
+        tbGoodsDemandService.update(t);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 查 - 根据id
+     */
+    @RequestMapping("getById")
+    public AjaxJson getById(Long id) {
+        TbGoodsDemand t = tbGoodsDemandService.getById(id);
+        return AjaxJson.getSuccessData(t);
+    }
+
+    /**
+     * app端:专供给一级市场查看的需求列表
+     */
+    @RequestMapping("getAppList")
+    public AjaxJson getAppList() {
+        SoMap so = SoMap.getRequestSoMap();
+        List<TbGoodsDemand> list = tbGoodsDemandService.getAppList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
+    }
+
+    /**
+     * app端:二级收购商查看需求发布列表(包括报价信息)
+     */
+    @RequestMapping("goodsDemandDetail")
+    public AjaxJson goodsDemandDetail() {
+        SoMap so = SoMap.getRequestSoMap();
+        GoodsDemandVo goodsDemandVos = tbGoodsDemandService.goodsDemandList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), goodsDemandVos);
+    }
+
+    /**
+     * app端:  二级市场收购商处理已被报价的需求
+     *
+     * @param disposeStatus     商家处理状态,只能是1或者2,其他值会抛异常 , 1=同意,2=拒绝
+     * @param goodsDemandId     需求表主键
+     * @param demandQuotationId 报价表主键
+     * @param purchaserRemark   商家的备注,非必填
+     * @return true/false
+     */
+    @RequestMapping("disposeOrders")
+    public AjaxJson disposeOrders(@RequestParam(value = "disposeStatus") Integer disposeStatus, @RequestParam("goodsDemandId") Long goodsDemandId, @RequestParam("demandQuotationId") Long demandQuotationId, @RequestParam(value = "purchaserRemark", required = false) String purchaserRemark) {
+        boolean disposed = tbGoodsDemandService.disposeOrders(disposeStatus, goodsDemandId, demandQuotationId, purchaserRemark);
+        if (disposed) return AjaxJson.getSuccess("处理报价结果成功!");
+        return AjaxJson.getError("处理报价结果失败!");
+    }
 
 
 }

+ 22 - 12
sp-service/level-two-server/src/main/java/com/pj/tb_goods_demand/MethodGoodsDemandService.java

@@ -52,29 +52,39 @@ public class MethodGoodsDemandService {
 
             //获取需求表ID
             Long id = item.getId();
+            so.delete("id");
             //查询报价表
             so.put("demandId",id);
             //报价结果[0=待确认,1=确认,2=拒绝]
             so.put("quotationResult",1);
             so.put("deleteStatus",DeleteStatus.DELETE_STATUS_ON.getCode());
             List<TbDemandQuotation> tbDemandQuotations = tbDemandQuotationMapper.getList(so);
-            if(tbDemandQuotations.size() == 0)return;
-            //查询商品基本信息
-            TbDemandQuotation tbDemandQuotation = tbDemandQuotations.get(0);
-            GoodsDto goodsDto = levelOneServerInterface.getByGoodsId(item.getLevelOneGoodsId());
+
             //开始封装数据
             GoodsDemandVo goodsDemandVo = new GoodsDemandVo();
+
+            //查询商品基本信息
+            GoodsDto goodsDto = levelOneServerInterface.getByGoodsId(item.getLevelOneGoodsId());
+            // TODO: 2023/8/8 获取商品图片暂时不需要
+            //goodsDemandVo.setGoodsImg(goodsDto.getAvatar());
+
             goodsDemandVo.setGoodsDemandId(id);
-            goodsDemandVo.setDemandQuotationId(tbDemandQuotation.getId());
-            goodsDemandVo.setGoodsImg(goodsDto.getAvatar());
-            goodsDemandVo.setGoodsName(goodsDto.getName());
-            goodsDemandVo.setGroupName(item.getGoodsName());
-            goodsDemandVo.setCreateName(tbDemandQuotation.getCreateName());
-            goodsDemandVo.setCreateTime(tbDemandQuotation.getCreateTime());
-            goodsDemandVo.setQuotation(tbDemandQuotation.getQuotation());
-            goodsDemandVo.setRemark(tbDemandQuotation.getRemark());
             goodsDemandVo.setGoodsQuantity(item.getGoodsQuantity());
             goodsDemandVo.setGoodsDemandTime(item.getCreateTime());
+            goodsDemandVo.setGoodsName(item.getGoodsName());
+            goodsDemandVo.setIsOrders(item.getIsOrders());
+
+            // 获取收购商发布需求中,关联的已确认的报价信息
+            if(tbDemandQuotations.size() > 0) {
+                TbDemandQuotation tbDemandQuotation = tbDemandQuotations.get(0);
+                goodsDemandVo.setDemandQuotationId(tbDemandQuotation.getId());
+                goodsDemandVo.setCreateName(tbDemandQuotation.getCreateName());
+                goodsDemandVo.setCreateTime(tbDemandQuotation.getCreateTime());
+                goodsDemandVo.setQuotation(tbDemandQuotation.getQuotation());
+                goodsDemandVo.setRemark(tbDemandQuotation.getRemark());
+                goodsDemandVo.setGroupName(tbDemandQuotation.getGroupName());
+            }
+
             //执行添加
             resultList.add(goodsDemandVo);