|
@@ -21,18 +21,24 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
|
|
|
import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
|
|
|
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
|
|
|
import com.ym.mec.biz.dal.dto.StudentInfo;
|
|
|
import com.ym.mec.biz.dal.entity.Goods;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroup;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
|
|
|
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
|
|
|
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
|
|
|
import com.ym.mec.biz.dal.entity.StudentRegistration;
|
|
|
import com.ym.mec.biz.dal.entity.Subject;
|
|
|
import com.ym.mec.biz.dal.entity.SysUserContracts;
|
|
|
import com.ym.mec.biz.dal.entity.SysUserContracts.ContractType;
|
|
|
import com.ym.mec.biz.dal.entity.SysUserTsign;
|
|
|
import com.ym.mec.biz.dal.entity.VipGroup;
|
|
|
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
|
+import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
|
|
|
+import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
|
|
|
import com.ym.mec.biz.service.ContractService;
|
|
|
import com.ym.mec.biz.service.GoodsService;
|
|
|
import com.ym.mec.biz.service.MusicGroupService;
|
|
@@ -82,6 +88,9 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
private MusicGroupSubjectGoodsGroupService musicGroupSubjectGoodsGroupService;
|
|
|
|
|
|
@Autowired
|
|
|
+ private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private VipGroupService vipGroupService;
|
|
|
|
|
|
@Autowired
|
|
@@ -556,7 +565,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean transferGoodsContract(Integer userId, String musicGroupId, String goodsIds) {
|
|
|
+ public boolean transferGoodsContract(Integer userId, String musicGroupId, String goodsIds, KitGroupPurchaseTypeEnum kitGroupPurchaseTypeEnum) {
|
|
|
SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
|
|
|
|
|
|
if (sysUserTsign == null) {
|
|
@@ -595,12 +604,23 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
List<Goods> goodsList = goodsService.findGoodsByIds(goodsIds);
|
|
|
params.put("goodsList", goodsList);
|
|
|
|
|
|
- MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId, subjectId);
|
|
|
- if (musicGroupSubjectPlan == null) {
|
|
|
- throw new BizException("声部课程费用设置找不到");
|
|
|
+ double depositFee = 0d;
|
|
|
+ if (kitGroupPurchaseTypeEnum == KitGroupPurchaseTypeEnum.LEASE) {
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, DealStatusEnum.SUCCESS);
|
|
|
+
|
|
|
+ if (studentPaymentOrder == null) {
|
|
|
+ throw new BizException("缴费订单不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
|
|
|
+ for (StudentPaymentOrderDetail detail : orderDetailList) {
|
|
|
+ if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
|
|
|
+ depositFee = detail.getPrice().doubleValue();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- params.put("depositFee", musicGroupSubjectPlan.getDepositFee().doubleValue());
|
|
|
- params.put("depositFeeFmt", MoneyUtil.toChinese(musicGroupSubjectPlan.getDepositFee().toString()));
|
|
|
+ params.put("depositFee", depositFee);
|
|
|
+ params.put("depositFeeFmt", MoneyUtil.toChinese(depositFee + ""));
|
|
|
|
|
|
params.put("isShowVisualSeal", false);
|
|
|
|
|
@@ -642,7 +662,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String queryGoodsContract(Integer userId, String musicGroupId, String goodsIds) {
|
|
|
+ public String queryGoodsContract(Integer userId, String musicGroupId, String goodsIds, KitGroupPurchaseTypeEnum kitGroupPurchaseTypeEnum) {
|
|
|
|
|
|
// 合成freemarker
|
|
|
String srcPdfPath = contractBaseDir + "/goods/" + userId + ".pdf";
|
|
@@ -672,12 +692,23 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
List<Goods> goodsList = goodsService.findGoodsByIds(goodsIds);
|
|
|
params.put("goodsList", goodsList);
|
|
|
|
|
|
- MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId, subjectId);
|
|
|
- if (musicGroupSubjectPlan == null) {
|
|
|
- throw new BizException("声部课程费用设置找不到");
|
|
|
+ double depositFee = 0d;
|
|
|
+ if (kitGroupPurchaseTypeEnum == KitGroupPurchaseTypeEnum.LEASE) {
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, DealStatusEnum.SUCCESS);
|
|
|
+
|
|
|
+ if (studentPaymentOrder == null) {
|
|
|
+ throw new BizException("缴费订单不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
|
|
|
+ for (StudentPaymentOrderDetail detail : orderDetailList) {
|
|
|
+ if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
|
|
|
+ depositFee = detail.getPrice().doubleValue();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- params.put("depositFee", musicGroupSubjectPlan.getDepositFee().doubleValue());
|
|
|
- params.put("depositFeeFmt", MoneyUtil.toChinese(musicGroupSubjectPlan.getDepositFee().toString()));
|
|
|
+ params.put("depositFee", depositFee);
|
|
|
+ params.put("depositFeeFmt", MoneyUtil.toChinese(depositFee + ""));
|
|
|
|
|
|
params.put("isShowVisualSeal", true);
|
|
|
|