1. 优惠券
This commit is contained in:
parent
6386b46b36
commit
e782f4183d
|
@ -203,20 +203,19 @@ public class AppController extends BaseController
|
|||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 根据定位获取运营区信息,并返回所有车辆定位
|
||||
// */
|
||||
// @GetMapping(value = "/vehicleLocalization")
|
||||
// public AjaxResult vehicleLocalization(String longitude,String latitude)
|
||||
// {
|
||||
// if(StrUtil.isBlank(longitude) || StrUtil.isBlank(latitude)){
|
||||
// logger.info("没有经纬度参数:【longitude={}】,【latitude={}】",longitude,latitude);
|
||||
// return error("请传经纬度参数"+"【longitude="+longitude+"】,【latitude="+latitude+"】");
|
||||
// }
|
||||
//// webSocket.SendMessage("需要发送的消息", "识别唯一session");
|
||||
// List<AsDevice> asDevices = asDeviceService.vehicleLocalization(longitude,latitude);
|
||||
// return success(asDevices);
|
||||
// }
|
||||
/**
|
||||
* 根据经纬度查询附近500米的所有车辆
|
||||
*/
|
||||
@GetMapping(value = "/vehicleLocalization")
|
||||
public AjaxResult vehicleLocalization(String longitude,String latitude)
|
||||
{
|
||||
if(StrUtil.isBlank(longitude) || StrUtil.isBlank(latitude)){
|
||||
logger.info("没有经纬度参数:【longitude={}】,【latitude={}】",longitude,latitude);
|
||||
return error("请传经纬度参数"+"【longitude="+longitude+"】,【latitude="+latitude+"】");
|
||||
}
|
||||
List<AsDevice> asDevices = asDeviceService.vehicleLocalization(longitude,latitude);
|
||||
return success(asDevices);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据运营区id获取所有车辆
|
||||
|
|
|
@ -24,9 +24,7 @@ import com.ruoyi.system.domain.*;
|
|||
import com.ruoyi.system.domain.response.FaultResponse;
|
||||
import com.ruoyi.system.domain.response.OrderResponse;
|
||||
import com.ruoyi.system.domain.vo.*;
|
||||
import com.ruoyi.system.mapper.AsDeviceMapper;
|
||||
import com.ruoyi.system.mapper.AsUserMapper;
|
||||
import com.ruoyi.system.mapper.EtOrderMapper;
|
||||
import com.ruoyi.system.mapper.*;
|
||||
import com.ruoyi.system.service.*;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -36,10 +34,8 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* app接口(需要登录校验的)
|
||||
|
@ -104,6 +100,13 @@ public class AppVerifyController extends BaseController
|
|||
@Autowired
|
||||
private IWxPayService wxPayService;
|
||||
|
||||
@Resource
|
||||
private EtCapitalFlowMapper etCapitalFlowMapper;
|
||||
|
||||
@Resource
|
||||
private EtOperatingAreaMapper etOperatingAreaMapper;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 故障上报
|
||||
|
@ -887,9 +890,43 @@ public class AppVerifyController extends BaseController
|
|||
{
|
||||
logger.info("【获取运营商信息】获取到areaId:【{}】", areaId);
|
||||
SysDept sysDept = wxPayService.getDeptObjByAreaId(areaId);
|
||||
|
||||
BigDecimal todayOrderAmount = getTodayOrderAmount(sysDept);
|
||||
// 更新 sysDept 的余额字段
|
||||
if (sysDept.getBalance() != null) {
|
||||
sysDept.setBalance(sysDept.getBalance().subtract(todayOrderAmount));
|
||||
}
|
||||
return success(sysDept);
|
||||
}
|
||||
|
||||
/** 获取今日订单金额 */
|
||||
@NotNull
|
||||
private BigDecimal getTodayOrderAmount(SysDept sysDept) {
|
||||
// 获取今天的日期字符串
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String startDateStr = dateFormat.format(new Date()) + " 00:00:00";
|
||||
String endDateStr = dateFormat.format(new Date()) + " 23:59:59";
|
||||
|
||||
//今日订单金额
|
||||
BigDecimal todayOrderAmount = BigDecimal.ZERO;
|
||||
List<Long> longs = etOperatingAreaMapper.selectAreaListByDeptId(sysDept.getDeptId());
|
||||
for (Long id:longs) {
|
||||
BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, id), BigDecimal.ZERO);//新增
|
||||
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, id), BigDecimal.ZERO);//退款
|
||||
BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, id);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,id);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal areaOrderAmount = defaultIfNull(payFee.subtract(serviceFee).subtract(refundFee).subtract(platformServiceFee), BigDecimal.ZERO);//营收 = 新增 - 手续费 - 退款 - 平台服务费
|
||||
if (areaOrderAmount != null) {
|
||||
todayOrderAmount = todayOrderAmount.add(areaOrderAmount);
|
||||
}
|
||||
}
|
||||
return todayOrderAmount;
|
||||
}
|
||||
|
||||
private BigDecimal defaultIfNull(BigDecimal value, BigDecimal defaultValue) {
|
||||
return value != null ? value : defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定APP用户
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.EtCouponClaimLog;
|
||||
import com.ruoyi.system.service.IEtCouponClaimLogService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 优惠券领取记录Controller
|
||||
*
|
||||
* @author qzz
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/claimLog")
|
||||
public class EtCouponClaimLogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IEtCouponClaimLogService etCouponClaimLogService;
|
||||
|
||||
/**
|
||||
* 查询优惠券领取记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:claimLog:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(EtCouponClaimLog etCouponClaimLog)
|
||||
{
|
||||
startPage();
|
||||
List<EtCouponClaimLog> list = etCouponClaimLogService.selectEtCouponClaimLogList(etCouponClaimLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出优惠券领取记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:claimLog:export')")
|
||||
@Log(title = "优惠券领取记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, EtCouponClaimLog etCouponClaimLog)
|
||||
{
|
||||
List<EtCouponClaimLog> list = etCouponClaimLogService.selectEtCouponClaimLogList(etCouponClaimLog);
|
||||
ExcelUtil<EtCouponClaimLog> util = new ExcelUtil<EtCouponClaimLog>(EtCouponClaimLog.class);
|
||||
util.exportExcel(response, list, "优惠券领取记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取优惠券领取记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:claimLog:query')")
|
||||
@GetMapping(value = "/{claimId}")
|
||||
public AjaxResult getInfo(@PathVariable("claimId") Long claimId)
|
||||
{
|
||||
return success(etCouponClaimLogService.selectEtCouponClaimLogByClaimId(claimId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增优惠券领取记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:claimLog:add')")
|
||||
@Log(title = "优惠券领取记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EtCouponClaimLog etCouponClaimLog)
|
||||
{
|
||||
return toAjax(etCouponClaimLogService.insertEtCouponClaimLog(etCouponClaimLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改优惠券领取记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:claimLog:edit')")
|
||||
@Log(title = "优惠券领取记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EtCouponClaimLog etCouponClaimLog)
|
||||
{
|
||||
return toAjax(etCouponClaimLogService.updateEtCouponClaimLog(etCouponClaimLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除优惠券领取记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:claimLog:remove')")
|
||||
@Log(title = "优惠券领取记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{claimIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] claimIds)
|
||||
{
|
||||
return toAjax(etCouponClaimLogService.deleteEtCouponClaimLogByClaimIds(claimIds));
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@ import com.ruoyi.system.mapper.EtOrderMapper;
|
|||
import com.ruoyi.system.service.IEtOperatingAreaService;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -103,11 +104,42 @@ public class SysDeptController extends BaseController
|
|||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
ajax.put(AjaxResult.DATA_TAG,deptService.selectDeptById(deptId));
|
||||
SysDept sysDept = deptService.selectDeptById(deptId);
|
||||
BigDecimal todayOrderAmount = getTodayOrderAmount(deptId);
|
||||
|
||||
// 更新 sysDept 的余额字段
|
||||
if (sysDept.getBalance() != null) {
|
||||
sysDept.setBalance(sysDept.getBalance().subtract(todayOrderAmount));
|
||||
}
|
||||
|
||||
ajax.put(AjaxResult.DATA_TAG,sysDept);
|
||||
ajax.put("areaIds", etOperatingAreaService.selectAreaListByDeptId(deptId));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private BigDecimal getTodayOrderAmount(@PathVariable Long deptId) {
|
||||
// 获取今天的日期字符串
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String startDateStr = dateFormat.format(new Date()) + " 00:00:00";
|
||||
String endDateStr = dateFormat.format(new Date()) + " 23:59:59";
|
||||
|
||||
//今日订单金额
|
||||
BigDecimal todayOrderAmount = BigDecimal.ZERO;
|
||||
List<Long> longs = etOperatingAreaMapper.selectAreaListByDeptId(deptId);
|
||||
for (Long areaId:longs) {
|
||||
BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//新增
|
||||
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//退款
|
||||
BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, areaId);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,areaId);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal areaOrderAmount = defaultIfNull(payFee.subtract(serviceFee).subtract(refundFee).subtract(platformServiceFee), BigDecimal.ZERO);//营收 = 新增 - 手续费 - 退款 - 平台服务费
|
||||
if (areaOrderAmount != null) {
|
||||
todayOrderAmount = todayOrderAmount.add(areaOrderAmount);
|
||||
}
|
||||
}
|
||||
return todayOrderAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增运营商
|
||||
*/
|
||||
|
@ -216,25 +248,7 @@ public class SysDeptController extends BaseController
|
|||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
SysDept sysDept = deptService.selectDeptById(deptId);
|
||||
|
||||
// 获取今天的日期字符串
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String startDateStr = dateFormat.format(new Date()) + " 00:00:00";
|
||||
String endDateStr = dateFormat.format(new Date()) + " 23:59:59";
|
||||
|
||||
//今日订单金额
|
||||
BigDecimal todayOrderAmount = BigDecimal.ZERO;
|
||||
List<Long> longs = etOperatingAreaMapper.selectAreaListByDeptId(deptId);
|
||||
for (Long areaId:longs) {
|
||||
BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//新增
|
||||
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//退款
|
||||
BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, areaId);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,areaId);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal areaOrderAmount = defaultIfNull(payFee.subtract(serviceFee).subtract(refundFee).subtract(platformServiceFee), BigDecimal.ZERO);//营收 = 新增 - 手续费 - 退款 - 平台服务费
|
||||
if (areaOrderAmount != null) {
|
||||
todayOrderAmount = todayOrderAmount.add(areaOrderAmount);
|
||||
}
|
||||
}
|
||||
BigDecimal todayOrderAmount = getTodayOrderAmount(deptId);//获取今日金额
|
||||
// 更新 sysDept 的余额字段
|
||||
if (sysDept.getBalance() != null) {
|
||||
sysDept.setBalance(sysDept.getBalance().subtract(todayOrderAmount));
|
||||
|
|
|
@ -35,20 +35,32 @@ public class EtCoupon extends BaseEntity
|
|||
@Excel(name = "区域")
|
||||
private Long areaId;
|
||||
|
||||
/** 区域名称 */
|
||||
@Excel(name = "区域名称")
|
||||
private String areaName;
|
||||
|
||||
/** 用户 */
|
||||
@Excel(name = "用户")
|
||||
private Long userId;
|
||||
|
||||
/** 用户名 */
|
||||
@Excel(name = "用户名")
|
||||
private String userName;
|
||||
|
||||
/** 抵扣金额 */
|
||||
@Excel(name = "抵扣金额")
|
||||
private BigDecimal discountAmount;
|
||||
|
||||
/** 有效时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "有效时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "有效时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date expirationTime;
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
|
||||
/** 限制次数: 0无限制 */
|
||||
@Excel(name = "限制次数:0无限制")
|
||||
private String limitNum;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 优惠券领取记录对象 et_coupon_claim_log
|
||||
*
|
||||
* @author qzz
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
@Data
|
||||
public class EtCouponClaimLog extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 领取id */
|
||||
private Long claimId;
|
||||
|
||||
/** 区域 */
|
||||
@Excel(name = "区域")
|
||||
private Long areaId;
|
||||
|
||||
/** 区域名称 */
|
||||
@Excel(name = "区域名称")
|
||||
private String areaName;
|
||||
|
||||
/** 用户 */
|
||||
@Excel(name = "用户")
|
||||
private Long userId;
|
||||
|
||||
/** 用户名 */
|
||||
@Excel(name = "用户名")
|
||||
private String userName;
|
||||
|
||||
/** 优惠券 */
|
||||
@Excel(name = "优惠券")
|
||||
private Long couponId;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.EtCouponClaimLog;
|
||||
|
||||
/**
|
||||
* 优惠券领取记录Mapper接口
|
||||
*
|
||||
* @author qzz
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
public interface EtCouponClaimLogMapper
|
||||
{
|
||||
/**
|
||||
* 查询优惠券领取记录
|
||||
*
|
||||
* @param claimId 优惠券领取记录主键
|
||||
* @return 优惠券领取记录
|
||||
*/
|
||||
public EtCouponClaimLog selectEtCouponClaimLogByClaimId(Long claimId);
|
||||
|
||||
/**
|
||||
* 查询优惠券领取记录列表
|
||||
*
|
||||
* @param etCouponClaimLog 优惠券领取记录
|
||||
* @return 优惠券领取记录集合
|
||||
*/
|
||||
public List<EtCouponClaimLog> selectEtCouponClaimLogList(EtCouponClaimLog etCouponClaimLog);
|
||||
|
||||
/**
|
||||
* 新增优惠券领取记录
|
||||
*
|
||||
* @param etCouponClaimLog 优惠券领取记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEtCouponClaimLog(EtCouponClaimLog etCouponClaimLog);
|
||||
|
||||
/**
|
||||
* 修改优惠券领取记录
|
||||
*
|
||||
* @param etCouponClaimLog 优惠券领取记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEtCouponClaimLog(EtCouponClaimLog etCouponClaimLog);
|
||||
|
||||
/**
|
||||
* 删除优惠券领取记录
|
||||
*
|
||||
* @param claimId 优惠券领取记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEtCouponClaimLogByClaimId(Long claimId);
|
||||
|
||||
/**
|
||||
* 批量删除优惠券领取记录
|
||||
*
|
||||
* @param claimIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEtCouponClaimLogByClaimIds(Long[] claimIds);
|
||||
}
|
|
@ -149,7 +149,7 @@ public interface IAsDeviceService extends IService<AsDevice>
|
|||
public int deleteAsDeviceByDeviceId(Long deviceId);
|
||||
|
||||
/**
|
||||
* 根据定位获取运营区信息,并返回所有车辆定位
|
||||
* 根据经纬度查询附近500米的所有车辆
|
||||
*
|
||||
* @param longitude 经度
|
||||
* @param latitude 纬度
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.EtCouponClaimLog;
|
||||
|
||||
/**
|
||||
* 优惠券领取记录Service接口
|
||||
*
|
||||
* @author qzz
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
public interface IEtCouponClaimLogService
|
||||
{
|
||||
/**
|
||||
* 查询优惠券领取记录
|
||||
*
|
||||
* @param claimId 优惠券领取记录主键
|
||||
* @return 优惠券领取记录
|
||||
*/
|
||||
public EtCouponClaimLog selectEtCouponClaimLogByClaimId(Long claimId);
|
||||
|
||||
/**
|
||||
* 查询优惠券领取记录列表
|
||||
*
|
||||
* @param etCouponClaimLog 优惠券领取记录
|
||||
* @return 优惠券领取记录集合
|
||||
*/
|
||||
public List<EtCouponClaimLog> selectEtCouponClaimLogList(EtCouponClaimLog etCouponClaimLog);
|
||||
|
||||
/**
|
||||
* 新增优惠券领取记录
|
||||
*
|
||||
* @param etCouponClaimLog 优惠券领取记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEtCouponClaimLog(EtCouponClaimLog etCouponClaimLog);
|
||||
|
||||
/**
|
||||
* 修改优惠券领取记录
|
||||
*
|
||||
* @param etCouponClaimLog 优惠券领取记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEtCouponClaimLog(EtCouponClaimLog etCouponClaimLog);
|
||||
|
||||
/**
|
||||
* 批量删除优惠券领取记录
|
||||
*
|
||||
* @param claimIds 需要删除的优惠券领取记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEtCouponClaimLogByClaimIds(Long[] claimIds);
|
||||
|
||||
/**
|
||||
* 删除优惠券领取记录信息
|
||||
*
|
||||
* @param claimId 优惠券领取记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEtCouponClaimLogByClaimId(Long claimId);
|
||||
}
|
|
@ -111,6 +111,9 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
@Autowired
|
||||
private CallbackService callbackService;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService sysConfigService;
|
||||
|
||||
@Value(value = "${iot.iotUrl}")
|
||||
private String iotUrl;
|
||||
|
||||
|
@ -517,39 +520,38 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
}
|
||||
|
||||
/**
|
||||
* 根据定位获取运营区信息,并返回所有车辆定位
|
||||
* a. 将前端的边界值获取后转成geometry格式
|
||||
* b. 模拟gps定位根据定位计算在哪个运营区内
|
||||
* c. 获取到运营区信息,查询出该运营区下所有的车辆信息并获取所有车辆的定位返回前端
|
||||
* 根据经纬度查询附近500米的所有车辆
|
||||
* @param longitude 经度
|
||||
* @param latitude 纬度
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<AsDevice> vehicleLocalization(String longitude, String latitude) {
|
||||
List<EtOperatingArea> etOperatingAreas = etOperatingAreaService.selectEtOperatingAreaList(new EtOperatingArea());
|
||||
EtOperatingArea area = null;
|
||||
for(EtOperatingArea etOperatingArea:etOperatingAreas){
|
||||
Geometry geometry = GeoUtils.fromWkt(etOperatingArea.getBoundary());
|
||||
Boolean inCircle = GeoUtils.isInCircle(longitude, latitude, geometry);
|
||||
if(inCircle){
|
||||
area = etOperatingArea;
|
||||
break;
|
||||
QueryWrapper<AsDevice> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("status", "1"); // 设备状态正常
|
||||
|
||||
// 查询所有设备
|
||||
List<AsDevice> allDevices = asDeviceMapper.selectList(wrapper);
|
||||
|
||||
List<AsDevice> nearbyDevices = new ArrayList<>();
|
||||
double targetLon = Double.parseDouble(longitude);
|
||||
double targetLat = Double.parseDouble(latitude);
|
||||
|
||||
int nearbyVehicle = 500;// 默认距离小于等于 500 米
|
||||
String nearbyVehicles = sysConfigService.selectConfigByKey("nearby.vehicles");
|
||||
if(StrUtil.isNotBlank(nearbyVehicles)){
|
||||
nearbyVehicle = Integer.parseInt(nearbyVehicles);
|
||||
}
|
||||
for (AsDevice device : allDevices) {
|
||||
double deviceLon = Double.parseDouble(device.getLongitude());
|
||||
double deviceLat = Double.parseDouble(device.getLatitude());
|
||||
double distance = GeoUtils.calculateDistance(targetLat, targetLon, deviceLat, deviceLon);
|
||||
|
||||
if (distance <= nearbyVehicle) {
|
||||
nearbyDevices.add(device);
|
||||
}
|
||||
}
|
||||
List<AsDevice> asDevices = new ArrayList<>();
|
||||
if(ObjectUtil.isNotNull(area)){
|
||||
/** c. 获取到运营区信息,查询出该运营区下所有的车辆信息并获取所有车辆的定位返回前端*/
|
||||
log.info("在【{}】运营区内",area.getAreaName());
|
||||
QueryWrapper<AsDevice> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("area_id", area.getAreaId());
|
||||
wrapper.in("status","1");//0 未上架,1-正常
|
||||
asDevices = asDeviceMapper.selectList(wrapper);
|
||||
return asDevices;
|
||||
}else{
|
||||
log.info("不在任何运营区内");
|
||||
return asDevices;
|
||||
}
|
||||
return nearbyDevices;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1648,40 +1650,41 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
EtFeeRule rule = etFeeRuleService.selectEtFeeRuleByRuleIdIncludeDelete(order.getRuleId());
|
||||
Integer autoRefundDeposit = rule.getAutoRefundDeposit();
|
||||
log.info("【还车关锁】进入押金抵扣环节--------"+autoRefundDeposit+"个小时后退还押金");
|
||||
/** 2. 获取最后一次押金*/
|
||||
EtOrder depositOrder = etOrderService.getDepositOrder(order.getUserId());
|
||||
BigDecimal deposit = depositOrder.getTotalFee();
|
||||
BigDecimal ridingFee = order.getTotalFee();
|
||||
BigDecimal afterDeductionFee;
|
||||
String mark;
|
||||
if(deposit.compareTo(ridingFee) <= 0){// 骑行费大于押金,订单为未支付, 抵扣后的金额 = 骑行费 - 押金
|
||||
afterDeductionFee = BigDecimal.ZERO;
|
||||
mark = "押金抵扣成功,骑行费【"+ridingFee+"】大于押金【"+deposit+"】";
|
||||
order.setStatus(ServiceConstants.ORDER_STATUS_RIDING_END);
|
||||
order.setPayFee(deposit);
|
||||
}else{
|
||||
// 押金大于订单金额 扣除后
|
||||
afterDeductionFee = deposit.subtract(ridingFee);
|
||||
mark = "押金抵扣成功,骑行费【"+ridingFee+"】小于押金【"+deposit+"】,扣除后金额【"+afterDeductionFee+"】";
|
||||
order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||
}
|
||||
/** 更新骑行订单*/
|
||||
order.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
|
||||
order.setPayTime(DateUtils.getNowDate());
|
||||
order.setPayType(ServiceConstants.PAY_TYPE_YJ);
|
||||
order.setMark(mark);
|
||||
order.setDepositDeduction(ServiceConstants.IS_DEPOSIT_DEDUCTION);
|
||||
/** 更新押金订单*/
|
||||
depositOrder.setDepositDeduction(ServiceConstants.IS_DEPOSIT_DEDUCTION);
|
||||
int updateEtOrder1 = etOrderMapper.updateEtOrder(depositOrder);
|
||||
if(updateEtOrder1 == 0){
|
||||
throw new ServiceException("押金抵扣失败,更新押金订单失败");
|
||||
}
|
||||
/** 押金抵扣后生成资金流水记录 */
|
||||
callbackService.capitalFlowRecords(order,ServiceConstants.FLOW_TYPE_INCOME,ServiceConstants.ORDER_TYPE_RIDING,ServiceConstants.OWNER_TYPE_OPERATOR,null,ServiceConstants.PAY_TYPE_YJ);
|
||||
//创建一个定时器,计算出退还时间后,执行退款操作
|
||||
// 往后推autoRefundDeposit小时执行
|
||||
if(autoRefundDeposit!=null){
|
||||
//创建一个定时器,计算出退还时间后,执行退款操作
|
||||
// 往后推autoRefundDeposit小时执行
|
||||
EtOrder finalOrder = order;
|
||||
scheduledExecutorService.schedule(() -> {
|
||||
/** 2. 获取最后一次押金*/
|
||||
EtOrder depositOrder = etOrderService.getDepositOrder(finalOrder.getUserId());
|
||||
BigDecimal deposit = depositOrder.getTotalFee();
|
||||
BigDecimal ridingFee = finalOrder.getTotalFee();
|
||||
BigDecimal afterDeductionFee;
|
||||
String mark;
|
||||
if(deposit.compareTo(ridingFee) <= 0){// 骑行费大于押金,订单为未支付, 抵扣后的金额 = 骑行费 - 押金
|
||||
afterDeductionFee = BigDecimal.ZERO;
|
||||
mark = "押金抵扣成功,骑行费【"+ridingFee+"】大于押金【"+deposit+"】";
|
||||
finalOrder.setStatus(ServiceConstants.ORDER_STATUS_RIDING_END);
|
||||
finalOrder.setPayFee(deposit);
|
||||
}else{
|
||||
// 押金大于订单金额 扣除后
|
||||
afterDeductionFee = deposit.subtract(ridingFee);
|
||||
mark = "押金抵扣成功,骑行费【"+ridingFee+"】小于押金【"+deposit+"】,扣除后金额【"+afterDeductionFee+"】";
|
||||
finalOrder.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||
}
|
||||
/** 更新骑行订单*/
|
||||
finalOrder.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
|
||||
finalOrder.setPayTime(DateUtils.getNowDate());
|
||||
finalOrder.setPayType(ServiceConstants.PAY_TYPE_YJ);
|
||||
finalOrder.setMark(mark);
|
||||
finalOrder.setDepositDeduction(ServiceConstants.IS_DEPOSIT_DEDUCTION);
|
||||
/** 更新押金订单*/
|
||||
depositOrder.setDepositDeduction(ServiceConstants.IS_DEPOSIT_DEDUCTION);
|
||||
int updateEtOrder1 = etOrderMapper.updateEtOrder(depositOrder);
|
||||
if(updateEtOrder1 == 0){
|
||||
throw new ServiceException("押金抵扣失败,更新押金订单失败");
|
||||
}
|
||||
if(afterDeductionFee.compareTo(BigDecimal.ZERO) > 0){
|
||||
/** 退款剩余押金*/
|
||||
Refund refund = wxPayService.refund(depositOrder, "押金抵扣退款",afterDeductionFee,IdUtils.getOrderNo("ref"));
|
||||
|
@ -1706,8 +1709,6 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
}
|
||||
}
|
||||
}
|
||||
/** 押金抵扣后生成资金流水记录 */
|
||||
callbackService.capitalFlowRecords(finalOrder,ServiceConstants.FLOW_TYPE_INCOME,ServiceConstants.ORDER_TYPE_RIDING,ServiceConstants.OWNER_TYPE_OPERATOR,null,ServiceConstants.PAY_TYPE_YJ);
|
||||
}, autoRefundDeposit , TimeUnit.HOURS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.EtCouponClaimLogMapper;
|
||||
import com.ruoyi.system.domain.EtCouponClaimLog;
|
||||
import com.ruoyi.system.service.IEtCouponClaimLogService;
|
||||
|
||||
/**
|
||||
* 优惠券领取记录Service业务层处理
|
||||
*
|
||||
* @author qzz
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
@Service
|
||||
public class EtCouponClaimLogServiceImpl implements IEtCouponClaimLogService
|
||||
{
|
||||
@Autowired
|
||||
private EtCouponClaimLogMapper etCouponClaimLogMapper;
|
||||
|
||||
/**
|
||||
* 查询优惠券领取记录
|
||||
*
|
||||
* @param claimId 优惠券领取记录主键
|
||||
* @return 优惠券领取记录
|
||||
*/
|
||||
@Override
|
||||
public EtCouponClaimLog selectEtCouponClaimLogByClaimId(Long claimId)
|
||||
{
|
||||
return etCouponClaimLogMapper.selectEtCouponClaimLogByClaimId(claimId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询优惠券领取记录列表
|
||||
*
|
||||
* @param etCouponClaimLog 优惠券领取记录
|
||||
* @return 优惠券领取记录
|
||||
*/
|
||||
@Override
|
||||
public List<EtCouponClaimLog> selectEtCouponClaimLogList(EtCouponClaimLog etCouponClaimLog)
|
||||
{
|
||||
return etCouponClaimLogMapper.selectEtCouponClaimLogList(etCouponClaimLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增优惠券领取记录
|
||||
*
|
||||
* @param etCouponClaimLog 优惠券领取记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEtCouponClaimLog(EtCouponClaimLog etCouponClaimLog)
|
||||
{
|
||||
etCouponClaimLog.setCreateTime(DateUtils.getNowDate());
|
||||
return etCouponClaimLogMapper.insertEtCouponClaimLog(etCouponClaimLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改优惠券领取记录
|
||||
*
|
||||
* @param etCouponClaimLog 优惠券领取记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEtCouponClaimLog(EtCouponClaimLog etCouponClaimLog)
|
||||
{
|
||||
return etCouponClaimLogMapper.updateEtCouponClaimLog(etCouponClaimLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除优惠券领取记录
|
||||
*
|
||||
* @param claimIds 需要删除的优惠券领取记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEtCouponClaimLogByClaimIds(Long[] claimIds)
|
||||
{
|
||||
return etCouponClaimLogMapper.deleteEtCouponClaimLogByClaimIds(claimIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除优惠券领取记录信息
|
||||
*
|
||||
* @param claimId 优惠券领取记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEtCouponClaimLogByClaimId(Long claimId)
|
||||
{
|
||||
return etCouponClaimLogMapper.deleteEtCouponClaimLogByClaimId(claimId);
|
||||
}
|
||||
}
|
|
@ -318,7 +318,7 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
refund.setRefundResult(Constants.SUCCESS2);
|
||||
refund.setUserName(etOrder.getUserName());
|
||||
PageUtils.startPage();
|
||||
List<EtRefund> etRefunds = etRefundMapper.selectEtRefundList(refund);;
|
||||
List<EtRefund> etRefunds = etRefundMapper.selectEtRefundList(refund);
|
||||
etRefunds.forEach(etRefund -> {
|
||||
AsUser asUser = asUserService.selectUserById(etRefund.getUserId());
|
||||
RechargeVo rechargeVo = new RechargeVo();
|
||||
|
|
|
@ -27,7 +27,7 @@ import com.ruoyi.system.service.ISysRoleService;
|
|||
|
||||
/**
|
||||
* 角色 业务层处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
|
@ -47,12 +47,12 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 根据条件分页查询角色数据
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 角色数据集合信息
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d")
|
||||
// @DataScope(deptAlias = "d")
|
||||
public List<SysRole> selectRoleList(SysRole role)
|
||||
{
|
||||
return roleMapper.selectRoleList(role);
|
||||
|
@ -60,7 +60,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 根据用户ID查询角色
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 角色列表
|
||||
*/
|
||||
|
@ -85,7 +85,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 根据用户ID查询权限
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
|
@ -106,7 +106,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 查询所有角色
|
||||
*
|
||||
*
|
||||
* @return 角色列表
|
||||
*/
|
||||
@Override
|
||||
|
@ -117,7 +117,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 根据用户ID获取角色选择框列表
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 选中角色ID列表
|
||||
*/
|
||||
|
@ -129,7 +129,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 通过角色ID查询角色
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
|
@ -141,7 +141,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 校验角色名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -159,7 +159,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 校验角色权限是否唯一
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -177,7 +177,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 校验角色是否允许操作
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
*/
|
||||
@Override
|
||||
|
@ -191,7 +191,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 校验角色是否有数据权限
|
||||
*
|
||||
*
|
||||
* @param roleId 角色id
|
||||
*/
|
||||
@Override
|
||||
|
@ -211,7 +211,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 通过角色ID查询角色使用数量
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -223,7 +223,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 新增保存角色信息
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -238,7 +238,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 修改保存角色信息
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -255,7 +255,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 修改角色状态
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -267,7 +267,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 修改数据权限信息
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -285,7 +285,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 新增角色菜单信息
|
||||
*
|
||||
*
|
||||
* @param role 角色对象
|
||||
*/
|
||||
public int insertRoleMenu(SysRole role)
|
||||
|
@ -333,7 +333,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 通过角色ID删除角色
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -350,7 +350,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 批量删除角色信息
|
||||
*
|
||||
*
|
||||
* @param roleIds 需要删除的角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -377,7 +377,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 取消授权用户角色
|
||||
*
|
||||
*
|
||||
* @param userRole 用户和角色关联信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -389,7 +389,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 批量取消授权用户角色
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 需要取消授权的用户数据ID
|
||||
* @return 结果
|
||||
|
@ -402,7 +402,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
|
||||
/**
|
||||
* 批量选择授权用户角色
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 需要授权的用户数据ID
|
||||
* @return 结果
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.EtCouponClaimLogMapper">
|
||||
|
||||
<resultMap type="EtCouponClaimLog" id="EtCouponClaimLogResult">
|
||||
<result property="claimId" column="claim_id" />
|
||||
<result property="areaId" column="area_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="couponId" column="coupon_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEtCouponClaimLogVo">
|
||||
select claim_id, area_id, user_id, coupon_id, create_time from et_coupon_claim_log
|
||||
</sql>
|
||||
|
||||
<select id="selectEtCouponClaimLogList" parameterType="EtCouponClaimLog" resultMap="EtCouponClaimLogResult">
|
||||
select
|
||||
l.claim_id,
|
||||
l.area_id,
|
||||
a.area_name areaName,
|
||||
l.user_id,
|
||||
u.user_name userName,
|
||||
l.coupon_id,
|
||||
l.create_time
|
||||
from et_coupon_claim_log l
|
||||
left join et_operating_area a on a.area_id = l.area_id
|
||||
left join et_user u on u.user_id = l.user_id
|
||||
<where>
|
||||
<if test="areaId != null "> and l.area_id like concat('%', #{areaId}, '%')</if>
|
||||
<if test="areaName != null "> and a.area_name like concat('%', #{areaName}, '%')</if>
|
||||
<if test="userId != null "> and l.user_id like concat('%', #{userId}, '%')</if>
|
||||
<if test="userName != null "> and u.user_name = #{userName}</if>
|
||||
<if test="couponId != null "> and l.coupon_id like concat('%', #{couponId}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEtCouponClaimLogByClaimId" parameterType="Long" resultMap="EtCouponClaimLogResult">
|
||||
<include refid="selectEtCouponClaimLogVo"/>
|
||||
where claim_id = #{claimId}
|
||||
</select>
|
||||
|
||||
<insert id="insertEtCouponClaimLog" parameterType="EtCouponClaimLog" useGeneratedKeys="true" keyProperty="claimId">
|
||||
insert into et_coupon_claim_log
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="areaId != null">area_id,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="couponId != null">coupon_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="areaId != null">#{areaId},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="couponId != null">#{couponId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEtCouponClaimLog" parameterType="EtCouponClaimLog">
|
||||
update et_coupon_claim_log
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="areaId != null">area_id = #{areaId},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="couponId != null">coupon_id = #{couponId},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where claim_id = #{claimId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEtCouponClaimLogByClaimId" parameterType="Long">
|
||||
delete from et_coupon_claim_log where claim_id = #{claimId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEtCouponClaimLogByClaimIds" parameterType="String">
|
||||
delete from et_coupon_claim_log where claim_id in
|
||||
<foreach item="claimId" collection="array" open="(" separator="," close=")">
|
||||
#{claimId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -3,7 +3,7 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.EtCouponMapper">
|
||||
|
||||
|
||||
<resultMap type="EtCoupon" id="EtCouponResult">
|
||||
<result property="couponId" column="coupon_id" />
|
||||
<result property="type" column="type" />
|
||||
|
@ -14,30 +14,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="createTime" column="create_time" />
|
||||
<result property="expirationTime" column="expiration_time" />
|
||||
<result property="status" column="status" />
|
||||
<result property="limitNum" column="limit_num" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEtCouponVo">
|
||||
select coupon_id, type, discount_percent, area_id, user_id, discount_amount, create_time, expiration_time, status from et_coupon
|
||||
select coupon_id, type, discount_percent, area_id, user_id, discount_amount, create_time, expiration_time, status, limit_num from et_coupon
|
||||
</sql>
|
||||
|
||||
<select id="selectEtCouponList" parameterType="EtCoupon" resultMap="EtCouponResult">
|
||||
<include refid="selectEtCouponVo"/>
|
||||
<where>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="discountPercent != null "> and discount_percent = #{discountPercent}</if>
|
||||
<if test="areaId != null "> and area_id = #{areaId}</if>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="discountAmount != null "> and discount_amount = #{discountAmount}</if>
|
||||
<if test="expirationTime != null "> and expiration_time = #{expirationTime}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
SELECT
|
||||
c.coupon_id,
|
||||
c.type,
|
||||
c.discount_percent,
|
||||
c.area_id,
|
||||
a.area_name areaName,
|
||||
c.user_id,
|
||||
u.user_name userName,
|
||||
c.discount_amount,
|
||||
c.create_time,
|
||||
c.expiration_time,
|
||||
c.STATUS,
|
||||
c.limit_num
|
||||
FROM
|
||||
et_coupon c
|
||||
left join et_operating_area a on a.area_id = c.area_id
|
||||
left join et_user u on u.user_id = c.user_id
|
||||
<where>
|
||||
<if test="type != null and type != ''"> and c.type = #{type}</if>
|
||||
<if test="discountPercent != null "> and c.discount_percent = #{discountPercent}</if>
|
||||
<if test="areaId != null "> and c.area_id = #{areaId}</if>
|
||||
<if test="areaName != null "> and a.area_name like concat('%', #{areaName}, '%')</if>
|
||||
<if test="userId != null "> and c.user_id = like concat('%', #{userId}, '%')</if>
|
||||
<if test="userName != null "> and u.user_name = #{userName}</if>
|
||||
<if test="discountAmount != null "> and c.discount_amount = #{discountAmount}</if>
|
||||
<if test="expirationTime != null "> and c.expiration_time = #{expirationTime}</if>
|
||||
<if test="status != null and status != ''"> and c.status = #{status}</if>
|
||||
<if test="limitNum != null and limitNum != ''"> and c.limit_num = #{limitNum}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectEtCouponByCouponId" parameterType="Long" resultMap="EtCouponResult">
|
||||
<include refid="selectEtCouponVo"/>
|
||||
where coupon_id = #{couponId}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertEtCoupon" parameterType="EtCoupon" useGeneratedKeys="true" keyProperty="couponId">
|
||||
insert into et_coupon
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
@ -49,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createTime != null">create_time,</if>
|
||||
<if test="expirationTime != null">expiration_time,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="limitNum != null">limit_num,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="type != null">#{type},</if>
|
||||
|
@ -59,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="expirationTime != null">#{expirationTime},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="limitNum != null">#{limitNum},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -73,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="expirationTime != null">expiration_time = #{expirationTime},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="limitNum != null">limit_num = #{limitNum},</if>
|
||||
</trim>
|
||||
where coupon_id = #{couponId}
|
||||
</update>
|
||||
|
@ -82,9 +105,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</delete>
|
||||
|
||||
<delete id="deleteEtCouponByCouponIds" parameterType="String">
|
||||
delete from et_coupon where coupon_id in
|
||||
delete from et_coupon where coupon_id in
|
||||
<foreach item="couponId" collection="array" open="(" separator="," close=")">
|
||||
#{couponId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
|
|
@ -31,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where 1 = 1
|
||||
<if test="userId != null "> and f.user_id = #{userId}</if>
|
||||
<if test="type != null and type != ''"> and f.type = #{type}</if>
|
||||
<if test="sn != null and sn != ''"> and f.sn = #{sn}</if>
|
||||
<if test="status != null and status != ''"> and f.status = #{status}</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
|
|
Loading…
Reference in New Issue
Block a user