ソースを参照

管乐迷商城改造

zouxuan 1 年間 前
コミット
8c8944f66d

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -1285,6 +1285,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
         orderCreate.setReceiverRegion(nameMapByIds.getOrDefault(address.getRegion(),""));
         orderCreate.setReceiverDetailAddress(address.getAddress());
         orderCreate.setStatus(1);
+        orderCreate.setPayType(4);
         List<OrderCreate.OrderItem> orderItems = new ArrayList<>();
         for (MusicGroupPaymentCalenderGoods e : goods) {
             BigDecimal totalPrice = e.getTotalPrice();

+ 12 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SellOrderServiceImpl.java

@@ -276,12 +276,18 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
         mallOrder.setOrderNo(studentPaymentOrder.getOrderNo());
         mallOrder.setTotalAmount(sellOrders.stream().map(SellOrder::getExpectAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
         String paymentBusinessChannel = studentPaymentOrder.getPaymentBusinessChannel();
-        if (StringUtils.endsWithIgnoreCase(paymentBusinessChannel, "wx_pub") ||
-                StringUtils.endsWithIgnoreCase(paymentBusinessChannel, "WECHAT") ||
-                StringUtils.endsWithIgnoreCase(paymentBusinessChannel, "WXPay")) {
-            mallOrder.setPayType(2);
-        } else {
-            mallOrder.setPayType(1);
+        if(StringUtils.isEmpty(paymentBusinessChannel)) {
+            mallOrder.setPayType(4);
+        }else {
+            if (StringUtils.endsWithIgnoreCase(paymentBusinessChannel, "wx_pub") ||
+                    StringUtils.endsWithIgnoreCase(paymentBusinessChannel, "WECHAT") ||
+                    StringUtils.endsWithIgnoreCase(paymentBusinessChannel, "WXPay")) {
+                mallOrder.setPayType(2);
+            } else if (StringUtils.endsWithIgnoreCase(paymentBusinessChannel, "BALANCE")) {
+                mallOrder.setPayType(3);
+            }else {
+                mallOrder.setPayType(1);
+            }
         }
         Integer memberId = studentPaymentOrder.getUserId()==null?studentPaymentOrder.getCooperationId():studentPaymentOrder.getUserId();
         mallOrder.setMemberId(memberId==null?0L:memberId);

+ 20 - 20
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentRouteOrderServiceImpl.java

@@ -262,7 +262,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                         calenderDetail.setPaymentStatus(MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED);
                         calenderDetail.setPayTime(nowDate);
                     }
-                    if (calenderDetails.size() > 0) {
+                    if (CollectionUtils.isNotEmpty(calenderDetails)) {
                         musicGroupPaymentCalenderDetailDao.batchUpdate(calenderDetails);
                     }
                 }
@@ -296,7 +296,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
         studentPaymentRouteOrderDao.deleteByOrderNo(studentPaymentOrder.getOrderNo());
         //归还库存
         List<SellOrder> sellOrders = sellOrderService.getSellOrderByParentGoodsId(orderId, null);
-        if (sellOrders.size() > 0) {
+        if (CollectionUtils.isNotEmpty(sellOrders)) {
             sellOrderDao.deleteByOrderId(orderId);
         }
         return true;
@@ -321,7 +321,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
         for (String e : sheetsListMap.keySet()) {
             List<Map<String, Object>> sheet = sheetsListMap.get(e);
             List<Object> collect = sheet.stream().map(m -> m.get("交易流水号")).collect(Collectors.toList());
-            if (collect == null || collect.size() == 0) {
+            if (CollectionUtils.isEmpty(collect)) {
                 continue;
             }
             Date nowDate = new Date();
@@ -334,7 +334,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
             for (int j = 0; j < sheet.size(); j++) {
                 int rowNum = j + 2;
                 Map<String, Object> row = sheet.get(j);
-                if (row.size() == 0) {
+                if (row == null || row.isEmpty()) {
                     continue;
                 }
                 JSONObject objectMap = new JSONObject();
@@ -347,7 +347,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                     String columnValue = columns.get(s);
                     if (columnValue.equals("incomeType")) {
                         if (StringUtils.isEmpty(row.get(s).toString())) {
-                            sb.append("第" + rowNum).append("行数据导入失败:收入类型不可为空;");
+                            sb.append("第").append(rowNum).append("行数据导入失败:收入类型不可为空;");
                             continue valueIsNull;
                         } else {
                             objectMap.put("incomeType", row.get(s));
@@ -355,7 +355,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                     }
                     if (columnValue.equals("type")) {
                         if (StringUtils.isEmpty(row.get(s).toString())) {
-                            sb.append("第" + rowNum).append("行数据导入失败:订单类型不可为空;");
+                            sb.append("第").append(rowNum).append("行数据导入失败:订单类型不可为空;");
                             continue valueIsNull;
                         } else {
                             for (OrderTypeEnum orderTypeEnum : OrderTypeEnum.values()) {
@@ -369,19 +369,19 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                     }
                     if (columnValue.equals("transNo")) {
                         if (StringUtils.isEmpty(row.get(s).toString())) {
-                            sb.append("第" + rowNum).append("行数据导入失败:交易流水号不可为空;");
+                            sb.append("第").append(rowNum).append("行数据导入失败:交易流水号不可为空;");
                             continue valueIsNull;
                         }
                     }
                     if (columnValue.equals("payTime") && StringUtils.isEmpty(row.get(s).toString())) {
                         if (StringUtils.isEmpty(row.get(s).toString())) {
-                            sb.append("第" + rowNum).append("行数据导入失败:交易日期不可为空;");
+                            sb.append("第").append(rowNum).append("行数据导入失败:交易日期不可为空;");
                             continue valueIsNull;
                         }
                     }
                     if (columnValue.equals("merNo")) {
                         if (StringUtils.isEmpty(row.get(s).toString())) {
-                            sb.append("第" + rowNum).append("行数据导入失败:收款账户不可为空;");
+                            sb.append("第").append(rowNum).append("行数据导入失败:收款账户不可为空;");
                             continue valueIsNull;
                         } else {
                             objectMap.put("merNo", row.get(s));
@@ -391,7 +391,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                     if (columnValue.equals("organName") && StringUtils.isNotEmpty(row.get(s).toString())) {
                         Integer integer = organMap.get(row.get(s));
                         if (integer == null) {
-                            sb.append("第" + rowNum).append("行数据导入失败:分部名称不存在;");
+                            sb.append("第").append(rowNum).append("行数据导入失败:分部名称不存在;");
                             continue valueIsNull;
                         } else {
                             objectMap.put("routeOrganId", integer);
@@ -403,7 +403,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                         if (integer != null) {
                             objectMap.put("schoolId", integer);
                         } else {
-                            sb.append("第" + rowNum).append("行数据导入失败:所属学校名称不存在;");
+                            sb.append("第").append(rowNum).append("行数据导入失败:所属学校名称不存在;");
                             continue valueIsNull;
                         }
                         continue;
@@ -413,7 +413,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                         if (flag) {
                             objectMap.put("userId", row.get(s));
                         } else {
-                            sb.append("第" + rowNum).append("行数据导入失败:学员编号不存在;");
+                            sb.append("第").append(rowNum).append("行数据导入失败:学员编号不存在;");
                             continue valueIsNull;
                         }
                         continue;
@@ -422,10 +422,10 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                         String toString = row.get(s).toString();
                         Date date = DateUtil.stringToDate(toString, DateUtil.DEFAULT_PATTERN);
                         if (date == null) {
-                            sb.append("第" + rowNum).append("行数据导入失败:交易日期格式错误;");
+                            sb.append("第").append(rowNum).append("行数据导入失败:交易日期格式错误;");
                             continue valueIsNull;
                         } else if (date.after(nowDate)) {
-                            sb.append("第" + rowNum).append("行数据导入失败:交易日期不能大于当前日期");
+                            sb.append("第").append(rowNum).append("行数据导入失败:交易日期不能大于当前日期");
                             continue valueIsNull;
                         } else {
                             objectMap.put(columnValue, DateUtil.format(date, DateUtil.DEFAULT_PATTERN));
@@ -434,7 +434,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                     }
                     if (columnValue.equals("calenderId")) {
                         if (StringUtils.isNotBlank(row.get(s).toString()) && !schoolCalender.containsKey(row.get(s).toString())) {
-                            sb.append("第" + rowNum).append("行数据导入失败:学校缴费单号(审核通过)不存在;");
+                            sb.append("第").append(rowNum).append("行数据导入失败:学校缴费单号(审核通过)不存在;");
                             continue valueIsNull;
                         } else {
                             objectMap.put("calenderId", row.get(s));
@@ -446,7 +446,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                 StudentPaymentRouteOrder studentPaymentRouteOrder = JSONObject.parseObject(objectMap.toJSONString(), StudentPaymentRouteOrder.class);
                 //销售收入
                 if ("销售收入".equals(studentPaymentRouteOrder.getIncomeType())) {
-                    Boolean calenderFlag = studentPaymentRouteOrder.getCalenderId()==null;
+                    boolean calenderFlag = studentPaymentRouteOrder.getCalenderId()==null;
                     if (studentPaymentRouteOrder.getSaleAmount() == null) {
                         throw new BizException("导入失败:交易流水号{},收入类型为销售收入时,销售金额不可为空", studentPaymentRouteOrder.getTransNo());
                     }
@@ -461,8 +461,8 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                         throw new BizException("导入失败:有销售金额时商品编号必填");
                     }
                     if(StringUtils.isNotEmpty(goodsNums) && StringUtils.isNotEmpty(goodsIds)){
-                        List<String> goodsIdList = new ArrayList(Arrays.asList(goodsIds.split(",")));
-                        List<String> goodsNumList = new ArrayList(Arrays.asList(goodsNums.split(",")));
+                        List<String> goodsIdList = Arrays.asList(goodsIds.split(","));
+                        List<String> goodsNumList = Arrays.asList(goodsNums.split(","));
                         if (goodsIdList.size() != goodsNumList.size()) {
                             throw new BizException("导入失败:商品编号和商品数量不一致");
                         }
@@ -499,12 +499,12 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
         if(sb.length() > 0){
             throw new BizException(sb.toString());
         }
-        if (studentPaymentRouteOrders.size() > 0) {
+        if (CollectionUtils.isNotEmpty(studentPaymentRouteOrders)) {
             studentPaymentRouteOrderDao.batchAdd(studentPaymentRouteOrders);
         } else {
             throw new BizException(sb.length() > 0 ? sb.toString() : "导入失败:没有可以录入的数据");
         }
-        HttpResponseResult httpResponseResult = new HttpResponseResult();
+        HttpResponseResult<List<StudentPaymentRouteOrder>> httpResponseResult = new HttpResponseResult<List<StudentPaymentRouteOrder>>();
         httpResponseResult.setData(studentPaymentRouteOrders);
         httpResponseResult.setMsg(sb.toString());
         if (StringUtils.isNotEmpty(sb.toString())) {

+ 1 - 1
mec-common/common-core/src/main/java/com/ym/mec/common/dto/OrderCreate.java

@@ -27,7 +27,7 @@ public class OrderCreate {
 //    @ApiModelProperty("订单总金额")
     private BigDecimal totalAmount;
 
-//    @ApiModelProperty("支付类型  1->支付宝;2->微信  3余额")
+//    @ApiModelProperty("支付类型  1->支付宝;2->微信  3余额 4 录入")
     private Integer payType;
 
 //    @ApiModelProperty(value = "收货人姓名")