更新9.19
This commit is contained in:
parent
67ab67e6ac
commit
5f5ff96bb9
@ -0,0 +1,10 @@
|
||||
package com.fuint.business.integral.bo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class IntegralSettingsBo {
|
||||
private String integralName;
|
||||
private Integer integral;
|
||||
}
|
@ -150,6 +150,26 @@ public class IntegralSettingsController extends BaseController {
|
||||
return getSuccessResult(this.integralSettingsService.todayIsSignIn(storeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取签到奖励数据
|
||||
* @param storeId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getIntegral")
|
||||
public ResponseObject getIntegral(Integer storeId){
|
||||
return getSuccessResult(this.integralSettingsService.getIntegral(storeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取签到奖励规则
|
||||
* @param storeId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getIntegralSignInRules")
|
||||
public ResponseObject getIntegralSignInRules(Integer storeId){
|
||||
return getSuccessResult(this.integralSettingsService.getIntegralSignInRules(storeId));
|
||||
}
|
||||
|
||||
@PostMapping("signInFunction")
|
||||
public ResponseObject signInFunction(@RequestBody IntegralSettings integralSettings) {
|
||||
return getSuccessResult(this.integralSettingsService.signInFunction(integralSettings));
|
||||
|
@ -2,6 +2,8 @@ package com.fuint.business.integral.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fuint.repository.model.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@ -40,6 +42,7 @@ public class IntegralDetail extends BaseEntity implements Serializable {
|
||||
|
||||
private String changeType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String storeName;
|
||||
/**
|
||||
* 店铺ID
|
||||
@ -51,7 +54,9 @@ public class IntegralDetail extends BaseEntity implements Serializable {
|
||||
*/
|
||||
private Integer chainStoreId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String startTime;
|
||||
@TableField(exist = false)
|
||||
private String endTime;
|
||||
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.fuint.business.integral.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fuint.repository.model.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@ -94,5 +96,6 @@ public class IntegralSettings extends BaseEntity {
|
||||
*/
|
||||
private Integer chainStoreId;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fuint.business.integral.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.integral.entity.IntegralDetail;
|
||||
@ -15,7 +16,7 @@ import java.util.List;
|
||||
* @author wangh
|
||||
* @since 2023-11-10 17:52:33
|
||||
*/
|
||||
public interface IntegralDetailMapper {
|
||||
public interface IntegralDetailMapper extends BaseMapper<IntegralDetail> {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fuint.business.integral.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.integral.entity.IntegralSettings;
|
||||
@ -13,7 +14,7 @@ import java.util.List;
|
||||
* @author makejava
|
||||
* @since 2023-11-09 10:13:20
|
||||
*/
|
||||
public interface IntegralSettingsMapper {
|
||||
public interface IntegralSettingsMapper extends BaseMapper<IntegralSettings> {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
|
@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.integral.entity.IntegralGift;
|
||||
import com.fuint.business.integral.entity.IntegralSettings;
|
||||
import com.fuint.business.integral.vo.IntegralSettingsVo;
|
||||
import com.fuint.business.order.entity.OilOrder;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 积分设置表(IntegralSettings)表服务接口
|
||||
@ -75,4 +78,8 @@ public interface IntegralSettingsService {
|
||||
* @param order
|
||||
*/
|
||||
void refuelPoints(OilOrder order);
|
||||
|
||||
IntegralSettingsVo getIntegral(Integer storeId);
|
||||
|
||||
String getIntegralSignInRules(Integer storeId);
|
||||
}
|
||||
|
@ -1,13 +1,17 @@
|
||||
package com.fuint.business.integral.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fuint.business.integral.bo.IntegralSettingsBo;
|
||||
import com.fuint.business.integral.entity.IntegralDetail;
|
||||
import com.fuint.business.integral.entity.IntegralGift;
|
||||
import com.fuint.business.integral.entity.IntegralSettings;
|
||||
@ -15,6 +19,7 @@ import com.fuint.business.integral.mapper.IntegralDetailMapper;
|
||||
import com.fuint.business.integral.mapper.IntegralSettingsMapper;
|
||||
import com.fuint.business.integral.service.IntegralDetailService;
|
||||
import com.fuint.business.integral.service.IntegralSettingsService;
|
||||
import com.fuint.business.integral.vo.IntegralSettingsVo;
|
||||
import com.fuint.business.order.entity.OilOrder;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilNumber;
|
||||
import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper;
|
||||
@ -26,6 +31,8 @@ import com.fuint.business.userManager.mapper.LJUserMapper;
|
||||
import com.fuint.business.userManager.service.LJUserGradeService;
|
||||
import com.fuint.business.userManager.service.UserBalanceService;
|
||||
import com.fuint.business.userManager.vo.LJUserVo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
@ -39,6 +46,8 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 积分设置表(IntegralSettings)表服务实现类
|
||||
@ -48,11 +57,15 @@ import java.util.Map;
|
||||
*/
|
||||
@Service("integralSettingsService")
|
||||
public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
private static final Logger log = LoggerFactory.getLogger(IntegralSettingsServiceImpl.class);
|
||||
|
||||
@Resource
|
||||
private IntegralSettingsMapper integralSettingsMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private OilNumberMapper oilNumberMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
@ -85,7 +98,7 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
public IPage<IntegralSettings> queryByPage(@Param("page") Page page, IntegralSettings integralSettings) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
integralSettings.setStoreId(nowAccountInfo.getStoreId());
|
||||
return integralSettingsMapper.queryAllByLimit(page,integralSettings);
|
||||
return integralSettingsMapper.queryAllByLimit(page, integralSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,7 +121,7 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
refuelConsumptionAmountMap.put("oilName", oilNumber.getOilName() + oilNumber.getOilType());
|
||||
refuelConsumptionAmountMap.put("amount", 0);
|
||||
refuelConsumptionAmountMap.put("integral", 0);
|
||||
refuelConsumptionAmountMap.put("oilNameId",oilNumber.getId());
|
||||
refuelConsumptionAmountMap.put("oilNameId", oilNumber.getId());
|
||||
refuelConsumptionAmountList.add(refuelConsumptionAmountMap);
|
||||
}
|
||||
String refuelConsumptionAmount = JSON.toJSONString(refuelConsumptionAmountList);
|
||||
@ -118,7 +131,7 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
insert(integralSettings);
|
||||
return integralSettings;
|
||||
|
||||
}else if (ObjectUtil.isEmpty(settings.getRefuelConsumptionAmount()) || settings.getRefuelConsumptionAmount().length()<6){
|
||||
} else if (ObjectUtil.isEmpty(settings.getRefuelConsumptionAmount()) || settings.getRefuelConsumptionAmount().length() < 6) {
|
||||
// 查询店铺所有的存油
|
||||
List<OilNumber> oilName = oilNumberMapper.getOilName(nowAccountInfo.getStoreId());
|
||||
if (!ObjectUtil.isEmpty(oilName)) {
|
||||
@ -128,7 +141,7 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
refuelConsumptionAmountMap.put("oilName", oilNumber.getOilName() + oilNumber.getOilType());
|
||||
refuelConsumptionAmountMap.put("amount", 0);
|
||||
refuelConsumptionAmountMap.put("integral", 0);
|
||||
refuelConsumptionAmountMap.put("oilNameId",oilNumber.getId());
|
||||
refuelConsumptionAmountMap.put("oilNameId", oilNumber.getId());
|
||||
refuelConsumptionAmountList.add(refuelConsumptionAmountMap);
|
||||
}
|
||||
String refuelConsumptionAmount = JSON.toJSONString(refuelConsumptionAmountList);
|
||||
@ -142,7 +155,6 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
return settings;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -200,8 +212,10 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
private UserBalanceService userBalanceService;
|
||||
@Resource
|
||||
private IntegralDetailService integralDetailService;
|
||||
|
||||
/**
|
||||
* 查询当前用户是否已经签到过 或者是否开启签到功能
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@ -214,10 +228,10 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
if (signInGifts.size() > 0) {
|
||||
// 已经签到过
|
||||
return -2;
|
||||
}else {
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -227,6 +241,7 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
|
||||
/**
|
||||
* 签到功能
|
||||
*
|
||||
* @param integralSettings
|
||||
* @return
|
||||
*/
|
||||
@ -239,7 +254,7 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
|
||||
if (integer == 0) {
|
||||
// 查询当前用户
|
||||
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById4Chain(nowAccountInfo.getId(),integralSettings.getChainStoreId());
|
||||
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById4Chain(nowAccountInfo.getId(), integralSettings.getChainStoreId());
|
||||
|
||||
if (ObjectUtil.isEmpty(ljUserVos)) {
|
||||
// 新增余额信息
|
||||
@ -257,7 +272,7 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
}
|
||||
// 新增会员余额信息
|
||||
userBalanceService.insertUserBalance(userBalanceAdd);
|
||||
ljUserVos = ljUserMapper.selectAllInfoById4Chain(nowAccountInfo.getId(),integralSettings.getChainStoreId());
|
||||
ljUserVos = ljUserMapper.selectAllInfoById4Chain(nowAccountInfo.getId(), integralSettings.getChainStoreId());
|
||||
}
|
||||
ljUserVos.setChainStoreId(integralSettings.getChainStoreId());
|
||||
ljUserVos.setStoreId(integralSettings.getStoreId());
|
||||
@ -267,7 +282,7 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
// 签到规则
|
||||
JSONArray jsonArray = JSON.parseArray(integralSetting.getPointsObtained());
|
||||
// 查询昨天是否签到
|
||||
List<IntegralDetail> signInGifts = integralDetailMapper.signInGiftsYesterday("签到赠送",ljUserVos.getId(),ljUserVos.getChainStoreId());
|
||||
List<IntegralDetail> signInGifts = integralDetailMapper.signInGiftsYesterday("签到赠送", ljUserVos.getId(), ljUserVos.getChainStoreId());
|
||||
|
||||
if (ObjectUtil.isEmpty(signInGifts)) {
|
||||
extracted(ljUserVos, jsonArray, 0);
|
||||
@ -304,38 +319,92 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
@Override
|
||||
public void refuelPoints(OilOrder order) {
|
||||
IntegralSettings integralSettings = integralSettingsMapper.getByStoreId(order.getStoreId());
|
||||
if (ObjectUtil.isNotEmpty(integralSettings) && integralSettings.getRefuelPointsRules()==0
|
||||
&& integralSettings.getRefuelPointsFunction() ==0){
|
||||
if (integralSettings.getRefuelSceneType()==0){
|
||||
if (ObjectUtil.isNotEmpty(integralSettings) && integralSettings.getRefuelPointsRules() == 0
|
||||
&& integralSettings.getRefuelPointsFunction() == 0) {
|
||||
if (integralSettings.getRefuelSceneType() == 0) {
|
||||
// 按金额
|
||||
if (integralSettings.getRefuelAmountType()==0){
|
||||
if (integralSettings.getRefuelAmountType() == 0) {
|
||||
// 按订单金额
|
||||
countPoints(integralSettings,order.getOils(),order.getOrderAmount(),order.getUserId());
|
||||
}else {
|
||||
countPoints(integralSettings, order.getOils(), order.getOrderAmount(), order.getUserId());
|
||||
} else {
|
||||
// 按实付金额
|
||||
if (integralSettings.getRefuelValueParticipation()==0){
|
||||
if (integralSettings.getRefuelValueParticipation() == 0) {
|
||||
// 储值金额不参与
|
||||
countPoints(integralSettings,order.getOils(),order.getPayAmount(),order.getUserId());
|
||||
}else {
|
||||
countPoints(integralSettings, order.getOils(), order.getPayAmount(), order.getUserId());
|
||||
} else {
|
||||
// 储值金额参与
|
||||
countPoints(integralSettings,order.getOils(),order.getPayAmount()+order.getBalanceAmount(),order.getUserId());
|
||||
countPoints(integralSettings, order.getOils(), order.getPayAmount() + order.getBalanceAmount(), order.getUserId());
|
||||
}
|
||||
}
|
||||
}else if (integralSettings.getRefuelSceneType()==1){
|
||||
} else if (integralSettings.getRefuelSceneType() == 1) {
|
||||
// 按实付金额
|
||||
countPoints(integralSettings,order.getOils(),order.getPayAmount()+order.getBalanceAmount(),order.getUserId());
|
||||
countPoints(integralSettings, order.getOils(), order.getPayAmount() + order.getBalanceAmount(), order.getUserId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegralSettingsVo getIntegral(Integer storeId) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
LambdaQueryWrapper<IntegralSettings> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(IntegralSettings::getStoreId, storeId);
|
||||
IntegralSettings integralSettings = integralSettingsMapper.selectOne(queryWrapper);
|
||||
JSONArray jsonArray = JSONArray.parseArray(integralSettings.getPointsObtained());
|
||||
IntegralSettingsVo integralSettingsVo = new IntegralSettingsVo();
|
||||
List<IntegralSettingsBo> integralSettingsList = new ArrayList<>();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
String day = jsonArray.getJSONObject(i).get("day").toString();
|
||||
Integer points = Integer.parseInt(jsonArray.getJSONObject(i).get("integral").toString());
|
||||
IntegralSettingsBo integralSettings1 = new IntegralSettingsBo();
|
||||
integralSettings1.setIntegralName(day);
|
||||
integralSettings1.setIntegral(points);
|
||||
integralSettingsList.add(integralSettings1);
|
||||
}
|
||||
integralSettingsVo.setIntegralSettings(integralSettingsList);
|
||||
|
||||
DateTime now = DateUtil.date();
|
||||
DateTime yesterDay = DateUtil.offsetDay(now, -1);
|
||||
//查询连续签到天数
|
||||
List<IntegralDetail> day = integralDetailMapper.selectList(new LambdaQueryWrapper<IntegralDetail>()
|
||||
.eq(IntegralDetail::getUserId, nowAccountInfo.getId())
|
||||
.eq(IntegralDetail::getStoreId, storeId)
|
||||
.eq(IntegralDetail::getType, "签到赠送")
|
||||
.between(IntegralDetail::getCreateTime, DateUtil.beginOfDay(yesterDay), now)
|
||||
.orderBy(true, false, IntegralDetail::getCreateTime));
|
||||
|
||||
if (CollUtil.isNotEmpty(day)) {
|
||||
IntegralDetail integralDetail = day.get(0);
|
||||
if (ObjectUtil.isNotEmpty(integralDetail)) {
|
||||
// 正则表达式,匹配数字
|
||||
Pattern pattern = Pattern.compile("\\d+");
|
||||
Matcher matcher = pattern.matcher(integralDetail.getChangeReason());
|
||||
StringBuilder numbers = new StringBuilder();
|
||||
while (matcher.find()) {
|
||||
numbers.append(matcher.group());
|
||||
}
|
||||
integralSettingsVo.setSignInDays(numbers.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return integralSettingsVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIntegralSignInRules(Integer storeId) {
|
||||
IntegralSettings integralSettings = integralSettingsMapper.selectOne(new LambdaQueryWrapper<IntegralSettings>()
|
||||
.eq(IntegralSettings::getStoreId, storeId));
|
||||
return integralSettings.getSignInRules();
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算赠送积分
|
||||
*
|
||||
* @param integralSettings
|
||||
* @param oilId 油品id
|
||||
* @param amount 消费金额
|
||||
* @param userId 用户id
|
||||
*/
|
||||
private void countPoints(IntegralSettings integralSettings,String oilId,Double amount,Integer userId){
|
||||
private void countPoints(IntegralSettings integralSettings, String oilId, Double amount, Integer userId) {
|
||||
LJStore store = iljStoreService.selectStoreByStoreId(integralSettings.getStoreId());
|
||||
UserBalance balance = userBalanceService.selectUserBalance(userId, store.getChainStoreId());
|
||||
IntegralDetail integralDetail = new IntegralDetail();
|
||||
@ -348,23 +417,23 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
integralDetail.setUserId(balance.getMtUserId());
|
||||
IntegralDetail integralDetail1 = integralDetailService.insert2(integralDetail);
|
||||
if (ObjectUtil.isNotEmpty(balance)) {
|
||||
if (integralSettings.getRefuelSceneRules()==0) {
|
||||
if (integralSettings.getRefuelSceneRules() == 0) {
|
||||
// 通用规则
|
||||
if (integralSettings.getRefuelFuelAmount() <= amount) {
|
||||
Integer points = balance.getPoints();
|
||||
balance.setPoints(points+integralSettings.getRefuelPoints());
|
||||
balance.setPoints(points + integralSettings.getRefuelPoints());
|
||||
}
|
||||
} else {
|
||||
// 油品区分
|
||||
JSONArray jsonArray = JSONArray.parseArray(integralSettings.getRefuelConsumptionAmount());
|
||||
for (int i = 0;i<jsonArray.size();i++){
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
Double amount1 = Double.valueOf(jsonArray.getJSONObject(i).get("amount").toString());
|
||||
Integer integral = Integer.valueOf(jsonArray.getJSONObject(i).get("integral").toString());
|
||||
String oilNameId = jsonArray.getJSONObject(i).get("oilNameId").toString();
|
||||
if (oilNameId.equals(oilId)){
|
||||
if (amount1<=amount){
|
||||
if (oilNameId.equals(oilId)) {
|
||||
if (amount1 <= amount) {
|
||||
Integer points = balance.getPoints();
|
||||
balance.setPoints(points+integral);
|
||||
balance.setPoints(points + integral);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -379,7 +448,7 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
integralDetail.setStoreId(ljUserVos.getStoreId());
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
if (dayInt >= 8 ) {
|
||||
if (dayInt >= 8) {
|
||||
jsonObject = jsonArray.getJSONObject(7);
|
||||
|
||||
} else {
|
||||
@ -402,7 +471,7 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
integralDetail.setType("签到赠送");
|
||||
integralDetail.setChainStoreId(ljUserVos.getChainStoreId());
|
||||
|
||||
integralDetail.setChangeReason("签到第"+ (dayInt +1)+"天获得");
|
||||
integralDetail.setChangeReason("签到第" + (dayInt + 1) + "天获得");
|
||||
|
||||
integralDetailService.insert2(integralDetail);
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.fuint.business.integral.vo;
|
||||
|
||||
import com.fuint.business.integral.bo.IntegralSettingsBo;
|
||||
import com.fuint.business.integral.entity.IntegralSettings;
|
||||
import com.fuint.repository.model.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 积分设置表Vo
|
||||
*
|
||||
* @author wangh
|
||||
* @since 2023-11-09 10:13:20
|
||||
*/
|
||||
@Data
|
||||
public class IntegralSettingsVo{
|
||||
private String signInDays;
|
||||
private List<IntegralSettingsBo> integralSettings;
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,17 +2,20 @@ package com.fuint.business.order.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.integral.entity.IntegralDetail;
|
||||
import com.fuint.business.order.dto.AllOrderInfoDto;
|
||||
import com.fuint.business.order.entity.AllOrderInfo;
|
||||
import com.fuint.business.order.entity.CardBalanceChange;
|
||||
import com.fuint.business.order.entity.CashierOrder;
|
||||
import com.fuint.business.order.service.AllOrderInfoService;
|
||||
import com.fuint.business.order.vo.AllOrderInfoUniVo;
|
||||
import com.fuint.business.order.vo.AllOrderInfoVo;
|
||||
import com.fuint.business.order.vo.CardBalanceChangeVo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import com.fuint.system.dept.vo.SysDeptVo;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -304,4 +307,20 @@ public class AllOrderInfoController extends BaseController {
|
||||
public ResponseObject getDataBoard(@RequestParam Map<String, String> map){
|
||||
return getSuccessResult(allOrderInfoService.getDataBoard(map));
|
||||
}
|
||||
|
||||
/**
|
||||
* 消费记录(小程序)
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param allOrderInfo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("queryByPageUni")
|
||||
public ResponseObject queryByPageUni(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
@Param("integralDetail") AllOrderInfo allOrderInfo) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
IPage<AllOrderInfoUniVo> iPageList = this.allOrderInfoService.queryByPageUni(page, allOrderInfo);
|
||||
return getSuccessResult(iPageList);
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import com.fuint.business.order.dto.AllOrderInfoDto;
|
||||
import com.fuint.business.order.entity.AllOrderInfo;
|
||||
import com.fuint.business.order.entity.CardBalanceChange;
|
||||
import com.fuint.business.order.entity.HandoverRecord;
|
||||
import com.fuint.business.order.vo.AllOrderInfoUniVo;
|
||||
import com.fuint.business.order.vo.AllOrderInfoVo;
|
||||
import com.fuint.business.order.vo.CardBalanceChangeVo;
|
||||
import com.fuint.business.order.vo.Excel.allorderVOo;
|
||||
@ -91,6 +92,7 @@ public interface AllOrderInfoMapper extends BaseMapper<AllOrderInfo> {
|
||||
|
||||
IPage<AllOrderInfoVo> runningWaterByInstituion2(Page page,@Param("order") AllOrderInfoDto allOrderInfo);
|
||||
|
||||
IPage<CardValueOrdersVo> getBlanceANdOrder(Page page, @Param("order") CardValueOrdersDTO allOrderInfo);
|
||||
// IPage<CardValueOrdersVo> getBlanceANdOrder(Page page, @Param("order") CardValueOrdersDTO allOrderInfo);
|
||||
|
||||
IPage<AllOrderInfoUniVo> queryAllByLimit(Page page, @Param("allOrderInfo") AllOrderInfo allOrderInfo);
|
||||
}
|
@ -727,6 +727,32 @@
|
||||
|
||||
group by content
|
||||
</select>
|
||||
<select id="queryAllByLimit" resultType="com.fuint.business.order.vo.AllOrderInfoUniVo">
|
||||
select *,m.name as storeName,
|
||||
case when type = 1 then '油品'
|
||||
when type = 2 then '商品'
|
||||
when type = 3 then '储值卡'
|
||||
when type = 4 then '积分'
|
||||
when type = 5 then '囤油卡'
|
||||
when type = 6 then '收银台订单'
|
||||
when type = 7 then '挂账订单'
|
||||
when type = 8 then 'pos'
|
||||
else '未知' end as type_name
|
||||
from all_order_info a
|
||||
join mt_store m
|
||||
on a.store_id = m.id
|
||||
<where>
|
||||
<if test="allOrderInfo.storeId != null">
|
||||
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>
|
||||
</where>
|
||||
</select>
|
||||
<!-- <where>-->
|
||||
<!-- store_id = #{order.storeId}-->
|
||||
<!-- <if test="order.params.beginTime != null and order.params.beginTime != ''"><!– 开始时间检索 –>-->
|
||||
|
@ -7,6 +7,7 @@ import com.fuint.business.order.dto.AllOrderInfoDto;
|
||||
import com.fuint.business.order.entity.AllOrderInfo;
|
||||
import com.fuint.business.order.entity.CashierOrder;
|
||||
import com.fuint.business.order.entity.HandoverRecord;
|
||||
import com.fuint.business.order.vo.AllOrderInfoUniVo;
|
||||
import com.fuint.business.order.vo.AllOrderInfoVo;
|
||||
import com.fuint.business.order.vo.CardBalanceChangeVo;
|
||||
import com.fuint.framework.exception.BusinessCheckException;
|
||||
@ -150,4 +151,12 @@ public interface AllOrderInfoService {
|
||||
* @return
|
||||
*/
|
||||
Map<String ,Object> getDataBoard(Map<String,String> map);
|
||||
|
||||
/**
|
||||
* 消费记录
|
||||
* @param page
|
||||
* @param allOrderInfo
|
||||
* @return
|
||||
*/
|
||||
IPage<AllOrderInfoUniVo> queryByPageUni(Page page, AllOrderInfo allOrderInfo);
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.fuint.business.order.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@ -23,6 +25,7 @@ import com.fuint.business.order.mapper.AllOrderInfoMapper;
|
||||
import com.fuint.business.order.mapper.OilOrderMapper;
|
||||
import com.fuint.business.order.mapper.OrderGoodsMapper;
|
||||
import com.fuint.business.order.service.*;
|
||||
import com.fuint.business.order.vo.AllOrderInfoUniVo;
|
||||
import com.fuint.business.order.vo.AllOrderInfoVo;
|
||||
import com.fuint.business.order.vo.Excel.*;
|
||||
import com.fuint.business.order.vo.OilOrderVo;
|
||||
@ -1657,6 +1660,21 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper, All
|
||||
return map1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 消费记录
|
||||
*
|
||||
* @param page
|
||||
* @param allOrderInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<AllOrderInfoUniVo> queryByPageUni(Page page, AllOrderInfo allOrderInfo) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
allOrderInfo.setUserId(nowAccountInfo.getId());
|
||||
allOrderInfo.setStatus("paid");
|
||||
return this.allOrderInfoMapper.queryAllByLimit(page, allOrderInfo);
|
||||
}
|
||||
|
||||
|
||||
private long dayCount(String beginTimeStr, String endTimeStr) {
|
||||
// 将字符串表示的时间转换成 LocalDate 对象
|
||||
|
@ -0,0 +1,11 @@
|
||||
package com.fuint.business.order.vo;
|
||||
|
||||
import com.fuint.business.order.entity.AllOrderInfo;
|
||||
import lombok.Data;
|
||||
import weixin.popular.bean.pay.OrderInfo;
|
||||
|
||||
@Data
|
||||
public class AllOrderInfoUniVo extends AllOrderInfo {
|
||||
private String typeName;
|
||||
private String storeName;
|
||||
}
|
@ -5,10 +5,13 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableRecordMapper;
|
||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
|
||||
import com.fuint.business.marketingActivity.cardValue.mapper.CardValueRecordMapper;
|
||||
import com.fuint.business.order.mapper.AllOrderInfoMapper;
|
||||
@ -71,6 +74,9 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
||||
@Resource
|
||||
MtStoreMapper mtStoreMapper;
|
||||
|
||||
@Autowired
|
||||
CardFavorableRecordMapper cardFavorableRecordMapper;
|
||||
|
||||
@Override
|
||||
public IPage<UserBalanceVo> listByZt(Page page, UserBalanceVo user) {
|
||||
if (ObjectUtil.isEmpty(user.getDeptId())) {
|
||||
@ -336,17 +342,21 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
||||
@Override
|
||||
public UserBlanceUniVo getUserBalanceApplet(UserBalance userBalance) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
log.info("查询会员信息:"+nowAccountInfo);
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("mt_user_id",nowAccountInfo.getId());
|
||||
queryWrapper.eq("chain_store_id",userBalance.getChainStoreId());
|
||||
UserBalance balance = baseMapper.selectOne(queryWrapper);
|
||||
log.info("查询会员储值卡余额:"+balance);
|
||||
UserBlanceUniVo userBlanceUniVo = new UserBlanceUniVo();
|
||||
if (ObjectUtil.isNotEmpty(balance)) {
|
||||
userBlanceUniVo = BeanUtil.copyProperties(balance,UserBlanceUniVo.class);
|
||||
Double giveAmount = ObjectUtil.isNotEmpty(balance.getGiveAmount()) ? balance.getGiveAmount() : 0;
|
||||
userBlanceUniVo.setAllBalance(balance.getCardBalance()+ giveAmount);
|
||||
//查询优惠券数量
|
||||
Integer count = cardFavorableRecordMapper.selectCount(new LambdaQueryWrapper<CardFavorableRecord>()
|
||||
.eq(CardFavorableRecord::getMtUserId, balance.getMtUserId())
|
||||
.eq(CardFavorableRecord::getStatus, 0)
|
||||
.eq(CardFavorableRecord::getStoreId, balance.getStoreId()));
|
||||
userBlanceUniVo.setCardFavorableCount(count);
|
||||
}else {
|
||||
userBlanceUniVo.setAllBalance(0.0);
|
||||
userBlanceUniVo.setCardBalance(0.0);
|
||||
|
@ -7,4 +7,7 @@ import lombok.Data;
|
||||
public class UserBlanceUniVo extends UserBalance {
|
||||
//总余额
|
||||
private Double allBalance;
|
||||
|
||||
//卡券数量
|
||||
private int cardFavorableCount;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user