diff --git a/fuintAdmin/.env.development b/fuintAdmin/.env.development index 473d93732..41a54452d 100644 --- a/fuintAdmin/.env.development +++ b/fuintAdmin/.env.development @@ -11,7 +11,7 @@ VUE_APP_BASE_API = '/dev-api' VUE_APP_PUBLIC_PATH = '/' # 后端接口地址 -VUE_APP_SERVER_URL = 'http://192.168.31.95:8080/' +VUE_APP_SERVER_URL = 'http://127.0.0.1:8080/' # http://192.168.0.121:8080/ diff --git a/fuintAdmin/src/views/EventMarketing/newCertificate/index.vue b/fuintAdmin/src/views/EventMarketing/newCertificate/index.vue index 9d7ec7f4a..4c5fdc23c 100644 --- a/fuintAdmin/src/views/EventMarketing/newCertificate/index.vue +++ b/fuintAdmin/src/views/EventMarketing/newCertificate/index.vue @@ -270,6 +270,22 @@ + + + 不限 + 自定义 + + + + + + + + { + this.goodsList = response.data.records; + }); + }, sxCoupon(id) { getCoupon(id).then(res => { if (res.code == 200) { @@ -925,6 +952,7 @@ export default { pageNo: 1, pageSize: 10 } + this.goodsList = []; this.getlist(); }, getlist() { @@ -1062,8 +1090,8 @@ export default { if (this.ruleForm.oilNumber) { this.ruleForm.oilNumber = this.ruleForm.oilNumber.toString() } - - + let productIds = this.ruleForm.productIdList + '' + this.ruleForm.productIds = productIds if (!this.ruleForm.id) { addCardCoupon(this.ruleForm).then(res => { @@ -1071,6 +1099,7 @@ export default { this.$message.success('添加成功'); this.gettj() this.getlist() + this.centerDialogVisible = false } else { this.$message.error('操作失败请稍后再试'); } @@ -1083,6 +1112,7 @@ export default { this.$message.success('修改成功'); this.gettj() this.getlist() + this.centerDialogVisible = false } else { this.$message.error('操作失败请稍后再试'); } @@ -1092,7 +1122,6 @@ export default { } - this.centerDialogVisible = false } } } diff --git a/fuintAdmin_zt/.env.development b/fuintAdmin_zt/.env.development index 0f26d7a9e..2549f583a 100644 --- a/fuintAdmin_zt/.env.development +++ b/fuintAdmin_zt/.env.development @@ -11,11 +11,6 @@ VUE_APP_BASE_API = '/dev-api' VUE_APP_PUBLIC_PATH = '/' # 后端接口地址 - - - -VUE_APP_SERVER_URL = 'http://192.168.31.95:8080/' - - +VUE_APP_SERVER_URL = 'http://192.168.31.178:8080/' # cp端地址 # VUE_PC_SERVER_URL = 'http://47.95.206.185:85/' diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetInfoController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetInfoController.java index 389380323..6d6121793 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetInfoController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetInfoController.java @@ -104,5 +104,15 @@ public class FleetInfoController extends BaseController { public ResponseObject addFleetInfo(@RequestBody FleetInfo fleetInfo) { return getSuccessResult(fleetInfoService.addFleetInfo(fleetInfo)); } + + /** + * 根据车队id查询车队信息 + * @param fleetId + * @return + */ + @GetMapping("/getFleetInfoByFleetId") + public ResponseObject getFleetInfoByFleetId(@Param("fleetId")Integer fleetId){ + return getSuccessResult(fleetInfoService.queryByFleetId(fleetId)); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetMemberController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetMemberController.java index 6f68cdeb2..712a914fa 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetMemberController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetMemberController.java @@ -196,5 +196,14 @@ public class FleetMemberController extends BaseController { } return getSuccessResult(map); } + + /** + * 额度调整(小程序) + * @return + */ + @PutMapping("editLimit") + public ResponseObject editLimit(@RequestBody FleetMember fleetMember){ + return getSuccessResult(fleetMemberService.editLimit(fleetMember)); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetInfoService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetInfoService.java index 095bc2185..b68f4f509 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetInfoService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetInfoService.java @@ -75,4 +75,6 @@ public interface FleetInfoService { * @return */ int addFleetInfo(FleetInfo fleetInfo); + + FleetInfoUniVo queryByFleetId(Integer fleetId); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetMemberService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetMemberService.java index 9c0d2da30..cbdd12b8d 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetMemberService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetMemberService.java @@ -80,4 +80,11 @@ public interface FleetMemberService { * @return */ int logOffFleetMember(Integer id); + + /** + * 额度调整 + * @param fleetMember + * @return + */ + int editLimit(FleetMember fleetMember); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetInfoServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetInfoServiceImpl.java index 9ddbc71b3..c9fa819a6 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetInfoServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetInfoServiceImpl.java @@ -231,7 +231,8 @@ public class FleetInfoServiceImpl extends ServiceImpl //获取所在车队的id集合 List fleetIds = fleetMembers.stream().map(FleetMember::getFleetId).collect(Collectors.toList()); if (CollUtil.isEmpty(fleetIds)) { - throw new RuntimeException("未绑定车队"); +// throw new RuntimeException("未绑定车队"); + return null; } List fleetInfos = baseMapper.selectList(new LambdaQueryWrapper() @@ -295,6 +296,29 @@ public class FleetInfoServiceImpl extends ServiceImpl } } + @Override + public FleetInfoUniVo queryByFleetId(Integer fleetId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + //查询当前登录人的车队信息 + FleetMember fleetMembers = fleetMemberMapper.selectOne(new LambdaQueryWrapper() + .eq(FleetMember::getFleetId, fleetId) + .eq(FleetMember::getUserId, nowAccountInfo.getId())); + //获取所在车队的id集合 +// List fleetIds = fleetMembers.stream().map(FleetMember::getFleetId).collect(Collectors.toList()); + if (ObjectUtil.isEmpty(fleetMembers)) { + throw new RuntimeException("未绑定该车队"); + } + + FleetInfo fleetInfo = baseMapper.selectOne(new LambdaQueryWrapper() + .eq(FleetInfo::getId, fleetId)); + + + FleetInfoUniVo fleetInfoUniVo = BeanUtil.copyProperties(fleetInfo, FleetInfoUniVo.class); + fleetInfoUniVo.setStoreName(mtStoreMapper.selectById(fleetInfo.getStoreId()).getName()); + + return fleetInfoUniVo; + } + /** * 创建用户的基础信息 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java index e3a2fd446..0f2a392f2 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java @@ -12,6 +12,7 @@ import com.fuint.business.fleet.entity.FleetMember; import com.fuint.business.fleet.mapper.FleetMemberMapper; import com.fuint.business.fleet.service.FleetInfoService; import com.fuint.business.fleet.service.FleetMemberService; +import com.fuint.business.fleet.vo.FleetInfoUniVo; import com.fuint.business.fleet.vo.FleetMemberVo; import com.fuint.business.storeInformation.entity.LJStore; import com.fuint.business.storeInformation.service.ILJStoreService; @@ -70,7 +71,13 @@ public class FleetMemberServiceImpl extends ServiceImpl queryPageByNameOrMobile(Page page, FleetMemberVo fleetMember) { -// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + FleetMember fleetMember1 = baseMapper.selectOne(new LambdaQueryWrapper() + .eq(FleetMember::getFleetId, fleetMember.getFleetId()) + .eq(FleetMember::getUserId, nowAccountInfo.getId())); + if (ObjectUtil.isEmpty(fleetMember1)){ + throw new RuntimeException("未绑定该车队,无法查看当前车队成员信息"); + } return baseMapper.queryPageByNameOrMobile(page,fleetMember); } @@ -102,7 +109,11 @@ public class FleetMemberServiceImpl extends ServiceImpl() .eq(FleetMember::getMobile, fleetMember.getMobile()) @@ -115,7 +126,7 @@ public class FleetMemberServiceImpl extends ServiceImpl() .eq(MtUser::getMobile, fleetMember.getMobile()) .last("limit 1")); @@ -201,6 +212,18 @@ public class FleetMemberServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(IntegralSettings::getStoreId, storeId); IntegralSettings integralSettings = integralSettingsMapper.selectOne(queryWrapper); - JSONArray jsonArray = JSONArray.parseArray(integralSettings.getPointsObtained()); IntegralSettingsVo integralSettingsVo = new IntegralSettingsVo(); List 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); + if (ObjectUtil.isNotEmpty(integralSettings)) { + JSONArray jsonArray = JSONArray.parseArray(integralSettings.getPointsObtained()); + if (ObjectUtil.isNotEmpty(integralSettings.getSignApplicableRules()) && integralSettings.getSignApplicableRules() == 0) { + int length = 30; + for (int i = 0; i < length; i++) { + IntegralSettingsBo integralSettings1 = new IntegralSettingsBo(); + if (ObjectUtil.isNotEmpty(jsonArray.getJSONObject(0))) { + Integer points = Integer.parseInt(jsonArray.getJSONObject(0).get("integral").toString()); + integralSettings1.setIntegral(points); + } + integralSettings1.setIntegralName("第" + i + 1 + "天"); + integralSettingsList.add(integralSettings1); + } + }else if (ObjectUtil.isNotEmpty(integralSettings.getSignApplicableRules()) && integralSettings.getSignApplicableRules() == 1) { + 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.setIntegralName("第" +( i + 1 )+ "天"); + integralSettings1.setIntegral(points); + integralSettingsList.add(integralSettings1); + } + integralSettingsVo.setIntegralSettings(integralSettingsList); + } - DateTime now = DateUtil.date(); - DateTime yesterDay = DateUtil.offsetDay(now, -1); - //查询连续签到天数 - IntegralDetail integralDetail = integralDetailMapper.selectOne(new LambdaQueryWrapper() - .eq(IntegralDetail::getUserId, nowAccountInfo.getId()) - .eq(IntegralDetail::getStoreId, storeId) - .eq(IntegralDetail::getType, "签到赠送") - .between(IntegralDetail::getCreateTime, DateUtil.beginOfDay(yesterDay), now) - .orderBy(true, false, IntegralDetail::getCreateTime).last("limit 1")); + DateTime now = DateUtil.date(); + DateTime yesterDay = DateUtil.offsetDay(now, -1); + //查询连续签到天数 + IntegralDetail integralDetail = integralDetailMapper.selectOne(new LambdaQueryWrapper() + .eq(IntegralDetail::getUserId, nowAccountInfo.getId()) + .eq(IntegralDetail::getStoreId, storeId) + .eq(IntegralDetail::getType, "签到赠送") + .between(IntegralDetail::getCreateTime, DateUtil.beginOfDay(yesterDay), now) + .orderBy(true, false, IntegralDetail::getCreateTime).last("limit 1")); // 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(); - numbers.append(0); - while (matcher.find()) { - numbers.append(matcher.group()); - } - if (StrUtil.isEmpty(numbers)) { - integralSettingsVo.setSignInDays("0"); - } - String str = numbers.toString(); - if (Integer.parseInt(str) >= 10) { - numbers.deleteCharAt(0); - } - integralSettingsVo.setSignInDays(numbers.toString()); - }else { + if (ObjectUtil.isNotEmpty(integralDetail)) { + // 正则表达式,匹配数字 + Pattern pattern = Pattern.compile("\\d+"); + Matcher matcher = pattern.matcher(integralDetail.getChangeReason()); + StringBuilder numbers = new StringBuilder(); + numbers.append(0); + while (matcher.find()) { + numbers.append(matcher.group()); + } + if (StrUtil.isEmpty(numbers)) { + integralSettingsVo.setSignInDays("0"); + } + String str = numbers.toString(); + if (Integer.parseInt(str) >= 10) { + numbers.deleteCharAt(0); + } + integralSettingsVo.setSignInDays(numbers.toString()); + } else { integralSettingsVo.setSignInDays("0"); } // } + } return integralSettingsVo; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/controller/CardCouponController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/controller/CardCouponController.java index 95331d536..9237a0e29 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/controller/CardCouponController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/controller/CardCouponController.java @@ -1,7 +1,8 @@ package com.fuint.business.marketingActivity.cardCoupon.controller; - +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.api.ApiController; @@ -9,16 +10,23 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponService; import com.fuint.business.marketingActivity.cardGiftActive.entity.CardGiftActive; +import com.fuint.business.petrolStationManagement.entity.OilName; +import com.fuint.business.petrolStationManagement.service.OilNameService; import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.StringUtils; import com.fuint.common.util.TokenUtil; import com.fuint.framework.web.BaseController; import com.fuint.framework.web.ResponseObject; import org.apache.ibatis.annotations.Param; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; /** * 油站优惠卷表2024(CardCoupon)表控制层 @@ -35,6 +43,9 @@ public class CardCouponController extends BaseController { @Resource private CardCouponService cardCouponService; + @Autowired + private OilNameService OilNameService; + /** * 分页查询所有数据 * @@ -42,8 +53,8 @@ public class CardCouponController extends BaseController { * @return 所有数据 */ @GetMapping - public ResponseObject selectAll(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo, - @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, @Param("cardCoupon") CardCoupon cardCoupon) { + public ResponseObject selectAll(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, @Param("cardCoupon") CardCoupon cardCoupon) { Page page = new Page(pageNo, pageSize); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); cardCoupon.setStoreId(nowAccountInfo.getStoreId()); @@ -59,7 +70,44 @@ public class CardCouponController extends BaseController { */ @GetMapping("{id}") public ResponseObject selectOne(@PathVariable Serializable id) { - return getSuccessResult(this.cardCouponService.getById(id)); + CardCoupon cardCoupon = cardCouponService.getById(id); + if (StringUtils.isNotEmpty(cardCoupon.getProductIds())) { + String[] array = cardCoupon.getProductIds().split(","); + // 转换为列表 + List list = Arrays.asList(array); + cardCoupon.setProductIdList(list); + } + String oilNumber = cardCoupon.getOilNumber(); + List hxList = new ArrayList<>(); + //判断是否可以与其他优惠券使用 + if (ObjectUtil.isNotEmpty(cardCoupon.getUseWithOther())){ + if ("1".equals(cardCoupon.getUseWithOther())){ + hxList.add("可以与其他优惠券一起使用"); + }else { + hxList.add("不可与其他优惠券一起使用"); + } + } + //以逗号隔开 + if (StrUtil.isNotEmpty(oilNumber)) { + String[] split = oilNumber.split(","); + List list = Arrays.asList(split); + //转成integer集合 + List ids = list.stream().map(Integer::parseInt).collect(Collectors.toList()); + List oilNames = OilNameService.selectOilNameList(ids); + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("以下油品油号可用:"); + for (int i = 0; i < oilNames.size(); i++) { + if (i < oilNames.size() - 1) { + stringBuilder.append(oilNames.get(i).getOilName()).append("、"); + } else { + stringBuilder.append(oilNames.get(i).getOilName()); + } + } + hxList.add(stringBuilder.toString()); + } + cardCoupon.setHxList(hxList); + //获取支付方式 + return getSuccessResult(cardCoupon); } /** @@ -73,10 +121,10 @@ public class CardCouponController extends BaseController { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); //判断活动编号是否存在 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(CardCoupon::getNumber,cardCoupon.getNumber()) - .eq(CardCoupon::getStoreId,nowAccountInfo.getStoreId()); + queryWrapper.eq(CardCoupon::getNumber, cardCoupon.getNumber()) + .eq(CardCoupon::getStoreId, nowAccountInfo.getStoreId()); int count = cardCouponService.count(queryWrapper); - if (count>0){ + if (count > 0) { return getFailureResult("编号已存在"); } cardCoupon.setStoreId(nowAccountInfo.getStoreId()); @@ -95,11 +143,11 @@ public class CardCouponController extends BaseController { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); //判断活动编号是否存在 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(CardCoupon::getNumber,cardCoupon.getNumber()) - .ne(CardCoupon::getId,cardCoupon.getId()) - .eq(CardCoupon::getStoreId,nowAccountInfo.getStoreId()); + queryWrapper.eq(CardCoupon::getNumber, cardCoupon.getNumber()) + .ne(CardCoupon::getId, cardCoupon.getId()) + .eq(CardCoupon::getStoreId, nowAccountInfo.getStoreId()); int count = cardCouponService.count(queryWrapper); - if (count>0){ + if (count > 0) { return getFailureResult("编号已存在"); } return getSuccessResult(this.cardCouponService.updateById(cardCoupon)); @@ -129,6 +177,7 @@ public class CardCouponController extends BaseController { /** * 上下架 + * * @param id * @return */ @@ -139,17 +188,23 @@ public class CardCouponController extends BaseController { /** * 分页查询可领取优惠券(uniapp使用) + * * @param pageNo * @param pageSize * @param cardCoupon * @return */ @GetMapping("/queryByPageAndStoreId") - public ResponseObject selectAllByPageAndStoreId(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo, - @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, @Param("cardCoupon") CardCoupon cardCoupon) { + public ResponseObject selectAllByPageAndStoreId(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, @Param("cardCoupon") CardCoupon cardCoupon) { Page page = new Page(pageNo, pageSize); return getSuccessResult(this.cardCouponService.selectAllByPageAndStoreId(page, cardCoupon)); } + + @GetMapping("getCouponOne") + public ResponseObject getCouponOne(Integer id) { + return getSuccessResult(cardCouponService.getCouponOne(id)); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCoupon.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCoupon.java index 33da5ad28..ed0e556f1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCoupon.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCoupon.java @@ -13,6 +13,7 @@ import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; +import java.util.List; /** * 油站优惠卷表2024(CardCoupon)表实体类 @@ -138,6 +139,10 @@ public class CardCoupon extends Model { //当次获取数量 @TableField(exist = false) private Integer giftCardTotal; + @TableField(exist = false) + private List productIdList; + @TableField(exist = false) + private List hxList; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponMapper.java index ea5f2d758..ccd848be7 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponMapper.java @@ -21,5 +21,13 @@ public interface CardCouponMapper extends BaseMapper { IPage pageVo(Page page, @Param("cardCoupon") CardCoupon cardCoupon); IPage selectAllByPageAndStoreId(Page page, @Param("cardCoupon")CardCoupon cardCoupon); + IPage selectAllByPageAndIds(Page page,@Param("ids") List ids); + + /** + * 根据店铺id查询优惠券今日领取数量 + * @param cardCouponUniVos + * @return + */ + List selectByStoreIdCount(CardCouponUniVo cardCouponUniVos); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponUserMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponUserMapper.java index d2a92c445..7b6657980 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponUserMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponUserMapper.java @@ -4,6 +4,7 @@ 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.marketingActivity.cardCoupon.entity.CardCouponUser; +import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUniVo; import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUserVo; import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponVO; import org.apache.ibatis.annotations.Mapper; @@ -11,6 +12,7 @@ import org.apache.ibatis.annotations.Param; import java.util.Date; import java.util.List; +import java.util.Map; /** * 用户优惠卷表2024(CardCouponUser)表数据库访问层 @@ -38,5 +40,7 @@ public interface CardCouponUserMapper extends BaseMapper { * @return */ IPage queryPage(Page page,@Param("entity") CardCouponUserVo cardCouponUserVo); + + List selectCouponCount(@Param("storeId") Integer storeId,@Param("userId") Integer userId); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponMapper.xml index d1e0241ef..7455a26a1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponMapper.xml @@ -31,7 +31,7 @@ resultType="com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUniVo"> SELECT cc.*, - mt.NAME AS typeName, + mt.NAME AS storeName, CASE cc.type WHEN 1 THEN @@ -44,7 +44,7 @@ '油品立减券' WHEN 5 THEN '单品代金券' - END AS statusName + END AS typeName FROM card_coupon cc LEFT JOIN mt_store mt ON mt.id = cc.store_id @@ -66,5 +66,46 @@ + + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponUserMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponUserMapper.xml index d3ee783ef..c0d6a60b9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponUserMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponUserMapper.xml @@ -29,4 +29,12 @@ + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/CardCouponService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/CardCouponService.java index 81631d374..2e0863019 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/CardCouponService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/CardCouponService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; +import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUniVo; /** * 油站优惠卷表2024(CardCoupon)表服务接口 @@ -22,5 +23,12 @@ public interface CardCouponService extends IService { int isOnLine(Integer id); IPage selectAllByPageAndStoreId(Page page, CardCoupon cardCoupon); + + /** + * 卡券详情(小程序) + * @param id + * @return + */ + CardCouponUniVo getCouponOne(Integer id); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/impl/CardCouponServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/impl/CardCouponServiceImpl.java index 6dd229a56..da1ffb7ef 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/impl/CardCouponServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/impl/CardCouponServiceImpl.java @@ -1,16 +1,23 @@ package com.fuint.business.marketingActivity.cardCoupon.service.impl; import cn.hutool.core.bean.BeanUtil; +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 cn.hutool.core.util.StrUtil; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponMapper; +import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponUserMapper; import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponService; import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUniVo; import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponVO; +import com.fuint.business.petrolStationManagement.entity.OilName; +import com.fuint.business.petrolStationManagement.mapper.OilNameMapper; import com.fuint.business.store.entity.MtStore; import com.fuint.business.store.mapper.MtStoreMapper; import com.fuint.common.dto.AccountInfo; @@ -19,7 +26,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * 油站优惠卷表2024(CardCoupon)表服务实现类 @@ -32,6 +42,12 @@ public class CardCouponServiceImpl extends ServiceImpl pageVo(Page page, CardCoupon cardCoupon) { return baseMapper.pageVo( page, cardCoupon); @@ -49,24 +65,87 @@ public class CardCouponServiceImpl extends ServiceImpl cardCouponUniVos = baseMapper.selectAllByPageAndStoreId(page, cardCoupon); - List cardCouponVos = new ArrayList<>(); + //用户拥有的优惠券以及数量 + List list= cardCouponUserMapper.selectCouponCount(cardCoupon.getStoreId(), nowAccountInfo.getId()); + Map map = list.stream().collect(Collectors.toMap(CardCouponUniVo::getId, CardCouponUniVo::getCount)); + + CardCouponUniVo cardCouponUniVo1 = new CardCouponUniVo(); + cardCouponUniVo1.setStoreId(cardCoupon.getStoreId()); + cardCouponUniVo1.setStartTime(startTime.toString()); + cardCouponUniVo1.setEndTime(endTime.toString()); + //根据店铺id查询优惠券今日领取数量 + List cardCouponUniVos1 = baseMapper.selectByStoreIdCount(cardCouponUniVo1); + Map cardCouponMap = cardCouponUniVos1.stream().collect(Collectors.toMap(CardCouponUniVo::getId, CardCouponUniVo::getCount)); + + + //存放最终可领取的优惠券id集合 + List ids = new ArrayList<>(); //循环店铺优惠券 for (CardCouponUniVo coupon : cardCouponUniVos.getRecords()) { //查询该优惠券是否已到达限制数量 - if (coupon.getTfGetNum() < coupon.getTfTotal()){ - CardCouponUniVo cardCouponUniVo = BeanUtil.copyProperties(coupon, CardCouponUniVo.class); - //计算领取的比例 - double scale = (coupon.getTfGetNum() * 1.0 / coupon.getTfTotal()) * 100; - cardCouponUniVo.setScale(scale + "%"); + if ((coupon.getTfGetNum() < coupon.getTfTotal())) { + Integer count = 0; + if (ObjectUtil.isNotEmpty(cardCouponMap.get(coupon.getId()))){ + count = cardCouponMap.get(coupon.getId()); + } + if (count < coupon.getDayGetLimit()) { + Integer getNumLimit = coupon.getGetNumLimit(); + Integer userCount = 0; + if (ObjectUtil.isNotEmpty(map.get(coupon.getId()))){ + userCount = map.get(coupon.getId()); + } + if (userCount < getNumLimit) { + //查询当前用户所拥有的优惠券数量 + ids.add(coupon.getId()); + } + } } } - return cardCouponUniVos; + IPage cardCouponUniVoIPage = new Page<>(page.getCurrent(), page.getSize()); + if (CollUtil.isNotEmpty(ids)) { + cardCouponUniVoIPage = baseMapper.selectAllByPageAndIds(page, ids); + cardCouponUniVoIPage.getRecords().stream().forEach(coupon -> extracted(coupon)); + } + return cardCouponUniVoIPage; + } + + /** + * 卡券详情(小程序) + * + * @param id + * @return + */ + @Override + public CardCouponUniVo getCouponOne(Integer id) { + CardCoupon cardCoupon = baseMapper.selectById(id); + CardCouponUniVo cardCouponUniVo = BeanUtil.copyProperties(cardCoupon, CardCouponUniVo.class); + String oilNumber = cardCouponUniVo.getOilNumber(); + //以逗号隔开 + if (StrUtil.isNotEmpty(oilNumber)) { + String[] split = oilNumber.split(","); + List list = Arrays.asList(split); + //转成integer集合 + List ids = list.stream().map(Integer::parseInt).collect(Collectors.toList()); + List oilNames = oilNameMapper.selectList(new LambdaQueryWrapper() + .in(OilName::getId, ids)); + } + return null; + } + + private static void extracted(CardCouponUniVo coupon) { + //计算领取的比例 + double scale = (coupon.getTfGetNum() * 1.0 / coupon.getTfTotal()) * 100; + coupon.setScale(scale + "%"); } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/vo/CardCouponUniVo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/vo/CardCouponUniVo.java index c4a75b6ed..26c0fa75a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/vo/CardCouponUniVo.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/vo/CardCouponUniVo.java @@ -1,5 +1,7 @@ package com.fuint.business.marketingActivity.cardCoupon.vo; +import cn.hutool.core.date.DateTime; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; import lombok.Data; @@ -11,4 +13,12 @@ public class CardCouponUniVo extends CardCoupon { private String scale; //兑换券类型 private String typeName; + + private Integer count; + + @JsonIgnore + private String startTime; + + @JsonIgnore + private String endTime; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilNameService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilNameService.java index c5ecbd148..0cd90750a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilNameService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilNameService.java @@ -32,6 +32,13 @@ public interface OilNameService extends IService { */ public OilName selectOilNameById(int id); + /** + * 根据ids查询油号信息 + * @param ids + * @return + */ + public List selectOilNameList(List ids); + /** * 根据油品名称查询油号信息 * @param oilName diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilNameServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilNameServiceImpl.java index e10a7aab2..42e33a4f5 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilNameServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilNameServiceImpl.java @@ -2,6 +2,7 @@ package com.fuint.business.petrolStationManagement.service.impl; +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; @@ -45,6 +46,19 @@ public class OilNameServiceImpl extends ServiceImpl impl return oilName; } + /** + * 根据ids查询油号信息 + * + * @param ids + * @return + */ + @Override + public List selectOilNameList(List ids) { + List oilNames = baseMapper.selectList(new LambdaQueryWrapper() + .in(OilName::getId, ids)); + return oilNames; + } + @Override public OilName selectOilNameByOilName(String oilName) { QueryWrapper queryWrapper = new QueryWrapper<>(); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/controller/LJStoreController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/controller/LJStoreController.java index b3eeccadd..d9f7775c7 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/controller/LJStoreController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/controller/LJStoreController.java @@ -135,6 +135,16 @@ public class LJStoreController extends BaseController { return getSuccessResult(storeService.selectListDepts(page,storeVo)); } + /** + * 根据店铺id查询连锁店下面所有商铺信息(小程序) + * @param chainStoreId + * @return + */ + @GetMapping("selectByStoreId") + public ResponseObject selectByStoreId(Integer chainStoreId){ + return getSuccessResult(storeService.selectByStoreId(chainStoreId)); + } + // /** // * 修改等级规则信息 // * @param map diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/ILJStoreService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/ILJStoreService.java index 243d3fe8c..af70f5d46 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/ILJStoreService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/ILJStoreService.java @@ -6,6 +6,7 @@ import com.fuint.business.storeInformation.entity.LJStore; import com.fuint.business.storeInformation.vo.LjStoreVo; import io.swagger.models.auth.In; import org.apache.ibatis.annotations.Param; +import org.springframework.web.bind.annotation.GetMapping; import java.util.List; import java.util.Map; @@ -92,4 +93,11 @@ public interface ILJStoreService extends IService { * @return */ IPage selectListDepts(IPage page, LjStoreVo storeVo); + + /** + * 根据店铺id查询连锁店下面所有商铺 + * @param chainStoreId + * @return + */ + List selectByStoreId(Integer chainStoreId); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/impl/LJStoreServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/impl/LJStoreServiceImpl.java index fc6f87221..e57d41be0 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/impl/LJStoreServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/impl/LJStoreServiceImpl.java @@ -1,6 +1,7 @@ package com.fuint.business.storeInformation.service.impl; import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -376,4 +377,17 @@ public class LJStoreServiceImpl extends ServiceImpl impl } return ljStoreVoIPage; } + + /** + * 根据店铺id查询连锁店下面所有商铺 + * + * @param chainStoreId + * @return + */ + @Override + public List selectByStoreId(Integer chainStoreId) { + List ljStores = baseMapper.selectList(new LambdaQueryWrapper() + .eq(LJStore::getChainStoreId, chainStoreId)); + return ljStores; + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/pay/service/impl/PayCenterServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/pay/service/impl/PayCenterServiceImpl.java index f68d40643..4342f7993 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/pay/service/impl/PayCenterServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/pay/service/impl/PayCenterServiceImpl.java @@ -68,6 +68,8 @@ public class PayCenterServiceImpl implements PayCenterService { **/ @Override public Object getActivity(Map map) { + //实际会收钱的支付方式 + List canUsePayWays = Arrays.asList("ALIPAY","WECHAT","UNIONPAY","CASH"); /*1.先把所有用到的值取出来 */ //当前时间,从点击结算的这一刻算 Date nowDate = new Date(); @@ -103,6 +105,10 @@ public class PayCenterServiceImpl implements PayCenterService { String payWay = map.get("payWay"); /*2.查询所有可参加的营销活动 */ List actList = new ArrayList<>(); + if(!canUsePayWays.contains(payWay)){ + //所选支付方式不符合活动参与条件 + return actList; + } try { //2.1 查可参加的分时优惠和限时特价 actList.addAll(this.getFenshiAndTejiaAct(nowDate,userId,gradeId,storeId,labelIdList,oilAmount,oilLiter,oilId,oilPrice,payWay)); @@ -351,6 +357,8 @@ public class PayCenterServiceImpl implements PayCenterService { **/ @Override public Object getCoupon(Map map){ + //实际会收钱的支付方式 + List canUsePayWays = Arrays.asList("ALIPAY","WECHAT","UNIONPAY","CASH"); /*1.先把所有用到的值取出来 */ //当前时间,从点击结算的这一刻算 Date nowDate = new Date(); @@ -364,6 +372,12 @@ public class PayCenterServiceImpl implements PayCenterService { Double oilAmount = Double.valueOf(map.getOrDefault("oilAmount","0")); //油升数 Double oilLiter = Double.valueOf(map.getOrDefault("oilLiter","0")); + //支付方式 + String payWay = map.get("payWay"); + if("after_pay".equals(payWay)){ + //挂账,不可以用优惠券 + return new ArrayList<>(); + } //选择的商品 List goodsList = new ArrayList<>(); String goodsStr = map.getOrDefault("goods",""); @@ -401,6 +415,10 @@ public class PayCenterServiceImpl implements PayCenterService { List rtnList = new ArrayList<>(); if(!filteredList.isEmpty()){ for(CardCouponVO rule:filteredList){ + if("0".equals(rule.getUseWithOther()) && !canUsePayWays.contains(payWay)){ + //不可以与其他优惠同时用,且支付方式不是 实际付钱的,跳过 + break; + } CouponVO couponVO = new CouponVO(); couponVO.setId(rule.getDataId()); couponVO.setCouponId(rule.getId()); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/pay/util/CheckUtil.java b/fuintBackend/fuint-application/src/main/java/com/fuint/pay/util/CheckUtil.java index cd0dc80de..e7259cd73 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/pay/util/CheckUtil.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/pay/util/CheckUtil.java @@ -164,11 +164,11 @@ public class CheckUtil { nowWeek =7; } if(timeSlotList.contains(nowWeek)){ - //周几是符合的,返回不可用 - return false; - }else{ - //周几是不符合的,进而判断时间是否符合 + //周几是符合的,再判断时间是否符合 return checkDayTimeReverse(nowDate,startTime,endTime); + }else{ + //周几是不符合的,直接可用 + return true; } }else{ //活动设置的适用时间类型是每月 @@ -337,23 +337,37 @@ public class CheckUtil { * @return java.lang.Boolean **/ public Boolean checkGoodsCoupon(CardCouponVO couponVO, List goodsList){ - if("5".equals(couponVO.getType()) || goodsList.isEmpty()){ + if("5".equals(couponVO.getType())){ //单品立减券 - if(StringUtils.isNotEmpty(couponVO.getProductIds())){ - //限制使用的商品id - List ruleGoodsList = Arrays.asList(couponVO.getProductIds().split(StrUtil.COMMA)); - //过滤出符合条件的本订单的商品 - List filteredList = goodsList.stream().filter(goods->ruleGoodsList.contains(goods.getId())).collect(Collectors.toList()); - //计算符合条件的商品订单总金额 - double orderAmount =0.0; - if(!filteredList.isEmpty()){ - orderAmount = filteredList.stream().mapToDouble(GoodsVO::getAmount).sum(); - } - return orderAmount>=couponVO.getReachAmount(); - }else{ - //未设置可用商品,不符合 + if(goodsList.isEmpty()){ + //没商品,不可用 return false; } + //符合条件的商品 + List filteredList; + if("1".equals(couponVO.getProductLimit())){ + //不限制使用商品 + filteredList = goodsList; + }else if("2".equals(couponVO.getProductLimit())){ + //自定义商品 + if(StringUtils.isNotEmpty(couponVO.getProductIds())) { + List ruleGoodsList = Arrays.asList(couponVO.getProductIds().split(StrUtil.COMMA)); + //过滤出符合条件的本订单的商品 + filteredList = goodsList.stream().filter(goods -> ruleGoodsList.contains(goods.getId())).collect(Collectors.toList()); + }else{ + //未设置可用商品,不符合 + return false; + } + }else{ + //超出预设值范围,不可用 + return false; + } + //计算符合条件的商品订单总金额 + double orderAmount =0.0; + if(!filteredList.isEmpty()){ + orderAmount = filteredList.stream().mapToDouble(GoodsVO::getAmount).sum(); + } + return orderAmount>=couponVO.getReachAmount(); }else{ //其他券或者本订单未选择商品不需要判断商品 return true; @@ -589,8 +603,6 @@ public class CheckUtil { Double disAmount = 0.0; DecimalFormat df = new DecimalFormat("#.00"); try { - //1 按加油金额,否则 按加油升数 - Double thisValue = "1".equals(coupon.getUseType())?oilAmount:oilLiter; if("1".equals(coupon.getType())){ //代金券-直接拿优惠金额 disAmount = coupon.getReduceAmount(); @@ -605,9 +617,12 @@ public class CheckUtil { }else if("4".equals(coupon.getType())){ //油品立减券,每满多少升减多少钱 //计算能除尽多少次,就减多少次 - int thisInt = (int) (thisValue / coupon.getLjOilNum()); + int thisInt = (int) (oilLiter / coupon.getLjOilNum()); //计算优惠金额 disAmount = thisInt * coupon.getLjOilAmount(); + }else if("5".equals(coupon.getType())){ + //单品立减券,直接拿优惠金额 + disAmount = coupon.getReduceAmount(); } }catch (Exception e){ log.error("优惠券优惠金额计算失败:"+e.getMessage(),e); @@ -710,7 +725,7 @@ public class CheckUtil { * @return boolean **/ private static boolean checkDayTimeReverse(Date nowDate,String dayStartTime,String dayEndTime){ - String dayStr = DateUtil.date(nowDate).toString(); + String dayStr = DateUtil.formatDate(nowDate); //时间范围区间 Date startTime = DateUtil.parse(dayStr+" "+(StringUtils.isNotEmpty(dayStartTime)?(dayStartTime+":00"):"00:00:00")); Date endTime = DateUtil.parse(dayStr+" "+(StringUtils.isNotEmpty(dayEndTime)?(dayEndTime+":59"):"23:59:59")); diff --git a/fuintBackend/fuint-application/src/main/resources/application.properties b/fuintBackend/fuint-application/src/main/resources/application.properties index 1fa299b97..1ce626a3f 100644 --- a/fuintBackend/fuint-application/src/main/resources/application.properties +++ b/fuintBackend/fuint-application/src/main/resources/application.properties @@ -1,7 +1,8 @@ # \u57FA\u672C\u914D\u7F6E server.port=8080 env.profile=dev -env.properties.path=D:/my_project/oil-station/fuintBackend/configure/ +#env.properties.path=D:/my_project/oil-station/fuintBackend/configure/ +env.properties.path=D:/Code/yuzhan/oil-station/fuintBackend/configure/ #env.properties.path=F:/work/oilSystem/fuintBackend/configure/ #env.properties.path=D:/oil/new-oil/oilSystem/fuintBackend/configure/ #env.properties.path=D:/work/oilSystem/fuintBackend/configure/ diff --git a/fuintCashierWeb/.env.development b/fuintCashierWeb/.env.development index 41a54452d..89b6b1bdb 100644 --- a/fuintCashierWeb/.env.development +++ b/fuintCashierWeb/.env.development @@ -11,7 +11,7 @@ VUE_APP_BASE_API = '/dev-api' VUE_APP_PUBLIC_PATH = '/' # 后端接口地址 -VUE_APP_SERVER_URL = 'http://127.0.0.1:8080/' +VUE_APP_SERVER_URL = 'http://192.168.31.178:8080/' # http://192.168.0.121:8080/ diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/Order.vue b/fuintCashierWeb/src/views/cashier/NewComponents/Order.vue index 830efb7d8..cfc7330df 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/Order.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/Order.vue @@ -1,28 +1,11 @@