Prechádzať zdrojové kódy

Merge branch 'zx_saas_goods' of http://git.dayaedu.com/yonge/mec into test

zouxuan 1 rok pred
rodič
commit
708aeb5f9e

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java

@@ -1736,6 +1736,7 @@ public class ExportServiceImpl implements ExportService {
         Map<String, Object> params = new HashMap<>();
         MapUtil.populateMap(params, queryInfo);
         params.put("notGroupType","MALL_SELL");
+        params.put("notType","SCHOOL_GOODS_PURCHASE");
         int count = studentPaymentOrderService.getDao().queryCount(params);
         if (count <= 0) {
             return BaseController.failed("没有可导出的数据");
@@ -1792,6 +1793,7 @@ public class ExportServiceImpl implements ExportService {
         }
         Map<String, Object> params = new HashMap<>();
         MapUtil.populateMap(params, queryInfo);
+        params.put("notType","SCHOOL_GOODS_PURCHASE");
         int count = studentPaymentOrderService.getDao().queryCount(params);
         if (count <= 0) {
             return BaseController.failed("没有可导出的数据");

+ 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();

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

@@ -4287,7 +4287,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                     continue;
                 }
                 JSONObject objectMap = new JSONObject();
-                valueIsNull: for (String s : row.keySet()) {
+                for (String s : row.keySet()) {
                     String columnValue = columns.get(s);
                     if (StringUtils.isEmpty(columnValue)) {
                         continue;

+ 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);

+ 37 - 34
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,6 +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;
                     if (studentPaymentRouteOrder.getSaleAmount() == null) {
                         throw new BizException("导入失败:交易流水号{},收入类型为销售收入时,销售金额不可为空", studentPaymentRouteOrder.getTransNo());
                     }
@@ -453,30 +454,32 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                     String goodsIds = studentPaymentRouteOrder.getGoodsIds();
                     String goodsNums = studentPaymentRouteOrder.getGoodsNums();
 
-                    if (StringUtils.isEmpty(goodsNums)) {
+                    if (calenderFlag && StringUtils.isEmpty(goodsNums)) {
                         throw new BizException("导入失败:有销售金额时商品数量必填");
                     }
-                    if (StringUtils.isEmpty(goodsIds)) {
+                    if (calenderFlag && StringUtils.isEmpty(goodsIds)) {
                         throw new BizException("导入失败:有销售金额时商品编号必填");
                     }
-                    List<String> goodsIdList = new ArrayList(Arrays.asList(goodsIds.split(",")));
-                    List<String> goodsNumList = new ArrayList(Arrays.asList(goodsNums.split(",")));
-                    if (goodsIdList.size() != goodsNumList.size()) {
-                        throw new BizException("导入失败:商品编号和商品数量不一致");
-                    }
-                    JSONObject goodsJSON = new JSONObject();
-                    for (int i = 0; i < goodsIdList.size(); i++) {
-                        if (!goodsDao.findByIdAndStatus(goodsIdList.get(i), 1)) {
-                            throw new BizException("导入失败:商品编号{}不存在", goodsIdList.get(i));
+                    if(StringUtils.isNotEmpty(goodsNums) && StringUtils.isNotEmpty(goodsIds)){
+                        List<String> goodsIdList = Arrays.asList(goodsIds.split(","));
+                        List<String> goodsNumList = Arrays.asList(goodsNums.split(","));
+                        if (goodsIdList.size() != goodsNumList.size()) {
+                            throw new BizException("导入失败:商品编号和商品数量不一致");
                         }
-                        try {
-                            int goodsNum = Integer.parseInt(goodsNumList.get(i));
-                            goodsJSON.put(goodsIdList.get(i), goodsNum);
-                        } catch (Exception e1) {
-                            throw new BizException("导入失败:商品数量{}填写错误", goodsNumList.get(i));
+                        JSONObject goodsJSON = new JSONObject();
+                        for (int i = 0; i < goodsIdList.size(); i++) {
+                            if (!goodsDao.findByIdAndStatus(goodsIdList.get(i), 1)) {
+                                throw new BizException("导入失败:商品编号{}不存在", goodsIdList.get(i));
+                            }
+                            try {
+                                int goodsNum = Integer.parseInt(goodsNumList.get(i));
+                                goodsJSON.put(goodsIdList.get(i), goodsNum);
+                            } catch (Exception e1) {
+                                throw new BizException("导入失败:商品数量{}填写错误", goodsNumList.get(i));
+                            }
                         }
+                        studentPaymentRouteOrder.setGoodsJson(goodsJSON.toJSONString());
                     }
-                    studentPaymentRouteOrder.setGoodsJson(goodsJSON.toJSONString());
                     //服务收入
                 } else {
                     studentPaymentRouteOrder.setSaleAmount(BigDecimal.ZERO);
@@ -496,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())) {

+ 4 - 1
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml

@@ -417,13 +417,16 @@
     </sql>
     <sql id="queryPaymentOrder">
         <where>
-        	spo.tenant_id_ = #{tenantId} AND spo.type_ != 'SCHOOL_GOODS_PURCHASE'
+        	spo.tenant_id_ = #{tenantId}
             <if test="userIds != null">
                 AND spo.user_id_ IN
                 <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
                     #{userId}
                 </foreach>
             </if>
+            <if test="notType != null and notType != ''">
+                AND spo.type_ != #{notType}
+            </if>
             <if test="organId != null">
                 AND FIND_IN_SET(spo.organ_id_,#{organId})
             </if>

+ 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 = "收货人姓名")