Browse Source

Merge remote-tracking branch 'origin/master'

scr 8 years ago
parent
commit
a7b37dcd7a

+ 58 - 0
src/main/java/com/uas/erp/schedular/b2b/domain/ProductSaler.java

@@ -0,0 +1,58 @@
+package com.uas.erp.schedular.b2b.domain;
+
+/**
+ * ERP个人物料信息
+ *
+ * Created by hejq on 2018-01-12.
+ */
+public class ProductSaler extends KeyEntity {
+
+    /**
+     * 主键id
+     */
+    private Long ps_id;
+
+    /**
+     * 物料code
+     */
+    private String ps_code;
+
+    /**
+     * 个人uu号
+     */
+    private Long em_uu;
+
+    public Long getPs_id() {
+        return ps_id;
+    }
+
+    public void setPs_id(Long ps_id) {
+        this.ps_id = ps_id;
+    }
+
+    public String getPs_code() {
+        return ps_code;
+    }
+
+    public void setPs_code(String ps_code) {
+        this.ps_code = ps_code;
+    }
+
+    public Long getEm_uu() {
+        return em_uu;
+    }
+
+    public void setEm_uu(Long em_uu) {
+        this.em_uu = em_uu;
+    }
+
+    /**
+     * 主键值
+     *
+     * @return
+     */
+    @Override
+    public Object getKey() {
+        return this.ps_id;
+    }
+}

+ 2 - 0
src/main/java/com/uas/erp/schedular/b2b/task/AbstractTask.java

@@ -29,6 +29,8 @@ import java.util.Date;
 import java.util.List;
 
 /**
+ * B2B轮询配置信息
+ *
  * Created by Pro1 on 2017/7/26.
  */
 public class AbstractTask {

+ 57 - 0
src/main/java/com/uas/erp/schedular/b2b/task/ProductSalerTask.java

@@ -0,0 +1,57 @@
+package com.uas.erp.schedular.b2b.task;
+
+import com.uas.erp.schedular.b2b.domain.Prod;
+import com.uas.erp.schedular.b2b.domain.ProductSaler;
+import com.uas.erp.schedular.entity.Master;
+import com.uas.erp.schedular.task.support.Method;
+import com.uas.erp.schedular.task.support.Role;
+import com.uas.erp.schedular.task.support.TaskMapping;
+import com.uas.erp.schedular.util.ContextHolder;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+
+/**
+ * 个人物料信息同步接口
+ *
+ * Created by hejq on 2018-01-12.
+ */
+@Component
+@TaskMapping(title = "个人物料信息", role = Role.PLAIN)
+public class ProductSalerTask extends AbstractTask {
+
+    /**
+     * 同步ERP的个人物料信息到平台数据库
+     *
+     * @author hejq
+     * @date 2018-01-12 19:05
+     */
+    @TaskMapping(title = "同步ERP的个人物料信息到商务平台", fixedDelay = 60000, method = Method.UPLOAD)
+    public void uploadProductSaler() {
+        List<ProductSaler> prods = jdbcTemplate.queryForBeanList("select ps_id,ps_prcode,em_uu from productsaler left join employee on productsaler.ps_emcode = employee.em_code where em_uu is not null and nvl(ps_uploadstatus, 0) <> -1 and nvl(ps_emstatus, 0) < 0 and rownum <= 200",
+                ProductSaler.class);
+        if (!CollectionUtils.isEmpty(prods)) {
+            ContextHolder.increaseDataSize(prods.size());
+            new StatusBasedHandler<ProductSaler>("productsaler", "ps_id", "ps_uploadstatus", "/erp/product/produser", prods).run();
+        }
+    }
+
+    /**
+     * ERP个人物料删除同步状态到平台
+     *
+     * @author hejq
+     * @date 2018-01-12 19:05
+     */
+    @TaskMapping(title = "ERP个人物料删除同步状态到平台", fixedDelay = 60000, method = Method.UPLOAD)
+    public void uploadProductSalerForCancel() {
+        List<ProductSaler> prods = jdbcTemplate.queryForBeanList("select ps_id,ps_prcode,em_uu from productsaler left join employee " +
+                        "on productsaler.ps_emcode = employee.em_code " +
+                        "where em_uu is not null and nvl(ps_uploadstatus, 0) <> -1 and nvl(ps_emstatus, 0) = 0 and rownum <= 200",
+                ProductSaler.class);
+        if (!CollectionUtils.isEmpty(prods)) {
+            ContextHolder.increaseDataSize(prods.size());
+            new StatusBasedHandler<ProductSaler>("productsaler", "ps_id", "ps_uploadstatus", "/erp/product/produser/quit", prods).run();
+        }
+    }
+}