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

针对发货提醒取消增加异常统计,方便查询

hejq 7 лет назад
Родитель
Сommit
40087c9529

+ 14 - 0
src/main/java/com/uas/platform/b2b/erp/model/NoticeRecord.java

@@ -71,6 +71,12 @@ public class NoticeRecord implements Serializable {
     @OneToMany(mappedBy = "record", cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH}, fetch = FetchType.EAGER)
     private List<NoticeRecordDetail> details;
 
+    /**
+     * 明细异常数据条数
+     */
+    @Column(name = "no_errcount")
+    private Integer errorCount = 0;
+
     public Long getId() {
         return id;
     }
@@ -128,4 +134,12 @@ public class NoticeRecord implements Serializable {
         details.forEach(detail -> detail.setRecord(this));
         this.details = details;
     }
+
+    public Integer getErrorCount() {
+        return errorCount;
+    }
+
+    public void setErrorCount(Integer errorCount) {
+        this.errorCount = errorCount;
+    }
 }

+ 1 - 1
src/main/java/com/uas/platform/b2b/erp/model/NoticeRecordDetail.java

@@ -102,7 +102,7 @@ public class NoticeRecordDetail implements Serializable {
      * 单据操作备注
      */
     @Column(name = "nod_remark")
-    private String  remark;
+    private String  remark = "";
 
     public Long getId() {
         return id;

+ 7 - 2
src/main/java/com/uas/platform/b2b/erp/service/impl/NoticeRecordServiceImpl.java

@@ -51,7 +51,9 @@ public class NoticeRecordServiceImpl implements NoticeRecordService {
         record.setEnUU(enterprise.getUu());
         record.setKind("end");
         List<NoticeRecordDetail> details = new ArrayList<>();
-        notifyList.forEach(notify -> details.add(covert(notify)));
+        int errorCount = 0;
+        notifyList.forEach(notify -> details.add(covert(notify, errorCount)));
+        record.setErrorCount(errorCount);
         record.setDetails(details);
         recordDao.save(record);
     }
@@ -60,9 +62,10 @@ public class NoticeRecordServiceImpl implements NoticeRecordService {
      * 将ERP发货提醒明细转成B2B记录明细
      *
      * @param notify ERP发货提醒明细
+     * @param errorCount 异常数
      * @return NoticeRecordDetail
      */
-    private NoticeRecordDetail covert(PurchaseNotify notify) {
+    private NoticeRecordDetail covert(PurchaseNotify notify, int errorCount) {
         NoticeRecordDetail detail = new NoticeRecordDetail();
         PurchaseNotice notice = noticeDao.findOne(notify.getPn_b2bid());
         detail.setErpId(notify.getPn_id());
@@ -76,6 +79,8 @@ public class NoticeRecordServiceImpl implements NoticeRecordService {
             detail.setNoDate(notice.getDate());
             if (detail.getSendQty() == 0) {
                 detail.setOkStatus(Constant.YES);
+            } else {
+                errorCount++;
             }
         }
         return detail;