Przeglądaj źródła

合作方产品字段部分

zishan-an 1 rok temu
rodzic
commit
a86b067de5

+ 22 - 0
src/main/java/com/kexun/controller/FieldTemplateController.java

@@ -13,6 +13,7 @@ import com.kexun.model.ro.FiledTemplateUpdateRO;
 import com.kexun.model.vo.FiledTemplateVO;
 import com.kexun.service.BusinessService;
 import com.kexun.service.CooperatorService;
+import com.kexun.service.FieldTemplateRefService;
 import com.kexun.service.FieldTemplateService;
 import lombok.extern.java.Log;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,6 +31,8 @@ public class FieldTemplateController {
     @Autowired
     private FieldTemplateService fieldTemplateService;
 
+    @Autowired
+    private FieldTemplateRefService fieldTemplateRefService;
 
     /**
      * 获取字段模版信息
@@ -74,6 +77,25 @@ public class FieldTemplateController {
         return Result.success("ok", resJson);
     }
 
+
+    //编辑字段用
+    @RequestMapping("/findTemplateFieldByNum")
+    @ResponseBody
+    public Result findTemplateFieldByNo(@RequestBody String json){
+        JSONObject req = JSON.parseObject(json);
+        int pageNum = req.getIntValue("pageNum");
+        int pageSize = req.getIntValue("pageSize");
+        String templateNo = req.getString("templateNo");
+
+        PageHelper.startPage(pageNum, pageSize);//设置分页信息
+        List<FieldTemplateRefEntity> list = fieldTemplateRefService.findTemplateFieldByNo(templateNo);
+        PageInfo pageInfo=new PageInfo(list);
+        System.out.println(pageInfo);
+        JSONObject resJson = new JSONObject();
+        resJson.put("base_field", pageInfo);
+        return Result.success("ok", resJson);
+    }
+
     @RequestMapping("/selectTemplate")
     public Result selectTemplate(@RequestBody String json){
         JSONObject req = JSON.parseObject(json);

+ 4 - 3
src/main/java/com/kexun/controller/ReportController.java

@@ -61,12 +61,13 @@ public class ReportController {
 
 
     @PostMapping("download")
-    public void  download(@RequestBody String json)  {
+    public Result  download(@RequestParam String fileName)  {
         // 获得待下载文件所在文件夹的绝对路径
-        JSONObject req = JSON.parseObject(json);
-        String fileName = req.getString("file_name");
+//        JSONObject req = JSON.parseObject(json);
+//        String fileName = req.getString("file_name");
         System.out.println(fileName);
         reportService.download(fileName);
+        return Result.success();
 
     }
 

+ 17 - 0
src/main/java/com/kexun/mapper/CooperatorProductFieldMapper.java

@@ -0,0 +1,17 @@
+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.
+ */
+public interface CooperatorProductFieldMapper extends BaseMapper<CooperatorProductField> {
+
+
+}

+ 4 - 0
src/main/java/com/kexun/mapper/FieldTemplateRefMapper.java

@@ -3,6 +3,8 @@ package com.kexun.mapper;
 import com.kexun.entity.FieldTemplateRefEntity;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+
 /**
  * <p>
  * 字段模板和字段关系 Mapper 接口
@@ -14,4 +16,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 public interface FieldTemplateRefMapper extends BaseMapper<FieldTemplateRefEntity> {
 
     void deleteByTemplateId(Long id);
+
+    List<FieldTemplateRefEntity> QueryField(String templateNo);
 }

+ 16 - 0
src/main/java/com/kexun/service/CooperatorProductFieldService.java

@@ -0,0 +1,16 @@
+package com.kexun.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.kexun.entity.CooperatorProductField;
+import com.kexun.entity.FieldTemplateRefEntity;
+
+/**
+ * <p>
+ * 产品和字段关系 服务类
+ * </p>
+ *
+
+ */
+public interface CooperatorProductFieldService extends IService<CooperatorProductField> {
+
+}

+ 4 - 0
src/main/java/com/kexun/service/FieldTemplateRefService.java

@@ -3,6 +3,8 @@ package com.kexun.service;
 import com.kexun.entity.FieldTemplateRefEntity;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * <p>
  * 字段模板和字段关系 服务类
@@ -14,4 +16,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
 public interface FieldTemplateRefService extends IService<FieldTemplateRefEntity> {
 
     void deleteByTemplateId(Long id);
+
+    List<FieldTemplateRefEntity> findTemplateFieldByNo(String templateNo);
 }

+ 1 - 0
src/main/java/com/kexun/service/FieldTemplateService.java

@@ -69,4 +69,5 @@ public interface FieldTemplateService extends IService<FieldTemplateEntity> {
     List<FieldTemplateEntity> selectTemplate(String templateName);
 
     FieldTemplateEntity findByID(long id);
+
 }

+ 24 - 0
src/main/java/com/kexun/service/impl/CooperatorProductFieldImpl.java

@@ -0,0 +1,24 @@
+package com.kexun.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.kexun.entity.CooperatorProductField;
+import com.kexun.entity.CreditApproval;
+import com.kexun.mapper.CooperatorProductFieldMapper;
+import com.kexun.mapper.CreditApprovalMapper;
+import com.kexun.service.CooperatorProductFieldService;
+import com.kexun.service.CreditApprovalService;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ */
+@Service
+public class CooperatorProductFieldImpl extends ServiceImpl<CooperatorProductFieldMapper, CooperatorProductField>
+    implements CooperatorProductFieldService {
+
+
+}
+
+
+
+

+ 10 - 0
src/main/java/com/kexun/service/impl/FieldTemplateRefServiceImpl.java

@@ -1,5 +1,6 @@
 package com.kexun.service.impl;
 
+import com.kexun.entity.CooperatorProduct;
 import com.kexun.entity.FieldTemplateRefEntity;
 import com.kexun.mapper.FieldTemplateRefMapper;
 import com.kexun.service.FieldTemplateRefService;
@@ -7,6 +8,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 字段模板和字段关系 服务实现类
@@ -29,4 +32,11 @@ public class FieldTemplateRefServiceImpl extends ServiceImpl<FieldTemplateRefMap
     public void deleteByTemplateId(Long id) {
         fieldTemplateRefMapper.deleteByTemplateId(id);
     }
+
+    @Override
+    public List<FieldTemplateRefEntity> findTemplateFieldByNo(String templateNo) {
+//        System.out.println("aaa");
+        List<FieldTemplateRefEntity> l = fieldTemplateRefMapper.QueryField(templateNo);
+        return l;
+    }
 }

