Przeglądaj źródła

Merge branch 'dev' of ssh://10.10.101.21/source/platform-b2b

hejq 7 lat temu
rodzic
commit
97fadb8923

+ 104 - 0
src/main/java/com/uas/platform/b2b/result/ResultCode.java

@@ -0,0 +1,104 @@
+package com.uas.platform.b2b.result;
+
+/**
+ * 返回结果状态码
+ *
+ * @author hejq
+ * @date 2018-10-22 9:18
+ */
+public enum ResultCode {
+
+    /**
+     * 操作失败
+     */
+    ERROR(0, "ERROR"),
+
+    /**
+     * 操作成功
+     */
+    OK(1, "SUCCESS"),
+    /**
+     * 参数信息缺失
+     */
+    NO_INFO(2, "NO_INFO"),
+    /**
+     * 操作实体信息不全
+     */
+    NOT_COMPLETE_INFO(3, "NOT_COMPLETE_INFO"),
+    /**
+     * 操作实体已存在
+     */
+    SAVED(4, "SAVED"),
+    /**
+     * 非法状态
+     */
+    ERROR_STATE(5, "ERROR_STATE"),
+    /**
+     * 操作不允许
+     */
+    NOT_PERMIT(6, "NOT_PERMIT"),
+    /**
+     * 操作实体不存在
+     */
+    NOT_EXiST(7, "NOT_EXiST"),
+    /**
+     * 参数异常,不在取值范围之内等原因
+     */
+    PARAMETER_ERROR(8, "PARAMETER_ERROR"),
+    /**
+     * 系统的基础参数不存在
+     */
+    SYSTEM_NOT_EXIST(9, "SYSTEM_NOT_EXIST"),
+
+    /**
+     * 系统异常
+     */
+    SYSTEM_ERROR(10, "SYSTEM_ERROR"),
+
+    /**
+     * 信息不一致
+     */
+    INFO_UPDATE(11, "信息不一致"),
+
+    /**
+     * 超时请求
+     */
+    TIME_OUT(12, "TIME_OUT"),
+
+    /**
+     * 无操作权限
+     */
+    NO_AUTHORITY(13, "NO_AUTHORITY"),
+
+    /**
+     * 信息已修改
+     */
+    INFO_MODIFY(14, "INFO_MODIFY"),
+
+    /**
+     * 信息未修改
+     */
+    INFO_NO_MODIFY(15, "INFO_NO_MODIFY");
+
+    private int code;
+
+    private String message;
+
+    ResultCode(int code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public int code() {
+        return this.code;
+    }
+
+    public String message() {
+        return this.message;
+    }
+
+    @Override
+    public String toString() {
+        return Integer.toString(code);
+    }
+}

+ 124 - 0
src/main/java/com/uas/platform/b2b/result/ResultMap.java

@@ -0,0 +1,124 @@
+package com.uas.platform.b2b.result;
+
+
+/**
+ * 封装返回数据格式
+ *
+ * @author hejq
+ * @date 2018-10-22 9:15
+ */
+public class ResultMap {
+
+    /**
+     * 返回状态码
+     */
+    private int code;
+
+    /**
+     * 返回数据
+     */
+    private Object data;
+
+    /**
+     * 消息
+     */
+    private String message;
+
+    /**
+     * 是否成功
+     */
+    private boolean success;
+
+    public int getCode() {
+        return code;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+
+    public Object getData() {
+        return data;
+    }
+
+    public void setData(Object data) {
+        this.data = data;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public boolean isSuccess() {
+        return success;
+    }
+
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+    public ResultMap() {
+
+    }
+
+    /**
+     * 通过传入数据封装返回内容
+     *
+     * @param code 状态码
+     * @param message message提示
+     */
+    public ResultMap(int code, String message) {
+        if (ResultCode.OK.code() == code) {
+            this.success = true;
+        } else {
+            this.success = false;
+        }
+        this.code = code;
+        this.message = message;
+    }
+
+    /**
+     * 返回成功
+     *
+     * @param message 消息提示
+     * @return ResultMap
+     */
+    public static ResultMap success(String message) {
+        ResultMap result = new ResultMap(ResultCode.OK.code(), message);
+        return result;
+    }
+
+    /**
+     * 返回成功
+     *
+     * @return ResultMap
+     */
+    public static ResultMap success() {
+        ResultMap result = new ResultMap(ResultCode.OK.code(), ResultCode.OK.message());
+        return result;
+    }
+
+
+    /**
+     * 返回失败
+     *
+     * @param e 异常
+     * @return ResultMap
+     */
+    public static ResultMap error(Exception e) {
+        return new ResultMap(ResultCode.ERROR.code(), e.getMessage());
+    }
+
+    /**
+     * 返回失败
+     *
+     * @return ResultMap
+     */
+    public static ResultMap error() {
+        return new ResultMap(ResultCode.ERROR.code(), ResultCode.ERROR.message());
+    }
+}

+ 4 - 2
src/main/java/com/uas/platform/b2b/service/impl/InvitationRecordServiceImpl.java

@@ -105,11 +105,13 @@ public class InvitationRecordServiceImpl implements InvitationRecordService {
 			}
 		}
 		// 先判断记录
-		InvitationRecord oldRecord = invitationRecordDao.findByUseruuAndVendname(userUU, record.getVendname());
+		InvitationRecord oldRecord;
 		// 如果是已存在的,直接替换
 		if (record.getId() != null) {
             oldRecord = invitationRecordDao.findOne(record.getId());
-		}
+		} else {
+            oldRecord = invitationRecordDao.findByUseruuAndVendname(userUU, record.getVendname());
+        }
 		if (oldRecord != null) {
             oldRecord.setCount(oldRecord.getCount() + 1);
             oldRecord.setDate(new Date(System.currentTimeMillis()));

+ 8 - 4
src/main/java/com/uas/platform/b2b/service/impl/OrderRedDotServiceImpl.java

@@ -120,8 +120,10 @@ public class OrderRedDotServiceImpl implements OrderRedDotService {
         List<OrderRedDotAll> redDotAllList = redDotAllDao.findAll(idList);
         List<OrderRedDotDone> redDotDoneList = new ArrayList<>();
         redDotAllList.forEach(redDotAll -> {
-            OrderRedDotDone redDotDone = new OrderRedDotDone(redDotAll);
-            redDotDoneList.add(redDotDone);
+            if (null != redDotAll) {
+                OrderRedDotDone redDotDone = new OrderRedDotDone(redDotAll);
+                redDotDoneList.add(redDotDone);
+            }
         });
         if (!CollectionUtil.isEmpty(redDotDoneList)) {
             redDotDoneDao.save(redDotDoneList);
@@ -141,8 +143,10 @@ public class OrderRedDotServiceImpl implements OrderRedDotService {
             Integer count = countByOrderTypeAndOrderId(orderType, id);
             if (count == 0) {
                 OrderRedDotAll redDotAll = redDotAllDao.findByOrderTypeAndOrderId(orderType, id);
-                OrderRedDotDone redDotDone = new OrderRedDotDone(redDotAll);
-                redDotDoneList.add(redDotDone);
+                if (null != redDotAll) {
+                    OrderRedDotDone redDotDone = new OrderRedDotDone(redDotAll);
+                    redDotDoneList.add(redDotDone);
+                }
             }
         });
         if (!CollectionUtil.isEmpty(redDotDoneList)) {

+ 1 - 0
src/main/java/com/uas/platform/b2b/service/impl/PurcInquiryServiceImpl.java

@@ -381,6 +381,7 @@ public class PurcInquiryServiceImpl implements PurcInquiryService {
         PurchaseInquiryItem item = purchaseInquiryItemDao.findOne(id);
         item.setAgreed(Constant.YES);
         item.setStatus((short) Status.REPLIED.value());
+        item.setDecideStatus((short) Status.NOT_UPLOAD.value());
         item = purchaseInquiryItemDao.save(item);
         if (item.getAgreed().equals(Constant.YES) && item.getStatus().equals((short) Status.REPLIED.value())) {
             map.put("success", "采纳成功");

BIN
src/main/resources/jxls-tpl/sale/purchaseInquiry.xls