Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
34d277e015
12 files changed
+195
-5
No files matched your search
+2
@@ -57,4 +57,6 @@ public class HardOrderDto extends HardOrderEntity implements BaseIsIncludeTreeIn
|
||||
*/
|
||||
private String afterSaleNo;
|
||||
|
||||
private String createTimeStr;
|
||||
|
||||
}
|
||||
+9
@@ -8,6 +8,15 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
public class HardCanteenProductTotalVo {
|
||||
|
||||
@Schema(description = "唯一编号")
|
||||
private String uniqueCode;
|
||||
|
||||
@Schema(description = "部门id")
|
||||
private Long userDeptId;
|
||||
|
||||
@Schema(description = "部门名")
|
||||
private String userDeptName;
|
||||
|
||||
@Schema(description = "购买日期(年月日)")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
+9
@@ -16,6 +16,8 @@ import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 食堂统计
|
||||
*/
|
||||
@@ -28,6 +30,13 @@ public class HardCanteenTotalController {
|
||||
|
||||
private final HardCanteenTotalService canteenTotalService;
|
||||
|
||||
@Operation(summary = "根据部门 食堂菜品购买统计", description = "根据部门 食堂菜品购买统计")
|
||||
@PostMapping("/proudct-total-by-dept")
|
||||
public R<List<HardCanteenProductTotalVo>> productTotalByDept(@ParameterObject Page page, @RequestBody HardOrderDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(canteenTotalService.productTotalByDept(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "食堂菜品购买统计", description = "食堂菜品购买统计")
|
||||
@PostMapping("/proudct-total")
|
||||
public R<Page<HardCanteenProductTotalVo>> productTotal(@ParameterObject Page page, @RequestBody HardOrderDto dto) {
|
||||
|
||||
+4
@@ -12,6 +12,8 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface HardCarMapper extends PjcloudBaseMapper<HardCarEntity> {
|
||||
|
||||
@@ -22,6 +24,8 @@ public interface HardCarMapper extends PjcloudBaseMapper<HardCarEntity> {
|
||||
return selectJoinPage(page, HardCarVo.class, wrapper);
|
||||
}
|
||||
|
||||
List<HardCanteenProductTotalVo> productTotalByDept(@Param("dto") HardOrderDto dto, DataScope dataScope);
|
||||
|
||||
Page<HardCanteenProductTotalVo> productTotal(Page page, @Param("dto") HardOrderDto dto, DataScope dataScope);
|
||||
|
||||
Page<HardCarVo> proudctQuery(Page page, @Param("dto") HardCarDto dto);
|
||||
|
||||
+7
@@ -8,8 +8,15 @@ import com.bsd.pjcloud.hard.api.vo.order.HardCanteenProductTotalVo;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardCarVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface HardCanteenTotalService {
|
||||
|
||||
/**
|
||||
* 根据部门 食堂菜品购买统计
|
||||
*/
|
||||
List<HardCanteenProductTotalVo> productTotalByDept(Page page, HardOrderDto dto, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* 食堂菜品购买统计
|
||||
*/
|
||||
|
||||
+43
-1
@@ -1,6 +1,10 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.order;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
|
||||
import com.bsd.pjcloud.canteen.api.feign.RemoteCanteenSpuService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardCarDto;
|
||||
@@ -15,6 +19,10 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 食堂统计
|
||||
@@ -30,13 +38,47 @@ public class HardCanteenTotalServiceImpl implements HardCanteenTotalService {
|
||||
private final HardOrderMapper hardOrderMapper;
|
||||
private final HardCarMapper hardCarMapper;
|
||||
|
||||
private final RemoteDeptService remoteDeptService;
|
||||
|
||||
/**
|
||||
* 根据部门 食堂菜品购买统计
|
||||
*/
|
||||
@Override
|
||||
public List<HardCanteenProductTotalVo> productTotalByDept(Page page, HardOrderDto dto, DataScope dataScope) {
|
||||
dto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
List<HardCanteenProductTotalVo> list = hardCarMapper.productTotalByDept(dto, dataScope);
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
// 查询部门名
|
||||
List<Long> userDeptList = list.stream().map(HardCanteenProductTotalVo::getUserDeptId).distinct().filter(ObjectUtil::isNotEmpty).toList();
|
||||
if(ObjectUtil.isNotEmpty(userDeptList)){
|
||||
Map<Long, SysDept> userDeptMap = remoteDeptService.getDeptByDeptIds(userDeptList).getData();
|
||||
if (ObjectUtil.isNotEmpty(userDeptMap)) {
|
||||
for (HardCanteenProductTotalVo v : list) {
|
||||
SysDept sysDept = userDeptMap.get(v.getUserDeptId());
|
||||
if (ObjectUtil.isNotEmpty(sysDept)) {
|
||||
v.setUserDeptName(sysDept.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 食堂菜品购买统计
|
||||
*/
|
||||
@Override
|
||||
public Page<HardCanteenProductTotalVo> productTotal(Page page, HardOrderDto dto, DataScope dataScope) {
|
||||
dto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
return hardCarMapper.productTotal(page, dto, dataScope);
|
||||
Page<HardCanteenProductTotalVo> pageList = hardCarMapper.productTotal(page, dto, dataScope);
|
||||
if (ObjectUtil.isNotEmpty(pageList)) {
|
||||
for (HardCanteenProductTotalVo v : pageList.getRecords()) {
|
||||
LocalDate localDate = v.getCreateTime().toLocalDate();
|
||||
v.setUniqueCode(localDate + "_" + v.getHourType());
|
||||
}
|
||||
}
|
||||
return pageList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+72
-2
@@ -41,7 +41,7 @@
|
||||
|
||||
<sql id="whereA">
|
||||
a.del_flag = '0'
|
||||
<if test="dto.createTimeStr != null ">
|
||||
<if test="dto.createTimeStr != null and dto.createTimeStr != '' ">
|
||||
and DATE_FORMAT(a.create_time, '%Y-%m-%d') = #{dto.createTimeStr}
|
||||
</if>
|
||||
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
|
||||
@@ -49,6 +49,76 @@
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="productTotalByDept" resultType="com.bsd.pjcloud.hard.api.vo.order.HardCanteenProductTotalVo">
|
||||
select DATE_FORMAT(a.create_time, '%Y-%m-%d') as createTime,
|
||||
o.user_dept_id,
|
||||
SUM(a.product_count) as payCount,
|
||||
SUM(a.total_price) as totalPrice,
|
||||
count(distinct o.id) as timeCount,
|
||||
count(distinct o.user_id) as payUserCount
|
||||
from hard_car a
|
||||
inner join hard_parent_car p on a.parent_car_id = p.id and p.del_flag = '0'
|
||||
inner join hard_order o on o.parent_car_id = p.id and o.del_flag = '0' and o.hour_type is not null and
|
||||
o.hour_type not in ('-1')
|
||||
<where>
|
||||
<include refid="whereA" />
|
||||
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
|
||||
and o.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
|
||||
</if>
|
||||
<if test="dto.hourType != null and dto.hourType != '' ">
|
||||
and o.hour_type = #{dto.hourType}
|
||||
</if>
|
||||
<if test="dto.merchantId != null">
|
||||
and o.merchant_id = #{dto.merchantId}
|
||||
</if>
|
||||
<if test="dto.isOfflineOrder != null">
|
||||
and o.is_offline_order = #{dto.isOfflineOrder}
|
||||
</if>
|
||||
<if test="dto.deptIds != null and dto.deptIds.size() != 0">
|
||||
<choose>
|
||||
<when test="dto.isInclude != null and dto.isInclude == true">
|
||||
and o.dept_id IN
|
||||
</when>
|
||||
<when test="dto.isInclude != null and dto.isInclude == false">
|
||||
and o.dept_id NOT IN
|
||||
</when>
|
||||
<otherwise>
|
||||
and o.dept_id IN
|
||||
</otherwise>
|
||||
</choose>
|
||||
<foreach collection="dto.deptIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.merchantDeptIds != null and dto.merchantDeptIds.size() != 0">
|
||||
and o.merchant_dept_id in
|
||||
<foreach collection="dto.merchantDeptIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.mchIds != null and dto.mchIds.size() != 0">
|
||||
and o.merchant_id in
|
||||
<foreach collection="dto.mchIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.orderStatusCodes != null and dto.orderStatusCodes.size() != 0">
|
||||
and o.order_status in
|
||||
<foreach collection="dto.orderStatusCodes" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.mchTypeCodes != null and dto.mchTypeCodes.size() != 0">
|
||||
and o.merchant_type in
|
||||
<foreach collection="dto.mchTypeCodes" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
group by o.user_dept_id
|
||||
order by o.user_dept_id
|
||||
</select>
|
||||
|
||||
<select id="productTotal" resultType="com.bsd.pjcloud.hard.api.vo.order.HardCanteenProductTotalVo">
|
||||
select DATE_FORMAT(a.create_time, '%Y-%m-%d') as createTime,
|
||||
o.hour_type,
|
||||
@@ -61,7 +131,7 @@
|
||||
inner join hard_order o on o.parent_car_id = p.id and o.del_flag = '0' and o.hour_type is not null and
|
||||
o.hour_type not in ('-1')
|
||||
<where>
|
||||
a.del_flag = 0
|
||||
<include refid="whereA"/>
|
||||
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
|
||||
and o.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
|
||||
</if>
|
||||
|
||||
-1
@@ -3,4 +3,3 @@ com.bsd.pjcloud.supermarket.api.feign.RemoteSupermarketSpuService
|
||||
com.bsd.pjcloud.supermarket.api.feign.RemoteSupermarketUnitSkuService
|
||||
com.bsd.pjcloud.supermarket.api.feign.RemoteShopCategoryService
|
||||
com.bsd.pjcloud.supermarket.api.feign.RemoteShopSpuService
|
||||
com.bsd.pjcloud.supermarket.api.feign.RemoteShopSKuService
|
||||
+6
@@ -37,5 +37,11 @@ public class WalletRechargeBindInvoiceDto extends WalletRechargeInvoiceEntity {
|
||||
*/
|
||||
private LocalDateTime[] processTimeList;
|
||||
|
||||
|
||||
private Boolean isFindUserCheck = false;
|
||||
|
||||
/**
|
||||
* sql
|
||||
*/
|
||||
private String orderSql = "";
|
||||
}
|
||||
+5
@@ -14,6 +14,7 @@ import com.alibaba.excel.write.metadata.fill.FillConfig;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
@@ -53,6 +54,7 @@ import com.bsd.pjcloud.wallet.service.WalletRechargeInvoiceService;
|
||||
import com.bsd.pjcloud.wallet.utils.ConvertCnPriceUtil;
|
||||
import com.bsd.pjcloud.wallet.utils.flow.FlowUtil;
|
||||
import com.bsd.pjcloud.wallet.utils.flow.dto.WalletRechargeInvoiceFlowDto;
|
||||
import com.bsd.pjcloud.wallet.utils.page.PaginationOrderSqlExtractor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -472,6 +474,9 @@ public class WalletRechargeInvoiceServiceImpl extends ServiceImpl<WalletRecharge
|
||||
*/
|
||||
@Override
|
||||
public void export(HttpServletResponse response, Page page, WalletRechargeBindInvoiceDto dto, DataScope dataScope) {
|
||||
String orderSql = PaginationOrderSqlExtractor.getOrderSql(page, "a");
|
||||
if (ObjectUtil.isNotEmpty(orderSql)) dto.setOrderSql(orderSql + ",");
|
||||
|
||||
List<WalletRechargeInvoiceVo> list = scopeList(dto, dataScope);
|
||||
try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(ResourceUtil.getStream("file/充值扣款发票申请.xlsx")).build()) {
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.bsd.pjcloud.wallet.utils.page;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class PaginationOrderSqlExtractor {
|
||||
|
||||
public static String getOrderSql(Page page) {
|
||||
return getOrderSql(page, null);
|
||||
}
|
||||
|
||||
public static String getOrderSql(Page page, String alias) {
|
||||
List<OrderItem> orderItems = page.orders();
|
||||
if (ObjectUtil.isEmpty(orderItems)) return null;
|
||||
if (ObjectUtil.isEmpty(alias)) alias = "";
|
||||
if (alias.length() > 0) alias += ".";
|
||||
String finalAlias = alias;
|
||||
return orderItems.stream()
|
||||
.map(item -> {
|
||||
if (item.isAsc()) {
|
||||
return finalAlias + item.getColumn() + " asc";
|
||||
} else {
|
||||
return finalAlias + item.getColumn() + " desc";
|
||||
}
|
||||
})
|
||||
.collect(Collectors.joining(", "));
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -71,7 +71,11 @@
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
</where>
|
||||
order by a.create_time desc , a.id desc
|
||||
order by
|
||||
<if test="dto.orderSql != null and dto.orderSql != '' ">
|
||||
${dto.orderSql}
|
||||
</if>
|
||||
a.create_time desc , a.id desc
|
||||
</sql>
|
||||
|
||||
<select id="selectAllCount" resultType="java.lang.Long">
|
||||
|
||||
Reference in new issue
Block a user