This commit is contained in:
wuchunlei
2026-01-19 18:17:34 +08:00
parent df3d869bc1
commit f47203a9d4
3 changed files with 37 additions and 12 deletions

View File

@@ -79,6 +79,7 @@ public class PaymentController {
long count = ordersService.count(new LambdaQueryWrapper<Orders>()
.notExists("select 1 from payment_to_order where order_id = orders.id and state = 0")
.eq(Orders::getFee, payment.getFee())
.eq(Orders::getPayType,0)
.ge(Orders::getOrderTime, DateUtils.addDays(payment.getCtime(),-1))
.le(Orders::getOrderTime, DateUtils.addDays(payment.getCtime(),3)));
if (count>0){

View File

@@ -16,6 +16,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.YearMonth;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@RestController("commonStatistics")
@@ -29,6 +30,8 @@ public class StatisticsController {
@Autowired
private IUserVipLogService userVipLogService;
@Autowired
private ITCustomerApplyCurriculumService customerApplyCurriculumService;
@Autowired
private ITCustomerTaihuClassService customerTaihuClassService;
@Autowired
private IUserCourseBuyLogService userCourseBuyLogService;
@@ -66,7 +69,7 @@ public class StatisticsController {
.apply("DATE_FORMAT(t.order_time, '%Y-%m') > '"+params.get("year")+"-"+params.get("month")+"'")
.select("SUM(IF(type=0,fee,fee*-1)) diff"));
//目前总额+差额
map.put("surplus",new BigDecimal(totalPoint.get("totalPoint").toString()).add(diff==null?BigDecimal.ZERO:new BigDecimal(diff.get("diff").toString())));
map.put("surplus",new BigDecimal(totalPoint.get("totalPoint").toString()).subtract(diff==null?BigDecimal.ZERO:new BigDecimal(diff.get("diff").toString())));
return R.ok().putData("map",map);
}
//天医币明细导出
@@ -103,7 +106,8 @@ public class StatisticsController {
List<Map<String,Object>> list = new ArrayList<>();
if (orders.getSource()==1){
List<UserVipLog> userVipLogs = userVipLogService.list(new MPJLambdaWrapper<UserVipLog>()
.eq(UserVipLog::getOrderSn,orders.getOrderSn())
.leftJoin("buy_order t2 on t2.order_sn = t.order_sn ")
.apply("t2.order_id = "+orders.getOrderOldId())
.select("fee,start_time,end_time"));
for (UserVipLog userVipLog : userVipLogs) {
Map<String,Object> map = new HashMap<>();
@@ -133,7 +137,7 @@ public class StatisticsController {
already = already.add(fee);
//未开始摊销
}else if (sdfday.parse(day).getTime()<sdfday.parse(startTime).getTime()){
if (orders.getOrderTime().getTime()<=sdfmonth.parse(month).getTime()){
if (orders.getOrderTime().getTime()<sdfmonth.parse(month).getTime()){
notyet = notyet.add(fee);
}
//摊销中
@@ -163,7 +167,7 @@ public class StatisticsController {
}
}
}
return R.ok().putData("incomes",incomes).putData("alread",already).putData("now",nowTotal).putData("notyet",notyet);
return R.ok().putData("incomes",incomes).putData("already",already).putData("now",nowTotal).putData("notyet",notyet);
}
//课程
@@ -190,15 +194,32 @@ public class StatisticsController {
BigDecimal already = BigDecimal.ZERO;
BigDecimal nowTotal = BigDecimal.ZERO;
BigDecimal notyet = BigDecimal.ZERO;
List<String> taihuOrderIds = courseOrders.stream().filter(o -> o.getSource() == 0).map(Orders::getOrderOldId).collect(Collectors.toList());
// Map<String,Map<String,Object>> taihuClassMap = cus.listMaps(new MPJLambdaWrapper<TCustomerTaihuClass>()
// .leftJoin("t_customer_apply_curriculum t1 on t.description like concat('%',t1.curriculumID,'%')")
// .in("t1.oid", taihuOrderIds)
// .apply("t1.valid=1 and t1.status = '50'")
// .select("t1.oid,if(t1.point>0,t1.point,t1.money) fee,DATE_FORMAT(t.startDate, '%Y-%m-%d %H:%i:%s') startDate,t.studyDays"))
// .stream().collect(Collectors.toMap(m -> m.get("oid").toString(), m -> m));
Map<String,Map<String,Object>> taihuClassMap = customerApplyCurriculumService.listMaps(new MPJLambdaWrapper<TCustomerApplyCurriculum>()
.in("t.oid", taihuOrderIds)
.apply("t.valid=1 and t.status = '50'")
.select("t.oid,if(t.point>0,t.point,t.money) fee,curriculumID"))
.stream().collect(Collectors.toMap(m -> m.get("oid").toString(), m -> m));
for(Orders orders:courseOrders){
List<Map<String,Object>> list = new ArrayList<>();
if(orders.getSource()==0){
Map<String,Object> taihuClass = customerTaihuClassService.getMap(new MPJLambdaWrapper<TCustomerTaihuClass>()
.leftJoin("t_customer_apply_curriculum t1 on t.description like concat('%',t1.curriculumID,'%')")
.eq("t1.oid", orders.getOrderOldId())
.apply("t1.valid=1 and t1.status = '50'")
.select("if(t1.point>0,t1.point,t1.money) fee,DATE_FORMAT(t.startDate, '%Y-%m-%d %H:%i:%s') startDate,t.studyDays"));
Map<String,Object> map = new HashMap<>();
Map<String,Object> taihuClass = taihuClassMap.get(orders.getOrderOldId());
Map<String,Object> c = customerTaihuClassService.getMap(new MPJLambdaWrapper<TCustomerTaihuClass>()
.like(TCustomerTaihuClass::getDescription,taihuClass.get("curriculumID"))
.select("DATE_FORMAT(startDate, '%Y-%m-%d %H:%i:%s') startDate,studyDays"));
if (c != null) {
taihuClass.put("startDate",c.get("startDate"));
taihuClass.put("studyDays",c.get("studyDays"));
}else {
taihuClass.put("startDate",null);
}
map.put("fee",new BigDecimal(taihuClass.get("fee").toString()));
if (taihuClass.get("startDate")==null){
map.put("startTime",null);
@@ -212,7 +233,8 @@ public class StatisticsController {
}else if (orders.getSource()==1){
List<Map<String,Object>> userCourseBuyLogs = userCourseBuyLogService.listMaps(new MPJLambdaWrapper<UserCourseBuyLog>()
.leftJoin("user_course_buy t1 on t1.id = t.id")
.eq(UserCourseBuyLog::getOrderSn,orders.getOrderSn())
.leftJoin("buy_order t2 on t2.order_sn = t.order_sn ")
.apply("t2.order_id = "+orders.getOrderOldId())
.isNotNull("t1.start_time")
.select("t.fee,t.days,t.begin_day,t1.start_time,t1.end_time"));
for (Map<String,Object> userCourseBuyLog : userCourseBuyLogs) {
@@ -249,7 +271,7 @@ public class StatisticsController {
already = already.add(fee);
//未开始摊销
}else if (sdfday.parse(day).getTime()<sdfday.parse(startTime).getTime()){
if (orders.getOrderTime().getTime()<=sdfmonth.parse(month).getTime()){
if (orders.getOrderTime().getTime()<sdfmonth.parse(month).getTime()){
notyet = notyet.add(fee);
}
//摊销中
@@ -283,7 +305,7 @@ public class StatisticsController {
}
}
}
return R.ok().putData("incomes",incomes).putData("alread",already).putData("now",nowTotal).putData("notyet",notyet);
return R.ok().putData("incomes",incomes).putData("already",already).putData("now",nowTotal).putData("notyet",notyet);
}
//实物统计

View File

@@ -38,6 +38,8 @@ spring:
max-pool-prepared-statement-per-connection-size: 10
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
socketTimeout: 60000
connectTimeout: 30000
primary: master #设置默认的数据源或者数据源组,默认值即为master
datasource:
master: #主数据库