Merge remote-tracking branch 'origin/master'

This commit is contained in:
zjf committed 2025-03-27 18:06:55 +08:00
commit 4af50bf60e
24 files changed
+341 -119

No files matched your search

+3 -2
View File
@@ -95,7 +95,7 @@ CREATE TABLE wallet_rule_price_config
id bigint NOT NULL COMMENT '主键',
rule_price_type varchar(64) NOT NULL COMMENT '规则类型',
base_price bigint NOT NULL COMMENT '基础金额',
multiple bigint NOT NULL COMMENT '金额的倍数必须大于1',
multiple bigint NOT NULL COMMENT '额外支付的倍数',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
@@ -114,7 +114,8 @@ CREATE TABLE wallet_rule_mch_config
(
id bigint NOT NULL COMMENT '主键',
source_mch_id bigint NOT NULL COMMENT '源商户id',
traget_mch_id bigint NOT NULL COMMENT '目标商户id',
target_mch_id bigint NOT NULL COMMENT '目标商户id',
target_dept_id bigint NOT NULL COMMENT '目标部门id',
rule_price_config_id bigint NOT NULL COMMENT '规则配置id',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
@@ -7,8 +7,8 @@ import lombok.RequiredArgsConstructor;
@Getter
public enum MerchantTypeEnum {
CANTEEN("1", "食堂"),
SUPERMARKET("3", "合作超市"),
SELF_SUPERMARKET("2", "自营超市"),
SUPERMARKET("2", "合作超市"),
SELF_SUPERMARKET("3", "自营超市"),
;
/**
@@ -1,7 +1,6 @@
package com.bsd.pjcloud.hard.api.dto.hard;
import cn.hutool.core.util.ObjectUtil;
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
import lombok.Data;
import java.util.ArrayList;
@@ -29,10 +28,11 @@ public class CurrentUserHardTypeInfoDto {
List<String> list = new ArrayList<>();
if (isAll()) return list;
if (this.getCanteenView() != null && this.getCanteenView()) {
list.add(HardTypeEnum.CANTEEN.getType());
list.add(MerchantTypeEnum.CANTEEN.getType());
}
if (this.getSupermarket() != null && this.getSupermarket()) {
list.add(HardTypeEnum.SUPERMARKET.getType());
list.add(MerchantTypeEnum.SELF_SUPERMARKET.getType());
list.add(MerchantTypeEnum.SUPERMARKET.getType());
}
return list;
}
@@ -23,12 +23,12 @@ public class HardOrderDto extends HardOrderEntity implements BaseIsIncludeTreeIn
private List<Long> hardIds;
private List<String> hardTypeCodes;
private String hardTypeCode;
private List<Long> mchIds;
private List<String> mchTypeCodes;
private List<String> orderStatusCodes;
private LocalDate[] createTimeList;
@@ -39,6 +39,8 @@ public class HardOrderDto extends HardOrderEntity implements BaseIsIncludeTreeIn
private List<String> orderPayTypeCodes;
private List<String> hardTypeCodes;
/**
* 是否查询购物车列表
*/
@@ -56,6 +56,19 @@ public class HardOrderEntity extends Model<HardOrderEntity> {
@Schema(description = "商户id")
private Long merchantId;
/**
* 商户类型
*/
@Schema(description = "商户类型")
private String merchantType;
/**
* 商户绑定的部门id
*/
@Schema(description = "商户绑定的部门id")
private Long merchantDeptId;
/**
* 设备id
*/
@@ -40,6 +40,8 @@ public class HardOrderVo extends HardOrderEntity implements BaseUserInterface, B
private String hardType;
private List<String> hardTypeCodes;
/**
* 购物车
*/
@@ -12,9 +12,11 @@ import com.alibaba.excel.write.metadata.fill.FillConfig;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.DataScopeFuncEnum;
import com.bsd.pjcloud.common.idempotent.annotation.Idempotent;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.common.security.annotation.Inner;
@@ -36,6 +38,8 @@ import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
import com.bsd.pjcloud.hard.service.HardManagerService;
import com.bsd.pjcloud.hard.service.HardOrderService;
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
@@ -73,6 +77,8 @@ public class HardOrderController {
private final HardOrderMapper hardOrderMapper;
private final RemoteMchService mchService;
/* ************************************* start 远程调用 start ************************************* */
@Inner
@Operation(summary = "app查询订单列表", description = "app查询订单列表")
@@ -151,11 +157,13 @@ public class HardOrderController {
@GetMapping("/page-join")
@PreAuthorize("@pms.hasPermission('hard_hardwareOrder_view')")
public R pageJoin(@ParameterObject Page page, @ParameterObject HardOrderDto dto) {
DataScope dataScope = DataScope.of();
dataScope.setScopeDeptName("user_dept_id");
DataScope dataScope = DataScope.of().func(DataScopeFuncEnum.ALL);
dataScope.setScopeDeptName("merchant_dept_id");
PjcloudUser user = SecurityUtils.getUser();
CurrentUserHardTypeInfoDto hardTypeInfo = hardManagerService.getCurrentUserHardTypeInfo(user);
dto.setHardTypeCodes(hardTypeInfo.getHardTypeList());
dto.setMchTypeCodes(hardTypeInfo.getHardTypeList());
// List<Long> mchIds = hardManagerService.getCurrentUserMchInfo(user, dto.getMchIds());
// dto.setMchIds(mchIds);
return R.ok(hardwareOrderService.scopePageList(page, dto, dataScope));
}
@@ -84,7 +84,7 @@ public interface HardOrderMapper extends PjcloudBaseMapper<HardOrderEntity> {
return selectListByScope(commonWrapper(dto), DataScope.of());
}
Page<HardOrderVo> scopePageList(Page page, @Param("dto") HardOrderDto dto, @Param("dataScope") DataScope dataScope);
Page<HardOrderVo> scopePageList(Page page, @Param("dto") HardOrderDto dto, DataScope dataScope);
List<HardOrderSbVo> listSb(@Param("dto") HardOrderDto dto, DataScope dataScope);
@@ -9,6 +9,8 @@ import com.bsd.pjcloud.hard.api.dto.hard.HardBindDto;
import com.bsd.pjcloud.hard.api.entity.HardManagerEntity;
import com.bsd.pjcloud.hard.api.vo.HardManagerVo;
import java.util.List;
public interface HardManagerService extends IService<HardManagerEntity> {
Page<HardManagerVo> pageJoin(Page page, HardManagerDto dto);
@@ -27,4 +29,9 @@ public interface HardManagerService extends IService<HardManagerEntity> {
* 判断当前用户是否有食堂或者超市管理元权限
*/
CurrentUserHardTypeInfoDto getCurrentUserHardTypeInfo(PjcloudUser user);
/**
* 判断当前用户有哪些商户的权限
*/
List<Long> getCurrentUserMchInfo(PjcloudUser user, List<Long> mchIds);
}
@@ -11,6 +11,7 @@ import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
import com.bsd.pjcloud.admin.api.utils.DataUtil;
import com.bsd.pjcloud.common.core.constant.CommonRoleConstant;
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.core.util.CollectionUtils;
import com.bsd.pjcloud.common.core.util.R;
@@ -38,10 +39,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
/**
* 设备管理
@@ -235,6 +233,27 @@ public class HardManagerServiceImpl extends ServiceImpl<HardManagerMapper, HardM
return result;
}
@Override
public List<Long> getCurrentUserMchInfo(PjcloudUser user, List<Long> mchIds) {
if (ObjectUtil.isEmpty(mchIds)) mchIds = new ArrayList<>();
UserInfo userInfo = userService.getByUserId(user.getId()).getData();
if (ObjectUtil.isEmpty(userInfo)) return mchIds;
String[] roles = userInfo.getRoleCodes();
if (roles.length == 0) return mchIds;
List<String> roleList = Arrays.asList(roles);
MchManageVo mchDetail = null;
if (roleList.contains(CommonRoleConstant.SUPERMARKET_ADMIN)) {
mchDetail = mchService.getByDeptId(user.getDeptId(), MerchantTypeEnum.SELF_SUPERMARKET).getData();
}
if (roleList.contains(CommonRoleConstant.CANTEEN_ADMIN)) {
mchDetail = mchService.getByDeptId(user.getDeptId(), MerchantTypeEnum.CANTEEN).getData();
}
if (ObjectUtil.isNotEmpty(mchDetail)) {
mchIds.add(mchDetail.getId());
}
return mchIds;
}
private boolean existUniqueCode(String uniqueCode, Long id) {
Long count = baseMapper.selectCount(new LambdaQueryWrapper<HardManagerEntity>()
.eq(ObjectUtil.isNotEmpty(uniqueCode), HardManagerEntity::getUniqueCode, uniqueCode)
@@ -264,6 +264,8 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
.hardId(dto.getHardwareId())
.orderStatus(HardOrderStatusEnum.CREATE.getType())
.merchantId(dto.getMerchantId())
.merchantType(mch.getTypes())
.merchantDeptId(mch.getDeptId())
.deptId(dto.getDeptId())
.orderType(dto.getOrderType().getType())
.payType(dto.getOrderPayType().getType())
@@ -298,6 +300,9 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
// 查询父订单
HardParentCarEntity parentCar = hardCarService.getParentCarById(dto.getCarParentId());
if (ObjectUtil.isEmpty(parentCar)) throw new RuntimeException("购物车不存在");
// 查询商户
MchManageVo hardManager = remoteMchService.getById(dto.getMerchantId()).getData();
if (ObjectUtil.isEmpty(hardManager)) throw new RuntimeException("商户不存在");
// 查询父购物车
List<HardCarEntity> carList = hardCarService.getByParentCarId(dto.getCarParentId());
if (ObjectUtil.isEmpty(carList)) throw new RuntimeException("购物车不存在");
@@ -327,6 +332,8 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
.sysType(dto.getHardType().getType())
.orderStatus(HardOrderStatusEnum.CREATE.getType())
.merchantId(parentCar.getMerchantId())
.merchantType(hardManager.getTypes())
.merchantDeptId(hardManager.getDeptId())
.orderType(dto.getOrderType().getType())
.payType(dto.getPayType().getType())
.orderSourceTypeId(dto.getOrderSourceTypeId())
@@ -352,9 +359,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
@Transactional(rollbackFor = Exception.class)
public Long appCreateOrderScancode(HardAppCreateOrderDto dto) {
MchManageVo mch = remoteMchService.getById(dto.getMerchantId()).getData();
if (ObjectUtil.isEmpty(mch)) {
throw new RuntimeException("商户不存在");
}
if (ObjectUtil.isEmpty(mch)) throw new RuntimeException("商户不存在");
// 查询用户
UserInfo userDetail = userService.getByUserId(dto.getUserId()).getData();
if (ObjectUtil.isEmpty(userDetail)) throw new RuntimeException("用户不存在不存在");
@@ -372,6 +377,8 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
.userId(dto.getUserId())
.userDeptId(userDetail.getSysUser().getDeptId())
.merchantId(mch.getId())
.merchantType(mch.getTypes())
.merchantDeptId(mch.getDeptId())
.parentCarId(dto.getCarParentId())
.sysType(dto.getHardType().getType())
.orderStatus(HardOrderStatusEnum.CREATE.getType())
@@ -70,7 +70,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
PjcloudUser user = SecurityUtils.getUser();
CurrentUserHardTypeInfoDto hardTypeInfo = hardManagerService.getCurrentUserHardTypeInfo(user);
dto.setHardTypeCodes(hardTypeInfo.getHardTypeList());
dto.setMchTypeCodes(hardTypeInfo.getHardTypeList());
// 查询总流水
HardOrderDto totalDto = BeanUtil.toBean(dto, HardOrderDto.class);
totalDto.setOrderStatusCodes(HardOrderStatusEnum.getPayPrice());
@@ -132,7 +132,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
dataScope.setScopeDeptName("user_dept_id");
PjcloudUser user = SecurityUtils.getUser();
CurrentUserHardTypeInfoDto hardTypeInfo = hardManagerService.getCurrentUserHardTypeInfo(user);
dto.setHardTypeCodes(hardTypeInfo.getHardTypeList());
dto.setMchTypeCodes(hardTypeInfo.getHardTypeList());
// 查询总流水
HardOrderDto totalDto = BeanUtil.toBean(dto, HardOrderDto.class);
totalDto.setOrderStatusCodes(HardOrderStatusEnum.getPayPrice());
@@ -427,7 +427,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
dataScope.setScopeDeptName("user_dept_id");
PjcloudUser user = SecurityUtils.getUser();
CurrentUserHardTypeInfoDto hardTypeInfo = hardManagerService.getCurrentUserHardTypeInfo(user);
dto.setHardTypeCodes(hardTypeInfo.getHardTypeList());
dto.setMchTypeCodes(hardTypeInfo.getHardTypeList());
// 查询总流水
HardOrderDto totalDto = BeanUtil.toBean(dto, HardOrderDto.class);
totalDto.setOrderStatusCodes(HardOrderStatusEnum.getPayPrice());
@@ -8,6 +8,8 @@
<result property="userId" column="user_id"/>
<result property="userDeptId" column="user_dept_id"/>
<result property="merchantId" column="merchant_id"/>
<result property="merchantType" column="merchant_type"/>
<result property="merchantDeptId" column="merchant_dept_id"/>
<result property="hardId" column="hard_id"/>
<result property="deptId" column="dept_id"/>
<result property="walletId" column="wallet_id"/>
@@ -45,6 +47,8 @@
a.user_id,
a.user_dept_id,
a.merchant_id,
a.merchant_type,
a.merchant_dept_id,
a.hard_id,
a.dept_id,
a.wallet_id,
@@ -78,6 +82,12 @@
<sql id="whereA">
a.del_flag = '0'
<if test="dto.merchantType != null and dto.merchantType != '' ">
and a.merchant_type = #{dto.merchantType}
</if>
<if test="dto.orderType != null and dto.orderType != '' ">
and a.order_type = #{dto.orderType}
</if>
<if test="dto.hourType != null and dto.hourType != '' ">
and a.hour_type = #{dto.hourType}
</if>
@@ -160,7 +170,8 @@
<select id="scopePageList" resultType="com.bsd.pjcloud.hard.api.vo.order.HardOrderVo">
<include refid="selectA"/>
m.name as hardName,
m.type as hardType
m.type as hardType,
m.dept_id as hardTypeDeptId
from hard_order a
left join hard_manager m on m.id = a.hard_id
<where>
@@ -174,6 +185,12 @@
#{v}
</foreach>
</if>
<if test="dto.mchTypeCodes != null and dto.mchTypeCodes.size() != 0">
and a.merchant_type in
<foreach collection="dto.mchTypeCodes" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
</where>
order by a.create_time desc, a.user_id desc
</select>
@@ -137,32 +137,36 @@ public class ThirdZySelfServiceImpl implements ThirdZySelfService {
refundDto.setSerialNum(dto.getSerialNum());
HardCallbackRefundVo refundRes = hardCallback.refund(refundDto).getData();
result.setCode(refundRes.getCode().getType());
result.setMsg(refundRes.getCode().getDescription());
ZySelfPayVo zySelfPayVo = new ZySelfPayVo();
// 人员编号
ThirdZyIdDictEntity userIdDict = thirdZyIdDictMapper.getBySelfId(ThirdZyBizEnumType.SYNC_ACCOUNT_INFO, String.valueOf(refundRes.getUserId()));
String userZyId = userIdDict.getZyId();
zySelfPayVo.setAccNum(userZyId);
zySelfPayVo.setAccName(refundRes.getUsername());
zySelfPayVo.setPerCode(userZyId);
zySelfPayVo.setSerialNum(refundRes.getOrderNo());
switch (refundRes.getCode()) {
case SUCCESS -> {
ThirdZyIdDictEntity userIdDict = thirdZyIdDictMapper.getBySelfId(ThirdZyBizEnumType.SYNC_ACCOUNT_INFO, String.valueOf(refundRes.getUserId()));
String userZyId = userIdDict.getZyId();
ZySelfPayVo success = new ZySelfPayVo();
success.setAccNum(userZyId);
success.setAccName(refundRes.getUsername());
success.setPerCode(userZyId);
success.setPlatformSerialNum(String.valueOf(refundRes.getRefundId()));
success.setSerialNum(refundRes.getOrderNo());
success.setRecDate(LocalDateTimeUtil.format(refundRes.getRefundTime(), DatePattern.NORM_DATETIME_PATTERN));
success.setAmount(dto.getAmount());
result.setMsg(ZyBaseVo.selfSuccessMsg);
Map<String, Object> resMap = BeanUtil.beanToMap(result);
Map<String, Object> dataMap = BeanUtil.beanToMap(success);
dataMap.put("sign", zyApiTool.generateSign(dataMap, false));
resMap.put("data", Base64.encode(JSONUtil.toJsonStr(dataMap)));
entity.setOrgRes(JSONUtil.toJsonStr(success));
entity.setEncipherRes(JSONUtil.toJsonStr(resMap));
long elapsedTime = System.currentTimeMillis() - startTime;
entity.setTimeConsuming(Long.toString(elapsedTime));
thirdZyLogService.save(entity);
return resMap;
zySelfPayVo.setPlatformSerialNum(String.valueOf(refundRes.getRefundId()));
zySelfPayVo.setAmount(dto.getAmount());
zySelfPayVo.setRecDate(LocalDateTimeUtil.format(refundRes.getRefundTime(), DatePattern.NORM_DATETIME_PATTERN));
}
default -> {
zySelfPayVo.setPlatformSerialNum("temporary_" + dto.getSerialNum());
zySelfPayVo.setRecDate(LocalDateTimeUtil.format(LocalDateTime.now(), DatePattern.NORM_DATETIME_PATTERN));
}
default -> throw new RuntimeException();
}
Map<String, Object> resMap = BeanUtil.beanToMap(result);
Map<String, Object> dataMap = BeanUtil.beanToMap(zySelfPayVo);
dataMap.put("sign", zyApiTool.generateSign(dataMap, false));
resMap.put("data", Base64.encode(JSONUtil.toJsonStr(dataMap)));
entity.setOrgRes(JSONUtil.toJsonStr(zySelfPayVo));
entity.setEncipherRes(JSONUtil.toJsonStr(resMap));
long elapsedTime = System.currentTimeMillis() - startTime;
entity.setTimeConsuming(Long.toString(elapsedTime));
thirdZyLogService.save(entity);
return resMap;
} catch (Exception e) {
String error = String.format("|%s||correct|意外的错误error|%s|stack|%s|", TAG, e.getMessage(), Arrays.toString(e.getStackTrace()));
log.error(error);
@@ -229,30 +233,33 @@ public class ThirdZySelfServiceImpl implements ThirdZySelfService {
payDto.setOrderNo(dto.getSerialNum());
HardCallbackPayVo payRes = hardCallback.pay(payDto).getData();
result.setCode(payRes.getCode().getType());
result.setMsg(payRes.getCode().getDescription());
ZySelfPayVo zySelfPayVo = new ZySelfPayVo();
zySelfPayVo.setSerialNum(dto.getSerialNum());
switch (payRes.getCode()) {
case SUCCESS -> {
ZySelfPayVo success = new ZySelfPayVo();
success.setAccNum(payRes.getUserId().toString());
success.setAccName(payRes.getUsername());
success.setPerCode(payRes.getUserId().toString());
success.setPlatformSerialNum(payRes.getOrderId().toString());
success.setSerialNum(dto.getSerialNum());
success.setAmount(amount);
success.setRecDate(LocalDateTimeUtil.format(payRes.getPayTime(), DatePattern.NORM_DATETIME_PATTERN));
result.setMsg(ZyBaseVo.selfSuccessMsg);
Map<String, Object> resMap = BeanUtil.beanToMap(result);
Map<String, Object> dataMap = BeanUtil.beanToMap(success);
dataMap.put("sign", zyApiTool.generateSign(dataMap, false));
resMap.put("data", Base64.encode(JSONUtil.toJsonStr(dataMap)));
entity.setOrgRes(JSONUtil.toJsonStr(success));
entity.setEncipherRes(JSONUtil.toJsonStr(resMap));
long elapsedTime = System.currentTimeMillis() - startTime;
entity.setTimeConsuming(Long.toString(elapsedTime));
thirdZyLogService.save(entity);
return resMap;
zySelfPayVo.setAccNum(payRes.getUserId().toString());
zySelfPayVo.setAccName(payRes.getUsername());
zySelfPayVo.setPerCode(payRes.getUserId().toString());
zySelfPayVo.setPlatformSerialNum(payRes.getOrderId().toString());
zySelfPayVo.setAmount(amount);
zySelfPayVo.setRecDate(LocalDateTimeUtil.format(payRes.getPayTime(), DatePattern.NORM_DATETIME_PATTERN));
}
default -> {
zySelfPayVo.setPlatformSerialNum("temporary_" + dto.getSerialNum());
zySelfPayVo.setRecDate(LocalDateTimeUtil.format(LocalDateTime.now(), DatePattern.NORM_DATETIME_PATTERN));
}
default -> throw new RuntimeException();
}
Map<String, Object> resMap = BeanUtil.beanToMap(result);
Map<String, Object> dataMap = BeanUtil.beanToMap(zySelfPayVo);
dataMap.put("sign", zyApiTool.generateSign(dataMap, false));
resMap.put("data", Base64.encode(JSONUtil.toJsonStr(dataMap)));
entity.setOrgRes(JSONUtil.toJsonStr(zySelfPayVo));
entity.setEncipherRes(JSONUtil.toJsonStr(resMap));
long elapsedTime = System.currentTimeMillis() - startTime;
entity.setTimeConsuming(Long.toString(elapsedTime));
thirdZyLogService.save(entity);
return resMap;
} catch (Exception e) {
String error = String.format("|%s||pay|意外的错误error|%s|stack|%s|", TAG, e.getMessage(), Arrays.toString(e.getStackTrace()));
log.error(error);
@@ -196,8 +196,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
CompletableFuture.runAsync(() -> {
remoteWalletService.createWallet(sysUser.getUserId());
});
// remoteWalletService.userChange(sysUser.getUserId(), Boolean.FALSE);
remoteWalletService.userChange(sysUser.getUserId(), Boolean.FALSE);
}
return sysUser.getUserId();
@@ -367,7 +366,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
remoteWalletService.createWallet(userDto.getUserId());
});
remoteWalletService.userChange(userDto.getUserId(), Boolean.FALSE);
return Boolean.TRUE;
}
@@ -845,7 +843,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Override
public List<SysUser> listScopeByLikeNameOrByMobileScope(LambdaQueryWrapper<SysUser> eq) {
return baseMapper.selectListByScope(eq, DataScope.of());
return baseMapper.selectListByScope(eq, DataScope.of());
}
private SysUserServiceImpl getSelf() {
@@ -6,6 +6,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
/**
@@ -22,69 +23,75 @@ import java.time.LocalDateTime;
public class WalletRuleMchConfigEntity extends Model<WalletRuleMchConfigEntity> {
/**
* 主键
*/
@Schema(description="主键")
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private Long id;
/**
* 源商户id
*/
@Schema(description="源商户id")
/**
* 源商户id
*/
@Schema(description = "源商户id")
private Long sourceMchId;
/**
* 目标商户id
*/
@Schema(description="目标商户id")
private Long tragetMchId;
/**
* 目标商户id
*/
@Schema(description = "目标商户id")
private Long targetMchId;
/**
* 规则配置id
*/
@Schema(description="规则配置id")
/**
* 目标部门id
*/
private Long tragetDeptId;
/**
* 规则配置id
*/
@Schema(description = "规则配置id")
private Long rulePriceConfigId;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="修改人")
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description = "修改人")
private String updateBy;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="修改时间")
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description = "修改时间")
private LocalDateTime updateTime;
/**
* 删除标记
*/
/**
* 删除标记
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="删除标记")
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除标记")
private String delFlag;
/**
* 租户ID
*/
@Schema(description="租户ID")
/**
* 租户ID
*/
@Schema(description = "租户ID")
private Long tenantId;
}
@@ -21,6 +21,7 @@ public class WalletRulePriceConfigEntity extends Model<WalletRulePriceConfigEnti
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private Long id;
@@ -37,9 +38,9 @@ public class WalletRulePriceConfigEntity extends Model<WalletRulePriceConfigEnti
private Long basePrice;
/**
* 金额的倍数必须大于1
* 额外需要支付的倍数
*/
@Schema(description = "金额的倍数必须大于1")
@Schema(description = "额外支付的倍数")
private Long multiple;
/**
@@ -5,4 +5,25 @@ import lombok.Data;
@Data
public class WalletRuleMchConfigVo extends WalletRuleMchConfigEntity {
/**
* 钱包规则id
*/
private Long rulePirceConfigId;
/**
* 钱包规则类型
*/
private String rulePriceType;
/**
* 基础价格
*/
private Long basePrice;
/**
* 额外需要支付的倍数
*/
private Long multiple;
}
@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleMchConfigDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleMchConfigEntity;
import com.bsd.pjcloud.wallet.service.WalletRuleMchConfigService;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -39,6 +41,13 @@ public class WalletRuleMchConfigController {
return R.ok(walletRuleMchConfigService.page(page, wrapper));
}
@Operation(summary = "分页复杂查询", description = "分页复杂查询")
@GetMapping("/page-join")
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_view')")
public R pageJoin(@ParameterObject Page page, @ParameterObject WalletRuleMchConfigDto dto) {
return R.ok(walletRuleMchConfigService.pageScopeList(page, dto, DataScope.of()));
}
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_view')")
@@ -1,11 +1,17 @@
package com.bsd.pjcloud.wallet.mapper.rule;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleMchConfigDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleMchConfigEntity;
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleMchConfigVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface WalletRuleMchConfigMapper extends PjcloudBaseMapper<WalletRuleMchConfigEntity> {
Page<WalletRuleMchConfigVo> pageScopeList(Page page, @Param("dto") WalletRuleMchConfigDto dto, DataScope dataScope);
}
@@ -1,8 +1,17 @@
package com.bsd.pjcloud.wallet.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleMchConfigDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleMchConfigEntity;
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleMchConfigVo;
public interface WalletRuleMchConfigService extends IService<WalletRuleMchConfigEntity> {
/**
* 权限分页查询
*/
Page<WalletRuleMchConfigVo> pageScopeList(Page page, WalletRuleMchConfigDto dto, DataScope dataScope);
}
@@ -1,7 +1,11 @@
package com.bsd.pjcloud.wallet.service.impl.rule;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleMchConfigDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleMchConfigEntity;
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleMchConfigVo;
import com.bsd.pjcloud.wallet.mapper.rule.WalletRuleMchConfigMapper;
import com.bsd.pjcloud.wallet.service.WalletRuleMchConfigService;
import org.springframework.stereotype.Service;
@@ -14,4 +18,12 @@ import org.springframework.stereotype.Service;
*/
@Service
public class WalletRuleMchConfigServiceImpl extends ServiceImpl<WalletRuleMchConfigMapper, WalletRuleMchConfigEntity> implements WalletRuleMchConfigService {
/**
* 权限分页查询
*/
@Override
public Page<WalletRuleMchConfigVo> pageScopeList(Page page, WalletRuleMchConfigDto dto, DataScope dataScope) {
return baseMapper.pageScopeList(page, dto, dataScope);
}
}
@@ -0,0 +1,58 @@
<?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.bsd.pjcloud.wallet.mapper.rule.WalletRuleMchConfigMapper">
<resultMap id="walletRuleMchConfigMap" type="com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleMchConfigEntity">
<result property="id" column="id"/>
<result property="sourceMchId" column="source_mch_id"/>
<result property="targetMchId" column="target_mch_id"/>
<result property="tragetDeptId" column="traget_dept_id"/>
<result property="rulePriceConfigId" column="rule_price_config_id"/>
<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="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
<sql id="selectA">
select a.id,
a.source_mch_id,
a.target_mch_id,
a.rule_price_config_id,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.del_flag,
a.tenant_id,
</sql>
<sql id="whereA">
a.del_flag = 0
<if test="dto.sourceMchId != null">
and a.source_mch_id = #{dto.sourceMchId}
</if>
<if test="dto.targetMchId != null">
and a.target_mch_id = #{dto.targetMchId}
</if>
<if test="dto.rulePriceConfigId != null">
and a.rule_price_config_id = #{dto.rulePriceConfigId}
</if>
</sql>
<select id="pageScopeList" resultType="com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleMchConfigVo">
<include refid="selectA"/>
p.id as rulePirceConfigId,
p.rule_price_type,
p.base_price,
p.multiple
from wallet_rule_mch_config a
left join wallet_rule_price_config p on a.rule_price_config_id = p.id
<where>
<include refid="whereA"/>
</where>
order by a.create_time desc , a.id desc
</select>
</mapper>
@@ -0,0 +1,18 @@
<?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.bsd.pjcloud.wallet.mapper.rule.WalletRulePriceConfigMapper">
<resultMap id="walletRulePriceConfigMap" type="com.bsd.pjcloud.wallet.api.entity.rule.WalletRulePriceConfigEntity">
<result property="id" column="id"/>
<result property="rulePriceType" column="rule_price_type"/>
<result property="basePrice" column="base_price"/>
<result property="multiple" column="multiple"/>
<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="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
</mapper>