Prechádzať zdrojové kódy

增加氚云导入功能

ruqinhu 5 rokov pred
rodič
commit
931dd56f57
22 zmenil súbory, kde vykonal 709 pridanie a 8 odobranie
  1. 237 0
      src/main/java/com/ygj/yuemum/component/CyScheduled.java
  2. 4 0
      src/main/java/com/ygj/yuemum/controller/customer/CustomerInfoFeedbackController.java
  3. 4 0
      src/main/java/com/ygj/yuemum/dao/customer/CustomerInfoBasicDao.java
  4. 4 0
      src/main/java/com/ygj/yuemum/dao/customer/CustomerInfoFeedbackDao.java
  5. 3 0
      src/main/java/com/ygj/yuemum/dao/customer/CustomerInfoFollowMapper.java
  6. 12 0
      src/main/java/com/ygj/yuemum/domain/customer/CustomerInfoFeedback.java
  7. 95 0
      src/main/java/com/ygj/yuemum/domain/customer/dto/CustomerInfoBasicCyDto.java
  8. 47 0
      src/main/java/com/ygj/yuemum/domain/customer/dto/CustomerInfoFeedbackCyDto.java
  9. 14 0
      src/main/java/com/ygj/yuemum/domain/customer/dto/CustomerInfoFeedbackDto.java
  10. 72 0
      src/main/java/com/ygj/yuemum/domain/customer/dto/CustomerInfoFollowCyDto.java
  11. 5 0
      src/main/java/com/ygj/yuemum/service/customer/CustomerInfoBasicService.java
  12. 5 0
      src/main/java/com/ygj/yuemum/service/customer/CustomerInfoFeedbackService.java
  13. 4 0
      src/main/java/com/ygj/yuemum/service/customer/CustomerInfoFollowService.java
  14. 22 1
      src/main/java/com/ygj/yuemum/service/scheduled/ScheduledService.java
  15. 18 0
      src/main/java/com/ygj/yuemum/utils/HttpUtils.java
  16. 3 0
      src/main/resources/application.yml
  17. 42 0
      src/main/resources/mybatis/mapper/customer/CustomerInfoBasicDao.xml
  18. 35 2
      src/main/resources/mybatis/mapper/customer/CustomerInfoFeedbackMapper.xml
  19. 37 0
      src/main/resources/mybatis/mapper/customer/CustomerInfoFollowMapper.xml
  20. 41 0
      src/test/java/com/ygj/yuemum/chuanyun/CyScheduledTest.java
  21. 3 3
      src/test/java/com/ygj/yuemum/chuanyun/ScheduledServiceTest.java
  22. 2 2
      src/test/java/com/ygj/yuemum/chuanyun/ImportTest.java

+ 237 - 0
src/main/java/com/ygj/yuemum/component/CyScheduled.java

