收费模式等
app首页统计
This commit is contained in:
邱贞招 2024-10-10 08:50:13 +08:00
parent 0b24f831bd
commit c50e3e4afb
44 changed files with 1053 additions and 329 deletions

View File

@ -130,6 +130,19 @@ public class AppController extends BaseController
return error("代理商不存在");
}
/**
* 根据代理商id获取车型列表
*/
@GetMapping("/getModelListByAgentId")
public AjaxResult getModelListByAgentId(Long agentId)
{
logger.info("根据代理商id获取车型列表【agentId="+agentId+"");
if(agentId==null){
return error("代理商id不能为空");
}
return success(modelService.selectEModelListByAgentId(agentId));
}
/**
* 根据定位获取哪个城市
*/

View File

@ -8,6 +8,8 @@ import com.ruoyi.common.constant.ServiceConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.RlUser;
import com.ruoyi.common.core.domain.entity.RlUserVO;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.ServiceException;
@ -28,6 +30,8 @@ import com.ruoyi.system.domain.query.AuthenticationQuery;
import com.ruoyi.system.domain.store.StoreVo;
import com.ruoyi.system.domain.vo.PriceVO;
import com.ruoyi.system.domain.vo.RlUserQuery;
import com.ruoyi.system.domain.withdraw.RlWithdraw;
import com.ruoyi.system.domain.withdraw.RlWithdrawQuery;
import com.ruoyi.system.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@ -137,7 +141,7 @@ public class AppVerifyController extends BaseController
throw new ServiceException("取车时间不能为空");
}
// 取车经纬度不能为空
if(StringUtils.isEmpty(order.getPickupLon()) && StringUtils.isEmpty(order.getPickupLat())){
if(StringUtils.isEmpty(order.getPickupLon()) && StringUtils.isEmpty(order.getPickupLat()) && !order.getDeliveryMethod().equals(ServiceConstants.DELIVERY_METHOD_SELF_PICKUP)){
throw new ServiceException("取车经度不能为空");
}
// ruleId不能为空
@ -256,6 +260,18 @@ public class AppVerifyController extends BaseController
@PutMapping("/device/edit")
public AjaxResult deviceEdit(String sn, String vehicleNum, String status)
{
logger.info("【更新车牌号】请求参数sn={},vehicleNum={}", sn,vehicleNum);
if(StrUtil.isBlank(sn)){
return error("【更新车牌号】sn不能为空");
}
RlDevice rlDevice = deviceService.selectDeviceBySn(sn);
if(rlDevice == null){
return error("【更新车牌号】设备不存在【"+sn+"");
}
if(StrUtil.isBlank(vehicleNum)){
return error("【更新车牌号】车牌号不能为空");
}
RlDevice device = new RlDevice();
device.setSn(sn);
device.setVehicleNum(vehicleNum);
@ -301,17 +317,6 @@ public class AppVerifyController extends BaseController
return success(aBoolean);
}
/**
* 车辆列表
*/
@GetMapping(value = "/vehicleList")
public AjaxResult allVehicleInfo(RlDeviceQuery query)
{
logger.info("【车辆列表】请求参数query={}", JSON.toJSONString(query));
List<RlDeviceVO> devices = deviceService.selectDeviceList(query);
return success(devices);
}
/**
* 管理员开锁
*/
@ -408,18 +413,6 @@ public class AppVerifyController extends BaseController
return error();
}
/**
* 我的账户
*/
@GetMapping(value = { "/myAccountInfo" })
public AjaxResult myAccountInfo()
{
AjaxResult ajax = AjaxResult.success();
RlUser rlUser = rlUserService.myAccountInfoByUserId(getUserId());
ajax.put(AjaxResult.DATA_TAG, rlUser);
return ajax;
}
/**
* 获取提现记录详细信息

View File

@ -0,0 +1,377 @@
package com.ruoyi.web.controller.appadmin;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.ServiceConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.core.domain.entity.RlUserVO;
import com.ruoyi.common.core.domain.model.LoginBody;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.framework.web.service.SysLoginService;
import com.ruoyi.system.domain.changeBalance.RlChangeBalance;
import com.ruoyi.system.domain.changeBalance.RlChangeBalanceQuery;
import com.ruoyi.system.domain.device.RlDeviceQuery;
import com.ruoyi.system.domain.device.RlDeviceVO;
import com.ruoyi.system.domain.model.RlModel;
import com.ruoyi.system.domain.model.RlModelQuery;
import com.ruoyi.system.domain.order.RlOrderQuery;
import com.ruoyi.system.domain.order.RlOrderVO;
import com.ruoyi.system.domain.rule.RlFeeRule;
import com.ruoyi.system.domain.store.StoreBO;
import com.ruoyi.system.domain.store.StoreVo;
import com.ruoyi.system.domain.userExt.RlUserExt;
import com.ruoyi.system.domain.vo.IndexAdminVo;
import com.ruoyi.system.domain.withdraw.RlWithdrawQuery;
import com.ruoyi.system.service.*;
import com.ruoyi.system.service.store.RlStoreService;
import com.ruoyi.system.service.store.StoreAssembler;
import com.ruoyi.system.service.store.StoreValidator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
/**
* app接口需要登录校验的
* 校验
* @author ruoyi
*/
@Slf4j
@RestController
@RequestMapping("/appAdmin")
public class AppAdminController extends BaseController
{
@Resource
private IRlUserService rlUserService;
@Autowired
private SysLoginService loginService;
@Resource
private IRlOrderService orderService;
@Autowired
private IRlDeviceService deviceService;
@Autowired
private IRlUserExtService rlUserExtService;
@Autowired
private IRlModelService modelService;
@Autowired
private RlStoreService storeService;
@Autowired
private StoreValidator storeValidator;
@Autowired
private StoreAssembler storeAssembler;
@Autowired
private IRlFeeRuleService feeRuleService;
/**
* 首页统计
*/
@GetMapping(value = { "/index" })
public AjaxResult index()
{
AjaxResult ajax = AjaxResult.success();
IndexAdminVo incomeVos = orderService.indexStatistics(getUserId());
ajax.put(AjaxResult.DATA_TAG, incomeVos);
return ajax;
}
/**
* 验证码登录
*/
@PostMapping("/appCodeLogin")
public AjaxResult appCodeLogin(@RequestBody LoginBody loginBody) {
AjaxResult ajax = AjaxResult.success();
/**通过手机号找到用户名*/
String phone = loginBody.getPhone();
// 生成令牌
String token = loginService.appCodeLogin(phone, loginBody.getPhoneCode(),loginBody.getPassword(), loginBody.getUuid());
ajax.put(Constants.TOKEN, token);
return ajax;
}
/**
* 微信登录
*/
@PostMapping("/wxlogin")
public AjaxResult wxlogin(String mobileCode,String jsCode) {
log.info("【微信登录/wxlogin】areaId参数【mobileCode={}】", mobileCode);
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.wxloing(mobileCode,jsCode);
ajax.put(Constants.TOKEN, token);
return ajax;
}
/**
* 我的账户
*/
@GetMapping(value = { "/myAccountInfo" })
public AjaxResult myAccountInfo()
{
AjaxResult ajax = AjaxResult.success();
RlUserVO rlUser = rlUserService.myAccountInfoByUserId(getUserId());
ajax.put(AjaxResult.DATA_TAG, rlUser);
return ajax;
}
/**
* 账变记录
*/
@GetMapping(value = { "/myChangeBalanceList" })
public AjaxResult myChangeBalanceList(RlChangeBalanceQuery query)
{
log.info("【账变记录/myChangeBalanceList】参数【query={}】", query);
AjaxResult ajax = AjaxResult.success();
if(query.getType().equals("0")){
query.setType(null);
}
List<RlChangeBalance> changeBalances = rlUserService.myChangeBalanceList(query,getUserId());
ajax.put(AjaxResult.DATA_TAG, changeBalances);
return ajax;
}
/**
* 车辆列表
*/
@GetMapping(value = "/vehicleList")
public AjaxResult allVehicleInfo(RlDeviceQuery query)
{
logger.info("【车辆列表】请求参数query={}", JSON.toJSONString(query));
List<RlDeviceVO> devices = deviceService.selectDeviceList(query);
return success(devices);
}
/**
* 上传收款码
* type:1-微信收款码2-支付宝收款码
*/
@Log(title = "上传收款码", businessType = BusinessType.UPDATE)
@PostMapping("/uploadPaymentCode")
public AjaxResult uploadPaymentCode(String collectionCode,String type)
{
log.info("【上传收款码】请求参数collectionCode={}", collectionCode);
if(collectionCode == null || collectionCode.equals("")){
return AjaxResult.warn("收款码不能为空");
}
if(type == null || type.equals("")){
return AjaxResult.warn("收款码类型不能为空");
}
RlUserExt userExt = new RlUserExt();
userExt.setUserId(getUserId());
if(type.equals("1")){
userExt.setWxCollectionCode(collectionCode);
}else{
userExt.setAliCollectionCode(collectionCode);
}
int result = rlUserExtService.updateRlUserExt(userExt);
return toAjax(result);
}
/**
* 车辆上线
*/
@Log(title = "车辆上线", businessType = BusinessType.ONLINE)
@PostMapping("/device/online")
public AjaxResult online(String sn)
{
logger.info("【车辆上线请求】:{}",sn);
Boolean aBoolean = deviceService.online(sn);
return success(aBoolean);
}
/**
* 车辆下线
*/
@Log(title = "车辆下线", businessType = BusinessType.OFFLINE)
@PostMapping("/device/offline")
public AjaxResult offline(String sn)
{
logger.info("【车辆下线请求】:{}",sn);
Boolean aBoolean = deviceService.offline(sn, ServiceConstants.VEHICLE_STATUS_IN_OFFLINE);
return success(aBoolean);
}
/**
*
* 根据商户id[merchantId]获取车型列表
*/
@GetMapping("/getModelListByMerchantId")
public AjaxResult getModelListByMerchantId()
{
logger.info("根据userid获取车型列表【userId="+getUserId()+"");
return success(modelService.getModelListByMerchantId(getUserId()));
}
/**
* 订单列表
*/
@GetMapping("/orderList")
public AjaxResult orderList(RlOrderQuery order)
{
order.setMerchantId(getUserId());
logger.info("订单列表请求order=【"+JSON.toJSONString(order)+"");
List<RlOrderVO> rlOrderVOS = orderService.selectRlOrderList(order);
return success(rlOrderVOS);
}
/**
* 订单信息
*/
@GetMapping("/orderInfo")
public AjaxResult orderInfo(String orderNo)
{
logger.info("订单列表请求order=【"+JSON.toJSON(orderNo)+"");
RlOrderVO rlOrder = orderService.getOrderInfoByOrderNo(orderNo);
return success(rlOrder);
}
/**
* 退款
*/
@Log(title = "订单退款", businessType = BusinessType.REFUND)
@PutMapping("/order/refund")
public AjaxResult orderRefund(@RequestBody RlOrderQuery order)
{
logger.info("【订单退款请求】:{}", JSON.toJSON(order));
return toAjax(orderService.refund(order));
}
/**
* 管理员提现
*/
@Log(title = "管理员提现", businessType = BusinessType.ADMINWITHDRAW)
@PostMapping("/admin/withdraw")
public AjaxResult add(@RequestBody RlWithdrawQuery withdraw)
{
logger.info("管理员提现请求:【{}】", JSON.toJSON(withdraw));
int i = rlUserService.adminWithdraw(withdraw);
return toAjax(i);
}
/**
* 获取商户详细信息
*/
@GetMapping(value = "/store/{storeId}")
public AjaxResult getInfo(@PathVariable("storeId") Long storeId)
{
StoreVo store = storeService.selectSmStoreById(storeId);
List<StoreVo> list = Collections.singletonList(store);
storeAssembler.assembleDeviceCount(list); // 设备数量
storeAssembler.assembleRevenue(list); // 经营数据
return success(store);
}
/**
* 保存店铺
*/
@Log(title = "保存店铺", businessType = BusinessType.SAVESTORE)
@PostMapping(value = "/store/save")
public AjaxResult add(@RequestBody @Validated(ValidGroup.Create.class) StoreBO store)
{
int result;
store.setMerchantId(getUserId());
if(ObjectUtil.isNull(store.getStoreId())){
store = store.filterCreate();
ServiceUtil.assertion(storeValidator.preCreate(store));
result = storeService.insertSmStore(store);
}else{
store = store.filterUpdate();
ServiceUtil.assertion(storeValidator.preUpdate(store));
result = storeService.updateSmStore(store);
}
return toAjax(result);
}
/**
* 新增车辆型号
*/
@Log(title = "车辆型号", businessType = BusinessType.INSERT)
@PostMapping(value = "/model/save")
public AjaxResult add(@RequestBody RlModelQuery model)
{
return toAjax(modelService.insertEModel(model));
}
/**
* 修改车辆型号
*/
@Log(title = "车辆型号", businessType = BusinessType.UPDATE)
@PutMapping(value = "/model/edit")
public AjaxResult edit(@RequestBody RlModelQuery model)
{
return toAjax(modelService.updateEModel(model));
}
/**
* 删除车辆型号
*/
@Log(title = "车辆型号", businessType = BusinessType.DELETE)
@DeleteMapping("/model/{modelIds}")
public AjaxResult remove(@PathVariable Long[] modelIds)
{
for (Long modelId:modelIds) {
RlModel model = new RlModel();
model.setModelId(modelId);
model.setDelFlag("2");
modelService.updateEModel(model);
}
return toAjax(1);
}
/**
* 新增收费模板
*/
@Log(title = "收费模板", businessType = BusinessType.INSERT)
@PostMapping("/rule/save")
public AjaxResult addModel(@RequestBody RlFeeRule rlFeeRule)
{
return toAjax(feeRuleService.insertRlFeeRule(rlFeeRule));
}
/**
* 修改收费模板
*/
@Log(title = "收费模板", businessType = BusinessType.UPDATE)
@PutMapping("/rule/edit")
public AjaxResult editModel(@RequestBody RlFeeRule rlFeeRule)
{
return toAjax(feeRuleService.updateRlFeeRule(rlFeeRule));
}
/**
* 删除收费模板
*/
@Log(title = "收费模板", businessType = BusinessType.DELETE)
@DeleteMapping("/rule/{ruleIds}")
public AjaxResult removeModel(@PathVariable Long[] ruleIds)
{
for (Long ruleId:ruleIds) {
RlFeeRule rule = new RlFeeRule();
rule.setRuleId(ruleId);
rule.setDelFlag("2");
feeRuleService.updateRlFeeRule(rule);
}
return toAjax(1);
}
}

