Преглед на файлове

新增单个更新方法

openHj преди 1 година
родител
ревизия
61b72f1995

+ 2 - 2
hx-customer/src/main/java/com/fjhx/customer/initializers/XiaomanInitializers.java

@@ -35,7 +35,7 @@ public class XiaomanInitializers {
         refreshToken();
         //获取全量数据
         try {
-//            xiaomanApiService.updateList(8);
+            xiaomanApiService.updateSingle(18846628768390l);
         } catch (Exception e) {
             log.error("获取小满全量数据异常", e);
         }
@@ -43,7 +43,7 @@ public class XiaomanInitializers {
     }
 
 
-    @Scheduled(cron = "0 0 0/8 * * ? ")
+    @Scheduled(cron = "0 0/30 * * * ? ")
     void refreshToken(){
         //如果过期时间是空的,就获取新的token
         XiaomanConfig config = xiaomanConfigService.getCache();

+ 2 - 0
hx-customer/src/main/java/com/fjhx/customer/service/xiaoman/XiaomanApiService.java

@@ -20,6 +20,8 @@ public interface XiaomanApiService {
 
     void updateList(int hours);
 
+    void updateSingle(Long companyId);
+
     void getSelectorData();
 
     void updateXiaomanData(XiaomanUpdateInfoVO xiaomanUpdateInfoVO);

+ 3 - 0
hx-customer/src/main/java/com/fjhx/customer/service/xiaoman/XiaomanCustomerService.java

@@ -53,6 +53,9 @@ public interface XiaomanCustomerService  {
 
     void handleSaveOrUpdate(List<CustomerApiVo> customerApiVoList, Set<Long> allCustomer,boolean flag);
 
+
+    void processCustomer(XiaomanCustomer customer, boolean isUpdate, boolean flag);
+
     void initAllList();
     void updateList();
 }

+ 11 - 0
hx-customer/src/main/java/com/fjhx/customer/service/xiaoman/impl/XiaomanApiServiceImpl.java

@@ -18,6 +18,7 @@ import com.fjhx.customer.entity.customer.dto.CustomerDto;
 import com.fjhx.customer.entity.customer.po.CustomerUser;
 import com.fjhx.customer.entity.xiaoman.dto.XiaomanCustomerSelectDto;
 import com.fjhx.customer.entity.xiaoman.po.XiaomanConfig;
+import com.fjhx.customer.entity.xiaoman.po.XiaomanCustomer;
 import com.fjhx.customer.entity.xiaoman.vo.CustomerListApiVo;
 import com.fjhx.customer.entity.xiaoman.vo.XiaomanCustomerVo;
 import com.fjhx.customer.entity.xiaoman.vo.XiaomanUpdateInfoVO;
@@ -186,6 +187,16 @@ public class XiaomanApiServiceImpl implements XiaomanApiService {
     }
 
 
+    @Override
+    public void updateSingle(Long companyId) {
+        //先更新一下数据字典
+        getSelectorData();
+        List<XiaomanCustomerVo> list = xiaomanCustomerService.getList(new XiaomanCustomerSelectDto());
+        XiaomanCustomerVo detail = xiaomanCustomerService.detail(companyId);
+        XiaomanCustomer customer = BeanUtil.copyProperties(detail, XiaomanCustomer.class);
+        xiaomanCustomerService.processCustomer(customer, true, false);
+    }
+
     private static Map<String, Object> initPageParams(int page) {
         Map<String, Object> params = new HashMap<>();
         params.put("start_index", page);

+ 1 - 3
hx-customer/src/main/java/com/fjhx/customer/service/xiaoman/impl/XiaomanCustomerServiceImpl.java

@@ -134,7 +134,7 @@ public class XiaomanCustomerServiceImpl extends ServiceImpl<XiaomanCustomerMappe
     }
 
 
-    private void processCustomer(XiaomanCustomer customer, boolean isUpdate,boolean flag) {
+    public void processCustomer(XiaomanCustomer customer, boolean isUpdate, boolean flag) {
 
             // 如果不是同时全量更新且需要修改,则执行以下逻辑
             if (!(isUpdate && flag)) {
@@ -158,8 +158,6 @@ public class XiaomanCustomerServiceImpl extends ServiceImpl<XiaomanCustomerMappe
                 } else {
                     save(customer);
                 }
-
-
             }