Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a8ba621d7e
45 files changed
+530
-180
No files matched your search
@@ -9,6 +9,7 @@ CREATE TABLE mch_manage
|
||||
(
|
||||
id bigint NOT NULL COMMENT '主键',
|
||||
dept_id bigint NOT NULL COMMENT '绑定的部门id',
|
||||
hard_group_id bigint COMMENT '设备分组id',
|
||||
name varchar(64) NOT NULL COMMENT '商户名',
|
||||
types varchar(64) NOT NULL COMMENT '店铺类型,逗号分隔',
|
||||
logo_pic varchar(256) NOT NULL COMMENT '商户logo图片',
|
||||
@@ -45,7 +46,7 @@ CREATE TABLE wallet_manage
|
||||
total_expense int DEFAULT 0 NOT NULL COMMENT '累计支出,单位分',
|
||||
total_recharge int DEFAULT 0 NOT NULL COMMENT '累计充值,单位分',
|
||||
freeze_price int DEFAULT 0 NOT NULL COMMENT '冻结金额,单位分',
|
||||
is_freeze tinyint DEFAULT '0' NOT NULL COMMENT '是否冻结饭卡',
|
||||
is_freeze char(1) DEFAULT '0' NOT NULL COMMENT '是否冻结饭卡',
|
||||
active_bind_time timestamp COMMENT '绑定饭卡时间',
|
||||
active_bind_status char(10) COMMENT '饭卡绑定状态',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
|
||||
+1
-1
@@ -40,5 +40,5 @@ public class QRCodeExtraDto {
|
||||
/**
|
||||
* 是否冻结饭卡
|
||||
*/
|
||||
private Boolean isFreeze = false;
|
||||
private String isFreeze = "1";
|
||||
}
|
||||
+3
@@ -70,6 +70,9 @@ public class HardCreateOrderDto {
|
||||
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "钱包id")
|
||||
private Long walletId;
|
||||
|
||||
@Schema(description = "离线支付是否成功")
|
||||
private Boolean offlinePaySuccess;
|
||||
}
|
||||
+1
-1
@@ -43,5 +43,5 @@ public class HardAdUserVo {
|
||||
/**
|
||||
* 是否冻结饭卡
|
||||
*/
|
||||
private Boolean walletIsFreeze;
|
||||
private String walletIsFreeze;
|
||||
}
|
||||
+12
-2
@@ -72,8 +72,11 @@ public class HardApiController {
|
||||
|
||||
@PostMapping("/cancel-code")
|
||||
@Operation(summary = "核销二维码")
|
||||
@Idempotent(expireTime = 10, info = "正在支付中,请勿重复操作")
|
||||
public R<Boolean> handCancelCode(@Valid @RequestBody HandCancelCodeDto dto) {
|
||||
@Idempotent(expireTime = 10, info = "正在核销中,请勿重复操作")
|
||||
public R<Boolean> handCancelCode(@RequestBody HandCancelCodeDto dto) {
|
||||
if (!ObjectUtil.isAllNotEmpty(dto.getOrderId(), dto.getHardwareId())) {
|
||||
throw new RuntimeException("参数不正确");
|
||||
}
|
||||
return R.ok(hardwareOrderService.handCancelCode(dto));
|
||||
}
|
||||
|
||||
@@ -106,4 +109,11 @@ public class HardApiController {
|
||||
return R.ok(hardApiService.getUserById(id, type));
|
||||
}
|
||||
|
||||
@GetMapping("/get-user-by-card")
|
||||
@Operation(summary = "获取用户和钱包")
|
||||
public R<HardAdUserVo> getUserByCard(@RequestParam String card) {
|
||||
return R.ok(hardApiService.getUserByCard(card));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+1
@@ -10,4 +10,5 @@ public interface HardApiService {
|
||||
|
||||
HardAdUserVo getUserById(Long userId, HardTypeEnum type);
|
||||
|
||||
HardAdUserVo getUserByCard(String card);
|
||||
}
|
||||
+1
-1
@@ -67,5 +67,5 @@ public interface HardOrderService extends IService<HardOrderEntity> {
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Boolean handCancelCode(@Valid HandCancelCodeDto dto);
|
||||
Boolean handCancelCode(HandCancelCodeDto dto);
|
||||
}
|
||||
+24
@@ -47,4 +47,28 @@ public class HardApiServiceImpl implements HardApiService {
|
||||
result.setWalletIsFreeze(wallet.getIsFreeze());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HardAdUserVo getUserByCard(String card) {
|
||||
HardAdUserVo result = new HardAdUserVo();
|
||||
// 查询钱包
|
||||
WalletManageEntity wallet = remoteWalletService.getWalletByCardNumber(card).getData();
|
||||
if (ObjectUtil.isEmpty(wallet)) return null;
|
||||
// 查询用户
|
||||
UserInfo user = userService.getByUserId(wallet.getUserId()).getData();
|
||||
if (ObjectUtil.isEmpty(user)) return null;
|
||||
SysUser sysUser = user.getSysUser();
|
||||
result.setUserId(sysUser.getUserId());
|
||||
result.setUsername(sysUser.getUsername());
|
||||
result.setUserAvatar(sysUser.getAvatar());
|
||||
result.setUserMobile(sysUser.getPhone());
|
||||
result.setDeptId(sysUser.getDeptId());
|
||||
result.setWalletCardNumber(wallet.getCardNumber());
|
||||
result.setWalletId(wallet.getId());
|
||||
result.setWalletTypeId(wallet.getWalletTypeId());
|
||||
result.setWalletBalance(wallet.getBalance());
|
||||
result.setWalletIsFreeze(wallet.getIsFreeze());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+18
-13
@@ -20,7 +20,6 @@ import com.bsd.pjcloud.hard.api.utils.HardUtil;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardManagerVo;
|
||||
import com.bsd.pjcloud.hard.mapper.HardGroupMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.HardManagerMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardGroupService;
|
||||
import com.bsd.pjcloud.hard.service.HardManagerService;
|
||||
import com.bsd.pjcloud.hard.mqtt.config.MqttConfig;
|
||||
import com.bsd.pjcloud.hard.utils.MqTopicUtil;
|
||||
@@ -117,9 +116,12 @@ public class HardManagerServiceImpl extends ServiceImpl<HardManagerMapper, HardM
|
||||
|
||||
@Override
|
||||
public Long create(HardManagerDto dto, PjcloudUser user) {
|
||||
R<MchManageVo> mch = mchService.getById(dto.getMerchantId());
|
||||
Long mchDeptId = Optional.of(mch).map(R::getData).map(MchManageVo::getDeptId).orElseThrow(() -> new RuntimeException("商户不存在"));
|
||||
MchManageVo mch = mchService.getById(dto.getMerchantId()).getData();
|
||||
if (ObjectUtil.isEmpty(mch)) {
|
||||
throw new RuntimeException("商户不存在");
|
||||
}
|
||||
dto.setDeptId(user.getDeptId());
|
||||
dto.setHardGroupId(mch.getHardGroupId());
|
||||
// mq地址和端口
|
||||
dto.setMqSocketAddress(mqttConfig.getAndroidAddress());
|
||||
dto.setMqSocketPort(mqttConfig.getAndroidPort());
|
||||
@@ -127,13 +129,13 @@ public class HardManagerServiceImpl extends ServiceImpl<HardManagerMapper, HardM
|
||||
baseMapper.insert(dto);
|
||||
// topic
|
||||
HardManagerEntity updateObj = HardManagerEntity.builder().id(dto.getId()).build();
|
||||
String topic = createMqConfigByAction(mchDeptId, null, 1) + "/#";
|
||||
String topic = createMqConfigByAction(mch.getHardGroupId(), null, null, 1) + "/#";
|
||||
updateObj.setMainTopic(topic);
|
||||
// client id
|
||||
String clientId = createMqConfigByAction(mchDeptId, dto.getId(), 2);
|
||||
String clientId = createMqConfigByAction(null, null, dto.getId(), 2);
|
||||
updateObj.setMqClientId(clientId);
|
||||
// username TODO 密码9位随机数字加字母
|
||||
String mqUsername = createMqConfigByAction(mchDeptId, dto.getId(), 3);
|
||||
String mqUsername = createMqConfigByAction(null, null, dto.getId(), 3);
|
||||
updateObj.setMqUsername(mqUsername);
|
||||
updateObj.setMqPassword(RandomUtil.randomString(9));
|
||||
baseMapper.updateById(updateObj);
|
||||
@@ -146,17 +148,20 @@ public class HardManagerServiceImpl extends ServiceImpl<HardManagerMapper, HardM
|
||||
if (ObjectUtil.isEmpty(detail)) {
|
||||
throw new RuntimeException("设备不存在");
|
||||
}
|
||||
R<MchManageVo> mch = mchService.getById(dto.getMerchantId());
|
||||
Long mchDeptId = Optional.of(mch).map(R::getData).map(MchManageVo::getDeptId).orElseThrow(() -> new RuntimeException("商户不存在"));
|
||||
MchManageVo mch = mchService.getById(dto.getMerchantId()).getData();
|
||||
if (ObjectUtil.isEmpty(mch)) {
|
||||
throw new RuntimeException("商户不存在");
|
||||
}
|
||||
dto.setHardGroupId(mch.getHardGroupId());
|
||||
if (!ObjectUtil.equals(dto.getMerchantId(), detail.getMerchantId())) {
|
||||
// topic
|
||||
String topic = createMqConfigByAction(mchDeptId, null, 1) + "/#";
|
||||
String topic = createMqConfigByAction(mch.getHardGroupId(), null, null, 1) + "/#";
|
||||
dto.setMainTopic(topic);
|
||||
// client id
|
||||
String clientId = createMqConfigByAction(mchDeptId, dto.getId(), 2);
|
||||
String clientId = createMqConfigByAction(null, null, dto.getId(), 2);
|
||||
dto.setMqClientId(clientId);
|
||||
// username TODO 密码9位随机数字加字母
|
||||
String mqUsername = createMqConfigByAction(mchDeptId, dto.getId(), 3);
|
||||
String mqUsername = createMqConfigByAction(null, null, dto.getId(), 3);
|
||||
dto.setMqUsername(mqUsername);
|
||||
}
|
||||
baseMapper.updateById(dto);
|
||||
@@ -186,8 +191,8 @@ public class HardManagerServiceImpl extends ServiceImpl<HardManagerMapper, HardM
|
||||
return vo;
|
||||
}
|
||||
|
||||
private String createMqConfigByAction(Long deptId, Long hardId, Integer action) {
|
||||
MqTopicUtil eventDto = MqTopicUtil.builder().deptId(deptId).hardId(hardId).build();
|
||||
private String createMqConfigByAction(Long groupId, Long deptId, Long hardId, Integer action) {
|
||||
MqTopicUtil eventDto = MqTopicUtil.builder().groupId(groupId).deptId(deptId).hardId(hardId).build();
|
||||
if (ObjectUtil.equals(action, 1)) {
|
||||
return eventDto.getTopic();
|
||||
}
|
||||
|
||||
+32
-14
@@ -51,6 +51,7 @@ import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
|
||||
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.WalletManageVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletSettingVo;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -251,8 +252,18 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
// 饭卡钱包
|
||||
WalletManageEntity wallet = null;
|
||||
if (isPay) {
|
||||
R<WalletManageEntity> walletResult = remoteWalletService.getWallet(dto.getUserId(), WalletTypeEnum.EAT);
|
||||
wallet = Optional.of(walletResult).map(R::getData).orElseThrow(() -> new RuntimeException("用户钱包不存在"));
|
||||
if (ObjectUtil.equals(dto.getOrderPayType(), HardPayTypeEnum.WALLET_QR_CODE)) {
|
||||
if (ObjectUtil.isEmpty(dto.getWalletId())) throw new RuntimeException("钱包二维码支付错误");
|
||||
R<WalletManageVo> walletResult = remoteWalletService.getWalletById(dto.getWalletId());
|
||||
WalletManageVo walletVo = Optional.of(walletResult).map(R::getData).orElseThrow(() -> new RuntimeException("用户钱包不存在"));
|
||||
if (!ObjectUtil.equals(walletVo.getWalletTypeUniqueCode(), WalletTypeEnum.EAT.getCode())) {
|
||||
throw new RuntimeException("请使用钱包二维码支付");
|
||||
}
|
||||
wallet = walletVo;
|
||||
} else {
|
||||
R<WalletManageEntity> walletResult = remoteWalletService.getWallet(dto.getUserId(), WalletTypeEnum.EAT);
|
||||
wallet = Optional.of(walletResult).map(R::getData).orElseThrow(() -> new RuntimeException("用户钱包不存在"));
|
||||
}
|
||||
}
|
||||
int totalPrice = 0, extraPrice = 0, payPrice = 0;
|
||||
totalPrice = hardCarService.computerCarTotalPrice(dto.getSysType(), dto.getOrderType(), dto.getList());
|
||||
@@ -407,7 +418,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
boolean isCancel = validateCodeIsCancel(orderType, order.getId());
|
||||
if (isCancel) throw new RuntimeException("该二维码已被核销");
|
||||
// 核销二维码
|
||||
cancelCode(order);
|
||||
getSelf().cancelCode(order);
|
||||
HardOrderEntity updateObj = HardOrderEntity.builder().id(order.getId()).androidOrderCode(dto.getAndroidOrderCode()).hardId(dto.getHardwareId()).orderStatus(HardOrderStatusEnum.CANCEL.getType()).build();
|
||||
return baseMapper.updateById(updateObj) > 0;
|
||||
}
|
||||
@@ -417,14 +428,20 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelCode(HardOrderEntity order) {
|
||||
HardOrderTypeEnum orderTypeEnum = HardOrderTypeEnum.valueOfByType(order.getOrderType());
|
||||
if (!ObjectUtil.isAllNotEmpty(orderTypeEnum, order.getOrderSourceTypeId())) return;
|
||||
Long id = order.getOrderSourceTypeId();
|
||||
if (!ObjectUtil.isAllNotEmpty(orderTypeEnum)) return;
|
||||
Long id = order.getId();
|
||||
switch (orderTypeEnum) {
|
||||
// 线下购买
|
||||
case BELOW -> {
|
||||
}
|
||||
// 外来人员 | 跨单位 | 线上订餐
|
||||
case FOREIGN_TICKET, STRIDE_DEPT, RESERVE -> remoteCodeUseService.cancelCode(id);
|
||||
case FOREIGN_TICKET, STRIDE_DEPT, RESERVE -> {
|
||||
R<Boolean> result = remoteCodeUseService.cancelCode(id);
|
||||
if (ObjectUtil.isEmpty(result) || result.getCode() != 0 || !result.getData()) {
|
||||
throw new RuntimeException("核销二维码错误");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -502,18 +519,19 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
}
|
||||
}
|
||||
|
||||
// 二维码类型的订单是否被核销
|
||||
private boolean validateCodeIsCancel(HardOrderTypeEnum orderType, Long orderSourceTypeId) {
|
||||
// 二维码类型的订单是否被核销 true被核销 false未核销
|
||||
private boolean validateCodeIsCancel(HardOrderTypeEnum orderType, Long orderId) {
|
||||
Boolean flag = switch (orderType) {
|
||||
case RESERVE -> false;
|
||||
case FOREIGN_TICKET, STRIDE_DEPT -> {
|
||||
R<Boolean> result = remoteCodeUseService.isCancelCode(orderSourceTypeId);
|
||||
if (ObjectUtil.isEmpty(result.getData())) yield false;
|
||||
case FOREIGN_TICKET, STRIDE_DEPT, RESERVE -> {
|
||||
R<Boolean> result = remoteCodeUseService.isCancelCode(orderId);
|
||||
if (ObjectUtil.isEmpty(result.getData()) || result.getCode() != 0) {
|
||||
yield true;
|
||||
}
|
||||
yield result.getData();
|
||||
}
|
||||
default -> false;
|
||||
default -> true;
|
||||
};
|
||||
if (!flag) throw new RuntimeException("该二维码已被核销");
|
||||
if (flag) throw new RuntimeException("该二维码已被核销");
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
+17
-14
@@ -11,6 +11,12 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class MqTopicUtil {
|
||||
|
||||
/**
|
||||
* 分组id
|
||||
*/
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 商户id
|
||||
*/
|
||||
@@ -22,31 +28,28 @@ public class MqTopicUtil {
|
||||
private Long hardId;
|
||||
|
||||
public String getTopic() {
|
||||
if (ObjectUtil.isAllNotEmpty(deptId, hardId)) {
|
||||
return String.format("topic/android/%s/%s", deptId, hardId);
|
||||
if (ObjectUtil.isAllNotEmpty(groupId, deptId, hardId)) {
|
||||
return String.format("topic/android/%s/%s/%s", groupId, deptId, hardId);
|
||||
}
|
||||
if (ObjectUtil.isAllNotEmpty(deptId)) {
|
||||
return String.format("topic/android/%s", deptId);
|
||||
if (ObjectUtil.isAllNotEmpty(groupId, deptId)) {
|
||||
return String.format("topic/android/%s/%s", groupId, deptId);
|
||||
}
|
||||
if (ObjectUtil.isAllNotEmpty(groupId)) {
|
||||
return String.format("topic/android/%s", groupId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
if (ObjectUtil.isAllNotEmpty(deptId, hardId)) {
|
||||
return String.format("client_id/android/%s/%s", deptId, hardId);
|
||||
}
|
||||
if (ObjectUtil.isAllNotEmpty(deptId)) {
|
||||
return String.format("client_id/android/%s", deptId);
|
||||
if (ObjectUtil.isAllNotEmpty(hardId)) {
|
||||
return String.format("client_id/android/%s", hardId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
if (ObjectUtil.isAllNotEmpty(deptId, hardId)) {
|
||||
return String.format("username_android_/android/%s/%s", deptId, hardId);
|
||||
}
|
||||
if (ObjectUtil.isAllNotEmpty(deptId)) {
|
||||
return String.format("username_android_/android/%s", deptId);
|
||||
if (ObjectUtil.isAllNotEmpty(hardId)) {
|
||||
return String.format("username/android/%s", hardId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -58,5 +58,5 @@ public interface RemoteMqttEventService {
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/mqtt/send-face-change-msg")
|
||||
R<Boolean> sendFaceChangeMsg(@RequestParam List<Long> parentDeptList, @RequestParam Long userId, @RequestParam(required = false) Boolean isGlobalFace);
|
||||
R<Boolean> sendFaceChangeMsg(@RequestParam Long userDeptId, @RequestParam Long userId, @RequestParam(required = false) Boolean isGlobalFace);
|
||||
}
|
||||
+9
-7
@@ -6,6 +6,9 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MqttBaseDto<T extends MqttHardBaseMsg> {
|
||||
// 硬件分组id
|
||||
private Long hardGroupId;
|
||||
|
||||
// 商户id
|
||||
private Long merchantDeptId;
|
||||
|
||||
@@ -18,16 +21,15 @@ public class MqttBaseDto<T extends MqttHardBaseMsg> {
|
||||
|
||||
private T data;
|
||||
|
||||
public Boolean isExistMchDeptId() {
|
||||
return ObjectUtil.isNotEmpty(merchantDeptId);
|
||||
}
|
||||
|
||||
public String getTopic() {
|
||||
if (ObjectUtil.isAllNotEmpty(merchantDeptId, hardwareId)) {
|
||||
if (ObjectUtil.isAllNotEmpty(hardGroupId, merchantDeptId, hardwareId)) {
|
||||
return String.format("topic/android/%s/%s/%s", hardGroupId, merchantDeptId, hardwareId);
|
||||
}
|
||||
if (ObjectUtil.isAllNotEmpty(hardGroupId, merchantDeptId)) {
|
||||
return String.format("topic/android/%s/%s", merchantDeptId, hardwareId);
|
||||
}
|
||||
if (ObjectUtil.isAllNotEmpty(merchantDeptId)) {
|
||||
return String.format("topic/android/%s", merchantDeptId);
|
||||
if (ObjectUtil.isAllNotEmpty(hardGroupId)) {
|
||||
return String.format("topic/android/%s", hardGroupId);
|
||||
}
|
||||
return "topic/android";
|
||||
}
|
||||
|
||||
+4
-11
@@ -7,16 +7,13 @@ import com.bsd.pjcloud.mqtt.constant.MqttActionEnum;
|
||||
import com.bsd.pjcloud.mqtt.dto.MqttBaseDto;
|
||||
import com.bsd.pjcloud.mqtt.dto.hard.HardCustomerMsg;
|
||||
import com.bsd.pjcloud.mqtt.service.MqttEventService;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@@ -28,8 +25,6 @@ public class MqttEventController {
|
||||
|
||||
private final MqttEventService mqttEventService;
|
||||
|
||||
private final RemoteMchService remoteMchService;
|
||||
|
||||
@Inner
|
||||
@PostMapping("/send-default-msg")
|
||||
public R<Boolean> sendDefaultMsg(@RequestBody MqttBaseDto dto) {
|
||||
@@ -109,13 +104,11 @@ public class MqttEventController {
|
||||
*/
|
||||
@Inner
|
||||
@GetMapping("/send-face-change-msg")
|
||||
public R<Boolean> sendFaceChangeMsg(@RequestParam List<Long> parentDeptList, @RequestParam Long userId, @RequestParam(required = false) Boolean isGlobalFace) {
|
||||
public R<Boolean> sendFaceChangeMsg(@RequestParam Long userDeptId, @RequestParam Long userId, @RequestParam(required = false) Boolean isGlobalFace) {
|
||||
MqttBaseDto dto = new MqttBaseDto();
|
||||
MchManageVo mchDept = remoteMchService.getFirstMch(parentDeptList).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchDept)) {
|
||||
dto.setMerchantDeptId(mchDept.getDeptId());
|
||||
}
|
||||
mqttEventService.getTopicParamsByUserDeptId(dto, userDeptId);
|
||||
dto.setAction(MqttActionEnum.FACE);
|
||||
// msg
|
||||
HardCustomerMsg msg = new HardCustomerMsg();
|
||||
msg.setUserId(String.valueOf(userId));
|
||||
if (ObjectUtil.isNotEmpty(isGlobalFace)) {
|
||||
|
||||
+14
@@ -1,12 +1,17 @@
|
||||
package com.bsd.pjcloud.mqtt.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.bsd.pjcloud.mqtt.dto.MqttBaseDto;
|
||||
import com.bsd.pjcloud.mqtt.dto.MqttHardBaseMsg;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -14,6 +19,7 @@ public class MqttEventService {
|
||||
|
||||
private final MqttService mqttService;
|
||||
|
||||
private final RemoteMchService remoteMchService;
|
||||
|
||||
public <T extends MqttBaseDto> Boolean defaultAction(T dto) {
|
||||
MqttHardBaseMsg msg = dto.getData();
|
||||
@@ -21,4 +27,12 @@ public class MqttEventService {
|
||||
mqttService.publish(dto.getQos(), false, dto.getTopic(), JSON.toJSONString(msg));
|
||||
return true;
|
||||
}
|
||||
|
||||
public <T extends MqttBaseDto> void getTopicParamsByUserDeptId(T dto, Long deptId) {
|
||||
MchManageVo mch = remoteMchService.getFirstMchByDeptId(deptId).getData();
|
||||
if (ObjectUtil.isEmpty(mch)) {
|
||||
return;
|
||||
}
|
||||
dto.setHardGroupId(mch.getHardGroupId());
|
||||
}
|
||||
}
|
||||
+10
@@ -74,4 +74,14 @@ public interface RemoteDeptService {
|
||||
*/
|
||||
@GetMapping("/dept/getDeptListByDeptId")
|
||||
R<SysDept> getDeptByDeptId(@RequestParam("deptId") Long deptId);
|
||||
|
||||
/**
|
||||
* 获得指定部门的所有父部门
|
||||
*
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/dept/getParentDeptList")
|
||||
R<List<SysDept>> getParentDeptList(@RequestParam("deptId") Long deptId);
|
||||
}
|
||||
+6
@@ -198,4 +198,10 @@ public class SysDeptController {
|
||||
public R<SysDept> getDeptByDeptId(@RequestParam("deptId") Long deptId) {
|
||||
return R.ok(sysDeptService.getById(deptId));
|
||||
}
|
||||
|
||||
@Inner
|
||||
@GetMapping("/getParentDeptList")
|
||||
public R<List<SysDept>> getParentDeptList(@RequestParam("deptId") Long deptId) {
|
||||
return R.ok(sysDeptService.getParentDeptList(deptId));
|
||||
}
|
||||
}
|
||||
+1
-4
@@ -122,10 +122,7 @@ public class SysUserFaceServiceImpl extends ServiceImpl<SysUserFaceMapper, SysUs
|
||||
List<SysUser> list = sysUserService.list(new LambdaQueryWrapper<SysUser>().in(SysUser::getUserId, userIds));
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
for (SysUser v : list) {
|
||||
List<SysDept> parentDeptList = sysDeptService.getParentDeptList(v.getDeptId());
|
||||
if (ObjectUtil.isEmpty(parentDeptList)) continue;
|
||||
List<Long> deptIds = parentDeptList.stream().map(SysDept::getDeptId).toList();
|
||||
remoteMqttEventService.sendFaceChangeMsg(deptIds, v.getUserId(), isGlobalFace);
|
||||
remoteMqttEventService.sendFaceChangeMsg(v.getDeptId(), v.getUserId(), isGlobalFace);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
+1
-1
@@ -31,7 +31,7 @@ public class WalletRechargeExcelDto {
|
||||
private Long lineNum;
|
||||
|
||||
@ColumnWidth(100)
|
||||
@ExcelProperty("用户名")
|
||||
@ExcelProperty("用户姓名")
|
||||
private String username;
|
||||
|
||||
@ColumnWidth(100)
|
||||
|
||||
+6
@@ -32,6 +32,12 @@ public class MchManageEntity extends Model<MchManageEntity> {
|
||||
@Schema(description="主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备分组id
|
||||
*/
|
||||
@Schema(description="设备分组id")
|
||||
private Long hardGroupId;
|
||||
|
||||
/**
|
||||
* 绑定的部门id
|
||||
*/
|
||||
|
||||
+65
-64
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@@ -24,94 +25,94 @@ import java.time.LocalDateTime;
|
||||
public class WalletFreezeEntity extends Model<WalletFreezeEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="编号")
|
||||
@Schema(description = "编号")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 流程id
|
||||
*/
|
||||
@Schema(description = "流程id")
|
||||
private String processId;
|
||||
/**
|
||||
* 流程id
|
||||
*/
|
||||
@Schema(description = "流程id")
|
||||
private String processId;
|
||||
|
||||
/**
|
||||
* 流程状态
|
||||
*/
|
||||
@Schema(description = "流程状态")
|
||||
private String processStatus;
|
||||
/**
|
||||
* 流程状态
|
||||
*/
|
||||
@Schema(description = "流程状态")
|
||||
private String processStatus;
|
||||
|
||||
/**
|
||||
* 钱包id
|
||||
*/
|
||||
@Schema(description="钱包id")
|
||||
/**
|
||||
* 钱包id
|
||||
*/
|
||||
@Schema(description = "钱包id")
|
||||
private Long walletId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description="用户id")
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@Schema(description="部门id")
|
||||
private Long deptId;
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@Schema(description = "部门id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 冻结状态
|
||||
*/
|
||||
@Schema(description="冻结状态")
|
||||
/**
|
||||
* 冻结状态
|
||||
*/
|
||||
@Schema(description = "冻结状态")
|
||||
private String freeStatus;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description="备注")
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
+6
-4
@@ -3,8 +3,7 @@ package com.bsd.pjcloud.wallet.api.entity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.*;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -15,6 +14,9 @@ import java.time.LocalDateTime;
|
||||
* @author dzc
|
||||
* @date 2024-12-30 09:06:35
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("wallet_manage")
|
||||
@@ -82,7 +84,7 @@ public class WalletManageEntity extends Model<WalletManageEntity> {
|
||||
* 是否冻结饭卡
|
||||
*/
|
||||
@Schema(description = "是否冻结饭卡")
|
||||
private Boolean isFreeze;
|
||||
private String isFreeze;
|
||||
|
||||
/**
|
||||
* 绑定饭卡时间
|
||||
@@ -91,7 +93,7 @@ public class WalletManageEntity extends Model<WalletManageEntity> {
|
||||
private LocalDateTime activeBindTime;
|
||||
|
||||
/**
|
||||
* 饭卡绑定状态
|
||||
* 饭卡绑定状态 1已经绑定 0未绑定
|
||||
*/
|
||||
@Schema(description = "饭卡绑定状态")
|
||||
private String activeBindStatus;
|
||||
|
||||
+3
@@ -33,4 +33,7 @@ public interface RemoteMchService {
|
||||
@GetMapping("/mch-manage/get-first-mch")
|
||||
R<MchManageVo> getFirstMch(@RequestParam List<Long> deptIds);
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/mch-manage/get-first-mch-by-dept-id")
|
||||
R<MchManageVo> getFirstMchByDeptId(@RequestParam Long deptId);
|
||||
}
|
||||
+9
@@ -6,6 +6,7 @@ import com.bsd.pjcloud.common.feign.annotation.NoToken;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletCodeBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -23,6 +24,14 @@ public interface RemoteWalletService {
|
||||
@GetMapping("/wallet-manage/get-wallet")
|
||||
R<WalletManageEntity> getWallet(@RequestParam Long userId, @RequestParam WalletTypeEnum walletTypeCode);
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/wallet-manage/get-wallet-by-id")
|
||||
R<WalletManageVo> getWalletById(@RequestParam Long walletId);
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/wallet-manage/get-wallet-by-card-number")
|
||||
R<WalletManageEntity> getWalletByCardNumber(@RequestParam String cardNumber);
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/wallet-manage/create-wallet")
|
||||
R<WalletManageEntity> createWallet(@RequestParam Long userId);
|
||||
|
||||
+2
-2
@@ -32,9 +32,9 @@ public interface BaseWalletInterface {
|
||||
|
||||
void setWalletFreezePrice(Integer walletFreezePrice);
|
||||
|
||||
Boolean getWalletIsFreeze();
|
||||
String getWalletIsFreeze();
|
||||
|
||||
void setWalletIsFreeze(Boolean walletIsFreeze);
|
||||
void setWalletIsFreeze(String walletIsFreeze);
|
||||
|
||||
LocalDateTime getWalletActiveBindTime();
|
||||
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class WalletTransactionVo extends WalletTransactionEntity implements Base
|
||||
|
||||
private Integer walletFreezePrice;
|
||||
|
||||
private Boolean walletIsFreeze;
|
||||
private String walletIsFreeze;
|
||||
|
||||
private LocalDateTime walletActiveBindTime;
|
||||
|
||||
|
||||
+8
@@ -80,6 +80,14 @@ public class MchManageController {
|
||||
if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在");
|
||||
return R.ok(mchManage);
|
||||
}
|
||||
|
||||
@Inner
|
||||
@GetMapping("/get-first-mch-by-dept-id")
|
||||
public R<MchManageVo> getFirstMchByDeptId(@RequestParam Long deptId) {
|
||||
MchManageVo mchManage = mchManageService.getFirstMchByDeptId(deptId);
|
||||
if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在");
|
||||
return R.ok(mchManage);
|
||||
}
|
||||
/* ************************************* end 远程调用 end ************************************* */
|
||||
|
||||
/* ************************************* start app start ************************************* */
|
||||
|
||||
+13
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.idempotent.annotation.Idempotent;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletActiveDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletActiveVo;
|
||||
@@ -65,6 +67,17 @@ public class WalletActiveController {
|
||||
}
|
||||
/* ************************************* end android end ************************************* */
|
||||
|
||||
|
||||
/* ************************************* start android start ************************************* */
|
||||
@PostMapping("/app/bind-card")
|
||||
@SysLog("app绑定饭卡")
|
||||
@Operation(summary = "app绑定饭卡")
|
||||
public R<Boolean> appBindCard(@RequestBody WalletActiveDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
return R.ok(walletActiveService.appBindCard(dto, user));
|
||||
}
|
||||
/* ************************************* end android end ************************************* */
|
||||
|
||||
@GetMapping("/refresh-avatar")
|
||||
@Operation(summary = "重新激活")
|
||||
@SysLog("重新激活")
|
||||
|
||||
+17
@@ -13,6 +13,7 @@ import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletActiveDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletFreezeDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
|
||||
@@ -53,6 +54,22 @@ public class WalletFreezeController {
|
||||
}
|
||||
/* ************************************* start flow callback start ************************************* */
|
||||
|
||||
/* ************************************* start app start ************************************* */
|
||||
@PostMapping("/app/apply-freeze")
|
||||
@Operation(summary = "申请冻结")
|
||||
public R<Object> appApplyFreeze(@RequestBody WalletFreezeDto dto) {
|
||||
if (ObjectUtil.isEmpty(dto.getWalletId())) {
|
||||
throw new RuntimeException("钱包id不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(dto.getRemark())) {
|
||||
throw new RuntimeException("备注不能为空");
|
||||
}
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
walletFreezeService.applyFreeze(dto, user);
|
||||
return R.ok(true);
|
||||
}
|
||||
/* ************************************* start end start ************************************* */
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletFreeze_view')")
|
||||
|
||||
+21
-5
@@ -14,6 +14,8 @@ import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletManageDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletManageMapper;
|
||||
import com.bsd.pjcloud.wallet.service.WalletCodeUseService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletManageService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -42,9 +44,10 @@ import java.util.List;
|
||||
public class WalletManageController {
|
||||
|
||||
private final WalletManageService walletManageService;
|
||||
|
||||
private final WalletCodeUseService walletCodeUseService;
|
||||
|
||||
private final WalletManageMapper walletManageMapper;
|
||||
|
||||
/* ************************************* start 远程调用 start ************************************* */
|
||||
@Inner
|
||||
@GetMapping("/get-or-create-wallet")
|
||||
@@ -67,9 +70,23 @@ public class WalletManageController {
|
||||
@GetMapping("/get-wallet")
|
||||
public R getWallet(@RequestParam Long userId, @RequestParam WalletTypeEnum walletTypeCode) {
|
||||
WalletManageEntity wallet = walletManageService.getWallet(userId, walletTypeCode);
|
||||
if (ObjectUtil.isEmpty(wallet)) {
|
||||
return R.failed("用户钱包不存在");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(wallet)) return R.failed("用户钱包不存在");
|
||||
return R.ok(wallet);
|
||||
}
|
||||
|
||||
@Inner
|
||||
@GetMapping("/get-wallet-by-id")
|
||||
public R getWalletById(@RequestParam Long walletId) {
|
||||
WalletManageVo wallet = walletManageMapper.join(walletId);
|
||||
if (ObjectUtil.isEmpty(wallet)) return R.failed("用户钱包不存在");
|
||||
return R.ok(wallet);
|
||||
}
|
||||
|
||||
@Inner
|
||||
@GetMapping("/get-wallet-by-card-number")
|
||||
public R getWalletByCardNumber(@RequestParam String cardNumber) {
|
||||
WalletManageEntity wallet = walletManageService.getWallet(cardNumber);
|
||||
if (ObjectUtil.isEmpty(wallet)) return R.failed("用户钱包不存在");
|
||||
return R.ok(wallet);
|
||||
}
|
||||
|
||||
@@ -111,7 +128,6 @@ public class WalletManageController {
|
||||
public R<String> getQrCode(@RequestParam Long walletId) {
|
||||
return R.ok(walletManageService.getQrCode(walletId));
|
||||
}
|
||||
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ public class WalletTransactionController {
|
||||
public R appGetAll(@ParameterObject Page page, @ParameterObject WalletTransactionDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setUserId(user.getId());
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto));
|
||||
return R.ok(walletTransactionService.pageJoin(page, dto));
|
||||
}
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
|
||||
+2
@@ -28,4 +28,6 @@ public interface MchManageService extends IService<MchManageEntity> {
|
||||
MchManageVo getByDeptId(Long deptId);
|
||||
|
||||
MchManageVo getFirstMch(List<Long> deptIds);
|
||||
|
||||
MchManageVo getFirstMchByDeptId(Long deptId);
|
||||
}
|
||||
+24
@@ -2,9 +2,11 @@ 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.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletActiveDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletActiveVo;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
public interface WalletActiveService extends IService<WalletActiveEntity> {
|
||||
/**
|
||||
@@ -23,10 +25,32 @@ public interface WalletActiveService extends IService<WalletActiveEntity> {
|
||||
|
||||
/**
|
||||
* 重新激活
|
||||
*
|
||||
* @param id 开卡id
|
||||
*/
|
||||
Boolean refreshAvatar(Long id);
|
||||
|
||||
/**
|
||||
* 绑定饭卡
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Boolean appBindCard(WalletActiveDto dto, PjcloudUser user);
|
||||
|
||||
/**
|
||||
* 卡号是否存在
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Boolean exitCardNumber(Long id, String CardNumber);
|
||||
|
||||
/**
|
||||
* 更具卡号查询开卡信息
|
||||
* @return
|
||||
*/
|
||||
WalletActiveEntity getByCardNumber(@NotEmpty String cardNumber);
|
||||
|
||||
Page<WalletActiveVo> pageJoin(Page page, WalletActiveDto dto);
|
||||
|
||||
Page<WalletActiveVo> scopePageList(Page page, WalletActiveDto dto);
|
||||
|
||||
+3
@@ -2,6 +2,7 @@ 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.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletFreezeDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
|
||||
@@ -16,4 +17,6 @@ public interface WalletFreezeService extends IService<WalletFreezeEntity> {
|
||||
Long create(WalletFreezeDto dto);
|
||||
|
||||
void applyCallback(ProcessNodeRecordAssignUserParamDto dto);
|
||||
|
||||
void applyFreeze(WalletFreezeDto dto, PjcloudUser user);
|
||||
}
|
||||
+9
-1
@@ -45,6 +45,14 @@ public interface WalletManageService extends IService<WalletManageEntity> {
|
||||
WalletManageEntity getWallet(@NotNull Long userId, @NotNull WalletTypeEnum walletTypeCode);
|
||||
|
||||
|
||||
/**
|
||||
* 获取钱包(没有缓存)
|
||||
* @param cardNumber
|
||||
* @return
|
||||
*/
|
||||
WalletManageEntity getWallet(@NotNull String cardNumber);
|
||||
|
||||
|
||||
/**
|
||||
* 获取钱包(没有缓存)
|
||||
*
|
||||
@@ -82,7 +90,7 @@ public interface WalletManageService extends IService<WalletManageEntity> {
|
||||
|
||||
Page<WalletManageVo> scopePageList(Page page, WalletManageDto dto);
|
||||
|
||||
WalletManageVo join(Long id, Long walletId);
|
||||
WalletManageVo join(Long user, Long walletId);
|
||||
|
||||
/**
|
||||
* 生成钱包二维码参数
|
||||
|
||||
+4
-8
@@ -9,6 +9,10 @@ import com.bsd.pjcloud.wallet.api.vo.transaction.WalletTransactionVo;
|
||||
|
||||
public interface WalletTransactionService extends IService<WalletTransactionEntity> {
|
||||
|
||||
Page<WalletTransactionVo> scopePageList(Page page, WalletTransactionDto dto);
|
||||
|
||||
Page<WalletTransactionVo> pageJoin(Page page, WalletTransactionDto dto);
|
||||
|
||||
/**
|
||||
* 扣减钱包余额
|
||||
*
|
||||
@@ -38,12 +42,4 @@ public interface WalletTransactionService extends IService<WalletTransactionEnti
|
||||
* @return
|
||||
*/
|
||||
Boolean updateWalletBalance(WalletTransactionDto dto);
|
||||
|
||||
/**
|
||||
* 分页查询复杂查询
|
||||
* @param page
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Page<WalletTransactionVo> scopePageList(Page page, WalletTransactionDto dto);
|
||||
}
|
||||
+11
-1
@@ -112,7 +112,7 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
@Override
|
||||
public void delByIds(ArrayList<Long> list) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
delByIds(list);
|
||||
baseMapper.deleteByIds(list);
|
||||
// 删除缓存
|
||||
list.forEach(v -> redisTemplate.opsForValue().getAndDelete(CacheConstants.WALLET_MCH + v));
|
||||
}
|
||||
@@ -189,6 +189,16 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MchManageVo getFirstMchByDeptId(Long deptId) {
|
||||
List<SysDept> parentDeptIdList = remoteDeptService.getParentDeptList(deptId).getData();
|
||||
if (ObjectUtil.isEmpty(parentDeptIdList)) {
|
||||
return null;
|
||||
}
|
||||
List<Long> deptIds = parentDeptIdList.stream().map(SysDept::getDeptId).toList();
|
||||
return getFirstMch(deptIds);
|
||||
}
|
||||
|
||||
private boolean existName(String name, Long id) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<MchManageEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(name), MchManageEntity::getName, name)
|
||||
|
||||
+49
-3
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.wallet.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
@@ -13,12 +14,14 @@ import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.exception.CheckedException;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletActiveDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletTypeDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
@@ -27,6 +30,7 @@ import com.bsd.pjcloud.wallet.mapper.WalletActiveMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper;
|
||||
import com.bsd.pjcloud.wallet.service.MchManageService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletActiveService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletManageService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTypeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -34,6 +38,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -50,6 +55,7 @@ import java.util.Map;
|
||||
@Service
|
||||
public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, WalletActiveEntity> implements WalletActiveService {
|
||||
|
||||
private final WalletManageService walletManageService;
|
||||
private final WalletTypeService walletTypeService;
|
||||
private final MchManageService mchManageService;
|
||||
|
||||
@@ -111,6 +117,46 @@ public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, Wal
|
||||
return baseMapper.updateById(updateObj) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean appBindCard(WalletActiveDto dto, PjcloudUser user) {
|
||||
WalletActiveEntity walletActive = getByCardNumber(dto.getCardNumber());
|
||||
if (ObjectUtil.isEmpty(walletActive)) {
|
||||
throw new RuntimeException("卡号不存在");
|
||||
}
|
||||
WalletManageEntity wallet = walletManageService.getWallet(dto.getCardNumber());
|
||||
if (ObjectUtil.isNotEmpty(wallet)) {
|
||||
throw new RuntimeException("该卡号已经绑定用户");
|
||||
}
|
||||
WalletManageEntity selfWallet = walletManageService.getWallet(dto.getWalletId());
|
||||
if (ObjectUtil.isNotEmpty(selfWallet) && ObjectUtil.isNotEmpty(selfWallet.getCardNumber())) {
|
||||
throw new RuntimeException("用户已绑定饭卡");
|
||||
}
|
||||
// 更新开卡记录
|
||||
WalletActiveEntity walletActiveObj = WalletActiveEntity.builder().id(walletActive.getId()).userId(user.getId()).walletId(selfWallet.getId()).walletTypeId(selfWallet.getWalletTypeId()).build();
|
||||
baseMapper.updateById(walletActiveObj);
|
||||
// 更新用户钱包
|
||||
WalletManageEntity walletObj = WalletManageEntity.builder().id(selfWallet.getId()).cardNumber(walletActive.getCardNumber()).activeBindStatus(YesNoEnum.YES.getCode()).activeBindTime(LocalDateTime.now()).build();
|
||||
walletManageService.updateById(walletObj);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean exitCardNumber(Long id, String CardNumber) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<WalletActiveEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(id), WalletActiveEntity::getId, id)
|
||||
.eq(ObjectUtil.isNotEmpty(CardNumber), WalletActiveEntity::getCardNumber, CardNumber)
|
||||
);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WalletActiveEntity getByCardNumber(String cardNumber) {
|
||||
return baseMapper.selectOne(new LambdaQueryWrapper<WalletActiveEntity>()
|
||||
.eq(WalletActiveEntity::getCardNumber, cardNumber)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletActiveVo> pageJoin(Page page, WalletActiveDto dto) {
|
||||
Page<WalletActiveVo> list = baseMapper.pageJoin(page, dto);
|
||||
@@ -156,7 +202,7 @@ public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, Wal
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(page.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
@@ -164,7 +210,7 @@ public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, Wal
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(page.getRecords(), deptList.getData());
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
// 商户
|
||||
@@ -172,7 +218,7 @@ public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, Wal
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
List<MchManageVo> mchList = mchManageService.list(MchManageDto.builder().ids(mchIds).build());
|
||||
if (ObjectUtil.isNotEmpty(mchList)) {
|
||||
WalletDataUtil.convertMchList(page.getRecords(), CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
WalletDataUtil.convertMchList(list.getRecords(), CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-5
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.wallet.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
@@ -107,18 +108,22 @@ public class WalletCodeUseServiceImpl extends ServiceImpl<WalletCodeUseMapper, W
|
||||
@GlobalTransactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean cancelCode(Long id) {
|
||||
WalletCodeUseEntity codeUse = baseMapper.selectById(id);
|
||||
if (ObjectUtil.isEmpty(codeUse)) return false;
|
||||
WalletCodeUseEntity codeUse = baseMapper.selectOne(new LambdaQueryWrapper<WalletCodeUseEntity>()
|
||||
.eq(WalletCodeUseEntity::getBizId, id)
|
||||
);
|
||||
if (ObjectUtil.isEmpty(codeUse)) return null;
|
||||
if (ObjectUtil.equals(codeUse.getStatus(), YesNoEnum.YES.getCode())) return false;
|
||||
WalletCodeUseEntity updateObj = WalletCodeUseEntity.builder().id(id).status(YesNoEnum.YES.getCode()).useTime(LocalDateTime.now()).build();
|
||||
WalletCodeUseEntity updateObj = WalletCodeUseEntity.builder().id(codeUse.getId()).status(YesNoEnum.YES.getCode()).useTime(LocalDateTime.now()).build();
|
||||
return baseMapper.updateById(updateObj) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean isCancelCode(Long id) {
|
||||
WalletCodeUseEntity codeUse = baseMapper.selectById(id);
|
||||
if (ObjectUtil.isEmpty(codeUse)) return false;
|
||||
WalletCodeUseEntity codeUse = baseMapper.selectOne(new LambdaQueryWrapper<WalletCodeUseEntity>()
|
||||
.eq(WalletCodeUseEntity::getBizId, id)
|
||||
);
|
||||
if (ObjectUtil.isEmpty(codeUse)) return null;
|
||||
return ObjectUtil.equals(codeUse.getStatus(), YesNoEnum.YES.getCode());
|
||||
}
|
||||
}
|
||||
+46
-10
@@ -3,6 +3,7 @@ package com.bsd.pjcloud.wallet.service.impl;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -17,6 +18,7 @@ import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.flow.task.constant.NodeStatusEnum;
|
||||
import com.bsd.pjcloud.flow.task.constant.TaskCheckStatusEnum;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
@@ -132,16 +134,7 @@ public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, Wal
|
||||
if (ObjectUtil.isEmpty(dept)) throw new RuntimeException("发起人部门不存在");
|
||||
baseMapper.insert(dto);
|
||||
// 发起审批
|
||||
WalletFreezeApplyFlowDto flowDto = new WalletFreezeApplyFlowDto();
|
||||
flowDto.setApplyUsername(userData.getSysUser().getUsername());
|
||||
flowDto.setApplyUserId(userData.getSysUser().getUserId());
|
||||
flowDto.setApplyDeptName(dept.getName());
|
||||
flowDto.setApplyDeptId(dept.getDeptId());
|
||||
flowDto.setApplyCreateTime(LocalDateTimeUtil.format(LocalDateTime.now(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
flowDto.setCardNumber(wallet.getCardNumber());
|
||||
flowDto.setRemark(dto.getRemark());
|
||||
String processId = flowUtil.startFlow("TASK_FREEZE_FLOW", userData.getSysUser(), dto.getId(), flowDto);
|
||||
baseMapper.updateById(WalletFreezeEntity.builder().id(dto.getId()).processId(processId).build());
|
||||
getSelf().applyFlow(userData, dept, wallet, dto);
|
||||
return dto.getId();
|
||||
}
|
||||
|
||||
@@ -162,12 +155,51 @@ public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, Wal
|
||||
Boolean isConsent = flowUtil.isConsent(dto);
|
||||
String processStatus = isConsent ? TaskCheckStatusEnum.RESULT.getCode() : TaskCheckStatusEnum.REJECT.getCode();
|
||||
baseMapper.updateById(WalletFreezeEntity.builder().id(detail.getId()).freeStatus(YesNoEnum.YES.getCode()).processStatus(processStatus).build());
|
||||
if (isConsent) {
|
||||
// 更改钱包状态
|
||||
WalletManageEntity walletUpdateObj = WalletManageEntity.builder().id(detail.getWalletId()).isFreeze(YesNoEnum.YES.getCode()).build();
|
||||
walletManageService.updateById(walletUpdateObj);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("|{}|审批回调意外的错误,dto:|{}|error:|{}|", TAG, JSON.toJSONString(dto), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void applyFreeze(WalletFreezeDto dto, PjcloudUser user) {
|
||||
WalletManageEntity wallet = walletManageService.getWallet(dto.getWalletId());
|
||||
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("钱包不存在");
|
||||
// 判断之前有没有在审核的
|
||||
if (isCheckData(dto.getUserId())) throw new RuntimeException("已提交申请,请勿重复提交");
|
||||
// 查询发起人
|
||||
UserInfo userData = userService.getByUserId(user.getId()).getData();
|
||||
// 查询部门
|
||||
SysDept dept = deptService.getDeptByDeptId(user.getDeptId()).getData();
|
||||
if (ObjectUtil.isEmpty(dept)) throw new RuntimeException("用户部门不存在");
|
||||
// 添加钱包冻结记录
|
||||
WalletFreezeEntity saveObj = WalletFreezeEntity.builder().walletId(wallet.getId()).userId(user.getId()).deptId(user.getDeptId()).processStatus(TaskCheckStatusEnum.PADDING.getCode()).freeStatus(YesNoEnum.YES.getCode()).remark(dto.getRemark()).build();
|
||||
baseMapper.insert(saveObj);
|
||||
// 发起审批
|
||||
getSelf().applyFlow(userData, dept, wallet, saveObj);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void applyFlow(UserInfo userInfo, SysDept dept, WalletManageEntity wallet, WalletFreezeEntity obj) {
|
||||
// 发起审批
|
||||
WalletFreezeApplyFlowDto flowDto = new WalletFreezeApplyFlowDto();
|
||||
flowDto.setApplyUsername(userInfo.getSysUser().getUsername());
|
||||
flowDto.setApplyUserId(userInfo.getSysUser().getUserId());
|
||||
flowDto.setApplyDeptName(dept.getName());
|
||||
flowDto.setApplyDeptId(dept.getDeptId());
|
||||
flowDto.setApplyCreateTime(LocalDateTimeUtil.format(LocalDateTime.now(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
flowDto.setCardNumber(wallet.getCardNumber());
|
||||
flowDto.setRemark(obj.getRemark());
|
||||
String processId = flowUtil.startFlow("TASK_FREEZE_FLOW", userInfo.getSysUser(), obj.getId(), flowDto);
|
||||
baseMapper.updateById(WalletFreezeEntity.builder().id(obj.getId()).processId(processId).build());
|
||||
}
|
||||
|
||||
private boolean isCheckData(Long walletId) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<WalletFreezeEntity>()
|
||||
.eq(WalletFreezeEntity::getUserId, walletId)
|
||||
@@ -176,4 +208,8 @@ public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, Wal
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
private WalletFreezeServiceImpl getSelf() {
|
||||
return SpringUtil.getBean(getClass());
|
||||
}
|
||||
|
||||
}
|
||||
+7
-1
@@ -137,6 +137,12 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WalletManageEntity getWallet(String cardNumber) {
|
||||
return baseMapper.selectOne(new LambdaQueryWrapper<WalletManageEntity>()
|
||||
.eq(WalletManageEntity::getCardNumber, cardNumber));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WalletManageEntity getWallet(Long userId, Long walletTypeId) {
|
||||
WalletTypeEntity walletType = walletTypeService.getById(walletTypeId);
|
||||
@@ -148,7 +154,7 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = CacheConstants.WALLET_DETAIL, key = "#walletId", condition = "#walletId != null", unless = "#result == null")
|
||||
// @Cacheable(value = CacheConstants.WALLET_DETAIL, key = "#walletId", condition = "#walletId != null", unless = "#result == null")
|
||||
public WalletManageEntity getWallet(Long walletId) {
|
||||
return baseMapper.selectById(walletId);
|
||||
}
|
||||
|
||||
+48
@@ -199,4 +199,52 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletTransactionVo> pageJoin(Page page, WalletTransactionDto dto) {
|
||||
Page<WalletTransactionVo> list = baseMapper.pageJoin(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletTransactionVo::getUserId).distinct().toList();
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(WalletTransactionVo::getDeptId).distinct().toList();
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
// 饭卡
|
||||
List<Long> walletIds = list.getRecords().stream().map(WalletTransactionVo::getWalletId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(walletIds)) {
|
||||
WalletManageDto walletManageDto = new WalletManageDto();
|
||||
walletManageDto.setWalletIds(walletIds);
|
||||
List<WalletManageEntity> walletList = walletManageMapper.list(walletManageDto);
|
||||
if (ObjectUtil.isNotEmpty(walletList)) {
|
||||
WalletDataUtil.convertWalletList(list.getRecords(), CollectionUtils.convertMap(walletList, WalletManageEntity::getId));
|
||||
}
|
||||
}
|
||||
// 饭卡类型
|
||||
List<Long> walletTypeIds = list.getRecords().stream().map(WalletTransactionVo::getWalletTypeId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(walletTypeIds)) {
|
||||
WalletTypeDto walletTypeDto = new WalletTypeDto();
|
||||
walletTypeDto.setWalletTypeIds(walletTypeIds);
|
||||
List<WalletTypeEntity> walletTypeList = walletTypeMapper.list(walletTypeDto);
|
||||
if (ObjectUtil.isNotEmpty(walletTypeList)) {
|
||||
WalletDataUtil.convertWalletTypeList(list.getRecords(), CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId));
|
||||
}
|
||||
}
|
||||
// 订单
|
||||
if (dto.getIsFindOrder()) {
|
||||
list.getRecords().forEach(v -> {
|
||||
if (ObjectUtil.isNotEmpty(v.getBizId())) {
|
||||
v.setOrderId(Long.valueOf(v.getBizId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+7
-3
@@ -238,11 +238,15 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
errors.add("用户手机号格式不正确");
|
||||
} else {
|
||||
R<UserInfo> user = userService.getUserByNameAndMobile(v.getUsername(), v.getUserMobile());
|
||||
Optional<Long> userId = Optional.of(user).map(R::getData).map(UserInfo::getSysUser).map(SysUser::getUserId);
|
||||
if (userId.isEmpty()) {
|
||||
Optional<SysUser> sysUser = Optional.of(user).map(R::getData).map(UserInfo::getSysUser);
|
||||
if (sysUser.isEmpty()) {
|
||||
errors.add("用户不存在");
|
||||
} else {
|
||||
v.setUserId(userId.get());
|
||||
if (!ObjectUtil.equals(sysUser.get().getName(), v.getUsername())) {
|
||||
errors.add("用户不存在");
|
||||
} else {
|
||||
v.setUserId(sysUser.get().getUserId());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(errors)) {
|
||||
|
||||
Reference in new issue
Block a user