Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
bb75b0dfa3
12 files changed
+153
-5
No files matched your search
+5
@@ -44,4 +44,9 @@ public class HardAdUserVo {
|
||||
* 是否冻结饭卡
|
||||
*/
|
||||
private String walletIsFreeze;
|
||||
|
||||
/**
|
||||
* 查询用户食堂信息
|
||||
*/
|
||||
private Long canteenId;
|
||||
}
|
||||
+4
@@ -3,6 +3,7 @@ package com.bsd.pjcloud.hard.service;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
@@ -14,6 +15,7 @@ import com.bsd.pjcloud.hard.api.dto.order.app.HardAppCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOrderVo;
|
||||
import com.bsd.pjcloud.thirdparty.dto.ks.KsRecognitionCallbackDto;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
@@ -70,6 +72,8 @@ public interface HardOrderService extends IService<HardOrderEntity> {
|
||||
*/
|
||||
Integer computeExtraPrice(Integer price);
|
||||
|
||||
Integer computeExtraPrice(Integer price, MchManageVo mch, SysUser sysUser);
|
||||
|
||||
/**
|
||||
* 核销二维码
|
||||
*/
|
||||
|
||||
+14
@@ -4,12 +4,15 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.vo.android.HardAdUserVo;
|
||||
import com.bsd.pjcloud.hard.service.HardApiService;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteWalletService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -23,6 +26,7 @@ public class HardApiServiceImpl implements HardApiService {
|
||||
|
||||
private final RemoteUserService userService;
|
||||
private final RemoteWalletService remoteWalletService;
|
||||
private final RemoteMchService remoteMchService;
|
||||
|
||||
@Override
|
||||
public HardAdUserVo getUserById(Long userId, HardTypeEnum type) {
|
||||
@@ -48,6 +52,11 @@ public class HardApiServiceImpl implements HardApiService {
|
||||
result.setWalletTypeId(wallet.getWalletTypeId());
|
||||
result.setWalletBalance(wallet.getBalance());
|
||||
result.setWalletIsFreeze(wallet.getIsFreeze());
|
||||
// 查询用户食堂信息
|
||||
MchManageVo mchDetail = remoteMchService.getFirstMchByDeptId(user.getSysUser().getDeptId(), MerchantTypeEnum.CANTEEN).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchDetail)) {
|
||||
result.setCanteenId(mchDetail.getId());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -72,6 +81,11 @@ public class HardApiServiceImpl implements HardApiService {
|
||||
result.setWalletTypeId(wallet.getWalletTypeId());
|
||||
result.setWalletBalance(wallet.getBalance());
|
||||
result.setWalletIsFreeze(wallet.getIsFreeze());
|
||||
// 查询用户食堂信息
|
||||
MchManageVo mchDetail = remoteMchService.getFirstMchByDeptId(user.getSysUser().getDeptId(), MerchantTypeEnum.CANTEEN).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchDetail)) {
|
||||
result.setCanteenId(mchDetail.getId());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+45
-1
@@ -54,6 +54,7 @@ import com.bsd.pjcloud.thirdparty.dto.ks.KsRecognitionCallbackDto;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletCodeBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.constant.mch.WalletMchRulePriceTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletBalanceTransactionDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletCodeUseEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
@@ -62,6 +63,7 @@ import com.bsd.pjcloud.wallet.api.feign.*;
|
||||
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletSettingVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -111,6 +113,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
private final RemoteWalletSettingService walletSettingService;
|
||||
private final RemoteUserService userService;
|
||||
private final RemoteDeptService deptService;
|
||||
private final RemoteMchRuleJoinService mchRuleJoinService;
|
||||
|
||||
private final RemoteOnlineCanteenSpuService onlineCanteenSpuService;
|
||||
private final RemoteSupermarketSpuService supermarketSpuService;
|
||||
@@ -216,7 +219,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
}
|
||||
int totalPrice = 0, extraPrice = 0, payPrice = 0;
|
||||
totalPrice = hardCarService.computerCarTotalPrice(dto.getSysType(), dto.getOrderType(), dto.getList());
|
||||
if (isExtraPrice) extraPrice = computeExtraPrice(totalPrice);
|
||||
if (isExtraPrice) extraPrice = computeExtraPrice(totalPrice, mch, userDetail.getSysUser());
|
||||
payPrice = totalPrice + extraPrice;
|
||||
if (isPay) {
|
||||
// 如果是支付的话,不能小于等于0
|
||||
@@ -557,6 +560,47 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
return extraPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算额外金额
|
||||
*/
|
||||
@Override
|
||||
public Integer computeExtraPrice(Integer price, MchManageVo mch, SysUser sysUser) {
|
||||
int extraPrice = 0;
|
||||
if (!ObjectUtil.isAllNotEmpty(price, mch, sysUser)) return 0;
|
||||
try {
|
||||
// 查询规则
|
||||
List<MchRuleJoinDtoVo> list = mchRuleJoinService.innerMchRoleList(mch.getId()).getData();
|
||||
if (ObjectUtil.isEmpty(list)) return extraPrice;
|
||||
// 查询用户食堂
|
||||
MchManageVo userMch = remoteMchService.getFirstMchByDeptId(sysUser.getDeptId(), MerchantTypeEnum.CANTEEN).getData();
|
||||
for (MchRuleJoinDtoVo v : list) {
|
||||
Long basePrice = v.getBasePrice();
|
||||
Long multiple = v.getMultiple();
|
||||
String rulePriceType = v.getRulePriceType();
|
||||
if (!ObjectUtil.isAllNotEmpty(price, mch, sysUser)) continue;
|
||||
if (price < basePrice) continue;
|
||||
Long surplus = price - basePrice;
|
||||
BigDecimal extraPriceBD = BigDecimal.valueOf(surplus).multiply(BigDecimal.valueOf(multiple)).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
|
||||
// 10 跨单位额外支付
|
||||
if (ObjectUtil.equals(rulePriceType, WalletMchRulePriceTypeEnum.STRIDE_LIMIT.getCode())) {
|
||||
if (ObjectUtil.isEmpty(userMch) || ObjectUtil.notEqual(userMch.getId(), v.getSourceMchId())) {
|
||||
continue;
|
||||
}
|
||||
extraPrice += extraPriceBD.setScale(0, RoundingMode.HALF_UP).intValueExact();
|
||||
continue;
|
||||
}
|
||||
// 20 每餐额外支付
|
||||
if (ObjectUtil.equals(rulePriceType, WalletMchRulePriceTypeEnum.EVERY_LIMIT.getCode())) {
|
||||
extraPrice += extraPriceBD.setScale(0, RoundingMode.HALF_UP).intValueExact();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("|{}|计算额外金额错误", TAG, e);
|
||||
}
|
||||
return extraPrice;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean handCancelCode(HandCancelCodeDto dto) {
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.bsd.pjcloud.wallet.api.feign;
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.feign.annotation.NoToken;
|
||||
import com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@FeignClient(contextId = "remoteMchRuleJoinService", value = ServiceNameConstants.WALLET_SERVICE)
|
||||
public interface RemoteMchRuleJoinService {
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/mch-rule-join/inner/list")
|
||||
R<List<MchRuleJoinDtoVo>> innerMchRoleList(@RequestParam Long targetMchId);
|
||||
|
||||
}
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
com.bsd.pjcloud.wallet.api.feign.RemoteWalletService
|
||||
com.bsd.pjcloud.wallet.api.feign.RemoteMchRuleJoinService
|
||||
com.bsd.pjcloud.wallet.api.feign.RemoteCodeUseService
|
||||
com.bsd.pjcloud.wallet.api.feign.RemoteWalletRechargeService
|
||||
com.bsd.pjcloud.wallet.api.feign.RemoteMchService
|
||||
|
||||
+31
@@ -5,11 +5,14 @@ import cn.hutool.core.collection.CollUtil;
|
||||
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.YesNoEnum;
|
||||
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.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.wallet.api.dto.mch.MchRuleJoinDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.mch.MchRuleJoinDtoEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo;
|
||||
import com.bsd.pjcloud.wallet.service.MchRuleJoinService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
@@ -33,6 +36,34 @@ public class MchRuleJoinController {
|
||||
|
||||
private final MchRuleJoinService mchRuleJoinService;
|
||||
|
||||
/* ************************************* start 远程调用 start ************************************* */
|
||||
|
||||
@Inner
|
||||
@Operation(summary = "获取钱包规则(android离线计算展示使用)", description = "获取钱包规则(android离线计算展示使用)")
|
||||
@GetMapping("/inner/list")
|
||||
public R<List<MchRuleJoinDtoVo>> innerMchRoleList(@RequestParam Long targetMchId) {
|
||||
DataScope dataScope = null;
|
||||
MchRuleJoinDtoEntity dto = new MchRuleJoinDtoEntity();
|
||||
dto.setTargetMchId(targetMchId);
|
||||
dto.setStatus(YesNoEnum.YES.getCode());
|
||||
return R.ok(mchRuleJoinService.scopeList(dto, dataScope));
|
||||
}
|
||||
|
||||
/* ************************************* end 远程调用 end ************************************* */
|
||||
|
||||
|
||||
/* ************************************* start andorid start ************************************* */
|
||||
|
||||
@Operation(summary = "获取钱包规则(android离线计算展示使用)", description = "获取钱包规则(android离线计算展示使用)")
|
||||
@GetMapping("/ad/list")
|
||||
public R<List<MchRuleJoinDtoVo>> adMchRoleList(@ParameterObject MchRuleJoinDtoEntity dto) {
|
||||
DataScope dataScope = null;
|
||||
dto.setStatus(YesNoEnum.YES.getCode());
|
||||
return R.ok(mchRuleJoinService.scopeList(dto, dataScope));
|
||||
}
|
||||
|
||||
/* ************************************* end andorid end ************************************* */
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_view')")
|
||||
|
||||
+4
@@ -9,10 +9,14 @@ import com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface WalletRuleMchConfigMapper extends PjcloudBaseMapper<MchRuleJoinDtoEntity> {
|
||||
|
||||
Page<MchRuleJoinDtoVo> pageScopeList(Page page, @Param("dto") MchRuleJoinDto dto, DataScope dataScope);
|
||||
|
||||
List<MchRuleJoinDtoVo> scopeList(@Param("dto") MchRuleJoinDtoEntity dto, DataScope dataScope);
|
||||
|
||||
MchRuleJoinDtoVo joinDetail(@Param("id") Long id);
|
||||
}
|
||||
+3
@@ -8,6 +8,7 @@ import com.bsd.pjcloud.wallet.api.entity.mch.MchRuleJoinDtoEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public interface MchRuleJoinService extends IService<MchRuleJoinDtoEntity> {
|
||||
|
||||
@@ -16,6 +17,8 @@ public interface MchRuleJoinService extends IService<MchRuleJoinDtoEntity> {
|
||||
*/
|
||||
Page<MchRuleJoinDtoVo> pageScopeList(Page page, MchRuleJoinDto dto, DataScope dataScope);
|
||||
|
||||
List<MchRuleJoinDtoVo> scopeList(MchRuleJoinDtoEntity dto, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
|
||||
+12
-2
@@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Validated
|
||||
@@ -58,8 +59,12 @@ public class MchRuleJoinControllerServiceImpl extends ServiceImpl<WalletRuleMchC
|
||||
if (existMchRuleJoin(dto)) {
|
||||
throw new RuntimeException("绑定的规则类型不能重复");
|
||||
}
|
||||
if (areMchIdsDistinct(dto)) {
|
||||
throw new RuntimeException("源商户与目标商户不能重复");
|
||||
// 查询配置规则
|
||||
MchRulePriceConfigEntity rulePriceConfig = rulePriceConfigService.getById(dto.getRulePriceConfigId());
|
||||
if (ObjectUtil.notEqual(rulePriceConfig.getRulePriceType(), WalletMchRulePriceTypeEnum.EVERY_LIMIT.getCode())) {
|
||||
if (areMchIdsDistinct(dto)) {
|
||||
throw new RuntimeException("源商户与目标商户不能重复");
|
||||
}
|
||||
}
|
||||
MchManageEntity targetMch = mchManageService.getById(dto.getTargetMchId());
|
||||
if (ObjectUtil.isEmpty(targetMch)) {
|
||||
@@ -89,6 +94,11 @@ public class MchRuleJoinControllerServiceImpl extends ServiceImpl<WalletRuleMchC
|
||||
return baseMapper.pageScopeList(page, dto, dataScope);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MchRuleJoinDtoVo> scopeList(MchRuleJoinDtoEntity dto, DataScope dataScope) {
|
||||
return baseMapper.scopeList(dto, dataScope);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否重复
|
||||
*/
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.notIds != null and dto.notIds.size() != 0">
|
||||
and a.id in
|
||||
and a.id not in
|
||||
<foreach collection="dto.notIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
|
||||
+12
-1
@@ -42,9 +42,12 @@
|
||||
<if test="dto.rulePriceConfigId != null">
|
||||
and a.rule_price_config_id = #{dto.rulePriceConfigId}
|
||||
</if>
|
||||
<if test="dto.status != null">
|
||||
and a.status = #{dto.status}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="pageScopeList" resultType="com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo">
|
||||
<sql id="pageList">
|
||||
<include refid="selectA"/>
|
||||
p.id as rulePirceConfigId,
|
||||
p.rule_price_type,
|
||||
@@ -60,6 +63,14 @@
|
||||
<include refid="whereA"/>
|
||||
</where>
|
||||
order by a.create_time desc , a.id desc
|
||||
</sql>
|
||||
|
||||
<select id="pageScopeList" resultType="com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo">
|
||||
<include refid="pageList" />
|
||||
</select>
|
||||
|
||||
<select id="scopeList" resultType="com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo">
|
||||
<include refid="pageList"/>
|
||||
</select>
|
||||
|
||||
<select id="joinDetail" resultType="com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo">
|
||||
|
||||
Reference in new issue
Block a user