浏览代码

收购商采购需求管理取消和发布,删除

李书文 2 年之前
父节点
当前提交
4b7727644d

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

@@ -5,6 +5,7 @@ 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 +15,112 @@ 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("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(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("处理报价结果失败!");
+    }
 
 
 }