3
0

3 Ревизии 42f19b6868 ... 36ffe10b0b

Автор SHA1 Съобщение Дата
  shixr 36ffe10b0b 合作产品界面 преди 1 година
  shixr e455b7d820 合作产品申请 преди 1 година
  shixr 92c9cb34d2 合作产品展示 преди 1 година

+ 8 - 8
src/main/java/com/kexun/controller/CooperatorController.java

@@ -99,22 +99,22 @@ public class CooperatorController {
 //        return Result.success("ok", result);
 //    }
 
-    @GetMapping("findCooperatorFieldByNum")
-    public Result findCooperatorFieldByNum(String cooperatorNum) {
-
+    @GetMapping("findCooperatorFieldByNum/{cooperatorNum}")
+    public Result findCooperatorFieldByNum(@PathVariable("cooperatorNum")String cooperatorNum) {
         JSONObject result = new JSONObject();
-        List<CooperatorField> list = CooperatorService.findCooperatorFieldByNum();
-//        System.out.println(list);
+        List<CooperatorField> list = CooperatorService.findCooperatorFieldByNum(cooperatorNum);
+        System.out.println(list);
+
         result.put("cooperator_field",list);
 
         return Result.success("ok", result);
     }
 
-    @GetMapping("findCooperatorProductByNum")
-    public Result findCooperatorProductByNum(String cooperatorNum) {
+    @GetMapping("findCooperatorProductByNum/{cooperatorNum}")
+    public Result findCooperatorProductByNum(@PathVariable("cooperatorNum")String cooperatorNum) {
 
         JSONObject result = new JSONObject();
-        List<CooperatorProduct> list = CooperatorService.findCooperatorProductByNum();
+        List<CooperatorProduct> list = CooperatorService.findCooperatorProductByNum(cooperatorNum);
 //        System.out.println(list);
         result.put("cooperator_product",list);
 

+ 88 - 0
src/main/java/com/kexun/controller/CooperatorProductController.java

@@ -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);
+    }
+
+}

+ 47 - 0
src/main/java/com/kexun/controller/ModelDefineController.java

@@ -0,0 +1,47 @@
+package com.kexun.controller;
+
+//import ch.qos.logback.core.rolling.helper.FileStoreUtil;
+//import ch.qos.logback.core.util.FileUtil;
+
+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.entity.ModelDefine;
+import com.kexun.service.ModelDefineService;
+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/model_define")
+@Log
+public class ModelDefineController {
+
+    @Autowired
+    private ModelDefineService ModelDefineService;
+
+    // 获取模型信息
+    @GetMapping("modelDefineList")
+    public Result modelDefineList() {
+        JSONObject resJson=new JSONObject();
+        List<ModelDefine> list= ModelDefineService.list();
+        resJson.put("model_define_list",list);
+        System.out.println(list);
+
+        return Result.success("ok",resJson);
+    }
+
+
+
+}

+ 2 - 1
src/main/java/com/kexun/entity/CooperatorField.java

@@ -26,8 +26,9 @@ public class CooperatorField implements Serializable {
     @TableField(value = "type")
     private String type;
 
+    @TableField(value = "create_time")
     private String createTime;
 
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
-}
+}

+ 1 - 1
src/main/java/com/kexun/entity/CooperatorInfo.java

