Commit 4feea183 by 吕明尚

修改订单

parent 873ce676
package share.web.controller.system; package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import share.common.annotation.Log; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo; 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.domain.Activity;
import share.system.service.ActivityService; import share.system.service.ActivityService;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
...@@ -36,17 +35,13 @@ public class ActivityController extends BaseController { ...@@ -36,17 +35,13 @@ public class ActivityController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
/** @GetMapping("/query")
* 导出活动列表 public AjaxResult query(Activity activity) {
*/
@Log(title = "活动", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Activity activity) {
List<Activity> list = activityService.selectActivityList(activity); List<Activity> list = activityService.selectActivityList(activity);
ExcelUtil<Activity> util = new ExcelUtil<Activity>(Activity.class); return success(list);
util.exportExcel(response, list, "活动数据");
} }
/** /**
* 获取活动详细信息 * 获取活动详细信息
*/ */
...@@ -55,30 +50,4 @@ public class ActivityController extends BaseController { ...@@ -55,30 +50,4 @@ public class ActivityController extends BaseController {
return success(activityService.selectActivityById(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; package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import share.common.annotation.Log; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo; import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType; import share.system.domain.SConsumer;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.BalanceLog;
import share.system.domain.vo.BalanceLogVo; import share.system.domain.vo.BalanceLogVo;
import share.system.domain.vo.FrontTokenComponent;
import share.system.service.BalanceLogService; import share.system.service.BalanceLogService;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
...@@ -37,49 +36,11 @@ public class BalanceLogController extends BaseController { ...@@ -37,49 +36,11 @@ public class BalanceLogController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
/** @GetMapping("/query")
* 导出余额日志列表 public AjaxResult query(BalanceLogVo balanceLog) {
*/ SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
@Log(title = "余额日志", businessType = BusinessType.EXPORT) balanceLog.setConsumerId(user.getId());
@PostMapping("/export")
public void export(HttpServletResponse response, BalanceLogVo balanceLog) {
List<BalanceLogVo> list = balanceLogService.selectBalanceLogList(balanceLog); List<BalanceLogVo> list = balanceLogService.selectBalanceLogList(balanceLog);
ExcelUtil<BalanceLogVo> util = new ExcelUtil<BalanceLogVo>(BalanceLogVo.class); return success(list);
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; package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import share.common.annotation.Log; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo; 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.domain.vo.ConsumerMemberVo;
import share.system.service.ConsumerMemberService; import share.system.service.ConsumerMemberService;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
...@@ -37,49 +34,10 @@ public class ConsumerMemberController extends BaseController { ...@@ -37,49 +34,10 @@ public class ConsumerMemberController extends BaseController {
return getDataTable(list); 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("/query")
* 获取会员用户详细信息 public AjaxResult selectByConsumerId() {
*/ return success(consumerMemberService.selectByConsumerId());
@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; package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import share.common.annotation.Log; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo; 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.domain.vo.ConsumerWalletVo;
import share.system.service.ConsumerWalletService; import share.system.service.ConsumerWalletService;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
...@@ -38,53 +35,8 @@ public class ConsumerWalletController extends BaseController { ...@@ -38,53 +35,8 @@ public class ConsumerWalletController extends BaseController {
} }
@GetMapping("/query") @GetMapping("/query")
public ConsumerWalletVo selectByConsumerId() { public AjaxResult selectByConsumerId() {
return consumerWalletService.selectByConsumerId(); return success(consumerWalletService.selectByConsumerId());
} }
/**
* 导出会员钱包列表
*/
@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; package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import share.common.annotation.Log; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo; import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType; import share.system.domain.SConsumer;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.DurationLog;
import share.system.domain.vo.DurationLogVo; import share.system.domain.vo.DurationLogVo;
import share.system.domain.vo.FrontTokenComponent;
import share.system.service.DurationLogService; import share.system.service.DurationLogService;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
...@@ -37,49 +36,11 @@ public class DurationLogController extends BaseController { ...@@ -37,49 +36,11 @@ public class DurationLogController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
/** @GetMapping("/query")
* 导出时长日志列表 public AjaxResult query(DurationLogVo durationLog) {
*/ SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
@Log(title = "时长日志", businessType = BusinessType.EXPORT) durationLog.setConsumerId(user.getId());
@PostMapping("/export")
public void export(HttpServletResponse response, DurationLogVo durationLog) {
List<DurationLogVo> list = durationLogService.selectDurationLogList(durationLog); List<DurationLogVo> list = durationLogService.selectDurationLogList(durationLog);
ExcelUtil<DurationLogVo> util = new ExcelUtil<DurationLogVo>(DurationLogVo.class); return success(list);
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));
} }
} }
...@@ -13,14 +13,13 @@ import share.common.core.page.TableDataInfo; ...@@ -13,14 +13,13 @@ import share.common.core.page.TableDataInfo;
import share.common.core.redis.RedisUtil; import share.common.core.redis.RedisUtil;
import share.common.enums.BusinessType; import share.common.enums.BusinessType;
import share.common.utils.JsonConvertUtil; import share.common.utils.JsonConvertUtil;
import share.common.utils.poi.ExcelUtil; import share.system.domain.SConsumer;
import share.system.domain.EquityMembersOrder;
import share.system.domain.vo.EquityMembersOrderVo; import share.system.domain.vo.EquityMembersOrderVo;
import share.system.domain.vo.FrontTokenComponent;
import share.system.request.CreateEquityMembersRequest; import share.system.request.CreateEquityMembersRequest;
import share.system.response.EquityMembersResultResponse; import share.system.response.EquityMembersResultResponse;
import share.system.service.EquityMembersOrderService; import share.system.service.EquityMembersOrderService;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
...@@ -48,41 +47,12 @@ public class EquityMembersOrderController extends BaseController { ...@@ -48,41 +47,12 @@ public class EquityMembersOrderController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
/** @GetMapping("/query")
* 导出权益会员订单列表 public AjaxResult query(EquityMembersOrderVo equityMembersOrder) {
*/ SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
@Log(title = "权益会员订单", businessType = BusinessType.EXPORT) equityMembersOrder.setConsumerId(user.getId());
@PostMapping("/export")
public void export(HttpServletResponse response, EquityMembersOrderVo equityMembersOrder) {
List<EquityMembersOrderVo> list = equityMembersOrderService.selectEquityMembersOrderList(equityMembersOrder); List<EquityMembersOrderVo> list = equityMembersOrderService.selectEquityMembersOrderList(equityMembersOrder);
ExcelUtil<EquityMembersOrderVo> util = new ExcelUtil<EquityMembersOrderVo>(EquityMembersOrderVo.class); return success(list);
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));
} }
/** /**
......
package share.web.controller.system; package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import share.common.annotation.Log; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo; import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType; import share.system.domain.SConsumer;
import share.common.utils.poi.ExcelUtil; import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.IntegralLog;
import share.system.domain.vo.IntegralLogVo; import share.system.domain.vo.IntegralLogVo;
import share.system.service.IntegralLogService; import share.system.service.IntegralLogService;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
...@@ -37,49 +36,11 @@ public class IntegralLogController extends BaseController { ...@@ -37,49 +36,11 @@ public class IntegralLogController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
/** @GetMapping("/query")
* 导出积分日志列表 public AjaxResult query(IntegralLogVo integralLog) {
*/ SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
@Log(title = "积分日志", businessType = BusinessType.EXPORT) integralLog.setConsumerId(user.getId());
@PostMapping("/export")
public void export(HttpServletResponse response, IntegralLogVo integralLog) {
List<IntegralLogVo> list = integralLogService.selectIntegralLogList(integralLog); List<IntegralLogVo> list = integralLogService.selectIntegralLogList(integralLog);
ExcelUtil<IntegralLogVo> util = new ExcelUtil<IntegralLogVo>(IntegralLogVo.class); return success(list);
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; package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import share.common.annotation.Log; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo; import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType; import share.system.domain.SConsumer;
import share.common.utils.poi.ExcelUtil; import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.MemberProgressLog;
import share.system.domain.vo.MemberProgressLogVo; import share.system.domain.vo.MemberProgressLogVo;
import share.system.service.MemberProgressLogService; import share.system.service.MemberProgressLogService;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
...@@ -37,49 +36,11 @@ public class MemberProgressLogController extends BaseController { ...@@ -37,49 +36,11 @@ public class MemberProgressLogController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
/** @GetMapping("/query")
* 导出会员进度日志列表 public AjaxResult query(MemberProgressLogVo memberProgressLog) {
*/ SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
@Log(title = "会员进度日志", businessType = BusinessType.EXPORT) memberProgressLog.setConsumerId(user.getId());
@PostMapping("/export")
public void export(HttpServletResponse response, MemberProgressLogVo memberProgressLog) {
List<MemberProgressLogVo> list = memberProgressLogService.selectMemberProgressLogList(memberProgressLog); List<MemberProgressLogVo> list = memberProgressLogService.selectMemberProgressLogList(memberProgressLog);
ExcelUtil<MemberProgressLogVo> util = new ExcelUtil<MemberProgressLogVo>(MemberProgressLogVo.class); return success(list);
util.exportExcel(response, list, "会员进度日志数据");
}
/**
* 获取会员进度日志详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(memberProgressLogService.selectMemberProgressLogById(id));
}
/**
* 新增会员进度日志
*/
@Log(title = "会员进度日志", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MemberProgressLog memberProgressLog) {
return toAjax(memberProgressLogService.insertMemberProgressLog(memberProgressLog));
}
/**
* 修改会员进度日志
*/
@Log(title = "会员进度日志", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MemberProgressLog memberProgressLog) {
return toAjax(memberProgressLogService.updateMemberProgressLog(memberProgressLog));
}
/**
* 删除会员进度日志
*/
@Log(title = "会员进度日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(memberProgressLogService.deleteMemberProgressLogByIds(ids));
} }
} }
...@@ -5,22 +5,19 @@ import lombok.extern.slf4j.Slf4j; ...@@ -5,22 +5,19 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.core.domain.R; import share.common.core.domain.R;
import share.common.core.page.TableDataInfo; import share.common.core.page.TableDataInfo;
import share.common.core.redis.RedisUtil; import share.common.core.redis.RedisUtil;
import share.common.enums.BusinessType;
import share.common.utils.JsonConvertUtil; import share.common.utils.JsonConvertUtil;
import share.common.utils.poi.ExcelUtil; import share.system.domain.SConsumer;
import share.system.domain.Recharge; import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.RechargeVo; import share.system.domain.vo.RechargeVo;
import share.system.request.CreateRechargeRequest; import share.system.request.CreateRechargeRequest;
import share.system.response.RechargePayResultResponse; import share.system.response.RechargePayResultResponse;
import share.system.service.RechargeService; import share.system.service.RechargeService;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
...@@ -48,51 +45,14 @@ public class RechargeController extends BaseController { ...@@ -48,51 +45,14 @@ public class RechargeController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
/** @GetMapping("/query")
* 导出充值记录列表 public AjaxResult query(RechargeVo recharge) {
*/ SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
@Log(title = "充值记录", businessType = BusinessType.EXPORT) recharge.setConsumerId(user.getId());
@PostMapping("/export")
public void export(HttpServletResponse response, RechargeVo recharge) {
List<RechargeVo> list = rechargeService.selectRechargeList(recharge); List<RechargeVo> list = rechargeService.selectRechargeList(recharge);
ExcelUtil<RechargeVo> util = new ExcelUtil<RechargeVo>(RechargeVo.class); return success(list);
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));
}
@PostMapping("/createRecharge") @PostMapping("/createRecharge")
public R<RechargePayResultResponse> createOrder(@RequestBody @Validated CreateRechargeRequest request) { public R<RechargePayResultResponse> createOrder(@RequestBody @Validated CreateRechargeRequest request) {
......
...@@ -55,7 +55,7 @@ public class BalanceLog extends BaseEntity { ...@@ -55,7 +55,7 @@ public class BalanceLog extends BaseEntity {
/** /**
* 操作时间 * 操作时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date operationTime; private Date operationTime;
......
...@@ -55,7 +55,7 @@ public class DurationLog extends BaseEntity { ...@@ -55,7 +55,7 @@ public class DurationLog extends BaseEntity {
/** /**
* 操作时间 * 操作时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date operationTime; private Date operationTime;
......
...@@ -55,7 +55,7 @@ public class IntegralLog extends BaseEntity { ...@@ -55,7 +55,7 @@ public class IntegralLog extends BaseEntity {
/** /**
* 操作时间 * 操作时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date operationTime; private Date operationTime;
......
...@@ -55,7 +55,7 @@ public class MemberProgressLog extends BaseEntity { ...@@ -55,7 +55,7 @@ public class MemberProgressLog extends BaseEntity {
/** /**
* 操作时间 * 操作时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date operationTime; private Date operationTime;
......
...@@ -93,6 +93,12 @@ public class SOrder extends BaseEntity ...@@ -93,6 +93,12 @@ public class SOrder extends BaseEntity
@Excel(name = "订单时长(H)") @Excel(name = "订单时长(H)")
private String timeLong; private String timeLong;
@Excel(name = "使用时长")
private BigDecimal duration;
@Excel(name = "使用余额")
private BigDecimal balance;
@Excel(name = "优惠比例") @Excel(name = "优惠比例")
private BigDecimal discountRatio; private BigDecimal discountRatio;
......
...@@ -111,6 +111,18 @@ public class SOrderVo ...@@ -111,6 +111,18 @@ public class SOrderVo
@Excel(name = "实际支付金额") @Excel(name = "实际支付金额")
private BigDecimal payPrice; private BigDecimal payPrice;
@ApiModelProperty(value = "使用时长")
@Excel(name = "使用时长")
private BigDecimal duration;
@ApiModelProperty(value = "使用余额")
@Excel(name = "使用余额")
private BigDecimal balance;
@ApiModelProperty(value = "优惠比例")
@Excel(name = "优惠比例")
private BigDecimal discountRatio;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "支付时间") @ApiModelProperty(value = "支付时间")
@Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
...@@ -169,11 +181,6 @@ public class SOrderVo ...@@ -169,11 +181,6 @@ public class SOrderVo
@ApiModelProperty(value = "支付类型(1:微信,2:支付宝)") @ApiModelProperty(value = "支付类型(1:微信,2:支付宝)")
private Integer payType; private Integer payType;
/**
* 优惠比例
*/
private BigDecimal discountRatio;
@ApiModelProperty(value = "支付状态(0:未支付,1:已支付)") @ApiModelProperty(value = "支付状态(0:未支付,1:已支付)")
private Integer payStatus; private Integer payStatus;
......
...@@ -60,4 +60,6 @@ public interface ConsumerMemberMapper extends BaseMapper<ConsumerMember> { ...@@ -60,4 +60,6 @@ public interface ConsumerMemberMapper extends BaseMapper<ConsumerMember> {
* @return 结果 * @return 结果
*/ */
public int deleteConsumerMemberByIds(Long[] ids); public int deleteConsumerMemberByIds(Long[] ids);
ConsumerMemberVo selectByConsumerId(ConsumerMemberVo consumerMemberVo);
} }
...@@ -60,4 +60,6 @@ public interface ConsumerMemberService extends IService<ConsumerMember> { ...@@ -60,4 +60,6 @@ public interface ConsumerMemberService extends IService<ConsumerMember> {
* @return 结果 * @return 结果
*/ */
public int deleteConsumerMemberById(Long id); public int deleteConsumerMemberById(Long id);
ConsumerMemberVo selectByConsumerId();
} }
...@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import share.system.domain.ConsumerMember; import share.system.domain.ConsumerMember;
import share.system.domain.SConsumer;
import share.system.domain.vo.ConsumerMemberVo; import share.system.domain.vo.ConsumerMemberVo;
import share.system.mapper.ConsumerMemberMapper; import share.system.mapper.ConsumerMemberMapper;
import share.system.service.ConsumerMemberService; import share.system.service.ConsumerMemberService;
...@@ -92,4 +93,12 @@ public class ConsumerMemberServiceImpl extends ServiceImpl<ConsumerMemberMapper, ...@@ -92,4 +93,12 @@ public class ConsumerMemberServiceImpl extends ServiceImpl<ConsumerMemberMapper,
public int deleteConsumerMemberById(Long id) { public int deleteConsumerMemberById(Long id) {
return consumerMemberMapper.deleteConsumerMemberById(id); return consumerMemberMapper.deleteConsumerMemberById(id);
} }
@Override
public ConsumerMemberVo selectByConsumerId() {
SConsumer info = sConsumerService.getInfo();
ConsumerMemberVo consumerMemberVo = new ConsumerMemberVo();
consumerMemberVo.setConsumerId(info.getId());
return consumerMemberMapper.selectByConsumerId(consumerMemberVo);
}
} }
...@@ -90,31 +90,6 @@ public class OrderPayServiceImpl implements OrderPayService { ...@@ -90,31 +90,6 @@ public class OrderPayServiceImpl implements OrderPayService {
return response; return response;
} }
@Override
public OrderPayResultResponse saobeiPayment(SOrder sOrder) {
OrderPayResultResponse response = new OrderPayResultResponse();
response.setOrderNo(sOrder.getOrderNo());
response.setPayType(PayTypeEnum.getEnumByCode(sOrder.getPayType()).getValue());
response.setStatus(YesNoEnum.no.getFlag());
// 扫呗支付
ConcurrentHashMap<String, String> unifiedorder = saobeiUnifiedOrder(sOrder);
WxPayJsResultVo vo = new WxPayJsResultVo();
vo.setAppId(unifiedorder.get("appId"));
vo.setNonceStr(unifiedorder.get("nonceStr"));
vo.setPackages(unifiedorder.get("package"));
vo.setSignType(unifiedorder.get("signType"));
vo.setTimeStamp(unifiedorder.get("timeStamp"));
vo.setPaySign(unifiedorder.get("paySign"));
// 更新商户订单号
sOrder.setOutTradeNo(unifiedorder.get("outTradeNo"));
orderService.updateById(sOrder);
response.setJsConfig(vo);
return response;
}
/** /**
* 预下单 * 预下单
* @param sOrder 订单 * @param sOrder 订单
...@@ -178,6 +153,29 @@ public class OrderPayServiceImpl implements OrderPayService { ...@@ -178,6 +153,29 @@ public class OrderPayServiceImpl implements OrderPayService {
return vo; return vo;
} }
@Override
public OrderPayResultResponse saobeiPayment(SOrder sOrder) {
OrderPayResultResponse response = new OrderPayResultResponse();
response.setOrderNo(sOrder.getOrderNo());
response.setPayType(PayTypeEnum.getEnumByCode(sOrder.getPayType()).getValue());
response.setStatus(YesNoEnum.no.getFlag());
// 扫呗支付
ConcurrentHashMap<String, String> unifiedorder = saobeiUnifiedOrder(sOrder);
WxPayJsResultVo vo = new WxPayJsResultVo();
vo.setAppId(unifiedorder.get("appId"));
vo.setNonceStr(unifiedorder.get("nonceStr"));
vo.setPackages(unifiedorder.get("package"));
vo.setSignType(unifiedorder.get("signType"));
vo.setTimeStamp(unifiedorder.get("timeStamp"));
vo.setPaySign(unifiedorder.get("paySign"));
// 更新商户订单号
sOrder.setOutTradeNo(unifiedorder.get("outTradeNo"));
orderService.updateById(sOrder);
response.setJsConfig(vo);
return response;
}
/** /**
* 预下单 (扫呗-微信) * 预下单 (扫呗-微信)
* @param sOrder 订单 * @param sOrder 订单
......
...@@ -156,6 +156,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -156,6 +156,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Autowired @Autowired
private ISOrderService sOrderService; private ISOrderService sOrderService;
@Autowired
private BalanceLogService balanceLogService;
@Autowired
private DurationLogService durationLogService;
@Autowired
private IntegralLogService integralLogService;
@Autowired
private MemberProgressLogService memberProgressLogService;
private final static Long FIVE = 5L; private final static Long FIVE = 5L;
...@@ -401,6 +413,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -401,6 +413,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override @Override
public int refundOp(AdminRefundRequest request) { public int refundOp(AdminRefundRequest request) {
SOrder sOrder = getInfoException(request.getOrderNo()); SOrder sOrder = getInfoException(request.getOrderNo());
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, sOrder.getConsumerId()));
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, sOrder.getConsumerId()));
SOrder oldSOrder = new SOrder(); SOrder oldSOrder = new SOrder();
BeanUtils.copyProperties(sOrder, oldSOrder); BeanUtils.copyProperties(sOrder, oldSOrder);
if (ObjectUtils.isEmpty(sOrder)) { if (ObjectUtils.isEmpty(sOrder)) {
...@@ -457,6 +471,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -457,6 +471,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
//退款 //退款
if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode())) { if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode())) {
try { try {
refundExtracted(consumerWallet, sOrder, consumerMember);
orderRefundService.refundOp(request, sOrder); orderRefundService.refundOp(request, sOrder);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -464,6 +479,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -464,6 +479,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
} }
} else { } else {
refundExtracted(consumerWallet, sOrder, consumerMember);
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());
...@@ -737,7 +753,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -737,7 +753,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
} }
if (StringUtils.isNoneEmpty(item.getOutTradeNo())) { if (StringUtils.isNoneEmpty(item.getOutTradeNo())) {
item.setOutTradeNo(saobeiApiLogs.stream().filter(saobeiApiLog -> saobeiApiLog.getTerminalTrace().equals(item.getOutTradeNo())).findFirst().orElse(null).getOutTradeNo()); item.setOutTradeNo(saobeiApiLogs.stream().filter(saobeiApiLog ->
saobeiApiLog.getTerminalTrace().equals(item.getOutTradeNo())).findFirst().orElse(null).getOutTradeNo());
} }
}); });
} }
...@@ -841,6 +858,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -841,6 +858,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
throw new BaseException("请绑定手机号"); throw new BaseException("请绑定手机号");
} }
} }
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, user.getId()));
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, user.getId()));
List<SStore> stores = storeService.list(); List<SStore> stores = storeService.list();
SRoom room = roomService.getById(request.getRoomId()); SRoom room = roomService.getById(request.getRoomId());
SStore sStore = storeService.getById(request.getStoreId()); SStore sStore = storeService.getById(request.getStoreId());
...@@ -897,6 +916,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -897,6 +916,7 @@ 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());
creatExtracted(consumerWallet, sOrder, consumerMember);
} else { } else {
// response = orderPayService.payment(sOrder); // response = orderPayService.payment(sOrder);
// 扫呗聚合支付 // 扫呗聚合支付
...@@ -1014,6 +1034,111 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1014,6 +1034,111 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
} }
private void creatExtracted(ConsumerWallet consumerWallet, SOrder sOrder, ConsumerMember consumerMember) {
if (ObjectUtil.isNotEmpty(consumerWallet)) {
if (ObjectUtil.isNotEmpty(sOrder.getDuration()) && sOrder.getDuration().compareTo(BigDecimal.ZERO) > 0) {
DurationLog durationLog = new DurationLog();
durationLog.setConsumerId(sOrder.getConsumerId());
durationLog.setVariableDuration(sOrder.getDuration());
durationLog.setCurrentDuration(consumerWallet.getRemainingDuration());
durationLog.setOperationType(YesNoEnum.no.getIndex());
durationLog.setOperationTime(new Date());
durationLogService.save(durationLog);
consumerWallet.setRemainingDuration(consumerWallet.getRemainingDuration().subtract(sOrder.getDuration()));
consumerWalletService.updateById(consumerWallet);
}
if (ObjectUtil.isNotEmpty(sOrder.getBalance()) && sOrder.getBalance().compareTo(BigDecimal.ZERO) > 0) {
BalanceLog balanceLog = new BalanceLog();
balanceLog.setConsumerId(sOrder.getConsumerId());
balanceLog.setVariableAmount(sOrder.getBalance());
balanceLog.setCurrentBalance(consumerWallet.getBalance());
balanceLog.setOperationType(YesNoEnum.no.getIndex());
balanceLog.setOperationTime(new Date());
balanceLogService.save(balanceLog);
consumerWallet.setBalance(consumerWallet.getBalance().subtract(sOrder.getBalance()));
consumerWalletService.updateById(consumerWallet);
}
}
if (ObjectUtil.isNotEmpty(consumerMember)) {
if (consumerMember.getMemberType().equals(MemberTypeEnum.RECHARGE.getIndex())) {
IntegralLog integralLog = new IntegralLog();
integralLog.setConsumerId(sOrder.getConsumerId());
integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral());
BigDecimal integral = consumerWallet.getRemainingIntegral().add(sOrder.getBalance());
consumerWallet.setRemainingIntegral(integral);
integralLog.setVariableIntegral(sOrder.getBalance());
integralLog.setOperationType(YesNoEnum.yes.getIndex());
integralLog.setOperationTime(new Date());
integralLogService.save(integralLog);
consumerWalletService.updateById(consumerWallet);
MemberProgressLog memberProgressLog = new MemberProgressLog();
memberProgressLog.setConsumerId(sOrder.getConsumerId());
memberProgressLog.setCurrentProgress(BigDecimal.valueOf(consumerMember.getMembershipProgress()));
Long membershipProgress = sOrder.getBalance().add(BigDecimal.valueOf(consumerMember.getMembershipProgress())).longValue();
//查询当前会员类型和下一级的会员配置
MemberConfig one = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel() + 1L));
if (ObjectUtil.isNotEmpty(one)) {
//判断是否升级
if (membershipProgress.compareTo(one.getLimitRequirements()) >= 0) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() + 1L);
consumerMember.setMemberConfigId(one.getId());
}
}
consumerMember.setMembershipProgress(membershipProgress);
memberProgressLog.setVariableProgress(BigDecimal.valueOf(membershipProgress));
memberProgressLog.setOperationType(YesNoEnum.yes.getIndex());
memberProgressLog.setOperationTime(new Date());
memberProgressLogService.save(memberProgressLog);
consumerMemberService.updateConsumerMember(consumerMember);
} else if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
SConsumerCoupon coupon = consumerCouponService.getById(sOrder.getCouponId());
IntegralLog integralLog = new IntegralLog();
integralLog.setConsumerId(sOrder.getConsumerId());
integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral());
BigDecimal integral;
Long membershipProgress;
if (ObjectUtil.isNotEmpty(coupon) && !coupon.getPlatformType().equals(PlatformTypeEnum.SELF.getCode()) && coupon.getCouponType().equals(CouponTypeEnum.CASH.getCode())) {
integral = consumerWallet.getRemainingIntegral().add(sOrder.getPayPrice()).add(sOrder.getBalance()).add(coupon.getCouponPayPrice());
membershipProgress = BigDecimal.valueOf(consumerMember.getMembershipProgress()).add(sOrder.getBalance())
.add(sOrder.getPayPrice()).add(coupon.getCouponPayPrice()).longValue();
} else {
integral = consumerWallet.getRemainingIntegral().add(sOrder.getPayPrice()).add(sOrder.getBalance());
membershipProgress = BigDecimal.valueOf(consumerMember.getMembershipProgress()).add(sOrder.getBalance()).add(sOrder.getPayPrice()).longValue();
}
integralLog.setVariableIntegral(integral.subtract(consumerWallet.getRemainingIntegral()));
consumerWallet.setRemainingIntegral(integral);
integralLog.setOperationType(YesNoEnum.yes.getIndex());
integralLog.setOperationTime(new Date());
integralLogService.save(integralLog);
consumerWalletService.updateById(consumerWallet);
MemberProgressLog memberProgressLog = new MemberProgressLog();
memberProgressLog.setConsumerId(sOrder.getConsumerId());
memberProgressLog.setCurrentProgress(BigDecimal.valueOf(consumerMember.getMembershipProgress()));
//查询当前会员类型和下一级的会员配置
MemberConfig one = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel() + 1L));
if (ObjectUtil.isNotEmpty(one)) {
//判断是否升级
if (membershipProgress.compareTo(one.getLimitRequirements()) >= 0) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() + 1L);
consumerMember.setMemberConfigId(one.getId());
}
}
consumerMember.setMembershipProgress(membershipProgress);
memberProgressLog.setVariableProgress(BigDecimal.valueOf(membershipProgress));
memberProgressLog.setOperationType(YesNoEnum.yes.getIndex());
memberProgressLog.setOperationTime(new Date());
memberProgressLogService.save(memberProgressLog);
consumerMemberService.updateConsumerMember(consumerMember);
}
}
}
private String lockOrder(CreateOrderRequest request) throws BaseException { private String lockOrder(CreateOrderRequest request) throws BaseException {
try { try {
//自旋10次,每次等待1秒 //自旋10次,每次等待1秒
...@@ -1172,7 +1297,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1172,7 +1297,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
BeanUtils.copyProperties(order, orderComputedPriceRequest); BeanUtils.copyProperties(order, orderComputedPriceRequest);
orderComputedPriceRequest.setRoomLabelId(request.getRoomLabelId()); orderComputedPriceRequest.setRoomLabelId(request.getRoomLabelId());
ComputedOrderPriceResponse priceResponse = computedPrice(orderComputedPriceRequest, user); ComputedOrderPriceResponse priceResponse = computedPrice(orderComputedPriceRequest, user);
if (priceResponse.getPayFee().compareTo(order.getPayPrice()) != 0) { order.setBalance(priceResponse.getBalance());
order.setDuration(priceResponse.getDuration());
order.setDiscountRatio(priceResponse.getDiscountRatio());
if (priceResponse.getPayFee().compareTo(order.getPayPrice()) != 0
// || priceResponse.getDuration().compareTo(request.getDuration()) !=0
// || priceResponse.getBalance().compareTo(request.getBalance()) !=0
// || priceResponse.getDiscountRatio().compareTo(request.getDiscountRatio()) !=0
) {
throw new BaseException("订单金额异常!"); throw new BaseException("订单金额异常!");
} }
} }
...@@ -1447,7 +1579,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1447,7 +1579,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override @Override
public void paymentSuccessful(SOrder sOrder) { public void paymentSuccessful(SOrder sOrder) {
unLockOrder(sOrder.getRoomId()); unLockOrder(sOrder.getRoomId());
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, sOrder.getConsumerId()));
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, sOrder.getConsumerId()));
// LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.ne(SOrder::getOrderNo,sOrder.getOrderNo()); // queryWrapper.ne(SOrder::getOrderNo,sOrder.getOrderNo());
// queryWrapper.eq(SOrder::getOrderType,OrderTypeEnum.RESERVER.getCode()); // queryWrapper.eq(SOrder::getOrderType,OrderTypeEnum.RESERVER.getCode());
...@@ -1505,6 +1638,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1505,6 +1638,7 @@ 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());
} }
creatExtracted(consumerWallet, sOrder, consumerMember);
baseMapper.updateSOrder(sOrder); baseMapper.updateSOrder(sOrder);
if (sOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) { if (sOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
...@@ -1592,6 +1726,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1592,6 +1726,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override @Override
public boolean autoRefund(OrderRefundRequest request) { public boolean autoRefund(OrderRefundRequest request) {
SOrder sOrder = getInfoException(request.getOrderNo()); SOrder sOrder = getInfoException(request.getOrderNo());
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, sOrder.getConsumerId()));
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, sOrder.getConsumerId()));
if (!YesNoEnum.yes.getIndex().equals(sOrder.getPayStatus())) { if (!YesNoEnum.yes.getIndex().equals(sOrder.getPayStatus())) {
throw new BaseException("未支付无法退款"); throw new BaseException("未支付无法退款");
} }
...@@ -1637,6 +1773,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1637,6 +1773,7 @@ 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());
} }
refundExtracted(consumerWallet, sOrder, consumerMember);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -1663,6 +1800,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1663,6 +1800,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
try { try {
sOrder.setRefundReason(request.getRefundReason()); sOrder.setRefundReason(request.getRefundReason());
updateById(sOrder); updateById(sOrder);
refundExtracted(consumerWallet, sOrder, consumerMember);
//微信退款 //微信退款
// 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, 定时任务退优惠券
...@@ -1679,6 +1817,112 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1679,6 +1817,112 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
return Boolean.TRUE; return Boolean.TRUE;
} }
private void refundExtracted(ConsumerWallet consumerWallet, SOrder sOrder, ConsumerMember consumerMember) {
if (ObjectUtil.isNotEmpty(consumerWallet)) {
if (ObjectUtil.isNotEmpty(sOrder.getDuration()) && sOrder.getDuration().compareTo(BigDecimal.ZERO) > 0) {
DurationLog durationLog = new DurationLog();
durationLog.setConsumerId(sOrder.getConsumerId());
durationLog.setVariableDuration(sOrder.getDuration());
durationLog.setCurrentDuration(consumerWallet.getRemainingDuration());
durationLog.setOperationType(YesNoEnum.yes.getIndex());
durationLog.setOperationTime(new Date());
durationLogService.save(durationLog);
consumerWallet.setRemainingDuration(consumerWallet.getRemainingDuration().add(sOrder.getDuration()));
consumerWalletService.updateById(consumerWallet);
}
if (ObjectUtil.isNotEmpty(sOrder.getBalance()) && sOrder.getBalance().compareTo(BigDecimal.ZERO) > 0) {
BalanceLog balanceLog = new BalanceLog();
balanceLog.setConsumerId(sOrder.getConsumerId());
balanceLog.setVariableAmount(sOrder.getBalance());
balanceLog.setCurrentBalance(consumerWallet.getBalance());
balanceLog.setOperationType(YesNoEnum.yes.getIndex());
balanceLog.setOperationTime(new Date());
balanceLogService.save(balanceLog);
consumerWallet.setBalance(consumerWallet.getBalance().add(sOrder.getBalance()));
consumerWalletService.updateById(consumerWallet);
}
}
if (ObjectUtil.isNotEmpty(consumerMember)) {
if (consumerMember.getMemberType().equals(MemberTypeEnum.RECHARGE.getIndex())) {
IntegralLog integralLog = new IntegralLog();
integralLog.setConsumerId(sOrder.getConsumerId());
integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral());
BigDecimal integral = consumerWallet.getRemainingIntegral().subtract(sOrder.getBalance());
consumerWallet.setRemainingIntegral(integral);
integralLog.setVariableIntegral(sOrder.getBalance());
integralLog.setOperationType(YesNoEnum.no.getIndex());
integralLog.setOperationTime(new Date());
integralLogService.save(integralLog);
consumerWalletService.updateById(consumerWallet);
MemberProgressLog memberProgressLog = new MemberProgressLog();
memberProgressLog.setConsumerId(sOrder.getConsumerId());
memberProgressLog.setCurrentProgress(BigDecimal.valueOf(consumerMember.getMembershipProgress()));
Long membershipProgress = BigDecimal.valueOf(consumerMember.getMembershipProgress()).subtract(sOrder.getBalance()).longValue();
//查询当前会员类型和当前等级的会员配置
MemberConfig one = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
if (ObjectUtil.isNotEmpty(one)) {
//判断是否升级
if (membershipProgress.compareTo(one.getLimitRequirements()) < 0) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1L);
consumerMember.setMemberConfigId(one.getId());
}
}
memberProgressLog.setVariableProgress(sOrder.getBalance());
consumerMember.setMembershipProgress(membershipProgress);
memberProgressLog.setOperationType(YesNoEnum.no.getIndex());
memberProgressLog.setOperationTime(new Date());
memberProgressLogService.save(memberProgressLog);
consumerMemberService.updateConsumerMember(consumerMember);
} else if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
SConsumerCoupon coupon = consumerCouponService.getById(sOrder.getCouponId());
IntegralLog integralLog = new IntegralLog();
integralLog.setConsumerId(sOrder.getConsumerId());
integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral());
BigDecimal integral;
Long membershipProgress;
if (ObjectUtil.isNotEmpty(coupon) && !coupon.getPlatformType().equals(PlatformTypeEnum.SELF.getCode()) && coupon.getCouponType().equals(CouponTypeEnum.CASH.getCode())) {
integral = consumerWallet.getRemainingIntegral().subtract(sOrder.getPayPrice())
.subtract(sOrder.getBalance()).subtract(coupon.getCouponPayPrice());
membershipProgress = BigDecimal.valueOf(consumerMember.getMembershipProgress())
.subtract(sOrder.getPayPrice()).subtract(coupon.getCouponPayPrice()).subtract(sOrder.getBalance()).longValue();
} else {
integral = consumerWallet.getRemainingIntegral().subtract(sOrder.getPayPrice()).subtract(sOrder.getBalance());
membershipProgress = BigDecimal.valueOf(consumerMember.getMembershipProgress()).subtract(sOrder.getPayPrice()).subtract(sOrder.getBalance()).longValue();
}
integralLog.setVariableIntegral(consumerWallet.getRemainingIntegral().subtract(integral));
consumerWallet.setRemainingIntegral(integral);
integralLog.setOperationType(YesNoEnum.no.getIndex());
integralLog.setOperationTime(new Date());
integralLogService.save(integralLog);
consumerWalletService.updateById(consumerWallet);
MemberProgressLog memberProgressLog = new MemberProgressLog();
memberProgressLog.setConsumerId(sOrder.getConsumerId());
memberProgressLog.setCurrentProgress(BigDecimal.valueOf(consumerMember.getMembershipProgress()));
//查询当前会员类型和下一级的会员配置
MemberConfig one = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
if (ObjectUtil.isNotEmpty(one)) {
//判断是否升级
if (membershipProgress.compareTo(one.getLimitRequirements()) < 0) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1L);
consumerMember.setMemberConfigId(one.getId());
}
}
memberProgressLog.setVariableProgress(BigDecimal.valueOf(consumerMember.getMembershipProgress() - membershipProgress));
consumerMember.setMembershipProgress(membershipProgress);
memberProgressLog.setOperationType(YesNoEnum.no.getIndex());
memberProgressLog.setOperationTime(new Date());
memberProgressLogService.save(memberProgressLog);
consumerMemberService.updateConsumerMember(consumerMember);
}
}
}
@Override @Override
public List<SOrder> payedUnrefundListByUserId(Long userId) { public List<SOrder> payedUnrefundListByUserId(Long userId) {
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
...@@ -2039,9 +2283,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2039,9 +2283,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
return priceResponse; return priceResponse;
} }
private BigDecimal getBigDecimal(ConsumerWallet consumerWallet, Activity activity, BigDecimal timeLong, ComputedOrderPriceResponse priceResponse, BigDecimal totalFee, SRoom room, OrderComputedPriceRequest request) { private BigDecimal getBigDecimal(ConsumerWallet consumerWallet, Activity activity, BigDecimal timeLong,
ComputedOrderPriceResponse priceResponse, BigDecimal totalFee, SRoom room, OrderComputedPriceRequest request) {
if (ObjectUtil.isNotEmpty(consumerWallet)) { if (ObjectUtil.isNotEmpty(consumerWallet)) {
CronParser cronParser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ)); CronParser cronParser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
priceResponse.setDuration(BigDecimal.ZERO);
priceResponse.setRemainingDuration(BigDecimal.ZERO);
if (ObjectUtil.isNotEmpty(activity)) { if (ObjectUtil.isNotEmpty(activity)) {
Cron cron = cronParser.parse(activity.getCronExpression()); Cron cron = cronParser.parse(activity.getCronExpression());
ExecutionTime executionTime = ExecutionTime.forCron(cron); ExecutionTime executionTime = ExecutionTime.forCron(cron);
...@@ -2090,6 +2337,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2090,6 +2337,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
totalFee = new BigDecimal(0); totalFee = new BigDecimal(0);
} else if (consumerWallet.getBalance().compareTo(remainingBalance) < 0) { } else if (consumerWallet.getBalance().compareTo(remainingBalance) < 0) {
priceResponse.setBalance(consumerWallet.getBalance()); priceResponse.setBalance(consumerWallet.getBalance());
priceResponse.setRemainingBalance(BigDecimal.ZERO);
totalFee = remainingBalance.subtract(consumerWallet.getBalance()); totalFee = remainingBalance.subtract(consumerWallet.getBalance());
} }
} }
...@@ -2098,8 +2346,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2098,8 +2346,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
return totalFee; return totalFee;
} }
private BigDecimal getBigDecimal(ConsumerWallet consumerWallet, Activity activity, BigDecimal timeLong, ComputedOrderPriceResponse priceResponse, BigDecimal totalFee, SPack byId, OrderComputedPriceRequest request) { private BigDecimal getBigDecimal(ConsumerWallet consumerWallet, Activity activity, BigDecimal timeLong,
ComputedOrderPriceResponse priceResponse, BigDecimal totalFee, SPack byId, OrderComputedPriceRequest request) {
if (ObjectUtil.isNotEmpty(consumerWallet)) { if (ObjectUtil.isNotEmpty(consumerWallet)) {
priceResponse.setDuration(BigDecimal.ZERO);
priceResponse.setRemainingDuration(BigDecimal.ZERO);
CronParser cronParser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ)); CronParser cronParser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
if (ObjectUtil.isNotEmpty(activity)) { if (ObjectUtil.isNotEmpty(activity)) {
Cron cron = cronParser.parse(activity.getCronExpression()); Cron cron = cronParser.parse(activity.getCronExpression());
...@@ -2163,7 +2414,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2163,7 +2414,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
queryWrapper.eq(SOrder::getConsumerId, user.getId()); queryWrapper.eq(SOrder::getConsumerId, user.getId());
queryWrapper.in(SOrder::getStatus, OrderStatusEnum.getValidOrderStatus()); queryWrapper.in(SOrder::getStatus, OrderStatusEnum.getValidOrderStatus());
queryWrapper.eq(SOrder::getPayStatus, YesNoEnum.yes.getIndex()); queryWrapper.eq(SOrder::getPayStatus, YesNoEnum.yes.getIndex());
queryWrapper.ne(SOrder::getPayPrice, new BigDecimal(0)); // queryWrapper.ne(SOrder::getPayPrice, new BigDecimal(0));
//预约结束时间大于等于今天的年月日 //预约结束时间大于等于今天的年月日
queryWrapper.ge(SOrder::getPreEndDate, DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, new Date()))); queryWrapper.ge(SOrder::getPreEndDate, DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, new Date())));
queryWrapper.isNull(SOrder::getCouponId); queryWrapper.isNull(SOrder::getCouponId);
...@@ -2179,7 +2430,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2179,7 +2430,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
orderList.stream().forEach(item -> { orderList.stream().forEach(item -> {
boolean match = executionTime.isMatch(ZonedDateTime.ofInstant(item.getPreStartDate().toInstant(), ZoneId.systemDefault())); boolean match = executionTime.isMatch(ZonedDateTime.ofInstant(item.getPreStartDate().toInstant(), ZoneId.systemDefault()));
boolean match1 = executionTime.isMatch(ZonedDateTime.ofInstant(item.getPreEndDate().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) { if (match && match1
// && (item.getPayPrice().compareTo(item.getTotalPrice().multiply(activity.getDiscountRatio()).divide(new BigDecimal(100)))) > 0
) {
i.getAndIncrement(); i.getAndIncrement();
} }
}); });
...@@ -2240,7 +2493,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2240,7 +2493,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
RoomLabel roomLabel = roomLabelService.selectRoomLabelById(request.getRoomLabelId()); RoomLabel roomLabel = roomLabelService.selectRoomLabelById(request.getRoomLabelId());
SRoom room = roomService.getById(request.getRoomId()); SRoom room = roomService.getById(request.getRoomId());
subtract = (roomLabel.getPromotionAmount().subtract(consumerCoupon.getSalePrice())). subtract = (roomLabel.getPromotionAmount().subtract(consumerCoupon.getSalePrice())).
add(((DateUtils.differentHour(request.getPreStartDate(), request.getPreEndDate()).subtract(new BigDecimal(roomLabel.getPromotionDuration()))).multiply(room.getPrice()))); add(((DateUtils.differentHour(request.getPreStartDate(), request.getPreEndDate())
.subtract(new BigDecimal(roomLabel.getPromotionDuration()))).multiply(room.getPrice())));
} else if (!ObjectUtils.isEmpty(request.getPackId())) { } else if (!ObjectUtils.isEmpty(request.getPackId())) {
SPack byId = packService.getById(request.getPackId()); SPack byId = packService.getById(request.getPackId());
subtract = byId.getPrice().subtract(consumerCoupon.getSalePrice()); subtract = byId.getPrice().subtract(consumerCoupon.getSalePrice());
......
...@@ -76,6 +76,28 @@ ...@@ -76,6 +76,28 @@
<include refid="selectConsumerMemberVo"/> <include refid="selectConsumerMemberVo"/>
where id = #{id} where id = #{id}
</select> </select>
<select id="selectByConsumerId" resultType="share.system.domain.vo.ConsumerMemberVo">
select m.id,
m.consumer_id,
c.nick_name,
c.phone,
c.avatar,
m.membership_level,
m.member_type,
m.member_config_id,
m.expiration_date,
m.membership_progress,
m.is_delete,
m.create_by,
m.create_time,
m.update_by,
m.update_time,
m.remark
from s_consumer_member m
join s_consumer c on m.consumer_id = c.id and m.is_delete = 0
where 1 = 1
and m.consumer_id = #{consumerId}
</select>
<insert id="insertConsumerMember" parameterType="ConsumerMember" useGeneratedKeys="true" keyProperty="id"> <insert id="insertConsumerMember" parameterType="ConsumerMember" useGeneratedKeys="true" keyProperty="id">
insert into s_consumer_member insert into s_consumer_member
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
<result property="couponId" column="coupon_id"/> <result property="couponId" column="coupon_id"/>
<result property="couponPrice" column="coupon_price"/> <result property="couponPrice" column="coupon_price"/>
<result property="totalPrice" column="total_price"/> <result property="totalPrice" column="total_price"/>
<result property="duration" column="duration"/>
<result property="balance" column="balance"/>
<result property="discountRatio" column="discount_ratio"/> <result property="discountRatio" column="discount_ratio"/>
<result property="payPrice" column="pay_price"/> <result property="payPrice" column="pay_price"/>
<result property="payTime" column="pay_time"/> <result property="payTime" column="pay_time"/>
...@@ -63,6 +65,8 @@ ...@@ -63,6 +65,8 @@
coupon_price, coupon_price,
total_price, total_price,
pay_price, pay_price,
duration,
balance,
discount_ratio, discount_ratio,
pay_time, pay_time,
time_long, time_long,
...@@ -108,6 +112,8 @@ ...@@ -108,6 +112,8 @@
<if test="couponPrice != null and couponPrice != ''">and coupon_price = #{couponPrice}</if> <if test="couponPrice != null and couponPrice != ''">and coupon_price = #{couponPrice}</if>
<if test="totalPrice != null and totalPrice != ''">and total_price = #{totalPrice}</if> <if test="totalPrice != null and totalPrice != ''">and total_price = #{totalPrice}</if>
<if test="payPrice != null and payPrice != ''">and pay_price = #{payPrice}</if> <if test="payPrice != null and payPrice != ''">and pay_price = #{payPrice}</if>
<if test="duration != null and duration != ''">and duration = #{duration}</if>
<if test="balance != null and balance != ''">and balance = #{balance}</if>
<if test="discountRatio != null and discountRatio != ''">and discount_ratio = #{discountRatio}</if> <if test="discountRatio != null and discountRatio != ''">and discount_ratio = #{discountRatio}</if>
<if test="startPayTime != null"> <if test="startPayTime != null">
and DATE_FORMAT(pay_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startPayTime}, '%Y-%m-%d') and DATE_FORMAT(pay_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startPayTime}, '%Y-%m-%d')
...@@ -178,6 +184,9 @@ ...@@ -178,6 +184,9 @@
s.consumer_id, s.consumer_id,
s.consumer_name, s.consumer_name,
s.consumer_phone, s.consumer_phone,
s.duration,
s.balance,
s.discount_ratio,
s.pack_id, s.pack_id,
s.pack_price, s.pack_price,
s.coupon_id, s.coupon_id,
...@@ -223,6 +232,9 @@ ...@@ -223,6 +232,9 @@
s.consumer_id, s.consumer_id,
s.consumer_name, s.consumer_name,
s.consumer_phone, s.consumer_phone,
s.duration,
s.balance,
s.discount_ratio,
s.pack_id, s.pack_id,
s.pack_price, s.pack_price,
s.coupon_id, s.coupon_id,
...@@ -292,6 +304,8 @@ ...@@ -292,6 +304,8 @@
<if test="createTime != null and createTime != ''">create_time,</if> <if test="createTime != null and createTime != ''">create_time,</if>
<if test="arrivalTime != null and arrivalTime != ''">arrival_time,</if> <if test="arrivalTime != null and arrivalTime != ''">arrival_time,</if>
<if test="discountRatio != null and discountRatio != ''">discount_ratio,</if> <if test="discountRatio != null and discountRatio != ''">discount_ratio,</if>
<if test="duration != null and duration != ''">duration,</if>
<if test="balance != null and balance != '' ">balance,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderNo != null">#{orderNo},</if> <if test="orderNo != null">#{orderNo},</if>
...@@ -326,7 +340,9 @@ ...@@ -326,7 +340,9 @@
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="arrivalTime != null">#{arrivalTime},</if> <if test="arrivalTime != null">#{arrivalTime},</if>
<if test="discountRatio != null">#{discountRatio},</if>" <if test="discountRatio != null">#{discountRatio},</if>
<if test="duration != null">#{duration},</if>
<if test="balance != null">#{balance},</if>
</trim> </trim>
</insert> </insert>
...@@ -367,6 +383,8 @@ ...@@ -367,6 +383,8 @@
<if test="arrivalTime != null">arrival_time = #{arrivalTime},</if> <if test="arrivalTime != null">arrival_time = #{arrivalTime},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="discountRatio != null">discount_ratio = #{discountRatio},</if> <if test="discountRatio != null">discount_ratio = #{discountRatio},</if>
<if test="duration != null">duration = #{duration},</if>
<if test="balance != null">balance = #{balance},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
......
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