商户中心核心功能
This commit is contained in:
parent
f6b16a225b
commit
611c535acb
|
@ -4,6 +4,8 @@ import java.math.BigDecimal;
|
|||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.ruoyi.common.core.domain.JsonViewProfile;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
@ -23,36 +25,45 @@ public class ReceiveBill extends BaseEntity
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 账单ID */
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private Long billId;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户ID")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private Long userId;
|
||||
|
||||
/** 设备ID */
|
||||
@Excel(name = "设备ID")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private Long deviceId;
|
||||
|
||||
/** 账单类型 */
|
||||
@Excel(name = "账单类型")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private String type;
|
||||
|
||||
/** 账单状态 */
|
||||
@Excel(name = "账单状态")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private String status;
|
||||
|
||||
/** 出账时间 */
|
||||
@Excel(name = "出账时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private LocalDateTime billTime;
|
||||
|
||||
/** 账单金额 */
|
||||
@Excel(name = "账单金额")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 账单描述 */
|
||||
@Excel(name = "账单描述")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty("已收金额")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private BigDecimal receivedAmount;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.ruoyi.ss.receiveBill.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.ruoyi.common.core.domain.JsonViewProfile;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -11,12 +13,15 @@ import lombok.Data;
|
|||
public class ReceiveBillVO extends ReceiveBill{
|
||||
|
||||
@ApiModelProperty("用户名称")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty("设备名称")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private String deviceName;
|
||||
|
||||
@ApiModelProperty("设备SN")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private String deviceNo;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ruoyi.ss.store.service;
|
|||
|
||||
import com.ruoyi.common.core.domain.ValidateResult;
|
||||
import com.ruoyi.ss.store.domain.Store;
|
||||
import com.ruoyi.ss.store.domain.StoreVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -66,6 +67,11 @@ public interface StoreValidator {
|
|||
*/
|
||||
boolean isStoreBelongUser(List<Long> storeId, Long userId);
|
||||
|
||||
/**
|
||||
* 判断店铺是否属于用户
|
||||
*/
|
||||
boolean isStoreBelongUser(Store store, Long userId);
|
||||
|
||||
/**
|
||||
* 判断店铺是否存在
|
||||
* @param storeIds
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ruoyi.ss.store.service.impl;
|
|||
|
||||
import com.ruoyi.common.core.domain.BaseValidator;
|
||||
import com.ruoyi.common.core.domain.ValidateResult;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.ss.device.domain.DeviceQuery;
|
||||
|
@ -164,18 +165,22 @@ public class StoreValidatorImpl extends BaseValidator implements StoreValidator
|
|||
return result;
|
||||
}
|
||||
|
||||
StoreVo old = storeService.selectSmStoreById(data.getStoreId());
|
||||
if (old == null) {
|
||||
return error("待修改的店铺不存在");
|
||||
}
|
||||
|
||||
// 前台用户更新校验
|
||||
// 判断是否是当前用户的店铺
|
||||
if (!this.isStoreBelongUser(Collections.singletonList(data.getStoreId()), SecurityUtils.getUserId())) {
|
||||
if (!this.isStoreBelongUser(old, SecurityUtils.getUserId())) {
|
||||
return error("当前店铺不属于当前用户");
|
||||
}
|
||||
|
||||
// TODO 判断店铺是否正在变更中
|
||||
if (this.isApproving(data)) {
|
||||
// 判断店铺是否正在变更中
|
||||
if (this.isApproving(old)) {
|
||||
return error("当前店铺正在变更中,请稍后重试");
|
||||
}
|
||||
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
|
@ -223,13 +228,23 @@ public class StoreValidatorImpl extends BaseValidator implements StoreValidator
|
|||
public boolean isStoreBelongUser(List<Long> storeIds, Long userId) {
|
||||
List<StoreVo> stores = storeService.selectStoreByIds(storeIds);
|
||||
for (StoreVo item : stores) {
|
||||
if (!Objects.equals(item.getUserId(), userId)) {
|
||||
if (!this.isStoreBelongUser(item, userId)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断店铺是否属于用户
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public boolean isStoreBelongUser(Store store, Long userId) {
|
||||
return store != null && store.getUserId() != null && store.getUserId().equals(userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断店铺是否存在
|
||||
*
|
||||
|
|
|
@ -65,8 +65,10 @@ public class Suit extends BaseEntity
|
|||
private String timeUnit;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
@JsonView(JsonViewProfile.AppMch.class)
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("排序顺序,越小越靠前")
|
||||
@JsonView(JsonViewProfile.AppMch.class)
|
||||
private Integer sort;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.List;
|
|||
public class SuitVO extends Suit {
|
||||
|
||||
@ApiModelProperty("用户名称")
|
||||
@JsonView(JsonViewProfile.AppMch.class)
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty("应用的设备列表")
|
||||
|
|
|
@ -12,10 +12,7 @@ import lombok.Data;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -42,7 +39,7 @@ public class SuitAssemblerImpl implements SuitAssembler {
|
|||
for (SuitVO suit : list) {
|
||||
List<DeviceSuitVO> deviceSuitList = group.get(suit.getSuitId());
|
||||
if (deviceSuitList != null) {
|
||||
suit.setDeviceList(deviceSuitList.stream().map(DeviceSuitVO::getDevice).collect(Collectors.toList()));
|
||||
suit.setDeviceList(deviceSuitList.stream().map(DeviceSuitVO::getDevice).filter(Objects::nonNull).collect(Collectors.toList()));
|
||||
} else {
|
||||
suit.setDeviceList(Collections.emptyList());
|
||||
}
|
||||
|
|
|
@ -87,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<sql id="searchCondition">
|
||||
<if test="query.userId != null "> and stb.user_id = #{query.userId}</if>
|
||||
<if test="query.billNo != null and query.billNo != ''"> and stb.bill_no like concat('%', #{query.billNo}, '%')</if>
|
||||
<if test="query.billId != null "> and stb.bill_id = #{query.billId}</if>
|
||||
<if test="query.deviceId != null "> and stb.device_id = #{query.deviceId}</if>
|
||||
<if test="query.type != null "> and stb.type = #{query.type} </if>
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
package com.ruoyi.web.controller.app;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.JsonViewProfile;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.ss.receiveBill.domain.ReceiveBillQuery;
|
||||
import com.ruoyi.ss.receiveBill.service.ReceiveBillService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -20,9 +24,13 @@ public class AppReceiveBillController extends BaseController {
|
|||
@Autowired
|
||||
private ReceiveBillService receiveBillService;
|
||||
|
||||
@ApiOperation("查询本人应付账单")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(ReceiveBillQuery query) {
|
||||
return success();
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
public TableDataInfo list(ReceiveBillQuery query) {
|
||||
query.setUserId(getUserId());
|
||||
startPage();
|
||||
return getDataTable(receiveBillService.selectReceiveBillList(query));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -112,12 +112,12 @@ public class AppTransactionBillController extends BaseController
|
|||
@ApiOperation("查询本人收款的订单列表")
|
||||
@GetMapping("/incomeList")
|
||||
@JsonView(JsonViewProfile.AppMch.class)
|
||||
public TableDataInfo incomeList(TransactionBillQuery smTransactionBill)
|
||||
public TableDataInfo incomeList(TransactionBillQuery query)
|
||||
{
|
||||
startPage();
|
||||
smTransactionBill.setMchId(getUserId());
|
||||
smTransactionBill.setType(TransactionBillType.RECHARGE.getType());
|
||||
List<TransactionBillVO> list = smTransactionBillService.selectSmTransactionBillList(smTransactionBill);
|
||||
query.setMchId(getUserId());
|
||||
query.setType(TransactionBillType.RECHARGE.getType());
|
||||
List<TransactionBillVO> list = smTransactionBillService.selectSmTransactionBillList(query);
|
||||
transactionAssembler.assembleChannelName(list);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
|
|||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.JsonViewProfile;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.ss.store.service.StoreValidator;
|
||||
import com.ruoyi.ss.storeApply.domain.StoreApplyQuery;
|
||||
import com.ruoyi.ss.storeApply.domain.StoreApplyVO;
|
||||
|
@ -64,4 +65,21 @@ public class MchStoreApplyController extends BaseController {
|
|||
return toAjax(storeApplyService.cancel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("查询本人提交的店铺申请")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(StoreApplyQuery query) {
|
||||
startPage();
|
||||
query.setUserId(getUserId());
|
||||
return getDataTable(storeApplyService.selectStoreApplyList(query));
|
||||
}
|
||||
@ApiOperation("查询本人提交的店铺申请详情")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult detail(@PathVariable Long id) {
|
||||
StoreApplyVO apply = storeApplyService.selectStoreApplyById(id);
|
||||
if (!storeApplyValidator.isBelong(apply, getUserId())) {
|
||||
return success();
|
||||
}
|
||||
return success(apply);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
package com.ruoyi.web.controller.mch;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.JsonViewProfile;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.ss.suit.domain.SuitQuery;
|
||||
import com.ruoyi.ss.suit.domain.SuitVO;
|
||||
import com.ruoyi.ss.suit.service.SuitAssembler;
|
||||
import com.ruoyi.ss.suit.service.SuitService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -11,6 +15,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/7/30
|
||||
|
@ -22,12 +28,18 @@ public class MchSuitController extends BaseController {
|
|||
@Autowired
|
||||
private SuitService suitService;
|
||||
|
||||
@Autowired
|
||||
private SuitAssembler suitAssembler;
|
||||
|
||||
@ApiOperation("获取用户的套餐列表")
|
||||
@GetMapping("/list")
|
||||
@JsonView(JsonViewProfile.AppMch.class)
|
||||
public TableDataInfo list(SuitQuery query) {
|
||||
startPage();
|
||||
query.setUserId(getUserId());
|
||||
return getDataTable(suitService.selectSuitList(query));
|
||||
List<SuitVO> list = suitService.selectSuitList(query);
|
||||
suitAssembler.assembleDeviceList(list);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user