Compare commits

...
2 Commits
Author SHA1 Message Date
fansongsong 515b231718 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/payment/controller/StBbzxOrderInfoController.java
2025-12-19 11:16:20 +08:00
fansongsong fcf1d0f5f4 消费明细报表-导出,调整字段顺序5 2025-12-19 11:14:13 +08:00
9 changed files with 150 additions and 69 deletions
@@ -87,4 +87,6 @@ public class StClientMemberTransactionRecordDTO {
@Schema(title ="餐次")
private String dinnerType;
private List<String> canteenIdList;
}
@@ -5,6 +5,8 @@ package org.jeecg.payment.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import org.jeecg.common.system.vo.ScreenVo;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@@ -46,5 +48,7 @@ public class StExceptionRecordDTO {
private String startDate;
private String endDate;
private String canteenId;
List<String> canteenIdList;
}
@@ -13,6 +13,7 @@ import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.system.vo.ScreenVo;
import org.jeecg.payment.dto.StAmountSpentEveryMemberDTO;
import org.jeecg.payment.dto.StClientMemberTransactionRecordDTO;
import org.jeecg.payment.service.IStBbzxOrderInfoService;
@@ -26,7 +27,9 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 订单 控制器
@@ -91,7 +94,7 @@ public class StBbzxOrderInfoController {
sumResult.setRestName("总计");
sumResult.setEatDay(startDate+"~"+endDate);
statisticsTheAmountSpentList.add(sumResult);
String exportFields = "restName|食堂名称,customerPrice|消费总额(元),totalCount|消费人次,totalNum|消费人数," +
String exportFields = "restName|食堂名称,totalCount|消费人次,customerPrice|消费总额(元),totalNum|消费人数," +
"breakfastAmount|早餐消费金额(元),breakfastPerson|早餐消费次数,lunchAmount|午餐消费金额(元),lunchPerson|午餐消费次数,dinnerAmount|晚餐消费金额(元),dinnerPerson|晚餐消费次数" +
",otherAmount|其他消费金额(元),otherPerson|其他消费次数,orderPrice|结算金额(元),eatDay|消费日期";
ExcelUtils.export(response, "食堂消费统计", statisticsTheAmountSpentList, exportFields, "yyyy-MM-dd HH:mm",true);
@@ -184,7 +187,7 @@ public class StBbzxOrderInfoController {
sumResult.setDepartName(null);
sumResult.setEatDay(startDate+"~"+endDate);
statisticsTheAmountSpentList.add(sumResult);
String exportFields = "realname|姓名,customerPrice|消费总额(元),workNo|工号,departName|部门,totalCount|消费次数,totalNum|消费天数," +
String exportFields = "workNo|工号,realname|姓名,departName|部门,totalCount|消费次数,customerPrice|消费总额(元),restName|食堂名称,totalNum|消费天数," +
"breakfastAmount|早餐消费金额(元),breakfastPerson|早餐消费次数,lunchAmount|午餐消费金额(元),lunchPerson|午餐消费次数,dinnerAmount|晚餐消费金额(元),dinnerPerson|晚餐消费次数" +
",otherAmount|其他消费金额(元),otherPerson|其他消费次数,orderPrice|结算金额(元),eatDay|消费日期";
ExcelUtils.export(response, "个人消费统计", statisticsTheAmountSpentList, exportFields, "yyyy-MM-dd HH:mm",true);
@@ -292,20 +295,20 @@ public class StBbzxOrderInfoController {
query.setStartTime(query.getDates().get(0));
query.setEndTime(query.getDates().get(1));
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//餐品总库只查询内置食堂
if(sysUser.getUserIdentity().equals(CommonConstant.USER_IDENTITY_0) || sysUser.getUserIdentity().equals(CommonConstant.USER_IDENTITY_1)){
// 后期分数据权限时在解开注释,此处管理员账户能看到所有食堂数据
// ScreenVo screenVo = new ScreenVo();
// screenVo.setId(CommonConstant.INLAY_CANTEEN_ID);
// canteenIdList.add(screenVo);
} else if (sysUser.getUserIdentity().equals(CommonConstant.USER_IDENTITY_4)) {
//查询当前登录用户的食堂列表
String canteenId = sysUser.getCanteenId();
query.setCanteenId(canteenId);
String canteenId = query.getCanteenId();
List<String> canteenIdList = new ArrayList<>();
if(StringUtils.isNotBlank(canteenId)){
canteenIdList.add(canteenId);
} else {
return Result.OK();
//权限校验
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> canteenIds = new ArrayList<>();
if(sysUser != null){
canteenIds = sysUser.getCanteenIdList().stream().map(ScreenVo::getId).collect(Collectors.toList());
canteenIdList.addAll(canteenIds);
}
}
query.setCanteenIdList(canteenIdList);
query.setStatus(3);//(充值=102
return Result.OK(iStClientMemberTransactionRecordService.pageQuery(query));
}
@@ -323,20 +326,20 @@ public class StBbzxOrderInfoController {
query.setStartTime(split[0]);
query.setEndTime(split[1]);
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//餐品总库只查询内置食堂
if(sysUser.getUserIdentity().equals(CommonConstant.USER_IDENTITY_0) || sysUser.getUserIdentity().equals(CommonConstant.USER_IDENTITY_1)){
// 后期分数据权限时在解开注释,此处管理员账户能看到所有食堂数据
// ScreenVo screenVo = new ScreenVo();
// screenVo.setId(CommonConstant.INLAY_CANTEEN_ID);
// canteenIdList.add(screenVo);
} else if (sysUser.getUserIdentity().equals(CommonConstant.USER_IDENTITY_4)) {
//查询当前登录用户的食堂列表
String canteenId = sysUser.getCanteenId();
query.setCanteenId(canteenId);
String canteenId = query.getCanteenId();
List<String> canteenIdList = new ArrayList<>();
if(StringUtils.isNotBlank(canteenId)){
canteenIdList.add(canteenId);
} else {
return Result.OK();
//权限校验
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> canteenIds = new ArrayList<>();
if(sysUser != null){
canteenIds = sysUser.getCanteenIdList().stream().map(ScreenVo::getId).collect(Collectors.toList());
canteenIdList.addAll(canteenIds);
}
}
query.setCanteenIdList(canteenIdList);
query.setStatus(3);//(充值=102
List<StClientMemberTransactionRecordVO> statisticsCanteenBusiness = iStClientMemberTransactionRecordService.queryList(query);
StClientMemberTransactionRecordVO sumResult = GenericSumUtil.sumList(statisticsCanteenBusiness, StClientMemberTransactionRecordVO.class);
@@ -358,20 +361,20 @@ public class StBbzxOrderInfoController {
query.setStartTime(split[0]);
query.setEndTime(split[1]);
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//餐品总库只查询内置食堂
if(sysUser.getUserIdentity().equals(CommonConstant.USER_IDENTITY_0) || sysUser.getUserIdentity().equals(CommonConstant.USER_IDENTITY_1)){
// 后期分数据权限时在解开注释,此处管理员账户能看到所有食堂数据
// ScreenVo screenVo = new ScreenVo();
// screenVo.setId(CommonConstant.INLAY_CANTEEN_ID);
// canteenIdList.add(screenVo);
} else if (sysUser.getUserIdentity().equals(CommonConstant.USER_IDENTITY_4)) {
//查询当前登录用户的食堂列表
String canteenId = sysUser.getCanteenId();
query.setCanteenId(canteenId);
String canteenId = query.getCanteenId();
List<String> canteenIdList = new ArrayList<>();
if(StringUtils.isNotBlank(canteenId)){
canteenIdList.add(canteenId);
} else {
return;
//权限校验
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> canteenIds = new ArrayList<>();
if(sysUser != null){
canteenIds = sysUser.getCanteenIdList().stream().map(ScreenVo::getId).collect(Collectors.toList());
canteenIdList.addAll(canteenIds);
}
}
query.setCanteenIdList(canteenIdList);
query.setStatus(3);//(充值=102
List<StClientMemberTransactionRecordVO> statisticsCanteenBusiness = iStClientMemberTransactionRecordService.queryList(query);
if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(statisticsCanteenBusiness)){
@@ -384,7 +387,7 @@ public class StBbzxOrderInfoController {
// String exportFields = "serialNo|交易流水号,orderNo|交易单号,userName|姓名,phone|手机号,workNo|工号," +
// "statusName|操作类型,transactionAmount|交易金额,paymentMethodName|结账方式,storedBalance|储值金额变动(元),rewardBalance|赠送金额变动(元),availableBalance|余额," +
// "integralBalance|积分变动,createTime|交易时间,payTime|结账时间,updateStatusName|操作端,createOne|操作人";
String exportFields = "serialNo|交易流水号,orderNo|交易单号,userName|姓名,phone|手机号,workNo|工号," +
String exportFields = "userName|姓名,deptName|部门,phone|手机号,workNo|工号,restName|食堂名称," +
"transactionAmount|交易金额,statusName|操作类型,paymentMethodName|充值方式,availableBalance|现金余额," +
"createTime|充值时间,createOne|操作人";
ExcelUtils.export(response, "充值记录", statisticsCanteenBusiness, exportFields, "yyyy-MM-dd HH:mm",true);
@@ -12,6 +12,7 @@ import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.system.vo.ScreenVo;
import org.jeecg.payment.dto.StClientMemberChangeBalanceDTO;
import org.jeecg.payment.dto.StClientMemberTopUpDTO;
import org.jeecg.payment.dto.StClientMemberTransactionRecordDTO;
@@ -436,9 +437,20 @@ public class StClientMemberBalanceController {
query.setEndTime(query.getDates().get(1));
}
String canteenId = query.getCanteenId();
List<String> canteenIdList = new ArrayList<>();
if(StringUtils.isNotBlank(canteenId)){
canteenIdList.add(canteenId);
} else {
//权限校验
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String canteenId = sysUser.getCanteenId();
query.setCanteenId(canteenId);
List<String> canteenIds = new ArrayList<>();
if(sysUser != null){
canteenIds = sysUser.getCanteenIdList().stream().map(ScreenVo::getId).collect(Collectors.toList());
canteenIdList.addAll(canteenIds);
}
}
query.setCanteenIdList(canteenIdList);
//消费=101
query.setStatus(101);
return Result.OK(iStClientMemberTransactionRecordService.pageQueryNew(query));
@@ -457,20 +469,20 @@ public class StClientMemberBalanceController {
query.setStartTime(split[0]);
query.setEndTime(split[1]);
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//餐品总库只查询内置食堂
if(sysUser.getUserIdentity().equals(CommonConstant.USER_IDENTITY_0) || sysUser.getUserIdentity().equals(CommonConstant.USER_IDENTITY_1)){
// 后期分数据权限时在解开注释,此处管理员账户能看到所有食堂数据
// ScreenVo screenVo = new ScreenVo();
// screenVo.setId(CommonConstant.INLAY_CANTEEN_ID);
// canteenIdList.add(screenVo);
} else if (sysUser.getUserIdentity().equals(CommonConstant.USER_IDENTITY_4)) {
//查询当前登录用户的食堂列表
String canteenId = sysUser.getCanteenId();
query.setCanteenId(canteenId);
String canteenId = query.getCanteenId();
List<String> canteenIdList = new ArrayList<>();
if(StringUtils.isNotBlank(canteenId)){
canteenIdList.add(canteenId);
} else {
return Result.OK();
//权限校验
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> canteenIds = new ArrayList<>();
if(sysUser != null){
canteenIds = sysUser.getCanteenIdList().stream().map(ScreenVo::getId).collect(Collectors.toList());
canteenIdList.addAll(canteenIds);
}
}
query.setCanteenIdList(canteenIdList);
query.setStatus(1);//消费=101
List<StClientMemberTransactionRecordVO> statisticsCanteenBusiness = iStClientMemberTransactionRecordService.queryList(query);
StClientMemberTransactionRecordVO sumResult = GenericSumUtil.sumList(statisticsCanteenBusiness, StClientMemberTransactionRecordVO.class);
@@ -497,20 +509,20 @@ public class StClientMemberBalanceController {
if(StringUtils.isNotBlank(query.getEndDate())){
query.setEndTime(query.getEndDate());
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//餐品总库只查询内置食堂
if(sysUser.getUserIdentity().equals(CommonConstant.USER_IDENTITY_0) || sysUser.getUserIdentity().equals(CommonConstant.USER_IDENTITY_1)){
// 后期分数据权限时在解开注释,此处管理员账户能看到所有食堂数据
// ScreenVo screenVo = new ScreenVo();
// screenVo.setId(CommonConstant.INLAY_CANTEEN_ID);
// canteenIdList.add(screenVo);
} else if (sysUser.getUserIdentity().equals(CommonConstant.USER_IDENTITY_4)) {
//查询当前登录用户的食堂列表
String canteenId = sysUser.getCanteenId();
query.setCanteenId(canteenId);
String canteenId = query.getCanteenId();
List<String> canteenIdList = new ArrayList<>();
if(StringUtils.isNotBlank(canteenId)){
canteenIdList.add(canteenId);
} else {
return;
//权限校验
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> canteenIds = new ArrayList<>();
if(sysUser != null){
canteenIds = sysUser.getCanteenIdList().stream().map(ScreenVo::getId).collect(Collectors.toList());
canteenIdList.addAll(canteenIds);
}
}
query.setCanteenIdList(canteenIdList);
query.setStatus(1);//消费=101
List<StClientMemberTransactionRecordVO> statisticsCanteenBusiness = iStClientMemberTransactionRecordService.queryList(query);
@@ -526,7 +538,7 @@ public class StClientMemberBalanceController {
// "dinnerType|餐次名称,restName|食堂名称,createTime|交易时间,payTime|结账时间,updateStatusName|操作端,createOne|操作人";
String exportFields = "userName|姓名,workNo|工号,dinnerType|餐次名称,transactionAmount|交易金额,availableBalance|剩余金额,createTime|上传时间,serialNo|交易流水号,orderNo|交易单号,phone|手机号码,cardCode|卡号," +
"statusName|操作类型,paymentMethodName|结账方式,businessModelName|消费类型名称,storedBalance|储值金额变动(元)," +
"statusName|操作类型,paymentMethodName|结账方式,businessModelName|消费类型名称,restName|食堂名称,storedBalance|储值金额变动(元)," +
"updateStatusName|操作端,payTime|扣费时间";
// "dinnerType|餐次名称,restName|食堂名称,,payTime|结账时间,updateStatusName|操作端,createOne|操作人";
ExcelUtils.export(response, "消费明细", statisticsCanteenBusiness, exportFields, "yyyy-MM-dd HH:mm",true);
@@ -85,7 +85,7 @@ public class StConsumptionExceptionRecordController {
List<StExceptionRecordVo> stExceptionRecordVos = stConsumptionExceptionRecordService.exceptionRecordPageExport(query);
if(CollectionUtils.isNotEmpty(stExceptionRecordVos)){
String exportFields = "userName|姓名,phone|手机号,workNo|工号,cardCode|卡号,spendMoney|本次扣费金额,payTime|消费时间,createTime|创建时间";
String exportFields = "userName|姓名,phone|手机号,workNo|工号,cardCode|卡号,spendMoney|本次扣费金额,restName|食堂名称,payTime|消费时间,createTime|创建时间";
ExcelUtils.export(response, "异常消费流水", stExceptionRecordVos, exportFields, "yyyy-MM-dd HH:mm",true);
}
}
@@ -269,6 +269,7 @@
resultType="org.jeecg.payment.vo.StatisticsTheAmountSpentVo">
SELECT
u.realname,
sr.rest_name as restName,
pay.realname as payRealname,
u.work_no,
CONCAT(
@@ -308,6 +309,7 @@
st_bbzx_order_info oi
JOIN sys_user_sub u ON oi.member_id = u.id
JOIN sys_user_sub pay ON oi.pay_member_id = pay.id
LEFT JOIN st_base_restaurant AS sr ON sr.id = oi.canteen_id
LEFT JOIN sys_pay_depart direct_depart ON pay.depart_ids = direct_depart.id AND direct_depart.del_flag = '0'
LEFT JOIN sys_pay_depart parent_depart ON direct_depart.parent_id = parent_depart.id AND parent_depart.del_flag = '0'
WHERE
@@ -129,6 +129,12 @@
#{departId}
</foreach>
</if>
<if test="vo.canteenIdList != null and vo.canteenIdList.size() > 0">
and a.canteen_id IN
<foreach collection="vo.canteenIdList" item="canteenId" separator="," open="(" close=")">
#{canteenId}
</foreach>
</if>
order by a.create_time desc
</select>
@@ -185,6 +191,12 @@
<if test="vo.dinnerType != null and vo.dinnerType != ''">
and sboi.dinner_type = #{vo.dinnerType}
</if>
<if test="vo.canteenIdList != null and vo.canteenIdList.size() > 0">
and a.canteen_id IN
<foreach collection="vo.canteenIdList" item="canteenId" separator="," open="(" close=")">
#{canteenId}
</foreach>
</if>
</select>
<select id="pageList2" resultType="org.jeecg.payment.vo.StClientMemberTransactionRecordVO">
@@ -204,12 +216,14 @@
a.integral_balance as integralBalance,
a.create_time as createTime,
a.pay_time as payTime,
-- sr.rest_name as restName,
a.update_status as updateStatus
FROM
st_client_member_transaction_record as a
<if test="vo.dinnerType != null and vo.dinnerType != ''">
LEFT JOIN st_bbzx_order_info sboi ON a.order_no = sboi.order_no
</if>
-- LEFT JOIN st_base_restaurant AS sr ON sr.id = a.canteen_id
LEFT JOIN sys_user_sub AS c ON a.pay_member_id = c.id
LEFT JOIN sys_user_sub AS pay ON a.member_id = pay.id
WHERE a.is_del = 0
@@ -255,6 +269,12 @@
<if test="vo.dinnerType != null and vo.dinnerType != ''">
and sboi.dinner_type = #{vo.dinnerType}
</if>
<if test="vo.canteenIdList != null and vo.canteenIdList.size() > 0">
and a.canteen_id IN
<foreach collection="vo.canteenIdList" item="canteenId" separator="," open="(" close=")">
#{canteenId}
</foreach>
</if>
order by a.create_time desc
</select>
@@ -15,6 +15,7 @@
a.pay_time,
a.error_msg,
u.realname as userName,
sr.rest_name as restName,
CONCAT(
IFNULL(parent_depart.depart_name, ''),
IF(parent_depart.depart_name IS NOT NULL AND direct_depart.depart_name IS NOT NULL, '->', ''),
@@ -27,7 +28,7 @@
LEFT JOIN sys_user_sub AS u ON a.user_id = u.id
LEFT JOIN sys_pay_depart direct_depart ON u.depart_ids = direct_depart.id AND direct_depart.del_flag = '0'
LEFT JOIN sys_pay_depart parent_depart ON direct_depart.parent_id = parent_depart.id AND parent_depart.del_flag = '0'
LEFT JOIN st_base_restaurant AS sr ON a.canteen_id = sr.id
WHERE 1 = 1
<if test="query.phone != null and query.phone != ''">
and u.phone like CONCAT('%',#{query.phone},'%')
@@ -49,6 +50,12 @@
#{departId}
</foreach>
</if>
<if test="query.canteenIdList != null and query.canteenIdList.size() > 0">
and a.canteen_id IN
<foreach collection="query.canteenIdList" item="canteenId" separator="," open="(" close=")">
#{canteenId}
</foreach>
</if>
order by a.create_time desc
</select>
</mapper>
@@ -8,6 +8,9 @@ import com.opencsv.bean.CsvToBeanBuilder;
import com.opencsv.bean.HeaderColumnNameMappingStrategy;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.system.vo.ScreenVo;
import org.jeecg.payment.dto.StExceptionRecordDTO;
import org.jeecg.payment.entity.StConsumptionExceptionRecord;
import org.jeecg.payment.mapper.StConsumptionExceptionRecordMapper;
@@ -52,6 +55,20 @@ public class StConsumptionExceptionRecordServiceImpl extends ServiceImpl<StConsu
query.setList(allCascadeDeptIds);
}
}
String canteenId = query.getCanteenId();
List<String> canteenIdList = new ArrayList<>();
if(StringUtils.isNotBlank(canteenId)){
canteenIdList.add(canteenId);
} else {
//权限校验
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> canteenIds = new ArrayList<>();
if(sysUser != null){
canteenIds = sysUser.getCanteenIdList().stream().map(ScreenVo::getId).collect(Collectors.toList());
canteenIdList.addAll(canteenIds);
}
}
query.setCanteenIdList(canteenIdList);
Page<StExceptionRecordVo> page = new Page<>(query.getPageNo(), query.getPageSize());
return baseMapper.exceptionRecordPage(page, query);
}
@@ -69,6 +86,20 @@ public class StConsumptionExceptionRecordServiceImpl extends ServiceImpl<StConsu
query.setList(allCascadeDeptIds);
}
}
String canteenId = query.getCanteenId();
List<String> canteenIdList = new ArrayList<>();
if(StringUtils.isNotBlank(canteenId)){
canteenIdList.add(canteenId);
} else {
//权限校验
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> canteenIds = new ArrayList<>();
if(sysUser != null){
canteenIds = sysUser.getCanteenIdList().stream().map(ScreenVo::getId).collect(Collectors.toList());
canteenIdList.addAll(canteenIds);
}
}
query.setCanteenIdList(canteenIdList);
return baseMapper.exceptionRecordPage(query);
}