@@ -0,0 +1,237 @@
+package com.ygj.yuemum.component;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.ygj.yuemum.domain.customer.dto.CustomerInfoBasicCyDto;
+import com.ygj.yuemum.domain.customer.dto.CustomerInfoFeedbackCyDto;
+import com.ygj.yuemum.domain.customer.dto.CustomerInfoFollowCyDto;
+import com.ygj.yuemum.service.customer.CustomerInfoBasicService;
+import com.ygj.yuemum.service.customer.CustomerInfoFeedbackService;
+import com.ygj.yuemum.service.customer.CustomerInfoFollowService;
+import com.ygj.yuemum.service.scheduled.CYScheduledService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 氚云返回数据格式, ReturnData 没有数据时时会为 null
+ * {
+ *     "ReturnData":{
+ *         "BizObjectArray":[
+ *             {}
+ *             ]
+ *     },
+ *     "Logined":false,
+ *     "DataType":0,
+ *     "Successful":true
+ * }
+ */
+@Component
+public class CyScheduled {
+
+    private final Logger logger = LoggerFactory.getLogger(CyScheduled.class);
+
+    private static final String ENPTYDATE= "2000-01-01 01:01:10";
+
+    private static final String CIFBSchemaCode = "e3i1ixenjat08xho5hy3zp2c4";
+
+    private static final String CIBSchemaCode = "twjff2zg1n2lwdrfkwbqnqne5";
+
+    private static final String CIFSchemaCode = "ajxhpu8n5e3n2272xda8k38o3";
+
+    @Resource
+    CYScheduledService cyScheduledService;
+
+    @Resource
+    CustomerInfoFeedbackService customerInfoFeedbackService;
+
+    @Resource
+    CustomerInfoBasicService customerInfoBasicService;
+
+    @Resource
+    CustomerInfoFollowService customerInfoFollowService;
+
+    /**
+     * 信息反馈表,
+     */
+    public void initCustomerInfoFeedback(int fromRowNum, int toRowNum) {
+        JSONObject jsonObject;
+        try {
+            jsonObject = cyScheduledService.listFormData(CIFBSchemaCode, fromRowNum, toRowNum);
+        } catch (Exception e) {
+            logger.error("信息反馈表数据导入有问题" + e.getMessage());
+            e.printStackTrace();
+            return;
+        }
+        JSONObject jsonObject1 = jsonObject.getJSONObject("ReturnData");
+        if (jsonObject1 == null) {
+            logger.info("没有返回值,可能数据导完了");
+            return;
+        }
+        JSONArray jsonArray = jsonObject1.getJSONArray("BizObjectArray");
+        List<CustomerInfoFeedbackCyDto> list = convertRtData2CIFBList(jsonArray);
+        customerInfoFeedbackService.insertInfoFeedbackList(list);
+    }
+
+    /**
+     * 用户信息表
+     */
+    public void initCustomerInfoBasic(int fromRowNum, int toRowNum) {
+        JSONObject jsonObject;
+        try {
+            jsonObject = cyScheduledService.listFormData(CIBSchemaCode, fromRowNum, toRowNum);
+        } catch (Exception e) {
+            logger.error("信息基础表数据导入有问题" + e.getMessage());
+            e.printStackTrace();
+            return;
+        }
+        JSONObject jsonObject1 = jsonObject.getJSONObject("ReturnData");
+        if (jsonObject1 == null) {
+            logger.info("没有返回值,可能数据导完了");
+            return;
+        }
+        JSONArray jsonArray = jsonObject1.getJSONArray("BizObjectArray");
+        List<CustomerInfoBasicCyDto> list = convertRtData2CIBList(jsonArray);
+        customerInfoBasicService.insertInfoBasicList(list);
+    }
+
+    public void initCustomerInfoFollow(int fromRowNum, int toRowNum) {
+        JSONObject jsonObject;
+        try {
+            jsonObject = cyScheduledService.listFormData(CIFSchemaCode, fromRowNum, toRowNum);
+        } catch (Exception e) {
+            logger.error("信息跟进表数据导入有问题" + e.getMessage());
+            e.printStackTrace();
+            return;
+        }
+        JSONObject jsonObject1 = jsonObject.getJSONObject("ReturnData");
+        if (jsonObject1 == null) {
+            logger.info("没有返回值,可能数据导完了");
+            return;
+        }
+        JSONArray jsonArray = jsonObject1.getJSONArray("BizObjectArray");
+        List<CustomerInfoFollowCyDto> list = convertRtData2CIFList(jsonArray);
+        customerInfoFollowService.insertInfoFollowList(list);
+    }
+
+    private List<CustomerInfoFeedbackCyDto> convertRtData2CIFBList(JSONArray jsonArray) {
+        List<CustomerInfoFeedbackCyDto> customerInfoFeedbacks = new ArrayList<>(jsonArray.size() * 2);
+        for (int i = 0; i < jsonArray.size(); i++) {
+            JSONObject jObj = jsonArray.getJSONObject(i);
+            CustomerInfoFeedbackCyDto customerInfoFeedback = new CustomerInfoFeedbackCyDto();
+            customerInfoFeedback.setFb_date(jObj.getString("Fd70b7fe2c26543b7a0dc5e842f01505a"));
+            customerInfoFeedback.setSource_channel(jObj.getString("F65c267199c244ab781911ae917c19e23"));
+            customerInfoFeedback.setFb_customer_phone(jObj.getString("F2eaf0b5866324133ae25469e15bfcbeb"));
+            customerInfoFeedback.setBranche_name(jObj.getString("F0000001"));
+            customerInfoFeedback.setFb_type(jObj.getString("F69ae33f6130a456bb49d9c3eda150924"));
+            customerInfoFeedback.setCreate_person(jObj.getString("CreatedBy"));
+            customerInfoFeedback.setIn_charge_person(jObj.getString("F0000005"));
+            customerInfoFeedback.setCustomer_manager(jObj.getString("OwnerId"));
+            customerInfoFeedback.setEntry_date(jObj.getString("CreatedTime"));
+            customerInfoFeedback.setP_code(jObj.getString("F0000012"));
+            customerInfoFeedback.setFb_customer_name(jObj.getString("Feee971d2c7744512951911969636b29a"));
+            customerInfoFeedback.setFb_wechat_number(jObj.getString("F0000010"));
+            customerInfoFeedback.setEdc_date(jObj.getString("F6d79882ffa4145f797ae2d7463087f05"));
+            customerInfoFeedback.setFb_remarks(jObj.getString("fb_remarks"));
+            customerInfoFeedback.setStore(jObj.getString("Fa8590df8fe8546458f799d71e3514a71"));
+            JSONArray jsonArray1 = jObj.getJSONArray("Fe568775265f74579a6f6d54cfabba349");
+            if (jsonArray1 != null && jsonArray1.size() > 0) {
+                JSONObject jsonObject1 = jsonArray1.getJSONObject(0);
+                if (jsonObject1.getString("F6016dc1446df4ce0b9c6ef3fc19bb89a") != null) {
+                    customerInfoFeedback.setIt_on(jsonObject1.getString("F6016dc1446df4ce0b9c6ef3fc19bb89a"));
+                } else {
+                    customerInfoFeedback.setIt_on("");
+                }
+                if (jsonObject1.getString("F0000008") != null) {
+                    customerInfoFeedback.setCommunication_content(jsonObject1.getString("F0000008"));
+                } else {
+                    customerInfoFeedback.setCommunication_content("");
+                }
+                if (jsonObject1.getDate("") != null) {
+                    customerInfoFeedback.setConvenient_time(jObj.getString(""));
+                } else {
+                    customerInfoFeedback.setConvenient_time(ENPTYDATE);
+                }
+                if (jsonObject1.getString("") != null) {
+                    customerInfoFeedback.setUser_feedback(jsonObject1.getString(""));
+                } else {
+                    customerInfoFeedback.setUser_feedback("");
+                }
+            } else {
+                customerInfoFeedback.setIt_on("");
+                customerInfoFeedback.setCommunication_content("");
+                customerInfoFeedback.setConvenient_time(ENPTYDATE);
+                customerInfoFeedback.setUser_feedback("");
+            }
+            customerInfoFeedbacks.add(customerInfoFeedback);
+        }
+
+        return customerInfoFeedbacks;
+    }
+
+    /**
+     * @param jsonArray
+     * @return
+     */
+    private List<CustomerInfoBasicCyDto> convertRtData2CIBList(JSONArray jsonArray) {
+        List<CustomerInfoBasicCyDto> list = new ArrayList<>(jsonArray.size() * 2);
+        for (int i = 0;i < jsonArray.size(); i++) {
+            JSONObject jsonObject = jsonArray.getJSONObject(i);
+            CustomerInfoBasicCyDto customerInfoBasicCyDto = new CustomerInfoBasicCyDto();
+            customerInfoBasicCyDto.setBranche_name(jsonObject.getString("F0000002"));
+            customerInfoBasicCyDto.setFb_customer_name(jsonObject.getString("F0000004"));
+            customerInfoBasicCyDto.setFb_customer_phone(jsonObject.getString("F0000005"));
+            customerInfoBasicCyDto.setP_code(jsonObject.getString("F0000029"));
+            customerInfoBasicCyDto.setFb_wechat_number(jsonObject.getString("F0000007"));
+            customerInfoBasicCyDto.setSource_channel(jsonObject.getString("F0000014"));
+            customerInfoBasicCyDto.setCustomer_state(jsonObject.getString("F0000013"));
+            customerInfoBasicCyDto.setEdc_date(jsonObject.getString("F0000009"));
+            customerInfoBasicCyDto.setPregnancy_way(jsonObject.getString("F0000038"));
+
+            JSONObject jsonObject1 = jsonObject.getJSONObject("F0000010");
+            if (jsonObject1 != null) {
+                customerInfoBasicCyDto.setAddress_basic(jsonObject1.getString("adcode"));
+                customerInfoBasicCyDto.setAddress_detail(jsonObject1.getString("Detail"));
+            }
+
+            customerInfoBasicCyDto.setFb_remarks(jsonObject.getString("F0000011"));
+            customerInfoBasicCyDto.setEntry_date(jsonObject.getString("CreatedTime"));
+            customerInfoBasicCyDto.setCreate_person(jsonObject.getString("CreatedBy"));
+            customerInfoBasicCyDto.setFb_date(jsonObject.getString("F0000024"));
+            list.add(customerInfoBasicCyDto);
+        }
+        return list;
+    }
+
+    /**
+     * @param jsonArray
+     * @return
+     */
+    private List<CustomerInfoFollowCyDto> convertRtData2CIFList(JSONArray jsonArray) {
+        List<CustomerInfoFollowCyDto> list = new ArrayList<>(jsonArray.size() * 2);
+        for (int i = 0; i < jsonArray.size(); i++) {
+            JSONObject jsonObject = jsonArray.getJSONObject(i);
+            CustomerInfoFollowCyDto customerInfoFollowCyDto = new CustomerInfoFollowCyDto();
+            customerInfoFollowCyDto.setCreate_date(jsonObject.getString("CreatedTime"));
+            customerInfoFollowCyDto.setFollow_mehtod(jsonObject.getString("F0000006"));
+            customerInfoFollowCyDto.setFb_customer_name(jsonObject.getString("F0000021"));
+            customerInfoFollowCyDto.setFb_customer_phone(jsonObject.getString("F0000016"));
+            customerInfoFollowCyDto.setSource_channel(jsonObject.getString("F0000017"));
+            customerInfoFollowCyDto.setEdc_date(jsonObject.getString("F0000022"));
+            customerInfoFollowCyDto.setFollow_state(jsonObject.getString("F0000007"));
+            customerInfoFollowCyDto.setAddress(jsonObject.getString("F0000008"));
+            customerInfoFollowCyDto.setFollow_desc(jsonObject.getString("F0000009"));
+            customerInfoFollowCyDto.setPhotos("");
+            customerInfoFollowCyDto.setNext_follow_date(jsonObject.getString("F0000011"));
+            customerInfoFollowCyDto.setCreate_person(jsonObject.getString("CreatedBy"));
+            customerInfoFollowCyDto.setFb_date(jsonObject.getString("F0000023"));
+            list.add(customerInfoFollowCyDto);
+        }
+        return list;
+    }
+
+}

