|
@@ -16,6 +16,7 @@ import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
+import com.ym.mec.common.page.QueryInfo;
|
|
|
import com.ym.mec.common.service.IdGeneratorService;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
|
|
@@ -25,7 +26,6 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Isolation;
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -104,7 +104,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional(rollbackFor = Exception.class,isolation = Isolation.SERIALIZABLE)
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
public Map addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception {
|
|
|
//关闭老订单
|
|
|
if(StringUtils.isNotEmpty(studentGoodsSell.getOrderNo())){
|
|
@@ -119,6 +119,8 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
if (orderByOrderNo.getBalancePaymentAmount() != null && orderByOrderNo.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
sysUserCashAccountService.updateBalance(orderByOrderNo.getUserId(), orderByOrderNo.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "关闭订单");
|
|
|
}
|
|
|
+ studentGoodsSell = studentGoodsSellDao.findByOrderNo(studentGoodsSell.getOrderNo());
|
|
|
+ studentGoodsSell.setGoodsSellDtos(JSON.parseArray(studentGoodsSell.getGoodsJson(),GoodsSellDto.class));
|
|
|
}
|
|
|
Integer studentId = studentGoodsSell.getUserId();
|
|
|
List<GoodsSellDto> goodsSellDtos = studentGoodsSell.getGoodsSellDtos();
|
|
@@ -130,13 +132,27 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
}
|
|
|
studentDao.lockUser(studentId);
|
|
|
SysUser student = sysUserFeignService.queryUserById(studentId);
|
|
|
+ //如果教务老师为空,代表学员自己创建的订单
|
|
|
if(studentGoodsSell.getTeacherId() == null){
|
|
|
- //获取学员第一个教务老师
|
|
|
- studentGoodsSell.setTeacherId(musicGroupDao.getFirstEduTeacherId(studentGoodsSell.getUserId()));
|
|
|
+ //获取学生关联的所有教务老师列表
|
|
|
+ List<Integer> stuEducation = studentRepairDao.countStuEducation(studentId);
|
|
|
+ if (stuEducation != null && stuEducation.size() == 1){
|
|
|
+ //获取学员乐团关联的教务
|
|
|
+ MusicGroup musicGroup = musicGroupDao.getStuMusic(studentId);
|
|
|
+ studentGoodsSell.setTeacherId(stuEducation.get(0));
|
|
|
+ if(musicGroup != null){
|
|
|
+ studentGoodsSell.setCooperationOrganId(musicGroup.getCooperationOrganId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if(studentGoodsSell.getCooperationOrganId() == null){
|
|
|
+ //获取教务老师,学员关联的乐团
|
|
|
+ MusicGroup musicGroup = musicGroupDao.getStuEduMusic(studentId,studentGoodsSell.getTeacherId());
|
|
|
+ if(musicGroup != null){
|
|
|
+ studentGoodsSell.setCooperationOrganId(musicGroup.getCooperationOrganId());
|
|
|
+ }
|
|
|
}
|
|
|
List<Integer> goodsIds = goodsSellDtos.stream().map(e -> e.getGoodsId()).collect(Collectors.toList());
|
|
|
|
|
|
-// String[] goodsIds = goodsJson.split(",");
|
|
|
Map<Integer, BigDecimal> map = getMap("goods", "id_", "market_price_", goodsIds, Integer.class, BigDecimal.class);
|
|
|
for (GoodsSellDto goodsSellDto : goodsSellDtos) {
|
|
|
goodsSellDto.setGoodsPrice(map.get(goodsSellDto.getGoodsId()));
|
|
@@ -226,7 +242,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional(rollbackFor = Exception.class,isolation = Isolation.SERIALIZABLE)
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
public Map studentPaymentGoodsOrder(Integer goodsSellId) throws Exception {
|
|
|
StudentGoodsSell studentGoodsSell = studentGoodsSellDao.get(goodsSellId);
|
|
|
Integer studentId = studentGoodsSell.getUserId();
|
|
@@ -691,6 +707,31 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public PageInfo<BasicUserDto> queryEduStudents(QueryInfo queryInfo) {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ throw new BizException("请登录");
|
|
|
+ }
|
|
|
+ PageInfo<BasicUserDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ MapUtil.populateMap(params, queryInfo);
|
|
|
+ params.put("teacherId",sysUser.getId());
|
|
|
+
|
|
|
+ List<BasicUserDto> dataList = null;
|
|
|
+ int count = studentRepairDao.countEduStudents(params);
|
|
|
+ if (count > 0) {
|
|
|
+ pageInfo.setTotal(count);
|
|
|
+ params.put("offset", pageInfo.getOffset());
|
|
|
+ dataList = studentRepairDao.queryEduStudents(params);
|
|
|
+ }
|
|
|
+ if (count == 0) {
|
|
|
+ dataList = new ArrayList<>();
|
|
|
+ }
|
|
|
+ pageInfo.setRows(dataList);
|
|
|
+ return pageInfo;
|
|
|
+ }
|
|
|
+
|
|
|
private void saveSellOrder(String orderNo){
|
|
|
StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(orderNo);
|
|
|
StudentGoodsSell studentGoodsSell = studentGoodsSellDao.findByOrderNo(orderNo);
|
|
@@ -728,6 +769,8 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
sellOrder.setPaymentChannel(orderByOrderNo.getPaymentChannel());
|
|
|
sellOrder.setMerNo(orderByOrderNo.getMerNos());
|
|
|
sellOrder.setSellTime(orderByOrderNo.getPayTime());
|
|
|
+ sellOrder.setEduTeacherId(studentGoodsSell.getTeacherId());
|
|
|
+ sellOrder.setCooperationOrganId(studentGoodsSell.getCooperationOrganId());
|
|
|
sellOrders.add(sellOrder);
|
|
|
});
|
|
|
if(sellOrders.size() > 0){
|