Compare commits

...

11 Commits

26 changed files with 390 additions and 108 deletions

View File

@@ -7,10 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.alibaba.fastjson.JSONObject;
import com.peanut.common.utils.DateUtils;
import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.R;
import com.peanut.common.utils.ShiroUtils;
import com.peanut.common.utils.*;
import com.peanut.config.Constants;
import com.peanut.config.DelayQueueConfig;
import com.peanut.modules.book.service.*;
@@ -41,6 +38,7 @@ import com.peanut.modules.pay.weChatPay.dto.WechatPaymentInfo;
import com.peanut.modules.pay.weChatPay.service.WxpayService;
import com.peanut.modules.sys.entity.SysConfigEntity;
import com.peanut.modules.sys.service.SysConfigService;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpException;
import org.apache.poi.ss.usermodel.Row;
@@ -152,7 +150,9 @@ public class BuyOrderController {
*/
@RequestMapping(path = "/orderList", method = RequestMethod.POST)
public R orderList(@RequestBody BuyOrderListRequestVo requestVo) {
Page<BuyOrder> buyOrderPage = buyOrderService.orderList(requestVo);
HttpServletRequest request = HttpContextUtil.getHttpServletRequest();
Boolean isHT = request.getHeader("appType")==null?true:false;
Page<BuyOrder> buyOrderPage = buyOrderService.orderList(requestVo, isHT);
return R.ok().put("result", buyOrderPage);
}
//导出名医精彩订单
@@ -673,6 +673,9 @@ public class BuyOrderController {
|| Constants.ORDER_STATUS_OUT_OF_TIME.equals(buyOrder.getOrderStatus())) {
return R.error("当前订单状态不支持退单");
}
if(buyOrder.getOrderType().equals("vip")&& buyOrderService.hasYQOrder(buyOrder)){
return R.error("需要先退掉当前VIP下的延期");
}
//设置状态为退款中
buyOrder.setOrderStatus(Constants.ORDER_STATUS_REFUNDING);
buyOrderService.updateById(buyOrder);

View File

@@ -388,10 +388,12 @@ public class ShopProductController {
shopProduct.setBookId("");
}
shopProductService.save(shopProduct);
ShopProductBookEntity shopProductBookEntity = new ShopProductBookEntity();
for (String s : shopProduct.getBookids()) {
String bookIdList = s;
if (bookIdList != null) {
ShopProductBookEntity shopProductBookEntity = new ShopProductBookEntity();
Integer product = shopProduct.getProductId();
shopProductBookEntity.setProductId(product);
shopProductBookEntity.setBookId(Integer.valueOf(bookIdList));

View File

@@ -55,6 +55,8 @@ public interface BuyOrderService extends IService<BuyOrder> {
*/
R delivery(String expressCompanyCode, List<Integer> buyOrderDetailId);
Page<BuyOrder> orderList(BuyOrderListRequestVo requestVo, Boolean isHT);
Page<BuyOrder> getUserOrderList(UserOrderDto userOrderDto);
List<BuyOrder> getUserOrderStatusNum(Integer userId);
@@ -74,4 +76,6 @@ public interface BuyOrderService extends IService<BuyOrder> {
BigDecimal getRefundFee(Map<String, Object> params, BuyOrder buyOrder);
void refundOrder(BuyOrder buyOrder, MyUserEntity user, int refundId);
boolean hasYQOrder(BuyOrder buyOrder);
}

View File

@@ -116,6 +116,8 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
private UserVipLogDao userVipLogDao;
@Autowired
private UserVipDao userVipDao;
@Autowired
private VipBuyConfigDao vipBuyConfigDao;
// TODO 新版本上线后删除
@Override
@@ -383,6 +385,15 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
@Override
public Page<BuyOrder> orderList(BuyOrderListRequestVo requestVo) {
Page<BuyOrder> buyOrderPage = this.getOrderList(requestVo,null);
return buyOrderPage;
}
@Override
public Page<BuyOrder> orderList(BuyOrderListRequestVo requestVo, Boolean isHT) {
Page<BuyOrder> buyOrderPage = this.getOrderList(requestVo,isHT);
return buyOrderPage;
}
public Page<BuyOrder> getOrderList(BuyOrderListRequestVo requestVo,Boolean isHT){
MPJLambdaWrapper<BuyOrder> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(BuyOrder.class);
wrapper.leftJoin(MyUserEntity.class, MyUserEntity::getId,BuyOrder::getUserId);
@@ -443,6 +454,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
if(paymentDateTime > timestamp-7*24*60*60*1000){
refundableStatus = true;
}
refundableStatus = isHT?true:refundableStatus;
b.setVipBuyConfigEntity(vipBuyConfigService.getById(b.getVipBuyConfigId()));
}
//添加商品信息
@@ -460,9 +472,9 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
b1.setProduct(byId);
b1.setExpressOrder(expressOrderDao.selectById(b1.getExpressOrderId()));
boolean refundableStatusProduct = false;
if(b1.getProduct()!=null && b1.getProduct().getGoodsType().equals("05") && (paymentDateTime > timestamp-7*24*60*60*1000)){
if(b1.getProduct()!=null && b1.getProduct().getGoodsType().equals("05") && (paymentDateTime > timestamp-7*24*60*60*1000 || isHT)){
refundableStatusProduct = true;
}else if(b1.getProduct()!=null && !b1.getProduct().getGoodsType().equals("05") && b.getOrderStatus().equals("1")){
}else if(b1.getProduct()!=null && !b1.getProduct().getGoodsType().equals("05") && b.getOrderStatus().equals("1") && b1.getExpressOrderId()==0){
refundableStatusProduct = true;
}
refundableStatusArr[i] = refundableStatusProduct;
@@ -571,7 +583,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
boolean refundableStatusProduct = false;
if (bb.getProduct()!=null && bb.getProduct().getGoodsType().equals("05") && paymentDateTime > timestamp - 7 * 24 * 60 * 60 * 1000) {
refundableStatusProduct = true;
} else if (bb.getProduct()!=null && !bb.getProduct().getGoodsType().equals("05") && b.getOrderStatus().equals(Constants.ORDER_STATUS_TO_BE_SHIPPED)){
} else if (bb.getProduct()!=null && !bb.getProduct().getGoodsType().equals("05") && b.getOrderStatus().equals(Constants.ORDER_STATUS_TO_BE_SHIPPED) && bb.getExpressOrderId()==0){
refundableStatusProduct = true;
}
refundableStatusArr[i] = refundableStatusProduct;
@@ -1082,10 +1094,10 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
if(buyOrder.getOrderType().equals("vip")){
userVipService.refundVip(buyOrder);
}else{
//撤回本订单购买赠送的优惠券
couponService.refundZSCouponHistoryByOrder(buyOrder);
//恢复用户权益(点穴/时辰取穴/五运六气/肿瘤古方)
myUserService.rollbackUserPowers(buyOrder,user, orderProducts);
//撤回本订单购买赠送的优惠券
couponService.refundZSCouponHistoryByOrder(buyOrder);
//撤回电子书权限
userEbookBuyService.rollbackUserEbooks(buyOrder, orderProducts);
//撤回课程权限
@@ -1095,4 +1107,35 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
shopProductService.rollbackStock(buyOrder);
}
}
/**
* 判断该VIP后是否办理过延期VIP,退VIP时如果在此VIP后办理过延期需要把延期退掉才可以退此订单
* @param buyOrder
* @return
*/
@Override
public boolean hasYQOrder(BuyOrder buyOrder){
VipBuyConfigEntity vipBuyConfig = vipBuyConfigService.getById(buyOrder.getVipBuyConfigId());
if(vipBuyConfig.getType()<=10){
List<String> typeStrs = new ArrayList<>();
if(vipBuyConfig.getType()==1){
typeStrs.add("41");
typeStrs.add("91");
typeStrs.add("51");
typeStrs.add("41");
typeStrs.add("61");
typeStrs.add("101");
}else if(vipBuyConfig.getType()==2){
typeStrs.add("71");
typeStrs.add("81");
}else{
typeStrs.add(vipBuyConfig.getType()+"1");
}
List<Integer> vipBuyConfigIdList = vipBuyConfigDao.selectList(new LambdaQueryWrapper<VipBuyConfigEntity>().in(VipBuyConfigEntity::getType,typeStrs)).stream().map(VipBuyConfigEntity::getId).collect(Collectors.toList());
Long nums = buyOrderDao.selectCount(new LambdaQueryWrapper<BuyOrder>().in(BuyOrder::getVipBuyConfigId,vipBuyConfigIdList).eq(BuyOrder::getOrderStatus,3).gt(BuyOrder::getCreateTime, buyOrder.getCreateTime()));
log.info("=====hasYQOrder===="+nums);
return nums>0?true:false;
}
return false;
}
}

View File

@@ -494,7 +494,6 @@ public class ClassController {
}
}
}
//结班
@RequestMapping("/closeClass")
@Transactional
@@ -641,7 +640,4 @@ public class ClassController {
List<UserCertificate> userCertificate = userCertificateService.list(wrapper);
return R.ok().put("userCertificate",userCertificate);
}
}