View File

@ -249,33 +249,6 @@ public class RlDeviceController extends BaseController
// Boolean aBoolean =eDeviceService.adminLockByMac(mac,getUsername());
// return success(aBoolean);
// }
//
//
// /**
// * 车辆上线
// */
// @PreAuthorize("@ss.hasPermi('system:device:online')")
// @Log(title = "车辆上线", businessType = BusinessType.ONLINE)
// @PostMapping("/device/online")
// public AjaxResult online(String sn)
// {
// logger.info("【车辆上线请求】:{}",sn);
// Boolean aBoolean =eDeviceService.online(sn);
// return success(aBoolean);
// }
//
// /**
// * 车辆下线
// */
// @PreAuthorize("@ss.hasPermi('system:device:online')")
// @Log(title = "车辆下线", businessType = BusinessType.OFFLINE)
// @PostMapping("/device/offline")
// public AjaxResult offline(String sn)
// {
// logger.info("【车辆下线请求】:{}",sn);
// Boolean aBoolean =eDeviceService.offline(sn, ServiceConstants.VEHICLE_STATUS_IN_OFFLINE);
// return success(aBoolean);
// }
}

View File

@ -10,10 +10,7 @@ import java.util.List;
public class RlUserVO extends RlUser{
/** 累计提现金额 */
private BigDecimal totalWithdrawAmount;
/** 账变记录 */
List<ChangeBalanceInterface> changeBalanceList;
private BigDecimal totalWithdrawAmount = new BigDecimal("0.00");
/** 余额 */
private String balance;

View File

@ -113,4 +113,31 @@ public enum BusinessType
* 改价
*/
EDITPRICE,
}
/**
* 退款
*/
REFUND,
/**
* 车辆上线
*/
ONLINE,
/**
* 车辆下线
*/
OFFLINE,
/**
* 提现
*/
WITHDRAW,
/**
* 管理员提现
*/
ADMINWITHDRAW,
/**
* 保存店铺
*/
SAVESTORE
}

View File

@ -129,6 +129,7 @@ public class SecurityConfig
requests
.antMatchers("/login",
"/wxlogin",
"/appAdmin/wxlogin",
"/register",
"/captchaImage",
"/appCaptcha",

View File

@ -6,5 +6,8 @@ import lombok.Data;
public class RlDeviceQuery extends RlDevice{
/** 排序 */
private String orderBy;
private String sort;
/** 关键字: sn或车牌号 */
private String keywords;
}

View File

@ -56,4 +56,7 @@ public class RlModel extends BaseEntity
/** 描述 */
private String description;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
}

View File

@ -25,4 +25,7 @@ public class RlModelVO extends RlModel{
@ApiModelProperty("功能列表")
private List<RlFunction> functionList;
/** 代理商名称 */
private String agnetName;
}

View File

@ -62,6 +62,10 @@ public class RlOrder extends BaseEntity
@Excel(name = "车型id")
private Long modelId;
/** 车型 */
@Excel(name = "车型")
private String model;
/** 支付时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")

View File

@ -32,4 +32,7 @@ public class RlOrderQuery extends RlOrder{
/** 类型 1-租赁订单2-续租订单*/
private String type;
/** 关键字: 手机号或订单号 */
private String keywords;
}

View File

@ -1,6 +1,7 @@
package com.ruoyi.system.domain.order;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.system.domain.RlFunction;
import com.ruoyi.system.domain.accessory.RlAccessoryVO;
import com.ruoyi.system.domain.rule.RlFeeRule;
import lombok.Data;
@ -25,15 +26,15 @@ public class RlOrderVO extends RlOrder{
/** 店铺地址 */
private String storeAddress;
/** 车型 */
private String model;
/** 代理商 */
private String agentName;
@Excel(name = "配件列表")
private List<RlAccessoryVO> accessorys;
@Excel(name = "功能列表")
private List<RlFunction> functionList;
/** 图片 */
@Excel(name = "图片")
private String picture;

View File

@ -51,15 +51,12 @@ public class RlRefund extends BaseEntity
/** 调度费 */
private BigDecimal dispatchFee;
/** 停车点外调度费 */
private BigDecimal manageFee;
/** 配送费 */
private BigDecimal deliveryFee;
/** 骑行费 */
private BigDecimal leaseFee;
/** 预约费 */
private BigDecimal appointmentFee;
/** 退款原因 */
@Excel(name = "退款原因")
private String reason;

View File

@ -52,4 +52,7 @@ public class RlFeeRule extends BaseEntity
/** 车型id */
private Long modelId;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
}

View File

