|
@@ -0,0 +1,88 @@
|
|
|
+package com.kexun.controller;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.kexun.common.utils.Result;
|
|
|
+import com.kexun.entity.CooperatorField;
|
|
|
+import com.kexun.entity.CooperatorInfo;
|
|
|
+import com.kexun.entity.CooperatorProduct;
|
|
|
+import com.kexun.service.CooperatorProductService;
|
|
|
+import lombok.extern.java.Log;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Calendar;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/admin/cooperator_product")
|
|
|
+@Log
|
|
|
+public class CooperatorProductController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CooperatorProductService CooperatorProductService;
|
|
|
+
|
|
|
+ // 获取合作产品信息
|
|
|
+ @GetMapping("cooperatorProductList")
|
|
|
+ public Result cooperatorProductList() {
|
|
|
+ JSONObject resJson=new JSONObject();
|
|
|
+ List<CooperatorProduct> list=CooperatorProductService.productList();
|
|
|
+ resJson.put("cooperator_Product_List",list);
|
|
|
+ System.out.println(list);
|
|
|
+
|
|
|
+ return Result.success("ok",resJson);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取合作产品字段
|
|
|
+ @GetMapping("findCooperatorProductFieldByNum/{productNum}")
|
|
|
+ public Result findCooperatorProductFieldByNum(@PathVariable("productNum") String productNum) {
|
|
|
+
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ System.out.println(productNum);
|
|
|
+ List<CooperatorField> list = CooperatorProductService.findCooperatorProductFieldByNum(productNum);
|
|
|
+ result.put("cooperator_product_field",list);
|
|
|
+ System.out.println(list);
|
|
|
+
|
|
|
+ return Result.success("ok", result);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 申请合作产品
|
|
|
+ @PostMapping("apply")
|
|
|
+ public Result cooperatorProductApply(@RequestBody String json)
|
|
|
+ {
|
|
|
+ JSONObject req = JSON.parseObject(json);
|
|
|
+ String cooperatorNo = req.getString("cooperator_no");
|
|
|
+ String cooperatorName = req.getString("cooperator_name");
|
|
|
+ String productNo = req.getString("product_num");
|
|
|
+ String productName = req.getString("product_name");
|
|
|
+ String modelId = req.getString("model_id");
|
|
|
+ Calendar calendar= Calendar.getInstance();
|
|
|
+ SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
|
|
|
+ String createTime = dateFormat.format(calendar.getTime());
|
|
|
+
|
|
|
+ CooperatorProductService.Apply(cooperatorNo, cooperatorName, productNo, productName, modelId, createTime);
|
|
|
+
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("updateProductFieldNo/{productNum}/{fieldNo}")
|
|
|
+ public Result updateProductFieldNo(@PathVariable("productNum") String productNum,@PathVariable("fieldNo") String fieldNo) {
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ CooperatorProductService.updateProductFieldNo(productNum,fieldNo);
|
|
|
+ return Result.success("ok", result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("findCooperatorFieldsByName/{cooperatorName}")
|
|
|
+ public Result findCooperatorFieldsByName(@PathVariable("cooperatorName") String cooperatorName){
|
|
|
+ JSONObject resJson=new JSONObject();
|
|
|
+ List<CooperatorField> list=CooperatorProductService.findCooperatorFieldsByName(cooperatorName);
|
|
|
+ resJson.put("cooperator_fields_by_name",list);
|
|
|
+ System.out.println(list);
|
|
|
+
|
|
|
+ return Result.success("ok",resJson);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|