+ 4 - 0
src/main/java/com/ygj/yuemum/controller/customer/CustomerInfoFeedbackController.java

@@ -5,6 +5,7 @@ import com.ygj.yuemum.domain.customer.dto.CustomerInfoFeedbackDto;
 import com.ygj.yuemum.service.customer.CustomerInfoFeedbackService;
 import com.ygj.yuemum.utils.ResponseUtil;
 import io.swagger.annotations.Api;
+import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -30,6 +31,9 @@ public class CustomerInfoFeedbackController {
     public Integer insertInfoFeedback(CustomerInfoFeedback customerInfoFeedback) {
         Object principal = SecurityUtils.getSubject().getPrincipal();
         customerInfoFeedback.setCreate_person(String.valueOf(principal));
+        if (StringUtils.isBlank(customerInfoFeedback.getFb_type())) {
+            customerInfoFeedback.setFb_type("待确认");
+        }
         return customerInfoFeedbackService.insertInfoFeedback(customerInfoFeedback);
     }
 

+ 4 - 0
src/main/java/com/ygj/yuemum/dao/customer/CustomerInfoBasicDao.java

@@ -1,8 +1,10 @@
 package com.ygj.yuemum.dao.customer;
 
 import com.ygj.yuemum.domain.customer.CustomerInfoBasic;
+import com.ygj.yuemum.domain.customer.dto.CustomerInfoBasicCyDto;
 import com.ygj.yuemum.domain.customer.dto.CustomerInfoBasicDto;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -59,4 +61,6 @@ public interface CustomerInfoBasicDao {
 
     List<CustomerInfoBasic> selectByPageNumSize(CustomerInfoBasicDto customerInfoBasic);
 
+    void insertInfoBasicList(@Param("list")List<CustomerInfoBasicCyDto> list);
+
 }

+ 4 - 0
src/main/java/com/ygj/yuemum/dao/customer/CustomerInfoFeedbackDao.java

@@ -1,7 +1,9 @@
 package com.ygj.yuemum.dao.customer;
 
 import com.ygj.yuemum.domain.customer.CustomerInfoFeedback;
+import com.ygj.yuemum.domain.customer.dto.CustomerInfoFeedbackCyDto;
 import com.ygj.yuemum.domain.customer.dto.CustomerInfoFeedbackDto;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -16,4 +18,6 @@ public interface CustomerInfoFeedbackDao {
     CustomerInfoFeedback getById(Integer id);
 
     int updateByPrimaryKeySelective(CustomerInfoFeedback customerInfoFeedback);
+
+    void insertInfoFeedbackList(@Param("list") List<CustomerInfoFeedbackCyDto> customerInfoFeedbacks);
 }

+ 3 - 0
src/main/java/com/ygj/yuemum/dao/customer/CustomerInfoFollowMapper.java

@@ -1,7 +1,9 @@
 package com.ygj.yuemum.dao.customer;
 
 import com.ygj.yuemum.domain.customer.CustomerInfoFollow;
+import com.ygj.yuemum.domain.customer.dto.CustomerInfoFollowCyDto;
 import com.ygj.yuemum.domain.customer.dto.CustomerInfoFollowDto;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -58,5 +60,6 @@ public interface CustomerInfoFollowMapper {
 
     List<CustomerInfoFollow> selectByPageNumSize(CustomerInfoFollowDto customerInfoFollowDto);
 
+    void insertInfoFollowList(@Param("list") List<CustomerInfoFollowCyDto> list);
 
 }

+ 12 - 0
src/main/java/com/ygj/yuemum/domain/customer/CustomerInfoFeedback.java

@@ -44,6 +44,18 @@ public class CustomerInfoFeedback {
     private Date edc_date;
 
     private String fb_remarks;
+
+    private String it_on;
+
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date convenient_time;
+
+    private String communication_content;
+
+    private String user_feedback;
+
+    private String store;
 //
 //
 //    private Integer page;

+ 95 - 0
src/main/java/com/ygj/yuemum/domain/customer/dto/CustomerInfoBasicCyDto.java

@@ -0,0 +1,95 @@
+package com.ygj.yuemum.domain.customer.dto;
+
+import lombok.Data;
+
+@Data
+public class CustomerInfoBasicCyDto {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    private Integer id;
+
+    /**
+     * 所属城市
+     */
+    private String branche_name;
+
+    /**
+     * 用户姓名
+     */
+    private String fb_customer_name;
+
+    /**
+     * 用户电话
+     */
+    private String fb_customer_phone;
+
+    /**
+     * 用户产品类型
+     */
+    private String p_code;
+
+    /**
+     * 微信号
+     */
+    private String fb_wechat_number;
+
+    /**
+     * 渠道来源
+     */
+    private String source_channel;
+
+    /**
+     * 用户状态
+     */
+    private String customer_state;
+
+    /**
+     * 预产期
+     */
+    private String edc_date;
+
+    /**
+     * 计划生产方式
+     */
+    private String pregnancy_way;
+
+    /**
+     * 地址
+     */
+    private String address_basic;
+
+    /**
+     * 详细地址
+     */
+    private String address_detail;
+
+    /**
+     * 备注
+     */
+    private String fb_remarks;
+
+    /**
+     * 录入时间
+     */
+    private String entry_date;
+
+    /**
+     * 创建人
+     */
+    private String create_person;
+
+    private String fb_date;
+
+    private Integer page;
+    private Integer limit;
+    private String start_entry_date;
+    private String end_entry_date;
+
+    private String address_basic_str;
+
+
+}

+ 47 - 0
src/main/java/com/ygj/yuemum/domain/customer/dto/CustomerInfoFeedbackCyDto.java

@@ -0,0 +1,47 @@
+package com.ygj.yuemum.domain.customer.dto;
+
+import lombok.Data;
+
+@Data
+public class CustomerInfoFeedbackCyDto {
+
+    private Integer id;
+
+    private String fb_date;
+
+    private String source_channel;
+
+    private String fb_customer_phone;
+
+    private String branche_name;
+
+    private String fb_type;
+
+    private String create_person;
+
+    private String in_charge_person;
+
+    private String customer_manager;
+
+    private String entry_date;
+
+    private String p_code;
+
+    private String fb_customer_name;
+
+    private String fb_wechat_number;
+
+    private String edc_date;
+
+    private String fb_remarks;
+
+    private String it_on;
+
+    private String convenient_time;
+
+    private String communication_content;
+
+    private String user_feedback;
+
+    private String store;
+}

+ 14 - 0
src/main/java/com/ygj/yuemum/domain/customer/dto/CustomerInfoFeedbackDto.java

@@ -1,6 +1,8 @@
 package com.ygj.yuemum.domain.customer.dto;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.util.Date;
 import java.util.List;
@@ -28,6 +30,18 @@ public class CustomerInfoFeedbackDto {
 
     private Date entry_date;
 
+    private String it_on;
+
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date convenient_time;
+
+    private String communication_content;
+
+    private String user_feedback;
+
+    private String store;
+
 
     private Integer page;
     private Integer limit;

+ 72 - 0
src/main/java/com/ygj/yuemum/domain/customer/dto/CustomerInfoFollowCyDto.java

@@ -0,0 +1,72 @@
+package com.ygj.yuemum.domain.customer.dto;
+
+import lombok.Data;
+
+@Data
+public class CustomerInfoFollowCyDto {
+
+    /**
+     * id
+     */
+    private Integer id;
+
+    /**
+     * 创建时间
+     */
+    private String create_date;
+
+    /**
+     * 跟进方式
+     */
+    private String follow_mehtod;
+
+    /**
+     * 客户姓名
+     */
+    private String fb_customer_name;
+
+    /**
+     * 用户电话
+     */
+    private String fb_customer_phone;
+
+    /**
+     * 渠道来源
+     */
+    private String source_channel;
+
+    /**
+     * 预产期
+     */
+    private String edc_date;
+
+    /**
+     * 跟进状态
+     */
+    private String follow_state;
+
+    /**
+     * 位置
+     */
+    private String address;
+
+    /**
+     * 跟进情况描述
+     */
+    private String follow_desc;
+
+    /**
+     * 相关照片
+     */
+    private String photos;
+
+    /**
+     * 下次跟进时间
+     */
+    private String next_follow_date;
+
+    private String create_person;
+
+    private String fb_date;
+
+}

+ 5 - 0
src/main/java/com/ygj/yuemum/service/customer/CustomerInfoBasicService.java

@@ -3,6 +3,7 @@ package com.ygj.yuemum.service.customer;
 import com.github.pagehelper.PageHelper;
 import com.ygj.yuemum.dao.customer.CustomerInfoBasicDao;
 import com.ygj.yuemum.domain.customer.CustomerInfoBasic;
+import com.ygj.yuemum.domain.customer.dto.CustomerInfoBasicCyDto;
 import com.ygj.yuemum.domain.customer.dto.CustomerInfoBasicDto;
 import org.springframework.stereotype.Service;
 
@@ -63,4 +64,8 @@ public class CustomerInfoBasicService {
 		return customerInfoBasicDao.selectByPageNumSize(customerInfoBasic);
 	}
 
+	public void insertInfoBasicList(List<CustomerInfoBasicCyDto> list) {
+		customerInfoBasicDao.insertInfoBasicList(list);
+	}
+
 }

+ 5 - 0
src/main/java/com/ygj/yuemum/service/customer/CustomerInfoFeedbackService.java

@@ -3,6 +3,7 @@ package com.ygj.yuemum.service.customer;
 import com.github.pagehelper.PageHelper;
 import com.ygj.yuemum.dao.customer.CustomerInfoFeedbackDao;
 import com.ygj.yuemum.domain.customer.CustomerInfoFeedback;
+import com.ygj.yuemum.domain.customer.dto.CustomerInfoFeedbackCyDto;
 import com.ygj.yuemum.domain.customer.dto.CustomerInfoFeedbackDto;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.stereotype.Service;
@@ -36,4 +37,8 @@ public class CustomerInfoFeedbackService {
         return feedbackDao.updateByPrimaryKeySelective(customerInfoFeedback);
     }
 
+    public void insertInfoFeedbackList(List<CustomerInfoFeedbackCyDto> customerInfoFeedbacks) {
+        feedbackDao.insertInfoFeedbackList(customerInfoFeedbacks);
+    }
+
 }

+ 4 - 0
src/main/java/com/ygj/yuemum/service/customer/CustomerInfoFollowService.java

@@ -3,6 +3,7 @@ package com.ygj.yuemum.service.customer;
 import com.github.pagehelper.PageHelper;
 import com.ygj.yuemum.dao.customer.CustomerInfoFollowMapper;
 import com.ygj.yuemum.domain.customer.CustomerInfoFollow;
+import com.ygj.yuemum.domain.customer.dto.CustomerInfoFollowCyDto;
 import com.ygj.yuemum.domain.customer.dto.CustomerInfoFollowDto;
 import org.springframework.stereotype.Service;
 
@@ -49,5 +50,8 @@ public class CustomerInfoFollowService {
 		return customerInfoFollowMapper.selectByPageNumSize(customerInfoFollowDto);
 	}
 
+	public void insertInfoFollowList(List<CustomerInfoFollowCyDto> list) {
+		customerInfoFollowMapper.insertInfoFollowList(list);
+	}
 
 }