@ -40,7 +40,7 @@ public class Store extends BaseEntity
/** 用户 */
@Excel(name = "用户")
@ApiModelProperty("用户id")
@NotNull(message = "用户id不能为空", groups = {ValidGroup.Create.class})
// @NotNull(message = "用户id不能为空", groups = {ValidGroup.Create.class})
private Long userId;
/** 代理商 */
@ -124,7 +124,7 @@ public class Store extends BaseEntity
private String contactMobile;
@ApiModelProperty("是否展示店铺")
@NotNull(message = "是否展示店铺不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
// @NotNull(message = "是否展示店铺不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
private Boolean show;
@ApiModelProperty("状态")

View File

@ -41,4 +41,13 @@ public class RlUserExt extends BaseEntity
/** 分账状态 */
@Excel(name = "分账状态")
private Boolean dividendStatus;
/** 微信收款码 */
public String wxCollectionCode;
/** 支付宝收款码 */
public String aliCollectionCode;
/** 代理商id */
private Long agentId;
}

View File

@ -0,0 +1,45 @@
package com.ruoyi.system.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* app首页统计
*
* @author 邱贞招
* @date 2024-05-09
*/
@Data
public class IndexAdminVo {
/** 收入统计list */
private List<IncomeVo> incomeVoList;
/**
* 7日营收
*/
@Data
public static class IncomeVo {
/** 日期 */
private String day;
/** 订单金额 */
private BigDecimal orderFee;
/** 订单数 */
private Integer orderNum;
}
/** 今日营收 */
private BigDecimal todayIncome;
/** 今日订单数 */
private BigDecimal todayOrderNum;
/** 较昨日营收 */
private BigDecimal comparedYesterdayIncome;
/** 较昨日订单数 */
private BigDecimal comparedYesterdayOrderNum;
}

View File

@ -1,6 +1,8 @@
package com.ruoyi.system.domain.withdraw;
import java.math.BigDecimal;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
@ -12,6 +14,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* @author qzz
* @date 2024-09-28
*/
@Data
public class RlWithdraw extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -27,10 +30,6 @@ public class RlWithdraw extends BaseEntity
@Excel(name = "提现金额")
private BigDecimal amount;
/** 运营商id */
@Excel(name = "运营商id")
private Long deptId;
/** 状态 */
@Excel(name = "状态")
private String status;
@ -51,9 +50,9 @@ public class RlWithdraw extends BaseEntity
@Excel(name = "手机号")
private String ownerPhone;
/** 服务费 */
@Excel(name = "服务")
private BigDecimal serviceCharge;
/** 手续费 */
@Excel(name = "手续")
private BigDecimal handlingCharge;
/** 成本 */
@Excel(name = "成本")
@ -63,131 +62,4 @@ public class RlWithdraw extends BaseEntity
@Excel(name = "打款方式")
private String paymentMethod;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setWithdrawNo(String withdrawNo)
{
this.withdrawNo = withdrawNo;
}
public String getWithdrawNo()
{
return withdrawNo;
}
public void setAmount(BigDecimal amount)
{
this.amount = amount;
}
public BigDecimal getAmount()
{
return amount;
}
public void setDeptId(Long deptId)
{
this.deptId = deptId;
}
public Long getDeptId()
{
return deptId;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setRejectReason(String rejectReason)
{
this.rejectReason = rejectReason;
}
public String getRejectReason()
{
return rejectReason;
}
public void setOwnerName(String ownerName)
{
this.ownerName = ownerName;
}
public String getOwnerName()
{
return ownerName;
}
public void setOwnerId(Long ownerId)
{
this.ownerId = ownerId;
}
public Long getOwnerId()
{
return ownerId;
}
public void setOwnerPhone(String ownerPhone)
{
this.ownerPhone = ownerPhone;
}
public String getOwnerPhone()
{
return ownerPhone;
}
public void setServiceCharge(BigDecimal serviceCharge)
{
this.serviceCharge = serviceCharge;
}
public BigDecimal getServiceCharge()
{
return serviceCharge;
}
public void setCost(BigDecimal cost)
{
this.cost = cost;
}
public BigDecimal getCost()
{
return cost;
}
public void setPaymentMethod(String paymentMethod)
{
this.paymentMethod = paymentMethod;
}
public String getPaymentMethod()
{
return paymentMethod;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("withdrawNo", getWithdrawNo())
.append("amount", getAmount())
.append("deptId", getDeptId())
.append("status", getStatus())
.append("createTime", getCreateTime())
.append("rejectReason", getRejectReason())
.append("ownerName", getOwnerName())
.append("ownerId", getOwnerId())
.append("ownerPhone", getOwnerPhone())
.append("serviceCharge", getServiceCharge())
.append("cost", getCost())
.append("paymentMethod", getPaymentMethod())
.toString();
}
}

View File

@ -79,4 +79,6 @@ public interface RlModelMapper
int selectAllCount();
List<RlModelVO> getModelListByMerchantId(Long merchantId);
}

View File

@ -20,6 +20,14 @@ public interface RlUserExtMapper
*/
public RlUserExt selectRlUserExtByExtId(Long extId);
/**
* 查询用户扩展
*
* @param userId 用户扩展主键
* @return 用户扩展
*/
public RlUserExt selectRlUserExtByUserId(Long userId);
/**
* 查询用户扩展列表
*

View File

@ -1,6 +1,7 @@
package com.ruoyi.system.service;
import com.ruoyi.system.domain.changeBalance.RlChangeBalance;
import com.ruoyi.system.domain.changeBalance.RlChangeBalanceQuery;
import java.util.List;
@ -34,7 +35,7 @@ public interface IRlChangeBalanceService
* @param userId 余额变动
* @return 余额变动集合
*/
public List<RlChangeBalance> selectRlChangeBalanceListByUserId(Long userId);
public List<RlChangeBalance> selectRlChangeBalanceListByUserId(RlChangeBalanceQuery query, Long userId);
/**

View File

@ -6,8 +6,11 @@ import com.ruoyi.common.utils.onenet.ResponseVo;
import com.ruoyi.system.domain.device.RlDevice;
import com.ruoyi.system.domain.device.RlDeviceQuery;
import com.ruoyi.system.domain.device.RlDeviceVO;
import com.ruoyi.system.domain.order.RlOrder;
import com.ruoyi.system.domain.order.RlOrderQuery;
import com.ruoyi.system.domain.order.RlOrderVO;
import java.math.BigDecimal;
import java.util.List;
/**
@ -393,4 +396,7 @@ public interface IRlDeviceService extends IService<RlDevice>
// * 是否靠近运营区边界
// */
// boolean isCloseToTheBoundary(String sn, EtOperatingArea area);
/** 计算逾期费用 */
public BigDecimal computeOverdueFee(RlOrderVO order, RlOrder updateOrder);
}

View File

@ -38,6 +38,14 @@ public interface IRlModelService
*/
public List<RlModel> selectEModelListByAgentId(Long agentId);
/**
* 根据商户id查询车辆型号列表
*
* @param merchantId 商户id
* @return 车辆型号集合
*/
public List<RlModelVO> getModelListByMerchantId(Long merchantId);
/**
* 根据店铺id查询车辆型号列表

View File

@ -4,10 +4,13 @@ import com.ruoyi.common.utils.wx.vo.PrepayResponseVO;
import com.ruoyi.system.domain.order.RlOrder;
import com.ruoyi.system.domain.order.RlOrderQuery;
import com.ruoyi.system.domain.order.RlOrderVO;
import com.ruoyi.system.domain.refund.RlRefund;
import com.ruoyi.system.domain.store.StoreVo;
import com.ruoyi.system.domain.vo.IndexAdminVo;
import com.ruoyi.system.domain.vo.PriceVO;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
@ -141,6 +144,23 @@ public interface IRlOrderService
*/
Boolean depositRefund(String orderNo);
/**
* 订单退款
*/
int refund(RlOrderQuery order);
/**
* 创建退款
*
*/
public RlRefund createRefund(String reason, Long userId,String orderNo,
BigDecimal refundAmount,
BigDecimal dispatchFee,
BigDecimal deliveryFee,
BigDecimal leaseFee, String outRefundNo, String type);
/**
* 计算价格
*/
@ -158,4 +178,9 @@ public interface IRlOrderService
void validate(RlOrderQuery orderQuery);
/**
* app首页统计
*/
IndexAdminVo indexStatistics(Long userId);
}

View File

@ -20,6 +20,14 @@ public interface IRlUserExtService
*/
public RlUserExt selectRlUserExtByExtId(Long extId);
/**
* 查询用户扩展
*
* @param userId 用户id
* @return 用户扩展
*/
public RlUserExt selectRlUserExtByUserId(Long userId);
/**
* 查询用户扩展列表
*

View File

@ -2,8 +2,12 @@ package com.ruoyi.system.service;
import com.ruoyi.common.core.domain.entity.RlUser;
import com.ruoyi.common.core.domain.entity.RlUserVO;
import com.ruoyi.system.domain.changeBalance.RlChangeBalance;
import com.ruoyi.system.domain.changeBalance.RlChangeBalanceQuery;
import com.ruoyi.system.domain.query.AuthenticationQuery;
import com.ruoyi.system.domain.vo.RlUserQuery;
import com.ruoyi.system.domain.withdraw.RlWithdraw;
import com.ruoyi.system.domain.withdraw.RlWithdrawQuery;
import java.math.BigDecimal;
import java.util.List;
@ -61,7 +65,7 @@ public interface IRlUserService
* @param RlUserId 用户ID
* @return 用户对象信息
*/
public RlUser myAccountInfoByUserId(Long RlUserId);
public RlUserVO myAccountInfoByUserId(Long RlUserId);
@ -376,4 +380,14 @@ public interface IRlUserService
* @return 结果
*/
BigDecimal selectUserBalanceById(Long userId);
/**
* 账变记录
*/
List<RlChangeBalance> myChangeBalanceList(RlChangeBalanceQuery query, Long userId);
/**
* 管理员提现
*/
int adminWithdraw(RlWithdrawQuery withdraw);
}

