|
|
@@ -1,10 +1,12 @@
|
|
|
package com.uas.erp.schedular.publicproduct.task;
|
|
|
|
|
|
-import com.uas.erp.schedular.publicproduct.domain.ProductReplace;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.uas.api.b2c_erp.seller.service.ProductReplaceService;
|
|
|
+import com.uas.erp.schedular.publicproduct.domain.ProductReplaceErp;
|
|
|
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.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
@@ -19,6 +21,9 @@ import java.util.List;
|
|
|
@TaskMapping(title = "个人物料信息", role = Role.PLAIN)
|
|
|
public class ProdUserTask extends AbstractTask {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ProductReplaceService productReplaceService;
|
|
|
+
|
|
|
/**
|
|
|
* 同步ERP的个人物料信息到公共服务
|
|
|
*
|
|
|
@@ -27,27 +32,16 @@ public class ProdUserTask extends AbstractTask {
|
|
|
*/
|
|
|
@TaskMapping(title = "同步ERP的个人物料信息到公共服务", fixedDelay = 60000, method = Method.UPLOAD)
|
|
|
public void uploadProductSaler() {
|
|
|
- List<ProductReplace> prods = jdbcTemplate.queryForBeanList("select ps_id,ps_prcode ps_code,nvl(em_uu,0) em_uu,nvl((select en_uu from enterprise ),0) en_uu from productSaler, employee, product where em_code = ps_emcode and nvl(em_uu, 0)<>0 and pr_code = ps_prcode and nvl(pr_sendstatus, ' ') = '已上传' and nvl(pr_status, ' ') = '已审核' and nvl(ps_emstatus,' ') = '是' and nvl(ps_uploadstatus, ' ') <> '已上传' and rownum <= 200",
|
|
|
- ProductReplace.class);
|
|
|
+ List<ProductReplaceErp> prods = jdbcTemplate.queryForBeanList("select BPR_ID,BPR_STATUSCODE,BPR_SENDSTATUS,BPR_PRODCODE,BPR_REPCODE,BPR_DATE,BPR_PRODBRAND,BPR_PRODOSCODE,BPR_REPBAND,BPR_REPOSCODE,BPR_ENUU " +
|
|
|
+ "from B2B_PRODREPLACE where nvl(BPR_SENDSTATUS,' ')<>'已上传' and rownum <400 ",
|
|
|
+ ProductReplaceErp.class);
|
|
|
+ String jsons = JSON.toJSONString(prods);
|
|
|
if (!CollectionUtils.isEmpty(prods)) {
|
|
|
- ContextHolder.increaseDataSize(prods.size());
|
|
|
- postForList("/erp/productReplace/update", ProductReplace.class, dataWrap(prods));
|
|
|
+ productReplaceService.update(jsons);
|
|
|
}
|
|
|
- }
|
|
|
- /**
|
|
|
- * 同步ERP的个人物料信息到公共服务(取消关联)
|
|
|
- *
|
|
|
- * @author wuyx
|
|
|
- * @date 2018-01-30 08:16
|
|
|
- */
|
|
|
- /* @TaskMapping(title = "同步取消公共服务ERP的个人物料信息", fixedDelay = 60000, method = Method.UPLOAD)
|
|
|
- public void uploadProductSalerQuit() {
|
|
|
- List<ProductSaler> prods = jdbcTemplate.queryForBeanList("select ps_id,ps_prcode ps_code,nvl(em_uu,0) em_uu,nvl((select en_uu from enterprise ),0) en_uu from productSaler, employee, product where em_code = ps_emcode and nvl(em_uu, 0)<>0 and pr_code = ps_prcode and nvl(pr_sendstatus, ' ') = '已上传' and nvl(pr_status, ' ') = '已审核' and nvl(ps_emstatus,' ') = '否' and nvl(ps_uploadstatus, ' ') <> '已上传' and rownum <= 200",
|
|
|
- ProductSaler.class);
|
|
|
- if (!CollectionUtils.isEmpty(prods)) {
|
|
|
- ContextHolder.increaseDataSize(prods.size());
|
|
|
- new StatusBasedHandler<ProductSaler>("productsaler", "ps_id", "ps_uploadstatus", "/product/produser/quit", prods).run();
|
|
|
+ for(ProductReplaceErp erp : prods){
|
|
|
+ String sql = "update B2B_PRODREPLACE set BPR_SENDSTATUS = '已上传' where BPR_ID = " + erp.getBPR_ID();
|
|
|
+ jdbcTemplate.execute(sql);
|
|
|
}
|
|
|
- }*/
|
|
|
-
|
|
|
+ }
|
|
|
}
|