|
@@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
-import com.ym.mec.biz.dal.dao.StudentDao;
|
|
|
-import com.ym.mec.biz.dal.dao.StudentGoodsSellDao;
|
|
|
-import com.ym.mec.biz.dal.dao.StudentRepairDao;
|
|
|
-import com.ym.mec.biz.dal.dao.SysConfigDao;
|
|
|
+import com.ym.mec.biz.dal.dao.*;
|
|
|
import com.ym.mec.biz.dal.dto.BasicUserDto;
|
|
|
import com.ym.mec.biz.dal.dto.GoodsSellDto;
|
|
|
import com.ym.mec.biz.dal.dto.RepairGoodsDto;
|
|
@@ -52,7 +49,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
@Autowired
|
|
|
private StudentPaymentOrderService studentPaymentOrderService;
|
|
|
@Autowired
|
|
|
- private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
|
|
|
+ private MusicGroupDao musicGroupDao;
|
|
|
@Autowired
|
|
|
private SysUserCashAccountService sysUserCashAccountService;
|
|
|
@Autowired
|
|
@@ -109,8 +106,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class,isolation = Isolation.SERIALIZABLE)
|
|
|
public Map addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- Integer studentId = sysUser.getId();
|
|
|
+ Integer studentId = studentGoodsSell.getUserId();
|
|
|
List<GoodsSellDto> goodsSellDtos = studentGoodsSell.getGoodsSellDtos();
|
|
|
if(goodsSellDtos == null || goodsSellDtos.size() == 0){
|
|
|
throw new BizException("请选择需要购买的商品");
|
|
@@ -122,7 +118,10 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
SysUser student = sysUserFeignService.queryUserById(studentId);
|
|
|
String orderNo = idGeneratorService.generatorId("payment") + "";
|
|
|
studentGoodsSell.setOrderNo(orderNo);
|
|
|
-
|
|
|
+ if(studentGoodsSell.getTeacherId() == null){
|
|
|
+ //获取学员第一个教务老师
|
|
|
+ studentGoodsSell.setTeacherId(musicGroupDao.getFirstEduTeacherId(studentGoodsSell.getUserId()));
|
|
|
+ }
|
|
|
List<Integer> goodsIds = goodsSellDtos.stream().map(e -> e.getGoodsId()).collect(Collectors.toList());
|
|
|
|
|
|
// String[] goodsIds = goodsJson.split(",");
|
|
@@ -141,7 +140,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
if(amount.signum() < 0){
|
|
|
throw new BizException("操作失败:订单金额异常");
|
|
|
}
|
|
|
- studentGoodsSell.setOrganId(sysUser.getOrganId());
|
|
|
+ studentGoodsSell.setOrganId(student.getOrganId());
|
|
|
studentGoodsSell.setTotalAmount(amount);
|
|
|
studentGoodsSell.setGoodsJson(JSONObject.toJSONString(goodsSellDtos));
|
|
|
if(studentGoodsSell.getId() == null){
|