qin пре 1 година
родитељ
комит
111b472120

+ 275 - 0
src/main/java/com/poteviohealth/cgp/statistics/constant/enums/OrderConstantEnum.java

@@ -0,0 +1,275 @@
+package com.poteviohealth.cgp.statistics.constant.enums;
+
+/**
+ * @description 订单相关枚举
+ * @Date 4:57 PM 2019/7/26
+ * @Author MoonJiDoo
+ **/
+public class OrderConstantEnum {
+
+    public enum OrderStatus {
+        PAY(1, "待付款"),
+        SEND(2, "待发货"),
+        STOCKING(3, "备货中"),
+        Arrival(4, "待自提"),
+        PickUp(5, "待收货"),
+        Finish(6, "已完成"),
+        Cancel(7, "已取消"),
+        AFTERSALE(8, "售后中"),
+        GROUP(9,"待成团"),
+        REFUNDING(10, "退款中"),
+        WORK(11, "待派工"),
+        SERVICE(12, "待服务"),
+        SERVICEING(13, "服务中"),
+        INVALID(14, "作废"),
+        REVIEW(15, "待审核"),
+        VISIT(16, "待回访");
+        private Integer code;
+        private String display;
+
+        OrderStatus(Integer code, String display) {
+            this.code = code;
+            this.display = display;
+        }
+
+        public Integer getCode() {
+            return code;
+        }
+
+        public String getDisplay() {
+            return display;
+        }
+    }
+
+    public enum ShowStatus {
+        PAY(1, "待付款"),
+        DOING(2, "待收货"),
+        Finish(3, "已完成"),
+        Cancel(4, "已取消");
+        private Integer code;
+        private String display;
+
+        ShowStatus(Integer code, String display) {
+            this.code = code;
+            this.display = display;
+        }
+
+        public Integer getCode() {
+            return code;
+        }
+
+        public String getDisplay() {
+            return display;
+        }
+    }
+
+    public enum DishesShowStatus {
+        PAY(1, "待付款"),
+        DOING(2, "配送中"),
+        Finish(3, "已完成"),
+        Cancel(4, "已取消"),
+        DOING_FETCH(5, "待取货");
+        private Integer code;
+        private String display;
+
+        DishesShowStatus(Integer code, String display) {
+            this.code = code;
+            this.display = display;
+        }
+
+        public Integer getCode() {
+            return code;
+        }
+
+        public String getDisplay() {
+            return display;
+        }
+    }
+
+    public enum AuditStatus {
+        WAIT(1, "待审核"),
+        SUCCESS(2, "通过"),
+        REJECT(3, "驳回");
+
+        private Integer code;
+        private String display;
+
+        AuditStatus(Integer code, String display) {
+            this.code = code;
+            this.display = display;
+        }
+
+        public Integer getCode() {
+            return code;
+        }
+
+        public String getDisplay() {
+            return display;
+        }
+    }
+
+    public enum AfterSaleStatus {
+        NONE(1, "未售后"),
+        POSSIBLE(2, "可售后"),
+        FINISH(4,"已售后"),
+        DOING(3, "售后中"),
+        NONE_EXPIRED(5,"未售后已过期"),
+        EXPIRED(6,"已售后过期");
+        private Integer code;
+        private String display;
+
+        AfterSaleStatus(Integer code, String display) {
+            this.code = code;
+            this.display = display;
+        }
+
+        public Integer getCode() {
+            return code;
+        }
+
+        public String getDisplay() {
+            return display;
+        }
+    }
+
+    public enum AddressType {
+        SIGN(0, "个人"),
+        GROUP(1, "驿站");
+
+        private Integer code;
+        private String display;
+
+        AddressType(Integer code, String display) {
+            this.code = code;
+            this.display = display;
+        }
+
+        public Integer getCode() {
+            return code;
+        }
+
+        public String getDisplay() {
+            return display;
+        }
+    }
+
+    public enum PayStatus {
+        PAY(1, "待支付"),
+        PAYMENTS(2, "支付中"),
+        SUCCESS(3, "已支付"),
+        FAIL(4, "支付失败"),
+        REFUNDING(5, "退款中"),
+        REFUND(6, "退款成功"),
+        FAILED(7, "退款失败");
+        private Integer code;
+        private String display;
+
+        PayStatus(Integer code, String display) {
+            this.code = code;
+            this.display = display;
+        }
+
+        public Integer getCode() {
+            return code;
+        }
+
+        public String getDisplay() {
+            return display;
+        }
+    }
+
+
+    public enum OrderType {
+        PRODUCT(1, "商品订单"),
+        SERVICE(2, "服务工单"),
+        DISHES(3, "点餐工单");
+        private Integer code;
+        private String display;
+
+        OrderType(Integer code, String display) {
+            this.code = code;
+            this.display = display;
+        }
+
+        public Integer getCode() {
+            return code;
+        }
+
+        public String getDisplay() {
+            return display;
+        }
+    }
+
+    public enum PayStyle {
+        UNPAY(0, "未支付"),
+        WECHAT(1, "微信支付"),
+        BANK(2, "农商行"),
+        POS(3,"POS机"),
+        INTEGRAL(4,"积分支付"),
+        ACCOUNT(5,"充值卡账户"),
+        VOUCHER(6,"养老劵支付"),
+        DISABILITY(7,"失能补贴支付"),
+        KLTWECHAT(8,"开联通微信支付"),
+        OFFLINE(9,"线下支付"),
+        FUND(10,"资金积分"),
+        SHARE(11,"共享积分");
+        private Integer code;
+        private String display;
+
+        PayStyle(Integer code, String display) {
+            this.code = code;
+            this.display = display;
+        }
+
+        public Integer getCode() {
+            return code;
+        }
+
+        public String getDisplay() {
+            return display;
+        }
+    }
+
+    public enum OrderStyle {
+        SIGN(1, "零售"),
+        GROUP(2, "团购");
+        private Integer code;
+        private String display;
+
+        OrderStyle(Integer code, String display) {
+            this.code = code;
+            this.display = display;
+        }
+
+        public Integer getCode() {
+            return code;
+        }
+
+        public String getDisplay() {
+            return display;
+        }
+    }
+
+    public enum PayWay {
+        SUBSIDY(1, "补贴支付"),
+        OWN(2, "自费"),
+        MIX(3, "混合"),
+        INTEGRAL(4, "积分支付");
+        private Integer code;
+        private String display;
+
+        PayWay(Integer code, String display) {
+            this.code = code;
+            this.display = display;
+        }
+
+        public Integer getCode() {
+            return code;
+        }
+
+        public String getDisplay() {
+            return display;
+        }
+    }
+
+}

