财务统计
This commit is contained in:
@@ -21,6 +21,102 @@ public class UserCourseBuyUtil {
|
||||
// userCourseBuyOnload();
|
||||
// userCourseBuyOnload2();
|
||||
// userVipUpdate();
|
||||
// distinctUserCourseBuy();
|
||||
// addUserCourseBuyLog();
|
||||
}
|
||||
public static void addUserCourseBuyLog() {
|
||||
try {
|
||||
Connection fzdsconn = DriverManager.getConnection(
|
||||
"jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book_test?rewriteBatchedStatements=true",
|
||||
"nuttyreading", "Wu751019!");
|
||||
PreparedStatement addUserCourseBuyLogStatement = fzdsconn.prepareStatement(
|
||||
"INSERT ignore INTO user_course_buy_log (user_course_buy_id,user_id,type,pay_type,pay_time,order_sn,days,fee) " +
|
||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
PreparedStatement statement = fzdsconn.prepareStatement("""
|
||||
select t.*,ucb.id,ROUND(orderPrice/t.productCount,2) price,ucb.days,ucb.come,ucb.start_time startTime,ucb.end_time endTime
|
||||
from
|
||||
(
|
||||
select bo.order_sn orderSn,bo.create_time createTime,IF(bo.payment_method=1,'微信',IF(bo.payment_method=2,'支付宝','天医币')) payType,sp.product_name title,
|
||||
(select count(1) from shop_product_course where del_flag = 0 and product_id = bop.product_id) productCount,
|
||||
bo.real_money orderPrice,bo.user_id userId,spc.course_id courseId,spc.catalogue_id catalogueId
|
||||
from buy_order bo
|
||||
left join buy_order_product bop on bop.order_id = bo.order_id
|
||||
left join shop_product sp on sp.product_id = bop.product_id
|
||||
left join shop_product_course spc on spc.product_id = sp.product_id
|
||||
where bo.del_flag = 0 and bo.order_status = 3 and bo.order_type = 'order' and real_money > 0
|
||||
and sp.goods_type = '05' and spc.del_flag = 0 and sp.product_id not in (1759,1758,1743,1741,1740,1739,1738,1737,1736,1735,1734,17331732,1731)
|
||||
and bo.user_id not in (select id from user where tel in ('18812616272','13110039505','18526084267','12222222222','13333333333','14444444444','15555555555','16666666666','17777777777','18888888888','1774455','15533','165965','164964','54321','111','13662001490','15505153873','18834844847','17602219785','19999999999','12299','166933','16855','17602634511','16161616161','17171717171','112112112','21212121211','222222','666666','123123','789789','96','25252525','3434343434','123789','124789','789789','163963','5656','19966','1664455','15151515151','256366','986986','18834844846','18834844849','15611027864','18047689535','18834844848','456456456'))
|
||||
) t
|
||||
left join user_course_buy ucb on ucb.user_id = t.userId and ucb.course_id = t.courseId and ucb.catalogue_id = t.catalogueId and ucb.come like CONCAT('%',t.orderSn,'%')
|
||||
where ucb.del_flag = 0
|
||||
union
|
||||
select t.*,ucb.id,t.orderPrice price,ucb.days,ucb.come,ucb.start_time startTime,ucb.end_time endTime
|
||||
from
|
||||
(
|
||||
select bo.order_sn orderSn,bo.create_time createTime,IF(bo.payment_method=1,'微信',IF(bo.payment_method=2,'支付宝','天医币')) payType,bo.remark title,1 productCount,bo.real_money orderPrice,bo.user_id userId,spc.course_id courseId,spc.catalogue_id catalogueId
|
||||
from buy_order bo
|
||||
left join shop_product sp on sp.product_id = SUBSTR(bo.remark FROM 1 FOR 4)
|
||||
left join shop_product_course spc on spc.product_id = sp.product_id
|
||||
where bo.del_flag = 0 and bo.order_status = 3 and bo.order_type = 'relearn' and real_money > 0
|
||||
and sp.goods_type = '05' and spc.del_flag = 0 and sp.product_id not in (1759,1758,1743,1741,1740,1739,1738,1737,1736,1735,1734,17331732,1731)
|
||||
and bo.user_id not in (select id from user where tel in ('18812616272','13110039505','18526084267','12222222222','13333333333','14444444444','15555555555','16666666666','17777777777','18888888888','1774455','15533','165965','164964','54321','111','13662001490','15505153873','18834844847','17602219785','19999999999','12299','166933','16855','17602634511','16161616161','17171717171','112112112','21212121211','222222','666666','123123','789789','96','25252525','3434343434','123789','124789','789789','163963','5656','19966','1664455','15151515151','256366','986986','18834844846','18834844849','15611027864','18047689535','18834844848','456456456'))
|
||||
) t
|
||||
left join user_course_buy ucb on ucb.user_id = t.userId and ucb.course_id = t.courseId and ucb.catalogue_id = t.catalogueId and ucb.come like CONCAT('%',t.orderSn,'%')
|
||||
where ucb.del_flag = 0
|
||||
order by orderSn
|
||||
""");
|
||||
ResultSet resultSet = statement.executeQuery();
|
||||
while(resultSet.next()){
|
||||
addUserCourseBuyLogStatement.setString(1,resultSet.getString("id"));
|
||||
addUserCourseBuyLogStatement.setString(2,resultSet.getString("userId"));
|
||||
addUserCourseBuyLogStatement.setString(3,"order");
|
||||
addUserCourseBuyLogStatement.setString(4,resultSet.getString("payType"));
|
||||
addUserCourseBuyLogStatement.setTimestamp(5,resultSet.getTimestamp("createTime"));
|
||||
addUserCourseBuyLogStatement.setString(6,resultSet.getString("orderSn"));
|
||||
addUserCourseBuyLogStatement.setString(7,resultSet.getString("days"));
|
||||
addUserCourseBuyLogStatement.setString(8,resultSet.getString("price"));
|
||||
addUserCourseBuyLogStatement.addBatch();
|
||||
}
|
||||
addUserCourseBuyLogStatement.executeBatch();
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void distinctUserCourseBuy() {
|
||||
try {
|
||||
Connection fzdsconn = DriverManager.getConnection(
|
||||
"jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book_test?rewriteBatchedStatements=true",
|
||||
"nuttyreading", "Wu751019!");
|
||||
PreparedStatement statement = fzdsconn.prepareStatement("""
|
||||
select user_id,course_id,catalogue_id,count(1) c from user_course_buy where del_flag = 0
|
||||
group by user_id,course_id,catalogue_id
|
||||
HAVING c > 1
|
||||
order by c desc
|
||||
""");
|
||||
ResultSet resultSet = statement.executeQuery();
|
||||
while(resultSet.next()){
|
||||
System.out.println(resultSet.getString("user_id"));
|
||||
PreparedStatement ucbStatement = fzdsconn.prepareStatement("select * from user_course_buy where del_flag = 0 " +
|
||||
"and user_id = "+resultSet.getString("user_id")+" " +
|
||||
"and course_id = "+resultSet.getString("course_id")+" " +
|
||||
"and catalogue_id = "+resultSet.getString("catalogue_id")+"");
|
||||
ResultSet ucbResultSet = ucbStatement.executeQuery();
|
||||
int i=0;
|
||||
while(ucbResultSet.next()){
|
||||
if(i!=0){
|
||||
PreparedStatement delStatement = fzdsconn.prepareStatement(
|
||||
"update user_course_buy set del_flag = -1 where id = "+ucbResultSet.getString("id"));
|
||||
delStatement.executeUpdate();
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void userEbookBuy250410() {
|
||||
|
||||
@@ -10,6 +10,14 @@ import com.peanut.common.utils.R;
|
||||
import com.peanut.config.Constants;
|
||||
import com.peanut.config.DelayQueueConfig;
|
||||
import com.peanut.modules.book.service.*;
|
||||
import com.peanut.modules.book.service.BuyOrderService;
|
||||
import com.peanut.modules.book.service.CityService;
|
||||
import com.peanut.modules.book.service.CountyService;
|
||||
import com.peanut.modules.book.service.ExpressOrderService;
|
||||
import com.peanut.modules.book.service.MyUserService;
|
||||
import com.peanut.modules.book.service.ProvinceService;
|
||||
import com.peanut.modules.book.service.TransactionDetailsService;
|
||||
import com.peanut.modules.book.service.UserAddressService;
|
||||
import com.peanut.modules.book.to.UserOrderDto;
|
||||
import com.peanut.modules.book.vo.UserAddressVo;
|
||||
import com.peanut.modules.book.vo.request.BuyOrderListRequestVo;
|
||||
@@ -20,10 +28,7 @@ import com.peanut.modules.book.vo.response.BuyOrderResponseVo;
|
||||
import com.peanut.modules.book.vo.response.OrderAddressResponseVo;
|
||||
import com.peanut.modules.common.dao.UserCourseBuyDao;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.service.CouponHistoryService;
|
||||
import com.peanut.modules.common.service.CouponService;
|
||||
import com.peanut.modules.common.service.JfTransactionDetailsService;
|
||||
import com.peanut.modules.common.service.UserVipService;
|
||||
import com.peanut.modules.common.service.*;
|
||||
import com.peanut.modules.pay.weChatPay.dto.WechatPaymentInfo;
|
||||
import com.peanut.modules.pay.weChatPay.service.WxpayService;
|
||||
import com.peanut.modules.sys.entity.SysConfigEntity;
|
||||
@@ -105,6 +110,8 @@ public class BuyOrderController {
|
||||
private CouponService couponService;
|
||||
@Autowired
|
||||
private CouponHistoryService couponHistoryService;
|
||||
@Autowired
|
||||
private UserCourseBuyLogService userCourseBuyLogService;
|
||||
|
||||
@RequestMapping(value = "/decomposeShipment", method = RequestMethod.POST)
|
||||
public R decomposeShipment(@RequestBody BuyOrderListRequestVo requestVo) {
|
||||
@@ -1125,8 +1132,18 @@ public class BuyOrderController {
|
||||
wrapper2.eq(UserCourseBuyEntity::getCatalogueId,s.getCatalogueId());
|
||||
wrapper2.and(r->r.isNull(UserCourseBuyEntity::getEndTime).or().gt(UserCourseBuyEntity::getEndTime,new Date()));
|
||||
List<UserCourseBuyEntity> userCourseBuyEntities = userCourseBuyDao.selectList(wrapper2);
|
||||
//插入开课记录
|
||||
UserCourseBuyLog userCourseBuyLog = new UserCourseBuyLog();
|
||||
userCourseBuyLog.setUserId(orderEntity.getUserId());
|
||||
userCourseBuyLog.setType("order");
|
||||
userCourseBuyLog.setPayType("天医币");
|
||||
userCourseBuyLog.setPayTime(orderEntity.getCreateTime());
|
||||
userCourseBuyLog.setOrderSn(orderEntity.getOrderSn());
|
||||
if(userCourseBuyEntities.size()>0){//延长有效期
|
||||
UserCourseBuyEntity userCourseBuyEntity = userCourseBuyEntities.get(0);
|
||||
userCourseBuyLog.setUserCourseBuyId(userCourseBuyEntity.getId());
|
||||
userCourseBuyLog.setBeginDay(userCourseBuyEntity.getDays()+1);
|
||||
userCourseBuyLog.setDays(s.getDays());
|
||||
userCourseBuyEntity.setDays(userCourseBuyEntity.getDays()+s.getDays());
|
||||
if(userCourseBuyEntity.getEndTime()!=null){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
@@ -1150,7 +1167,13 @@ public class BuyOrderController {
|
||||
// userCourseBuyEntity.setEndTime(cal.getTime());
|
||||
userCourseBuyEntity.setCome("虚拟币购买:"+orderEntity.getOrderSn());
|
||||
userCourseBuyDao.insert(userCourseBuyEntity);
|
||||
userCourseBuyLog.setUserCourseBuyId(userCourseBuyEntity.getId());
|
||||
userCourseBuyLog.setBeginDay(0);
|
||||
userCourseBuyLog.setDays(s.getDays());
|
||||
}
|
||||
userCourseBuyLog.setFee(orderEntity.getRealMoney().divide(new BigDecimal(orderCourse.size()),2, BigDecimal.ROUND_HALF_UP));
|
||||
userCourseBuyLog.setJf(orderEntity.getJfDeduction().divide(new BigDecimal(orderCourse.size()),2, BigDecimal.ROUND_HALF_UP));
|
||||
userCourseBuyLogService.save(userCourseBuyLog);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -642,18 +642,17 @@ public class MyUserController {
|
||||
}
|
||||
TransactionDetailsEntity transactionDetailsEntity = new TransactionDetailsEntity();
|
||||
transactionDetailsEntity.setUserId(Integer.valueOf(id));
|
||||
transactionDetailsEntity.setOrderType("后台充扣操作");
|
||||
transactionDetailsEntity.setTel(byId.getTel());
|
||||
transactionDetailsEntity.setUserName(byId.getNickname());
|
||||
transactionDetailsEntity.setNote(params.get("note"));
|
||||
if (pointType.equals("0")) {
|
||||
transactionDetailsEntity.setOrderType("后台充值");
|
||||
transactionDetailsEntity.setChangeAmount(pointAmount);
|
||||
transactionDetailsEntity.setRemark("充值");
|
||||
transactionDetailsEntity.setPayMethod(params.get("payMethod"));
|
||||
transactionDetailsEntity.setPayNo(params.get("payNo"));
|
||||
}else {
|
||||
transactionDetailsEntity.setOrderType("后台扣费");
|
||||
transactionDetailsEntity.setChangeAmount(pointAmount.negate());
|
||||
transactionDetailsEntity.setRemark("扣费");
|
||||
}
|
||||
transactionDetailsEntity.setUserBalance(i);
|
||||
transactionDetailsService.save(transactionDetailsEntity);
|
||||
|
||||
@@ -59,7 +59,7 @@ public class TransactionDetailsServiceImpl extends ServiceImpl<TransactionDetail
|
||||
@Override
|
||||
public void recordTransaction(BuyOrder buyOrder, MyUserEntity user, BigDecimal totalPrice) {
|
||||
TransactionDetailsEntity transactionDetailsEntity = new TransactionDetailsEntity();
|
||||
transactionDetailsEntity.setRemark("订单编号为 - " + buyOrder.getOrderSn());
|
||||
transactionDetailsEntity.setPayNo(buyOrder.getOrderSn());
|
||||
transactionDetailsEntity.setUserId(user.getId());
|
||||
transactionDetailsEntity.setUserName(user.getNickname());
|
||||
transactionDetailsEntity.setChangeAmount(totalPrice.negate());
|
||||
@@ -76,7 +76,8 @@ public class TransactionDetailsServiceImpl extends ServiceImpl<TransactionDetail
|
||||
transactionDetailsEntity.setChangeAmount(new BigDecimal(money));
|
||||
transactionDetailsEntity.setOrderType("充值");
|
||||
transactionDetailsEntity.setRelationId(payXxxOrderId);
|
||||
transactionDetailsEntity.setRemark(AppName+"充值:"+orderSn);
|
||||
transactionDetailsEntity.setPayMethod(AppName);
|
||||
transactionDetailsEntity.setPayNo(orderSn);
|
||||
transactionDetailsEntity.setUserBalance(user.getPeanutCoin());
|
||||
transactionDetailsEntity.setUserName(user.getNickname());
|
||||
transactionDetailsEntity.setTel(user.getTel());
|
||||
|
||||
@@ -51,7 +51,7 @@ public class TransactionDetailsController {
|
||||
List<TransactionDetailsEntity> list = transactionDetailsService.list(wrapper);
|
||||
for (TransactionDetailsEntity detail:list){
|
||||
String productName = "";
|
||||
String orderSn = detail.getRemark().contains("20")?detail.getRemark().substring(detail.getRemark().indexOf("20")):"";
|
||||
String orderSn = detail.getPayNo();
|
||||
BuyOrder buyOrder = buyOrderService.getOne(new LambdaQueryWrapper<BuyOrder>()
|
||||
.eq(BuyOrder::getOrderSn,orderSn));
|
||||
if (buyOrder!=null){
|
||||
|
||||
@@ -18,6 +18,8 @@ import java.util.Map;
|
||||
@Mapper
|
||||
public interface TransactionDetailsDao extends BaseMapper<TransactionDetailsEntity> {
|
||||
|
||||
Map<String,Object> getUserSurplusPeanutCoin(@Param("date") String date);
|
||||
|
||||
List<Map<String,Object>> getTransactionDetailsTotal(@Param("date") String date);
|
||||
|
||||
List<Map<String,Object>> getTransactionDetailsInfo(@Param("date") String date);
|
||||
|
||||
@@ -3,7 +3,15 @@ package com.peanut.modules.common.dao;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.peanut.modules.common.entity.UserCourseBuyEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface UserCourseBuyDao extends MPJBaseMapper<UserCourseBuyEntity> {
|
||||
|
||||
List<Map<String,Object>> getUserCourseBuyInfo(@Param("date") String date);
|
||||
|
||||
List<Map<String,Object>> getUserCourseBuyInfoTotal(@Param("date") String date);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.dao;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.peanut.modules.common.entity.UserCourseBuyLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UserCourseBuyLogDao extends MPJBaseMapper<UserCourseBuyLog> {
|
||||
}
|
||||
@@ -43,10 +43,6 @@ public class TransactionDetailsEntity implements Serializable {
|
||||
* 关联id
|
||||
*/
|
||||
private Integer relationId;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.peanut.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("user_course_buy_log")
|
||||
public class UserCourseBuyLog {
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
private Integer userCourseBuyId;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private String type;
|
||||
|
||||
private String payType;
|
||||
|
||||
private Date payTime;
|
||||
|
||||
private String orderSn;
|
||||
|
||||
private Integer adminId;
|
||||
|
||||
private Integer beginDay;
|
||||
|
||||
private Integer days;
|
||||
|
||||
private BigDecimal fee;
|
||||
|
||||
private BigDecimal jf;
|
||||
|
||||
private String remark;
|
||||
|
||||
private String state;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import java.util.Map;
|
||||
|
||||
public interface TransactionDetailsService extends IService<TransactionDetailsEntity> {
|
||||
|
||||
Map<String,Object> getUserSurplusPeanutCoin(String date);
|
||||
|
||||
List<Map<String,Object>> getTransactionDetailsTotal(String date);
|
||||
|
||||
List<Map<String,Object>> getTransactionDetailsInfo(String date);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.common.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.UserCourseBuyLog;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface UserCourseBuyLogService extends IService<UserCourseBuyLog> {
|
||||
|
||||
List<Map<String,Object>> getIncome(String date);
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.peanut.modules.common.entity.UserVip;
|
||||
import com.peanut.modules.common.entity.UserVipLog;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -12,6 +13,8 @@ public interface UserVipLogService extends IService<UserVipLog> {
|
||||
|
||||
boolean addUserVipLog(UserVipLog userVipLog);
|
||||
|
||||
boolean addUserVipLogOrder(int userId, int userVipId,String orderSn, Date startTime, Date endTime, BigDecimal fee, BigDecimal jf, String payType);
|
||||
|
||||
boolean addUserVipLog(Map<String, Object> params, UserVip userVip);
|
||||
|
||||
BigDecimal countDayAmount(UserVipLog userVipLog);
|
||||
|
||||
@@ -13,6 +13,12 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@Service("commonTransactionDetailsService")
|
||||
public class TransactionDetailsServiceImpl extends ServiceImpl<TransactionDetailsDao, TransactionDetailsEntity> implements TransactionDetailsService {
|
||||
|
||||
@Override
|
||||
public Map<String,Object> getUserSurplusPeanutCoin(String date) {
|
||||
return this.baseMapper.getUserSurplusPeanutCoin(date);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getTransactionDetailsTotal(String date) {
|
||||
return this.baseMapper.getTransactionDetailsTotal(date);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.peanut.modules.common.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.modules.common.dao.UserCourseBuyLogDao;
|
||||
import com.peanut.modules.common.entity.UserCourseBuyLog;
|
||||
import com.peanut.modules.common.service.UserCourseBuyLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service("commonUserCourseBuyLogService")
|
||||
public class UserCourseBuyLogServiceImpl extends ServiceImpl<UserCourseBuyLogDao, UserCourseBuyLog> implements UserCourseBuyLogService {
|
||||
@Override
|
||||
public List<Map<String,Object>> getIncome(String date) {
|
||||
return this.baseMapper.selectMaps(new MPJLambdaWrapper<UserCourseBuyLog>()
|
||||
.select(UserCourseBuyLog::getPayType)
|
||||
.selectSum(UserCourseBuyLog::getFee)
|
||||
.apply("DATE_FORMAT(pay_time,'%Y-%m') = '"+date+"'")
|
||||
.groupBy(UserCourseBuyLog::getPayType));
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.peanut.modules.common.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.DateUtils;
|
||||
import com.peanut.modules.common.dao.UserVipLogDao;
|
||||
import com.peanut.modules.common.entity.UserVip;
|
||||
import com.peanut.modules.common.entity.UserVipLog;
|
||||
@@ -23,13 +24,30 @@ public class UserVipLogServiceImpl extends ServiceImpl<UserVipLogDao, UserVipLog
|
||||
return this.save(userVipLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addUserVipLogOrder(int userId,int userVipId,String orderSn,Date startTime,Date endTime,BigDecimal fee,BigDecimal jf,String payType) {
|
||||
UserVipLog userVipLog = new UserVipLog();
|
||||
userVipLog.setUserId(userId);
|
||||
userVipLog.setUserVipId(userVipId);
|
||||
userVipLog.setType("order");
|
||||
userVipLog.setPayTime(new Date());
|
||||
userVipLog.setOrderSn(orderSn);
|
||||
userVipLog.setStartTime(startTime);
|
||||
userVipLog.setEndTime(endTime);
|
||||
userVipLog.setFee(fee);
|
||||
userVipLog.setJf(jf);
|
||||
userVipLog.setPayType(payType);
|
||||
userVipLog.setDayAmount(countDayAmount(userVipLog));
|
||||
return this.save(userVipLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addUserVipLog(Map<String, Object> params, UserVip userVip) {
|
||||
UserVipLog userVipLog = new UserVipLog();
|
||||
userVipLog.setUserId(userVip.getUserId());
|
||||
userVipLog.setUserVipId(userVip.getId());
|
||||
userVipLog.setType(params.get("userVipType").toString());
|
||||
userVipLog.setPayTime(new Date());
|
||||
userVipLog.setPayTime(DateUtils.stringToDate(params.get("payTime").toString(),"yyyy-MM-dd HH:mm:ss"));
|
||||
userVipLog.setAdminId(Integer.parseInt(params.get("adminId").toString()));
|
||||
userVipLog.setStartTime(userVip.getStartTime());
|
||||
userVipLog.setEndTime(userVip.getEndTime());
|
||||
|
||||
@@ -5,12 +5,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.ShiroUtils;
|
||||
import com.peanut.modules.common.dao.*;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.service.UserVipLogService;
|
||||
import com.peanut.modules.common.service.UserVipService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@@ -29,6 +31,8 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
||||
private CourseToPsycheDao courseToPsycheDao;
|
||||
@Autowired
|
||||
private VipBuyConfigDao vipBuyConfigDao;
|
||||
@Autowired
|
||||
private UserVipLogService userVipLogService;
|
||||
|
||||
@Override
|
||||
public boolean isVip() {
|
||||
@@ -246,6 +250,13 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
||||
|
||||
@Override
|
||||
public void openVipForUser(BuyOrder buyOrder) {
|
||||
String payType = "1".equals(buyOrder.getPaymentMethod())?"微信":("2".equals(buyOrder.getPaymentMethod())?"支付宝":"天医币");
|
||||
BigDecimal fee4 = buyOrder.getRealMoney().divide(new BigDecimal(4),2,BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal fee2 = buyOrder.getRealMoney().divide(new BigDecimal(2),2,BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal jf4 = buyOrder.getJfDeduction().divide(new BigDecimal(2),2,BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal jf2 = buyOrder.getJfDeduction().divide(new BigDecimal(2),2,BigDecimal.ROUND_HALF_UP);
|
||||
String orderSn = buyOrder.getOrderSn();
|
||||
|
||||
VipBuyConfigEntity vipBuyConfigEntity = vipBuyConfigDao.selectById(buyOrder.getVipBuyConfigId());
|
||||
if(vipBuyConfigEntity.getType()==1){//医学超级
|
||||
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
|
||||
@@ -262,8 +273,11 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
||||
if (uv.getType()==i){
|
||||
flag = true;
|
||||
userVip = uv;
|
||||
userVip.setEndTime(DateUtils.addYears(uv.getEndTime(),vipBuyConfigEntity.getYear()));
|
||||
Date startTime = uv.getEndTime();
|
||||
Date endTime = DateUtils.addYears(uv.getEndTime(),vipBuyConfigEntity.getYear());
|
||||
userVip.setEndTime(endTime);
|
||||
userVipDao.updateById(userVip);
|
||||
userVipLogService.addUserVipLogOrder(userVip.getUserId(),userVip.getId(),orderSn,startTime,endTime,fee4,jf4,payType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -271,6 +285,8 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
||||
userVip.setStartTime(new Date());
|
||||
userVip.setEndTime(DateUtils.addYears(userVip.getStartTime(),vipBuyConfigEntity.getYear()));
|
||||
userVipDao.insert(userVip);
|
||||
userVipLogService.addUserVipLogOrder(userVip.getUserId(),userVip.getId(),orderSn,
|
||||
userVip.getStartTime(),userVip.getEndTime(), fee4,jf4,payType);
|
||||
}
|
||||
}
|
||||
}else if(vipBuyConfigEntity.getType()==11){//延期医学超级
|
||||
@@ -282,8 +298,11 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
||||
.eq(UserVip::getUserId,buyOrder.getUserId()).eq(UserVip::getType,i).orderByDesc(UserVip::getEndTime));
|
||||
UserVip userVip = userVipList.get(0);
|
||||
if (userVip.getState()==0) {
|
||||
userVip.setEndTime(DateUtils.addYears(userVip.getEndTime(),vipBuyConfigEntity.getYear()));
|
||||
Date startTime = userVip.getEndTime();
|
||||
Date endTime = DateUtils.addYears(userVip.getEndTime(),vipBuyConfigEntity.getYear());
|
||||
userVip.setEndTime(endTime);
|
||||
userVipDao.updateById(userVip);
|
||||
userVipLogService.addUserVipLogOrder(userVip.getUserId(),userVip.getId(),orderSn,startTime,endTime,fee4,jf4,payType);
|
||||
}else {
|
||||
UserVip uv = new UserVip();
|
||||
uv.setUserId(buyOrder.getUserId());
|
||||
@@ -291,6 +310,7 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
||||
uv.setStartTime(new Date());
|
||||
uv.setEndTime(DateUtils.addYears(uv.getStartTime(),vipBuyConfigEntity.getYear()));
|
||||
userVipDao.insert(uv);
|
||||
userVipLogService.addUserVipLogOrder(uv.getUserId(),uv.getId(),orderSn,uv.getStartTime(),uv.getEndTime(),fee4,jf4,payType);
|
||||
}
|
||||
}
|
||||
}else if (vipBuyConfigEntity.getType()==2){//国心超级
|
||||
@@ -305,8 +325,11 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
||||
if (uv.getType()==i){
|
||||
flag = true;
|
||||
userVip = uv;
|
||||
userVip.setEndTime(DateUtils.addYears(uv.getEndTime(),vipBuyConfigEntity.getYear()));
|
||||
Date startTime = userVip.getEndTime();
|
||||
Date endTime = DateUtils.addYears(userVip.getEndTime(),vipBuyConfigEntity.getYear());
|
||||
userVip.setEndTime(endTime);
|
||||
userVipDao.updateById(userVip);
|
||||
userVipLogService.addUserVipLogOrder(userVip.getUserId(),userVip.getId(),orderSn,startTime,endTime,fee2,jf2,payType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -314,6 +337,7 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
||||
userVip.setStartTime(new Date());
|
||||
userVip.setEndTime(DateUtils.addYears(userVip.getStartTime(),vipBuyConfigEntity.getYear()));
|
||||
userVipDao.insert(userVip);
|
||||
userVipLogService.addUserVipLogOrder(userVip.getUserId(),userVip.getId(),orderSn,userVip.getStartTime(),userVip.getEndTime(),fee2,jf2,payType);
|
||||
}
|
||||
}
|
||||
}else if(vipBuyConfigEntity.getType()==21){//延期国心超级
|
||||
@@ -322,8 +346,11 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
||||
.eq(UserVip::getUserId,buyOrder.getUserId()).eq(UserVip::getType,i).orderByDesc(UserVip::getEndTime));
|
||||
UserVip userVip = userVipList.get(0);
|
||||
if (userVip.getState()==0) {
|
||||
userVip.setEndTime(DateUtils.addYears(userVip.getEndTime(),vipBuyConfigEntity.getYear()));
|
||||
Date startTime = userVip.getEndTime();
|
||||
Date endTime = DateUtils.addYears(userVip.getEndTime(),vipBuyConfigEntity.getYear());
|
||||
userVip.setEndTime(endTime);
|
||||
userVipDao.updateById(userVip);
|
||||
userVipLogService.addUserVipLogOrder(userVip.getUserId(),userVip.getId(),orderSn,startTime,endTime,fee2,jf2,payType);
|
||||
}else {
|
||||
UserVip uv = new UserVip();
|
||||
uv.setUserId(buyOrder.getUserId());
|
||||
@@ -331,6 +358,7 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
||||
uv.setStartTime(new Date());
|
||||
uv.setEndTime(DateUtils.addYears(uv.getStartTime(),vipBuyConfigEntity.getYear()));
|
||||
userVipDao.insert(uv);
|
||||
userVipLogService.addUserVipLogOrder(uv.getUserId(),uv.getId(),orderSn,uv.getStartTime(),uv.getEndTime(),fee2,jf2,payType);
|
||||
}
|
||||
}
|
||||
}else if (vipBuyConfigEntity.getType()==4||vipBuyConfigEntity.getType()==9||vipBuyConfigEntity.getType()==5||vipBuyConfigEntity.getType()==6||
|
||||
@@ -341,6 +369,8 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
||||
userVip.setStartTime(new Date());
|
||||
userVip.setEndTime(DateUtils.addYears(userVip.getStartTime(),vipBuyConfigEntity.getYear()));
|
||||
userVipDao.insert(userVip);
|
||||
userVipLogService.addUserVipLogOrder(userVip.getUserId(),userVip.getId(),orderSn,userVip.getStartTime(),userVip.getEndTime(),
|
||||
buyOrder.getRealMoney(),buyOrder.getJfDeduction(),payType);
|
||||
}else if (vipBuyConfigEntity.getType()==41||vipBuyConfigEntity.getType()==91||vipBuyConfigEntity.getType()==51||vipBuyConfigEntity.getType()==61||
|
||||
vipBuyConfigEntity.getType()==71||vipBuyConfigEntity.getType()==81){
|
||||
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
|
||||
@@ -349,8 +379,12 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
||||
.orderByDesc(UserVip::getEndTime));
|
||||
UserVip userVip = userVipList.get(0);
|
||||
if (userVip.getState()==0) {
|
||||
userVip.setEndTime(DateUtils.addYears(userVip.getEndTime(),vipBuyConfigEntity.getYear()));
|
||||
Date startTime = userVip.getEndTime();
|
||||
Date endTime = DateUtils.addYears(userVip.getEndTime(),vipBuyConfigEntity.getYear());
|
||||
userVip.setEndTime(endTime);
|
||||
userVipDao.updateById(userVip);
|
||||
userVipLogService.addUserVipLogOrder(userVip.getUserId(),userVip.getId(),orderSn,startTime,userVip.getEndTime(),
|
||||
buyOrder.getRealMoney(),buyOrder.getJfDeduction(),payType);
|
||||
}else {
|
||||
UserVip uv = new UserVip();
|
||||
uv.setUserId(buyOrder.getUserId());
|
||||
@@ -358,6 +392,8 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
||||
uv.setStartTime(new Date());
|
||||
uv.setEndTime(DateUtils.addYears(uv.getStartTime(),vipBuyConfigEntity.getYear()));
|
||||
userVipDao.insert(uv);
|
||||
userVipLogService.addUserVipLogOrder(uv.getUserId(),uv.getId(),orderSn,uv.getStartTime(),uv.getEndTime(),
|
||||
buyOrder.getRealMoney(),buyOrder.getJfDeduction(),payType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,9 @@ public class AddCourses {
|
||||
private String catalogue_id;
|
||||
private Integer days;
|
||||
private ArrayList<MyUserEntity> list;
|
||||
private String payType;
|
||||
private String orderSn;
|
||||
private String fee;
|
||||
private String jf;
|
||||
private String remark;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.peanut.modules.master.controller;
|
||||
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.UserCourseBuyLog;
|
||||
import com.peanut.modules.common.service.BuyOrderService;
|
||||
import com.peanut.modules.common.service.TransactionDetailsService;
|
||||
import com.peanut.modules.common.service.UserCourseBuyLogService;
|
||||
import com.peanut.modules.common.service.UserVipLogService;
|
||||
import com.peanut.modules.master.service.UserCourseBuyService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
@@ -34,11 +37,100 @@ public class StatisticsController {
|
||||
private BuyOrderService buyOrderService;
|
||||
@Autowired
|
||||
private TransactionDetailsService transactionDetailsService;
|
||||
@Autowired
|
||||
private UserCourseBuyService userCourseBuyService;
|
||||
@Autowired
|
||||
private UserCourseBuyLogService userCourseBuyLogService;
|
||||
|
||||
|
||||
@RequestMapping("/getUserCourseBuyInfoTotal")
|
||||
public R getUserCourseBuyInfoTotal(@RequestBody Map<String, Object> params) {
|
||||
List<Map<String,Object>> tanxiaoTotal = userCourseBuyService.getUserCourseBuyInfoTotal(params.get("date").toString());
|
||||
List<Map<String,Object>> income = userCourseBuyLogService.getIncome(params.get("date").toString().substring(0,7));
|
||||
return R.ok().put("tanxiaoTotal", tanxiaoTotal).put("income", income);
|
||||
}
|
||||
|
||||
//课程明细
|
||||
@RequestMapping("/getUserCourseBuyInfo")
|
||||
public void getUserCourseBuyInfo(HttpServletResponse response, @RequestBody Map<String,Object> params){
|
||||
List<Map<String,Object>> maps = userCourseBuyService.getUserCourseBuyInfo(params.get("date").toString());
|
||||
XSSFWorkbook wb = new XSSFWorkbook();
|
||||
Sheet sheet = wb.createSheet("课程明细");
|
||||
Row titleRow = sheet.createRow(0);
|
||||
titleRow.createCell(0).setCellValue("姓名");
|
||||
titleRow.createCell(1).setCellValue("电话");
|
||||
titleRow.createCell(2).setCellValue("课程");
|
||||
titleRow.createCell(3).setCellValue("目录");
|
||||
titleRow.createCell(4).setCellValue("开始时间");
|
||||
titleRow.createCell(5).setCellValue("结束时间");
|
||||
titleRow.createCell(6).setCellValue("总天数");
|
||||
titleRow.createCell(7).setCellValue("开通渠道");
|
||||
titleRow.createCell(8).setCellValue("支付类型");
|
||||
titleRow.createCell(9).setCellValue("支付时间");
|
||||
titleRow.createCell(10).setCellValue("订单编号");
|
||||
titleRow.createCell(11).setCellValue("天数");
|
||||
titleRow.createCell(12).setCellValue("金额");
|
||||
titleRow.createCell(13).setCellValue("备注");
|
||||
titleRow.createCell(14).setCellValue("每日摊销");
|
||||
titleRow.createCell(15).setCellValue("已摊销天数");
|
||||
titleRow.createCell(16).setCellValue("本期天数");
|
||||
titleRow.createCell(17).setCellValue("已摊销金额");
|
||||
titleRow.createCell(18).setCellValue("本期摊销金额");
|
||||
titleRow.createCell(19).setCellValue("剩余金额");
|
||||
int cell = 1;
|
||||
for (Map<String,Object> map : maps) {
|
||||
Row row = sheet.createRow(cell);
|
||||
row.createCell(0).setCellValue(map.get("name").toString());
|
||||
row.createCell(1).setCellValue(map.get("tel").toString());
|
||||
row.createCell(2).setCellValue(map.get("ctitle").toString());
|
||||
row.createCell(3).setCellValue(map.get("cctitle").toString());
|
||||
row.createCell(4).setCellValue(map.get("startTime").toString());
|
||||
row.createCell(5).setCellValue(map.get("endTime").toString());
|
||||
row.createCell(6).setCellValue(map.get("totalDays").toString());
|
||||
row.createCell(7).setCellValue(map.get("type").toString());
|
||||
row.createCell(8).setCellValue(map.get("payType").toString());
|
||||
row.createCell(9).setCellValue(map.get("payTime").toString());
|
||||
row.createCell(10).setCellValue(map.get("orderSn").toString());
|
||||
row.createCell(11).setCellValue(map.get("days").toString());
|
||||
row.createCell(12).setCellValue(map.get("fee").toString());
|
||||
row.createCell(13).setCellValue(map.get("remark").toString());
|
||||
row.createCell(14).setCellValue(map.get("dayAmount").toString());
|
||||
row.createCell(15).setCellValue(map.get("alreadyDay").toString());
|
||||
row.createCell(16).setCellValue(map.get("currentDay").toString());
|
||||
row.createCell(17).setCellValue(map.get("alreadyTanxiao").toString());
|
||||
row.createCell(18).setCellValue(map.get("currentTanxiao").toString());
|
||||
row.createCell(19).setCellValue(map.get("surplusTanxiao").toString());
|
||||
//序号自增
|
||||
cell++;
|
||||
}
|
||||
String fileName = "课程明细.xlsx";
|
||||
OutputStream outputStream =null;
|
||||
try {
|
||||
//文件名编码格式
|
||||
fileName = URLEncoder.encode(fileName,"UTF-8");
|
||||
//设置ContentType请求信息格式
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
//设置标头
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName);
|
||||
outputStream = response.getOutputStream();
|
||||
wb.write(outputStream);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
try {
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/getTransactionDetailsTotal")
|
||||
public R getTransactionDetailsTotal(@RequestBody Map<String, Object> params) {
|
||||
Map<String,Object> map = transactionDetailsService.getUserSurplusPeanutCoin(params.get("date").toString());
|
||||
List<Map<String,Object>> list = transactionDetailsService.getTransactionDetailsTotal(params.get("date").toString());
|
||||
return R.ok().put("total", list);
|
||||
return R.ok().put("total", list).put("surplus", map);
|
||||
}
|
||||
|
||||
//导出实物订单明细
|
||||
@@ -69,8 +161,8 @@ public class StatisticsController {
|
||||
row.createCell(1).setCellValue(map.get("name").toString());
|
||||
row.createCell(2).setCellValue(map.get("tel").toString());
|
||||
row.createCell(3).setCellValue(map.get("type").toString());
|
||||
row.createCell(4).setCellValue(map.get("payType").toString());
|
||||
row.createCell(5).setCellValue(map.get("orderSn").toString());
|
||||
row.createCell(4).setCellValue(map.get("payMethod").toString());
|
||||
row.createCell(5).setCellValue(map.get("payNo").toString());
|
||||
row.createCell(6).setCellValue(map.get("changeAmount").toString());
|
||||
row.createCell(7).setCellValue(map.get("note").toString());
|
||||
row.createCell(8).setCellValue(map.get("goodsType").toString());
|
||||
@@ -185,18 +277,19 @@ public class StatisticsController {
|
||||
titleRow.createCell(2).setCellValue("VIP类型");
|
||||
titleRow.createCell(3).setCellValue("开始时间");
|
||||
titleRow.createCell(4).setCellValue("结束时间");
|
||||
titleRow.createCell(5).setCellValue("订单号");
|
||||
titleRow.createCell(6).setCellValue("支付方式");
|
||||
titleRow.createCell(7).setCellValue("备注");
|
||||
titleRow.createCell(8).setCellValue("金额");
|
||||
titleRow.createCell(9).setCellValue("总天数");
|
||||
titleRow.createCell(10).setCellValue("每日摊销");
|
||||
titleRow.createCell(11).setCellValue("已摊销天数");
|
||||
titleRow.createCell(12).setCellValue("当月摊销天数");
|
||||
titleRow.createCell(13).setCellValue("未摊销天数");
|
||||
titleRow.createCell(14).setCellValue("已摊销金额");
|
||||
titleRow.createCell(15).setCellValue("当月摊销金额");
|
||||
titleRow.createCell(16).setCellValue("剩余摊销金额");
|
||||
titleRow.createCell(5).setCellValue("支付时间");
|
||||
titleRow.createCell(6).setCellValue("订单号");
|
||||
titleRow.createCell(7).setCellValue("支付方式");
|
||||
titleRow.createCell(8).setCellValue("备注");
|
||||
titleRow.createCell(9).setCellValue("金额");
|
||||
titleRow.createCell(10).setCellValue("总天数");
|
||||
titleRow.createCell(11).setCellValue("每日摊销");
|
||||
titleRow.createCell(12).setCellValue("已摊销天数");
|
||||
titleRow.createCell(13).setCellValue("当月摊销天数");
|
||||
titleRow.createCell(14).setCellValue("未摊销天数");
|
||||
titleRow.createCell(15).setCellValue("已摊销金额");
|
||||
titleRow.createCell(16).setCellValue("当月摊销金额");
|
||||
titleRow.createCell(17).setCellValue("剩余摊销金额");
|
||||
//序号,默认为1
|
||||
int cell = 1;
|
||||
//遍历
|
||||
@@ -207,18 +300,19 @@ public class StatisticsController {
|
||||
row.createCell(2).setCellValue(map.get("type").toString());
|
||||
row.createCell(3).setCellValue(map.get("startTime").toString());
|
||||
row.createCell(4).setCellValue(map.get("endTime").toString());
|
||||
row.createCell(5).setCellValue(map.get("orderSn").toString());
|
||||
row.createCell(6).setCellValue(map.get("payType").toString());
|
||||
row.createCell(7).setCellValue(map.get("remark").toString());
|
||||
row.createCell(8).setCellValue(map.get("fee").toString());
|
||||
row.createCell(9).setCellValue(map.get("totalDays").toString());
|
||||
row.createCell(10).setCellValue(map.get("dayAmount").toString());
|
||||
row.createCell(11).setCellValue(map.get("alreadyDays").toString());
|
||||
row.createCell(12).setCellValue(map.get("currentDays").toString());
|
||||
row.createCell(13).setCellValue(map.get("notyetDays").toString());
|
||||
row.createCell(14).setCellValue(map.get("alreadyTanxiao").toString());
|
||||
row.createCell(15).setCellValue(map.get("currentTanxiao").toString());
|
||||
row.createCell(16).setCellValue(map.get("notyetTanxiao").toString());
|
||||
row.createCell(5).setCellValue(map.get("payTime").toString());
|
||||
row.createCell(6).setCellValue(map.get("orderSn").toString());
|
||||
row.createCell(7).setCellValue(map.get("payType").toString());
|
||||
row.createCell(8).setCellValue(map.get("remark").toString());
|
||||
row.createCell(9).setCellValue(map.get("fee").toString());
|
||||
row.createCell(10).setCellValue(map.get("totalDays").toString());
|
||||
row.createCell(11).setCellValue(map.get("dayAmount").toString());
|
||||
row.createCell(12).setCellValue(map.get("alreadyDays").toString());
|
||||
row.createCell(13).setCellValue(map.get("currentDays").toString());
|
||||
row.createCell(14).setCellValue(map.get("notyetDays").toString());
|
||||
row.createCell(15).setCellValue(map.get("alreadyTanxiao").toString());
|
||||
row.createCell(16).setCellValue(map.get("currentTanxiao").toString());
|
||||
row.createCell(17).setCellValue(map.get("notyetTanxiao").toString());
|
||||
//序号自增
|
||||
cell++;
|
||||
}
|
||||
|
||||
@@ -5,10 +5,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.DateUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.CourseCatalogueEntity;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.common.entity.MyUserEntity;
|
||||
import com.peanut.modules.common.entity.UserCourseBuyEntity;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.service.UserCourseBuyLogService;
|
||||
import com.peanut.modules.common.to.AddCourses;
|
||||
import com.peanut.modules.common.vo.AddCoursesFrag;
|
||||
import com.peanut.modules.master.service.CourseCatalogueService;
|
||||
@@ -24,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
@@ -43,6 +42,8 @@ public class UserCourseBuyController {
|
||||
private UserCourseBuyService userCourseBuyService;
|
||||
@Autowired
|
||||
private CourseCatalogueService courseCatalogueService;
|
||||
@Autowired
|
||||
private UserCourseBuyLogService userCourseBuyLogService;
|
||||
|
||||
@RequestMapping("/listByPage")
|
||||
public R listByPage(@RequestBody Map<String, Object> params) {
|
||||
@@ -98,6 +99,18 @@ public class UserCourseBuyController {
|
||||
userCourseBuyEntity.setDays(days);
|
||||
userCourseBuyEntity.setCome(come);
|
||||
userCourseBuyService.save(userCourseBuyEntity);
|
||||
UserCourseBuyLog userCourseBuyLog = new UserCourseBuyLog();
|
||||
userCourseBuyLog.setUserCourseBuyId(userCourseBuyEntity.getId());
|
||||
userCourseBuyLog.setUserId(userCourseBuyEntity.getUserId());
|
||||
userCourseBuyLog.setType("master");
|
||||
userCourseBuyLog.setPayType(params.get("payType").toString());
|
||||
userCourseBuyLog.setPayTime(new Date());
|
||||
userCourseBuyLog.setOrderSn(params.get("orderSn").toString());
|
||||
userCourseBuyLog.setDays(days);
|
||||
userCourseBuyLog.setFee(new BigDecimal(params.get("fee").toString()));
|
||||
userCourseBuyLog.setJf(new BigDecimal(params.get("jf").toString()));
|
||||
userCourseBuyLog.setRemark(params.get("remark").toString());
|
||||
userCourseBuyLogService.save(userCourseBuyLog);
|
||||
}else {
|
||||
CourseCatalogueEntity catalogueEntity = courseCatalogueService.getById(id);
|
||||
return R.error(catalogueEntity.getTitle()+"已开通");
|
||||
@@ -107,15 +120,30 @@ public class UserCourseBuyController {
|
||||
}
|
||||
|
||||
@RequestMapping("/delayUserCourseBuy")
|
||||
@Transactional
|
||||
public R delayUserCourseBuy(@RequestBody Map<String, Object> params) {
|
||||
UserCourseBuyEntity userCourseBuyEntity = userCourseBuyService.getById(params.get("id").toString());
|
||||
int days = Integer.parseInt(params.get("days").toString());
|
||||
int oldDay = userCourseBuyEntity.getDays();
|
||||
userCourseBuyEntity.setDays(userCourseBuyEntity.getDays()+days);
|
||||
if (userCourseBuyEntity.getEndTime()!=null){
|
||||
userCourseBuyEntity.setEndTime(DateUtils.addDateDays(userCourseBuyEntity.getEndTime(),days));
|
||||
}
|
||||
userCourseBuyEntity.setCome(userCourseBuyEntity.getCome()+";延期(管理员操作:"+days+","+DateUtils.format(new Date(),"yyyyMMdd")+")");
|
||||
userCourseBuyService.updateById(userCourseBuyEntity);
|
||||
UserCourseBuyLog userCourseBuyLog = new UserCourseBuyLog();
|
||||
userCourseBuyLog.setUserCourseBuyId(userCourseBuyEntity.getId());
|
||||
userCourseBuyLog.setUserId(userCourseBuyEntity.getUserId());
|
||||
userCourseBuyLog.setType("master");
|
||||
userCourseBuyLog.setPayType(params.get("payType").toString());
|
||||
userCourseBuyLog.setPayTime(new Date());
|
||||
userCourseBuyLog.setOrderSn(params.get("orderSn").toString());
|
||||
userCourseBuyLog.setBeginDay(oldDay+1);
|
||||
userCourseBuyLog.setDays(days);
|
||||
userCourseBuyLog.setFee(new BigDecimal(params.get("fee").toString()));
|
||||
userCourseBuyLog.setJf(new BigDecimal(params.get("jf").toString()));
|
||||
userCourseBuyLog.setRemark(params.get("remark").toString());
|
||||
userCourseBuyLogService.save(userCourseBuyLog);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@@ -127,6 +155,7 @@ public class UserCourseBuyController {
|
||||
}
|
||||
|
||||
@RequestMapping("/AddCourses")
|
||||
@Transactional
|
||||
public R AddCourses(@RequestBody AddCourses addCourses){
|
||||
Map<String, ArrayList<AddCoursesFrag>> stringArrayListMap = userCourseBuyService.addCourses(addCourses);
|
||||
return R.ok().put("result",stringArrayListMap);
|
||||
|
||||
@@ -93,14 +93,13 @@ public class UserVipController {
|
||||
if(user.getPeanutCoin().compareTo(fee)>=0){
|
||||
user.setPeanutCoin(user.getPeanutCoin().subtract(fee));
|
||||
TransactionDetailsEntity transactionDetailsEntity = new TransactionDetailsEntity();
|
||||
transactionDetailsEntity.setRemark("后台充扣操作");
|
||||
transactionDetailsEntity.setUserId(user.getId());
|
||||
transactionDetailsEntity.setUserName(user.getNickname());
|
||||
transactionDetailsEntity.setChangeAmount(fee.negate());
|
||||
transactionDetailsEntity.setUserBalance(user.getPeanutCoin());
|
||||
transactionDetailsEntity.setTel(user.getTel());
|
||||
transactionDetailsEntity.setOrderType("扣费");
|
||||
transactionDetailsEntity.setNote("购买VIP");
|
||||
transactionDetailsEntity.setOrderType("后台扣费");
|
||||
transactionDetailsEntity.setNote(params.get("remark").toString());
|
||||
transactionDetailsService.save(transactionDetailsEntity);
|
||||
}else {
|
||||
return R.error("天医币不足");
|
||||
@@ -210,7 +209,7 @@ public class UserVipController {
|
||||
userVipLog.setUserId(userVip.getUserId());
|
||||
userVipLog.setUserVipId(userVip.getId());
|
||||
userVipLog.setType(params.get("type").toString());
|
||||
userVipLog.setPayTime(params.containsKey("payTime")?DateUtils.stringToDate(params.get("payTime").toString(), "yyyy-MM-dd HH:mm:ss"):null);
|
||||
userVipLog.setPayTime(params.containsKey("payTime")?DateUtils.stringToDate(params.get("payTime").toString(), "yyyy-MM-dd HH:mm:ss"):new Date());
|
||||
if (params.containsKey("orderSn")){
|
||||
userVipLog.setOrderSn(params.get("orderSn").toString());
|
||||
}
|
||||
@@ -233,7 +232,7 @@ public class UserVipController {
|
||||
userVipLog.setUserId(Integer.parseInt(userId));
|
||||
userVipLog.setUserVipId(Integer.parseInt(params.get("userVipId").toString()));
|
||||
userVipLog.setType(params.get("type").toString());
|
||||
userVipLog.setPayTime(params.containsKey("payTime")?DateUtils.stringToDate(params.get("payTime").toString(), "yyyy-MM-dd HH:mm:ss"):null);
|
||||
userVipLog.setPayTime(params.containsKey("payTime")?DateUtils.stringToDate(params.get("payTime").toString(), "yyyy-MM-dd HH:mm:ss"):new Date());
|
||||
if (params.containsKey("orderSn")){
|
||||
userVipLog.setOrderSn(params.get("orderSn").toString());
|
||||
}
|
||||
|
||||
@@ -6,8 +6,10 @@ import com.peanut.modules.common.entity.MyUserEntity;
|
||||
import com.peanut.modules.common.entity.UserCourseBuyEntity;
|
||||
import com.peanut.modules.common.to.AddCourses;
|
||||
import com.peanut.modules.common.vo.AddCoursesFrag;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface UserCourseBuyService extends IService<UserCourseBuyEntity> {
|
||||
@@ -19,4 +21,8 @@ public interface UserCourseBuyService extends IService<UserCourseBuyEntity> {
|
||||
Map<String , ArrayList> readExcelForAddCourse(String file);
|
||||
|
||||
Map<String, ArrayList<AddCoursesFrag>> addCourses(AddCourses addCourses);
|
||||
|
||||
List<Map<String,Object>> getUserCourseBuyInfoTotal(String date);
|
||||
|
||||
List<Map<String,Object>> getUserCourseBuyInfo(String date);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package com.peanut.modules.master.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.modules.common.dao.CourseCatalogueDao;
|
||||
import com.peanut.modules.common.dao.MyUserDao;
|
||||
import com.peanut.modules.common.dao.ShopProductCourseDao;
|
||||
import com.peanut.modules.common.dao.UserCourseBuyDao;
|
||||
import com.peanut.common.utils.DateUtils;
|
||||
import com.peanut.modules.common.dao.*;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.to.AddCourses;
|
||||
import com.peanut.modules.common.vo.AddCoursesFrag;
|
||||
@@ -16,9 +14,11 @@ import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.*;
|
||||
@@ -33,8 +33,11 @@ public class UserCourseBuyServiceImpl extends ServiceImpl<UserCourseBuyDao, User
|
||||
public MyUserDao userDao;
|
||||
@Autowired
|
||||
public CourseCatalogueDao courseCatalogueDao;
|
||||
@Autowired
|
||||
public UserCourseBuyLogDao userCourseBuyLogDao;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void addUserCourseBuyRelearn(BuyOrder buyOrder,String come) {
|
||||
String[] info = buyOrder.getRemark().split(",");
|
||||
ShopProductCourseEntity spc = shopProductCourseDao.selectOne(new LambdaQueryWrapper<ShopProductCourseEntity>()
|
||||
@@ -49,7 +52,21 @@ public class UserCourseBuyServiceImpl extends ServiceImpl<UserCourseBuyDao, User
|
||||
userCourseBuyEntity.setDays(90);
|
||||
}
|
||||
userCourseBuyEntity.setCome("复读-"+come);
|
||||
Date date = buyOrder.getCreateTime();
|
||||
userCourseBuyEntity.setStartTime(date);
|
||||
userCourseBuyEntity.setEndTime(DateUtils.addDateDays(date,userCourseBuyEntity.getDays()));
|
||||
this.baseMapper.insert(userCourseBuyEntity);
|
||||
UserCourseBuyLog userCourseBuyLog = new UserCourseBuyLog();
|
||||
userCourseBuyLog.setUserCourseBuyId(userCourseBuyEntity.getId());
|
||||
userCourseBuyLog.setUserId(userCourseBuyEntity.getUserId());
|
||||
userCourseBuyLog.setType("order");
|
||||
userCourseBuyLog.setPayType(buyOrder.getPaymentMethod());
|
||||
userCourseBuyLog.setPayTime(buyOrder.getCreateTime());
|
||||
userCourseBuyLog.setOrderSn(buyOrder.getOrderSn());
|
||||
userCourseBuyLog.setDays(userCourseBuyEntity.getDays());
|
||||
userCourseBuyLog.setFee(buyOrder.getRealMoney());
|
||||
userCourseBuyLog.setJf(buyOrder.getJfDeduction());
|
||||
userCourseBuyLogDao.insert(userCourseBuyLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,6 +115,7 @@ public class UserCourseBuyServiceImpl extends ServiceImpl<UserCourseBuyDao, User
|
||||
|
||||
CourseCatalogueEntity courseCatalogueEntity = courseCatalogueDao.selectById(cata[0]);
|
||||
ArrayList<UserCourseBuyEntity> l = new ArrayList<>();
|
||||
ArrayList<UserCourseBuyLog> logs = new ArrayList<>();
|
||||
for (MyUserEntity m : addCourses.getList()){
|
||||
for (String s : cata) {
|
||||
int check = this.getBaseMapper().selectCount(new LambdaQueryWrapper<UserCourseBuyEntity>()
|
||||
@@ -134,11 +152,36 @@ public class UserCourseBuyServiceImpl extends ServiceImpl<UserCourseBuyDao, User
|
||||
}
|
||||
}
|
||||
this.saveBatch(l);
|
||||
for(UserCourseBuyEntity ucb : l){
|
||||
UserCourseBuyLog userCourseBuyLog = new UserCourseBuyLog();
|
||||
userCourseBuyLog.setUserCourseBuyId(ucb.getId());
|
||||
userCourseBuyLog.setUserId(ucb.getUserId());
|
||||
userCourseBuyLog.setType("master");
|
||||
userCourseBuyLog.setPayType(addCourses.getPayType());
|
||||
userCourseBuyLog.setPayTime(new Date());
|
||||
userCourseBuyLog.setOrderSn(addCourses.getOrderSn());
|
||||
userCourseBuyLog.setDays(addCourses.getDays());
|
||||
userCourseBuyLog.setFee(new BigDecimal(addCourses.getFee()));
|
||||
userCourseBuyLog.setJf(new BigDecimal(addCourses.getJf()));
|
||||
userCourseBuyLog.setRemark(addCourses.getRemark());
|
||||
logs.add(userCourseBuyLog);
|
||||
}
|
||||
userCourseBuyLogDao.insert(logs);
|
||||
frag.put("successList",successList);
|
||||
frag.put("failList",falseList);
|
||||
return frag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getUserCourseBuyInfoTotal(String date) {
|
||||
return this.baseMapper.getUserCourseBuyInfoTotal(date);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getUserCourseBuyInfo(String date) {
|
||||
return this.baseMapper.getUserCourseBuyInfo(date);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ArrayList> readExcelForAddCourse(String file) {
|
||||
Map<String, ArrayList> stringArrayListMap = new HashMap<>();
|
||||
|
||||
@@ -81,6 +81,8 @@ public class AliPayServiceImpl implements AliPayService {
|
||||
private TrainingClassService trainingClassService;
|
||||
@Autowired
|
||||
private AiVipLogService aiVipLogService;
|
||||
@Autowired
|
||||
private UserCourseBuyLogDao userCourseBuyLogDao;
|
||||
|
||||
@Override
|
||||
public String pay(AlipayDTO payDto) {
|
||||
@@ -265,8 +267,18 @@ public class AliPayServiceImpl implements AliPayService {
|
||||
wrapper2.eq(UserCourseBuyEntity::getCatalogueId,s.getCatalogueId());
|
||||
wrapper2.and(r->r.isNull(UserCourseBuyEntity::getEndTime).or().gt(UserCourseBuyEntity::getEndTime,new Date()));
|
||||
List<UserCourseBuyEntity> userCourseBuyEntities = userCourseBuyDao.selectList(wrapper2);
|
||||
//插入开课记录
|
||||
UserCourseBuyLog userCourseBuyLog = new UserCourseBuyLog();
|
||||
userCourseBuyLog.setUserId(order.getUserId());
|
||||
userCourseBuyLog.setType("order");
|
||||
userCourseBuyLog.setPayType("支付宝");
|
||||
userCourseBuyLog.setPayTime(order.getCreateTime());
|
||||
userCourseBuyLog.setOrderSn(order.getOrderSn());
|
||||
if(userCourseBuyEntities.size()>0){
|
||||
UserCourseBuyEntity userCourseBuyEntity = userCourseBuyEntities.get(0);
|
||||
userCourseBuyLog.setUserCourseBuyId(userCourseBuyEntity.getId());
|
||||
userCourseBuyLog.setBeginDay(userCourseBuyEntity.getDays()+1);
|
||||
userCourseBuyLog.setDays(s.getDays());
|
||||
userCourseBuyEntity.setDays(userCourseBuyEntity.getDays()+s.getDays());
|
||||
if(userCourseBuyEntity.getEndTime()!=null){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
@@ -290,7 +302,13 @@ public class AliPayServiceImpl implements AliPayService {
|
||||
// userCourseBuyEntity.setEndTime(cal.getTime());
|
||||
userCourseBuyEntity.setCome("支付宝购买:"+order.getOrderSn());
|
||||
userCourseBuyDao.insert(userCourseBuyEntity);
|
||||
userCourseBuyLog.setUserCourseBuyId(userCourseBuyEntity.getId());
|
||||
userCourseBuyLog.setBeginDay(0);
|
||||
userCourseBuyLog.setDays(s.getDays());
|
||||
}
|
||||
userCourseBuyLog.setFee(order.getRealMoney().divide(new BigDecimal(orderCourse.size()),2, BigDecimal.ROUND_HALF_UP));
|
||||
userCourseBuyLog.setJf(order.getJfDeduction().divide(new BigDecimal(orderCourse.size()),2, BigDecimal.ROUND_HALF_UP));
|
||||
userCourseBuyLogDao.insert(userCourseBuyLog);
|
||||
}
|
||||
//开通course,end
|
||||
//发放优惠卷
|
||||
|
||||
@@ -66,12 +66,11 @@ public class PayRefundOrderServiceImpl extends ServiceImpl<PayRefundOrderDao, Pa
|
||||
//插入花生比交易明细
|
||||
TransactionDetailsEntity transactionDetailsEntity = new TransactionDetailsEntity();
|
||||
transactionDetailsEntity.setUserId(order.getUserId());
|
||||
transactionDetailsEntity.setOrderType("退款");
|
||||
transactionDetailsEntity.setOrderType("后台充值");
|
||||
transactionDetailsEntity.setTel(byId.getTel());
|
||||
transactionDetailsEntity.setUserName(byId.getNickname());
|
||||
transactionDetailsEntity.setNote(map.get("note").toString());
|
||||
transactionDetailsEntity.setChangeAmount(new BigDecimal(map.get("refundFee").toString()));
|
||||
transactionDetailsEntity.setRemark("退款");
|
||||
BigDecimal balance = new BigDecimal(i);
|
||||
transactionDetailsEntity.setUserBalance(balance);
|
||||
transactionDetailsService.save(transactionDetailsEntity);
|
||||
|
||||
@@ -87,6 +87,8 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
|
||||
private TrainingClassService trainingClassService;
|
||||
@Autowired
|
||||
private AiVipLogService aiVipLogService;
|
||||
@Autowired
|
||||
private UserCourseBuyLogDao userCourseBuyLogDao;
|
||||
|
||||
@Override
|
||||
public void prepay(WechatPaymentInfo paymentInfo){
|
||||
@@ -223,8 +225,18 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
|
||||
wrapper2.eq(UserCourseBuyEntity::getCatalogueId,s.getCatalogueId());
|
||||
wrapper2.and(r->r.isNull(UserCourseBuyEntity::getEndTime).or().gt(UserCourseBuyEntity::getEndTime,new Date()));
|
||||
List<UserCourseBuyEntity> userCourseBuyEntities = userCourseBuyDao.selectList(wrapper2);
|
||||
//插入开课记录
|
||||
UserCourseBuyLog userCourseBuyLog = new UserCourseBuyLog();
|
||||
userCourseBuyLog.setUserId(order.getUserId());
|
||||
userCourseBuyLog.setType("order");
|
||||
userCourseBuyLog.setPayType("微信");
|
||||
userCourseBuyLog.setPayTime(order.getCreateTime());
|
||||
userCourseBuyLog.setOrderSn(order.getOrderSn());
|
||||
if(userCourseBuyEntities.size()>0){
|
||||
UserCourseBuyEntity userCourseBuyEntity = userCourseBuyEntities.get(0);
|
||||
userCourseBuyLog.setUserCourseBuyId(userCourseBuyEntity.getId());
|
||||
userCourseBuyLog.setBeginDay(userCourseBuyEntity.getDays()+1);
|
||||
userCourseBuyLog.setDays(s.getDays());
|
||||
userCourseBuyEntity.setDays(userCourseBuyEntity.getDays()+s.getDays());
|
||||
if(userCourseBuyEntity.getEndTime()!=null){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
@@ -248,7 +260,13 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
|
||||
// userCourseBuyEntity.setEndTime(cal.getTime());
|
||||
userCourseBuyEntity.setCome("微信购买:"+order.getOrderSn());
|
||||
userCourseBuyDao.insert(userCourseBuyEntity);
|
||||
userCourseBuyLog.setUserCourseBuyId(userCourseBuyEntity.getId());
|
||||
userCourseBuyLog.setBeginDay(0);
|
||||
userCourseBuyLog.setDays(s.getDays());
|
||||
}
|
||||
userCourseBuyLog.setFee(order.getRealMoney().divide(new BigDecimal(orderCourse.size()),2, BigDecimal.ROUND_HALF_UP));
|
||||
userCourseBuyLog.setJf(order.getJfDeduction().divide(new BigDecimal(orderCourse.size()),2, BigDecimal.ROUND_HALF_UP));
|
||||
userCourseBuyLogDao.insert(userCourseBuyLog);
|
||||
}
|
||||
//开通course,end
|
||||
//发放优惠卷
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.peanut.modules.sociology.service.CourseSociologyService;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -153,6 +154,7 @@ public class CourseController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/startStudyForMF")
|
||||
@Transactional
|
||||
public R startStudyForMF(@RequestBody Map<String,Integer> map){
|
||||
return courseService.startStudyForMF(map.get("catalogueId"));
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -49,6 +51,8 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
||||
private ShopProductDao shopProductDao;
|
||||
@Autowired
|
||||
private UserVipDao userVipDao;
|
||||
@Autowired
|
||||
private UserCourseBuyLogDao userCourseBuyLogDao;
|
||||
|
||||
|
||||
//根据标签获取课程列表
|
||||
@@ -240,6 +244,15 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
||||
userCourseBuyEntity.setEndTime(cal.getTime());
|
||||
userCourseBuyEntity.setCome("免费领取课程");
|
||||
userCourseBuyDao.insert(userCourseBuyEntity);
|
||||
UserCourseBuyLog userCourseBuyLog = new UserCourseBuyLog();
|
||||
userCourseBuyLog.setUserCourseBuyId(userCourseBuyEntity.getId());
|
||||
userCourseBuyLog.setUserId(userCourseBuyEntity.getUserId());
|
||||
userCourseBuyLog.setType("master");
|
||||
userCourseBuyLog.setPayType("其他");
|
||||
userCourseBuyLog.setPayTime(new Date());
|
||||
userCourseBuyLog.setDays(userCourseBuyEntity.getDays());
|
||||
userCourseBuyLog.setRemark("免费领取课程");
|
||||
userCourseBuyLogDao.insert(userCourseBuyLog);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user