Commit 7b02730d by 吕明尚

增加会员,活动功能

parent c0ce1a0b
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
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.Activity;
import share.system.service.ActivityService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 活动Controller
*
* @author wuwenlong
* @date 2024-06-24
*/
@RestController
@RequestMapping("/system/activity")
public class ActivityController extends BaseController {
@Autowired
private ActivityService activityService;
/**
* 查询活动列表
*/
@GetMapping("/list")
public TableDataInfo list(Activity activity) {
startPage();
List<Activity> list = activityService.selectActivityList(activity);
return getDataTable(list);
}
/**
* 导出活动列表
*/
@Log(title = "活动", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Activity activity) {
List<Activity> list = activityService.selectActivityList(activity);
ExcelUtil<Activity> util = new ExcelUtil<Activity>(Activity.class);
util.exportExcel(response, list, "活动数据");
}
/**
* 获取活动详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(activityService.selectActivityById(id));
}
/**
* 新增活动
*/
@Log(title = "活动", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Activity activity) {
return toAjax(activityService.insertActivity(activity));
}
/**
* 修改活动
*/
@Log(title = "活动", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Activity activity) {
return toAjax(activityService.updateActivity(activity));
}
/**
* 删除活动
*/
@Log(title = "活动", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(activityService.deleteActivityByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
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.BalanceLog;
import share.system.service.BalanceLogService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 余额日志Controller
*
* @author wuwenlong
* @date 2024-06-24
*/
@RestController
@RequestMapping("/system/balanceLog")
public class BalanceLogController extends BaseController {
@Autowired
private BalanceLogService balanceLogService;
/**
* 查询余额日志列表
*/
@GetMapping("/list")
public TableDataInfo list(BalanceLog balanceLog) {
startPage();
List<BalanceLog> list = balanceLogService.selectBalanceLogList(balanceLog);
return getDataTable(list);
}
/**
* 导出余额日志列表
*/
@Log(title = "余额日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BalanceLog balanceLog) {
List<BalanceLog> list = balanceLogService.selectBalanceLogList(balanceLog);
ExcelUtil<BalanceLog> util = new ExcelUtil<BalanceLog>(BalanceLog.class);
util.exportExcel(response, list, "余额日志数据");
}
/**
* 获取余额日志详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(balanceLogService.selectBalanceLogById(id));
}
/**
* 新增余额日志
*/
@Log(title = "余额日志", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BalanceLog balanceLog) {
return toAjax(balanceLogService.insertBalanceLog(balanceLog));
}
/**
* 修改余额日志
*/
@Log(title = "余额日志", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BalanceLog balanceLog) {
return toAjax(balanceLogService.updateBalanceLog(balanceLog));
}
/**
* 删除余额日志
*/
@Log(title = "余额日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(balanceLogService.deleteBalanceLogByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
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.ConsumerMember;
import share.system.domain.vo.ConsumerMemberVo;
import share.system.service.ConsumerMemberService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 会员用户Controller
*
* @author wuwenlong
* @date 2024-06-24
*/
@RestController
@RequestMapping("/system/member")
public class ConsumerMemberController extends BaseController {
@Autowired
private ConsumerMemberService consumerMemberService;
/**
* 查询会员用户列表
*/
@GetMapping("/list")
public TableDataInfo list(ConsumerMemberVo consumerMember) {
startPage();
List<ConsumerMemberVo> list = consumerMemberService.selectConsumerMemberList(consumerMember);
return getDataTable(list);
}
/**
* 导出会员用户列表
*/
@Log(title = "会员用户", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ConsumerMemberVo consumerMember) {
List<ConsumerMemberVo> list = consumerMemberService.selectConsumerMemberList(consumerMember);
ExcelUtil<ConsumerMemberVo> util = new ExcelUtil<>(ConsumerMemberVo.class);
util.exportExcel(response, list, "会员用户数据");
}
/**
* 获取会员用户详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(consumerMemberService.selectConsumerMemberById(id));
}
/**
* 新增会员用户
*/
@Log(title = "会员用户", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ConsumerMember consumerMember) {
return toAjax(consumerMemberService.insertConsumerMember(consumerMember));
}
/**
* 修改会员用户
*/
@Log(title = "会员用户", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ConsumerMember consumerMember) {
return toAjax(consumerMemberService.updateConsumerMember(consumerMember));
}
/**
* 删除会员用户
*/
@Log(title = "会员用户", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(consumerMemberService.deleteConsumerMemberByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
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.ConsumerWallet;
import share.system.domain.vo.ConsumerWalletVo;
import share.system.service.ConsumerWalletService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 会员钱包Controller
*
* @author wuwenlong
* @date 2024-06-24
*/
@RestController
@RequestMapping("/system/wallet")
public class ConsumerWalletController extends BaseController {
@Autowired
private ConsumerWalletService consumerWalletService;
/**
* 查询会员钱包列表
*/
@GetMapping("/list")
public TableDataInfo list(ConsumerWalletVo consumerWallet) {
startPage();
List<ConsumerWalletVo> list = consumerWalletService.selectConsumerWalletList(consumerWallet);
return getDataTable(list);
}
/**
* 导出会员钱包列表
*/
@Log(title = "会员钱包", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ConsumerWalletVo consumerWallet) {
List<ConsumerWalletVo> list = consumerWalletService.selectConsumerWalletList(consumerWallet);
ExcelUtil<ConsumerWalletVo> util = new ExcelUtil<ConsumerWalletVo>(ConsumerWalletVo.class);
util.exportExcel(response, list, "会员钱包数据");
}
/**
* 获取会员钱包详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(consumerWalletService.selectConsumerWalletById(id));
}
/**
* 新增会员钱包
*/
@Log(title = "会员钱包", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ConsumerWallet consumerWallet) {
return toAjax(consumerWalletService.insertConsumerWallet(consumerWallet));
}
/**
* 修改会员钱包
*/
@Log(title = "会员钱包", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ConsumerWallet consumerWallet) {
return toAjax(consumerWalletService.updateConsumerWallet(consumerWallet));
}
/**
* 删除会员钱包
*/
@Log(title = "会员钱包", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(consumerWalletService.deleteConsumerWalletByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
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.DurationLog;
import share.system.service.DurationLogService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 时长日志Controller
*
* @author wuwenlong
* @date 2024-06-24
*/
@RestController
@RequestMapping("/system/durationLog")
public class DurationLogController extends BaseController {
@Autowired
private DurationLogService durationLogService;
/**
* 查询时长日志列表
*/
@GetMapping("/list")
public TableDataInfo list(DurationLog durationLog) {
startPage();
List<DurationLog> list = durationLogService.selectDurationLogList(durationLog);
return getDataTable(list);
}
/**
* 导出时长日志列表
*/
@Log(title = "时长日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DurationLog durationLog) {
List<DurationLog> list = durationLogService.selectDurationLogList(durationLog);
ExcelUtil<DurationLog> util = new ExcelUtil<DurationLog>(DurationLog.class);
util.exportExcel(response, list, "时长日志数据");
}
/**
* 获取时长日志详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(durationLogService.selectDurationLogById(id));
}
/**
* 新增时长日志
*/
@Log(title = "时长日志", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DurationLog durationLog) {
return toAjax(durationLogService.insertDurationLog(durationLog));
}
/**
* 修改时长日志
*/
@Log(title = "时长日志", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DurationLog durationLog) {
return toAjax(durationLogService.updateDurationLog(durationLog));
}
/**
* 删除时长日志
*/
@Log(title = "时长日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(durationLogService.deleteDurationLogByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
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.EquityMembersOrderConfig;
import share.system.service.EquityMembersOrderConfigService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 权益会员订单配置Controller
*
* @author wuwenlong
* @date 2024-06-24
*/
@RestController
@RequestMapping("/system/equityMembersOrderConfig")
public class EquityMembersOrderConfigController extends BaseController {
@Autowired
private EquityMembersOrderConfigService equityMembersOrderConfigService;
/**
* 查询权益会员订单配置列表
*/
@GetMapping("/list")
public TableDataInfo list(EquityMembersOrderConfig equityMembersOrderConfig) {
startPage();
List<EquityMembersOrderConfig> list = equityMembersOrderConfigService.selectEquityMembersOrderConfigList(equityMembersOrderConfig);
return getDataTable(list);
}
/**
* 导出权益会员订单配置列表
*/
@Log(title = "权益会员订单配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EquityMembersOrderConfig equityMembersOrderConfig) {
List<EquityMembersOrderConfig> list = equityMembersOrderConfigService.selectEquityMembersOrderConfigList(equityMembersOrderConfig);
ExcelUtil<EquityMembersOrderConfig> util = new ExcelUtil<EquityMembersOrderConfig>(EquityMembersOrderConfig.class);
util.exportExcel(response, list, "权益会员订单配置数据");
}
/**
* 获取权益会员订单配置详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(equityMembersOrderConfigService.selectEquityMembersOrderConfigById(id));
}
/**
* 新增权益会员订单配置
*/
@Log(title = "权益会员订单配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EquityMembersOrderConfig equityMembersOrderConfig) {
return toAjax(equityMembersOrderConfigService.insertEquityMembersOrderConfig(equityMembersOrderConfig));
}
/**
* 修改权益会员订单配置
*/
@Log(title = "权益会员订单配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EquityMembersOrderConfig equityMembersOrderConfig) {
return toAjax(equityMembersOrderConfigService.updateEquityMembersOrderConfig(equityMembersOrderConfig));
}
/**
* 删除权益会员订单配置
*/
@Log(title = "权益会员订单配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(equityMembersOrderConfigService.deleteEquityMembersOrderConfigByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
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.EquityMembersOrder;
import share.system.domain.vo.EquityMembersOrderVo;
import share.system.service.EquityMembersOrderService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 权益会员订单Controller
*
* @author wuwenlong
* @date 2024-06-24
*/
@RestController
@RequestMapping("/system/equityMembersOrder")
public class EquityMembersOrderController extends BaseController {
@Autowired
private EquityMembersOrderService equityMembersOrderService;
/**
* 查询权益会员订单列表
*/
@GetMapping("/list")
public TableDataInfo list(EquityMembersOrderVo equityMembersOrder) {
startPage();
List<EquityMembersOrderVo> list = equityMembersOrderService.selectEquityMembersOrderList(equityMembersOrder);
return getDataTable(list);
}
/**
* 导出权益会员订单列表
*/
@Log(title = "权益会员订单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EquityMembersOrderVo equityMembersOrder) {
List<EquityMembersOrderVo> list = equityMembersOrderService.selectEquityMembersOrderList(equityMembersOrder);
ExcelUtil<EquityMembersOrderVo> util = new ExcelUtil<EquityMembersOrderVo>(EquityMembersOrderVo.class);
util.exportExcel(response, list, "权益会员订单数据");
}
/**
* 获取权益会员订单详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(equityMembersOrderService.selectEquityMembersOrderById(id));
}
/**
* 新增权益会员订单
*/
@Log(title = "权益会员订单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EquityMembersOrder equityMembersOrder) {
return toAjax(equityMembersOrderService.insertEquityMembersOrder(equityMembersOrder));
}
/**
* 修改权益会员订单
*/
@Log(title = "权益会员订单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EquityMembersOrder equityMembersOrder) {
return toAjax(equityMembersOrderService.updateEquityMembersOrder(equityMembersOrder));
}
/**
* 删除权益会员订单
*/
@Log(title = "权益会员订单", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(equityMembersOrderService.deleteEquityMembersOrderByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
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.IntegralLog;
import share.system.service.IntegralLogService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 积分日志Controller
*
* @author wuwenlong
* @date 2024-06-24
*/
@RestController
@RequestMapping("/system/integralLog")
public class IntegralLogController extends BaseController {
@Autowired
private IntegralLogService integralLogService;
/**
* 查询积分日志列表
*/
@GetMapping("/list")
public TableDataInfo list(IntegralLog integralLog) {
startPage();
List<IntegralLog> list = integralLogService.selectIntegralLogList(integralLog);
return getDataTable(list);
}
/**
* 导出积分日志列表
*/
@Log(title = "积分日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, IntegralLog integralLog) {
List<IntegralLog> list = integralLogService.selectIntegralLogList(integralLog);
ExcelUtil<IntegralLog> util = new ExcelUtil<IntegralLog>(IntegralLog.class);
util.exportExcel(response, list, "积分日志数据");
}
/**
* 获取积分日志详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(integralLogService.selectIntegralLogById(id));
}
/**
* 新增积分日志
*/
@Log(title = "积分日志", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody IntegralLog integralLog) {
return toAjax(integralLogService.insertIntegralLog(integralLog));
}
/**
* 修改积分日志
*/
@Log(title = "积分日志", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody IntegralLog integralLog) {
return toAjax(integralLogService.updateIntegralLog(integralLog));
}
/**
* 删除积分日志
*/
@Log(title = "积分日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(integralLogService.deleteIntegralLogByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
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.MemberConfig;
import share.system.service.MemberConfigService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 会员配置Controller
*
* @author wuwenlong
* @date 2024-06-24
*/
@RestController
@RequestMapping("/system/memberConfig")
public class MemberConfigController extends BaseController {
@Autowired
private MemberConfigService memberConfigService;
/**
* 查询会员配置列表
*/
@GetMapping("/list")
public TableDataInfo list(MemberConfig memberConfig) {
startPage();
List<MemberConfig> list = memberConfigService.selectMemberConfigList(memberConfig);
return getDataTable(list);
}
@GetMapping("/query")
public R<List<MemberConfig>> query(MemberConfig memberConfig) {
return R.ok(memberConfigService.selectMemberConfigList(memberConfig));
}
/**
* 导出会员配置列表
*/
@Log(title = "会员配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MemberConfig memberConfig) {
List<MemberConfig> list = memberConfigService.selectMemberConfigList(memberConfig);
ExcelUtil<MemberConfig> util = new ExcelUtil<MemberConfig>(MemberConfig.class);
util.exportExcel(response, list, "会员配置数据");
}
/**
* 获取会员配置详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(memberConfigService.selectMemberConfigById(id));
}
/**
* 新增会员配置
*/
@Log(title = "会员配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MemberConfig memberConfig) {
return toAjax(memberConfigService.insertMemberConfig(memberConfig));
}
/**
* 修改会员配置
*/
@Log(title = "会员配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MemberConfig memberConfig) {
return toAjax(memberConfigService.updateMemberConfig(memberConfig));
}
/**
* 删除会员配置
*/
@Log(title = "会员配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(memberConfigService.deleteMemberConfigByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
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.RechargeConf;
import share.system.service.RechargeConfService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 充值配置Controller
*
* @author wuwenlong
* @date 2024-06-24
*/
@RestController
@RequestMapping("/system/rechargeConf")
public class RechargeConfController extends BaseController {
@Autowired
private RechargeConfService rechargeConfService;
/**
* 查询充值配置列表
*/
@GetMapping("/list")
public TableDataInfo list(RechargeConf rechargeConf) {
startPage();
List<RechargeConf> list = rechargeConfService.selectRechargeConfList(rechargeConf);
return getDataTable(list);
}
/**
* 导出充值配置列表
*/
@Log(title = "充值配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RechargeConf rechargeConf) {
List<RechargeConf> list = rechargeConfService.selectRechargeConfList(rechargeConf);
ExcelUtil<RechargeConf> util = new ExcelUtil<RechargeConf>(RechargeConf.class);
util.exportExcel(response, list, "充值配置数据");
}
/**
* 获取充值配置详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(rechargeConfService.selectRechargeConfById(id));
}
/**
* 新增充值配置
*/
@Log(title = "充值配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RechargeConf rechargeConf) {
return toAjax(rechargeConfService.insertRechargeConf(rechargeConf));
}
/**
* 修改充值配置
*/
@Log(title = "充值配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RechargeConf rechargeConf) {
return toAjax(rechargeConfService.updateRechargeConf(rechargeConf));
}
/**
* 删除充值配置
*/
@Log(title = "充值配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(rechargeConfService.deleteRechargeConfByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
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.Recharge;
import share.system.service.RechargeService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 充值记录Controller
*
* @author wuwenlong
* @date 2024-06-24
*/
@RestController
@RequestMapping("/system/recharge")
public class RechargeController extends BaseController {
@Autowired
private RechargeService rechargeService;
/**
* 查询充值记录列表
*/
@GetMapping("/list")
public TableDataInfo list(Recharge recharge) {
startPage();
List<Recharge> list = rechargeService.selectRechargeList(recharge);
return getDataTable(list);
}
/**
* 导出充值记录列表
*/
@Log(title = "充值记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Recharge recharge) {
List<Recharge> list = rechargeService.selectRechargeList(recharge);
ExcelUtil<Recharge> util = new ExcelUtil<Recharge>(Recharge.class);
util.exportExcel(response, list, "充值记录数据");
}
/**
* 获取充值记录详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(rechargeService.selectRechargeById(id));
}
/**
* 新增充值记录
*/
@Log(title = "充值记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Recharge recharge) {
return toAjax(rechargeService.insertRecharge(recharge));
}
/**
* 修改充值记录
*/
@Log(title = "充值记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Recharge recharge) {
return toAjax(rechargeService.updateRecharge(recharge));
}
/**
* 删除充值记录
*/
@Log(title = "充值记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(rechargeService.deleteRechargeByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
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.RechargeCouponConf;
import share.system.service.RechargeCouponConfService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 充值优惠券配置Controller
*
* @author wuwenlong
* @date 2024-06-24
*/
@RestController
@RequestMapping("/system/rechargeCouponConf")
public class RechargeCouponConfController extends BaseController {
@Autowired
private RechargeCouponConfService rechargeCouponConfService;
/**
* 查询充值优惠券配置列表
*/
@GetMapping("/list")
public TableDataInfo list(RechargeCouponConf rechargeCouponConf) {
startPage();
List<RechargeCouponConf> list = rechargeCouponConfService.selectRechargeCouponConfList(rechargeCouponConf);
return getDataTable(list);
}
/**
* 导出充值优惠券配置列表
*/
@Log(title = "充值优惠券配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RechargeCouponConf rechargeCouponConf) {
List<RechargeCouponConf> list = rechargeCouponConfService.selectRechargeCouponConfList(rechargeCouponConf);
ExcelUtil<RechargeCouponConf> util = new ExcelUtil<RechargeCouponConf>(RechargeCouponConf.class);
util.exportExcel(response, list, "充值优惠券配置数据");
}
/**
* 获取充值优惠券配置详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(rechargeCouponConfService.selectRechargeCouponConfById(id));
}
/**
* 新增充值优惠券配置
*/
@Log(title = "充值优惠券配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RechargeCouponConf rechargeCouponConf) {
return toAjax(rechargeCouponConfService.insertRechargeCouponConf(rechargeCouponConf));
}
/**
* 修改充值优惠券配置
*/
@Log(title = "充值优惠券配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RechargeCouponConf rechargeCouponConf) {
return toAjax(rechargeCouponConfService.updateRechargeCouponConf(rechargeCouponConf));
}
/**
* 删除充值优惠券配置
*/
@Log(title = "充值优惠券配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(rechargeCouponConfService.deleteRechargeCouponConfByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
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.RechargeRefund;
import share.system.service.RechargeRefundService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 充值退款申请Controller
*
* @author wuwenlong
* @date 2024-06-24
*/
@RestController
@RequestMapping("/system/rechargeRefund")
public class RechargeRefundController extends BaseController {
@Autowired
private RechargeRefundService rechargeRefundService;
/**
* 查询充值退款申请列表
*/
@GetMapping("/list")
public TableDataInfo list(RechargeRefund rechargeRefund) {
startPage();
List<RechargeRefund> list = rechargeRefundService.selectRechargeRefundList(rechargeRefund);
return getDataTable(list);
}
/**
* 导出充值退款申请列表
*/
@Log(title = "充值退款申请", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RechargeRefund rechargeRefund) {
List<RechargeRefund> list = rechargeRefundService.selectRechargeRefundList(rechargeRefund);
ExcelUtil<RechargeRefund> util = new ExcelUtil<RechargeRefund>(RechargeRefund.class);
util.exportExcel(response, list, "充值退款申请数据");
}
/**
* 获取充值退款申请详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(rechargeRefundService.selectRechargeRefundById(id));
}
/**
* 新增充值退款申请
*/
@Log(title = "充值退款申请", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RechargeRefund rechargeRefund) {
return toAjax(rechargeRefundService.insertRechargeRefund(rechargeRefund));
}
/**
* 修改充值退款申请
*/
@Log(title = "充值退款申请", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RechargeRefund rechargeRefund) {
return toAjax(rechargeRefundService.updateRechargeRefund(rechargeRefund));
}
/**
* 删除充值退款申请
*/
@Log(title = "充值退款申请", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(rechargeRefundService.deleteRechargeRefundByIds(ids));
}
}
......@@ -151,5 +151,10 @@
<scope>system</scope>
<systemPath>${project.basedir}/src/lib/saobei-open-sdk-1.1.8.jar</systemPath>
</dependency>
<dependency>
<groupId>com.cronutils</groupId>
<artifactId>cron-utils</artifactId>
<version>9.1.3</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -2,6 +2,7 @@ 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;
......@@ -17,6 +18,7 @@ import java.math.BigDecimal;
* @date 2024-06-24
*/
@Data
@TableName(value = "s_activity")
public class Activity extends BaseEntity {
private static final long serialVersionUID = 1L;
......
......@@ -2,6 +2,7 @@ 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;
......@@ -19,6 +20,7 @@ import java.util.Date;
* @date 2024-06-24
*/
@Data
@TableName(value = "s_balance_log")
public class BalanceLog extends BaseEntity {
private static final long serialVersionUID = 1L;
......
......@@ -2,6 +2,7 @@ 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;
......@@ -18,6 +19,7 @@ import java.util.Date;
* @date 2024-06-24
*/
@Data
@TableName(value = "s_consumer_member")
public class ConsumerMember extends BaseEntity {
private static final long serialVersionUID = 1L;
......
......@@ -2,6 +2,7 @@ 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;
......@@ -17,6 +18,7 @@ import java.math.BigDecimal;
* @date 2024-06-24
*/
@Data
@TableName(value = "s_consumer_wallet")
public class ConsumerWallet extends BaseEntity {
private static final long serialVersionUID = 1L;
......
......@@ -2,6 +2,7 @@ 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;
......@@ -19,6 +20,7 @@ import java.util.Date;
* @date 2024-06-24
*/
@Data
@TableName(value = "s_equity_members_order")
public class EquityMembersOrder extends BaseEntity {
private static final long serialVersionUID = 1L;
......
......@@ -2,6 +2,7 @@ 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;
......@@ -17,6 +18,7 @@ import java.math.BigDecimal;
* @date 2024-06-24
*/
@Data
@TableName(value = "s_equity_members_order_config")
public class EquityMembersOrderConfig extends BaseEntity {
private static final long serialVersionUID = 1L;
......
......@@ -2,6 +2,7 @@ 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;
......@@ -19,6 +20,7 @@ import java.util.Date;
* @date 2024-06-24
*/
@Data
@TableName(value = "s_integral_log")
public class IntegralLog extends BaseEntity {
private static final long serialVersionUID = 1L;
......
......@@ -2,6 +2,7 @@ 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;
......@@ -17,6 +18,7 @@ import java.math.BigDecimal;
* @date 2024-06-24
*/
@Data
@TableName(value = "s_member_config")
public class MemberConfig extends BaseEntity {
private static final long serialVersionUID = 1L;
......
......@@ -2,6 +2,7 @@ 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;
......@@ -19,6 +20,7 @@ import java.util.Date;
* @date 2024-06-24
*/
@Data
@TableName(value = "s_recharge")
public class Recharge extends BaseEntity {
private static final long serialVersionUID = 1L;
......
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;
......@@ -15,6 +16,7 @@ import java.math.BigDecimal;
* @date 2024-06-24
*/
@Data
@TableName(value = "s_recharge_conf")
public class RechargeConf extends BaseEntity {
private static final long serialVersionUID = 1L;
......
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;
......@@ -15,6 +16,7 @@ import java.math.BigDecimal;
* @date 2024-06-24
*/
@Data
@TableName(value = "s_recharge_coupon_conf")
public class RechargeCouponConf extends BaseEntity {
private static final long serialVersionUID = 1L;
......
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;
......@@ -17,6 +18,7 @@ import java.util.Date;
* @date 2024-06-24
*/
@Data
@TableName(value = "s_recharge_refund")
public class RechargeRefund extends BaseEntity {
private static final long serialVersionUID = 1L;
......
package share.system.domain.vo;
import lombok.Data;
import share.system.domain.ConsumerMember;
import share.system.domain.ConsumerWallet;
import share.system.domain.SConsumer;
/**
......@@ -26,4 +28,8 @@ public class SConsumerVo extends SConsumer {
private Integer gating;
private ConsumerMember consumerMember;
private ConsumerWallet consumerWallet;
}
......@@ -6,10 +6,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Author wwl
......@@ -32,5 +30,11 @@ public class ComputedOrderPriceResponse implements Serializable {
@ApiModelProperty(value = "总金额")
private BigDecimal totalFee;
@ApiModelProperty(value = "优惠金额")
private BigDecimal discountFee;
@ApiModelProperty(value = "折扣比例")
private BigDecimal discountRatio;
}
......@@ -5,10 +5,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.DateUtils;
import share.system.domain.Activity;
import share.system.domain.SStore;
import share.system.mapper.ActivityMapper;
import share.system.service.ActivityService;
import share.system.service.ISStoreService;
import java.util.List;
import java.util.stream.Collectors;
/**
* 活动Service业务层处理
......@@ -20,6 +23,8 @@ import java.util.List;
public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> implements ActivityService {
@Autowired
private ActivityMapper activityMapper;
@Autowired
private ISStoreService storeService;
/**
* 查询活动
......@@ -52,6 +57,7 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> i
@Override
public int insertActivity(Activity activity) {
activity.setCreateTime(DateUtils.getNowDate());
activity.setStoreIds(storeService.list().stream().map(SStore::getId).collect(Collectors.toList()).stream().map(String::valueOf).collect(Collectors.joining(",")));
return activityMapper.insertActivity(activity);
}
......
......@@ -18,18 +18,13 @@ import share.common.enums.RoleTypeEnum;
import share.common.exception.base.BaseException;
import share.common.utils.BaseUtil;
import share.common.utils.DateUtil;
import share.system.domain.SConsumer;
import share.system.domain.SConsumerCoupon;
import share.system.domain.SConsumerToken;
import share.system.domain.SStoreConsumer;
import share.system.domain.*;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.SConsumerVo;
import share.system.mapper.SConsumerMapper;
import share.system.mapper.SStoreConsumerMapper;
import share.system.request.RegisterThirdSConsumerRequest;
import share.system.service.ISConsumerCouponService;
import share.system.service.SConsumerService;
import share.system.service.SConsumerTokenService;
import share.system.service.*;
import java.util.List;
......@@ -51,6 +46,10 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
private SStoreConsumerMapper storeConsumerMapper;
@Autowired
private SConsumerTokenService sConsumerTokenService;
@Autowired
private ConsumerWalletService consumerWalletService;
@Autowired
private ConsumerMemberService consumerMemberService;
/**
* 查询会员用户
......@@ -188,6 +187,8 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
}
SConsumerVo vo = new SConsumerVo();
BeanUtils.copyProperties(currentUser, vo);
vo.setConsumerMember(consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, currentUser.getId())));
vo.setConsumerWallet(consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, currentUser.getId())));
List<Long> longList = storeConsumerMapper.selectByConsumerId(currentUser.getId(), PositionEnum.CLEANER.getCode());
if (CollectionUtils.isEmpty(longList)) {
vo.setIsCleaner(false);
......
......@@ -9,6 +9,10 @@ import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cronutils.model.Cron;
import com.cronutils.model.definition.CronDefinitionBuilder;
import com.cronutils.model.time.ExecutionTime;
import com.cronutils.parser.CronParser;
import com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptGetConsumedReponseEntity;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
......@@ -47,10 +51,14 @@ import share.system.service.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 订单Service业务层处理
*
......@@ -131,7 +139,16 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Autowired
private SStoreConsumerMapper storeConsumerMapper;
private final static Long FIVE = 5l;
@Autowired
private ConsumerMemberService consumerMemberService;
@Autowired
private MemberConfigService memberConfigService;
@Autowired
private ActivityService activityService;
private final static Long FIVE = 5L;
/**
......@@ -153,8 +170,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
*/
@Override
public List<SOrder> selectSOrderList(SOrder sOrder) {
List<SOrder> orders = baseMapper.selectSOrderList(sOrder);
return orders;
return baseMapper.selectSOrderList(sOrder);
}
......@@ -425,7 +441,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
.ne(SOrder::getOrderNo, request.getOrderNo())))
&& (ObjectUtil.isEmpty(cleanRecords) || cleanRecords.getStatus().equals(CleaningStatusEnum.CLEANED.getCode()))) {
//房间添加保洁记录
boolean b = isCleanRecordsService.addSCleanRecords(sOrder.getStoreId(), sOrder.getRoomId());
isCleanRecordsService.addSCleanRecords(sOrder.getStoreId(), sOrder.getRoomId());
}
}
if (request.getAmount().compareTo(BigDecimal.ZERO) > 0) {
......@@ -959,12 +975,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
List<SConsumer> consumers = sConsumerService.selectAllocatedList(sConsumer);
//获取用户id
List<Long> sconsumerIds = consumers.stream().map(SConsumer::getId).collect(Collectors.toList());
if (consumers.size() > 0) {
Map<Long, SStoreConsumer> consumerMap = storeConsumerMapper.selectList(new LambdaQueryWrapper<SStoreConsumer>()
.in(SStoreConsumer::getConsumerId, sconsumerIds)
.eq(SStoreConsumer::getPosition, PositionEnum.CUSTOMER_SERVICE.getCode())
.eq(SStoreConsumer::getStoreId, sOrder.getStoreId())
).stream().collect(Collectors.toMap(SStoreConsumer::getConsumerId, Function.identity()));
if (consumers.size() > 0) {
logger.info("订单预订成功通知发送开始");
consumers.forEach(o -> {
SStoreConsumer sStoreConsumer = consumerMap.get(o.getId());
......@@ -1499,12 +1515,13 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sConsumer.setPosition(3);
List<SConsumer> consumers = sConsumerService.selectAllocatedList(sConsumer);
List<Long> sconsumerIds = consumers.stream().map(SConsumer::getId).collect(Collectors.toList());
if (consumers.size() > 0) {
Map<Long, SStoreConsumer> consumerMap = storeConsumerMapper.selectList(new LambdaQueryWrapper<SStoreConsumer>()
.in(SStoreConsumer::getConsumerId, sconsumerIds)
.eq(SStoreConsumer::getPosition, PositionEnum.CUSTOMER_SERVICE.getCode())
.eq(SStoreConsumer::getStoreId, sOrder.getStoreId())
).stream().collect(Collectors.toMap(SStoreConsumer::getConsumerId, Function.identity()));
if (consumers.size() > 0) {
logger.info("订单预订成功通知发送开始");
consumers.forEach(o->{
SStoreConsumer sStoreConsumer = consumerMap.get(o.getId());
......@@ -1835,37 +1852,67 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
private ComputedOrderPriceResponse computedPrice(OrderComputedPriceRequest request, SConsumer user) {
// 计算各种价格
ComputedOrderPriceResponse priceResponse = new ComputedOrderPriceResponse();
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, user.getId()));
SRoom room = roomService.getById(request.getRoomId());
BigDecimal totalPrice = computeTotalPrice(room.getPrice(), request.getPreStartDate(), request.getPreEndDate());
BigDecimal payPrice = new BigDecimal(0);
BigDecimal totalFee = new BigDecimal(0);
Activity activity;
LambdaQueryWrapper<Activity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Activity::getIsOpen, YesNoEnum.yes.getIndex());
queryWrapper.eq(Activity::getMemberType, consumerMember.getMemberType());
if (!ObjectUtils.isEmpty(request.getRoomLabelId())) {
RoomLabel roomLabel = roomLabelService.selectRoomLabelById(request.getRoomLabelId());
if (ObjectUtils.isEmpty(roomLabel.getPackId())) {
queryWrapper.eq(Activity::getLabelId, roomLabel.getLabelId());
activity = activityService.getOne(queryWrapper);
payPrice = totalPrice;
request.setBuyType(BuyTypeEnum.TIME.getCode());
totalFee = getBigDecimal(request, activity, payPrice, user);
} else {
SPack byId = packService.getById(roomLabel.getPackId());
if (!ObjectUtils.isEmpty(byId) && byId.getIsOpen().equals(YesNoEnum.yes.getIndex())) {
queryWrapper.eq(Activity::getPackId, roomLabel.getPackId());
activity = activityService.getOne(queryWrapper);
payPrice = computeTotalPrice(roomLabel.getPackId(), totalPrice);
request.setBuyType(BuyTypeEnum.PACK.getCode());
totalFee = getBigDecimal(request, activity, payPrice, user);
} else {
queryWrapper.eq(Activity::getLabelId, roomLabel.getLabelId());
activity = activityService.getOne(queryWrapper);
payPrice = totalPrice;
request.setBuyType(BuyTypeEnum.TIME.getCode());
totalFee = getBigDecimal(request, activity, payPrice, user);
}
}
} else if (!ObjectUtils.isEmpty(request.getPackId())) {
queryWrapper.eq(Activity::getPackId, request.getPackId());
activity = activityService.getOne(queryWrapper);
payPrice = computeTotalPrice(request.getPackId(), totalPrice);
request.setBuyType(BuyTypeEnum.PACK.getCode());
totalFee = getBigDecimal(request, activity, payPrice, user);
}
priceResponse.setTotalFee(payPrice);
priceResponse.setPayFee(totalFee);
// 计算优惠券金额
if (ObjectUtil.isNull(request.getCouponId()) || request.getCouponId() <= 0) {
priceResponse.setCouponFee(BigDecimal.ZERO);
priceResponse.setPayFee(payPrice);
if (ObjectUtil.isNotEmpty(consumerMember)) {
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getId, consumerMember.getMemberConfigId()));
//总金额乘以折扣比例除以100
priceResponse.setPayFee(priceResponse.getPayFee().multiply(memberConfig.getDiscountRatio()).divide(new BigDecimal(100)));
priceResponse.setDiscountFee(priceResponse.getTotalFee().subtract(priceResponse.getPayFee()));
priceResponse.setCouponFee(priceResponse.getDiscountFee());
if (ObjectUtil.isNotEmpty(priceResponse.getDiscountFee()) && priceResponse.getTotalFee().compareTo(new BigDecimal(0.00)) > 0) {
priceResponse.setDiscountRatio(priceResponse.getDiscountFee().divide(priceResponse.getTotalFee()).multiply(new BigDecimal(100)));
} else {
priceResponse.setDiscountRatio(new BigDecimal(0));
}
}
} else {
// 判断优惠券是否可以使用
if (Objects.nonNull(user) && Objects.nonNull(request.getCouponId())) {
priceResponse.setTotalFee(payPrice);
SConsumerCoupon consumerCoupon = consumerCouponService.getById(request.getCouponId());
computedCouponPrice(request, priceResponse, user, consumerCoupon);
}
......@@ -1873,6 +1920,43 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
return priceResponse;
}
private BigDecimal getBigDecimal(OrderComputedPriceRequest request, Activity activity, BigDecimal payPrice, SConsumer user) {
if (ObjectUtil.isNotEmpty(activity)) {
CronParser cronParser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(com.cronutils.model.CronType.QUARTZ));
Cron cron = cronParser.parse(activity.getCronExpression());
ExecutionTime executionTime = ExecutionTime.forCron(cron);
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SOrder::getConsumerId, user.getId());
queryWrapper.in(SOrder::getStatus, OrderStatusEnum.getUnfinishOrderStatus());
queryWrapper.eq(SOrder::getPayStatus, YesNoEnum.yes.getIndex());
queryWrapper.ne(SOrder::getPayPrice, new BigDecimal(0.00));
queryWrapper.isNull(SOrder::getCouponId);
List<SOrder> orderList = list(queryWrapper);
if (CollectionUtils.isEmpty(orderList)) {
boolean match = executionTime.isMatch(ZonedDateTime.ofInstant(request.getPreStartDate().toInstant(), ZoneId.systemDefault()));
boolean match1 = executionTime.isMatch(ZonedDateTime.ofInstant(request.getPreEndDate().toInstant(), ZoneId.systemDefault()));
if (match && match1) {
payPrice = payPrice.multiply(activity.getDiscountRatio()).divide(new BigDecimal(100));
}
} else {
AtomicInteger i = new AtomicInteger();
orderList.stream().forEach(item -> {
boolean match = executionTime.isMatch(ZonedDateTime.ofInstant(item.getPreStartDate().toInstant(), ZoneId.systemDefault()));
boolean match1 = executionTime.isMatch(ZonedDateTime.ofInstant(item.getPreEndDate().toInstant(), ZoneId.systemDefault()));
if (match && match1 && (item.getPayPrice().compareTo(item.getTotalPrice().multiply(activity.getDiscountRatio()).divide(new BigDecimal(100)))) > 0) {
i.getAndIncrement();
}
});
if (i.get() == 0) {
payPrice = payPrice.multiply(activity.getDiscountRatio()).divide(new BigDecimal(100));
} else {
return payPrice;
}
}
}
return payPrice;
}
private BigDecimal computeTotalPrice(Long packId, BigDecimal totalPrice) {
SPack pack = packService.getById(packId);
if (Objects.isNull(pack)) {
......
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