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