+ 6 - 0
src/main/java/com/kexun/service/impl/FieldTemplateServiceImpl.java

@@ -80,6 +80,8 @@ public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, F
         QueryWrapper<FieldTemplateEntity> wrapper=new QueryWrapper<FieldTemplateEntity>().eq("id",id);
         return getOne(wrapper);
     }
+
+
     /**
      * 保存模板字段
      *
@@ -113,6 +115,7 @@ public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, F
                 fieldTemplateRefEntity.setFieldNo(fieldDefine.getFieldNo());
                 fieldTemplateRefEntity.setName(fieldDefine.getName());
                 fieldTemplateRefEntity.setFieldTemplateId(id);
+//                fieldTemplateRefEntity.setType("1");
                 fieldTemplateRefEntity.setTemplateNo(fieldTemplateEntity.getTemplateNo());
                 fieldTemplateRefList.add(fieldTemplateRefEntity);
             }
@@ -125,6 +128,8 @@ public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, F
                 fieldTemplateRefEntity.setFieldNo(fieldDefine.getFieldNo());
                 fieldTemplateRefEntity.setName(fieldDefine.getName());
                 fieldTemplateRefEntity.setFieldTemplateId(id);
+//                fieldTemplateRefEntity.setType("2");
+
                 fieldTemplateRefEntity.setTemplateNo(fieldTemplateEntity.getTemplateNo());
                 fieldTemplateRefList.add(fieldTemplateRefEntity);
             }
@@ -158,6 +163,7 @@ public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, F
         fieldTemplateEntity.setTemplateName(filedTemplateUpdateRO.getTemplateName());
         BeanUtils.copyProperties(filedTemplateUpdateRO,fieldTemplateEntity);
         updateById(fieldTemplateEntity);
+        List <String> fieldSelected = filedTemplateUpdateRO.getFieldSelected();
 
         }
 

+ 0 - 1
src/main/java/com/kexun/service/impl/ReportServiceImpl.java

@@ -41,7 +41,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, ReportFile>
             outputFile.close();
             System.out.println("文件下载成功!");
         } catch (IOException e) {
-            e.printStackTrace();
         }
     }
 

+ 31 - 0
src/main/resources/mapper/CooperatorProductFieldMapper.xml

@@ -0,0 +1,31 @@
+<?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.CooperatorProductFieldMapper">
+
+    <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="findCooperatorFieldsQuery" resultType="com.kexun.entity.CooperatorProduct">
+       SELECT * FROM prd_product
+        WHERE model_id=#{modelNo}
+    </select>
+
+
+</mapper>

+ 7 - 0
src/main/resources/mapper/FieldTemplateRefMapper.xml

@@ -41,4 +41,11 @@
         where field_template_id = #{id}
     </delete>
 
+
+    <select id="QueryField" resultType="com.kexun.entity.FieldTemplateRefEntity" >
+        select * from field_template_ref
+        WHERE
+            template_no   = #{templateNo}
+
+    </select>
 </mapper>