更新10.12

This commit is contained in:
许允枞 2024-10-12 14:43:16 +08:00
parent d61f30cb08
commit 4f974132a9
7 changed files with 60 additions and 56 deletions

View File

@ -319,7 +319,7 @@ public class AllOrderInfoController extends BaseController {
@GetMapping("queryByPageUni")
public ResponseObject queryByPageUni(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("integralDetail") AllOrderInfo allOrderInfo) {
@Param("integralDetail") AllOrderInfoUniVo allOrderInfo) {
Page page = new Page(pageNo, pageSize);
IPage<AllOrderInfoUniVo> iPageList = this.allOrderInfoService.queryByPageUni(page, allOrderInfo);
return getSuccessResult(iPageList);
@ -330,9 +330,9 @@ public class AllOrderInfoController extends BaseController {
* @param storeId
* @return
*/
@GetMapping("getConsumptionMoney/{storeId}")
public ResponseObject getConsumptionMoney(@PathVariable Integer storeId){
return getSuccessResult(allOrderInfoService.getConsumptionMoney(storeId));
@GetMapping("getConsumptionMoney")
public ResponseObject getConsumptionMoney(AllOrderInfoUniVo allOrderInfo){
return getSuccessResult(allOrderInfoService.getConsumptionMoney(allOrderInfo));
}
/**

View File

@ -102,5 +102,5 @@ public interface AllOrderInfoMapper extends BaseMapper<AllOrderInfo> {
// IPage<CardValueOrdersVo> getBlanceANdOrder(Page page, @Param("order") CardValueOrdersDTO allOrderInfo);
IPage<AllOrderInfoUniVo> queryAllByLimit(Page page, @Param("allOrderInfo") AllOrderInfo allOrderInfo);
IPage<AllOrderInfoUniVo> queryAllByLimit(Page page, @Param("allOrderInfo") AllOrderInfoUniVo allOrderInfo);
}

View File

@ -800,15 +800,20 @@
join mt_store m
on a.store_id = m.id
<where>
a.status = "paid"
<if test="allOrderInfo.storeId != null">
a.store_id = #{allOrderInfo.storeId}
and a.store_id = #{allOrderInfo.storeId}
</if>
<if test="allOrderInfo.userId != null">
and a.user_id = #{allOrderInfo.userId}
</if>
<if test="allOrderInfo.status != null">
and a.status = #{allOrderInfo.status}
<if test="allOrderInfo.startTime != null">
and a.pay_time between #{allOrderInfo.startTime} and #{allOrderInfo.endTime}
</if>
<if test="allOrderInfo.content != null and allOrderInfo.content != ''">
and a.content like concat('%',#{allOrderInfo.content},'%')
</if>
</where>
</select>
<select id="getOneByOrderId" resultType="com.fuint.business.order.vo.AllOrderActivityVo">

View File

@ -159,14 +159,14 @@ public interface AllOrderInfoService {
* @param allOrderInfo
* @return
*/
IPage<AllOrderInfoUniVo> queryByPageUni(Page page, AllOrderInfo allOrderInfo);
IPage<AllOrderInfoUniVo> queryByPageUni(Page page, AllOrderInfoUniVo allOrderInfo);
/**
* 获取消费金额小程序
* @param storeId
* @return
*/
Double getConsumptionMoney(Integer storeId);
Double getConsumptionMoney(AllOrderInfoUniVo allOrderInfo);
// 根据订单id 查询订单 并且有且只有一个关联油品订单
AllOrderActivityVo getOneByOrderId(Integer orderId);

View File

@ -1662,30 +1662,46 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper, All
* @return
*/
@Override
public IPage<AllOrderInfoUniVo> queryByPageUni(Page page, AllOrderInfo allOrderInfo) {
public IPage<AllOrderInfoUniVo> queryByPageUni(Page page, AllOrderInfoUniVo allOrderInfo) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
allOrderInfo.setUserId(nowAccountInfo.getId());
allOrderInfo.setStatus("paid");
if (ObjectUtil.isNotEmpty(allOrderInfo.getStartTime())) {
DateTime parse = DateUtil.parse(allOrderInfo.getStartTime(), "yyyy-MM");
allOrderInfo.setStartTime(DateUtil.beginOfMonth(parse).toString());
allOrderInfo.setEndTime(DateUtil.endOfMonth(parse).toString());
}
// allOrderInfo.setStatus("paid");
return this.allOrderInfoMapper.queryAllByLimit(page, allOrderInfo);
}
/**
* 获取消费金额小程序
*
* @param storeId
* @param
* @return
*/
@Override
public Double getConsumptionMoney(Integer storeId) {
public Double getConsumptionMoney(AllOrderInfoUniVo allOrderInfo) {
Integer id = TokenUtil.getNowAccountInfo().getId();
List<AllOrderInfo> paid = baseMapper.selectList(new LambdaQueryWrapper<AllOrderInfo>()
.eq(AllOrderInfo::getStoreId, storeId)
.ne(AllOrderInfo::getPayType, "refund")
.eq(AllOrderInfo::getUserId, id));
LambdaQueryWrapper<AllOrderInfo> allOrderInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
allOrderInfoLambdaQueryWrapper.eq(AllOrderInfo::getStoreId, allOrderInfo.getStoreId())
.eq(AllOrderInfo::getStatus, "paid")
.eq(AllOrderInfo::getUserId, id);
if (ObjectUtil.isNotEmpty(allOrderInfo.getStartTime())) {
DateTime parse = DateUtil.parse(allOrderInfo.getStartTime(), "yyyy-MM");
allOrderInfo.setStartTime(DateUtil.beginOfMonth(parse).toString());
allOrderInfo.setEndTime(DateUtil.endOfMonth(parse).toString());
allOrderInfoLambdaQueryWrapper.between(AllOrderInfo::getPayTime, allOrderInfo.getStartTime(), allOrderInfo.getEndTime());
}
if (ObjectUtil.isNotEmpty(allOrderInfo.getContent())) {
allOrderInfoLambdaQueryWrapper.like(AllOrderInfo::getContent, allOrderInfo.getContent());
}
List<AllOrderInfo> paid = baseMapper.selectList(allOrderInfoLambdaQueryWrapper);
//计算实付金额
double sum = paid.stream()
.mapToDouble(order -> Optional.ofNullable(order.getPayMoney()).orElse(0.0))
.filter(order -> !Optional.ofNullable(order.getContent()).orElse("").contains("充值"))
.mapToDouble(order -> order.getPayMoney() != null ? order.getPayMoney() : 0.0)
.sum();
return sum;
}

View File

@ -8,4 +8,6 @@ import weixin.popular.bean.pay.OrderInfo;
public class AllOrderInfoUniVo extends AllOrderInfo {
private String typeName;
private String storeName;
private String startTime;
private String endTime;
}

View File

@ -25,7 +25,7 @@
<view style="width: 85%;">
<view class="right-box">
<view class="l-text">{{ item.typeName }}</view>
<view class="r-text" v-if="item.updateBy!=null">+{{ item.payMoney }}</view>
<view class="r-text" v-if="item.content && item.content.includes('充值')">{{ item.payMoney }}</view>
<view class="r-text" v-else>-{{ item.payMoney }}</view>
</view>
<view class="right-box">
@ -109,45 +109,20 @@ export default {
label: '全部类型',
value: null
}, {
label: '消费有礼',
value: ''
label: '油品',
value: '订单'
}, {
label: '充值有礼',
value: ''
label: '会员充值',
value: '充值'
}, {
label: '积分兑换',
value: ''
}, {
label: '开卡有礼',
value: ''
}, {
label: '邀请有礼',
value: ''
}, {
label: '生日有礼',
value: ''
}, {
label: '推荐会员充值有礼',
value: ''
},
{
label: '推荐会员推荐有礼',
value: ''
}, {
label: '每日签到',
value: ''
}, {
label: '大转盘抽奖',
value: ''
}, {
label: '九宫格抽奖',
value: ''
}
]
value: '积分'
}]
],
queryParams: {
pageNo: 1,
pageSize: 30,
content: "",
type: "",
storeId: uni.getStorageSync("storeId"),
changeReason: "",
@ -187,8 +162,9 @@ export default {
getUserBalance() {
console.log('this.queryParams:', this.queryParams.storeId)
request({
url: '/business/allOrderInfo/getConsumptionMoney/' + this.queryParams.storeId,
method: 'get'
url: 'business/allOrderInfo/getConsumptionMoney',
method: 'get',
params: this.queryParams
}).then(res => {
if (res.code == 200) {
this.cardBalance = res.data
@ -196,6 +172,7 @@ export default {
})
},
getList() {
console.log('this.queryParams:', this.queryParams)
request({
url: '/business/allOrderInfo/queryByPageUni',
method: 'get',
@ -210,11 +187,13 @@ export default {
confirm(e) {
this.queryParams.pageNo = 1
if (e.value[0] == '全部类型') {
this.queryParams.type = null
this.queryParams.content = null
} else {
this.queryParams.type = e.value[0].type
this.queryParams.content = e.value[0].value
}
console.log('this.queryParams:', this.queryParams.content)
this.getList()
this.getUserBalance()
this.show1 = false
},
cancel() {
@ -232,7 +211,9 @@ export default {
confirm1(e) {
this.queryParams.startTime = this.timestampToString(e.value)
this.queryParams.pageNo = 1
console.log('this.queryParams:', this.queryParams)
this.getList()
this.getUserBalance()
this.show = false
},
cancel1() {