车型和收费方式关联等
This commit is contained in:
parent
10942e6f1d
commit
4ed575e7bb
|
@ -565,7 +565,7 @@ public class AppVerifyController extends BaseController
|
|||
throw new ServiceException("【改价】更新订单信息失败");
|
||||
}
|
||||
/** 记录订单履历 */
|
||||
if(orderOperService.recordOrderHistory(order.getOrderNo(),ServiceConstants.ORDER_OPERATION_CHANGE_PRICE,
|
||||
if(!orderOperService.recordOrderHistory(order.getOrderNo(),ServiceConstants.ORDER_OPERATION_CHANGE_PRICE,
|
||||
etOrder1.getStatus(),order.getStatus(),etOrder1.getPayFee(),order.getPayFee(),etOrder1.getUserId(),etOrder1.getPhone(),
|
||||
"订单改价,修改前价格:"+etOrder1.getPayFee()+",修改后价格:"+order.getPayFee())){
|
||||
throw new ServiceException("【改价】更新订单信息失败");
|
||||
|
|
|
@ -155,7 +155,7 @@ public class AppAdminController extends BaseController
|
|||
{
|
||||
log.info("【账变记录/myChangeBalanceList】参数:【query={}】", query);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
if(query.getType().equals("0")){
|
||||
if(ObjectUtil.isNotNull(query.getType()) && query.getType().equals("0")){
|
||||
query.setType(null);
|
||||
}
|
||||
List<RlChangeBalance> changeBalances = rlUserService.myChangeBalanceList(query,getUserId());
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
|
|||
import com.ruoyi.system.domain.store.StoreBO;
|
||||
import com.ruoyi.system.domain.store.StoreQuery;
|
||||
import com.ruoyi.system.domain.store.StoreVo;
|
||||
import com.ruoyi.system.service.IRlModelService;
|
||||
import com.ruoyi.system.service.store.RlStoreService;
|
||||
import com.ruoyi.system.service.store.StoreAssembler;
|
||||
import com.ruoyi.system.service.store.StoreValidator;
|
||||
|
@ -43,6 +44,9 @@ public class RlStoreController extends BaseController
|
|||
@Autowired
|
||||
private StoreAssembler storeAssembler;
|
||||
|
||||
@Autowired
|
||||
private IRlModelService modelService;
|
||||
|
||||
/**
|
||||
* 查询商户列表
|
||||
*/
|
||||
|
@ -88,11 +92,15 @@ public class RlStoreController extends BaseController
|
|||
@GetMapping(value = "/{storeId}")
|
||||
public AjaxResult getInfo(@PathVariable("storeId") Long storeId)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
StoreVo store = storeService.selectSmStoreById(storeId);
|
||||
List<Long> longs = modelService.selectEModelLongListByStoreId(storeId);
|
||||
List<StoreVo> list = Collections.singletonList(store);
|
||||
storeAssembler.assembleDeviceCount(list); // 设备数量
|
||||
storeAssembler.assembleRevenue(list); // 经营数据
|
||||
return success(store);
|
||||
ajax.put(AjaxResult.DATA_TAG, store);
|
||||
ajax.put("modelIds", longs);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,6 +6,7 @@ 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.SysRole;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
|
@ -18,6 +19,7 @@ import com.ruoyi.system.domain.vo.RlUserQuery;
|
|||
import com.ruoyi.system.service.IRlAgentService;
|
||||
import com.ruoyi.system.service.IRlUserExtService;
|
||||
import com.ruoyi.system.service.IRlUserService;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -27,6 +29,7 @@ import javax.annotation.Resource;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
|
@ -49,6 +52,9 @@ public class RlUserController extends BaseController
|
|||
@Autowired
|
||||
private IRlAgentService agentService;
|
||||
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
|
@ -96,10 +102,13 @@ public class RlUserController extends BaseController
|
|||
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
List<SysRole> roles = roleService.selectRoleAll();
|
||||
ajax.put("roles", RlUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
if (StringUtils.isNotNull(userId))
|
||||
{
|
||||
RlUser rlUser = userService.selectUserById(userId);
|
||||
ajax.put(AjaxResult.DATA_TAG, rlUser);
|
||||
ajax.put("roleIds", rlUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
||||
}
|
||||
return ajax;
|
||||
}
|
||||
|
@ -166,10 +175,6 @@ public class RlUserController extends BaseController
|
|||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
|
|
|
@ -8,4 +8,8 @@ public class RlModelQuery extends RlModel{
|
|||
/** 配件列表 */
|
||||
private Long[] accessoryIds;
|
||||
|
||||
/** 收费列表 */
|
||||
private Long[] feeRulesIds;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ruoyi.system.domain.model;
|
|||
|
||||
import com.ruoyi.system.domain.RlFunction;
|
||||
import com.ruoyi.system.domain.accessory.RlAccessoryVO;
|
||||
import com.ruoyi.system.domain.rule.RlFeeRule;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -28,4 +29,10 @@ public class RlModelVO extends RlModel{
|
|||
|
||||
/** 代理商名称 */
|
||||
private String agnetName;
|
||||
|
||||
@ApiModelProperty("收费模版")
|
||||
private List<Long> feeRulesIds;
|
||||
|
||||
@ApiModelProperty("配件列表")
|
||||
private List<Long> accessorysIds;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.ruoyi.system.domain.modelRule;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 车型和收费方式关联对象 rl_model_rule
|
||||
*
|
||||
* @author qzz
|
||||
* @date 2024-10-18
|
||||
*/
|
||||
@Data
|
||||
public class RlModelRule extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 车型id */
|
||||
private Long modelId;
|
||||
|
||||
/** 收费模版id */
|
||||
private Long ruleId;
|
||||
|
||||
}
|
|
@ -49,9 +49,9 @@ public class RlFeeRule extends BaseEntity
|
|||
/** 是否删除:1-删除 */
|
||||
@Excel(name = "是否删除:1-删除")
|
||||
private Integer isDeleted;
|
||||
|
||||
/** 车型id */
|
||||
private Long modelId;
|
||||
//
|
||||
// /** 车型id */
|
||||
// private Long modelId;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
|
|
@ -13,6 +13,7 @@ import javax.validation.constraints.NotNull;
|
|||
import javax.validation.constraints.Size;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺对象 sm_device_group
|
||||
|
@ -37,11 +38,11 @@ public class Store extends BaseEntity
|
|||
@Size(min = 1, max = 20, message = "店铺名称长度必须在1~60之间")
|
||||
private String name;
|
||||
|
||||
/** 用户 */
|
||||
@Excel(name = "用户")
|
||||
@ApiModelProperty("用户id")
|
||||
// @NotNull(message = "用户id不能为空", groups = {ValidGroup.Create.class})
|
||||
private Long userId;
|
||||
// /** 用户 */
|
||||
// @Excel(name = "用户")
|
||||
// @ApiModelProperty("用户id")
|
||||
//// @NotNull(message = "用户id不能为空", groups = {ValidGroup.Create.class})
|
||||
// private Long userId;
|
||||
|
||||
/** 代理商 */
|
||||
@Excel(name = "代理商")
|
||||
|
@ -139,4 +140,8 @@ public class Store extends BaseEntity
|
|||
/** 商户id */
|
||||
@Excel(name = "商户id")
|
||||
private Long merchantId;
|
||||
|
||||
/** id */
|
||||
@Excel(name = "车型ids")
|
||||
private List<Long> modelIds;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,6 @@ public class StoreBO extends Store {
|
|||
StoreBO bo = new StoreBO();
|
||||
bo.setStoreId(getStoreId());
|
||||
bo.setName(getName());
|
||||
bo.setUserId(getUserId());
|
||||
bo.setPicture(getPicture());
|
||||
bo.setAddress(getAddress());
|
||||
bo.setLng(getLng());
|
||||
|
@ -75,6 +74,8 @@ public class StoreBO extends Store {
|
|||
bo.setContactName(getContactName());
|
||||
bo.setContactMobile(getContactMobile());
|
||||
bo.setShow(getShow());
|
||||
bo.setMerchantId(getMerchantId());
|
||||
bo.setModelIds(getModelIds());
|
||||
return bo;
|
||||
}
|
||||
|
||||
|
@ -85,7 +86,6 @@ public class StoreBO extends Store {
|
|||
public StoreBO filterCreate() {
|
||||
StoreBO bo = new StoreBO();
|
||||
bo.setName(getName());
|
||||
bo.setUserId(getUserId());
|
||||
bo.setPicture(getPicture());
|
||||
bo.setAddress(getAddress());
|
||||
bo.setLng(getLng());
|
||||
|
@ -103,6 +103,7 @@ public class StoreBO extends Store {
|
|||
bo.setAgentId(getAgentId());
|
||||
bo.setServerPhone(getServerPhone());
|
||||
bo.setSimpleAddress(getSimpleAddress());
|
||||
bo.setModelIds(getModelIds());
|
||||
return bo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,4 +67,13 @@ public interface RlFeeRuleMapper
|
|||
* @return 收费模板
|
||||
*/
|
||||
public List<RlFeeRule> selectRlFeeRuleListByModelId(Long modelId);
|
||||
|
||||
/**
|
||||
* 查询收费模板列表ids
|
||||
*
|
||||
* @param modelId 车型id
|
||||
* @return 收费模板集合
|
||||
*/
|
||||
List<Long> selectRlFeeRuleLongListByModelId(Long modelId);
|
||||
|
||||
}
|
||||
|
|
|
@ -81,4 +81,12 @@ public interface RlModelMapper
|
|||
int selectAllCount();
|
||||
|
||||
List<RlModelVO> getModelListByMerchantId(Long merchantId);
|
||||
|
||||
/**
|
||||
* 根据店铺id查询车辆型号列表ids
|
||||
*
|
||||
* @param storeId 店铺id
|
||||
* @return 车辆型号
|
||||
*/
|
||||
List<Long> selectEModelLongListByStoreId(Long storeId);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.ruoyi.system.domain.modelRule.RlModelRule;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车型和收费方式关联Mapper接口
|
||||
*
|
||||
* @author qzz
|
||||
* @date 2024-10-18
|
||||
*/
|
||||
public interface RlModelRuleMapper
|
||||
{
|
||||
/**
|
||||
* 查询车型和收费方式关联
|
||||
*
|
||||
* @param modelId 车型和收费方式关联主键
|
||||
* @return 车型和收费方式关联
|
||||
*/
|
||||
public RlModelRule selectRlModelRuleByModelId(Long modelId);
|
||||
|
||||
/**
|
||||
* 查询车型和收费方式关联列表
|
||||
*
|
||||
* @param rlModelRule 车型和收费方式关联
|
||||
* @return 车型和收费方式关联集合
|
||||
*/
|
||||
public List<RlModelRule> selectRlModelRuleList(RlModelRule rlModelRule);
|
||||
|
||||
/**
|
||||
* 新增车型和收费方式关联
|
||||
*
|
||||
* @param rlModelRule 车型和收费方式关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRlModelRule(RlModelRule rlModelRule);
|
||||
|
||||
/**
|
||||
* 修改车型和收费方式关联
|
||||
*
|
||||
* @param rlModelRule 车型和收费方式关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRlModelRule(RlModelRule rlModelRule);
|
||||
|
||||
/**
|
||||
* 删除车型和收费方式关联
|
||||
*
|
||||
* @param modelId 车型和收费方式关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRlModelRuleByModelId(Long modelId);
|
||||
|
||||
/**
|
||||
* 批量删除车型和收费方式关联
|
||||
*
|
||||
* @param modelIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRlModelRuleByModelIds(Long[] modelIds);
|
||||
}
|
|
@ -60,4 +60,12 @@ public interface RlModelStoreMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteRlModelStoreByModeIds(Long[] modeIds);
|
||||
|
||||
/**
|
||||
* 根据店铺id删除车型店铺关系信息
|
||||
*
|
||||
* @param storeId 店铺id
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRlModelStoreByStoreId(Long storeId);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public interface RlUserMapper
|
|||
* @param userId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public RlUser selectUserById(Long userId);
|
||||
public RlUserVO selectUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 通过用户ID查询账户
|
||||
|
@ -194,4 +194,9 @@ public interface RlUserMapper
|
|||
* @return 结果
|
||||
*/
|
||||
BigDecimal selectUserBalanceById(Long userId);
|
||||
|
||||
/**
|
||||
* 更新用户余额
|
||||
*/
|
||||
int changeBalance(@Param("changeAmount")BigDecimal changeAmount,@Param("userId")Long userId);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,14 @@ public interface IRlFeeRuleService
|
|||
*/
|
||||
public List<RlFeeRule> selectRlFeeRuleListByModelId(Long modelId);
|
||||
|
||||
/**
|
||||
* 查询收费模板列表ids
|
||||
*
|
||||
* @param modelId 车型id
|
||||
* @return 收费模板集合
|
||||
*/
|
||||
public List<Long> selectRlFeeRuleLongListByModelId(Long modelId);
|
||||
|
||||
/**
|
||||
* 新增收费模板
|
||||
*
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.system.domain.modelRule.RlModelRule;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车型和收费方式关联Service接口
|
||||
*
|
||||
* @author qzz
|
||||
* @date 2024-10-18
|
||||
*/
|
||||
public interface IRlModelRuleService
|
||||
{
|
||||
/**
|
||||
* 查询车型和收费方式关联
|
||||
*
|
||||
* @param modelId 车型和收费方式关联主键
|
||||
* @return 车型和收费方式关联
|
||||
*/
|
||||
public RlModelRule selectRlModelRuleByModelId(Long modelId);
|
||||
|
||||
/**
|
||||
* 查询车型和收费方式关联列表
|
||||
*
|
||||
* @param rlModelRule 车型和收费方式关联
|
||||
* @return 车型和收费方式关联集合
|
||||
*/
|
||||
public List<RlModelRule> selectRlModelRuleList(RlModelRule rlModelRule);
|
||||
|
||||
/**
|
||||
* 新增车型和收费方式关联
|
||||
*
|
||||
* @param rlModelRule 车型和收费方式关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRlModelRule(RlModelRule rlModelRule);
|
||||
|
||||
/**
|
||||
* 修改车型和收费方式关联
|
||||
*
|
||||
* @param rlModelRule 车型和收费方式关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRlModelRule(RlModelRule rlModelRule);
|
||||
|
||||
/**
|
||||
* 批量删除车型和收费方式关联
|
||||
*
|
||||
* @param modelIds 需要删除的车型和收费方式关联主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRlModelRuleByModelIds(Long[] modelIds);
|
||||
|
||||
/**
|
||||
* 删除车型和收费方式关联信息
|
||||
*
|
||||
* @param modelId 车型和收费方式关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRlModelRuleByModelId(Long modelId);
|
||||
}
|
|
@ -56,6 +56,14 @@ public interface IRlModelService
|
|||
*/
|
||||
public List<RlModelVO> selectEModelListByStoreId(Long storeId);
|
||||
|
||||
/**
|
||||
* 根据店铺id查询车辆型号列表ids
|
||||
*
|
||||
* @param storeId 店铺id
|
||||
* @return 车辆型号
|
||||
*/
|
||||
public List<Long> selectEModelLongListByStoreId(Long storeId);
|
||||
|
||||
/**
|
||||
* 新增车辆型号
|
||||
*
|
||||
|
|
|
@ -67,4 +67,12 @@ public interface IRlModelStoreService
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteRlModelStoreByModeId(Long modeId);
|
||||
|
||||
/**
|
||||
* 根据店铺id删除车型店铺关系信息
|
||||
*
|
||||
* @param storeId 店铺id
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRlModelStoreByStoreId(Long storeId);
|
||||
}
|
||||
|
|
|
@ -390,4 +390,9 @@ public interface IRlUserService
|
|||
* 管理员提现
|
||||
*/
|
||||
int adminWithdraw(RlWithdrawQuery withdraw);
|
||||
|
||||
/**
|
||||
* 更新余额
|
||||
*/
|
||||
int changeBalance(BigDecimal changeAmount, Long userId);
|
||||
}
|
||||
|
|
|
@ -185,7 +185,7 @@ public class CallbackServiceImpl implements CallbackService {
|
|||
generateChangeBalance(rlDividendDetailVOS,originalOrder);
|
||||
|
||||
/** 记录订单履历 */
|
||||
if(orderOperService.recordOrderHistory(originalOrder.getOrderNo(),ServiceConstants.ORDER_OPERATION_PAY,
|
||||
if(!orderOperService.recordOrderHistory(originalOrder.getOrderNo(),ServiceConstants.ORDER_OPERATION_PAY,
|
||||
originalOrder.getStatus(),updateOrder.getStatus(),BigDecimal.ZERO,originalOrder.getPayFee(),originalOrder.getUserId(),originalOrder.getPhone(),"订单支付:已支付 "+originalOrder.getPayFee()+"元")){
|
||||
throw new ServiceException("【订单履历-支付】更新订单信息失败");
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.system.domain.changeBalance.RlChangeBalance;
|
||||
import com.ruoyi.system.domain.changeBalance.RlChangeBalanceQuery;
|
||||
|
@ -8,6 +9,7 @@ import com.ruoyi.system.service.IRlChangeBalanceService;
|
|||
import com.ruoyi.system.service.IRlUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
|
@ -28,6 +30,9 @@ public class RlChangeBalanceServiceImpl implements IRlChangeBalanceService
|
|||
@Autowired
|
||||
private IRlUserService userService;
|
||||
|
||||
@Autowired
|
||||
private TransactionTemplate transactionTemplate;
|
||||
|
||||
/**
|
||||
* 查询余额变动
|
||||
*
|
||||
|
@ -143,6 +148,7 @@ public class RlChangeBalanceServiceImpl implements IRlChangeBalanceService
|
|||
rlChangeBalance.setOwnerPhone(phone);
|
||||
rlChangeBalance.setCreateTime(DateUtils.getNowDate());
|
||||
// 根据 busType 生成不同的 reason 描述
|
||||
BigDecimal changeAmount = rlChangeBalance.getAmount();
|
||||
String reason = "";
|
||||
switch (busType) {
|
||||
case "1":
|
||||
|
@ -153,21 +159,34 @@ public class RlChangeBalanceServiceImpl implements IRlChangeBalanceService
|
|||
break;
|
||||
case "4":
|
||||
reason = "订单退款:" + orderNo;
|
||||
changeAmount = changeAmount.negate();
|
||||
break;
|
||||
case "5":
|
||||
reason = "提现";
|
||||
changeAmount = changeAmount.negate();
|
||||
break;
|
||||
case "6":
|
||||
reason = "提现失败";
|
||||
break;
|
||||
case "8":
|
||||
reason = "短信扣费";
|
||||
changeAmount = changeAmount.negate();
|
||||
break;
|
||||
default:
|
||||
reason = "未知业务类型";
|
||||
break;
|
||||
}
|
||||
rlChangeBalance.setReason(reason);
|
||||
return insertRlChangeBalance(rlChangeBalance);
|
||||
BigDecimal finalChangeAmount = changeAmount;
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
int i = insertRlChangeBalance(rlChangeBalance);
|
||||
if (i <= 0) {
|
||||
throw new RuntimeException("账变记录插入失败");
|
||||
}
|
||||
int i2 = userService.changeBalance(finalChangeAmount,userId);
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if(!execute)throw new ServiceException("账变记录插入失败");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1414,7 +1414,7 @@ public class RlDeviceServiceImpl extends ServiceImpl<RlDeviceMapper, RlDevice> i
|
|||
throw new ServiceException("更新订单状态失败");
|
||||
}
|
||||
/** 7. 记录订单履历*/
|
||||
if(orderOperService.recordOrderHistory(orderNo,ServiceConstants.ORDER_OPERATION_RETURN_END,
|
||||
if(!orderOperService.recordOrderHistory(orderNo,ServiceConstants.ORDER_OPERATION_RETURN_END,
|
||||
order.getStatus(),updateOrder.getStatus(),order.getPayFee(),order.getPayFee(),order.getUserId(),order.getPhone(),"已还车")){
|
||||
throw new ServiceException("【记录订单履历失败】");
|
||||
}
|
||||
|
|
|
@ -56,6 +56,17 @@ public class RlFeeRuleServiceImpl implements IRlFeeRuleService
|
|||
return rlFeeRuleMapper.selectRlFeeRuleListByModelId(modelId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询收费模板列表ids
|
||||
*
|
||||
* @param modelId 车型id
|
||||
* @return 收费模板集合
|
||||
*/
|
||||
@Override
|
||||
public List<Long> selectRlFeeRuleLongListByModelId(Long modelId) {
|
||||
return rlFeeRuleMapper.selectRlFeeRuleLongListByModelId(modelId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增收费模板
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.ruoyi.system.domain.modelRule.RlModelRule;
|
||||
import com.ruoyi.system.mapper.RlModelRuleMapper;
|
||||
import com.ruoyi.system.service.IRlModelRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车型和收费方式关联Service业务层处理
|
||||
*
|
||||
* @author qzz
|
||||
* @date 2024-10-18
|
||||
*/
|
||||
@Service
|
||||
public class RlModelRuleServiceImpl implements IRlModelRuleService
|
||||
{
|
||||
@Autowired
|
||||
private RlModelRuleMapper rlModelRuleMapper;
|
||||
|
||||
/**
|
||||
* 查询车型和收费方式关联
|
||||
*
|
||||
* @param modelId 车型和收费方式关联主键
|
||||
* @return 车型和收费方式关联
|
||||
*/
|
||||
@Override
|
||||
public RlModelRule selectRlModelRuleByModelId(Long modelId)
|
||||
{
|
||||
return rlModelRuleMapper.selectRlModelRuleByModelId(modelId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车型和收费方式关联列表
|
||||
*
|
||||
* @param rlModelRule 车型和收费方式关联
|
||||
* @return 车型和收费方式关联
|
||||
*/
|
||||
@Override
|
||||
public List<RlModelRule> selectRlModelRuleList(RlModelRule rlModelRule)
|
||||
{
|
||||
return rlModelRuleMapper.selectRlModelRuleList(rlModelRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增车型和收费方式关联
|
||||
*
|
||||
* @param rlModelRule 车型和收费方式关联
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRlModelRule(RlModelRule rlModelRule)
|
||||
{
|
||||
return rlModelRuleMapper.insertRlModelRule(rlModelRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车型和收费方式关联
|
||||
*
|
||||
* @param rlModelRule 车型和收费方式关联
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRlModelRule(RlModelRule rlModelRule)
|
||||
{
|
||||
return rlModelRuleMapper.updateRlModelRule(rlModelRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除车型和收费方式关联
|
||||
*
|
||||
* @param modelIds 需要删除的车型和收费方式关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRlModelRuleByModelIds(Long[] modelIds)
|
||||
{
|
||||
return rlModelRuleMapper.deleteRlModelRuleByModelIds(modelIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除车型和收费方式关联信息
|
||||
*
|
||||
* @param modelId 车型和收费方式关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRlModelRuleByModelId(Long modelId)
|
||||
{
|
||||
return rlModelRuleMapper.deleteRlModelRuleByModelId(modelId);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
|
|||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.system.domain.RlFunction;
|
||||
import com.ruoyi.system.domain.accessory.RlAccessoryVO;
|
||||
|
@ -10,19 +11,24 @@ import com.ruoyi.system.domain.model.RlModel;
|
|||
import com.ruoyi.system.domain.model.RlModelQuery;
|
||||
import com.ruoyi.system.domain.model.RlModelVO;
|
||||
import com.ruoyi.system.domain.modelAccessory.RlModelAccessory;
|
||||
import com.ruoyi.system.domain.modelRule.RlModelRule;
|
||||
import com.ruoyi.system.domain.rule.RlFeeRule;
|
||||
import com.ruoyi.system.domain.store.StoreVo;
|
||||
import com.ruoyi.system.mapper.RlModelMapper;
|
||||
import com.ruoyi.system.service.*;
|
||||
import com.ruoyi.system.service.store.RlStoreService;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
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;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 车辆型号Service业务层处理
|
||||
|
@ -52,6 +58,15 @@ public class RlModelServiceImpl implements IRlModelService
|
|||
@Autowired
|
||||
private IRlModelAccessoryService modelAccessoryService;
|
||||
|
||||
@Autowired
|
||||
private IRlFeeRuleService rlFeeRuleService;
|
||||
|
||||
@Autowired
|
||||
private IRlModelRuleService rlModelRuleService;
|
||||
|
||||
@Autowired
|
||||
private TransactionTemplate transactionTemplate;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -69,12 +84,19 @@ public class RlModelServiceImpl implements IRlModelService
|
|||
List<RlAccessoryVO> accessories = accessoryService.selectRlAccessoryListByModelId(modelId);
|
||||
if(ObjectUtil.isNotNull(accessories)){
|
||||
etModel.setAccessorys(accessories);
|
||||
// 将List<RlAccessoryVO> accessories 转为List<Long> list
|
||||
List<Long> accessoryIds = accessories.stream()
|
||||
.map(RlAccessoryVO::getAccessoryId) // 假设 RlAccessoryVO 有一个 getAccessoryId() 方法
|
||||
.collect(Collectors.toList());
|
||||
etModel.setAccessorysIds(accessoryIds);
|
||||
}
|
||||
// 功能列表
|
||||
List<RlFunction> functionList = getFunctionListByModelId(modelId);
|
||||
etModel.setFunctionList(functionList);
|
||||
// Integer allNum = eDeviceService.selectCountByModelId(modelId);
|
||||
// etModel.setDeviceNum(allNum);
|
||||
|
||||
// 收费模版
|
||||
List<Long> rlFeeRules = rlFeeRuleService.selectRlFeeRuleLongListByModelId(modelId);
|
||||
etModel.setFeeRulesIds(rlFeeRules);
|
||||
}
|
||||
return etModel;
|
||||
}
|
||||
|
@ -155,6 +177,18 @@ public class RlModelServiceImpl implements IRlModelService
|
|||
return models;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据店铺id查询车辆型号列表ids
|
||||
*
|
||||
* @param storeId 店铺id
|
||||
* @return 车辆型号
|
||||
*/
|
||||
@Override
|
||||
public List<Long> selectEModelLongListByStoreId(Long storeId) {
|
||||
return rlModelMapper.selectEModelLongListByStoreId(storeId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增车辆型号
|
||||
*
|
||||
|
@ -166,23 +200,20 @@ public class RlModelServiceImpl implements IRlModelService
|
|||
@Transactional
|
||||
public int insertEModel(RlModelQuery modelQuery)
|
||||
{
|
||||
modelQuery.setCreateTime(DateUtils.getNowDate());
|
||||
int i = rlModelMapper.insertEModel(modelQuery);
|
||||
if(i == 0){
|
||||
throw new Exception("新增失败");
|
||||
}
|
||||
Long[] accessoryIds = modelQuery.getAccessoryIds();
|
||||
if(ObjectUtil.isNotNull(accessoryIds) && accessoryIds.length>0){
|
||||
log.info("【新增车辆型号】");
|
||||
for (Long accessoryId:accessoryIds) {
|
||||
RlModelAccessory modelAccessory = new RlModelAccessory();
|
||||
modelAccessory.setAccessoryId(accessoryId);
|
||||
modelAccessory.setModelId(modelQuery.getModelId());
|
||||
modelAccessoryService.insertRlModelAccessory(modelAccessory);
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
modelQuery.setCreateTime(DateUtils.getNowDate());
|
||||
int i = rlModelMapper.insertEModel(modelQuery);
|
||||
if(i == 0){
|
||||
throw new ServiceException("新增失败");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
/** 关联配件*/
|
||||
associatedAccessory(modelQuery);
|
||||
/** 关联收费方式*/
|
||||
associatedFeeRule(modelQuery);
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if(!execute)throw new ServiceException("修改车辆型号失败");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -197,25 +228,59 @@ public class RlModelServiceImpl implements IRlModelService
|
|||
public int updateEModel(RlModelQuery etModel)
|
||||
{
|
||||
etModel.setUpdateTime(DateUtils.getNowDate());
|
||||
int i = rlModelMapper.updateEModel(etModel);
|
||||
if(i == 0){
|
||||
throw new Exception("修改车辆型号失败");
|
||||
}
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
int i = rlModelMapper.updateEModel(etModel);
|
||||
if(i == 0){
|
||||
throw new ServiceException("修改车辆型号失败");
|
||||
}
|
||||
/** 关联配件*/
|
||||
associatedAccessory(etModel);
|
||||
/** 关联收费方式*/
|
||||
associatedFeeRule(etModel);
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if(!execute)throw new ServiceException("修改车辆型号失败");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Integer associatedAccessory(RlModelQuery etModel) {
|
||||
Long[] accessoryIds = etModel.getAccessoryIds();
|
||||
if(ObjectUtil.isNotNull(accessoryIds) && accessoryIds.length>0){
|
||||
log.info("【修改车辆型号,删除车型配件关联成功】");
|
||||
int i1 = modelAccessoryService.deleteRlModelAccessoryByModelId(etModel.getModelId());
|
||||
if(i1 > 0){
|
||||
for (Long accessoryId:accessoryIds) {
|
||||
RlModelAccessory modelAccessory = new RlModelAccessory();
|
||||
modelAccessory.setAccessoryId(accessoryId);
|
||||
modelAccessory.setModelId(etModel.getModelId());
|
||||
modelAccessoryService.insertRlModelAccessory(modelAccessory);
|
||||
log.info("【修改车辆型号,删除车型配件关联成功】");
|
||||
for (Long accessoryId:accessoryIds) {
|
||||
RlModelAccessory modelAccessory = new RlModelAccessory();
|
||||
modelAccessory.setAccessoryId(accessoryId);
|
||||
modelAccessory.setModelId(etModel.getModelId());
|
||||
int i = modelAccessoryService.insertRlModelAccessory(modelAccessory);
|
||||
if (i > 0){
|
||||
log.info("【修改车辆型号,添加配件关联成功】");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Integer associatedFeeRule(RlModelQuery etModel) {
|
||||
Long[] feeRulesIds = etModel.getFeeRulesIds();
|
||||
if(ObjectUtil.isNotNull(feeRulesIds) && feeRulesIds.length>0){
|
||||
int i1 = rlModelRuleService.deleteRlModelRuleByModelId(etModel.getModelId());
|
||||
log.info("【修改车辆型号,删除收费方式成功】");
|
||||
for (Long feeRuleId:feeRulesIds) {
|
||||
RlModelRule modelRule = new RlModelRule();
|
||||
modelRule.setRuleId(feeRuleId);
|
||||
modelRule.setModelId(etModel.getModelId());
|
||||
int i = rlModelRuleService.insertRlModelRule(modelRule);
|
||||
if (i > 0){
|
||||
log.info("【修改车辆型号,添加收费方式成功】");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -92,4 +92,15 @@ public class RlModelStoreServiceImpl implements IRlModelStoreService
|
|||
{
|
||||
return rlModelStoreMapper.deleteRlModelStoreByModeId(modeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据店铺id删除车型店铺关系信息
|
||||
*
|
||||
* @param storeId 店铺id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRlModelStoreByStoreId(Long storeId) {
|
||||
return rlModelStoreMapper.deleteRlModelStoreByStoreId(storeId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -432,7 +432,7 @@ public class RlOrderServiceImpl implements IRlOrderService
|
|||
}else{
|
||||
startTime = order.getExpiryTime();
|
||||
}
|
||||
Date expiryTime = DateUtils.getTimeAfterXUnit(startTime, order.getNum(), feeRule.getRentalUnit());
|
||||
Date expiryTime = DateUtils.getTimeAfterXUnit(startTime, order.getNum(), feeRule.getRentalUnit());//先根据预估的取车时间,计算出到期时间,后面根据具体的取车时间再算一次
|
||||
order.setExpiryTime(expiryTime);
|
||||
}
|
||||
|
||||
|
@ -459,6 +459,8 @@ public class RlOrderServiceImpl implements IRlOrderService
|
|||
rlOrder.setSn(sn);
|
||||
rlOrder.setStatus(ServiceConstants.ORDER_STATUS_IN_USE);
|
||||
rlOrder.setPickupTime(DateUtils.getNowDate());
|
||||
Date expiryTime = DateUtils.getTimeAfterXUnit(DateUtils.getNowDate(), order.getNum(), order.getRentalUnit());
|
||||
rlOrder.setExpiryTime(expiryTime);
|
||||
int i = orderMapper.updateRlOrderByOrderNo(rlOrder);
|
||||
if(i > 0){
|
||||
/** 更新设备状态 */
|
||||
|
@ -542,8 +544,10 @@ public class RlOrderServiceImpl implements IRlOrderService
|
|||
int i = orderMapper.updateRlOrderByOrderNo(rlOrder);
|
||||
if(i>0){
|
||||
/** 记录订单履历 */
|
||||
orderOperService.recordOrderHistory(orderNo,ServiceConstants.ORDER_OPERATION_USER_CANCEL,
|
||||
order.getStatus(),rlOrder.getStatus(),order.getPayFee(),order.getPayFee(),order.getUserId(),order.getPhone(),"取消订单");
|
||||
if(!orderOperService.recordOrderHistory(orderNo,ServiceConstants.ORDER_OPERATION_USER_CANCEL,
|
||||
order.getStatus(),rlOrder.getStatus(),order.getPayFee(),order.getPayFee(),order.getUserId(),order.getPhone(),"取消订单")){
|
||||
throw new ServiceException("【订单履历-支付】更新订单信息失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -596,7 +600,7 @@ public class RlOrderServiceImpl implements IRlOrderService
|
|||
// updateOrder.setStatus(ServiceConstants.ORDER_STATUS_REFUND);
|
||||
// int i = orderMapper.updateRlOrderByOrderNo(updateOrder);
|
||||
/** 记录订单履历*/
|
||||
if(orderOperService.recordOrderHistory(orderNo,ServiceConstants.ORDER_OPERATION_RETURN_END,
|
||||
if(!orderOperService.recordOrderHistory(orderNo,ServiceConstants.ORDER_OPERATION_RETURN_END,
|
||||
order.getStatus(),order.getStatus(),order.getPayFee(),order.getPayFee(),order.getUserId(),order.getPhone(),"已退款:-"+remainingDeposit+"元")){
|
||||
throw new ServiceException("【记录订单履历失败】");
|
||||
}
|
||||
|
@ -647,7 +651,7 @@ public class RlOrderServiceImpl implements IRlOrderService
|
|||
refundDividendHandle(rlOrderVO, refundPercentage);
|
||||
/** 4.记录退款表 创建退款对象*/
|
||||
String outRefundNo = saveRefundObj(rlOrderVO, finalRefundAmount, dispatchFee, deliveryFee, leaseFee);
|
||||
if(orderOperService.recordOrderHistory(rlOrderVO.getOrderNo(),ServiceConstants.ORDER_OPERATION_REFUND,
|
||||
if(!orderOperService.recordOrderHistory(rlOrderVO.getOrderNo(),ServiceConstants.ORDER_OPERATION_REFUND,
|
||||
rlOrderVO.getStatus(),rlOrderVO.getStatus(),rlOrderVO.getPayFee(),rlOrderVO.getPayFee(),rlOrderVO.getUserId(),rlOrderVO.getPhone(),"已退款: "+finalRefundAmount+"元")){
|
||||
throw new ServiceException("【改价】更新订单信息失败");
|
||||
}
|
||||
|
|
|
@ -194,9 +194,9 @@ public class RlUserServiceImpl implements IRlUserService{
|
|||
* @return 用户对象信息
|
||||
*/
|
||||
@Override
|
||||
public RlUser selectUserById(Long userId)
|
||||
public RlUserVO selectUserById(Long userId)
|
||||
{
|
||||
RlUser users = rlUserMapper.selectUserById(userId);
|
||||
RlUserVO users = rlUserMapper.selectUserById(userId);
|
||||
if(ObjectUtil.isNull(users)){
|
||||
throw new ServiceException("没有该用户:"+userId);
|
||||
}
|
||||
|
@ -768,6 +768,14 @@ public class RlUserServiceImpl implements IRlUserService{
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户余额
|
||||
*/
|
||||
@Override
|
||||
public int changeBalance(BigDecimal changeAmount, Long userId) {
|
||||
return rlUserMapper.changeBalance(changeAmount, userId);
|
||||
}
|
||||
|
||||
private void withdrawalRecord(RlWithdrawQuery withdraw, String orderNo, RlUser user, RlUserExt rlUserExt) {
|
||||
RlWithdraw rlWithdraw = new RlWithdraw();
|
||||
rlWithdraw.setWithdrawNo(orderNo);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.system.service.store.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.DateUtils;
|
||||
|
@ -9,6 +10,7 @@ import com.ruoyi.common.utils.ServiceUtil;
|
|||
import com.ruoyi.common.utils.bean.collection.CollectionUtils;
|
||||
import com.ruoyi.common.utils.map.GeoUtils;
|
||||
import com.ruoyi.system.domain.model.RlModelVO;
|
||||
import com.ruoyi.system.domain.modelStore.RlModelStore;
|
||||
import com.ruoyi.system.domain.store.Store;
|
||||
import com.ruoyi.system.domain.store.StoreCountVO;
|
||||
import com.ruoyi.system.domain.store.StoreQuery;
|
||||
|
@ -69,6 +71,12 @@ public class StoreServiceImpl implements RlStoreService
|
|||
@Autowired
|
||||
private IRlModelService modelService;
|
||||
|
||||
@Autowired
|
||||
private IRlModelStoreService modelStoreService;
|
||||
|
||||
@Resource
|
||||
private IRlUserService userService;
|
||||
|
||||
/**
|
||||
* 查询店铺
|
||||
*
|
||||
|
@ -185,19 +193,37 @@ public class StoreServiceImpl implements RlStoreService
|
|||
store.setCreateBy(SecurityUtils.getUsername());
|
||||
|
||||
Integer result = transactionTemplate.execute(status -> {
|
||||
bandModel(store);
|
||||
// 新增店铺
|
||||
int i = storeMapper.insertSmStore(store);
|
||||
ServiceUtil.assertion(i != 1, "新增店铺失败");
|
||||
|
||||
// 如果没有默认店铺,则将其设为默认店铺
|
||||
if (this.selectDefaultStore(store.getUserId()) == null) {
|
||||
this.setDefault(store.getUserId(), store.getStoreId());
|
||||
if (this.selectDefaultStore(store.getMerchantId()) == null) {
|
||||
this.setDefault(store.getMerchantId(), store.getStoreId());
|
||||
}
|
||||
|
||||
return i;
|
||||
});
|
||||
return result == null ? 0 : result;
|
||||
}
|
||||
|
||||
private void bandModel(Store store) {
|
||||
/*关联车型*/
|
||||
List<Long> models = store.getModelIds();
|
||||
if (models != null && models.size() > 0) {
|
||||
for(Long modelId:models){
|
||||
RlModelStore rlModelStore = new RlModelStore();
|
||||
rlModelStore.setStoreId(store.getStoreId());
|
||||
rlModelStore.setModeId(modelId);
|
||||
int i = modelStoreService.insertRlModelStore(rlModelStore);
|
||||
if(i == 0){
|
||||
throw new ServiceException("关联车型失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改店铺
|
||||
*
|
||||
|
@ -207,9 +233,32 @@ public class StoreServiceImpl implements RlStoreService
|
|||
@Override
|
||||
public int updateSmStore(Store store)
|
||||
{
|
||||
store.setUpdateTime(DateUtils.getNowDate());
|
||||
store.setUpdateBy(SecurityUtils.getUsername());
|
||||
return storeMapper.updateSmStore(store);
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
store.setUpdateTime(DateUtils.getNowDate());
|
||||
store.setUpdateBy(SecurityUtils.getUsername());
|
||||
Long userId = store.getMerchantId();
|
||||
/** 修改用户类型 */
|
||||
RlUser rlUser = new RlUser();
|
||||
rlUser.setUserId(userId);
|
||||
rlUser.setUserType(ServiceConstants.USER_TYPE_MERCHANT);
|
||||
int i1 = userService.updateUserStatus(rlUser);
|
||||
if(i1 == 0){
|
||||
throw new ServiceException("【修改商户】失败");
|
||||
}
|
||||
/** 保存代理商*/
|
||||
RlUserExt userExt = new RlUserExt();
|
||||
userExt.setUserId(userId);
|
||||
userExt.setAgentId(store.getAgentId());
|
||||
int i2 = userExtService.updateRlUserExt(userExt);
|
||||
ServiceUtil.assertion(i2 != 1, "【修改商户】失败");
|
||||
/*关联车型*/
|
||||
int i = modelStoreService.deleteRlModelStoreByStoreId(store.getStoreId());
|
||||
bandModel(store);
|
||||
int i3 = storeMapper.updateSmStore(store);
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if(!execute)throw new ServiceException("修改店铺失败");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -258,7 +307,7 @@ public class StoreServiceImpl implements RlStoreService
|
|||
}
|
||||
StoreQuery dto = new StoreQuery();
|
||||
dto.setIsDefault(true);
|
||||
dto.setUserId(userId);
|
||||
dto.setMerchantId(userId);
|
||||
List<StoreVo> list = selectSmStoreList(dto);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return null;
|
||||
|
@ -287,11 +336,11 @@ public class StoreServiceImpl implements RlStoreService
|
|||
if (!CollectionUtils.isEmptyElement(defaultList)) {
|
||||
// 包含默认店铺,则查询第一个店铺
|
||||
query = new StoreQuery();
|
||||
query.setUserId(defaultList.get(0).getUserId());
|
||||
query.setMerchantId(defaultList.get(0).getMerchantId());
|
||||
StoreVo other = storeMapper.selectOne(query);
|
||||
if (other != null) {
|
||||
// 其他店铺不为空,则设置为第一个店铺
|
||||
this.setDefault(other.getUserId(), other.getStoreId());
|
||||
this.setDefault(other.getMerchantId(), other.getStoreId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -397,7 +446,7 @@ public class StoreServiceImpl implements RlStoreService
|
|||
}
|
||||
StoreQuery query = new StoreQuery();
|
||||
query.setStoreIds(ids);
|
||||
query.setUserId(userId);
|
||||
query.setMerchantId(userId);
|
||||
return selectSmStoreList(query);
|
||||
}
|
||||
|
||||
|
@ -407,7 +456,7 @@ public class StoreServiceImpl implements RlStoreService
|
|||
return Collections.emptyList();
|
||||
}
|
||||
StoreQuery query = new StoreQuery();
|
||||
query.setUserId(userId);
|
||||
query.setMerchantId(userId);
|
||||
return storeMapper.selectSmStoreList(query);
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ public class StoreValidatorImpl extends BaseValidator implements StoreValidator
|
|||
*/
|
||||
@Override
|
||||
public boolean isStoreBelongUser(Store store, Long userId) {
|
||||
return store != null && store.getUserId() != null && store.getUserId().equals(userId);
|
||||
return store != null && store.getMerchantId() != null && store.getMerchantId().equals(userId);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -61,13 +61,13 @@ public class RlTask {
|
|||
List<RlOrderVO> rlOrderVOS = orderService.selectAllRlOrderList(rlOrderQuery);
|
||||
for (RlOrderVO orderVO:rlOrderVOS) {
|
||||
// 检查autoCancelTime是否已经过了当前时间
|
||||
if (orderVO.getAutoCancelTime().before(new Date())) {
|
||||
if (!orderVO.getIsOverdue() && orderVO.getAutoCancelTime().before(new Date())) {
|
||||
RlOrder rlOrder = new RlOrder();
|
||||
rlOrder.setOrderId(orderVO.getOrderId());
|
||||
rlOrder.setStatus(ServiceConstants.ORDER_STATUS_AUTO_CANCEL);
|
||||
int i = orderService.updateRlOrder(rlOrder);
|
||||
if(i>0){
|
||||
if(orderOperService.recordOrderHistory(orderVO.getOrderNo(),ServiceConstants.ORDER_OPERATION_SYSTEM_CANCEL,
|
||||
if(!orderOperService.recordOrderHistory(orderVO.getOrderNo(),ServiceConstants.ORDER_OPERATION_SYSTEM_CANCEL,
|
||||
orderVO.getStatus(),rlOrder.getStatus(),orderVO.getPayFee(),orderVO.getPayFee(),orderVO.getUserId(),orderVO.getPhone(),"超时系统自动取消")){
|
||||
throw new ServiceException("【记录订单履历--超时系统自动取消失败】");
|
||||
}
|
||||
|
|
|
@ -36,7 +36,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectRlAccessoryByAccessoryId" parameterType="Long" resultMap="RlAccessoryResult">
|
||||
<include refid="selectRlAccessoryVo"/>
|
||||
where accessory_id = #{accessoryId}
|
||||
where a.accessory_id = #{accessoryId}
|
||||
GROUP BY
|
||||
a.accessory_id, a.NAME, a.STATUS, a.create_by, a.create_time, a.update_time;
|
||||
</select>
|
||||
|
||||
<select id="selectRlAccessoryListByModelId" parameterType="Long" resultMap="RlAccessoryResult">
|
||||
|
|
|
@ -25,6 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="ownerPhone != null and ownerPhone != ''"> and owner_phone = #{ownerPhone}</if>
|
||||
<if test="reason != null and reason != ''"> and reason = #{reason}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectRlChangeBalanceByChangeId" parameterType="Long" resultMap="RlChangeBalanceResult">
|
||||
|
|
|
@ -25,6 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="dividendAmount != null "> and dd.dividend_amount = #{dividendAmount}</if>
|
||||
<if test="dividendProportion != null "> and dd.dividend_proportion = #{dividendProportion}</if>
|
||||
</where>
|
||||
order by dd.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectRlDividendDetailById" parameterType="Long" resultMap="RlDividendDetailResult">
|
||||
|
@ -76,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="dividendProportion != null">dividend_proportion = #{dividendProportion},</if>
|
||||
<if test="refundAmount != null">refund_amount = #{refundAmount},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
|
@ -13,15 +13,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="outUnit" column="out_unit" />
|
||||
<result property="outPrice" column="out_price" />
|
||||
<result property="isDeleted" column="is_deleted" />
|
||||
<result property="modelId" column="model_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRlFeeRuleVo">
|
||||
select rule_id, rental_unit, price, `explain`, instructions, out_unit, out_price, is_deleted, model_id from rl_fee_rule
|
||||
select r.rule_id, r.rental_unit, r.price, r.`explain`, r.instructions, r.out_unit, r.out_price, r.is_deleted from rl_fee_rule r
|
||||
left join rl_model_rule mr on mr.rule_id = r.rule_id
|
||||
</sql>
|
||||
|
||||
<select id="selectRlFeeRuleList" parameterType="RlFeeRule" resultMap="RlFeeRuleResult">
|
||||
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
|
||||
select r.rule_id, r.rental_unit, r.price, r.`explain`, r.instructions, r.out_unit, r.out_price, r.is_deleted 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>
|
||||
|
@ -42,6 +42,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where rule_id = #{ruleId}
|
||||
</select>
|
||||
|
||||
<select id="selectRlFeeRuleLongListByModelId" resultType="java.lang.Long">
|
||||
select r.rule_id from rl_fee_rule r
|
||||
left join rl_model_rule mr on mr.rule_id = r.rule_id
|
||||
where mr.model_id = #{modelId}
|
||||
</select>
|
||||
|
||||
<insert id="insertRlFeeRule" parameterType="RlFeeRule" useGeneratedKeys="true" keyProperty="ruleId">
|
||||
insert into rl_fee_rule
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
@ -62,7 +68,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="outUnit != null">#{outUnit},</if>
|
||||
<if test="outPrice != null">#{outPrice},</if>
|
||||
<if test="isDeleted != null">#{isDeleted},</if>
|
||||
<if test="modelId != null">#{modelId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -76,7 +81,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="outUnit != null">out_unit = #{outUnit},</if>
|
||||
<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}
|
||||
|
|
|
@ -73,6 +73,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
</select>
|
||||
|
||||
<select id="selectEModelLongListByStoreId" resultType="java.lang.Long">
|
||||
select m.model_id from rl_model m
|
||||
LEFT JOIN rl_model_store ms ON ms.mode_id = m.model_id
|
||||
where m.del_flag = '0' and ms.store_id = #{storeId}
|
||||
</select>
|
||||
|
||||
<insert id="insertEModel" parameterType="RlModel" keyProperty="modelId" useGeneratedKeys="true">
|
||||
insert into rl_model
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
<?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.RlModelRuleMapper">
|
||||
|
||||
<resultMap type="RlModelRule" id="RlModelRuleResult">
|
||||
<result property="modelId" column="model_id" />
|
||||
<result property="ruleId" column="rule_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRlModelRuleVo">
|
||||
select model_id, rule_id from rl_model_rule
|
||||
</sql>
|
||||
|
||||
<select id="selectRlModelRuleList" parameterType="RlModelRule" resultMap="RlModelRuleResult">
|
||||
<include refid="selectRlModelRuleVo"/>
|
||||
<where>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRlModelRuleByModelId" parameterType="Long" resultMap="RlModelRuleResult">
|
||||
<include refid="selectRlModelRuleVo"/>
|
||||
where model_id = #{modelId}
|
||||
</select>
|
||||
|
||||
<insert id="insertRlModelRule" parameterType="RlModelRule">
|
||||
insert into rl_model_rule
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="modelId != null">model_id,</if>
|
||||
<if test="ruleId != null">rule_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="modelId != null">#{modelId},</if>
|
||||
<if test="ruleId != null">#{ruleId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRlModelRule" parameterType="RlModelRule">
|
||||
update rl_model_rule
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="ruleId != null">rule_id = #{ruleId},</if>
|
||||
</trim>
|
||||
where model_id = #{modelId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRlModelRuleByModelId" parameterType="Long">
|
||||
delete from rl_model_rule where model_id = #{modelId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRlModelRuleByModelIds" parameterType="String">
|
||||
delete from rl_model_rule where model_id in
|
||||
<foreach item="modelId" collection="array" open="(" separator="," close=")">
|
||||
#{modelId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -59,4 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{modeId}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteRlModelStoreByStoreId">
|
||||
delete from rl_model_store where store_id = #{storeId}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
|
@ -4,7 +4,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.RlUserMapper">
|
||||
|
||||
<resultMap type="RlUserVO" id="EUserResult" autoMapping="true" />
|
||||
<resultMap type="RlUserVO" id="EUserResult" autoMapping="true" >
|
||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="RoleResult" type="SysRole">
|
||||
<id property="roleId" column="role_id" />
|
||||
<result property="roleName" column="role_name" />
|
||||
<result property="roleKey" column="role_key" />
|
||||
<result property="roleSort" column="role_sort" />
|
||||
<result property="dataScope" column="data_scope" />
|
||||
<result property="status" column="role_status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id, u.user_name, u.real_name, u.id_card, u.nick_name, u.email, u.avatar,u.user_type,
|
||||
|
@ -65,7 +76,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectAllocatedList" parameterType="RlUser" resultMap="EUserResult">
|
||||
select distinct u.user_id, u.user_name, u.nick_name,u.real_name, u.email, u.phonenumber, u.status, u.create_time
|
||||
from rl_user u
|
||||
where u.del_flag = '0'
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
left join sys_role r on r.role_id = ur.role_id
|
||||
where u.del_flag = '0' and r.role_id = #{roleId}
|
||||
<if test="userName != null and userName != ''">
|
||||
AND u.user_name like concat('%', #{userName}, '%')
|
||||
</if>
|
||||
|
@ -92,10 +105,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<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.user_type,
|
||||
select u.user_id, u.user_name, u.real_name, u.id_card, u.nick_name, u.email, u.avatar,a.city_id,c.name cityName,
|
||||
ex.balance,ex.dividend_proportion dividendProportion,ex.cooperation_time cooperationTime,ex.dividend_status dividendStatus,ex.agent_id,
|
||||
u.phonenumber, u.password, u.sex, u.status,u.user_type,r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status,
|
||||
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
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
left join sys_role r on r.role_id = ur.role_id
|
||||
left join rl_user_ext ex on u.user_id = ex.user_id
|
||||
left join rl_agent a on a.agent_id = ex.agent_id
|
||||
left join rl_city c on c.city_id = a.city_id
|
||||
where u.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
|
@ -261,7 +280,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
update rl_user set password = #{password} where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteUserById" parameterType="Long">
|
||||
<update id="changeBalance">
|
||||
update rl_user_ext set balance = balance + #{changeAmount} where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteUserById" parameterType="Long">
|
||||
update rl_user set del_flag = '2' where user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user