Просмотр исходного кода

Merge branch 'release-hejq-20190107' of ssh://10.10.101.21/source/uas_schedular into dev

hejq 7 лет назад
Родитель
Сommit
1d858a8941

+ 1 - 0
build.gradle

@@ -57,6 +57,7 @@ dependencies {
     compile "com.h2database:h2"
     compile "com.alibaba:fastjson:$fastjsonVersion"
     compile "com.uas.api:b2c-erp-api:$mallApiVersion"
+    compile "org.projectlombok:lombok:1.18.4"
 }
 
 bootRun {

+ 0 - 1
src/main/java/com/uas/erp/schedular/b2b/domain/AcceptNotify.java

@@ -35,7 +35,6 @@ public class AcceptNotify extends KeyEntity{
 		this.b2b_ss_id = b2b_ss_id;
 	}
 
-	@JsonIgnore
 	public Integer getAn_id() {
 		return an_id;
 	}

+ 20 - 2
src/main/java/com/uas/erp/schedular/b2b/domain/AcceptNotifyDetail.java

@@ -10,6 +10,7 @@ import com.uas.erp.schedular.util.StringUtil;
  */
 public class AcceptNotifyDetail {
 
+	private Long b2b_si_id;
 	private short and_detno;
 	private String and_ordercode;
 	private Short and_orderdetno;
@@ -17,6 +18,15 @@ public class AcceptNotifyDetail {
 	private Double and_inqty;
 	private Double and_price;
 	private String and_remark;
+	private Long and_id;
+
+	public Long getB2b_si_id() {
+		return b2b_si_id;
+	}
+
+	public void setB2b_si_id(Long b2b_si_id) {
+		this.b2b_si_id = b2b_si_id;
+	}
 
 	public short getAnd_detno() {
 		return and_detno;
@@ -74,8 +84,16 @@ public class AcceptNotifyDetail {
 		this.and_price = and_price;
 	}
 
+	public Long getAnd_id() {
+		return and_id;
+	}
+
+	public void setAnd_id(Long and_id) {
+		this.and_id = and_id;
+	}
+
 	public String toSqlString(int foreignKey) {
-		return "insert into AcceptNotifyDetail(and_id,and_anid,and_detno,and_ordercode,and_orderdetno,and_inqty,and_b2bqty,and_remark,and_price,and_pnid) values (AcceptNotifyDetail_seq.nextval,"
+		return "insert into AcceptNotifyDetail(and_id,and_anid,and_detno,and_ordercode,and_orderdetno,and_inqty,and_b2bqty,and_remark,and_price,and_pnid,b2b_si_id) values (AcceptNotifyDetail_seq.nextval,"
 				+ foreignKey
 				+ ","
 				+ and_detno
@@ -88,7 +106,7 @@ public class AcceptNotifyDetail {
 				+ ","
 				+ and_inqty
 				+ ",'"
-				+ StringUtil.nvl(and_remark, "") + "'," + and_price + "," + this.and_pnid + ")";
+				+ StringUtil.nvl(and_remark, "") + "'," + and_price + "," + this.and_pnid + "," + this.b2b_si_id + ")";
 	}
 
 }

+ 114 - 0
src/main/java/com/uas/erp/schedular/b2b/domain/ProdIoPay.java

@@ -0,0 +1,114 @@
+package com.uas.erp.schedular.b2b.domain;
+
+
+import java.util.Date;
+
+/**
+ * 出入库单付款信息
+ *
+ * @author hejq
+ * @date 2019-01-03 10:31
+ */
+public class ProdIoPay extends KeyEntity {
+
+    /**
+     * 单据编号
+     */
+    private String piCode;
+
+    /**
+     * 单据类型
+     */
+    private String piClass;
+
+    /**
+     * 明细行号
+     */
+    private Short piDetNo;
+
+    /**
+     * 付款金额
+     */
+    private Double amount;
+
+    /**
+     * 付款日期
+     */
+    private Date inDate;
+
+    /**
+     * 上传状态
+     */
+    private String status;
+
+    /**
+     * 明细id
+     */
+    private Long pdId;
+
+    public String getPiCode() {
+        return piCode;
+    }
+
+    public void setPiCode(String piCode) {
+        this.piCode = piCode;
+    }
+
+    public String getPiClass() {
+        return piClass;
+    }
+
+    public void setPiClass(String piClass) {
+        this.piClass = piClass;
+    }
+
+    public Short getPiDetNo() {
+        return piDetNo;
+    }
+
+    public void setPiDetNo(Short piDetNo) {
+        this.piDetNo = piDetNo;
+    }
+
+    public Double getAmount() {
+        return amount;
+    }
+
+    public void setAmount(Double amount) {
+        this.amount = amount;
+    }
+
+    public Date getInDate() {
+        return inDate;
+    }
+
+    public void setInDate(Date inDate) {
+        this.inDate = inDate;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public Long getPdId() {
+        return pdId;
+    }
+
+    public void setPdId(Long pdId) {
+        this.pdId = pdId;
+    }
+
+    /**
+     * 主键值
+     *
+     * @return
+     */
+    @Override
+    public Object getKey() {
+        return this.pdId;
+    }
+}

+ 14 - 1
src/main/java/com/uas/erp/schedular/b2b/domain/PurchaseProdInOutDetail.java

@@ -20,7 +20,20 @@ public class PurchaseProdInOutDetail {
 	private String pd_remark;//备注
 	private String pd_prodcode;//物料编号
 	private String pd_whname;//仓库名称
-	
+
+	/**
+	 * 平台送货单明细id
+	 */
+	private Long b2b_si_id;
+
+	public Long getB2b_si_id() {
+		return b2b_si_id;
+	}
+
+	public void setB2b_si_id(Long b2b_si_id) {
+		this.b2b_si_id = b2b_si_id;
+	}
+
 	public String getPd_prodcode() {
 		return pd_prodcode;
 	}

+ 24 - 4
src/main/java/com/uas/erp/schedular/b2b/task/PurchaseNotifyTask.java

@@ -11,6 +11,7 @@ import com.uas.erp.schedular.util.ContextHolder;
 import com.uas.erp.schedular.util.DateUtil;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
 
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -142,10 +143,29 @@ public class PurchaseNotifyTask extends AbstractTask {
         List<AcceptNotify> accepts = getAcceptNotify();
         if (!CollectionUtils.isEmpty(accepts)) {
             ContextHolder.setDataSize(accepts.size());
-            post("/erp/purchase/notice/accept", dataWrap(accepts));
-            // 修改状态
-            String idStr = CollectionUtil.getKeyString(accepts);
-            jdbcTemplate.execute("update AcceptNotify set an_sendstatus='已下载' where an_id in(" + idStr + ")");
+            List<AcceptNotify> acceptNotifies = postForList("/erp/purchase/notice/accept", AcceptNotify.class, dataWrap(accepts));
+            if (!CollectionUtils.isEmpty(acceptNotifies)) {
+                List<String> sqlList = new ArrayList<>();
+                for (AcceptNotify acceptNotify : acceptNotifies) {
+                    if (!StringUtils.isEmpty(acceptNotify.getB2b_ss_id())) {
+                        sqlList.add("update AcceptNotify set an_sendstatus='已下载', b2b_ss_id = " + acceptNotify.getB2b_ss_id() + " where an_id = " + acceptNotify.getAn_id());
+                        List<AcceptNotifyDetail> details = acceptNotify.getDetails();
+                        if (!CollectionUtils.isEmpty(details)) {
+                            for (AcceptNotifyDetail detail : details) {
+                                if (!StringUtils.isEmpty(detail.getB2b_si_id())) {
+                                    sqlList.add("update AcceptNotifyDetail set b2b_si_id = " + detail.getB2b_si_id() + " where and_id = " + detail.getAnd_id());
+                                }
+                            }
+                        }
+                    }
+                }
+                if (!CollectionUtils.isEmpty(sqlList)) {
+                    jdbcTemplate.batchExecute(sqlList);
+                }
+            }
+//            // 修改状态
+//            String idStr = CollectionUtil.getKeyString(accepts);
+//            jdbcTemplate.execute("update AcceptNotify set an_sendstatus='已下载' where an_id in(" + idStr + ")");
         }
     }
 

+ 15 - 0
src/main/java/com/uas/erp/schedular/b2b/task/PurchaseProdInOutTask.java

@@ -1,6 +1,7 @@
 package com.uas.erp.schedular.b2b.task;
 
 import com.uas.erp.schedular.b2b.domain.ProdInOutRefreshPrice;
+import com.uas.erp.schedular.b2b.domain.ProdIoPay;
 import com.uas.erp.schedular.b2b.domain.PurchaseProdInOut;
 import com.uas.erp.schedular.b2b.domain.PurchaseProdInOutDetail;
 import com.uas.erp.schedular.task.support.Role;
@@ -251,4 +252,18 @@ public class PurchaseProdInOutTask extends AbstractTask {
             jdbcTemplate.batchExecute(sqlList);
         }
     }
+
+    @TaskMapping(title = "更新出入单付款金额", fixedDelay = 60000)
+    public void uploadUpdateProdIoPayment() {
+        String sql = "select * from (select piCode,piClass,piDetNo,amount,inDate,status,pdId from prodIoPay where status = '待上传' " +
+                "and piClass in ('采购验收单', '采购验退单', '不良品入库单', '不良品出库单', '委外验收单', '委外验退单', '其它应付单')" +
+                " order by inDate) where rowNum <= 400";
+        List<ProdIoPay> payList = jdbcTemplate.queryForBeanList(sql, ProdIoPay.class);
+        if (!CollectionUtils.isEmpty(payList)) {
+            ContextHolder.setDataSize(payList.size());
+            post("/erp/prodIoPay", dataWrap(payList));
+            String idStr = CollectionUtil.getKeyString(payList);
+            jdbcTemplate.execute("update prodIoPay set status = '已上传' where pdId in (" + idStr + ")");
+        }
+    }
 }