+ 54 - 0
src/main/java/com/poteviohealth/cgp/statistics/utils/OrderExcelTask.java

@@ -2,9 +2,13 @@ package com.poteviohealth.cgp.statistics.utils;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.common.collect.Lists;
+import com.poteviohealth.cgp.common.integrated.order.model.PayAccount;
+import com.poteviohealth.cgp.statistics.constant.enums.OrderConstantEnum;
 import com.poteviohealth.cgp.statistics.mapper.OrderMapper;
 import com.poteviohealth.cgp.statistics.model.outdto.OrderExcelDTO;
 import lombok.Data;
+import org.apache.commons.lang3.EnumUtils;
+import org.apache.commons.lang3.StringUtils;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -45,6 +49,38 @@ public class OrderExcelTask extends RecursiveTask<List<OrderExcelDTO>> {
                 if(page == 1){
                     list.addAll(orderMapper.orderExcel(queryWrapper,dbName,operatorId,(end-1)*MAX,MAX));
                 }
+
+            for (OrderExcelDTO orderExcelDTO : list) {
+                for (OrderConstantEnum.OrderStatus status : EnumUtils.getEnumList(OrderConstantEnum.OrderStatus.class)) {
+                    if (status.getCode().toString().equals(orderExcelDTO.getOrderStatus())) {
+                        orderExcelDTO.setOrderStatus(status.getDisplay());
+                        break;
+                    }
+                }
+
+                for (OrderConstantEnum.PayStyle status : EnumUtils.getEnumList(OrderConstantEnum.PayStyle.class)) {
+                    if (status.getCode().toString().equals(orderExcelDTO.getPayStyle())) {
+                        orderExcelDTO.setPayStyle(status.getDisplay());
+                        break;
+                    }
+                }
+
+                for (OrderConstantEnum.PayStatus status : EnumUtils.getEnumList(OrderConstantEnum.PayStatus.class)) {
+                    if (status.getCode().toString().equals(orderExcelDTO.getPayStatus())) {
+                        orderExcelDTO.setPayStatus(status.getDisplay());
+                        break;
+                    }
+                }
+
+                for (OrderConstantEnum.OrderStyle status : EnumUtils.getEnumList(OrderConstantEnum.OrderStyle.class)) {
+                    if (status.getCode().toString().equals(orderExcelDTO.getOrderStyle())) {
+                        orderExcelDTO.setOrderStyle(status.getDisplay());
+                        break;
+                    }
+                }
+                orderExcelDTO.setPayAccount(getPayAccountString(orderExcelDTO.getPayAccount()));
+                orderExcelDTO.setStationOrGroupName(StringUtils.isNotBlank(orderExcelDTO.getGroupLeaderName())?orderExcelDTO.getGroupLeaderName():orderExcelDTO.getServiceStationName());
+            }
             return list;
         } else {
             // 将任务分解
@@ -69,4 +105,22 @@ public class OrderExcelTask extends RecursiveTask<List<OrderExcelDTO>> {
             }
         }
     }
+
+    private String getPayAccountString(String payAccount){
+        StringBuilder sb = new StringBuilder();
+        for (String s : payAccount.split(",")) {
+            if(StringUtils.isNotBlank(s)){
+                for (PayAccount account : EnumUtils.getEnumList(PayAccount.class)) {
+                    if(account.getCode().equals(Integer.parseInt(s))){
+                        sb.append(account.getDisplay()+",");
+                        break;
+                    }
+                }
+            }
+        }
+        if(sb.length()>0){
+            return sb.substring(0,sb.length()-1);
+        }
+        return "";
+    }
 }