@@ -15,7 +15,7 @@ import java.io.Serializable;
 @Data
 public class CooperatorInfo implements Serializable {
 
-//    @TableId(value = "id" , type = IdType.AUTO)
+    @TableId(value = "id" , type = IdType.AUTO)
 //    @TableField(value = "id")
     private Long id;
 

+ 8 - 1
src/main/java/com/kexun/entity/CooperatorProduct.java

@@ -3,6 +3,7 @@ package com.kexun.entity;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
+import org.springframework.data.annotation.Transient;
 
 import java.io.Serializable;
 
@@ -19,7 +20,13 @@ public class CooperatorProduct implements Serializable {
     @TableField(value = "product_status")
     private String productStatus;
 
-    private String modelName;
+    private transient String modelName;
+
+    @TableField(value = "cooperator_name")
+    private String cooperatorName;
+
+    @TableField(value = "model_id")
+    private String modelId;
 
     @TableField(value = "create_time")
     private String createTime;

+ 26 - 0
src/main/java/com/kexun/entity/CooperatorProductField.java

@@ -0,0 +1,26 @@
+package com.kexun.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@TableName(value = "product_field_ref")
+@Data
+public class CooperatorProductField implements Serializable {
+
+    @TableField(value = "product_num")
+    private String productNum;
+
+    @TableField(value = "product_name")
+    private String productName;
+
+    @TableField(value = "field_no")
+    private String fieldNo;
+
+
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+}

+ 29 - 0
src/main/java/com/kexun/entity/ModelDefine.java

@@ -0,0 +1,29 @@
+package com.kexun.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@TableName(value = "model")
+@Data
+public class ModelDefine implements Serializable {
+
+
+    @TableId(value = "id")
+    private Long id;
+
+    @TableField(value = "model_no")
+    private String modelNo;
+
+    @TableField(value = "model_name")
+    private String modelName;
+
+    @TableField(value = "create_time")
+    private String createTime;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+}

+ 4 - 4
src/main/java/com/kexun/mapper/CooperatorMapper.java

@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.kexun.entity.CooperatorInfo;
 import com.kexun.entity.CooperatorField;
 import com.kexun.entity.CooperatorProduct;
-import org.apache.ibatis.annotations.Param;
+import org.springframework.data.repository.query.Param;
 
 import java.util.List;
 
@@ -13,9 +13,9 @@ import java.util.List;
  */
 public interface CooperatorMapper extends BaseMapper<CooperatorInfo> {
 
-    // List<CooperatorField> Query(@Param("cooperatorNum") String cooperatorNum);
-    List<CooperatorField> Query();
-    List<CooperatorProduct> QueryProduct();
+    List<CooperatorField> Query(@Param("cooperatorNum") String cooperatorNum);
+
+    List<CooperatorProduct> QueryProduct(@Param("cooperatorNum") String cooperatorNum);
 
 }
 

+ 22 - 0
src/main/java/com/kexun/mapper/CooperatorProductMapper.java

@@ -0,0 +1,22 @@
+package com.kexun.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.kexun.entity.CooperatorField;
+import com.kexun.entity.CooperatorProduct;
+import com.kexun.entity.CooperatorProductField;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
+
+/**
+ * @Entity com.kexun.entity.PartnerInfo
+ */
+public interface CooperatorProductMapper extends BaseMapper<CooperatorProduct> {
+
+    List<CooperatorProduct> Query();
+    List<CooperatorField> fieldQuery(@Param("productNum") String productNum);
+    void Apply(String cooperatorNo, String cooperatorName, String productNo, String productName, String modelId, String createTime);
+    void updateQuery(@Param("productNum") String productNum, @Param("fieldNo") String fieldNo);
+
+    List<CooperatorField> findCooperatorFieldsQuery(@Param("cooperatorName") String cooperatorName);
+}

+ 20 - 0
src/main/java/com/kexun/mapper/ModelDefineMapper.java

@@ -0,0 +1,20 @@
+package com.kexun.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.kexun.entity.CooperatorField;
+import com.kexun.entity.CooperatorInfo;
+import com.kexun.entity.CooperatorProduct;
+import com.kexun.entity.ModelDefine;
+
+import java.util.List;
+
+/**
+ * @Entity com.kexun.entity.PartnerInfo
+ */
+public interface ModelDefineMapper extends BaseMapper<ModelDefine> {
+
+}
+
+
+
+

+ 20 - 0
src/main/java/com/kexun/service/CooperatorProductService.java

@@ -0,0 +1,20 @@
+package com.kexun.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import com.kexun.entity.CooperatorField;
+import com.kexun.entity.CooperatorProduct;
+
+import java.util.List;
+
+/**
+ *
+ */
+public interface CooperatorProductService extends IService<CooperatorProduct> {
+    List<CooperatorProduct> productList();
+    List<CooperatorField> findCooperatorProductFieldByNum(String productNum);
+    void Apply(String cooperatorNo, String cooperatorName, String productNo, String productName, String modelId, String createTime);
+    void updateProductFieldNo(String productNum,String fieldNo);
+
+    List<CooperatorField> findCooperatorFieldsByName(String cooperatorName);
+}

+ 2 - 2
src/main/java/com/kexun/service/CooperatorService.java

@@ -15,7 +15,7 @@ import java.util.List;
 public interface CooperatorService extends IService<CooperatorInfo> {
     CooperatorInfo findByCooperatorNum(String partnerName);
 //    List<CooperatorField> findCooperatorFieldByNum(String cooperatorNum);
-    List<CooperatorField> findCooperatorFieldByNum();
-    List<CooperatorProduct> findCooperatorProductByNum();
+    List<CooperatorField> findCooperatorFieldByNum(String cooperatorNum);
+    List<CooperatorProduct> findCooperatorProductByNum(String cooperatorNum);
     CooperatorInfo findByID(long id);
 }

+ 15 - 0
src/main/java/com/kexun/service/ModelDefineService.java

@@ -0,0 +1,15 @@
+package com.kexun.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.kexun.entity.CooperatorField;
+import com.kexun.entity.CooperatorProduct;
+import com.kexun.entity.ModelDefine;
+
+import java.util.List;
+
+/**
+ *
+ */
+public interface ModelDefineService extends IService<ModelDefine> {
+
+}

+ 51 - 0
src/main/java/com/kexun/service/impl/CooperatorProductServiceImpl.java

@@ -0,0 +1,51 @@
+package com.kexun.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.kexun.entity.CooperatorField;
+import com.kexun.entity.CooperatorProduct;
+import com.kexun.mapper.CooperatorMapper;
+import com.kexun.mapper.CooperatorProductMapper;
+import com.kexun.service.CooperatorProductService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ *
+ */
+@Service
+public class CooperatorProductServiceImpl extends ServiceImpl<CooperatorProductMapper, CooperatorProduct>
+        implements CooperatorProductService {
+
+    @Resource
+    CooperatorProductMapper cooperatorProductMapper;
+    @Override
+    public List<CooperatorProduct> productList() {
+        List<CooperatorProduct> l = cooperatorProductMapper.Query();
+        return l;
+    }
+
+    @Override
+    public List<CooperatorField> findCooperatorProductFieldByNum(String productNum) {
+        List<CooperatorField> l = cooperatorProductMapper.fieldQuery(productNum);
+        return l;
+    }
+
+    @Override
+    public void Apply(String cooperatorNo, String cooperatorName, String productNo, String productName, String modelId, String createTime) {
+        cooperatorProductMapper.Apply(cooperatorNo,cooperatorName, productNo, productName,  modelId,  createTime);
+    }
+
+    @Override
+    public void updateProductFieldNo(String productNum,String fieldNo) {
+        cooperatorProductMapper.updateQuery(productNum,fieldNo);
+    }
+
+    @Override
+    public List<CooperatorField> findCooperatorFieldsByName(String cooperatorName){
+        List<CooperatorField> l = cooperatorProductMapper.findCooperatorFieldsQuery(cooperatorName);
+        return l;
+
+    }
+}

+ 4 - 4
src/main/java/com/kexun/service/impl/CooperatorServiceImpl.java

@@ -31,16 +31,16 @@ public class CooperatorServiceImpl extends ServiceImpl<CooperatorMapper, Coopera
     CooperatorMapper cooperatorMapper;
 
     @Override
-    public List<CooperatorField> findCooperatorFieldByNum() {
+    public List<CooperatorField> findCooperatorFieldByNum(String cooperatorNum) {
 //        System.out.println("aaa");
-        List<CooperatorField> l = cooperatorMapper.Query();
+        List<CooperatorField> l = cooperatorMapper.Query(cooperatorNum);
         return l;
     }
 
     @Override
-    public List<CooperatorProduct> findCooperatorProductByNum() {
+    public List<CooperatorProduct> findCooperatorProductByNum(String cooperatorNum) {
 //        System.out.println("aaa");
-        List<CooperatorProduct> l = cooperatorMapper.QueryProduct();
+        List<CooperatorProduct> l = cooperatorMapper.QueryProduct(cooperatorNum);
         return l;
     }
 

+ 23 - 0
src/main/java/com/kexun/service/impl/ModelDefineServiceImpl.java

@@ -0,0 +1,23 @@
+package com.kexun.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.kexun.entity.CooperatorField;
+import com.kexun.entity.CooperatorProduct;
+import com.kexun.entity.ModelDefine;
+import com.kexun.mapper.CooperatorProductMapper;
+import com.kexun.mapper.ModelDefineMapper;
+import com.kexun.service.CooperatorProductService;
+import com.kexun.service.ModelDefineService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ *
+ */
+@Service
+public class ModelDefineServiceImpl extends ServiceImpl<ModelDefineMapper, ModelDefine>
+        implements ModelDefineService {
+
+}

+ 3 - 3
src/main/resources/mapper/CooperatorMapper.xml

@@ -40,12 +40,12 @@
                 LEFT JOIN field_template_ref ON field_template_ref.field_no = field_define.field_no
                 LEFT JOIN cooperator_info ON cooperator_info.template_no = field_template_ref.template_no
         WHERE
-            cooperator_info.cooperator_num = "HBJK20230509";
+            cooperator_info.cooperator_num = #{cooperatorNum};
 
 
     </select>
 
-    <select id="QueryProduct" resultType="com.kexun.entity.CooperatorProduct">
+    <select id="QueryProduct" resultType="com.kexun.entity.CooperatorProduct" >
         SELECT DISTINCT
             prd_product.product_num,
             prd_product.product_name,
@@ -56,7 +56,7 @@
             prd_product
                 LEFT JOIN model ON model.model_no = prd_product.model_id
         WHERE
-            prd_product.cooperator_num = "HBJK20230509";
+            prd_product.cooperator_num = #{cooperatorNum};
 
 
     </select>

+ 76 - 0
src/main/resources/mapper/CooperatorProductMapper.xml

@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.kexun.mapper.CooperatorProductMapper">
+
+    <resultMap id="BaseResultMap" type="com.kexun.entity.CooperatorInfo">
+            <result property="partnerName" column="partner_name" jdbcType="VARCHAR"/>
+            <result property="contactName" column="contact_name" jdbcType="VARCHAR"/>
+            <result property="mobileNo" column="mobile_no" jdbcType="VARCHAR"/>
+            <result property="rate1" column="rate_1" jdbcType="VARCHAR"/>
+            <result property="queryNumber1" column="query_number1" jdbcType="VARCHAR"/>
+            <result property="rate2" column="rate_2" jdbcType="VARCHAR"/>
+            <result property="queryNumber2" column="query_number2" jdbcType="VARCHAR"/>
+            <result property="rate3" column="rate_3" jdbcType="VARCHAR"/>
+            <result property="queryNumber3" column="query_number3" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_time" jdbcType="VARCHAR"/>
+            <result property="isEnable" column="is_enable" jdbcType="VARCHAR"/>
+
+
+    </resultMap>
+
+
+    <select id="Query" resultType="com.kexun.entity.CooperatorProduct">
+    SELECT DISTINCT
+           prd_product.product_num,
+           prd_product.product_name,
+           prd_product.product_status,
+            prd_product.cooperator_name,
+           prd_product.create_time,
+           model.model_name as modelName
+       FROM
+           prd_product
+               LEFT JOIN model ON model.model_no = prd_product.model_id
+    </select>
+
+    <select id="fieldQuery" resultType="com.kexun.entity.CooperatorField">
+        SELECT DISTINCT
+            field_define.field_no,
+            field_define.`name`,
+            field_define.name_zh,
+            field_define.type,
+            field_define.create_time
+        FROM
+            field_define
+                LEFT JOIN product_field_ref ON product_field_ref.field_no = field_define.field_no
+        WHERE product_field_ref.product_num = #{productNum}
+    </select>
+
+    <insert id="Apply">
+        insert into prd_product(cooperator_num,cooperator_name,product_num,product_name,model_id,create_time)
+        values(#{cooperatorNo},#{cooperatorName},#{productNo},#{productName},#{modelId},#{createTime})
+    </insert>
+
+    <select id="updateQuery" >
+        UPDATE product_field_ref
+        SET product_field_ref.field_no=#{fieldNo}
+        WHERE product_field_ref.product_num=#{productNum}
+    </select>
+
+    <select id="findCooperatorFieldsQuery" resultType="com.kexun.entity.CooperatorField">
+        SELECT DISTINCT
+            field_define.field_no,
+            field_define.`name`,
+            field_define.name_zh,
+            field_define.type,
+            field_define.create_time
+        FROM
+            field_define
+                RIGHT JOIN field_template_ref ON field_template_ref.field_no = field_define.field_no
+                LEFT JOIN cooperator_info ON cooperator_info.template_no=field_template_ref.template_no
+        WHERE cooperator_info.cooperator_name = #{cooperatorName}
+    </select>
+
+
+</mapper>