+ 22 - 1
src/main/java/com/ygj/yuemum/service/scheduled/ScheduledService.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.ygj.yuemum.utils.HttpUtils;
 import org.apache.http.HttpResponse;
 import org.apache.http.util.EntityUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.util.Collections;
@@ -12,8 +13,28 @@ import java.util.HashMap;
 import java.util.Map;
 
 @Service
-public class ScheduledService {
+public class CYScheduledService {
 
+    @Value("${chuanyun.EngineCode}")
+    String EngineCode;
+
+    @Value("${chuanyun.EngineSecret}")
+    String EngineSecret;
+
+    public JSONObject listFormData(String SchemaCode, int FromRowNum, int ToRowNum) throws Exception {
+        return this.listFormData(EngineCode, EngineSecret, SchemaCode, FromRowNum, ToRowNum);
+    }
+
+    /**
+     * 批量从氚云导数据
+     * @param EngineCode 氚云code
+     * @param EngineSecret 氚云secret
+     * @param SchemaCode 表单id
+     * @param FromRowNum 从哪一条开始
+     * @param ToRowNum 到哪一条结束
+     * @return
+     * @throws Exception
+     */
     public JSONObject listFormData(String EngineCode, String EngineSecret, String SchemaCode, int FromRowNum, int ToRowNum) throws Exception {
         Map<String, String> paramMap = new HashMap();
         paramMap.put("ActionName",   "LoadBizObjects");

+ 18 - 0
src/main/java/com/ygj/yuemum/utils/HttpUtils.java

@@ -46,6 +46,12 @@ import java.util.Map;
  **/
 public class HttpUtils {
 
+	private static int defaultConnectTimeout = 60000;
+
+	private static int defaultConnectionRequestTimeout = 60000;
+
+	private static int defaultSocketTimeout = 60000;
+
 	/**
 	 * 获取 HttpClient
 	 *
@@ -198,6 +204,7 @@ public class HttpUtils {
 		if (StringUtils.isNotBlank(body)) {
 			request.setEntity(new StringEntity(body, "utf-8"));
 		}
+		request.setConfig(getRequestConfig(defaultConnectTimeout, defaultConnectionRequestTimeout, defaultSocketTimeout));
 		return httpClient.execute(request);
 	}
 
@@ -345,4 +352,15 @@ public class HttpUtils {
 		return sbUrl.toString();
 	}
 
+	/**
+	 * 单位毫秒
+	 * @return
+	 */
+	private static RequestConfig getRequestConfig(int connectTimeout, int connectionRequestTimeout, int socketTimeout){
+		RequestConfig requestConfig = RequestConfig.custom()
+				.setConnectTimeout(connectTimeout).setConnectionRequestTimeout(connectionRequestTimeout)
+				.setSocketTimeout(socketTimeout).build();
+		return requestConfig;
+	}
+
 }

+ 3 - 0
src/main/resources/application.yml

@@ -156,6 +156,9 @@ college:
   MAXSCHOLARSHIPS: 12000
 swagger:
   enable: false
+chuanyun:
+  EngineCode: ae483ce1607kh089
+  EngineSecret: aDKyV5OYQa7HMv4qWvqH8bAlXxmzD3bQK2/klBFoHlu6XHRxh7Q2lg==
 
 
 

+ 42 - 0
src/main/resources/mybatis/mapper/customer/CustomerInfoBasicDao.xml

@@ -246,4 +246,46 @@
             </foreach>
         </if>
     </select>
+
+    <insert id="insertInfoBasicList" >
+        INSERT INTO customer_info_basic
+                (
+                branche_name,
+                fb_customer_name,
+                fb_customer_phone,
+                p_code,
+                fb_wechat_number,
+                source_channel,
+                customer_state,
+                edc_date,
+                pregnancy_way,
+                address_basic,
+                address_detail,
+                fb_remarks,
+                entry_date,
+                create_person,
+                fb_date
+                )
+          VALUES
+        <foreach collection="list" item="item" separator=",">
+              (
+                #{item.branche_name},
+                #{item.fb_customer_name},
+                #{item.fb_customer_phone},
+                #{item.p_code},
+                #{item.fb_wechat_number},
+                #{item.source_channel},
+                #{item.customer_state},
+                #{item.edc_date},
+                #{item.pregnancy_way},
+                #{item.address_basic},
+                #{item.address_detail},
+                #{item.fb_remarks},
+                #{item.entry_date},
+                #{item.create_person},
+                #{item.fb_date}
+             )
+        </foreach>
+    </insert>
+
 </mapper>

+ 35 - 2
src/main/resources/mybatis/mapper/customer/CustomerInfoFeedbackMapper.xml

@@ -18,7 +18,12 @@
             edc_date,
             fb_wechat_number,
             fb_customer_name,
-            fb_remarks
+            fb_remarks,
+            it_on,
+            convenient_time,
+            communication_content,
+            user_feedback,
+            store
         FROM
             customer_info_feedback
         where 1=1
@@ -93,6 +98,7 @@
                 fb_wechat_number,
                 fb_customer_name,
                 fb_remarks,
+                store,
                 (
                     SELECT
                         p.p_name
@@ -100,7 +106,11 @@
                         packages p
                     WHERE
                         p.p_code = customer_info_feedback.p_code
-                ) AS p_code
+                ) AS p_code,
+                it_on,
+                convenient_time,
+                communication_content,
+                user_feedback
             FROM
                 customer_info_feedback
             WHERE
@@ -152,8 +162,31 @@
             <if test="fb_remarks != null">
                 `fb_remarks` = #{fb_remarks,jdbcType=VARCHAR},
             </if>
+            <if test="it_on != null">
+                `it_on` = #{it_on,jdbcType=VARCHAR},
+            </if>
+            <if test="convenient_time != null">
+                `convenient_time` = #{convenient_time,jdbcType=VARCHAR},
+            </if>
+            <if test="communication_content != null">
+                `communication_content` = #{communication_content,jdbcType=VARCHAR},
+            </if>
+            <if test="user_feedback != null">
+                `user_feedback` = #{user_feedback,jdbcType=VARCHAR},
+            </if>
+            <if test="store != null">
+                `store` = #{store,jdbcType=VARCHAR},
+            </if>
         </set>
         where `id` = #{id,jdbcType=INTEGER}
     </update>
 
+    <insert id="insertInfoFeedbackList">
+        insert into customer_info_feedback (fb_date, source_channel, fb_customer_phone, branche_name, fb_type, create_person, in_charge_person, customer_manager, entry_date, p_code, fb_customer_name, fb_wechat_number, edc_date, fb_remarks, it_on, convenient_time, communication_content, user_feedback, store)
+        values
+        <foreach collection="list" item="item" separator=",">
+         (#{item.fb_date}, #{item.source_channel}, #{item.fb_customer_phone}, #{item.branche_name}, #{item.fb_type}, #{item.create_person}, #{item.in_charge_person}, #{item.customer_manager}, #{item.entry_date}, #{item.p_code}, #{item.fb_customer_name}, #{item.fb_wechat_number}, #{item.edc_date}, #{item.fb_remarks}, #{item.it_on}, #{item.convenient_time}, #{item.communication_content}, #{item.user_feedback}, #{item.store})
+        </foreach>
+    </insert>
+
 </mapper>

+ 37 - 0
src/main/resources/mybatis/mapper/customer/CustomerInfoFollowMapper.xml

@@ -209,4 +209,41 @@
         </if>
     </select>
 
+    <insert id="insertInfoFollowList">
+        INSERT INTO customer_info_follow
+                (
+                create_date,
+                follow_mehtod,
+                fb_customer_name,
+                fb_customer_phone,
+                source_channel,
+                edc_date,
+                follow_state,
+                address,
+                follow_desc,
+                photos,
+                next_follow_date,
+                create_person,
+                fb_date
+                )
+        VALUES
+        <foreach collection="list" item="item" separator=",">
+                (
+                #{item.create_date},
+                #{item.follow_mehtod},
+                #{item.fb_customer_name},
+                #{item.fb_customer_phone},
+                #{item.source_channel},
+                #{item.edc_date},
+                #{item.follow_state},
+                #{item.address},
+                #{item.follow_desc},
+                #{item.photos},
+                #{item.next_follow_date},
+                #{item.create_person},
+                #{item.fb_date}
+                )
+        </foreach>
+    </insert>
+
 </mapper>

+ 41 - 0
src/test/java/com/ygj/yuemum/chuanyun/CyScheduledTest.java

@@ -0,0 +1,41 @@
+package com.ygj.yuemum.chuanyun;
+
+import com.ygj.yuemum.component.CyScheduled;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class CyScheduledTest {
+
+    private final int base = 500;
+
+    @Autowired
+    CyScheduled cyScheduled;
+
+    @Test
+    public void testInitCustomerInfoFeedback() {
+        for (int i = 0; i < 30; i++) {
+            cyScheduled.initCustomerInfoFeedback(i * base, (i + 1) * base);
+        }
+    }
+
+
+    @Test
+    public void testInitCustomerInfoBasic() {
+        for (int i = 0; i < 15; i++) {
+            cyScheduled.initCustomerInfoBasic(i * base, (i + 1) * base);
+        }
+    }
+
+    @Test
+    public void testInitCustomerInfoFollow() {
+        for (int i = 0; i < 15; i++) {
+            cyScheduled.initCustomerInfoFollow(i * base, (i + 1) * base);
+        }
+    }
+
+}

+ 3 - 3
src/test/java/com/ygj/yuemum/chuanyun/ScheduledServiceTest.java

@@ -1,16 +1,16 @@
 package com.ygj.yuemum.chuanyun;
 
 import com.alibaba.fastjson.JSONObject;
-import com.ygj.yuemum.service.scheduled.ScheduledService;
+import com.ygj.yuemum.service.scheduled.CYScheduledService;
 import org.junit.Test;
 
 public class ScheduledServiceTest {
 
     @Test
     public void testListFormData() throws Exception {
-        ScheduledService scheduledService = new ScheduledService();
+        CYScheduledService scheduledService = new CYScheduledService();
         JSONObject jsonObject = scheduledService.listFormData("ae483ce1607kh089", "aDKyV5OYQa7HMv4qWvqH8bAlXxmzD3bQK2/klBFoHlu6XHRxh7Q2lg==",
-                "e3i1ixenjat08xho5hy3zp2c4", 1, 10);
+                "twjff2zg1n2lwdrfkwbqnqne5", 0, 1);
         String strResult = jsonObject.toJSONString();
         System.out.println(strResult);
     }

+ 2 - 2
src/test/java/com/ygj/yuemum/chuanyun/ImportTest.java

@@ -10,7 +10,7 @@ import org.junit.Test;
 import java.util.HashMap;
 import java.util.Map;
 
-public class ImportTest {
+public class ScheduledSingleServiceTest {
 
     @Test
     public void testLoadObjects() throws Exception {
@@ -53,7 +53,7 @@ public class ImportTest {
 
         paramMap.put("SchemaCode", "ajxhpu8n5e3n2272xda8k38o3");
 
-        paramMap.put("BizObjectId", "97914666-af2a-4e4b-83ff-6bb0fa366cc0");
+        paramMap.put("BizObjectId", "1611aa3d-ee15-4ada-b56a-1fdd4c6987b5");
 
         //身份认证参数
         Map headers = new HashMap();