View File

@ -62,5 +62,11 @@ public interface IRlWithdrawService
*/
public int deleteRlWithdrawById(Long id);
BigDecimal cumulativeWithdrawalAmount(Long RlUserId);
/**
* 累计提现金额
*
* @param userId 用户id
* @return 结果
*/
BigDecimal cumulativeWithdrawalAmount(Long userId);
}

View File

@ -134,6 +134,20 @@ public class CallbackServiceImpl implements CallbackService {
order1.setStatus(ServiceConstants.ORDER_STATUS_TO_BE_SENT);
}
order1.setCost(getCost(channelVO,order.getPayFee()));
// 如果是续租的订单结束原订单
if(order.getType().equals(ServiceConstants.ORDER_TYPE_RELET)){
String originalOrderNo = order.getOriginalOrderNo();
RlOrder originalOrder = orderService.selectRlOrderByOrderNo(originalOrderNo);
RlOrder updateOriginalOrder = new RlOrder();
updateOriginalOrder.setOrderId(originalOrder.getOrderId());
updateOriginalOrder.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
int i = orderService.updateRlOrder(updateOriginalOrder);
if(i==1){
logger.error("【微信支付回调】更新原订单状态成功");
}
order1.setStatus(ServiceConstants.ORDER_STATUS_IN_USE);
}
logger.info("=================【微信支付回调】开始更新订单信息=================={}",JSON.toJSON(order1));
int updateEtOrder = orderService.updateRlOrder(order1);
if(updateEtOrder==0){

View File

@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.changeBalance.RlChangeBalance;
import com.ruoyi.system.domain.changeBalance.RlChangeBalanceQuery;
import com.ruoyi.system.mapper.RlChangeBalanceMapper;
import com.ruoyi.system.service.IRlChangeBalanceService;
import org.springframework.beans.factory.annotation.Autowired;
@ -52,11 +53,10 @@ public class RlChangeBalanceServiceImpl implements IRlChangeBalanceService
* @return 余额变动
*/
@Override
public List<RlChangeBalance> selectRlChangeBalanceListByUserId(Long RlUserId)
public List<RlChangeBalance> selectRlChangeBalanceListByUserId(RlChangeBalanceQuery query, Long RlUserId)
{
RlChangeBalance rlChangeBalance = new RlChangeBalance();
rlChangeBalance.setOwnerId(RlUserId);
return rlChangeBalanceMapper.selectRlChangeBalanceList(rlChangeBalance);
query.setOwnerId(RlUserId);
return rlChangeBalanceMapper.selectRlChangeBalanceList(query);
}
/**

View File

@ -214,12 +214,18 @@ public class RlDeviceServiceImpl extends ServiceImpl<RlDeviceMapper, RlDevice> i
StoreVo storeVo = storeService.selectSmStoreById(rlDevice.getStoreId());
if(ObjectUtil.isNotNull(storeVo)){
rlDevice.setStoreLocation(storeVo.getAddress());
rlDevice.setStoreName(storeVo.getName());
}
RlModelVO rlModelVO = modelService.selectEModelByModelId(rlDevice.getModelId());
if(ObjectUtil.isNotNull(rlModelVO)){
if(StrUtil.isNotBlank(rlDevice.getVoltage())){
rlDevice.setRemainingMileage(CommonUtil.getRemainingMileage(rlDevice.getVoltage(),rlModelVO.getFullVoltage(),rlModelVO.getLowVoltage(),rlModelVO.getFullEndurance()));
}
rlDevice.setModel(rlModelVO.getModel());
List<RlFunction> functionList = modelService.getFunctionListByModelId(rlDevice.getModelId());
List<RlAccessoryVO> rlAccessoryVOS = accessoryService.selectRlAccessoryListByModelId(rlDevice.getModelId());
rlDevice.setFunctionList(functionList);
rlDevice.setAccessorys(rlAccessoryVOS);
}
return rlDevice;
}
@ -245,25 +251,6 @@ public class RlDeviceServiceImpl extends ServiceImpl<RlDeviceMapper, RlDevice> i
public List<RlDeviceVO> selectDeviceList(RlDeviceQuery asDevice)
{
List<RlDeviceVO> asDevices = deviceMapper.selectDeviceList(asDevice);
// for (EDevice asDevice1:asDevices){
// Long areaId = asDevice1.getAreaId();
// if (ObjectUtil.isNotNull(areaId) && areaId!=0){
// EtOperatingArea etOperatingArea = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId);
// asDevice1.setAreaName(etOperatingArea.getAreaName());
// }
// Long modelId = asDevice1.getModelId();
// if (ObjectUtil.isNotNull(modelId)){
// EtModel model = etModelService.selectEtModelByModelId(modelId);
// if(ObjectUtil.isNotNull(model)){
// asDevice1.setModel(model.getModel());
// }
// }
// String status = asDevice1.getStatus();
// if(ObjectUtil.isNotNull(status)){
// String typeName = sysDictDataService.selectDictLabel("as_device_status", status);
// asDevice1.setStatusStr(typeName);
// }
// }
return asDevices;
}
@ -1565,7 +1552,7 @@ public class RlDeviceServiceImpl extends ServiceImpl<RlDeviceMapper, RlDevice> i
}
/** 计算逾期费用 */
private BigDecimal computeOverdueFee(RlOrderVO order, RlOrder updateOrder) {
public BigDecimal computeOverdueFee(RlOrderVO order, RlOrder updateOrder) {
String outUnit = order.getOutUnit();
BigDecimal outPrice = order.getOutPrice();
// 计算逾期的时间单位

View File

@ -8,11 +8,13 @@ import com.ruoyi.system.domain.accessory.RlAccessoryVO;
import com.ruoyi.system.domain.device.RlDevice;
import com.ruoyi.system.domain.model.RlModel;
import com.ruoyi.system.domain.model.RlModelVO;
import com.ruoyi.system.domain.store.StoreVo;
import com.ruoyi.system.mapper.RlModelMapper;
import com.ruoyi.system.service.IRlAccessoryService;
import com.ruoyi.system.service.IRlDeviceService;
import com.ruoyi.system.service.IRlFunctionService;
import com.ruoyi.system.service.IRlModelService;
import com.ruoyi.system.service.store.RlStoreService;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -20,6 +22,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
@ -44,6 +47,10 @@ public class RlModelServiceImpl implements IRlModelService
@Autowired
private IRlFunctionService rlFunctionService;
@Autowired
private RlStoreService storeService;
/**
* 查询车辆型号
@ -104,6 +111,25 @@ public class RlModelServiceImpl implements IRlModelService
return etModels;
}
/**
* 根据商户id查询车辆型号列表
*
* @param merchantId 商户id
* @return 车辆型号集合
*/
@Override
public List<RlModelVO> getModelListByMerchantId(Long merchantId)
{
List<RlModelVO> rlModelVOS = new ArrayList<>();
// 根据商户获取到店铺列表
List<StoreVo> storeVos = storeService.selectSmStoreListBYMerchantId(merchantId);
for(StoreVo storeVo:storeVos){
List<RlModelVO> rlModelVOS1 = selectEModelListByStoreId(storeVo.getStoreId());
rlModelVOS.addAll(rlModelVOS1);
}
return rlModelVOS;
}
/**
* 根据店铺id查询车辆型号列表

View File

@ -6,12 +6,14 @@ import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.constant.ServiceConstants;
import com.ruoyi.common.core.domain.entity.RlUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.CommonUtil;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.map.GeoUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.common.utils.wx.vo.PrepayResponseVO;
import com.ruoyi.system.domain.RlFunction;
import com.ruoyi.system.domain.accessory.RlAccessoryVO;
import com.ruoyi.system.domain.agent.RlAgent;
import com.ruoyi.system.domain.device.RlDevice;
@ -19,8 +21,11 @@ import com.ruoyi.system.domain.model.RlModelVO;
import com.ruoyi.system.domain.order.RlOrder;
import com.ruoyi.system.domain.order.RlOrderQuery;
import com.ruoyi.system.domain.order.RlOrderVO;
import com.ruoyi.system.domain.refund.RlRefund;
import com.ruoyi.system.domain.rule.RlFeeRule;
import com.ruoyi.system.domain.store.StoreVo;
import com.ruoyi.system.domain.userExt.RlUserExt;
import com.ruoyi.system.domain.vo.IndexAdminVo;
import com.ruoyi.system.domain.vo.PriceVO;
import com.ruoyi.system.mapper.RlOrderMapper;
import com.ruoyi.system.service.*;
@ -31,6 +36,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import javax.annotation.Resource;
@ -86,6 +92,12 @@ public class RlOrderServiceImpl implements IRlOrderService
@Autowired
private TransactionTemplate transactionTemplate;
@Autowired
private IRlUserExtService userExtService;
@Autowired
private IRlRefundService refundService;
/**
* 查询订单
*
@ -133,8 +145,17 @@ public class RlOrderServiceImpl implements IRlOrderService
public RlOrderVO getOrderInfoByOrderNo(String orderNo)
{
RlOrderVO order = orderMapper.selectRlOrderByOrderNo(orderNo);
List<RlAccessoryVO> accessorys = accessoryService.selectRlAccessoryListByModelId(order.getModelId());
order.setAccessorys(accessorys);
if(order.getModelId() == null){
throw new ServiceException("订单中没有车型id");
}
RlModelVO rlModelVO = modelService.selectEModelByModelId(order.getModelId());
if(ObjectUtil.isNotNull(rlModelVO)){
List<RlFunction> functionList = modelService.getFunctionListByModelId(order.getModelId());
List<RlAccessoryVO> rlAccessoryVOS = accessoryService.selectRlAccessoryListByModelId(order.getModelId());
order.setFunctionList(functionList);
order.setAccessorys(rlAccessoryVOS);
}
RlDevice rlDevice = deviceService.selectDeviceBySn(order.getSn());
if(ObjectUtil.isNotNull(rlDevice)) {
order.setPicture(rlDevice.getPicture());
@ -362,6 +383,7 @@ public class RlOrderServiceImpl implements IRlOrderService
rlOrder.setOrderNo(orderNo);
rlOrder.setSn(sn);
rlOrder.setStatus(ServiceConstants.ORDER_STATUS_IN_USE);
rlOrder.setPickupTime(DateUtils.getNowDate());
int i = orderMapper.updateRlOrderByOrderNo(rlOrder);
if(i > 0){
/** 更新设备状态 */
@ -391,15 +413,29 @@ public class RlOrderServiceImpl implements IRlOrderService
}
RlOrderQuery orderQuery = new RlOrderQuery();
BeanUtils.copyBeanProp(orderQuery,order);
/** 原订单已经到期 */
Date nowDate = DateUtils.getNowDate();
if (order.getExpiryTime().before(nowDate)) {
/** */
// throw new RuntimeException("订单已过期,请重新下单");
}
/** 原订单已经到期 续租订单的到期时间是根据原订单的到期时间算出来的 */
// Date nowDate = DateUtils.getNowDate();
// if (order.getExpiryTime().before(nowDate)) {
// /** 到期后先计算逾期费用,保存在订单中,在还车时一起结算 */
// RlOrder updateOrder = new RlOrder();
// updateOrder.setOrderId(order.getOrderId());
// BigDecimal overdueFee= BigDecimal.ZERO;
// if(ObjectUtil.isNull(order.getExpiryTime())){
// throw new ServiceException("【续租】订单没有到期时间");
// }
// if (order.getExpiryTime().before(DateUtils.getNowDate())) {
// overdueFee = deviceService.computeOverdueFee(order, updateOrder);
// }
// updateOrder.setOverdueFee(overdueFee);
// int i = updateRlOrder(updateOrder);
// if(i==0){
// throw new ServiceException("更新订单状态失败");
// }
// }
orderQuery.setOriginalOrderNo(query.getOrderNo());
orderQuery.setRuleId(query.getRuleId());
orderQuery.setPickupTime(order.getExpiryTime());
orderQuery.setNum(query.getNum());
String newOrderNo = IdUtils.getOrderNo("xz");
PrepayResponseVO responseVO = getPrepayResponseVO(orderQuery,newOrderNo,ServiceConstants.ORDER_TYPE_RELET,SecurityUtils.getUserId());
return responseVO;
@ -472,6 +508,108 @@ public class RlOrderServiceImpl implements IRlOrderService
return null;
}
/**
* todo 未完成
* 退款
* 1. 校验
* 2. 用户余额不足判断
* 3. 计算出退款的比例
* 4. 遍历用户新增账变
* 5. 新增退款明细
* 6. 发起退款
*/
@Transactional
@Override
public int refund(RlOrderQuery etOrder) {
//根据订单号查询订单信息
/** 1. 校验 */
RlOrderVO rlOrderVO = orderMapper.selectRlOrderByOrderNo(etOrder.getOrderNo());
if(ObjectUtil.isNull(rlOrderVO)){
throw new ServiceException("订单不存在");
}
if(!ServiceConstants.ORDER_STATUS_ORDER_END.equals(rlOrderVO.getStatus())){
throw new ServiceException("退款失败,订单未结束");
}
if(ServiceConstants.ORDER_PAY_STATUS_NON_PAYMENT.equals(rlOrderVO.getPaid())){
throw new ServiceException("订单未支付,不能退款");
}
/** 1.退款*/
//退款金额 调度费(商家取车) 配送费送车上门 租赁费
BigDecimal refundAmount = new BigDecimal("0");
BigDecimal dispatchFee = etOrder.getDispatchFee();
if(ObjectUtil.isNotNull(dispatchFee) && !dispatchFee.equals(BigDecimal.ZERO)){
refundAmount = refundAmount.add(dispatchFee);
}
BigDecimal deliveryFee = etOrder.getDeliveryFee();
if(ObjectUtil.isNotNull(deliveryFee) && !deliveryFee.equals(BigDecimal.ZERO)){
refundAmount = refundAmount.add(deliveryFee);
}
BigDecimal leaseFee = etOrder.getLeaseFee();
if(ObjectUtil.isNotNull(leaseFee) && !leaseFee.equals(BigDecimal.ZERO)){
refundAmount = refundAmount.add(leaseFee);
}
if(refundAmount.compareTo(BigDecimal.ZERO) == 0){
throw new ServiceException("总退款金额不能为0");
}
/** 3.计算出退款的比例 */
BigDecimal divide = refundAmount.divide(rlOrderVO.getPayFee());
/** 4. 遍历用户,新增账变 */
Long agentId = rlOrderVO.getAgentId();
/** todo 2. 每个用户都要余额不足判断 */
RlUserExt rlUserExt = userExtService.selectRlUserExtByUserId(SecurityUtils.getUserId());
BigDecimal subtract = rlUserExt.getBalance().subtract(etOrder.getTotalFee());
if(subtract.compareTo(BigDecimal.ZERO) <= 0){
throw new ServiceException("余额不足,不能退款");
}
// 新增账变
// etOrder1.setPayFee(refundAmount);
// callbackService.capitalFlowRecords(etOrder1,ServiceConstants.FLOW_TYPE_DISBURSE,ServiceConstants.ORDER_TYPE_RIDING_REFUND,ServiceConstants.OWNER_TYPE_OPERATOR,null,ServiceConstants.PAY_TYPE_WX);
String outRefundNo = IdUtils.getOrderNo("ref");
/** 2.记录退款表 创建退款对象*/
RlRefund refund1= createRefund("商家退款金额",rlOrderVO.getUserId(),rlOrderVO.getOrderNo(), refundAmount, dispatchFee, deliveryFee, leaseFee, outRefundNo,ServiceConstants.REFUND_TYPE_SYSTEM);
int i = refundService.insertEtRefund(refund1);
if(i>0){
logger.info("保存退款对象成功");
}
logger.info("总金额:【{}】,退款金额:【{}】", rlOrderVO.getTotalFee(), refundAmount);
/** 6. 发起退款 */
wxPayService.refund(rlOrderVO, "商家退款金额", refundAmount,outRefundNo);
return 1;
}
@Override
public RlRefund createRefund(String reason, Long userId,String orderNo,BigDecimal refundAmount, BigDecimal dispatchFee, BigDecimal deliveryFee, BigDecimal leaseFee, String outRefundNo, String type) {
RlRefund etRefund = new RlRefund();
etRefund.setAmount(refundAmount);
etRefund.setReason(reason);
etRefund.setDispatchFee(dispatchFee);
etRefund.setDeliveryFee(deliveryFee);
etRefund.setLeaseFee(leaseFee);
etRefund.setOrderNo(orderNo);
etRefund.setUserId(userId);
etRefund.setRefundNo(outRefundNo);
etRefund.setType(type);
if(type.equals(ServiceConstants.REFUND_TYPE_DEPOSIT)){
etRefund.setItemDesc("押金退款");
}else{
StringBuilder itemDesc = new StringBuilder();
if(ObjectUtil.isNotNull(deliveryFee) && !deliveryFee.equals(BigDecimal.ZERO)){
itemDesc.append("配送费:").append(deliveryFee).append("元,");
}
if(ObjectUtil.isNotNull(dispatchFee) && !dispatchFee.equals(BigDecimal.ZERO)){
itemDesc.append("调度费:").append(dispatchFee).append("元,");
}
if(ObjectUtil.isNotNull(leaseFee) && !leaseFee.equals(BigDecimal.ZERO)){
itemDesc.append("租赁费:").append(leaseFee).append("元,");
}
etRefund.setItemDesc(itemDesc.toString());
}
return etRefund;
}
/**
* 计算价格
*/
@ -550,6 +688,28 @@ public class RlOrderServiceImpl implements IRlOrderService
}
}
/**
* 首页统计
*/
@Override
public IndexAdminVo indexStatistics(Long userId) {
IndexAdminVo indexAdminVo = new IndexAdminVo();
ArrayList<IndexAdminVo.IncomeVo> incomeVos = new ArrayList<>();
for (int i = 1; i < 7; i++) {
IndexAdminVo.IncomeVo orderFee = new IndexAdminVo.IncomeVo();
orderFee.setDay("2024-10-0"+i);
orderFee.setOrderFee(BigDecimal.valueOf(i*100));
orderFee.setOrderNum(i*10);
incomeVos.add(orderFee);
}
indexAdminVo.setIncomeVoList(incomeVos);
indexAdminVo.setTodayOrderNum(new BigDecimal(10));
indexAdminVo.setTodayIncome(new BigDecimal(100));
indexAdminVo.setComparedYesterdayIncome(new BigDecimal(5));
indexAdminVo.setComparedYesterdayOrderNum(new BigDecimal(5));
return indexAdminVo;
}
private BigDecimal deposit(Long modelId, PriceVO priceVO) {
RlModelVO rlModelVO = modelService.selectEModelByModelId(modelId);
if(rlModelVO == null){

View File

@ -32,6 +32,17 @@ public class RlUserExtServiceImpl implements IRlUserExtService
return rlUserExtMapper.selectRlUserExtByExtId(extId);
}
/**
* 查询用户扩展
*
* @param userId 用户id
* @return 用户扩展
*/
@Override
public RlUserExt selectRlUserExtByUserId(Long userId) {
return rlUserExtMapper.selectRlUserExtByUserId(userId);
}
/**
* 查询用户扩展列表
*

View File

@ -1,24 +1,35 @@
package com.ruoyi.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.exceptions.ClientException;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.ServiceConstants;
import com.ruoyi.common.core.domain.entity.ChangeBalanceInterface;
import com.ruoyi.common.core.domain.entity.RlUser;
import com.ruoyi.common.core.domain.entity.RlUserVO;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.common.utils.verify.VerifyIdentityUtil;
import com.ruoyi.system.domain.RlMsgLog;
import com.ruoyi.system.domain.SysUserPost;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.domain.agent.RlAgentVO;
import com.ruoyi.system.domain.changeBalance.RlChangeBalance;
import com.ruoyi.system.domain.changeBalance.RlChangeBalanceQuery;
import com.ruoyi.system.domain.channel.ChannelVO;
import com.ruoyi.system.domain.query.AuthenticationQuery;
import com.ruoyi.system.domain.userExt.RlUserExt;
import com.ruoyi.system.domain.vo.RlUserQuery;
import com.ruoyi.system.domain.withdraw.RlWithdraw;
import com.ruoyi.system.domain.withdraw.RlWithdrawQuery;
import com.ruoyi.system.mapper.RlUserMapper;
import com.ruoyi.system.mapper.SysUserPostMapper;
import com.ruoyi.system.mapper.SysUserRoleMapper;
import com.ruoyi.system.service.IRlChangeBalanceService;
import com.ruoyi.system.service.IRlUserService;
import com.ruoyi.system.service.IRlWithdrawService;
import com.ruoyi.system.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -28,8 +39,11 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.validation.Validator;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* 用户 业务层处理
@ -43,6 +57,15 @@ public class RlUserServiceImpl implements IRlUserService{
@Resource
private RlUserMapper rlUserMapper;
@Resource
private IRlUserExtService userExtService;
@Resource
private IRlAgentService agentService;
@Autowired
private RlChannelService channelService;
@Autowired
protected Validator validator;
@ -58,6 +81,27 @@ public class RlUserServiceImpl implements IRlUserService{
@Resource
private SysUserPostMapper userPostMapper;
@Autowired
private ScheduledExecutorService scheduledExecutorService;
@Autowired
private IRlMsgLogService msgLogService;
@Value("${aliyun.accessKeyId}")
private String accessKeyId;
@Value("${aliyun.accessKeySecret}")
private String accessKeySecret;
@Value("${aliyun.signName}")
private String signName;
@Value("${aliyun.templateCode3}")
private String templateCode3;
@Value("${aliyun.phone}")
private String phone;
// @Autowired
// private IEtOrderService etOrderService;
//
@ -150,22 +194,19 @@ public class RlUserServiceImpl implements IRlUserService{
/**
* 通过用户ID查询账户
*
* @param RlUserId 用户ID
* @param userId 用户ID
* @return 用户对象信息
*/
@Override
public RlUserVO myAccountInfoByUserId(Long RlUserId)
public RlUserVO myAccountInfoByUserId(Long userId)
{
RlUserVO users = rlUserMapper.myAccountInfoByUserId(RlUserId);
RlUserVO users = rlUserMapper.myAccountInfoByUserId(userId);
/** 累计提现*/
BigDecimal totalWithdrawAmount = rlWithdrawService.cumulativeWithdrawalAmount(RlUserId);
BigDecimal totalWithdrawAmount = rlWithdrawService.cumulativeWithdrawalAmount(userId);
if(ObjectUtil.isNull(totalWithdrawAmount)){
totalWithdrawAmount = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
}
users.setTotalWithdrawAmount(totalWithdrawAmount);
/** 账变明细*/
List<ChangeBalanceInterface> changeBalances = new ArrayList<>();
List<RlChangeBalance> rlChangeBalances = rlChangeBalanceService.selectRlChangeBalanceListByUserId(RlUserId);
changeBalances.addAll(rlChangeBalances);
users.setChangeBalanceList(changeBalances);
return users;
}
@ -659,6 +700,90 @@ public class RlUserServiceImpl implements IRlUserService{
return rlUserMapper.selectUserBalanceById(userId);
}
/**
* 账变记录
*/
@Override
public List<RlChangeBalance> myChangeBalanceList(RlChangeBalanceQuery query,Long userId) {
/** 账变明细*/
List<RlChangeBalance> rlChangeBalances = rlChangeBalanceService.selectRlChangeBalanceListByUserId(query,userId);
return rlChangeBalances;
}
/**
* 管理员提现
* 1. 获取当前用户
* 2. 记录提现记录
* 3. 扣余额,记录账变
* 4. 发起提现如果是自动api提现
*/
@Override
public int adminWithdraw(RlWithdrawQuery withdraw) {
String orderNo = IdUtils.getOrderNo("tx");
/** 1. 获取当前用户*/
RlUser user = rlUserMapper.selectUserById(SecurityUtils.getUserId());
RlUserExt rlUserExt = userExtService.selectRlUserExtByUserId(user.getUserId());
RlAgentVO rlAgentVO = agentService.selectRlAgentByAgentId(rlUserExt.getAgentId());
ChannelVO channelVO = channelService.selectSmChannelByChannelId(rlAgentVO.getPayChannel());
// log.info();
/** 2. 记录提现记录*/
RlWithdraw rlWithdraw = new RlWithdraw();
rlWithdraw.setWithdrawNo(orderNo);
rlWithdraw.setCreateTime(DateUtils.getNowDate());
rlWithdraw.setAmount(withdraw.getAmount());
rlWithdraw.setStatus(ServiceConstants.FLOW_STATUS_APPLY);
rlWithdraw.setOwnerId(user.getUserId());
rlWithdraw.setOwnerName(user.getUserName());
rlWithdraw.setOwnerPhone(user.getPhonenumber());
// rlWithdraw.setHandlingCharge(new BigDecimal(0));手续费成本
rlWithdraw.setPaymentMethod(withdraw.getPaymentMethod());
int i = rlWithdrawService.insertRlWithdraw(rlWithdraw);
// 发短信通知转账人
asynchronousMsg(user.getUserName());
return 0;
}
private void asynchronousMsg(String userName) {
scheduledExecutorService.schedule(() -> {
/** 提现申请发送一个短信给审核人*/
JSONObject jsonObject = new JSONObject();
jsonObject.put("name", userName);
SendSmsVo sendSmsVo = new SendSmsVo();
sendSmsVo.setMobile(phone);
sendSmsVo.setTemplateCode(templateCode3);
sendSmsVo.setParam(jsonObject.toJSONString());
sendSmsVo.setSignName(signName);
SendSmsResponse response = null;
log.info("【提现申请】向阿里云发送短信,请求,----------【{}】", JSON.toJSONString(sendSmsVo));
try {
response = SendAliSmsUtil.sendVerifyCode(accessKeyId,accessKeySecret,sendSmsVo);
} catch (ClientException e) {
e.printStackTrace();
}
log.info("【提现申请】发送阿里云短信成功,返回----------【{}】",JSON.toJSONString(response));
// 短信日志
RlMsgLog etMsgLog = new RlMsgLog();
etMsgLog.setPhone(phone);
etMsgLog.setContent("用户【"+userName+"】,发起押金提现申请,请尽快审核!");
etMsgLog.setType("2");
etMsgLog.setSignName(signName);
etMsgLog.setTemplateCode(templateCode3);
int i = msgLogService.insertEtMsgLog(etMsgLog);
if(i>0){
log.info("【提现申请】短信日志记录成功");
}else{
log.info("【提现申请】短信日志记录失败");
}
}, 0 , TimeUnit.HOURS);
}
/**
* 新增用户岗位信息
*

View File

@ -162,7 +162,7 @@ public class WxPayService implements IWxPayService {
JsapiServiceExtension jsapiServiceExtension = getJsapiServiceExtension(channelVO);
PrepayWithRequestPaymentResponse res = jsapiServiceExtension.prepayWithRequestPayment(request);
if(StrUtil.isNotBlank(order.getOutTradeNo())){
if(StrUtil.isNotBlank(order.getOutTradeNo()) && order.getType().equals(ServiceConstants.ORDER_TYPE_LEASE)){
String tradeNo = order.getOutTradeNo();
// 关闭订单
CloseOrderRequest closeOrderRequest = new CloseOrderRequest();

View File

@ -5,35 +5,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.ruoyi.system.mapper.RlDeviceMapper">
<resultMap type="RlDeviceVO" id="DeviceResult" autoMapping="true"/>
<!-- <resultMap type="RlDeviceVO" id="DeviceResult">-->
<!-- <result property="deviceId" column="device_id" />-->
<!-- <result property="picture" column="picture" />-->
<!-- <result property="deviceName" column="device_name" />-->
<!-- <result property="mac" column="mac" />-->
<!-- <result property="sn" column="sn" />-->
<!-- <result property="modelId" column="model_id" />-->
<!-- <result property="hardwareVersionId" column="hardware_version_id" />-->
<!-- <result property="vehicleNum" column="vehicle_num" />-->
<!-- <result property="version" column="version" />-->
<!-- <result property="activationTime" column="activation_time" />-->
<!-- <result property="onlineStatus" column="online_status" />-->
<!-- <result property="createBy" column="create_by" />-->
<!-- <result property="createTime" column="create_time" />-->
<!-- <result property="updateBy" column="update_by" />-->
<!-- <result property="updateTime" column="update_time" />-->
<!-- <result property="lastTime" column="last_time" />-->
<!-- <result property="lastLocationTime" column="last_location_time" />-->
<!-- <result property="gps" column="gps" />-->
<!-- <result property="remark" column="remark" />-->
<!-- <result property="status" column="status" />-->
<!-- <result property="lockStatus" column="lock_status" />-->
<!-- <result property="location" column="location" />-->
<!-- <result property="remainingPower" column="remaining_power" />-->
<!-- <result property="voltage" column="voltage" />-->
<!-- <result property="qrcode" column="qrcode" />-->
<!-- <result property="longitude" column="longitude" />-->
<!-- <result property="latitude" column="latitude" />-->
<!-- </resultMap>-->
<sql id="selectDeviceVo">
select device_id, picture, device_name, mac, sn, model_id, hardware_version_id, vehicle_num, activation_time,
@ -44,9 +15,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDeviceList" parameterType="RlDeviceQuery" resultMap="DeviceResult">
select de.device_id, de.picture, de.device_name, de.mac, de.sn, de.model_id, de.hardware_version_id, de.vehicle_num,
de.activation_time, de.online_status, de.create_by, de.create_time, de.update_by,m.model,
de.update_time, de.last_time, de.last_location_time, de.gps, de.remark, de.status, de.lock_status, de.location,
de.update_time, de.last_time, de.last_location_time, de.gps, de.remark, de.status, de.lock_status, de.location, s.name storeName,
de.remaining_power, de.voltage, de.qrcode, de.longitude, de.latitude, de.signal_strength, de.satellites, de.quality, de.is_admin_unlocking, de.store_id from rl_device de
left join rl_model m on m.id = de.model_id
left join rl_model m on m.model_id = de.model_id
left join rl_store s on s.store_id = de.store_id
where 1 = 1
<if test="deviceName != null and deviceName != ''"> and de.device_name like concat('%', #{deviceName}, '%')</if>
<if test="mac != null and mac != ''"> and de.mac = #{mac}</if>
@ -56,9 +28,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="onlineStatus != null and onlineStatus != ''"> and de.online_status = #{onlineStatus}</if>
<if test="status != null and status != ''"> and de.status = #{status}</if>
<if test="lockStatus != null and lockStatus != ''"> and de.lock_status = #{lockStatus}</if>
<if test="keywords != null and keywords != ''">
AND (de.sn LIKE CONCAT('%', #{keywords}, '%') OR de.vehicle_num LIKE CONCAT('%', #{keywords}, '%'))
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by de.sn
<choose>
<when test="sort == 'desc'">
order by de.remaining_power desc
</when>
<otherwise>
order by de.remaining_power
</otherwise>
</choose>
</select>
<select id="selectDeviceListWithIsolate" parameterType="RlDeviceQuery" resultMap="DeviceResult">

View File

@ -21,16 +21,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectRlFeeRuleList" parameterType="RlFeeRule" resultMap="RlFeeRuleResult">
<include refid="selectRlFeeRuleVo"/>
<where>
<if test="rentalUnit != null and rentalUnit != ''"> and rental_unit = #{rentalUnit}</if>
<if test="price != null "> and price = #{price}</if>
<if test="explain != null and explain != ''"> and `explain` = #{explain}</if>
<if test="instructions != null and instructions != ''"> and instructions = #{instructions}</if>
<if test="outUnit != null and outUnit != ''"> and out_unit = #{outUnit}</if>
<if test="outPrice != null "> and out_price = #{outPrice}</if>
<if test="isDeleted != null "> and is_deleted = #{isDeleted}</if>
</where>
select r.rule_id, r.rental_unit, r.price, r.`explain`, r.instructions, r.out_unit, r.out_price, r.is_deleted, r.model_id from rl_fee_rule r
where del_flag = '0'
<if test="rentalUnit != null and rentalUnit != ''"> and r.rental_unit = #{rentalUnit}</if>
<if test="price != null "> and r.price = #{price}</if>
<if test="explain != null and explain != ''"> and r.`explain` = #{explain}</if>
<if test="instructions != null and instructions != ''"> and r.instructions = #{instructions}</if>
<if test="outUnit != null and outUnit != ''"> and r.out_unit = #{outUnit}</if>
<if test="outPrice != null "> and r.out_price = #{outPrice}</if>
<if test="isDeleted != null "> and r.is_deleted = #{isDeleted}</if>
</select>
<select id="selectRlFeeRuleListByModelId" parameterType="Long" resultMap="RlFeeRuleResult">
@ -78,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="outPrice != null">out_price = #{outPrice},</if>
<if test="isDeleted != null">is_deleted = #{isDeleted},</if>
<if test="modelId != null">model_id = #{modelId},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where rule_id = #{ruleId}
</update>

View File

@ -12,9 +12,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectEModelList" parameterType="RlModel" resultMap="EModelResult">
select m.model_id, m.model, m.full_voltage, m.low_voltage,
m.full_endurance, m.create_by, m.create_time,
m.full_endurance, m.create_by, m.create_time,a.name agnetName,
m.update_by, m.update_time, m.remark, m.intro, m.agent_id, m.deposit, m.picture,m.description from rl_model m
where 1 = 1
left join rl_agent a on a.agent_id = m.agent_id
where m.del_flag = '0'
<if test="model != null and model != ''"> and m.model = #{model}</if>
<!-- 数据范围过滤 <if test="operator != null and operator != ''"> and m.operator = #{operator}</if> -->
${params.dataScope}
@ -68,6 +69,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
m.model_id
</select>
<select id="getModelListByMerchantId" resultType="com.ruoyi.system.domain.model.RlModelVO">
</select>
<insert id="insertEModel" parameterType="RlModel" keyProperty="modelId" useGeneratedKeys="true">
insert into rl_model
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -123,6 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deposit != null">deposit = #{deposit},</if>
<if test="picture != null">picture = #{picture},</if>
<if test="description != null">description = #{description},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where model_id = #{modelId}
</update>

View File

@ -10,7 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select order_id, order_no, out_trade_no, user_id, user_name, real_name, phone, rule_id, device_mac, sn, pay_time, pay_type, paid, type, total_fee, pay_fee, deposit, overdue_fee, dispatch_fee,delivery_fee,
lease_fee, mark, duration, status, create_time, return_time, deposit_deduction, deposit_order_no, deduction_amount, used_sn, change_reason,
auto_refund_deposit, rental_unit, handling_charge, platform_service_fee, operator_dividend, pay_channel, delivery_method, pickup_time,
agent_id, store_id, merchant_id, pickup_city, pickup_loc, pickup_lon, pickup_lat, model_id, expiry_time, original_order_no, num, price, `explain`,
agent_id, store_id, merchant_id, pickup_city, pickup_loc, pickup_lon, pickup_lat, model_id, model, expiry_time, original_order_no, num, price, `explain`,
instructions, out_unit, out_price,return_type,return_method,address,auto_cancel_time,cost, is_overdue from rl_order
</sql>
@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
o.delivery_fee,
o.lease_fee,
o.model_id,
o.model,
o.mark,
o.duration,
o.status,
@ -72,7 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
o.out_price,
u.user_name as userName,
s.name as storeName,
s.address as storeAddress,
s.simple_address as storeAddress,
m.model,
a.name agentName,
r.rental_unit as rentalUnit,
@ -116,12 +117,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRlOrderList" parameterType="RlOrderQuery" resultMap="RlOrderResult">
<include refid="selectRlOrderDetail"/>
<where>
<if test="orderNo != null and orderNo != ''"> and o.order_no = #{orderNo}</if>
<if test="outTradeNo != null and outTradeNo != ''"> and o.out_trade_no = #{outTradeNo}</if>
<if test="orderNo != null and orderNo != ''"> and o.order_no like concat('%', #{orderNo}, '%')</if>
<if test="outTradeNo != null and outTradeNo != ''"> and o.out_trade_no like concat('%', #{outTradeNo}, '%')</if>
<if test="userId != null"> and o.user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and u.user_name like concat('%', #{userName}, '%')</if>
<if test="realName != null and realName != ''"> and o.real_name like concat('%', #{realName}, '%')</if>
<if test="phone != null and phone != ''"> and u.phone like concat('%', #{phone}, '%')</if>
<if test="phone != null and phone != ''"> and u.phonenumber like concat('%', #{phone}, '%')</if>
<if test="ruleId != null"> and o.rule_id = #{ruleId}</if>
<if test="deviceMac != null and deviceMac != ''"> and o.device_mac = #{deviceMac}</if>
<if test="sn != null and sn != ''"> and o.sn = #{sn}</if>
@ -159,10 +160,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="expiryTime != null"> and o.expiry_time = #{expiryTime}</if>
<if test="originalOrderNo != null and originalOrderNo != ''"> and o.original_order_no = #{originalOrderNo}</if>
<if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%Y%m%d') &gt;= date_format(#{startTime},'%Y%m%d')
and date_format(o.create_time,'%Y%m%d') &gt;= date_format(#{startTime},'%Y%m%d')
</if>
<if test="endTime != null and endTime != ''">
and date_format(create_time,'%Y%m%d') &lt;= date_format(#{endTime},'%Y%m%d')
and date_format(o.create_time,'%Y%m%d') &lt;= date_format(#{endTime},'%Y%m%d')
</if>
<if test="keywords != null and keywords != ''">
AND (u.phonenumber LIKE CONCAT('%', #{keywords}, '%') OR o.order_no LIKE CONCAT('%', #{keywords}, '%'))
</if>
<if test="phone != null and phone != ''"> and u.phonenumber like concat('%', #{phone}, '%')</if>
<if test="statusList != null and statusList !=''">
@ -172,6 +176,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
</where>
order by o.create_time desc
</select>
<select id="selectAllRlOrderList" parameterType="RlOrderQuery" resultMap="RlOrderResult">
@ -231,6 +236,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deliveryFee != null">delivery_fee,</if>
<if test="leaseFee != null">lease_fee,</if>
<if test="modelId != null">model_id,</if>
<if test="model != null">model,</if>
<if test="mark != null">mark,</if>
<if test="duration != null">duration,</if>
<if test="status != null">status,</if>
@ -292,6 +298,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deliveryFee != null">#{deliveryFee},</if>
<if test="leaseFee != null">#{leaseFee},</if>
<if test="modelId != null">#{modelId},</if>
<if test="model != null">#{model},</if>
<if test="mark != null">#{mark},</if>
<if test="duration != null">#{duration},</if>
<if test="status != null">#{status},</if>
@ -357,6 +364,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deliveryFee != null">delivery_fee = #{deliveryFee},</if>
<if test="leaseFee != null">lease_fee = #{leaseFee},</if>
<if test="modelId != null">model_id = #{modelId},</if>
<if test="model != null">model = #{model},</if>
<if test="mark != null">mark = #{mark},</if>
<if test="duration != null">duration = #{duration},</if>
<if test="status != null">status = #{status},</if>
@ -395,6 +403,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="address != null">address = #{address},</if>
<if test="autoCancelTime != null">auto_cancel_time = #{autoCancelTime},</if>
<if test="isOverdue != null">is_overdue = #{isOverdue},</if>
<if test="cost != null">cost = #{cost},</if>
</trim>
where order_id = #{orderId}
</update>
@ -423,6 +432,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deliveryFee != null">delivery_fee = #{deliveryFee},</if>
<if test="leaseFee != null">lease_fee = #{leaseFee},</if>
<if test="modelId != null">model_id = #{modelId},</if>
<if test="model != null">model,</if>
<if test="mark != null">mark = #{mark},</if>
<if test="duration != null">duration = #{duration},</if>
<if test="status != null">status = #{status},</if>

View File

@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="RlUserExt" id="RlUserExtResult" autoMapping="true" />
<sql id="selectRlUserExtVo">
select ext_id, user_id, balance, dividend_proportion, cooperation_time, dividend_status from rl_user_ext
select ext_id, user_id, balance, dividend_proportion, cooperation_time, dividend_status, wx_collection_code, ali_collection_code, agent_id from rl_user_ext
</sql>
<select id="selectRlUserExtList" parameterType="RlUserExt" resultMap="RlUserExtResult">
@ -26,6 +26,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where ext_id = #{extId}
</select>
<select id="selectRlUserExtByUserId" parameterType="Long" resultMap="RlUserExtResult">
<include refid="selectRlUserExtVo"/>
where user_id = #{userId}
</select>
<insert id="insertRlUserExt" parameterType="RlUserExt" useGeneratedKeys="true" keyProperty="extId">
insert into rl_user_ext
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -34,6 +39,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dividendProportion != null">dividend_proportion,</if>
<if test="cooperationTime != null">cooperation_time,</if>
<if test="dividendStatus != null">dividend_status,</if>
<if test="wxCollectionCode != null">wx_collection_code,</if>
<if test="aliCollectionCode != null">ali_collection_code,</if>
<if test="agentId != null">agent_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
@ -41,6 +49,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dividendProportion != null">#{dividendProportion},</if>
<if test="cooperationTime != null">#{cooperationTime},</if>
<if test="dividendStatus != null">#{dividendStatus},</if>
<if test="wxCollectionCode != null">#{wxCollectionCode},</if>
<if test="aliCollectionCode != null">#{aliCollectionCode},</if>
<if test="agentId != null">#{agentId},</if>
</trim>
</insert>
@ -52,6 +63,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dividendProportion != null">dividend_proportion = #{dividendProportion},</if>
<if test="cooperationTime != null">cooperation_time = #{cooperationTime},</if>
<if test="dividendStatus != null">dividend_status = #{dividendStatus},</if>
<if test="wxCollectionCode != null">wx_collection_code = #{wxCollectionCode},</if>
<if test="aliCollectionCode != null">ali_collection_code = #{aliCollectionCode},</if>
<if test="agentId != null">agent_id = #{agentId},</if>
</trim>
where user_id = #{userId}
</update>

View File

@ -88,7 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectUserById" parameterType="Long" resultMap="EUserResult">
select u.user_id, u.user_name, u.real_name, u.id_card, u.nick_name, u.email, u.avatar,
u.phonenumber, u.password, u.sex, u.status,
u.phonenumber, u.password, u.sex, u.status,u.user_type,
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wxopenid,u.is_authentication
from rl_user u
where u.user_id = #{userId}
@ -97,9 +97,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="myAccountInfoByUserId" parameterType="Long" resultMap="EUserResult">
select u.user_id, u.user_name, u.real_name, u.id_card, u.nick_name, u.email, u.avatar,
u.phonenumber, u.password, u.sex, u.status,
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wxopenid,u.is_authentication
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wxopenid,u.is_authentication,
ex.balance,ex.dividend_proportion dividendProportion,ex.cooperation_time cooperationTime,ex.dividend_status dividendStatus
from rl_user u
where user_id = #{userId}
left join rl_user_ext ex on u.user_id = ex.user_id
where u.user_id = #{userId}
</select>
<select id="checkUserNameUnique" parameterType="String" resultMap="EUserResult">

View File

@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="RlWithdrawVO" id="RlWithdrawResult" autoMapping="true" />
<sql id="selectRlWithdrawVo">
select id, withdraw_no, amount, status, create_time, reject_reason, owner_name, owner_id, owner_phone, service_charge, cost, payment_method from rl_withdraw
select id, withdraw_no, amount, status, create_time, reject_reason, owner_name, owner_id, owner_phone, handling_charge, cost, payment_method from rl_withdraw
</sql>
<select id="selectRlWithdrawList" parameterType="RlWithdraw" resultMap="RlWithdrawResult">
@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ownerName != null and ownerName != ''"> and owner_name like concat('%', #{ownerName}, '%')</if>
<if test="ownerId != null "> and owner_id = #{ownerId}</if>
<if test="ownerPhone != null and ownerPhone != ''"> and owner_phone = #{ownerPhone}</if>
<if test="serviceCharge != null "> and service_charge = #{serviceCharge}</if>
<if test="handlingCharge != null "> and handling_charge = #{handlingCharge}</if>
<if test="cost != null "> and cost = #{cost}</if>
<if test="paymentMethod != null and paymentMethod != ''"> and payment_method = #{paymentMethod}</if>
</where>
@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ownerName != null">owner_name,</if>
<if test="ownerId != null">owner_id,</if>
<if test="ownerPhone != null">owner_phone,</if>
<if test="serviceCharge != null">service_charge,</if>
<if test="handlingCharge != null">handling_charge,</if>
<if test="cost != null">cost,</if>
<if test="paymentMethod != null">payment_method,</if>
</trim>
@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ownerName != null">#{ownerName},</if>
<if test="ownerId != null">#{ownerId},</if>
<if test="ownerPhone != null">#{ownerPhone},</if>
<if test="serviceCharge != null">#{serviceCharge},</if>
<if test="handlingCharge != null">#{handlingCharge},</if>
<if test="cost != null">#{cost},</if>
<if test="paymentMethod != null">#{paymentMethod},</if>
</trim>
@ -78,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ownerName != null">owner_name = #{ownerName},</if>
<if test="ownerId != null">owner_id = #{ownerId},</if>
<if test="ownerPhone != null">owner_phone = #{ownerPhone},</if>
<if test="serviceCharge != null">service_charge = #{serviceCharge},</if>
<if test="handlingCharge != null">handling_charge = #{handlingCharge},</if>
<if test="cost != null">cost = #{cost},</if>
<if test="paymentMethod != null">payment_method = #{paymentMethod},</if>
</trim>

View File

@ -10,7 +10,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select
ss.store_id,
ss.name,
ss.user_id,
ss.group_sort,
ss.is_default,
ss.address,
@ -40,13 +39,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ss.simple_address,
ss.merchant_id
from rl_store ss
left join rl_user su on su.user_id = ss.user_id
left join rl_user su on su.user_id = ss.merchant_id
left join rl_agent a on a.agent_id = ss.agent_id
</sql>
<sql id="searchCondition">
<if test="query.name != null and query.name != ''"> and ss.name like concat('%', #{query.name}, '%')</if>
<if test="query.userId != null "> and ss.user_id = #{query.userId}</if>
<if test="query.show != null "> and ss.show = #{query.show}</if>
<if test="query.storeId != null "> and ss.store_id = #{query.storeId}</if>
<if test="query.isDefault != null "> and ss.is_default = #{query.isDefault}</if>
@ -75,7 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
<if test="query.userIds != null and query.userIds.size() > 0">
and ss.user_id in
and ss.merchant_id in
<foreach collection="query.userIds" close=")" item="item" open="(" separator=",">
#{item}
</foreach>
@ -151,7 +149,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into rl_store
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="userId != null">user_id,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="groupSort != null">group_sort,</if>
@ -178,7 +175,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="userId != null">#{userId},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="groupSort != null">#{groupSort},</if>
@ -215,7 +211,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="updateColumns">
<if test="data.name != null">`name` = #{data.name},</if>
<if test="data.userId != null">user_id = #{data.userId},</if>
<if test="data.groupSort != null">group_sort = #{data.groupSort},</if>
<if test="data.picture != null">picture = #{data.picture},</if>
<if test="data.address != null and data.address != ''">address = #{data.address},</if>
@ -269,16 +264,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</otherwise>
</choose>
</foreach>
<foreach open="user_id = CASE store_id" collection="list" item="item" close="END,">
<choose>
<when test="item.userId != null">
WHEN #{item.storeId} THEN #{item.userId}
</when>
<otherwise>
WHEN #{item.storeId} THEN user_id
</otherwise>
</choose>
</foreach>
<foreach open="group_sort = CASE store_id" collection="list" item="item" close="END,">
<choose>
<when test="item.groupSort != null">
@ -308,7 +293,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="setDefault">
update rl_store
set is_default = if(store_id = #{storeId}, true, false)
where user_id = #{userId}
where merchant_id = #{userId}
</update>
<delete id="deleteSmStoreById" parameterType="Long">