View File

@@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.transaction.Transactional;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -70,12 +71,14 @@ public class UserVipController {
List<UserVip> l9 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,9).orderByDesc(UserVip::getEndTime));
List<UserVip> l5 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,5).orderByDesc(UserVip::getEndTime));
List<UserVip> l6 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,6).orderByDesc(UserVip::getEndTime));
if (l4.size()>0&&l9.size()>0&&l5.size()>0&&l6.size()>0){
List<UserVip> l10 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,10).orderByDesc(UserVip::getEndTime));
if (l4.size()>0&&l9.size()>0&&l5.size()>0&&l6.size()>0&&l10.size()>0){
Date t4 = l4.get(0).getEndTime();
Date t9 = l9.get(0).getEndTime();
Date t5 = l5.get(0).getEndTime();
Date t6 = l6.get(0).getEndTime();
if (t4.getTime()==t9.getTime()&&t9.getTime()==t5.getTime()&&t5.getTime()==t6.getTime()){
Date t10 = l10.get(0).getEndTime();
if (t4.getTime()==t9.getTime()&&t9.getTime()==t5.getTime()&&t5.getTime()==t6.getTime()&&t6.getTime()==t10.getTime()){
Map map = new HashMap();
map.put("type",1);
map.put("endTime",t4);
@@ -98,6 +101,10 @@ public class UserVipController {
map6.put("type",6);
map6.put("endTime",t6);
tempList.add(map6);
Map map10 = new HashMap();
map10.put("type",10);
map10.put("endTime",t10);
tempList.add(map10);
tempList = tempList.stream().sorted((map1,map2)->{
return Long.compare(((Date)map1.get("endTime")).getTime(),((Date)map2.get("endTime")).getTime());
}).collect(Collectors.toList());
@@ -133,6 +140,13 @@ public class UserVipController {
resList.add(map);
}
if (l10.size()>0){
Map map = new HashMap();
map.put("type",10);
map.put("endTime",l10.get(0).getEndTime());
resList.add(map);
}
}
}
List<UserVip> l7 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,7).orderByDesc(UserVip::getEndTime));
@@ -201,6 +215,7 @@ public class UserVipController {
ll.add(Arrays.asList(9));
ll.add(Arrays.asList(5));
ll.add(Arrays.asList(6));
ll.add(Arrays.asList(10));
ll.add(Arrays.asList(2));
ll.add(Arrays.asList(7,8));
}
@@ -311,6 +326,7 @@ public class UserVipController {
ll.add(Arrays.asList(9));
ll.add(Arrays.asList(5));
ll.add(Arrays.asList(6));
ll.add(Arrays.asList(10));
ll.add(Arrays.asList(2));
ll.add(Arrays.asList(7,8));
List<Map<String,Object>> resList = new ArrayList<>();
@@ -345,7 +361,22 @@ public class UserVipController {
@RequestMapping("/ownCourseCatalogueByVip")
public R ownCourseCatalogueByVip(@RequestBody Map<String,Object> params) {
UserVip userVip = userVipService.ownCourseCatalogueByVip(Integer.parseInt(params.get("courseId").toString()));
return R.ok().put("userVip", userVip);
Map<String,Object> userVipInfo = new HashMap<>();
if(userVip!=null){
userVipInfo.put("id",userVip.getId());
userVipInfo.put("userId",userVip.getUserId());
userVipInfo.put("type",userVip.getType());
userVipInfo.put("startTime",userVip.getStartTime());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
userVipInfo.put("endTime",sdf.format(userVip.getEndTime()));
userVipInfo.put("state",userVip.getState());
userVipInfo.put("delFlag",userVip.getDelFlag());
userVipInfo.put("user",userVip.getUser());
userVipInfo.put("userVipLogs",userVip.getUserVipLogs());
}else{
userVipInfo = null;
}
return R.ok().put("userVip", userVipInfo);
}
//当前课程属于什么会员
@@ -369,10 +400,12 @@ public class UserVipController {
public R placeVipOrder(@RequestBody BuyOrder buyOrder){
int uid = ShiroUtils.getUId();
buyOrder.setOrderStatus("0");
buyOrder.setPaymentDate(new Date());
buyOrder.setOrderType("vip");
String timeId = IdWorker.getTimeId().substring(0, 32);
buyOrder.setOrderSn(timeId);
buyOrder.setUserId(uid);
buyOrder.setPaymentDate(new Date());
buyOrderService.save(buyOrder);
BigDecimal totalPrice = buyOrder.getRealMoney();
if (Constants.PAYMENT_METHOD_VIRTUAL.equals(buyOrder.getPaymentMethod())) {
@@ -469,7 +502,7 @@ public class UserVipController {
Map map = new HashMap();
map.put("courseCount",0);
map.put("originalPrice",0);
if ("4".equals(type)||"9".equals(type)||"5".equals(type)||"6".equals(type)){
if ("4".equals(type)||"9".equals(type)||"5".equals(type)||"6".equals(type)||"10".equals(type)){
List list = new ArrayList<>();
if ("4".equals(type)){
userVipService.bottomLabel(1,list);
@@ -479,6 +512,8 @@ public class UserVipController {
userVipService.bottomLabel(2,list);
}else if ("6".equals(type)){
userVipService.bottomLabel(5,list);
}else if ("10".equals(type)){
userVipService.bottomLabel(109,list);
}
if (list.size()>0){
MPJLambdaWrapper<CourseCatalogueEntity> wrapper = new MPJLambdaWrapper();

View File

@@ -2,9 +2,12 @@ package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.ClassExamOption;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ClassExamOptionDao extends MPJBaseMapper<ClassExamOption> {
@Delete("DELETE FROM class_exam_option WHERE subject_id = #{subjectId}")
int realDeleteClassExamOption(int subjectId);
}

View File

@@ -14,4 +14,6 @@ public interface UserVipLogDao extends MPJBaseMapper<UserVipLog> {
List<Map<String,Object>> getUserVipLogInfo(@Param("date") String date);
Map<String,Object> getUserVipLogInfoTotal(@Param("date") String date);
List<Map<String,Object>> getUserVipRefundInfo(@Param("date") String last_l_date,@Param("date") String last_date);
}

View File

@@ -105,7 +105,9 @@ public interface ClassEntityService extends IService<ClassEntity> {
List userScoreList(Map<String,Object> params);
List<Map<String,Object>> classCourseInfoClassId(int classId,int courseId);
Map<String,Object> getClassCourseInfoByClassId(int classId, int courseId);
List<Map<String,Object>> classCourseInfoClassId(int classId, int courseId);
R closeClass(Map<String,Object> params);

View File

@@ -0,0 +1,7 @@
package com.peanut.modules.common.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.CourseMedicine;
public interface CourseMedicineService extends IService<CourseMedicine> {
}

View File

@@ -22,6 +22,8 @@ public interface UserVipLogService extends IService<UserVipLog> {
List<Map<String,Object>> getUserVipLogInfo(String date);
List<Map<String, Object>> getUserVipRefundInfo(String last_l_date, String last_date);
Map<String, Object> getUserVipLogInfoTotal(String date);
}

View File

@@ -125,7 +125,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
boolean refundableStatusProduct = false;
if(bb.getProduct()!=null && bb.getProduct().getGoodsType().equals("05") && (paymentDateTime > timestamp-7*24*60*60*1000)){
refundableStatusProduct = true;
}else if(bb.getProduct()!=null && !bb.getProduct().getGoodsType().equals("05") && b.getOrderStatus().equals("1")){
}else if(bb.getProduct()!=null && !bb.getProduct().getGoodsType().equals("05") && b.getOrderStatus().equals("1") && bb.getExpressOrderId()==0){
refundableStatusProduct = true;
}
refundableStatusArr[i] = refundableStatusProduct;

View File

@@ -1396,7 +1396,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
.eq(ClassTaskAndQuesReply::getUserId,params.get("userId").toString()));
for (ClassTaskAndQuesReply reply:classTaskAndQuesReplys){
ClassEntity classEntity = this.getById(reply.getClassId());
if (!"2".equals(classEntity.getState())){
if (classEntity!=null && !"2".equals(classEntity.getState())){
res = reply;
}
}
@@ -1692,7 +1692,37 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
}
return resultList;
}
@Override
public Map<String,Object> getClassCourseInfoByClassId(int classId, int courseId) {
ClassEntity classEntity = this.baseMapper.selectById(classId);
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class);
wrapper.leftJoin(ClassCourse.class, ClassCourse::getCourseId, CourseEntity::getId);
wrapper.leftJoin(ClassModel.class, ClassModel::getId, ClassCourse::getModelId);
wrapper.eq(ClassModel::getId, classEntity.getModelId());
if (courseId!=0){
wrapper.eq(CourseEntity::getId,courseId);
}
CourseEntity course = courseDao.selectOne(wrapper);
Map<String,Object> candk = new HashMap<>();
MPJLambdaWrapper<CourseCatalogueChapterEntity> w = new MPJLambdaWrapper<>();
w.leftJoin(CourseCatalogueChapterVideoEntity.class,CourseCatalogueChapterVideoEntity::getChapterId,CourseCatalogueChapterEntity::getId);
w.eq(CourseCatalogueChapterEntity::getCourseId,course.getId());
w.selectSum(CourseCatalogueChapterVideoEntity::getDuration);
Map<String,Object> map = courseCatalogueChapterDao.selectJoinMap(w);
double duration = Double.parseDouble(map.get("duration").toString());
double minute = duration/60;
double keshi = Math.ceil(minute/45);
candk.put("courseId",course.getId());
candk.put("courseTitle",course.getTitle());
candk.put("courseETitle",course.getEtitle());
candk.put("titleAbbr",course.getTitleAbbr());
candk.put("keshi",keshi);
return candk;
}
@Override
public List<Map<String,Object>> classCourseInfoClassId(int classId,int courseId) {
List<Map<String,Object>> res = new ArrayList<>();

View File

@@ -74,7 +74,7 @@ public class ClassExamServiceImpl extends ServiceImpl<ClassExamDao, ClassExam> i
public void updateClassExamSubject(ClassExamSubject classExamSubject) {
classExamSubjectDao.updateById(classExamSubject);
if (classExamSubject.getOptions()!=null&&classExamSubject.getOptions().size() > 0){
classExamOptionDao.delete(new LambdaQueryWrapper<ClassExamOption>().eq(ClassExamOption::getSubjectId,classExamSubject.getId()));
classExamOptionDao.realDeleteClassExamOption(classExamSubject.getId());
for (ClassExamOption option:classExamSubject.getOptions()){
option.setSubjectId(classExamSubject.getId());
classExamOptionDao.insert(option);

View File

@@ -304,6 +304,19 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, CouponEntity> impl
@Override
public void refundZSCouponHistoryByOrder(BuyOrder order){
MyUserEntity userEntity = userDao.selectById(order.getUserId());
BigDecimal refundAllJF = BigDecimal.ZERO;
List<JfTransactionDetails> grantJfList = jfTransactionDetailsDao.selectList(new LambdaQueryWrapper<JfTransactionDetails>()
.eq(JfTransactionDetails::getRelationId, order.getOrderId())
.eq(JfTransactionDetails::getUserId, order.getUserId())
.eq(JfTransactionDetails::getActType, 0)
.gt(JfTransactionDetails::getChangeAmount, BigDecimal.ZERO)
.like(JfTransactionDetails::getRemark, "优惠券换积分"));
for (JfTransactionDetails grantJf : grantJfList) {
refundAllJF = refundAllJF.add(grantJf.getChangeAmount());
}
boolean orderGrantedJf = refundAllJF.compareTo(BigDecimal.ZERO) > 0;
MPJLambdaWrapper<CouponToProduct> wrapper = new MPJLambdaWrapper();
wrapper.leftJoin(BuyOrderProduct.class,BuyOrderProduct::getProductId,CouponToProduct::getProductId);
wrapper.leftJoin(CouponEntity.class,CouponEntity::getId,CouponToProduct::getCouponId);
@@ -314,51 +327,42 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, CouponEntity> impl
wrapper.select(BuyOrderProduct::getQuantity);
List<Map<String,Object>> buyOrderProducts = couponToProductDao.selectJoinMaps(wrapper);
MyUserEntity userEntity = userDao.selectById(order.getUserId());
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
.eq(UserVip::getUserId, userEntity.getId())
.eq(UserVip::getState,0)
.lt(UserVip::getStartTime,order.getPaymentDate()));
boolean isVip = false;
if (userVipList.size() > 0) {
isVip = true;
}
System.out.println("isVip:"+isVip);
BigDecimal refundAllJF = BigDecimal.ZERO;
Boolean isRefundCoupon = false;
for (Map<String,Object> map : buyOrderProducts) {
ShopProduct shopProduct = shopProductDao.selectById(map.get("product_id").toString());
System.out.println("goodsType:"+shopProduct.getGoodsType());
if ("03".equals(shopProduct.getGoodsType())){
int couponId = Integer.parseInt(map.get("coupon_id").toString());
CouponEntity couponEntity = couponDao.selectById(couponId);
//现金券
if (couponEntity.getCouponType()==0 && isVip){
BigDecimal quantity = new BigDecimal(map.get("quantity").toString());
BigDecimal sumRefundJF = couponEntity.getCouponAmount().multiply(quantity);
refundAllJF = refundAllJF.add(sumRefundJF);
QueryWrapper<CouponHistory> couponHistoryRemoveWrapper = new QueryWrapper<>();
couponHistoryRemoveWrapper.eq("order_id",order.getOrderId());
couponHistoryRemoveWrapper.eq("status",1);
couponHistoryService.remove(couponHistoryRemoveWrapper);
}else{
if ("03".equals(shopProduct.getGoodsType())) {
if (!orderGrantedJf) {
isRefundCoupon = true;
}
}else{
} else {
isRefundCoupon = true;
}
}
if(refundAllJF.compareTo(BigDecimal.ZERO)>0 && userEntity.getJf().compareTo(refundAllJF)>=0){
BigDecimal userJF = userEntity.getJf().subtract(refundAllJF);
userEntity.setJf(userJF.compareTo(BigDecimal.ZERO)>=0?userJF:BigDecimal.ZERO);
userDao.updateById(userEntity);
jfTransactionDetailsService.recordZsJfTransaction(order,userEntity, refundAllJF);
if (orderGrantedJf) {
BigDecimal userJf = userEntity.getJf() == null ? BigDecimal.ZERO : userEntity.getJf();
BigDecimal actualDeduct;
if (userJf.compareTo(refundAllJF) >= 0) {
actualDeduct = refundAllJF;
} else if (userJf.compareTo(BigDecimal.ZERO) > 0) {
actualDeduct = userJf;
} else {
actualDeduct = BigDecimal.ZERO;
}
if (actualDeduct.compareTo(BigDecimal.ZERO) > 0) {
userEntity.setJf(userJf.subtract(actualDeduct));
userDao.updateById(userEntity);
jfTransactionDetailsService.recordZsJfTransaction(order, userEntity, actualDeduct);
QueryWrapper<CouponHistory> couponHistoryRemoveWrapper = new QueryWrapper<>();
couponHistoryRemoveWrapper.eq("order_id", order.getOrderId());
couponHistoryRemoveWrapper.eq("status", 1);
couponHistoryService.remove(couponHistoryRemoveWrapper);
}
}
if(isRefundCoupon){
if (isRefundCoupon) {
QueryWrapper<CouponHistory> couponHistoryRemoveWrapper = new QueryWrapper<>();
couponHistoryRemoveWrapper.eq("order_id",order.getOrderId());
couponHistoryRemoveWrapper.eq("status",0);
couponHistoryRemoveWrapper.eq("order_id", order.getOrderId());
couponHistoryRemoveWrapper.eq("status", 0);
couponHistoryService.remove(couponHistoryRemoveWrapper);
}
@@ -376,17 +380,18 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, CouponEntity> impl
List<Map<String,Object>> buyOrderProducts = couponToProductDao.selectJoinMaps(wrapper);
for (Map<String,Object> map : buyOrderProducts) {
ShopProduct shopProduct = shopProductDao.selectById(map.get("product_id").toString());
//vip身份用户买送优惠券的预售书时候不送优惠券改自动送积分
//预售书+赠送现金券VIP用户将券额转为积分仅产品id=2023时需为妇幼生殖vip(type=10)
if ("03".equals(shopProduct.getGoodsType())){
MyUserEntity userEntity = userDao.selectById(order.getUserId());
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
.eq(UserVip::getUserId, userEntity.getId())
.eq(UserVip::getState,0));
if (userVipList.size() > 0) {
int couponId = Integer.parseInt(map.get("coupon_id").toString());
CouponEntity couponEntity = couponDao.selectById(couponId);
//现金券
if (couponEntity.getCouponType()==0){
int productId = Integer.parseInt(map.get("product_id").toString());
int couponId = Integer.parseInt(map.get("coupon_id").toString());
CouponEntity couponEntity = couponDao.selectById(couponId);
boolean isFyszVip = userVipList.stream().anyMatch(userVip -> Integer.valueOf(10).equals(userVip.getType()));
boolean couponToJf = couponEntity.getCouponType() == 0 && (productId == 2023 ? isFyszVip : userVipList.size() > 0);
if (couponToJf){
BigDecimal jf = BigDecimal.ZERO;
for (int i=0;i<Integer.parseInt(map.get("quantity").toString());i++){
R res = insertCouponHistory(order,couponId,order.getUserId(), 1,1,
@@ -407,12 +412,6 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, CouponEntity> impl
jfTransactionDetails.setRemark("vip用户买预售书送的优惠券换积分,订单号:"+order.getOrderSn());
jfTransactionDetailsDao.insert(jfTransactionDetails);
}
}else {
for (int i=0;i<Integer.parseInt(map.get("quantity").toString());i++){
insertCouponHistory(Integer.parseInt(map.get("coupon_id").toString()),
order.getUserId(), 1,0,"购买商品"+shopProduct.getProductName()+"赠送");
}
}
}else {
for (int i=0;i<Integer.parseInt(map.get("quantity").toString());i++){
insertCouponHistory(Integer.parseInt(map.get("coupon_id").toString()),

View File

@@ -0,0 +1,16 @@
package com.peanut.modules.common.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.CourseMedicineDao;
import com.peanut.modules.common.dao.CourseToMedicineDao;
import com.peanut.modules.common.entity.CourseMedicine;
import com.peanut.modules.common.entity.CourseToMedicine;
import com.peanut.modules.common.service.CourseMedicineService;
import com.peanut.modules.common.service.CourseToMedicineService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service("commonCourseMedicineService")
public class CourseMedicineServiceImpl extends ServiceImpl<CourseMedicineDao, CourseMedicine> implements CourseMedicineService {
}

View File

@@ -37,7 +37,7 @@ public class JfTransactionDetailsServiceImpl extends ServiceImpl<JfTransactionDe
public void recordZsJfTransaction(BuyOrder buyOrder, MyUserEntity user, BigDecimal refundJF) {
JfTransactionDetails jfTransactionDetails = new JfTransactionDetails();
jfTransactionDetails.setUserId(buyOrder.getUserId());
jfTransactionDetails.setChangeAmount(refundJF);
jfTransactionDetails.setChangeAmount(refundJF.abs().negate());
jfTransactionDetails.setActType(1);
jfTransactionDetails.setUserBalance(user.getJf());
jfTransactionDetails.setRelationId(buyOrder.getOrderId());

View File

@@ -55,6 +55,8 @@ public class TrainingClassServiceImpl extends ServiceImpl<TrainingClassDao, Trai
identity = "心理学vip";
}else if ("9".equals(vipType)) {
identity = "中西汇通vip";
}else if ("10".equals(vipType)) {
identity = "妇幼生殖vip";
}
break;
}

View File

@@ -93,6 +93,11 @@ public class UserVipLogServiceImpl extends ServiceImpl<UserVipLogDao, UserVipLog
return this.baseMapper.getUserVipLogInfo(date);
}
@Override
public List<Map<String, Object>> getUserVipRefundInfo(String last_l_date, String last_date) {
return this.baseMapper.getUserVipRefundInfo(last_l_date,last_date);
}
@Override
public Map<String, Object> getUserVipLogInfoTotal(String date) {
return this.baseMapper.getUserVipLogInfoTotal(date);

View File

@@ -108,7 +108,7 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
@Override
public boolean is4569SVip(int uid) {
if (isVipByType(4,uid)&&isVipByType(9,uid)&&isVipByType(5,uid)&&isVipByType(6,uid)){
if (isVipByType(4,uid)&&isVipByType(9,uid)&&isVipByType(5,uid)&&isVipByType(6,uid)&&isVipByType(10,uid)){
return true;
}
return false;
@@ -139,8 +139,9 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
.eq(UserVip::getUserId, u==null?ShiroUtils.getUId():u.getId())
.eq(UserVip::getState,0));
for (UserVip userVip : userVipList) {
if (userVip.getType()==4||userVip.getType()==9||userVip.getType()==5||userVip.getType()==6) {
if (userVip.getType()==4||userVip.getType()==9||userVip.getType()==5||userVip.getType()==6||userVip.getType()==10) {
List<CourseToMedicine> list = courseToMedicalDao.selectList(new LambdaQueryWrapper<CourseToMedicine>()
.eq(CourseToMedicine::getCourseId,courseId));
for (CourseToMedicine ctm:list) {
@@ -149,7 +150,9 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
if ((cm.getId()==1&&userVip.getType()==4)||//中医学
(cm.getId()==74&&userVip.getType()==9)||//中西汇通
(cm.getId()==2&&userVip.getType()==5)||//针灸学
(cm.getId()==109&&userVip.getType()==10)||//妇幼生殖
(cm.getId()==5&&userVip.getType()==6)){//肿瘤学
return userVip;
}
}
@@ -205,6 +208,8 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
set.add(6);
}else if (cm.getId() == 4) {//心身医学
set.add(8);
}else if (cm.getId() == 109){//妇幼生殖
set.add(10);
}
}
}
@@ -221,7 +226,8 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
return set;
}
public CourseMedicine topLabel(int labelId) {
public CourseMedicine
topLabel(int labelId) {
CourseMedicine cm = courseMedicineDao.selectById(labelId);
if (cm != null) {
CourseMedicine pcm = courseMedicineDao.selectById(cm.getPid());
@@ -258,8 +264,9 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
List<UserVip> resList = new ArrayList();
if(vipBuyConfigEntity.getType()==1){//医学超级
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
.eq(UserVip::getUserId,buyOrder.getUserId()).eq(UserVip::getState,0).in(UserVip::getType,4,9,5,6));
for (int i=4;i<=7;i++){
.eq(UserVip::getUserId,buyOrder.getUserId()).eq(UserVip::getState,0).in(UserVip::getType,4,9,5,6,10));
for (int i=4;i<=10;i++){
log.info("openVipForUser====i:"+i);
if (i==7){
i=9;
}
@@ -289,7 +296,7 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
}
}
}else if(vipBuyConfigEntity.getType()==11){//延期医学超级
for (int i=4;i<=7;i++){
for (int i=4;i<=10;i++){
if (i==7){
i=9;
}
@@ -367,7 +374,7 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
}
}
}else if (vipBuyConfigEntity.getType()==4||vipBuyConfigEntity.getType()==9||vipBuyConfigEntity.getType()==5||vipBuyConfigEntity.getType()==6||
vipBuyConfigEntity.getType()==7||vipBuyConfigEntity.getType()==8){
vipBuyConfigEntity.getType()==7||vipBuyConfigEntity.getType()==8 || vipBuyConfigEntity.getType()==10){
UserVip userVip = new UserVip();
userVip.setUserId(buyOrder.getUserId());
userVip.setType(vipBuyConfigEntity.getType());
@@ -376,10 +383,10 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
userVipDao.insert(userVip);
resList.add(userVip);
}else if (vipBuyConfigEntity.getType()==41||vipBuyConfigEntity.getType()==91||vipBuyConfigEntity.getType()==51||vipBuyConfigEntity.getType()==61||
vipBuyConfigEntity.getType()==71||vipBuyConfigEntity.getType()==81){
vipBuyConfigEntity.getType()==71||vipBuyConfigEntity.getType()==81 ||vipBuyConfigEntity.getType()==101){
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
.eq(UserVip::getUserId,buyOrder.getUserId())
.eq(UserVip::getType,vipBuyConfigEntity.getType().toString().substring(0,1))
.eq(UserVip::getType,vipBuyConfigEntity.getType().toString().substring(0,vipBuyConfigEntity.getType()==101?2:1))
.orderByDesc(UserVip::getEndTime));
UserVip userVip = userVipList.get(0);
if (userVip.getState()==0) {

View File

@@ -63,7 +63,7 @@ public class StatisticsBusinessVipController {
.stream().map(UserVip::getType).collect(Collectors.toList());
// 定义复购规则
Map<String, List<Integer>> reBuyRules = new HashMap<>();
reBuyRules.put("医学超级", Arrays.asList(4, 5, 6, 9));
reBuyRules.put("医学超级", Arrays.asList(4, 5, 6, 9, 10));
reBuyRules.put("国学心理学超级", Arrays.asList(7, 8));
reBuyRules.put("中医学", Arrays.asList(4));
reBuyRules.put("针灸学", Arrays.asList(5));
@@ -71,6 +71,7 @@ public class StatisticsBusinessVipController {
reBuyRules.put("国学", Arrays.asList(7));
reBuyRules.put("心理学", Arrays.asList(8));
reBuyRules.put("中西汇通学", Arrays.asList(9));
reBuyRules.put("妇幼生殖", Arrays.asList(10));
// 判断是否复购
List<Integer> required = reBuyRules.get(vipType);
if (required != null && state1UserVips.containsAll(required)) {
@@ -141,14 +142,17 @@ public class StatisticsBusinessVipController {
row5.createCell(0).setCellValue("肿瘤学");row5.createCell(1).setCellValue(state1Counts.getOrDefault("肿瘤学", 0).toString());
row5.createCell(2).setCellValue("肿瘤学");row5.createCell(3).setCellValue(state0Counts.getOrDefault("肿瘤学", 0).toString());
Row row6 = sheet.createRow(rowNum++);
row6.createCell(0).setCellValue("国学");row6.createCell(1).setCellValue(state1Counts.getOrDefault("国学",0).toString());
row6.createCell(2).setCellValue("国学");row6.createCell(3).setCellValue(state0Counts.getOrDefault("国学", 0).toString());
row6.createCell(0).setCellValue("妇幼生殖");row6.createCell(1).setCellValue(state1Counts.getOrDefault("妇幼生殖",0).toString());
row6.createCell(2).setCellValue("妇幼生殖");row6.createCell(3).setCellValue(state0Counts.getOrDefault("妇幼生殖", 0).toString());
Row row7 = sheet.createRow(rowNum++);
row7.createCell(0).setCellValue("心理");row7.createCell(1).setCellValue(state1Counts.getOrDefault("心理", 0).toString());
row7.createCell(2).setCellValue("心理");row7.createCell(3).setCellValue(state0Counts.getOrDefault("心理", 0).toString());
row7.createCell(0).setCellValue("");row7.createCell(1).setCellValue(state1Counts.getOrDefault("",0).toString());
row7.createCell(2).setCellValue("");row7.createCell(3).setCellValue(state0Counts.getOrDefault("", 0).toString());
Row row8 = sheet.createRow(rowNum++);
row8.createCell(0).setCellValue("中西汇通");row8.createCell(1).setCellValue(state1Counts.getOrDefault("中西汇通", 0).toString());
row8.createCell(2).setCellValue("中西汇通");row8.createCell(3).setCellValue(state0Counts.getOrDefault("中西汇通", 0).toString());
row8.createCell(0).setCellValue("心理");row8.createCell(1).setCellValue(state1Counts.getOrDefault("心理", 0).toString());
row8.createCell(2).setCellValue("心理");row8.createCell(3).setCellValue(state0Counts.getOrDefault("心理", 0).toString());
Row row9 = sheet.createRow(rowNum++);
row9.createCell(0).setCellValue("中西汇通学");row9.createCell(1).setCellValue(state1Counts.getOrDefault("中西汇通学", 0).toString());
row9.createCell(2).setCellValue("中西汇通学");row9.createCell(3).setCellValue(state0Counts.getOrDefault("中西汇通学", 0).toString());
sheet.createRow(rowNum++);
String[] header = {"时间","姓名","电话","VIP类型","是否延期", "本次年限","本次金额","本次开始时间","本次结束时间","到期时间","是否复购"};
@@ -316,14 +320,17 @@ public class StatisticsBusinessVipController {
row5.createCell(0).setCellValue("肿瘤学");row5.createCell(1).setCellValue(state1Counts.getOrDefault("肿瘤学", 0).toString());
row5.createCell(2).setCellValue("肿瘤学");row5.createCell(3).setCellValue(state0Counts.getOrDefault("肿瘤学", 0).toString());
Row row6 = sheet.createRow(rowNum++);
row6.createCell(0).setCellValue("国学");row6.createCell(1).setCellValue(state1Counts.getOrDefault("国学",0).toString());
row6.createCell(2).setCellValue("国学");row6.createCell(3).setCellValue(state0Counts.getOrDefault("国学", 0).toString());
row6.createCell(0).setCellValue("妇幼生殖");row6.createCell(1).setCellValue(state1Counts.getOrDefault("妇幼生殖",0).toString());
row6.createCell(2).setCellValue("妇幼生殖");row6.createCell(3).setCellValue(state0Counts.getOrDefault("妇幼生殖", 0).toString());
Row row7 = sheet.createRow(rowNum++);
row7.createCell(0).setCellValue("心理");row7.createCell(1).setCellValue(state1Counts.getOrDefault("心理", 0).toString());
row7.createCell(2).setCellValue("心理");row7.createCell(3).setCellValue(state0Counts.getOrDefault("心理", 0).toString());
row7.createCell(0).setCellValue("");row7.createCell(1).setCellValue(state1Counts.getOrDefault("",0).toString());
row7.createCell(2).setCellValue("");row7.createCell(3).setCellValue(state0Counts.getOrDefault("", 0).toString());
Row row8 = sheet.createRow(rowNum++);
row8.createCell(0).setCellValue("中西汇通");row8.createCell(1).setCellValue(state1Counts.getOrDefault("中西汇通", 0).toString());
row8.createCell(2).setCellValue("中西汇通");row8.createCell(3).setCellValue(state0Counts.getOrDefault("中西汇通", 0).toString());
row8.createCell(0).setCellValue("心理");row8.createCell(1).setCellValue(state1Counts.getOrDefault("心理", 0).toString());
row8.createCell(2).setCellValue("心理");row8.createCell(3).setCellValue(state0Counts.getOrDefault("心理", 0).toString());
Row row9 = sheet.createRow(rowNum++);
row9.createCell(0).setCellValue("中西汇通学");row9.createCell(1).setCellValue(state1Counts.getOrDefault("中西汇通学", 0).toString());
row9.createCell(2).setCellValue("中西汇通学");row9.createCell(3).setCellValue(state0Counts.getOrDefault("中西汇通学", 0).toString());
sheet.createRow(rowNum++);
String[] header2 = {"","首次办理三年","首次办理四年","其他","延期一年", "延期三年","延期四年","其他"};
@@ -339,6 +346,7 @@ public class StatisticsBusinessVipController {
fillRow(sheet.createRow(rowNum++), 0, "中医学", banCounts, yanCounts);
fillRow(sheet.createRow(rowNum++), 0, "针灸学", banCounts, yanCounts);
fillRow(sheet.createRow(rowNum++), 0, "肿瘤学", banCounts, yanCounts);
fillRow(sheet.createRow(rowNum++), 0, "妇幼生殖", banCounts, yanCounts);
fillRow(sheet.createRow(rowNum++), 0, "国学", banCounts, yanCounts);
fillRow(sheet.createRow(rowNum++), 0, "心理学", banCounts, yanCounts);
fillRow(sheet.createRow(rowNum++), 0, "中西汇通学", banCounts, yanCounts);
@@ -352,6 +360,7 @@ public class StatisticsBusinessVipController {
sheet.createRow(rowNum++).createCell(0).setCellValue("中医学");sheet.getRow(rowNum-1).createCell(1).setCellValue(banTypeRatios.getOrDefault("中医学",0).toString());
sheet.createRow(rowNum++).createCell(0).setCellValue("针灸学");sheet.getRow(rowNum-1).createCell(1).setCellValue(banTypeRatios.getOrDefault("针灸学",0).toString());
sheet.createRow(rowNum++).createCell(0).setCellValue("肿瘤学");sheet.getRow(rowNum-1).createCell(1).setCellValue(banTypeRatios.getOrDefault("肿瘤学",0).toString());
sheet.createRow(rowNum++).createCell(0).setCellValue("妇幼生殖");sheet.getRow(rowNum-1).createCell(1).setCellValue(banTypeRatios.getOrDefault("妇幼生殖",0).toString());
sheet.createRow(rowNum++).createCell(0).setCellValue("国学");sheet.getRow(rowNum-1).createCell(1).setCellValue(banTypeRatios.getOrDefault("国学",0).toString());
sheet.createRow(rowNum++).createCell(0).setCellValue("心理学");sheet.getRow(rowNum-1).createCell(1).setCellValue(banTypeRatios.getOrDefault("心理学",0).toString());
sheet.createRow(rowNum++).createCell(0).setCellValue("中西汇通学");sheet.getRow(rowNum-1).createCell(1).setCellValue(banTypeRatios.getOrDefault("中西汇通学",0).toString());

View File

@@ -1,5 +1,6 @@
package com.peanut.modules.master.controller;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
@@ -38,6 +39,10 @@ public class UserCertificateController {
private CourseMedicalService courseMedicalService;
@Autowired
private CourseToMedicalService courseToMedicalService;
@Autowired
private MyUserService userService;
@Autowired
private ClassEntityService classEntityService;
//小班自考证书列表
@RequestMapping("/userClassAndZKCertificateList")
@@ -278,6 +283,56 @@ public class UserCertificateController {
}
@RequestMapping("/createCertificateNo")
public R createCertificateNo(@RequestBody Map<String,Object> params){
ClassEntity classEntity = classEntityService.getById(params.get("classId").toString());
String type = params.get("type").toString();
List<String> certificateNoList = new ArrayList<>();
Map<String,Object> classCourseInfo = classEntityService.getClassCourseInfoByClassId(classEntity.getId(),0);
String pinyin = classCourseInfo.get("titleAbbr").toString();
String tels = params.get("tels").toString();
List<String> telList = Arrays.asList(tels.split(","));
List<MyUserEntity> userList = userService.list(new LambdaQueryWrapper<MyUserEntity>()
.in(MyUserEntity::getTel, telList));
for (int i=0;i<userList.size();i++){
MyUserEntity user = userList.get(i);
UserCertificate userCertificate = new UserCertificate();
userCertificate.setTitle(classEntity.getTitle());
userCertificate.setType(type);
userCertificate.setLabelId(5);
userCertificate.setUserId(user.getId());
userCertificate.setClassId(classEntity.getId());
String certificateNo = classEntityService.getNextCertificateNo(type,pinyin);
userCertificate.setCertificateNo(certificateNo);
userCertificate.setCourseId((Integer) classCourseInfo.get("courseId"));
if (StringUtils.isNotEmpty(user.getPhoto())&&StringUtils.isNotEmpty(user.getName())){
String startYear = DateUtil.year(classEntity.getStartTime())+"";
String startMonth = DateUtil.month(classEntity.getStartTime())+1+"";
String startDay = DateUtil.dayOfMonth(classEntity.getStartTime())+"";
String endYear = DateUtil.year(classEntity.getEndTime())+"";
String endMonth = DateUtil.month(classEntity.getEndTime())+1+"";
String endDay = DateUtil.dayOfMonth(classEntity.getEndTime())+"";
double keshiTotal = (double)classCourseInfo.get("keshi");
String keshi = (keshiTotal+"").replace(".0","");
String courseTitle = classCourseInfo.get("courseTitle").toString();
if (courseTitle.contains("")){
courseTitle = courseTitle.substring(0,courseTitle.indexOf(""));
}
String[] des = {startYear,startMonth,startDay,endYear,endMonth,endDay,
classEntity.getTitle(),courseTitle,keshi};
String[] edes = {classCourseInfo.get("courseETitle").toString(),keshi};
String url = userCertificateService.generateCertificate(type,certificateNo,user.getPhoto(),user.getName(),
des, edes, endYear,endMonth,endDay);
userCertificate.setCertificateUrl(url);
}
userCertificateService.save(userCertificate);
certificateNoList.add(user.getTel());
}
return R.ok().put("certificateNoList",certificateNoList);
}
}

View File

@@ -19,6 +19,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URL;
import java.net.URLConnection;
import java.util.*;
@@ -221,18 +222,21 @@ public class UserCourseBuyServiceImpl extends ServiceImpl<UserCourseBuyDao, User
continue;
}
CellType cellTypeEnum = cell.getCellTypeEnum();
// if(cellTypeEnum==CellType.NUMERIC){
String phone = cell.toString();
MyUserEntity myUserEntity = userDao.selectOne(new LambdaQueryWrapper<MyUserEntity>().select(MyUserEntity::getId,MyUserEntity::getName,MyUserEntity::getTel).eq(MyUserEntity::getTel, phone));
if(myUserEntity!=null){
has.add(myUserEntity);
}else{
HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("name",row.getCell(0)==null?"":row.getCell(0).toString());
stringStringHashMap.put("phone",phone);
nohas.add(stringStringHashMap);
}
// }
String phone = cell.toString().trim();
if(cellTypeEnum==CellType.NUMERIC){
BigInteger bigInteger = BigInteger.valueOf((long) cell.getNumericCellValue());
phone = bigInteger.toString();
}
MyUserEntity myUserEntity = userDao.selectOne(new LambdaQueryWrapper<MyUserEntity>().select(MyUserEntity::getId,MyUserEntity::getName,MyUserEntity::getTel).eq(MyUserEntity::getTel, phone));
if(myUserEntity!=null){
has.add(myUserEntity);
}else{
HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("name",row.getCell(0)==null?"":row.getCell(0).toString());
stringStringHashMap.put("phone",phone);
nohas.add(stringStringHashMap);
}
}
stringArrayListMap.put("has",has);
stringArrayListMap.put("no",nohas);

View File

@@ -1,6 +1,7 @@
package com.peanut.modules.sociology.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
@@ -10,9 +11,12 @@ import com.peanut.common.utils.ShiroUtils;
import com.peanut.modules.book.service.ShopProductService;
import com.peanut.modules.common.dao.*;
import com.peanut.modules.common.entity.*;
import com.peanut.modules.common.service.CourseMedicineService;
import com.peanut.modules.common.service.CourseToMedicineService;
import com.peanut.modules.common.service.MyUserService;
import com.peanut.modules.common.service.UserVipService;
import com.peanut.modules.common.to.ParamTo;
import com.peanut.modules.master.service.CourseMedicalService;
import com.peanut.modules.sociology.service.CourseService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@@ -52,6 +56,10 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
private UserVipDao userVipDao;
@Autowired
private UserCourseBuyLogDao userCourseBuyLogDao;
@Autowired
private CourseToMedicineService courseToMedicineService;
@Autowired
private CourseMedicineService courseMedicineService;
//根据标签获取课程列表
@@ -117,7 +125,14 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()), CourseEntity.class, wrapper);
return courseEntityPage;
}
public CourseMedicine getCourseMedicinePid(int medicineId){
CourseMedicine courseMedicine = courseMedicineService.getById(medicineId);
if(courseMedicine.getPid()==0){
return courseMedicine;
}else{
return getCourseMedicinePid(courseMedicine.getPid());
}
}
@Override
public Map<String, Object> getCourseDetail(Integer id) {
Map<String, Object> flag = new HashMap<>();
@@ -163,6 +178,26 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
}
}
}
QueryWrapper<CourseToMedicine> courseToMedicineWrapper = new QueryWrapper<CourseToMedicine>();
courseToMedicineWrapper.eq("course_id",course.getId());
List<CourseToMedicine> courseToMedicineList = courseToMedicineService.list(courseToMedicineWrapper);
String content = course.getContent();
List<Integer> medicinePids = new ArrayList<>();
for (CourseToMedicine courseToMedicine:courseToMedicineList){
CourseMedicine courseMedicine = getCourseMedicinePid(courseToMedicine.getMedicalId());
if(medicinePids.contains(courseMedicine.getId())){
continue;
}
if(courseMedicine!=null && courseMedicine.getId()==1){
content = content+"<img src=\"https://ehh-public-01.oss-cn-beijing.aliyuncs.com/image/zhong-yi-xue-ke-cheng-biao.jpg\"/>";
}else if(courseMedicine!=null && courseMedicine.getId()==74){
content = content+"<img src=\"https://ehh-public-01.oss-cn-beijing.aliyuncs.com/image/hui-tong-ke-cheng-biao.jpg\"/>";
}
if(courseMedicine!=null){
medicinePids.add(courseMedicine.getId());
}
}
course.setContent(content);
flag.put("course",course);
//课程关联商品
if (StringUtils.isNotEmpty(course.getRelationProductIds())){

View File

@@ -35,7 +35,7 @@
left join course_catalogue cc on cc.id = ucb.catalogue_id
left join pay_zfb_order pzo on pzo.relevanceOid = ucbl.order_sn and pzo.trade_no is not null
where ucbl.del_flag = 0 and ucbl.fee > 0 and DATE_FORMAT(ucbl.pay_time,'%Y-%m-%d') &lt;= #{date}
and u.id not in (select id from user where tester_flag = 1)
and (u.id not in (select id from user where tester_flag = 1) or (u.id in (select id from user where tester_flag = 1 and ( ucbl.pay_type in ('微信','支付宝') and ucbl.create_time>='2026-05-06 00:00:00'))))
order by ucb.id
) t) s) q) w) e) r
</select>

View File

@@ -20,7 +20,8 @@
left join pay_zfb_order pzo on pzo.relevanceOid = uvl.order_sn and pzo.trade_no is not null
where u.del_flag = 0 and uvl.del_flag = 0 and uv.del_flag = 0
and DATE_FORMAT(IF(uvl.pay_time is NULL,uvl.start_time,uvl.pay_time), '%Y-%m') &lt;= SUBSTR(#{date},1,7)
and u.id not in (select id from user where tester_flag = 1)
and
(u.id not in (select id from user where tester_flag = 1) or (u.id in (select id from user where tester_flag = 1 and (uvl.pay_type in('微信','支付宝') and uvl.create_time>='2026-05-06 00:00:00'))))
order by uvl.end_time asc
) t order by currentDays desc
</select>
@@ -49,5 +50,25 @@
) s
</select>
<select id="getUserVipRefundInfo" resultType="map">
select t.*,
IF(totalDays=alreadyDays,fee,dayAmount*alreadyDays) alreadyTanxiao,
dayAmount*currentDays currentTanxiao,
fee-IF(totalDays=alreadyDays,fee,dayAmount*alreadyDays)-(dayAmount*currentDays) notyetTanxiao
from (select uvl.*,c.create_time refund_time,u.name,if(u.tel is null,if(u.email is null,'',u.email),u.tel) tel, IF(uv.type=4,'中医学',IF(uv.type=5,'针灸学',IF(uv.type=6,'肿瘤学',IF(uv.type=7,'国学',IF(uv.type=8,'心理学','中西汇通学'))))) type,
uvl.start_time startTime,uvl.end_time endTime,if(uvl.pay_time is null,'',uvl.pay_time) payTime,uvl.order_sn orderSn,pzo.trade_no zfbOrder,uvl.pay_type payType,uvl.remark,uvl.price,uvl.fee,DATEDIFF(uvl.end_time,uvl.start_time)+1 totalDays,ROUND(uvl.fee/(DATEDIFF(uvl.end_time,uvl.start_time)+1),2) dayAmount,
IF(DATE_FORMAT(uvl.end_time, '%Y-%m') &lt; SUBSTR(#{date},1,7),DATEDIFF(uvl.end_time,uvl.start_time)+1,IF(DATE_FORMAT(uvl.start_time, '%Y-%m') > SUBSTR(#{date},1,7),0,IF(DATE_FORMAT(uvl.start_time, '%Y-%m') &lt; SUBSTR(#{date},1,7),DATEDIFF(concat(SUBSTR(#{date},1,7),'-01'),uvl.start_time),0))) alreadyDays,
IF(DATE_FORMAT(uvl.start_time, '%Y-%m') > SUBSTR(#{date},1,7),0,IF(DATE_FORMAT(uvl.end_time, '%Y-%m') &lt; SUBSTR(#{date},1,7),0,IF(DATE_FORMAT(uvl.end_time, '%Y-%m') > SUBSTR(#{date},1,7),if(DATE_FORMAT(uvl.start_time, '%Y-%m') = SUBSTR(#{date},1,7),DATEDIFF(#{date},uvl.start_time)+1,DAY(#{date})),DATEDIFF(uvl.end_time,concat(SUBSTR(#{date},1,7),'-01'))+1))) currentDays,
IF(DATE_FORMAT(uvl.start_time, '%Y-%m') > SUBSTR(#{date},1,7),DATEDIFF(uvl.end_time,uvl.start_time)+1,(IF(DATE_FORMAT(uvl.end_time, '%Y-%m') &lt;= SUBSTR(#{date},1,7),0,DATEDIFF(uvl.end_time,#{date})))) notyetDays
from buy_order a left join user_vip_log uvl on a.order_sn = uvl.order_sn
left join user_vip vp on uvl.user_vip_id = vp.id
left join buy_order_refund c on c.order_id=a.order_id left join user u on a.user_id=u.id
left join pay_zfb_order pzo on pzo.relevanceOid = a.order_sn and pzo.trade_no is not null
where a.order_status='6' and
DATE_FORMAT(a.create_time, '%Y-%m') = SUBSTR(#{last_l_date},1,7) and DATE_FORMAT(c.create_time, '%Y-%m') = SUBSTR(#{last_date},1,7) and a.order_type='vip' and a.del_flag=0 and uvl.del_flag=0 and c.del_flag=0
) t order by currentDays desc
) s
</select>
</mapper>