Commit 0f36c37b by 吕明尚

Merge branch 'test'

parents f93ea65e 9831dc4b
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.LotteryRecordsLog;
import share.system.service.LotteryRecordsLogService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 抽奖记录日志Controller
*
* @author wuwenlong
* @date 2024-11-12
*/
@RestController
@RequestMapping("/system/lotteryRecordsLog")
public class LotteryRecordsLogController extends BaseController {
@Autowired
private LotteryRecordsLogService lotteryRecordsLogService;
/**
* 查询抽奖记录日志列表
*/
@PreAuthorize("@ss.hasPermi('system:lotteryRecordsLog:list')")
@GetMapping("/list")
public TableDataInfo list(LotteryRecordsLog lotteryRecordsLog) {
startPage();
List<LotteryRecordsLog> list = lotteryRecordsLogService.selectLotteryRecordsLogList(lotteryRecordsLog);
return getDataTable(list);
}
/**
* 导出抽奖记录日志列表
*/
@PreAuthorize("@ss.hasPermi('system:lotteryRecordsLog:export')")
@Log(title = "抽奖记录日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, LotteryRecordsLog lotteryRecordsLog) {
List<LotteryRecordsLog> list = lotteryRecordsLogService.selectLotteryRecordsLogList(lotteryRecordsLog);
ExcelUtil<LotteryRecordsLog> util = new ExcelUtil<LotteryRecordsLog>(LotteryRecordsLog.class);
util.exportExcel(response, list, "抽奖记录日志数据");
}
/**
* 获取抽奖记录日志详细信息
*/
@PreAuthorize("@ss.hasPermi('system:lotteryRecordsLog:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(lotteryRecordsLogService.selectLotteryRecordsLogById(id));
}
/**
* 新增抽奖记录日志
*/
@PreAuthorize("@ss.hasPermi('system:lotteryRecordsLog:add')")
@Log(title = "抽奖记录日志", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody LotteryRecordsLog lotteryRecordsLog) {
return toAjax(lotteryRecordsLogService.insertLotteryRecordsLog(lotteryRecordsLog));
}
/**
* 修改抽奖记录日志
*/
@PreAuthorize("@ss.hasPermi('system:lotteryRecordsLog:edit')")
@Log(title = "抽奖记录日志", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody LotteryRecordsLog lotteryRecordsLog) {
return toAjax(lotteryRecordsLogService.updateLotteryRecordsLog(lotteryRecordsLog));
}
/**
* 删除抽奖记录日志
*/
@PreAuthorize("@ss.hasPermi('system:lotteryRecordsLog:remove')")
@Log(title = "抽奖记录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(lotteryRecordsLogService.deleteLotteryRecordsLogByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.PointActivitiesConf;
import share.system.domain.vo.PointActivitiesConfVo;
import share.system.service.PointActivitiesConfService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 用户集点活动配置Controller
*
* @author wuwenlong
* @date 2024-11-14
*/
@RestController
@RequestMapping("/system/pointActivitiesConf")
public class PointActivitiesConfController extends BaseController {
@Autowired
private PointActivitiesConfService pointActivitiesConfService;
/**
* 查询用户集点活动配置列表
*/
@PreAuthorize("@ss.hasPermi('system:pointActivitiesConf:list')")
@GetMapping("/list")
public TableDataInfo list(PointActivitiesConfVo pointActivitiesConf) {
startPage();
List<PointActivitiesConfVo> list = pointActivitiesConfService.selectPointActivitiesConfList(pointActivitiesConf);
return getDataTable(list);
}
/**
* 导出用户集点活动配置列表
*/
@PreAuthorize("@ss.hasPermi('system:pointActivitiesConf:export')")
@Log(title = "用户集点活动配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, PointActivitiesConfVo pointActivitiesConf) {
List<PointActivitiesConfVo> list = pointActivitiesConfService.selectPointActivitiesConfList(pointActivitiesConf);
ExcelUtil<PointActivitiesConfVo> util = new ExcelUtil<PointActivitiesConfVo>(PointActivitiesConfVo.class);
util.exportExcel(response, list, "用户集点活动配置数据");
}
/**
* 获取用户集点活动配置详细信息
*/
@PreAuthorize("@ss.hasPermi('system:pointActivitiesConf:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(pointActivitiesConfService.selectPointActivitiesConfById(id));
}
/**
* 新增用户集点活动配置
*/
@PreAuthorize("@ss.hasPermi('system:pointActivitiesConf:add')")
@Log(title = "用户集点活动配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PointActivitiesConf pointActivitiesConf) {
return toAjax(pointActivitiesConfService.insertPointActivitiesConf(pointActivitiesConf));
}
/**
* 修改用户集点活动配置
*/
@PreAuthorize("@ss.hasPermi('system:pointActivitiesConf:edit')")
@Log(title = "用户集点活动配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PointActivitiesConf pointActivitiesConf) {
return toAjax(pointActivitiesConfService.updatePointActivitiesConf(pointActivitiesConf));
}
/**
* 删除用户集点活动配置
*/
@PreAuthorize("@ss.hasPermi('system:pointActivitiesConf:remove')")
@Log(title = "用户集点活动配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(pointActivitiesConfService.deletePointActivitiesConfByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.PointActivities;
import share.system.domain.vo.PointActivitiesVo;
import share.system.service.PointActivitiesService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 用户集点活动Controller
*
* @author wuwenlong
* @date 2024-11-14
*/
@RestController
@RequestMapping("/system/pointActivities")
public class PointActivitiesController extends BaseController {
@Autowired
private PointActivitiesService pointActivitiesService;
/**
* 查询用户集点活动列表
*/
@PreAuthorize("@ss.hasPermi('system:pointActivities:list')")
@GetMapping("/list")
public TableDataInfo list(PointActivitiesVo pointActivities) {
startPage();
List<PointActivitiesVo> list = pointActivitiesService.selectPointActivitiesList(pointActivities);
return getDataTable(list);
}
/**
* 导出用户集点活动列表
*/
@PreAuthorize("@ss.hasPermi('system:pointActivities:export')")
@Log(title = "用户集点活动", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, PointActivitiesVo pointActivities) {
List<PointActivitiesVo> list = pointActivitiesService.selectPointActivitiesList(pointActivities);
ExcelUtil<PointActivitiesVo> util = new ExcelUtil<PointActivitiesVo>(PointActivitiesVo.class);
util.exportExcel(response, list, "用户集点活动数据");
}
/**
* 获取用户集点活动详细信息
*/
@PreAuthorize("@ss.hasPermi('system:pointActivities:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(pointActivitiesService.selectPointActivitiesById(id));
}
/**
* 新增用户集点活动
*/
@PreAuthorize("@ss.hasPermi('system:pointActivities:add')")
@Log(title = "用户集点活动", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PointActivities pointActivities) {
return toAjax(pointActivitiesService.insertPointActivities(pointActivities));
}
/**
* 修改用户集点活动
*/
@PreAuthorize("@ss.hasPermi('system:pointActivities:edit')")
@Log(title = "用户集点活动", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PointActivities pointActivities) {
return toAjax(pointActivitiesService.updatePointActivities(pointActivities));
}
/**
* 删除用户集点活动
*/
@PreAuthorize("@ss.hasPermi('system:pointActivities:remove')")
@Log(title = "用户集点活动", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(pointActivitiesService.deletePointActivitiesByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.Prize;
import share.system.domain.vo.PrizeVo;
import share.system.service.PrizeService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 奖品Controller
*
* @author wuwenlong
* @date 2024-11-12
*/
@RestController
@RequestMapping("/system/prize")
public class PrizeController extends BaseController {
@Autowired
private PrizeService prizeService;
/**
* 查询奖品列表
*/
@PreAuthorize("@ss.hasPermi('system:prize:list')")
@GetMapping("/list")
public TableDataInfo list(PrizeVo prize) {
startPage();
List<PrizeVo> list = prizeService.selectPrizeList(prize);
return getDataTable(list);
}
/**
* 导出奖品列表
*/
@PreAuthorize("@ss.hasPermi('system:prize:export')")
@Log(title = "奖品", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, PrizeVo prize) {
List<PrizeVo> list = prizeService.selectPrizeList(prize);
ExcelUtil<PrizeVo> util = new ExcelUtil<PrizeVo>(PrizeVo.class);
util.exportExcel(response, list, "奖品数据");
}
/**
* 获取奖品详细信息
*/
@PreAuthorize("@ss.hasPermi('system:prize:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(prizeService.selectPrizeById(id));
}
/**
* 新增奖品
*/
@PreAuthorize("@ss.hasPermi('system:prize:add')")
@Log(title = "奖品", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Prize prize) {
return toAjax(prizeService.insertPrize(prize));
}
/**
* 修改奖品
*/
@PreAuthorize("@ss.hasPermi('system:prize:edit')")
@Log(title = "奖品", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Prize prize) {
return toAjax(prizeService.updatePrize(prize));
}
/**
* 删除奖品
*/
@PreAuthorize("@ss.hasPermi('system:prize:remove')")
@Log(title = "奖品", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(prizeService.deletePrizeByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.domain.R;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.WheelGame;
import share.system.service.WheelGameService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 转盘游戏Controller
*
* @author wuwenlong
* @date 2024-11-12
*/
@RestController
@RequestMapping("/system/wheelGame")
public class WheelGameController extends BaseController {
@Autowired
private WheelGameService wheelGameService;
/**
* 查询转盘游戏列表
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:list')")
@GetMapping("/list")
public TableDataInfo list(WheelGame wheelGame) {
startPage();
List<WheelGame> list = wheelGameService.selectWheelGameList(wheelGame);
return getDataTable(list);
}
@GetMapping("/query")
public R<List<WheelGame>> query(WheelGame wheelGame) {
return R.ok(wheelGameService.selectWheelGameList(wheelGame));
}
/**
* 导出转盘游戏列表
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:export')")
@Log(title = "转盘游戏", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WheelGame wheelGame) {
List<WheelGame> list = wheelGameService.selectWheelGameList(wheelGame);
ExcelUtil<WheelGame> util = new ExcelUtil<WheelGame>(WheelGame.class);
util.exportExcel(response, list, "转盘游戏数据");
}
/**
* 获取转盘游戏详细信息
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(wheelGameService.selectWheelGameById(id));
}
/**
* 新增转盘游戏
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:add')")
@Log(title = "转盘游戏", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WheelGame wheelGame) {
return toAjax(wheelGameService.insertWheelGame(wheelGame));
}
/**
* 修改转盘游戏
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:edit')")
@Log(title = "转盘游戏", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WheelGame wheelGame) {
return toAjax(wheelGameService.updateWheelGame(wheelGame));
}
/**
* 删除转盘游戏
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:remove')")
@Log(title = "转盘游戏", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(wheelGameService.deleteWheelGameByIds(ids));
}
}
package share.common.enums;
public enum PrizeTypeEnum {
//1=优惠券,2商品,3积分,4谢谢参与
COUPON(1, "优惠券"),
GOODS(2, "商品"),
INTEGRAL(3, "积分"),
THANK(4, "谢谢参与");
private Integer index;
private String name;
PrizeTypeEnum() {
}
PrizeTypeEnum(Integer index, String name) {
this.index = index;
this.name = name;
}
public Integer getIndex() {
return index;
}
public void setIndex(Integer index) {
this.index = index;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.core.controller.BaseController;
import share.common.core.page.TableDataInfo;
import share.system.domain.LotteryRecordsLog;
import share.system.service.LotteryRecordsLogService;
import java.util.List;
/**
* 抽奖记录日志Controller
*
* @author wuwenlong
* @date 2024-11-12
*/
@RestController
@RequestMapping("/lotteryRecordsLog")
public class LotteryRecordsLogController extends BaseController {
@Autowired
private LotteryRecordsLogService lotteryRecordsLogService;
/**
* 查询抽奖记录日志列表
*/
@GetMapping("/list")
public TableDataInfo list(LotteryRecordsLog lotteryRecordsLog) {
startPage();
List<LotteryRecordsLog> list = lotteryRecordsLogService.selectLotteryRecordsLogList(lotteryRecordsLog);
return getDataTable(list);
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.WheelGame;
import share.system.service.WheelGameService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 转盘游戏Controller
*
* @author wuwenlong
* @date 2024-11-12
*/
@RestController
@RequestMapping("/wheelGame")
public class WheelGameController extends BaseController {
@Autowired
private WheelGameService wheelGameService;
/**
* 查询转盘游戏列表
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:list')")
@GetMapping("/list")
public TableDataInfo list(WheelGame wheelGame) {
startPage();
List<WheelGame> list = wheelGameService.selectWheelGameList(wheelGame);
return getDataTable(list);
}
/**
* 导出转盘游戏列表
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:export')")
@Log(title = "转盘游戏", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WheelGame wheelGame) {
List<WheelGame> list = wheelGameService.selectWheelGameList(wheelGame);
ExcelUtil<WheelGame> util = new ExcelUtil<WheelGame>(WheelGame.class);
util.exportExcel(response, list, "转盘游戏数据");
}
/**
* 获取转盘游戏详细信息
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(wheelGameService.selectWheelGameById(id));
}
/**
* 新增转盘游戏
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:add')")
@Log(title = "转盘游戏", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WheelGame wheelGame) {
return toAjax(wheelGameService.insertWheelGame(wheelGame));
}
/**
* 修改转盘游戏
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:edit')")
@Log(title = "转盘游戏", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WheelGame wheelGame) {
return toAjax(wheelGameService.updateWheelGame(wheelGame));
}
/**
* 删除转盘游戏
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:remove')")
@Log(title = "转盘游戏", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(wheelGameService.deleteWheelGameByIds(ids));
}
}
...@@ -275,7 +275,8 @@ public class RedisTask { ...@@ -275,7 +275,8 @@ public class RedisTask {
add(OrderStatusEnum.INUSE.getCode()); add(OrderStatusEnum.INUSE.getCode());
}}); }});
List<SOrder> sOrders = isOrderService.list(queryWrapper); List<SOrder> sOrders = isOrderService.list(queryWrapper);
keys.stream().forEach(o -> { for (String o : keys) {
try {
//获取key对应的value //获取key对应的value
String value = redisUtil.get(String.valueOf(o)); String value = redisUtil.get(String.valueOf(o));
JSONObject jsonObject = new JSONObject(value); JSONObject jsonObject = new JSONObject(value);
...@@ -299,12 +300,12 @@ public class RedisTask { ...@@ -299,12 +300,12 @@ public class RedisTask {
DateUtil.format(DateUtil.offsetMinute(new Date(), 1), DatePattern.NORM_DATETIME_PATTERN), "1", DateUtil.format(DateUtil.offsetMinute(new Date(), 1), DatePattern.NORM_DATETIME_PATTERN), "1",
DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode()); DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
logger.debug("订单号为:" + sOrder.getOrderNo() + "的订单距离结束时间还有15分钟"); logger.debug("订单号为:" + sOrder.getOrderNo() + "的订单距离结束时间还有15分钟");
// 从门店集合中判断门店id相同的门店对象 // 从门店集合中判断门店id相同的门店对象
SOrder finalSOrder = sOrder; SOrder finalSOrder = sOrder;
SStore sStore = sStoreList.stream().filter(item -> item.getId().equals(finalSOrder.getStoreId())).findFirst().orElse(null); SStore sStore = sStoreList.stream().filter(item -> item.getId().equals(finalSOrder.getStoreId())).findFirst().orElse(null);
// 从房间集合中判断房间id相同的房间对象 // 从房间集合中判断房间id相同的房间对象
SRoom sRoom = sRoomList.stream().filter(item -> item.getId().equals(finalSOrder.getRoomId())).findFirst().orElse(null); SRoom sRoom = sRoomList.stream().filter(item -> item.getId().equals(finalSOrder.getRoomId())).findFirst().orElse(null);
// 通知用户 // 通知用户
smsService.sendSmsOrderEndRemind(sOrder.getConsumerPhone(), sStore, sRoom); smsService.sendSmsOrderEndRemind(sOrder.getConsumerPhone(), sStore, sRoom);
//推送订单结束消息 //推送订单结束消息
wechatNewService.sendMiniSubscribeMessage(sOrder, MessageReminderEnum.END); wechatNewService.sendMiniSubscribeMessage(sOrder, MessageReminderEnum.END);
...@@ -344,6 +345,7 @@ public class RedisTask { ...@@ -344,6 +345,7 @@ public class RedisTask {
if (extracted(o, sOrders, sOrder)) return; if (extracted(o, sOrders, sOrder)) return;
//更改订单状态 //更改订单状态
sOrder.setStatus(OrderStatusEnum.USED.getCode()); sOrder.setStatus(OrderStatusEnum.USED.getCode());
addNewConsumer(sOrder);
isOrderService.updateById(sOrder); isOrderService.updateById(sOrder);
// 修改房间状态 // 修改房间状态
SRoom room = roomService.getById(sOrder.getRoomId()); SRoom room = roomService.getById(sOrder.getRoomId());
...@@ -375,7 +377,10 @@ public class RedisTask { ...@@ -375,7 +377,10 @@ public class RedisTask {
redisUtil.set(ReceiptRdeisEnum.ROOM_EXPIRE_TIME.getValue() + sOrder.getOrderNo(), json.toString()); redisUtil.set(ReceiptRdeisEnum.ROOM_EXPIRE_TIME.getValue() + sOrder.getOrderNo(), json.toString());
logger.debug("订单号为:" + sOrder.getOrderNo() + "的订单已结束,更改订单状态为已使用"); logger.debug("订单号为:" + sOrder.getOrderNo() + "的订单已结束,更改订单状态为已使用");
} }
}); } catch (BaseException e) {
continue;
}
}
logger.debug("AutoAddSCleanRecords:自动添加保洁记录结束"); logger.debug("AutoAddSCleanRecords:自动添加保洁记录结束");
} }
@XxlJob("autoRoomExpireTime") @XxlJob("autoRoomExpireTime")
...@@ -852,4 +857,37 @@ public class RedisTask { ...@@ -852,4 +857,37 @@ public class RedisTask {
logger.debug("AutomaticallySecondaryCard:自动结束次卡结束"); logger.debug("AutomaticallySecondaryCard:自动结束次卡结束");
} }
private void addNewConsumer(SOrder sorder) {
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, sorder.getConsumerId()));
//新增用户为普通会员
if (ObjectUtil.isEmpty(consumerWallet)) {
ConsumerWallet wallet = new ConsumerWallet();
wallet.setConsumerId(sorder.getConsumerId());
wallet.setBalance(BigDecimal.ZERO);
wallet.setRechargeAmount(BigDecimal.ZERO);
wallet.setGiftAmount(BigDecimal.ZERO);
wallet.setRemainingDuration(BigDecimal.ZERO);
wallet.setRemainingIntegral(sorder.getPayPrice());
wallet.setEquityFund(BigDecimal.ZERO);
wallet.setAccumulateEquityFund(BigDecimal.ZERO);
wallet.setCreateTime(new Date());
consumerWalletService.save(wallet);
}
ConsumerMember one = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, sorder.getConsumerId()));
if (ObjectUtil.isEmpty(one)) {
ConsumerMember consumerMember = new ConsumerMember();
consumerMember.setConsumerId(sorder.getConsumerId());
consumerMember.setMembershipLevel(0L);
String rechargeMembershipExpirationTime = sysConfigService.selectConfigByKey("rechargeMembershipExpirationTime");
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), Integer.parseInt(rechargeMembershipExpirationTime)));
consumerMember.setMembershipProgress(BigDecimal.ZERO);
consumerMember.setIsRecharge(YesNoEnum.no.getIndex());
consumerMember.setIsRights(YesNoEnum.no.getIndex());
consumerMember.setCreateTime(new Date());
consumerMemberService.save(consumerMember);
}
}
} }
package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import java.util.Date;
/**
* 抽奖记录日志对象 s_lottery_records_log
*
* @author wuwenlong
* @date 2024-11-12
*/
@Data
@TableName("s_lottery_records_log")
public class LotteryRecordsLog extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 游戏id
*/
@Excel(name = "游戏id")
private Long gameId;
/**
* 用户id
*/
@Excel(name = "用户id")
private Long userId;
/**
* 用户名
*/
@Excel(name = "用户名")
private String userName;
/**
* 手机号
*/
@Excel(name = "手机号")
private String phone;
/**
* 抽奖时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "抽奖时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date drawTime;
/**
* 是否中奖 0:未中奖 1:中奖
*/
@Excel(name = "是否中奖 0:未中奖 1:中奖")
private Long isHit;
/**
* 中奖奖品
*/
@Excel(name = "中奖奖品")
private String hitPrize;
/**
* 是否发放 1未发放,2 已发放 3 发放失败
*/
@Excel(name = " 是否发放 1未发放,2 已发放 3 发放失败")
private Long isSend;
/**
* 发放结果
*/
@Excel(name = "发放结果")
private String sendMsg;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("gameId", getGameId())
.append("userId", getUserId())
.append("userName", getUserName())
.append("phone", getPhone())
.append("drawTime", getDrawTime())
.append("isHit", getIsHit())
.append("hitPrize", getHitPrize())
.append("isSend", getIsSend())
.append("sendMsg", getSendMsg())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import java.util.Date;
/**
* 用户集点活动对象 s_point_activities
*
* @author wuwenlong
* @date 2024-11-14
*/
@Data
@TableName("s_point_activities")
public class PointActivities extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 用户ID
*/
// @Excel(name = "用户ID")
private Long consumerId;
/**
* 配置ID
*/
// @Excel(name = "配置ID")
private Long confId;
/**
* 优惠券Id
*/
// @Excel(name = "优惠券Id")
private Long couponId;
/**
* 已累计点数
*/
@Excel(name = "已累计点数")
private Integer points;
/**
* 上次消费时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "上次消费时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date lastConsumptionTime;
/**
* 是否可领取
*/
@Excel(name = "是否可领取")
private Integer isReceive;
/**
* 是否已领取优惠券
*/
@Excel(name = "是否已领取优惠券")
private Integer couponReceived;
/**
* 优惠券领取日期
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "优惠券领取日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date receivedDate;
/**
* 优惠券过期日期
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "优惠券过期日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date couponExpirationDate;
/**
* 是否删除(0:否,1:是)
*/
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField(select = false)
private Long isDelete;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("consumerId", getConsumerId())
.append("confId", getConfId())
.append("points", getPoints())
.append("lastConsumptionTime", getLastConsumptionTime())
.append("isReceive", getIsReceive())
.append("couponReceived", getCouponReceived())
.append("receivedDate", getReceivedDate())
.append("couponExpirationDate", getCouponExpirationDate())
.append("isDelete", getIsDelete())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
/**
* 用户集点活动配置对象 s_point_activities_conf
*
* @author wuwenlong
* @date 2024-11-14
*/
@Data
@TableName("s_point_activities_conf")
public class PointActivitiesConf extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 配置名称
*/
@Excel(name = "配置名称")
private String name;
/**
* 集点所需的消费次数
*/
@Excel(name = "集点所需的消费次数")
private Integer pointsRequired;
/**
* 每次消费的时间间隔(小时)
*/
@Excel(name = "每次消费的时间间隔(小时)")
private Integer timeInterval;
/**
* 优惠券Id
*/
@Excel(name = "优惠券Id")
private Long couponId;
/**
* 优惠券的领取期限 (天)
*/
@Excel(name = "优惠券的领取期限 (天)")
private Integer collectionDeadline;
/**
* 优惠券的使用期限 (天)
*/
@Excel(name = "优惠券的使用期限 (天)")
private Integer couponDuration;
/**
* 集点活动的重置周期 (月)
*/
@Excel(name = "集点活动的重置周期 (月)")
private Integer collectionResetPeriod;
/**
* 是否开启
*/
@Excel(name = "是否开启")
private Long isOpen;
/**
* 是否删除(0:否,1:是)
*/
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField(select = false)
private Long isDelete;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("pointsRequired", getPointsRequired())
.append("timeInterval", getTimeInterval())
.append("couponId", getCouponId())
.append("collectionDeadline", getCollectionDeadline())
.append("couponDuration", getCouponDuration())
.append("collectionResetPeriod", getCollectionResetPeriod())
.append("isOpen", getIsOpen())
.append("isDelete", getIsDelete())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import java.math.BigDecimal;
/**
* 奖品对象 s_prize
*
* @author wuwenlong
* @date 2024-11-12
*/
@Data
@TableName("s_prize")
public class Prize extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 游戏id
*/
@Excel(name = "游戏id")
private Long gameId;
/**
* 优惠券ID
*/
@Excel(name = "优惠券ID")
private Long couponId;
/**
* 奖品类型(1优惠券,2商品,3积分,4谢谢参与)
*/
@Excel(name = "奖品类型", readConverterExp = "1=优惠券,2商品,3积分,4谢谢参与")
private Integer prizeType;
/**
* 奖品名字
*/
@Excel(name = "奖品名字")
private String prizeName;
/**
* 奖品值(数量)
*/
@Excel(name = "奖品值", readConverterExp = "数=量")
private Integer prizeValue;
/**
* 当前命中
*/
@Excel(name = "当前命中")
private Integer currentNum;
/**
* 最大中奖数 0:代表不限制
*/
@Excel(name = "最大中奖数 0:代表不限制")
private Integer maxNum;
/**
* 中奖几率
*/
@Excel(name = "中奖几率")
private BigDecimal ratio;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("gameId", getGameId())
.append("prizeType", getPrizeType())
.append("prizeName", getPrizeName())
.append("prizeValue", getPrizeValue())
.append("currentNum", getCurrentNum())
.append("maxNum", getMaxNum())
.append("ratio", getRatio())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import java.util.Date;
/**
* 转盘游戏对象 s_wheel_game
*
* @author wuwenlong
* @date 2024-11-12
*/
@Data
@TableName("s_wheel_game")
public class WheelGame extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 活动名称
*/
@Excel(name = "活动名称")
private String name;
/**
* 开始时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/**
* 结束时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
/**
* 描述
*/
@Excel(name = "描述")
private String description;
/**
* 单人当天限制次数 0:代表不限制
*/
@Excel(name = "单人当天限制次数 0:代表不限制")
private Long dayLimit;
/**
* 单人总次数限制 0:代表不限制
*/
@Excel(name = "单人总次数限制 0:代表不限制")
private Long singleLimit;
/**
* 是否开启1 开启 0 关闭
*/
@Excel(name = "是否开启1 开启 0 关闭")
private Long isOpen;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.append("description", getDescription())
.append("dayLimit", getDayLimit())
.append("singleLimit", getSingleLimit())
.append("isOpen", getIsOpen())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
...@@ -2,6 +2,7 @@ package share.system.domain; ...@@ -2,6 +2,7 @@ package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
...@@ -18,6 +19,7 @@ import java.util.Date; ...@@ -18,6 +19,7 @@ import java.util.Date;
* @date 2024-08-28 * @date 2024-08-28
*/ */
@Data @Data
@TableName("s_withdraw_log")
public class WithdrawLog extends BaseEntity public class WithdrawLog extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
package share.system.domain.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
@Data
public class PointActivitiesConfVo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 配置名称
*/
@Excel(name = "配置名称")
private String name;
/**
* 集点所需的消费次数
*/
@Excel(name = "集点所需的消费次数")
private Long pointsRequired;
/**
* 每次消费的时间间隔(小时)
*/
@Excel(name = "每次消费的时间间隔(小时)")
private Long timeInterval;
/**
* 优惠券Id
*/
// @Excel(name = "优惠券Id")
private Long couponId;
//优惠券名称
@Excel(name = "优惠券名称")
private String couponName;
/**
* 优惠券的领取期限 (天)
*/
@Excel(name = "优惠券的领取期限 (天)")
private Long collectionDeadline;
/**
* 优惠券的使用期限 (天)
*/
@Excel(name = "优惠券的使用期限 (天)")
private Long couponDuration;
/**
* 集点活动的重置周期 (月)
*/
@Excel(name = "集点活动的重置周期 (月)")
private Long collectionResetPeriod;
/**
* 是否开启
*/
@Excel(name = "是否开启", dictType = "store_is_use_coupon")
private Long isOpen;
/**
* 是否删除(0:否,1:是)
*/
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField(select = false)
private Long isDelete;
}
package share.system.domain.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import java.util.Date;
@Data
public class PointActivitiesVo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 用户ID
*/
// @Excel(name = "用户ID")
private Long consumerId;
/**
* 配置ID
*/
// @Excel(name = "配置ID")
private Long confId;
/**
* 优惠券Id
*/
// @Excel(name = "优惠券Id")
private Long couponId;
//用户昵称
@Excel(name = "用户昵称")
private String nickName;
//用户头像
private String avatar;
//手机号
@Excel(name = "手机号")
private String phone;
//配置名称
@Excel(name = "配置名称")
private String confName;
//优惠券名称
@Excel(name = "优惠券名称")
private String couponName;
@Excel(name = "已累计点数")
private Long points;
/**
* 上次消费时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "上次消费时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date lastConsumptionTime;
/**
* 是否可领取
*/
@Excel(name = "是否可领取", dictType = "store_is_use_coupon")
private Long isReceive;
/**
* 是否已领取优惠券
*/
@Excel(name = "是否已领取", dictType = "store_is_use_coupon")
private Long couponReceived;
/**
* 优惠券领取日期
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "优惠券领取日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date receivedDate;
/**
* 优惠券过期日期
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "优惠券过期日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date couponExpirationDate;
/**
* 是否删除(0:否,1:是)
*/
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField(select = false)
private Long isDelete;
}
package share.system.domain.vo;
import lombok.Data;
import share.system.domain.Prize;
@Data
public class PrizeVo extends Prize {
private String gameName;
private String couponName;
}
package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.LotteryRecordsLog;
import java.util.List;
/**
* 抽奖记录日志Mapper接口
*
* @author wuwenlong
* @date 2024-11-12
*/
public interface LotteryRecordsLogMapper extends BaseMapper<LotteryRecordsLog> {
/**
* 查询抽奖记录日志
*
* @param id 抽奖记录日志主键
* @return 抽奖记录日志
*/
public LotteryRecordsLog selectLotteryRecordsLogById(Long id);
/**
* 查询抽奖记录日志列表
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 抽奖记录日志集合
*/
public List<LotteryRecordsLog> selectLotteryRecordsLogList(LotteryRecordsLog lotteryRecordsLog);
/**
* 新增抽奖记录日志
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 结果
*/
public int insertLotteryRecordsLog(LotteryRecordsLog lotteryRecordsLog);
/**
* 修改抽奖记录日志
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 结果
*/
public int updateLotteryRecordsLog(LotteryRecordsLog lotteryRecordsLog);
/**
* 删除抽奖记录日志
*
* @param id 抽奖记录日志主键
* @return 结果
*/
public int deleteLotteryRecordsLogById(Long id);
/**
* 批量删除抽奖记录日志
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteLotteryRecordsLogByIds(Long[] ids);
}
package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.PointActivitiesConf;
import share.system.domain.vo.PointActivitiesConfVo;
import java.util.List;
/**
* 用户集点活动配置Mapper接口
*
* @author wuwenlong
* @date 2024-11-14
*/
public interface PointActivitiesConfMapper extends BaseMapper<PointActivitiesConf> {
/**
* 查询用户集点活动配置
*
* @param id 用户集点活动配置主键
* @return 用户集点活动配置
*/
public PointActivitiesConf selectPointActivitiesConfById(Long id);
/**
* 查询用户集点活动配置列表
*
* @param pointActivitiesConf 用户集点活动配置
* @return 用户集点活动配置集合
*/
public List<PointActivitiesConfVo> selectPointActivitiesConfList(PointActivitiesConfVo pointActivitiesConf);
/**
* 新增用户集点活动配置
*
* @param pointActivitiesConf 用户集点活动配置
* @return 结果
*/
public int insertPointActivitiesConf(PointActivitiesConf pointActivitiesConf);
/**
* 修改用户集点活动配置
*
* @param pointActivitiesConf 用户集点活动配置
* @return 结果
*/
public int updatePointActivitiesConf(PointActivitiesConf pointActivitiesConf);
/**
* 删除用户集点活动配置
*
* @param id 用户集点活动配置主键
* @return 结果
*/
public int deletePointActivitiesConfById(Long id);
/**
* 批量删除用户集点活动配置
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePointActivitiesConfByIds(Long[] ids);
}
package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.PointActivities;
import share.system.domain.vo.PointActivitiesVo;
import java.util.List;
/**
* 用户集点活动Mapper接口
*
* @author wuwenlong
* @date 2024-11-14
*/
public interface PointActivitiesMapper extends BaseMapper<PointActivities> {
/**
* 查询用户集点活动
*
* @param id 用户集点活动主键
* @return 用户集点活动
*/
public PointActivities selectPointActivitiesById(Long id);
/**
* 查询用户集点活动列表
*
* @param pointActivities 用户集点活动
* @return 用户集点活动集合
*/
public List<PointActivitiesVo> selectPointActivitiesList(PointActivitiesVo pointActivities);
/**
* 新增用户集点活动
*
* @param pointActivities 用户集点活动
* @return 结果
*/
public int insertPointActivities(PointActivities pointActivities);
/**
* 修改用户集点活动
*
* @param pointActivities 用户集点活动
* @return 结果
*/
public int updatePointActivities(PointActivities pointActivities);
/**
* 删除用户集点活动
*
* @param id 用户集点活动主键
* @return 结果
*/
public int deletePointActivitiesById(Long id);
/**
* 批量删除用户集点活动
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePointActivitiesByIds(Long[] ids);
}
package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.Prize;
import share.system.domain.vo.PrizeVo;
import java.util.List;
/**
* 奖品Mapper接口
*
* @author wuwenlong
* @date 2024-11-12
*/
public interface PrizeMapper extends BaseMapper<Prize> {
/**
* 查询奖品
*
* @param id 奖品主键
* @return 奖品
*/
public Prize selectPrizeById(Long id);
/**
* 查询奖品列表
*
* @param prize 奖品
* @return 奖品集合
*/
public List<PrizeVo> selectPrizeList(PrizeVo prize);
/**
* 新增奖品
*
* @param prize 奖品
* @return 结果
*/
public int insertPrize(Prize prize);
/**
* 修改奖品
*
* @param prize 奖品
* @return 结果
*/
public int updatePrize(Prize prize);
/**
* 删除奖品
*
* @param id 奖品主键
* @return 结果
*/
public int deletePrizeById(Long id);
/**
* 批量删除奖品
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePrizeByIds(Long[] ids);
}
package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.WheelGame;
import java.util.List;
/**
* 转盘游戏Mapper接口
*
* @author wuwenlong
* @date 2024-11-12
*/
public interface WheelGameMapper extends BaseMapper<WheelGame> {
/**
* 查询转盘游戏
*
* @param id 转盘游戏主键
* @return 转盘游戏
*/
public WheelGame selectWheelGameById(Long id);
/**
* 查询转盘游戏列表
*
* @param wheelGame 转盘游戏
* @return 转盘游戏集合
*/
public List<WheelGame> selectWheelGameList(WheelGame wheelGame);
/**
* 新增转盘游戏
*
* @param wheelGame 转盘游戏
* @return 结果
*/
public int insertWheelGame(WheelGame wheelGame);
/**
* 修改转盘游戏
*
* @param wheelGame 转盘游戏
* @return 结果
*/
public int updateWheelGame(WheelGame wheelGame);
/**
* 删除转盘游戏
*
* @param id 转盘游戏主键
* @return 结果
*/
public int deleteWheelGameById(Long id);
/**
* 批量删除转盘游戏
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWheelGameByIds(Long[] ids);
}
package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.LotteryRecordsLog;
import java.util.List;
/**
* 抽奖记录日志Service接口
*
* @author wuwenlong
* @date 2024-11-12
*/
public interface LotteryRecordsLogService extends IService<LotteryRecordsLog> {
/**
* 查询抽奖记录日志
*
* @param id 抽奖记录日志主键
* @return 抽奖记录日志
*/
public LotteryRecordsLog selectLotteryRecordsLogById(Long id);
/**
* 查询抽奖记录日志列表
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 抽奖记录日志集合
*/
public List<LotteryRecordsLog> selectLotteryRecordsLogList(LotteryRecordsLog lotteryRecordsLog);
/**
* 新增抽奖记录日志
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 结果
*/
public int insertLotteryRecordsLog(LotteryRecordsLog lotteryRecordsLog);
/**
* 修改抽奖记录日志
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 结果
*/
public int updateLotteryRecordsLog(LotteryRecordsLog lotteryRecordsLog);
/**
* 批量删除抽奖记录日志
*
* @param ids 需要删除的抽奖记录日志主键集合
* @return 结果
*/
public int deleteLotteryRecordsLogByIds(Long[] ids);
/**
* 删除抽奖记录日志信息
*
* @param id 抽奖记录日志主键
* @return 结果
*/
public int deleteLotteryRecordsLogById(Long id);
}
package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.PointActivitiesConf;
import share.system.domain.vo.PointActivitiesConfVo;
import java.util.List;
/**
* 用户集点活动配置Service接口
*
* @author wuwenlong
* @date 2024-11-14
*/
public interface PointActivitiesConfService extends IService<PointActivitiesConf> {
/**
* 查询用户集点活动配置
*
* @param id 用户集点活动配置主键
* @return 用户集点活动配置
*/
public PointActivitiesConf selectPointActivitiesConfById(Long id);
/**
* 查询用户集点活动配置列表
*
* @param pointActivitiesConf 用户集点活动配置
* @return 用户集点活动配置集合
*/
public List<PointActivitiesConfVo> selectPointActivitiesConfList(PointActivitiesConfVo pointActivitiesConf);
/**
* 新增用户集点活动配置
*
* @param pointActivitiesConf 用户集点活动配置
* @return 结果
*/
public int insertPointActivitiesConf(PointActivitiesConf pointActivitiesConf);
/**
* 修改用户集点活动配置
*
* @param pointActivitiesConf 用户集点活动配置
* @return 结果
*/
public int updatePointActivitiesConf(PointActivitiesConf pointActivitiesConf);
/**
* 批量删除用户集点活动配置
*
* @param ids 需要删除的用户集点活动配置主键集合
* @return 结果
*/
public int deletePointActivitiesConfByIds(Long[] ids);
/**
* 删除用户集点活动配置信息
*
* @param id 用户集点活动配置主键
* @return 结果
*/
public int deletePointActivitiesConfById(Long id);
}
package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.PointActivities;
import share.system.domain.vo.PointActivitiesVo;
import java.util.List;
/**
* 用户集点活动Service接口
*
* @author wuwenlong
* @date 2024-11-14
*/
public interface PointActivitiesService extends IService<PointActivities> {
/**
* 查询用户集点活动
*
* @param id 用户集点活动主键
* @return 用户集点活动
*/
public PointActivities selectPointActivitiesById(Long id);
/**
* 查询用户集点活动列表
*
* @param pointActivities 用户集点活动
* @return 用户集点活动集合
*/
public List<PointActivitiesVo> selectPointActivitiesList(PointActivitiesVo pointActivities);
/**
* 新增用户集点活动
*
* @param pointActivities 用户集点活动
* @return 结果
*/
public int insertPointActivities(PointActivities pointActivities);
/**
* 修改用户集点活动
*
* @param pointActivities 用户集点活动
* @return 结果
*/
public int updatePointActivities(PointActivities pointActivities);
/**
* 批量删除用户集点活动
*
* @param ids 需要删除的用户集点活动主键集合
* @return 结果
*/
public int deletePointActivitiesByIds(Long[] ids);
/**
* 删除用户集点活动信息
*
* @param id 用户集点活动主键
* @return 结果
*/
public int deletePointActivitiesById(Long id);
}
package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.Prize;
import share.system.domain.vo.PrizeVo;
import java.util.List;
/**
* 奖品Service接口
*
* @author wuwenlong
* @date 2024-11-12
*/
public interface PrizeService extends IService<Prize> {
/**
* 查询奖品
*
* @param id 奖品主键
* @return 奖品
*/
public Prize selectPrizeById(Long id);
/**
* 查询奖品列表
*
* @param prize 奖品
* @return 奖品集合
*/
public List<PrizeVo> selectPrizeList(PrizeVo prize);
/**
* 新增奖品
*
* @param prize 奖品
* @return 结果
*/
public int insertPrize(Prize prize);
/**
* 修改奖品
*
* @param prize 奖品
* @return 结果
*/
public int updatePrize(Prize prize);
/**
* 批量删除奖品
*
* @param ids 需要删除的奖品主键集合
* @return 结果
*/
public int deletePrizeByIds(Long[] ids);
/**
* 删除奖品信息
*
* @param id 奖品主键
* @return 结果
*/
public int deletePrizeById(Long id);
}
package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.WheelGame;
import java.util.List;
/**
* 转盘游戏Service接口
*
* @author wuwenlong
* @date 2024-11-12
*/
public interface WheelGameService extends IService<WheelGame> {
/**
* 查询转盘游戏
*
* @param id 转盘游戏主键
* @return 转盘游戏
*/
public WheelGame selectWheelGameById(Long id);
/**
* 查询转盘游戏列表
*
* @param wheelGame 转盘游戏
* @return 转盘游戏集合
*/
public List<WheelGame> selectWheelGameList(WheelGame wheelGame);
/**
* 新增转盘游戏
*
* @param wheelGame 转盘游戏
* @return 结果
*/
public int insertWheelGame(WheelGame wheelGame);
/**
* 修改转盘游戏
*
* @param wheelGame 转盘游戏
* @return 结果
*/
public int updateWheelGame(WheelGame wheelGame);
/**
* 批量删除转盘游戏
*
* @param ids 需要删除的转盘游戏主键集合
* @return 结果
*/
public int deleteWheelGameByIds(Long[] ids);
/**
* 删除转盘游戏信息
*
* @param id 转盘游戏主键
* @return 结果
*/
public int deleteWheelGameById(Long id);
}
...@@ -46,6 +46,8 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC ...@@ -46,6 +46,8 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
private IPackService packService; private IPackService packService;
@Autowired @Autowired
private ISRoomService roomService; private ISRoomService roomService;
@Autowired
private ConsumerWalletService consumerWalletService;
/** /**
* 查询用户月卡 * 查询用户月卡
...@@ -128,12 +130,14 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC ...@@ -128,12 +130,14 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
SConsumer user = sConsumerService.getInfo(); SConsumer user = sConsumerService.getInfo();
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, user.getId()).eq(ConsumerMember::getIsRights ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, user.getId()).eq(ConsumerMember::getIsRights
, YesNoEnum.yes.getIndex())); , YesNoEnum.yes.getIndex()));
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, user.getId()));
ConsumerMonthlyCard consumerMonthlyCard = null; ConsumerMonthlyCard consumerMonthlyCard = null;
List<ConsumerSecondaryCard> consumerSecondaryCard = null; List<ConsumerSecondaryCard> consumerSecondaryCard = null;
MonthlyCardResponse map = new MonthlyCardResponse(); MonthlyCardResponse map = new MonthlyCardResponse();
List<ConsumerMonthlyCard> consumerMonthlyCardList = new ArrayList<>(); List<ConsumerMonthlyCard> consumerMonthlyCardList = new ArrayList<>();
List<ConsumerSecondaryCard> consumerSecondaryCardList = new ArrayList<>(); List<ConsumerSecondaryCard> consumerSecondaryCardList = new ArrayList<>();
//可用时长
BigDecimal freeDuration = consumerWallet.getRemainingDuration();
if (ObjectUtil.isNotEmpty(consumerMember)) { if (ObjectUtil.isNotEmpty(consumerMember)) {
SRoom room = roomService.getById(monthlyCardRequest.getRoomId()); SRoom room = roomService.getById(monthlyCardRequest.getRoomId());
consumerMonthlyCard = baseMapper.selectOne(new LambdaQueryWrapper<ConsumerMonthlyCard>().eq(ConsumerMonthlyCard::getConsumerId, user.getId()).gt(ConsumerMonthlyCard::getFreeDuration, 0)); consumerMonthlyCard = baseMapper.selectOne(new LambdaQueryWrapper<ConsumerMonthlyCard>().eq(ConsumerMonthlyCard::getConsumerId, user.getId()).gt(ConsumerMonthlyCard::getFreeDuration, 0));
...@@ -142,6 +146,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC ...@@ -142,6 +146,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
.gt(ConsumerSecondaryCard::getNumber, 0) .gt(ConsumerSecondaryCard::getNumber, 0)
.orderByAsc(ConsumerSecondaryCard::getNumber) .orderByAsc(ConsumerSecondaryCard::getNumber)
); );
freeDuration = freeDuration.add(consumerMonthlyCard.getFreeDuration());
if (!ObjectUtils.isEmpty(monthlyCardRequest.getRoomLabelId())) { if (!ObjectUtils.isEmpty(monthlyCardRequest.getRoomLabelId())) {
RoomLabel roomLabel = roomLabelService.selectRoomLabelById(monthlyCardRequest.getRoomLabelId()); RoomLabel roomLabel = roomLabelService.selectRoomLabelById(monthlyCardRequest.getRoomLabelId());
Label label = labelService.getById(roomLabel.getLabelId()); Label label = labelService.getById(roomLabel.getLabelId());
...@@ -179,7 +184,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC ...@@ -179,7 +184,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
} }
}); });
} }
if (ObjectUtil.isNotEmpty(consumerMonthlyCard) && consumerMonthlyCard.getFreeDuration().compareTo(new BigDecimal(byId.getDuration())) >= 0) { if (ObjectUtil.isNotEmpty(consumerMonthlyCard) && freeDuration.compareTo(new BigDecimal(byId.getDuration())) >= 0) {
consumerMonthlyCardList.add(consumerMonthlyCard); consumerMonthlyCardList.add(consumerMonthlyCard);
map.setConsumerMonthlyCard(consumerMonthlyCardList); map.setConsumerMonthlyCard(consumerMonthlyCardList);
} }
...@@ -218,7 +223,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC ...@@ -218,7 +223,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
} }
}); });
} }
if (ObjectUtil.isNotEmpty(consumerMonthlyCard) && consumerMonthlyCard.getFreeDuration().compareTo(new BigDecimal(pack.getDuration())) >= 0) { if (ObjectUtil.isNotEmpty(consumerMonthlyCard) && freeDuration.compareTo(new BigDecimal(pack.getDuration())) >= 0) {
consumerMonthlyCardList.add(consumerMonthlyCard); consumerMonthlyCardList.add(consumerMonthlyCard);
map.setConsumerMonthlyCard(consumerMonthlyCardList); map.setConsumerMonthlyCard(consumerMonthlyCardList);
} }
......
...@@ -252,7 +252,6 @@ public class EquityFundExcessServiceImpl extends ServiceImpl<EquityFundExcessMap ...@@ -252,7 +252,6 @@ public class EquityFundExcessServiceImpl extends ServiceImpl<EquityFundExcessMap
queryWrapper.eq(DurationLog::getDurationType, DurationTypeEnum.SHARE.getCode()); queryWrapper.eq(DurationLog::getDurationType, DurationTypeEnum.SHARE.getCode());
List<DurationLog> durationLogs = durationLogService.list(queryWrapper); List<DurationLog> durationLogs = durationLogService.list(queryWrapper);
if (YesNoEnum.yes.getIndex().equals(sOrderList.size()) && YesNoEnum.no.getIndex().equals(durationLogs.size())) { if (YesNoEnum.yes.getIndex().equals(sOrderList.size()) && YesNoEnum.no.getIndex().equals(durationLogs.size())) {
addNewConsumer(sOrder.getConsumerId());
LambdaQueryWrapper<ConsumerWallet> consumerWalletLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ConsumerWallet> consumerWalletLambdaQueryWrapper = new LambdaQueryWrapper<>();
consumerWalletLambdaQueryWrapper.eq(ConsumerWallet::getConsumerId, sharingActivities.getUid()); consumerWalletLambdaQueryWrapper.eq(ConsumerWallet::getConsumerId, sharingActivities.getUid());
ConsumerWallet consumerWallet = consumerWalletService.getOne(consumerWalletLambdaQueryWrapper); ConsumerWallet consumerWallet = consumerWalletService.getOne(consumerWalletLambdaQueryWrapper);
...@@ -287,10 +286,10 @@ public class EquityFundExcessServiceImpl extends ServiceImpl<EquityFundExcessMap ...@@ -287,10 +286,10 @@ public class EquityFundExcessServiceImpl extends ServiceImpl<EquityFundExcessMap
newConsumerWallet.setUpdateTime(DateUtils.getNowDate()); newConsumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.insertConsumerWallet(newConsumerWallet); consumerWalletService.insertConsumerWallet(newConsumerWallet);
DurationLog newDurationLog = new DurationLog(); DurationLog newDurationLog = new DurationLog();
newDurationLog.setConsumerId(consumerWallet.getConsumerId()); newDurationLog.setConsumerId(newConsumerWallet.getConsumerId());
newDurationLog.setNewId(sOrder.getConsumerId()); newDurationLog.setNewId(sOrder.getConsumerId());
newDurationLog.setVariableDuration(anHour); newDurationLog.setVariableDuration(anHour);
newDurationLog.setCurrentDuration(consumerWallet.getRemainingDuration()); newDurationLog.setCurrentDuration(newConsumerWallet.getRemainingDuration());
newDurationLog.setOperationType(YesNoEnum.yes.getIndex()); newDurationLog.setOperationType(YesNoEnum.yes.getIndex());
newDurationLog.setDurationType(DurationTypeEnum.SHARE.getCode()); newDurationLog.setDurationType(DurationTypeEnum.SHARE.getCode());
newDurationLog.setOperationTime(DateUtils.getNowDate()); newDurationLog.setOperationTime(DateUtils.getNowDate());
...@@ -348,29 +347,4 @@ public class EquityFundExcessServiceImpl extends ServiceImpl<EquityFundExcessMap ...@@ -348,29 +347,4 @@ public class EquityFundExcessServiceImpl extends ServiceImpl<EquityFundExcessMap
} }
} }
private void addNewConsumer(Long consumerId) {
//新增用户为普通会员
ConsumerWallet wallet = new ConsumerWallet();
wallet.setConsumerId(consumerId);
wallet.setBalance(BigDecimal.ZERO);
wallet.setRechargeAmount(BigDecimal.ZERO);
wallet.setGiftAmount(BigDecimal.ZERO);
wallet.setRemainingDuration(BigDecimal.ZERO);
wallet.setRemainingIntegral(BigDecimal.ZERO);
wallet.setEquityFund(BigDecimal.ZERO);
wallet.setAccumulateEquityFund(BigDecimal.ZERO);
wallet.setCreateTime(new Date());
ConsumerMember consumerMember = new ConsumerMember();
consumerMember.setConsumerId(consumerId);
consumerMember.setMembershipLevel(0L);
String rechargeMembershipExpirationTime = sysConfigService.selectConfigByKey("rechargeMembershipExpirationTime");
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), Integer.parseInt(rechargeMembershipExpirationTime)));
consumerMember.setMembershipProgress(BigDecimal.ZERO);
consumerMember.setIsRecharge(YesNoEnum.no.getIndex());
consumerMember.setIsRights(YesNoEnum.no.getIndex());
consumerMember.setCreateTime(new Date());
consumerWalletService.save(wallet);
consumerMemberService.save(consumerMember);
}
} }
package share.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.DateUtils;
import share.system.domain.LotteryRecordsLog;
import share.system.mapper.LotteryRecordsLogMapper;
import share.system.service.LotteryRecordsLogService;
import java.util.List;
/**
* 抽奖记录日志Service业务层处理
*
* @author wuwenlong
* @date 2024-11-12
*/
@Service
public class LotteryRecordsLogServiceImpl extends ServiceImpl<LotteryRecordsLogMapper, LotteryRecordsLog> implements LotteryRecordsLogService {
@Autowired
private LotteryRecordsLogMapper lotteryRecordsLogMapper;
/**
* 查询抽奖记录日志
*
* @param id 抽奖记录日志主键
* @return 抽奖记录日志
*/
@Override
public LotteryRecordsLog selectLotteryRecordsLogById(Long id) {
return lotteryRecordsLogMapper.selectLotteryRecordsLogById(id);
}
/**
* 查询抽奖记录日志列表
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 抽奖记录日志
*/
@Override
public List<LotteryRecordsLog> selectLotteryRecordsLogList(LotteryRecordsLog lotteryRecordsLog) {
return lotteryRecordsLogMapper.selectLotteryRecordsLogList(lotteryRecordsLog);
}
/**
* 新增抽奖记录日志
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 结果
*/
@Override
public int insertLotteryRecordsLog(LotteryRecordsLog lotteryRecordsLog) {
lotteryRecordsLog.setCreateTime(DateUtils.getNowDate());
return lotteryRecordsLogMapper.insertLotteryRecordsLog(lotteryRecordsLog);
}
/**
* 修改抽奖记录日志
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 结果
*/
@Override
public int updateLotteryRecordsLog(LotteryRecordsLog lotteryRecordsLog) {
lotteryRecordsLog.setUpdateTime(DateUtils.getNowDate());
return lotteryRecordsLogMapper.updateLotteryRecordsLog(lotteryRecordsLog);
}
/**
* 批量删除抽奖记录日志
*
* @param ids 需要删除的抽奖记录日志主键
* @return 结果
*/
@Override
public int deleteLotteryRecordsLogByIds(Long[] ids) {
return lotteryRecordsLogMapper.deleteLotteryRecordsLogByIds(ids);
}
/**
* 删除抽奖记录日志信息
*
* @param id 抽奖记录日志主键
* @return 结果
*/
@Override
public int deleteLotteryRecordsLogById(Long id) {
return lotteryRecordsLogMapper.deleteLotteryRecordsLogById(id);
}
}
package share.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.DateUtils;
import share.system.domain.PointActivitiesConf;
import share.system.domain.vo.PointActivitiesConfVo;
import share.system.mapper.PointActivitiesConfMapper;
import share.system.service.PointActivitiesConfService;
import java.util.List;
/**
* 用户集点活动配置Service业务层处理
*
* @author wuwenlong
* @date 2024-11-14
*/
@Service
public class PointActivitiesConfServiceImpl extends ServiceImpl<PointActivitiesConfMapper, PointActivitiesConf> implements PointActivitiesConfService {
@Autowired
private PointActivitiesConfMapper pointActivitiesConfMapper;
/**
* 查询用户集点活动配置
*
* @param id 用户集点活动配置主键
* @return 用户集点活动配置
*/
@Override
public PointActivitiesConf selectPointActivitiesConfById(Long id) {
return pointActivitiesConfMapper.selectPointActivitiesConfById(id);
}
/**
* 查询用户集点活动配置列表
*
* @param pointActivitiesConf 用户集点活动配置
* @return 用户集点活动配置
*/
@Override
public List<PointActivitiesConfVo> selectPointActivitiesConfList(PointActivitiesConfVo pointActivitiesConf) {
return pointActivitiesConfMapper.selectPointActivitiesConfList(pointActivitiesConf);
}
/**
* 新增用户集点活动配置
*
* @param pointActivitiesConf 用户集点活动配置
* @return 结果
*/
@Override
public int insertPointActivitiesConf(PointActivitiesConf pointActivitiesConf) {
pointActivitiesConf.setCreateTime(DateUtils.getNowDate());
return pointActivitiesConfMapper.insertPointActivitiesConf(pointActivitiesConf);
}
/**
* 修改用户集点活动配置
*
* @param pointActivitiesConf 用户集点活动配置
* @return 结果
*/
@Override
public int updatePointActivitiesConf(PointActivitiesConf pointActivitiesConf) {
pointActivitiesConf.setUpdateTime(DateUtils.getNowDate());
return pointActivitiesConfMapper.updatePointActivitiesConf(pointActivitiesConf);
}
/**
* 批量删除用户集点活动配置
*
* @param ids 需要删除的用户集点活动配置主键
* @return 结果
*/
@Override
public int deletePointActivitiesConfByIds(Long[] ids) {
return pointActivitiesConfMapper.deletePointActivitiesConfByIds(ids);
}
/**
* 删除用户集点活动配置信息
*
* @param id 用户集点活动配置主键
* @return 结果
*/
@Override
public int deletePointActivitiesConfById(Long id) {
return pointActivitiesConfMapper.deletePointActivitiesConfById(id);
}
}
package share.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.enums.YesNoEnum;
import share.common.utils.DateUtils;
import share.system.domain.PointActivities;
import share.system.domain.PointActivitiesConf;
import share.system.domain.SConsumer;
import share.system.domain.SOrder;
import share.system.domain.vo.PointActivitiesVo;
import share.system.mapper.PointActivitiesMapper;
import share.system.service.PointActivitiesConfService;
import share.system.service.PointActivitiesService;
import share.system.service.SConsumerService;
import java.util.List;
/**
* 用户集点活动Service业务层处理
*
* @author wuwenlong
* @date 2024-11-14
*/
@Service
public class PointActivitiesServiceImpl extends ServiceImpl<PointActivitiesMapper, PointActivities> implements PointActivitiesService {
@Autowired
private PointActivitiesMapper pointActivitiesMapper;
@Autowired
private SConsumerService sConsumerService;
@Autowired
private PointActivitiesConfService pointActivitiesConfService;
/**
* 查询用户集点活动
*
* @param id 用户集点活动主键
* @return 用户集点活动
*/
@Override
public PointActivities selectPointActivitiesById(Long id) {
return pointActivitiesMapper.selectPointActivitiesById(id);
}
/**
* 查询用户集点活动列表
*
* @param pointActivities 用户集点活动
* @return 用户集点活动
*/
@Override
public List<PointActivitiesVo> selectPointActivitiesList(PointActivitiesVo pointActivities) {
return pointActivitiesMapper.selectPointActivitiesList(pointActivities);
}
/**
* 新增用户集点活动
*
* @param pointActivities 用户集点活动
* @return 结果
*/
@Override
public int insertPointActivities(PointActivities pointActivities) {
pointActivities.setCreateTime(DateUtils.getNowDate());
return pointActivitiesMapper.insertPointActivities(pointActivities);
}
/**
* 修改用户集点活动
*
* @param pointActivities 用户集点活动
* @return 结果
*/
@Override
public int updatePointActivities(PointActivities pointActivities) {
pointActivities.setUpdateTime(DateUtils.getNowDate());
return pointActivitiesMapper.updatePointActivities(pointActivities);
}
//参与集点活动
public void joinPointActivities(SOrder sOrder) {
SConsumer user = sConsumerService.getInfo();
PointActivitiesConf pointActivitiesConf = pointActivitiesConfService.list().get(0);
PointActivities oldPointActivities = pointActivitiesMapper.selectOne(new LambdaQueryWrapper<PointActivities>().eq(PointActivities::getConsumerId, user.getId()));
if (ObjectUtil.isNotEmpty(oldPointActivities)) {
oldPointActivities.setPoints(oldPointActivities.getPoints() + YesNoEnum.yes.getIndex());
oldPointActivities.setLastConsumptionTime(sOrder.getPayTime());
if (oldPointActivities.getPoints().equals(pointActivitiesConf.getPointsRequired())) {
oldPointActivities.setIsReceive(YesNoEnum.yes.getIndex());
}
} else {
PointActivities pointActivities = new PointActivities();
pointActivities.setConsumerId(user.getId());
pointActivities.setConfId(pointActivitiesConf.getId());
pointActivities.setCouponId(pointActivitiesConf.getCouponId());
pointActivities.setPoints(YesNoEnum.yes.getIndex());
pointActivities.setLastConsumptionTime(sOrder.getPayTime());
pointActivities.setIsReceive(YesNoEnum.no.getIndex());
pointActivities.setCouponReceived(YesNoEnum.no.getIndex());
save(pointActivities);
}
}
/**
* 批量删除用户集点活动
*
* @param ids 需要删除的用户集点活动主键
* @return 结果
*/
@Override
public int deletePointActivitiesByIds(Long[] ids) {
return pointActivitiesMapper.deletePointActivitiesByIds(ids);
}
/**
* 删除用户集点活动信息
*
* @param id 用户集点活动主键
* @return 结果
*/
@Override
public int deletePointActivitiesById(Long id) {
return pointActivitiesMapper.deletePointActivitiesById(id);
}
}
package share.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.DateUtils;
import share.system.domain.Prize;
import share.system.domain.vo.PrizeVo;
import share.system.mapper.PrizeMapper;
import share.system.service.PrizeService;
import java.util.List;
/**
* 奖品Service业务层处理
*
* @author wuwenlong
* @date 2024-11-12
*/
@Service
public class PrizeServiceImpl extends ServiceImpl<PrizeMapper, Prize> implements PrizeService {
@Autowired
private PrizeMapper prizeMapper;
/**
* 查询奖品
*
* @param id 奖品主键
* @return 奖品
*/
@Override
public Prize selectPrizeById(Long id) {
return prizeMapper.selectPrizeById(id);
}
/**
* 查询奖品列表
*
* @param prize 奖品
* @return 奖品
*/
@Override
public List<PrizeVo> selectPrizeList(PrizeVo prize) {
return prizeMapper.selectPrizeList(prize);
}
/**
* 新增奖品
*
* @param prize 奖品
* @return 结果
*/
@Override
public int insertPrize(Prize prize) {
prize.setCreateTime(DateUtils.getNowDate());
return prizeMapper.insertPrize(prize);
}
/**
* 修改奖品
*
* @param prize 奖品
* @return 结果
*/
@Override
public int updatePrize(Prize prize) {
prize.setUpdateTime(DateUtils.getNowDate());
return prizeMapper.updatePrize(prize);
}
/**
* 批量删除奖品
*
* @param ids 需要删除的奖品主键
* @return 结果
*/
@Override
public int deletePrizeByIds(Long[] ids) {
return prizeMapper.deletePrizeByIds(ids);
}
/**
* 删除奖品信息
*
* @param id 奖品主键
* @return 结果
*/
@Override
public int deletePrizeById(Long id) {
return prizeMapper.deletePrizeById(id);
}
}
...@@ -528,11 +528,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -528,11 +528,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
//退款 //退款
if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode())) { if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode())) {
try { try {
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
refundExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard); refundExtracted(sOrder, consumerSecondaryCard);
} else {
refundExtracted(consumerWallet, sOrder, consumerMember);
} }
refundExtracted(consumerWallet, sOrder, consumerMember, consumerMonthlyCard);
orderRefundService.refundOp(request, sOrder); orderRefundService.refundOp(request, sOrder);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -540,11 +539,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -540,11 +539,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
} }
} else { } else {
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
refundExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard); refundExtracted(sOrder, consumerSecondaryCard);
} else {
refundExtracted(consumerWallet, sOrder, consumerMember);
} }
refundExtracted(consumerWallet, sOrder, consumerMember, consumerMonthlyCard);
sOrder.setStatus(OrderStatusEnum.CANCEL.getCode()); sOrder.setStatus(OrderStatusEnum.CANCEL.getCode());
sOrder.setRefundStatus(RefundStatusEnum.REFUNDED.getCode()); sOrder.setRefundStatus(RefundStatusEnum.REFUNDED.getCode());
sOrder.setRefundReasonTime(cn.hutool.core.date.DateUtil.date()); sOrder.setRefundReasonTime(cn.hutool.core.date.DateUtil.date());
...@@ -992,10 +990,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -992,10 +990,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
response.setOrderNo(sOrder.getOrderNo()); response.setOrderNo(sOrder.getOrderNo());
sOrder.setPayStatus(YesNoEnum.yes.getIndex()); sOrder.setPayStatus(YesNoEnum.yes.getIndex());
sOrder.setPayTime(DateUtils.getNowDate()); sOrder.setPayTime(DateUtils.getNowDate());
if (!ObjectUtils.isEmpty(request.getMonthlyCardId()) || !ObjectUtils.isEmpty(request.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(request.getSecondaryCardId())) {
creatExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard); creatExtracted(sOrder, consumerSecondaryCard);
} }
creatExtracted(consumerWallet, sOrder, consumerMember); creatExtracted(consumerWallet, sOrder, consumerMember, consumerMonthlyCard);
} else { } else {
// response = orderPayService.payment(sOrder); // response = orderPayService.payment(sOrder);
// 扫呗聚合支付 // 扫呗聚合支付
...@@ -1129,9 +1127,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1129,9 +1127,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
} }
private void creatExtracted(ConsumerWallet consumerWallet, SOrder sOrder, ConsumerMember consumerMember) { private void creatExtracted(ConsumerWallet consumerWallet, SOrder sOrder, ConsumerMember consumerMember, ConsumerMonthlyCard consumerMonthlyCard) {
if (ObjectUtil.isNotEmpty(consumerWallet)) { if (ObjectUtil.isNotEmpty(consumerWallet)) {
if (ObjectUtil.isNotEmpty(sOrder.getDuration()) && sOrder.getDuration().compareTo(BigDecimal.ZERO) > 0 && ObjectUtil.isEmpty(sOrder.getMonthlyCardId())) {
if (ObjectUtil.isNotEmpty(sOrder.getDuration()) && sOrder.getDuration().compareTo(BigDecimal.ZERO) > 0) {
if (ObjectUtil.isEmpty(sOrder.getMonthlyCardId())) {
DurationLog durationLog = new DurationLog(); DurationLog durationLog = new DurationLog();
durationLog.setConsumerId(sOrder.getConsumerId()); durationLog.setConsumerId(sOrder.getConsumerId());
durationLog.setVariableDuration(sOrder.getDuration()); durationLog.setVariableDuration(sOrder.getDuration());
...@@ -1143,6 +1143,51 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1143,6 +1143,51 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
durationLogService.save(durationLog); durationLogService.save(durationLog);
consumerWallet.setRemainingDuration(consumerWallet.getRemainingDuration().subtract(sOrder.getDuration())); consumerWallet.setRemainingDuration(consumerWallet.getRemainingDuration().subtract(sOrder.getDuration()));
consumerWalletService.updateById(consumerWallet); consumerWalletService.updateById(consumerWallet);
} else {
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) && !ObjectUtils.isEmpty(sOrder.getDuration())) {
if (consumerMonthlyCard.getFreeDuration().compareTo(sOrder.getDuration()) >= 0) {
consumerMonthlyCard.setFreeDuration(consumerMonthlyCard.getFreeDuration().subtract(sOrder.getDuration()));
MonthlyCardLog monthlyCardLog = new MonthlyCardLog();
monthlyCardLog.setConsumerMonthlyCardId(sOrder.getMonthlyCardId());
monthlyCardLog.setConsumerId(consumerMonthlyCard.getConsumerId());
monthlyCardLog.setPhone(sOrder.getConsumerPhone());
monthlyCardLog.setUseDuration(sOrder.getDuration());
monthlyCardLog.setResidueDuration(consumerMonthlyCard.getFreeDuration());
monthlyCardLog.setOperationType(YesNoEnum.no.getIndex());
monthlyCardLog.setOperationTime(new Date());
monthlyCardLog.setCreateTime(new Date());
consumerMonthlyCardService.updateById(consumerMonthlyCard);
monthlyCardLogService.save(monthlyCardLog);
} else if (consumerMonthlyCard.getFreeDuration().compareTo(sOrder.getDuration()) < 0) {
BigDecimal duration = sOrder.getDuration();
MonthlyCardLog monthlyCardLog = new MonthlyCardLog();
monthlyCardLog.setConsumerMonthlyCardId(sOrder.getMonthlyCardId());
monthlyCardLog.setConsumerId(consumerMonthlyCard.getConsumerId());
monthlyCardLog.setPhone(sOrder.getConsumerPhone());
monthlyCardLog.setUseDuration(consumerMonthlyCard.getFreeDuration());
duration = duration.subtract(consumerMonthlyCard.getFreeDuration());
consumerMonthlyCard.setFreeDuration(BigDecimal.ZERO);
monthlyCardLog.setResidueDuration(consumerMonthlyCard.getFreeDuration());
monthlyCardLog.setOperationType(YesNoEnum.no.getIndex());
monthlyCardLog.setOperationTime(new Date());
monthlyCardLog.setCreateTime(new Date());
consumerMonthlyCardService.updateById(consumerMonthlyCard);
monthlyCardLogService.save(monthlyCardLog);
DurationLog durationLog = new DurationLog();
durationLog.setConsumerId(sOrder.getConsumerId());
durationLog.setVariableDuration(duration);
durationLog.setCurrentDuration(consumerWallet.getRemainingDuration());
durationLog.setOperationType(YesNoEnum.no.getIndex());
durationLog.setDurationType(DurationTypeEnum.ORDER.getCode());
durationLog.setOperationTime(new Date());
durationLog.setCreateTime(new Date());
durationLogService.save(durationLog);
consumerWallet.setRemainingDuration(consumerWallet.getRemainingDuration().subtract(duration));
consumerWalletService.updateById(consumerWallet);
}
}
}
} }
if (ObjectUtil.isNotEmpty(sOrder.getBalance()) && sOrder.getBalance().compareTo(BigDecimal.ZERO) > 0) { if (ObjectUtil.isNotEmpty(sOrder.getBalance()) && sOrder.getBalance().compareTo(BigDecimal.ZERO) > 0) {
BalanceLog balanceLog = new BalanceLog(); BalanceLog balanceLog = new BalanceLog();
...@@ -1321,23 +1366,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1321,23 +1366,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
} }
private void creatExtracted(ConsumerMonthlyCard consumerMonthlyCard, SOrder sOrder, ConsumerSecondaryCard consumerSecondaryCard) { private void creatExtracted(SOrder sOrder, ConsumerSecondaryCard consumerSecondaryCard) {
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) && !ObjectUtils.isEmpty(sOrder.getDuration())) {
if (consumerMonthlyCard.getFreeDuration().compareTo(sOrder.getDuration()) >= 0) {
consumerMonthlyCard.setFreeDuration(consumerMonthlyCard.getFreeDuration().subtract(sOrder.getDuration()));
MonthlyCardLog monthlyCardLog = new MonthlyCardLog();
monthlyCardLog.setConsumerMonthlyCardId(sOrder.getMonthlyCardId());
monthlyCardLog.setConsumerId(consumerMonthlyCard.getConsumerId());
monthlyCardLog.setPhone(sOrder.getConsumerPhone());
monthlyCardLog.setUseDuration(sOrder.getDuration());
monthlyCardLog.setResidueDuration(consumerMonthlyCard.getFreeDuration());
monthlyCardLog.setOperationType(YesNoEnum.no.getIndex());
monthlyCardLog.setOperationTime(new Date());
monthlyCardLog.setCreateTime(new Date());
consumerMonthlyCardService.updateById(consumerMonthlyCard);
monthlyCardLogService.save(monthlyCardLog);
}
}
if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
consumerSecondaryCard.setNumber(consumerSecondaryCard.getNumber() - 1); consumerSecondaryCard.setNumber(consumerSecondaryCard.getNumber() - 1);
SecondaryCardLog secondaryCardLog = new SecondaryCardLog(); SecondaryCardLog secondaryCardLog = new SecondaryCardLog();
...@@ -1354,9 +1384,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1354,9 +1384,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
} }
private void refundExtracted(ConsumerWallet consumerWallet, SOrder sOrder, ConsumerMember consumerMember) { private void refundExtracted(ConsumerWallet consumerWallet, SOrder sOrder, ConsumerMember consumerMember, ConsumerMonthlyCard consumerMonthlyCard) {
if (ObjectUtil.isNotEmpty(consumerWallet)) { if (ObjectUtil.isNotEmpty(consumerWallet)) {
if (ObjectUtil.isNotEmpty(sOrder.getDuration()) && sOrder.getDuration().compareTo(BigDecimal.ZERO) > 0 && ObjectUtil.isEmpty(sOrder.getMonthlyCardId())) { if (ObjectUtil.isNotEmpty(sOrder.getDuration()) && sOrder.getDuration().compareTo(BigDecimal.ZERO) > 0) {
if (ObjectUtil.isEmpty(sOrder.getMonthlyCardId())) {
DurationLog durationLog = new DurationLog(); DurationLog durationLog = new DurationLog();
durationLog.setConsumerId(sOrder.getConsumerId()); durationLog.setConsumerId(sOrder.getConsumerId());
durationLog.setVariableDuration(sOrder.getDuration()); durationLog.setVariableDuration(sOrder.getDuration());
...@@ -1368,6 +1399,62 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1368,6 +1399,62 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
durationLogService.save(durationLog); durationLogService.save(durationLog);
consumerWallet.setRemainingDuration(consumerWallet.getRemainingDuration().add(sOrder.getDuration())); consumerWallet.setRemainingDuration(consumerWallet.getRemainingDuration().add(sOrder.getDuration()));
consumerWalletService.updateById(consumerWallet); consumerWalletService.updateById(consumerWallet);
} else {
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) && !ObjectUtils.isEmpty(sOrder.getDuration())) {
BigDecimal duration = sOrder.getDuration();
BigDecimal monthlyCardTime = new BigDecimal(sysConfigService.selectConfigByKey("monthlyCardTime"));
if (monthlyCardTime.compareTo(duration) >= 0) {
//判断订单的下单时间是否是当前天
LocalDate localDate1 = sOrder.getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate localDate2 = new Date().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
if (localDate1.equals(localDate2)) {
consumerMonthlyCard.setFreeDuration(consumerMonthlyCard.getFreeDuration().add(sOrder.getDuration()));
MonthlyCardLog monthlyCardLog = new MonthlyCardLog();
monthlyCardLog.setConsumerMonthlyCardId(sOrder.getMonthlyCardId());
monthlyCardLog.setConsumerId(consumerMonthlyCard.getConsumerId());
monthlyCardLog.setPhone(sOrder.getConsumerPhone());
monthlyCardLog.setUseDuration(sOrder.getDuration());
monthlyCardLog.setResidueDuration(consumerMonthlyCard.getFreeDuration());
monthlyCardLog.setOperationType(YesNoEnum.yes.getIndex());
monthlyCardLog.setOperationTime(new Date());
monthlyCardLog.setCreateTime(new Date());
consumerMonthlyCardService.updateById(consumerMonthlyCard);
monthlyCardLogService.save(monthlyCardLog);
}
} else if (monthlyCardTime.compareTo(duration) < 0) {
//判断订单的下单时间是否是当前天
LocalDate localDate1 = sOrder.getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate localDate2 = new Date().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
duration = duration.subtract(monthlyCardTime);
if (localDate1.equals(localDate2)) {
consumerMonthlyCard.setFreeDuration(consumerMonthlyCard.getFreeDuration().add(monthlyCardTime));
MonthlyCardLog monthlyCardLog = new MonthlyCardLog();
monthlyCardLog.setConsumerMonthlyCardId(sOrder.getMonthlyCardId());
monthlyCardLog.setConsumerId(consumerMonthlyCard.getConsumerId());
monthlyCardLog.setPhone(sOrder.getConsumerPhone());
monthlyCardLog.setUseDuration(monthlyCardTime);
monthlyCardLog.setResidueDuration(consumerMonthlyCard.getFreeDuration());
monthlyCardLog.setOperationType(YesNoEnum.yes.getIndex());
monthlyCardLog.setOperationTime(new Date());
monthlyCardLog.setCreateTime(new Date());
consumerMonthlyCardService.updateById(consumerMonthlyCard);
monthlyCardLogService.save(monthlyCardLog);
}
DurationLog durationLog = new DurationLog();
durationLog.setConsumerId(sOrder.getConsumerId());
durationLog.setVariableDuration(duration);
durationLog.setCurrentDuration(consumerWallet.getRemainingDuration());
durationLog.setOperationType(YesNoEnum.yes.getIndex());
durationLog.setDurationType(DurationTypeEnum.ORDER_REFUND.getCode());
durationLog.setOperationTime(new Date());
durationLog.setCreateTime(new Date());
durationLogService.save(durationLog);
consumerWallet.setRemainingDuration(consumerWallet.getRemainingDuration().add(duration));
consumerWalletService.updateById(consumerWallet);
}
}
}
} }
if (ObjectUtil.isNotEmpty(sOrder.getBalance()) && sOrder.getBalance().compareTo(BigDecimal.ZERO) > 0) { if (ObjectUtil.isNotEmpty(sOrder.getBalance()) && sOrder.getBalance().compareTo(BigDecimal.ZERO) > 0) {
BalanceLog balanceLog = new BalanceLog(); BalanceLog balanceLog = new BalanceLog();
...@@ -1571,26 +1658,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1571,26 +1658,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
// } // }
} }
private void refundExtracted(ConsumerMonthlyCard consumerMonthlyCard, SOrder sOrder, ConsumerSecondaryCard consumerSecondaryCard) { private void refundExtracted(SOrder sOrder, ConsumerSecondaryCard consumerSecondaryCard) {
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) && !ObjectUtils.isEmpty(sOrder.getDuration())) {
//判断订单的下单时间是否是当前天
LocalDate localDate1 = sOrder.getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate localDate2 = new Date().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
if (localDate1.equals(localDate2)) {
consumerMonthlyCard.setFreeDuration(consumerMonthlyCard.getFreeDuration().add(sOrder.getDuration()));
MonthlyCardLog monthlyCardLog = new MonthlyCardLog();
monthlyCardLog.setConsumerMonthlyCardId(sOrder.getMonthlyCardId());
monthlyCardLog.setConsumerId(consumerMonthlyCard.getConsumerId());
monthlyCardLog.setPhone(sOrder.getConsumerPhone());
monthlyCardLog.setUseDuration(sOrder.getDuration());
monthlyCardLog.setResidueDuration(consumerMonthlyCard.getFreeDuration());
monthlyCardLog.setOperationType(YesNoEnum.yes.getIndex());
monthlyCardLog.setOperationTime(new Date());
monthlyCardLog.setCreateTime(new Date());
consumerMonthlyCardService.updateById(consumerMonthlyCard);
monthlyCardLogService.save(monthlyCardLog);
}
}
if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
consumerSecondaryCard.setNumber(consumerSecondaryCard.getNumber() + 1); consumerSecondaryCard.setNumber(consumerSecondaryCard.getNumber() + 1);
SecondaryCardLog secondaryCardLog = new SecondaryCardLog(); SecondaryCardLog secondaryCardLog = new SecondaryCardLog();
...@@ -1812,6 +1880,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1812,6 +1880,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
order.setBalance(priceResponse.getBalance()); order.setBalance(priceResponse.getBalance());
order.setDuration(priceResponse.getDuration()); order.setDuration(priceResponse.getDuration());
order.setDiscountRatio(priceResponse.getDiscountRatio()); order.setDiscountRatio(priceResponse.getDiscountRatio());
order.setMonthlyCardId(priceResponse.getMonthlyCardId());
order.setSecondaryCardId(priceResponse.getSecondaryCardId());
if (priceResponse.getPayFee().compareTo(order.getPayPrice()) != 0 if (priceResponse.getPayFee().compareTo(order.getPayPrice()) != 0
&& priceResponse.getDuration().compareTo(request.getDuration()) != 0 && priceResponse.getDuration().compareTo(request.getDuration()) != 0
&& priceResponse.getBalance().compareTo(request.getBalance()) != 0 && priceResponse.getBalance().compareTo(request.getBalance()) != 0
...@@ -2156,10 +2226,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2156,10 +2226,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5, deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5,
DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode()); DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
} }
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
refundExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard); refundExtracted(sOrder, consumerSecondaryCard);
} else { } else {
refundExtracted(consumerWallet, sOrder, consumerMember); refundExtracted(consumerWallet, sOrder, consumerMember, consumerMonthlyCard);
} }
} }
} else { } else {
...@@ -2191,10 +2261,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2191,10 +2261,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (sOrder.getIsDelete().equals(YesNoEnum.yes.getIndex()) && sOrder.getPayStatus().equals(YesNoEnum.yes.getIndex())) { if (sOrder.getIsDelete().equals(YesNoEnum.yes.getIndex()) && sOrder.getPayStatus().equals(YesNoEnum.yes.getIndex())) {
sOrder.setIsDelete(YesNoEnum.no.getIndex()); sOrder.setIsDelete(YesNoEnum.no.getIndex());
} }
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
creatExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard); creatExtracted(sOrder, consumerSecondaryCard);
} }
creatExtracted(consumerWallet, sOrder, consumerMember); creatExtracted(consumerWallet, sOrder, consumerMember, consumerMonthlyCard);
baseMapper.updateSOrder(sOrder); baseMapper.updateSOrder(sOrder);
unLockOrder(sOrder.getRoomId()); unLockOrder(sOrder.getRoomId());
if (sOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) { if (sOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) {
...@@ -2348,10 +2418,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2348,10 +2418,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5, deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5,
DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode()); DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
} }
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
refundExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard); refundExtracted(sOrder, consumerSecondaryCard);
} }
refundExtracted(consumerWallet, sOrder, consumerMember); refundExtracted(consumerWallet, sOrder, consumerMember, consumerMonthlyCard);
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -2379,10 +2449,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2379,10 +2449,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
try { try {
sOrder.setRefundReason(request.getRefundReason()); sOrder.setRefundReason(request.getRefundReason());
updateById(sOrder); updateById(sOrder);
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
refundExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard); refundExtracted(sOrder, consumerSecondaryCard);
} }
refundExtracted(consumerWallet, sOrder, consumerMember); refundExtracted(consumerWallet, sOrder, consumerMember, consumerMonthlyCard);
//微信退款 //微信退款
// if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode()) && request.getAmount().compareTo(BigDecimal.ZERO) == 0) { // if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode()) && request.getAmount().compareTo(BigDecimal.ZERO) == 0) {
// 退款task, 定时任务退优惠券 // 退款task, 定时任务退优惠券
...@@ -2870,16 +2940,19 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2870,16 +2940,19 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setMemberDiscount(BigDecimal.ZERO); priceResponse.setMemberDiscount(BigDecimal.ZERO);
priceResponse.setTotalFee(payPrice); priceResponse.setTotalFee(payPrice);
priceResponse.setTotalFeeNow(payPrice); priceResponse.setTotalFeeNow(payPrice);
// priceResponse.setDiscount(BigDecimal.ZERO);
SConsumerCoupon consumerCoupon = consumerCouponService.getById(request.getCouponId()); SConsumerCoupon consumerCoupon = consumerCouponService.getById(request.getCouponId());
computedCouponPrice(request, priceResponse, user, consumerCoupon); computedCouponPrice(request, priceResponse, user, consumerCoupon);
priceResponse.setDuration(new BigDecimal(0)); priceResponse.setDuration(new BigDecimal(0));
priceResponse.setBalance(new BigDecimal(0)); priceResponse.setBalance(new BigDecimal(0));
priceResponse.setRemainingBalance(new BigDecimal(0)); priceResponse.setRemainingBalance(new BigDecimal(0));
priceResponse.setRemainingDuration(new BigDecimal(0)); priceResponse.setRemainingDuration(new BigDecimal(0));
priceResponse.setMonthlyCardId(null);
priceResponse.setSecondaryCardId(null);
if (priceResponse.getPayFee().compareTo(new BigDecimal(0)) > 0) { if (priceResponse.getPayFee().compareTo(new BigDecimal(0)) > 0) {
if (ObjectUtil.isNotEmpty(consumerWallet) && ObjectUtil.isNotEmpty(consumerMember)) { if (ObjectUtil.isNotEmpty(consumerWallet) && ObjectUtil.isNotEmpty(consumerMember)) {
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())); MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
priceResponse.setDiscount(memberConfig.getDiscountRatio());
if (consumerWallet.getBalance().compareTo(priceResponse.getPayFee()) >= 0) { if (consumerWallet.getBalance().compareTo(priceResponse.getPayFee()) >= 0) {
BigDecimal payFee = priceResponse.getPayFee(); BigDecimal payFee = priceResponse.getPayFee();
BigDecimal divide = priceResponse.getPayFee().multiply(memberConfig.getDiscountRatio()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP); BigDecimal divide = priceResponse.getPayFee().multiply(memberConfig.getDiscountRatio()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
...@@ -3180,21 +3253,21 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -3180,21 +3253,21 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setDiscountRatio(memberConfig.getDiscountRatio()); priceResponse.setDiscountRatio(memberConfig.getDiscountRatio());
priceResponse.setDiscount(memberConfig.getDiscountRatio()); priceResponse.setDiscount(memberConfig.getDiscountRatio());
priceResponse.setTotalFee(totalFee); priceResponse.setTotalFee(totalFee);
priceResponse.setAvailableDuration(consumerMonthlyCard.getFreeDuration()); priceResponse.setAvailableDuration(consumerMonthlyCard.getFreeDuration().add(consumerWallet.getRemainingDuration()));
if (consumerMonthlyCard.getFreeDuration().compareTo(timeLong) >= 0) { if (priceResponse.getAvailableDuration().compareTo(timeLong) >= 0) {
priceResponse.setDuration(timeLong); priceResponse.setDuration(timeLong);
priceResponse.setRemainingDuration(consumerMonthlyCard.getFreeDuration().subtract(timeLong)); priceResponse.setRemainingDuration(priceResponse.getAvailableDuration().subtract(timeLong));
totalFee = new BigDecimal(0); totalFee = new BigDecimal(0);
priceResponse.setDiscount(BigDecimal.ZERO); priceResponse.setDiscount(BigDecimal.ZERO);
priceResponse.setMemberDiscount(new BigDecimal(0.00)); priceResponse.setMemberDiscount(new BigDecimal(0.00));
priceResponse.setTotalFeeNow(priceResponse.getTotalFee()); priceResponse.setTotalFeeNow(priceResponse.getTotalFee());
priceResponse.setMonthlyCardId(consumerMonthlyCard.getId()); priceResponse.setMonthlyCardId(consumerMonthlyCard.getId());
priceResponse.setPayFee(BigDecimal.ZERO); priceResponse.setPayFee(BigDecimal.ZERO);
} else if (consumerMonthlyCard.getFreeDuration().compareTo(timeLong) < 0) { } else if (priceResponse.getAvailableDuration().compareTo(timeLong) < 0) {
priceResponse.setDuration(consumerMonthlyCard.getFreeDuration()); priceResponse.setDuration(priceResponse.getAvailableDuration());
priceResponse.setRemainingDuration(new BigDecimal(0)); priceResponse.setRemainingDuration(new BigDecimal(0));
//时长的金额 //时长的金额
BigDecimal remainingBalance = consumerMonthlyCard.getFreeDuration().multiply(room.getPrice()); BigDecimal remainingBalance = priceResponse.getAvailableDuration().multiply(room.getPrice());
//恢复原价 //恢复原价
// totalFee = totalFee.divide(memberConfig.getDiscountRatio(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); // totalFee = totalFee.divide(memberConfig.getDiscountRatio(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
//原价减时长 //原价减时长
......
package share.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.DateUtils;
import share.system.domain.WheelGame;
import share.system.mapper.WheelGameMapper;
import share.system.service.WheelGameService;
import java.util.List;
/**
* 转盘游戏Service业务层处理
*
* @author wuwenlong
* @date 2024-11-12
*/
@Service
public class WheelGameServiceImpl extends ServiceImpl<WheelGameMapper, WheelGame> implements WheelGameService {
@Autowired
private WheelGameMapper wheelGameMapper;
/**
* 查询转盘游戏
*
* @param id 转盘游戏主键
* @return 转盘游戏
*/
@Override
public WheelGame selectWheelGameById(Long id) {
return wheelGameMapper.selectWheelGameById(id);
}
/**
* 查询转盘游戏列表
*
* @param wheelGame 转盘游戏
* @return 转盘游戏
*/
@Override
public List<WheelGame> selectWheelGameList(WheelGame wheelGame) {
return wheelGameMapper.selectWheelGameList(wheelGame);
}
/**
* 新增转盘游戏
*
* @param wheelGame 转盘游戏
* @return 结果
*/
@Override
public int insertWheelGame(WheelGame wheelGame) {
wheelGame.setCreateTime(DateUtils.getNowDate());
return wheelGameMapper.insertWheelGame(wheelGame);
}
/**
* 修改转盘游戏
*
* @param wheelGame 转盘游戏
* @return 结果
*/
@Override
public int updateWheelGame(WheelGame wheelGame) {
wheelGame.setUpdateTime(DateUtils.getNowDate());
return wheelGameMapper.updateWheelGame(wheelGame);
}
/**
* 批量删除转盘游戏
*
* @param ids 需要删除的转盘游戏主键
* @return 结果
*/
@Override
public int deleteWheelGameByIds(Long[] ids) {
return wheelGameMapper.deleteWheelGameByIds(ids);
}
/**
* 删除转盘游戏信息
*
* @param id 转盘游戏主键
* @return 结果
*/
@Override
public int deleteWheelGameById(Long id) {
return wheelGameMapper.deleteWheelGameById(id);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.system.mapper.LotteryRecordsLogMapper">
<resultMap type="LotteryRecordsLog" id="LotteryRecordsLogResult">
<result property="id" column="id"/>
<result property="gameId" column="game_id"/>
<result property="userId" column="user_id"/>
<result property="userName" column="user_name"/>
<result property="phone" column="phone"/>
<result property="drawTime" column="draw_time"/>
<result property="isHit" column="is_hit"/>
<result property="hitPrize" column="hit_prize"/>
<result property="isSend" column="is_send"/>
<result property="sendMsg" column="send_msg"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectLotteryRecordsLogVo">
select id,
game_id,
user_id,
user_name,
phone,
draw_time,
is_hit,
hit_prize,
is_send,
send_msg,
create_by,
create_time,
update_by,
update_time,
remark
from s_lottery_records_log
</sql>
<select id="selectLotteryRecordsLogList" parameterType="LotteryRecordsLog" resultMap="LotteryRecordsLogResult">
<include refid="selectLotteryRecordsLogVo"/>
<where>
<if test="gameId != null ">and game_id = #{gameId}</if>
<if test="userId != null ">and user_id = #{userId}</if>
<if test="userName != null and userName != ''">and user_name like concat('%', #{userName}, '%')</if>
<if test="phone != null and phone != ''">and phone = #{phone}</if>
<if test="drawTime != null ">and draw_time = #{drawTime}</if>
<if test="isHit != null ">and is_hit = #{isHit}</if>
<if test="hitPrize != null and hitPrize != ''">and hit_prize = #{hitPrize}</if>
<if test="isSend != null ">and is_send = #{isSend}</if>
<if test="sendMsg != null and sendMsg != ''">and send_msg = #{sendMsg}</if>
</where>
</select>
<select id="selectLotteryRecordsLogById" parameterType="Long" resultMap="LotteryRecordsLogResult">
<include refid="selectLotteryRecordsLogVo"/>
where id = #{id}
</select>
<insert id="insertLotteryRecordsLog" parameterType="LotteryRecordsLog" useGeneratedKeys="true" keyProperty="id">
insert into s_lottery_records_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="gameId != null">game_id,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null">user_name,</if>
<if test="phone != null">phone,</if>
<if test="drawTime != null">draw_time,</if>
<if test="isHit != null">is_hit,</if>
<if test="hitPrize != null">hit_prize,</if>
<if test="isSend != null">is_send,</if>
<if test="sendMsg != null">send_msg,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="gameId != null">#{gameId},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null">#{userName},</if>
<if test="phone != null">#{phone},</if>
<if test="drawTime != null">#{drawTime},</if>
<if test="isHit != null">#{isHit},</if>
<if test="hitPrize != null">#{hitPrize},</if>
<if test="isSend != null">#{isSend},</if>
<if test="sendMsg != null">#{sendMsg},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateLotteryRecordsLog" parameterType="LotteryRecordsLog">
update s_lottery_records_log
<trim prefix="SET" suffixOverrides=",">
<if test="gameId != null">game_id = #{gameId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="drawTime != null">draw_time = #{drawTime},</if>
<if test="isHit != null">is_hit = #{isHit},</if>
<if test="hitPrize != null">hit_prize = #{hitPrize},</if>
<if test="isSend != null">is_send = #{isSend},</if>
<if test="sendMsg != null">send_msg = #{sendMsg},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteLotteryRecordsLogById" parameterType="Long">
delete
from s_lottery_records_log
where id = #{id}
</delete>
<delete id="deleteLotteryRecordsLogByIds" parameterType="String">
delete from s_lottery_records_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.system.mapper.PointActivitiesConfMapper">
<resultMap type="PointActivitiesConfVo" id="PointActivitiesConfResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="pointsRequired" column="points_required"/>
<result property="timeInterval" column="time_interval"/>
<result property="couponId" column="coupon_id"/>
<result property="couponName" column="coupon_name"/>
<result property="collectionDeadline" column="collection_deadline"/>
<result property="couponDuration" column="coupon_duration"/>
<result property="collectionResetPeriod" column="collection_reset_period"/>
<result property="isOpen" column="is_open"/>
<result property="isDelete" column="is_delete"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectPointActivitiesConfVo">
select id,
name,
points_required,
time_interval,
coupon_id,
collection_deadline,
coupon_duration,
collection_reset_period,
is_open,
is_delete,
create_by,
create_time,
update_by,
update_time,
remark
from s_point_activities_conf
</sql>
<select id="selectPointActivitiesConfList" parameterType="PointActivitiesConf"
resultMap="PointActivitiesConfResult">
select p.id,
p.name,
p.points_required,
p.time_interval,
p.coupon_id,
c.name as coupon_name,
p.collection_deadline,
p.coupon_duration,
p.collection_reset_period,
p.is_open,
p.is_delete,
p.create_by,
p.create_time,
p.update_by,
p.update_time,
p. remark
from s_point_activities_conf p left join s_coupon c on p.coupon_id = c.id
<where>
<if test="name != null and name != ''">and p.name like concat('%', #{name}, '%')</if>
<if test="couponName != null and couponName != ''">and c.name like concat('%', #{couponName}, '%')</if>
<if test="pointsRequired != null ">and p.points_required = #{pointsRequired}</if>
<if test="timeInterval != null ">and p.time_interval = #{timeInterval}</if>
<if test="couponId != null ">and p.coupon_id = #{couponId}</if>
<if test="collectionDeadline != null ">and p.collection_deadline = #{collectionDeadline}</if>
<if test="couponDuration != null ">and p.coupon_duration = #{couponDuration}</if>
<if test="collectionResetPeriod != null ">and p.collection_reset_period = #{collectionResetPeriod}</if>
<if test="isOpen != null ">and p.is_open = #{isOpen}</if>
<if test="isDelete != null ">and p.is_delete = #{isDelete}</if>
</where>
</select>
<select id="selectPointActivitiesConfById" parameterType="Long" resultMap="PointActivitiesConfResult">
<include refid="selectPointActivitiesConfVo"/>
where id = #{id}
</select>
<insert id="insertPointActivitiesConf" parameterType="PointActivitiesConf" useGeneratedKeys="true" keyProperty="id">
insert into s_point_activities_conf
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="pointsRequired != null">points_required,</if>
<if test="timeInterval != null">time_interval,</if>
<if test="couponId != null">coupon_id,</if>
<if test="collectionDeadline != null">collection_deadline,</if>
<if test="couponDuration != null">coupon_duration,</if>
<if test="collectionResetPeriod != null">collection_reset_period,</if>
<if test="isOpen != null">is_open,</if>
<if test="isDelete != null">is_delete,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="pointsRequired != null">#{pointsRequired},</if>
<if test="timeInterval != null">#{timeInterval},</if>
<if test="couponId != null">#{couponId},</if>
<if test="collectionDeadline != null">#{collectionDeadline},</if>
<if test="couponDuration != null">#{couponDuration},</if>
<if test="collectionResetPeriod != null">#{collectionResetPeriod},</if>
<if test="isOpen != null">#{isOpen},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updatePointActivitiesConf" parameterType="PointActivitiesConf">
update s_point_activities_conf
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="pointsRequired != null">points_required = #{pointsRequired},</if>
<if test="timeInterval != null">time_interval = #{timeInterval},</if>
<if test="couponId != null">coupon_id = #{couponId},</if>
<if test="collectionDeadline != null">collection_deadline = #{collectionDeadline},</if>
<if test="couponDuration != null">coupon_duration = #{couponDuration},</if>
<if test="collectionResetPeriod != null">collection_reset_period = #{collectionResetPeriod},</if>
<if test="isOpen != null">is_open = #{isOpen},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePointActivitiesConfById" parameterType="Long">
delete
from s_point_activities_conf
where id = #{id}
</delete>
<delete id="deletePointActivitiesConfByIds" parameterType="String">
delete from s_point_activities_conf where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.system.mapper.PointActivitiesMapper">
<resultMap type="PointActivitiesVo" id="PointActivitiesResult">
<result property="id" column="id"/>
<result property="consumerId" column="consumer_id"/>
<result property="nickName" column="nick_name"/>
<result property="avatar" column="avatar"/>
<result property="phone" column="phone"/>
<result property="confId" column="conf_id"/>
<result property="confName" column="conf_name"/>
<result property="couponId" column="coupon_id"/>
<result property="couponName" column="coupon_name"/>
<result property="points" column="points"/>
<result property="lastConsumptionTime" column="last_consumption_time"/>
<result property="isReceive" column="is_receive"/>
<result property="couponReceived" column="coupon_received"/>
<result property="receivedDate" column="received_date"/>
<result property="couponExpirationDate" column="coupon_expiration_date"/>
<result property="isDelete" column="is_delete"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectPointActivitiesVo">
select id,
consumer_id,
conf_id,
coupon_id,
points,
last_consumption_time,
is_receive,
coupon_received,
received_date,
coupon_expiration_date,
is_delete,
create_by,
create_time,
update_by,
update_time,
remark
from s_point_activities
</sql>
<select id="selectPointActivitiesList" parameterType="PointActivities" resultMap="PointActivitiesResult">
select
p.id,
p.consumer_id,
c.nick_name as 'nick_name',
c.avatar as 'avatar',
c.phone as 'phone',
p.conf_id,
c2.name as 'conf_name',
p. coupon_id,
c1.name as 'coupon_name',
p.points,
p. last_consumption_time,
p.is_receive,
p.coupon_received,
p.received_date,
p. coupon_expiration_date,
p.is_delete,
p. create_by,
p. create_time,
p. update_by,
p. update_time,
p. remark
from s_point_activities p left join s_consumer c on p.consumer_id = c.id
left join s_coupon c1 on p.coupon_id = c1.id
left join s_point_activities_conf c2 on p.conf_id = c2.id
<where>
<if test="consumerId != null ">and p.consumer_id = #{consumerId}</if>
<if test="nickName != null ">and c.nick_name like concat('%', #{nickName}, '%')</if>
<if test="confName != null ">and c2.name like concat('%', #{confName}, '%')</if>
<if test="couponName != null ">and c1.name like concat('%', #{couponName}, '%')</if>
<if test="confId != null ">and p.conf_id = #{confId}</if>
<if test="couponId != null ">and p.coupon_id = #{couponId}</if>
<if test="points != null ">and p.points = #{points}</if>
<if test="lastConsumptionTime != null ">and p.last_consumption_time = #{lastConsumptionTime}</if>
<if test="isReceive != null ">and p.is_receive = #{isReceive}</if>
<if test="couponReceived != null ">and p.coupon_received = #{couponReceived}</if>
<if test="receivedDate != null ">and p.received_date = #{receivedDate}</if>
<if test="couponExpirationDate != null ">and p.coupon_expiration_date = #{couponExpirationDate}</if>
<if test="isDelete != null ">and p.is_delete = #{isDelete}</if>
</where>
</select>
<select id="selectPointActivitiesById" parameterType="Long" resultMap="PointActivitiesResult">
<include refid="selectPointActivitiesVo"/>
where id = #{id}
</select>
<insert id="insertPointActivities" parameterType="PointActivities" useGeneratedKeys="true" keyProperty="id">
insert into s_point_activities
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="consumerId != null">consumer_id,</if>
<if test="confId != null">conf_id,</if>
<if test="couponId != null">coupon_id,</if>
<if test="points != null">points,</if>
<if test="lastConsumptionTime != null">last_consumption_time,</if>
<if test="isReceive != null">is_receive,</if>
<if test="couponReceived != null">coupon_received,</if>
<if test="receivedDate != null">received_date,</if>
<if test="couponExpirationDate != null">coupon_expiration_date,</if>
<if test="isDelete != null">is_delete,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="consumerId != null">#{consumerId},</if>
<if test="confId != null">#{confId},</if>
<if test="couponId != null">#{couponId},</if>
<if test="points != null">#{points},</if>
<if test="lastConsumptionTime != null">#{lastConsumptionTime},</if>
<if test="isReceive != null">#{isReceive},</if>
<if test="couponReceived != null">#{couponReceived},</if>
<if test="receivedDate != null">#{receivedDate},</if>
<if test="couponExpirationDate != null">#{couponExpirationDate},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updatePointActivities" parameterType="PointActivities">
update s_point_activities
<trim prefix="SET" suffixOverrides=",">
<if test="consumerId != null">consumer_id = #{consumerId},</if>
<if test="confId != null">conf_id = #{confId},</if>
<if test="couponId != null">coupon_id = #{couponId},</if>
<if test="points != null">points = #{points},</if>
<if test="lastConsumptionTime != null">last_consumption_time = #{lastConsumptionTime},</if>
<if test="isReceive != null">is_receive = #{isReceive},</if>
<if test="couponReceived != null">coupon_received = #{couponReceived},</if>
<if test="receivedDate != null">received_date = #{receivedDate},</if>
<if test="couponExpirationDate != null">coupon_expiration_date = #{couponExpirationDate},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePointActivitiesById" parameterType="Long">
delete
from s_point_activities
where id = #{id}
</delete>
<delete id="deletePointActivitiesByIds" parameterType="String">
delete from s_point_activities where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.system.mapper.PrizeMapper">
<resultMap type="PrizeVo" id="PrizeResult">
<result property="id" column="id"/>
<result property="gameId" column="game_id"/>
<result property="gameName" column="game_name"/>
<result property="couponName" column="coupon_name"/>
<result property="couponId" column="coupon_id"/>
<result property="prizeType" column="prize_type"/>
<result property="prizeName" column="prize_name"/>
<result property="prizeValue" column="prize_value"/>
<result property="currentNum" column="current_num"/>
<result property="maxNum" column="max_num"/>
<result property="ratio" column="ratio"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectPrizeVo">
select id,
game_id,
coupon_id,
prize_type,
prize_name,
prize_value,
current_num,
max_num,
ratio,
create_by,
create_time,
update_by,
update_time,
remark
from s_prize
</sql>
<select id="selectPrizeList" parameterType="Prize" resultMap="PrizeResult">
select p.id,
p.game_id,
w.name as 'game_name',
p.coupon_id,
c.name as 'coupon_name',
p. prize_type,
p.prize_name,
p.prize_value,
p.current_num,
p.max_num,
p.ratio,
p. create_by,
p. create_time,
p. update_by,
p. update_time,
p. remark
from s_prize p left join s_wheel_game w on p.game_id = w.id
left join s_coupon c on p.coupon_id = c.id
<where>
<if test="gameId != null ">and p.game_id = #{gameId}</if>
<if test="couponId != null ">and p.coupon_id = #{couponId}</if>
<if test="prizeType != null and prizeType != ''">and p.prize_type = #{prizeType}</if>
<if test="prizeName != null and prizeName != ''">and p.prize_name like concat('%', #{prizeName}, '%')</if>
<if test="prizeValue != null ">and p.prize_value = #{prizeValue}</if>
<if test="currentNum != null ">and p.current_num = #{currentNum}</if>
<if test="maxNum != null ">and p.max_num = #{maxNum}</if>
<if test="ratio != null ">and p.ratio = #{ratio}</if>
</where>
</select>
<select id="selectPrizeById" parameterType="Long" resultMap="PrizeResult">
<include refid="selectPrizeVo"/>
where id = #{id}
</select>
<insert id="insertPrize" parameterType="Prize" useGeneratedKeys="true" keyProperty="id">
insert into s_prize
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="gameId != null">game_id,</if>
<if test="couponId != null">coupon_id,</if>
<if test="prizeType != null">prize_type,</if>
<if test="prizeName != null">prize_name,</if>
<if test="prizeValue != null">prize_value,</if>
<if test="currentNum != null">current_num,</if>
<if test="maxNum != null">max_num,</if>
<if test="ratio != null">ratio,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="gameId != null">#{gameId},</if>
<if test="couponId != null">#{couponId}</if>
<if test="prizeType != null">#{prizeType},</if>
<if test="prizeName != null">#{prizeName},</if>
<if test="prizeValue != null">#{prizeValue},</if>
<if test="currentNum != null">#{currentNum},</if>
<if test="maxNum != null">#{maxNum},</if>
<if test="ratio != null">#{ratio},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updatePrize" parameterType="Prize">
update s_prize
<trim prefix="SET" suffixOverrides=",">
<if test="gameId != null">game_id = #{gameId},</if>
<if test="couponId != null">coupon_id = #{couponId}</if>
<if test="prizeType != null">prize_type = #{prizeType},</if>
<if test="prizeName != null">prize_name = #{prizeName},</if>
<if test="prizeValue != null">prize_value = #{prizeValue},</if>
<if test="currentNum != null">current_num = #{currentNum},</if>
<if test="maxNum != null">max_num = #{maxNum},</if>
<if test="ratio != null">ratio = #{ratio},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePrizeById" parameterType="Long">
delete
from s_prize
where id = #{id}
</delete>
<delete id="deletePrizeByIds" parameterType="String">
delete from s_prize where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
<if test="usageCount != null ">and l.usage_count = #{usageCount}</if> <if test="usageCount != null ">and l.usage_count = #{usageCount}</if>
<if test="residueCount != null ">and l.residue_count = #{residueCount}</if> <if test="residueCount != null ">and l.residue_count = #{residueCount}</if>
order by l.create_time order by l.create_time desc
</select> </select>
<select id="selectSecondaryCardLogById" parameterType="Long" resultMap="SecondaryCardLogResult"> <select id="selectSecondaryCardLogById" parameterType="Long" resultMap="SecondaryCardLogResult">
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.system.mapper.WheelGameMapper">
<resultMap type="WheelGame" id="WheelGameResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="startTime" column="start_time"/>
<result property="endTime" column="end_time"/>
<result property="description" column="description"/>
<result property="dayLimit" column="day_limit"/>
<result property="singleLimit" column="single_limit"/>
<result property="isOpen" column="is_open"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectWheelGameVo">
select id,
name,
start_time,
end_time,
description,
day_limit,
single_limit,
is_open,
create_by,
create_time,
update_by,
update_time,
remark
from s_wheel_game
</sql>
<select id="selectWheelGameList" parameterType="WheelGame" resultMap="WheelGameResult">
<include refid="selectWheelGameVo"/>
<where>
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
<if test="startTime != null ">and start_time = #{startTime}</if>
<if test="endTime != null ">and end_time = #{endTime}</if>
<if test="description != null and description != ''">and description = #{description}</if>
<if test="dayLimit != null ">and day_limit = #{dayLimit}</if>
<if test="singleLimit != null ">and single_limit = #{singleLimit}</if>
<if test="isOpen != null ">and is_open = #{isOpen}</if>
</where>
</select>
<select id="selectWheelGameById" parameterType="Long" resultMap="WheelGameResult">
<include refid="selectWheelGameVo"/>
where id = #{id}
</select>
<insert id="insertWheelGame" parameterType="WheelGame" useGeneratedKeys="true" keyProperty="id">
insert into s_wheel_game
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="description != null">description,</if>
<if test="dayLimit != null">day_limit,</if>
<if test="singleLimit != null">single_limit,</if>
<if test="isOpen != null">is_open,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="description != null">#{description},</if>
<if test="dayLimit != null">#{dayLimit},</if>
<if test="singleLimit != null">#{singleLimit},</if>
<if test="isOpen != null">#{isOpen},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateWheelGame" parameterType="WheelGame">
update s_wheel_game
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="description != null">description = #{description},</if>
<if test="dayLimit != null">day_limit = #{dayLimit},</if>
<if test="singleLimit != null">single_limit = #{singleLimit},</if>
<if test="isOpen != null">is_open = #{isOpen},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWheelGameById" parameterType="Long">
delete
from s_wheel_game
where id = #{id}
</delete>
<delete id="deleteWheelGameByIds" parameterType="String">
delete from s_wheel_game where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment