Bladeren bron

增加销售记录更新接口

周箭河 5 jaren geleden
bovenliggende
commit
38943b84df

+ 15 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentPaymentRouteOrderDto.java

@@ -1,8 +1,10 @@
 package com.ym.mec.biz.dal.dto;
 
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import io.swagger.annotations.ApiModelProperty;
 
 import java.math.BigDecimal;
+import java.util.Map;
 
 public class StudentPaymentRouteOrderDto extends StudentPaymentOrder {
 
@@ -14,6 +16,7 @@ public class StudentPaymentRouteOrderDto extends StudentPaymentOrder {
     /**
      * 学校id
      */
+    @ApiModelProperty(value = "学校id",required = true)
     private Integer schoolId;
 
     /**
@@ -32,10 +35,13 @@ public class StudentPaymentRouteOrderDto extends StudentPaymentOrder {
     private String merNo;
 
     /**
-     * 备注
+     * 是否承担手续费
      */
     private String feeFlag;
 
+    @ApiModelProperty(value = "商品 id->数量",required = true)
+    private Map<Integer, Integer> goodies;
+
     public Integer getRouteOrganId() {
         return routeOrganId;
     }
@@ -83,4 +89,12 @@ public class StudentPaymentRouteOrderDto extends StudentPaymentOrder {
     public void setSchoolId(Integer schoolId) {
         this.schoolId = schoolId;
     }
+
+    public Map<Integer, Integer> getGoodies() {
+        return goodies;
+    }
+
+    public void setGoodies(Map<Integer, Integer> goodies) {
+        this.goodies = goodies;
+    }
 }

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

@@ -1,14 +1,12 @@
 package com.ym.mec.biz.service.impl;
 
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentRouteOrderDao;
-import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
+import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.PageInfoOrder;
 import com.ym.mec.biz.dal.dto.StudentPaymentRouteOrderDto;
+import com.ym.mec.biz.dal.entity.Goods;
+import com.ym.mec.biz.dal.entity.SellOrder;
 import com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.dal.enums.SporadicChargeTypeEnum;
+import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
 import com.ym.mec.biz.service.StudentPaymentRouteOrderService;
 import com.ym.mec.common.dal.BaseDAO;
@@ -34,6 +32,10 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
     private StudentPaymentOrderDao studentPaymentOrderDao;
     @Autowired
     private IdGeneratorService idGeneratorService;
+    @Autowired
+    private SellOrderDao sellOrderDao;
+    @Autowired
+    private GoodsDao goodsDao;
 
     @Override
     public BaseDAO<Long, StudentPaymentRouteOrder> getDAO() {
@@ -92,6 +94,43 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
         studentPaymentRouteOrder.setRouteBalanceAmount(BigDecimal.ZERO);
         studentPaymentRouteOrder.setFeeFlag("N");
         studentPaymentRouteOrderDao.insert(studentPaymentRouteOrder);
+
+//        if (studentPaymentRouteOrderDto.getGoodies() != null && studentPaymentRouteOrderDto.getGoodies().size() > 0) {
+//            List<SellOrder> sellOrders = new ArrayList<>();
+//            BigDecimal hasRouteAmount = BigDecimal.ZERO;
+//            studentPaymentRouteOrderDto.getGoodies().forEach((id, num) -> {
+//                Goods goods = goodsDao.get(id);
+//
+//                SellOrder sellOrder = new SellOrder();
+//                sellOrder.setOrganId(studentPaymentOrder.getOrganId());
+//                sellOrder.setSchoolId(musicGroup.getSchoolId());
+//                sellOrder.setTransNo(studentPaymentOrder.getTransNo());
+//                sellOrder.setOrderId(studentPaymentOrder.getId());
+//                sellOrder.setOrderNo(studentPaymentOrder.getOrderNo());
+//                sellOrder.setActualAmount(actualAmount);
+//                sellOrder.setBalanceAmount(balancePaymentAmount);
+//                sellOrder.setExpectAmount(actualAmount.add(balance));
+//                sellOrder.setSellCost(goods.getDiscountPrice());
+//                sellOrder.setSellCost2(goods.getAgreeCostPrice());
+//                sellOrder.setNum(1);
+//                sellOrder.setUserId(studentPaymentOrder.getUserId());
+//                sellOrder.setPaymentChannel(studentPaymentOrder.getPaymentChannel());
+//                sellOrder.setMerNo(studentPaymentOrder.getMerNos());
+//                sellOrder.setSellTime(studentPaymentOrder.getCreateTime());
+//                sellOrder.setCreateIme(new Date());
+//                sellOrder.setUpdateTime(new Date());
+//                if (goods.getType().equals(GoodsType.INSTRUMENT)) {
+//                    sellOrder.setType(SellTypeEnum.INSTRUMENT);
+//                } else if (goods.getType().equals(GoodsType.ACCESSORIES)) {
+//                    sellOrder.setType(SellTypeEnum.ACCESSORIES);
+//                } else {
+//                    sellOrder.setType(SellTypeEnum.OTHER);
+//                }
+//                sellOrders.add(sellOrder);
+//            });
+//
+//            sellOrderDao.batchInsert(sellOrders);
+//        }
         return studentPaymentRouteOrderDto;
     }
 

+ 2 - 5
mec-web/src/main/java/com/ym/mec/web/controller/StudentPaymentRouteOrderController.java

@@ -24,10 +24,7 @@ import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
 import java.util.Arrays;
@@ -86,7 +83,7 @@ public class StudentPaymentRouteOrderController extends BaseController {
     @ApiOperation(value = "添加订单")
     @PostMapping("/add")
     @PreAuthorize("@pcs.hasPermissions('routeOrder/add')")
-    public HttpResponseResult<StudentPaymentRouteOrderDto> add(StudentPaymentRouteOrderDto studentPaymentRouteOrderDto) {
+    public HttpResponseResult<StudentPaymentRouteOrderDto> add(@RequestBody StudentPaymentRouteOrderDto studentPaymentRouteOrderDto) {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         studentPaymentRouteOrderDto.setUserId(sysUser.getId());
         if (studentPaymentRouteOrderDto.getSchoolId() != null) {