feat:医院支付

This commit is contained in:
dzc committed 2025-08-14 20:05:27 +08:00
1 parent 6443922c3f
commit a7cb2436cf
10 files changed
+98 -10

No files matched your search

@@ -32,6 +32,7 @@ public enum HardPayTypeEnum {
private final String type;
private final String description;
// 支付方式交易记录
public static final List<HardPayTypeEnum> payTypeTotalDisplayList = List.of(
WALLET_DEFAULT,
WALLET_QR_CODE,
@@ -39,7 +40,9 @@ public enum HardPayTypeEnum {
FACE,
CASH,
WECHANT_SELF_QR_CODE_PAY,
ALI_SELF_QR_CODE_PAY
ALI_SELF_QR_CODE_PAY,
ZYY,
RMYY
);
public static final List<HardPayTypeEnum> isNotWalletPay = List.of(
@@ -49,11 +52,19 @@ public enum HardPayTypeEnum {
ALI_SELF_QR_CODE_PAY
);
// 可以核销的订单
public static final List<HardPayTypeEnum> isNeedCancel = List.of(
STRIDE_DEPT_QR_CODE,
FOREIGN_TICKET_QR_CODE
);
// 线下支付的订单类型(现金支付,其他渠道支付如中医院、人民医院)
public static final List<HardPayTypeEnum> isOffline = List.of(
CASH,
ZYY,
RMYY
);
public static HardPayTypeEnum valueOfByType(String type) {
if (ObjectUtil.isEmpty(type)) return null;
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().get();
@@ -0,0 +1,14 @@
package com.bsd.pjcloud.hard.api.dto.sync;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import java.util.List;
@Data
public class HardSyncSupermarket {
@NotEmpty(message = "部门商户记录不存在")
private List<Long> mchDeptIdList;
}
@@ -5,15 +5,14 @@ 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.hard.api.dto.sync.HardSyncSupermarket;
import com.bsd.pjcloud.hard.service.HardSyncService;
import io.swagger.v3.oas.annotations.Operation;
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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* 设备同步
@@ -37,4 +36,13 @@ public class HardSyncController {
return R.ok();
}
@Operation(summary = "管理员同步超市分类商品和同步", description = "管理员同步超市分类商品和同步")
@SysLog("管理员同步超市分类商品和同步")
@Idempotent(expireTime = 3, info = "正在同步中,请勿重复操作")
@PostMapping("/sync-supermarket")
public R syncSupermarketByMchDeptIds(@RequestBody HardSyncSupermarket dto) {
hardSyncService.syncSupermarketByMchDeptIds(dto);
return R.ok();
}
}
@@ -1,6 +1,7 @@
package com.bsd.pjcloud.hard.service;
import com.bsd.pjcloud.common.security.service.PjcloudUser;
import com.bsd.pjcloud.hard.api.dto.sync.HardSyncSupermarket;
public interface HardSyncService {
@@ -9,4 +10,8 @@ public interface HardSyncService {
*/
void syncSupermarket(PjcloudUser user);
/**
* 管理员同步超市分类商品和同步
*/
void syncSupermarketByMchDeptIds(HardSyncSupermarket dto);
}
@@ -201,8 +201,9 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
if (ObjectUtil.isEmpty(mch)) throw new RuntimeException("机器绑定的商户不存在");
// 是否需要钱包支付
boolean isWalletPay = isPay(dto.getOrderType(), dto.getOrderPayType());
// 是否需要现金支付
boolean isCashPay = ObjectUtil.equals(dto.getOrderPayType(), HardPayTypeEnum.CASH);
// 是否为线下支付
boolean isOffline = HardPayTypeEnum.isOffline.contains(dto.getOrderPayType());
// 是否需要核销
boolean isVerify = isVerify(dto.getOrderPayType());
// 是否微信支付
@@ -297,7 +298,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
getSelf().cancelCode(orderObj, userDetail);
}
// 现金支付
if (isCashPay) {
if (isOffline) {
// 更改为支付成功
getSelf().orderSuccess(orderObj, Boolean.TRUE);
}
@@ -331,7 +332,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
}
}
// 发送mq消息
// getSelf().createOrderAfterSendMqMsg(orderObj.getId(), userDetail);
getSelf().createOrderAfterSendMqMsg(orderObj.getId(), userDetail);
return orderObj.getId();
}
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
import com.bsd.pjcloud.common.security.service.PjcloudUser;
import com.bsd.pjcloud.hard.api.dto.sync.HardSyncSupermarket;
import com.bsd.pjcloud.hard.service.HardSyncService;
import com.bsd.pjcloud.mqtt.api.feign.RemoteMqttEventService;
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
@@ -13,6 +14,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.List;
@Validated
@Slf4j
@RequiredArgsConstructor
@@ -34,8 +37,15 @@ public class HardSyncServiceImpl implements HardSyncService {
if (ObjectUtil.isEmpty(targetMch) || ObjectUtil.notEqual(targetMch.getTypes(), MerchantTypeEnum.CANTEEN.getType())) {
throw new RuntimeException("您不是超市用户,无法操作");
}
mqttEventService.sendSupermarketClassifyChangeMsg(deptId);
mqttEventService.sendSupermarketProductChangeMsg(deptId);
mqttEventService.sendSupermarket(List.of(deptId));
}
/**
* 管理员同步超市分类商品和同步
*/
@Override
public void syncSupermarketByMchDeptIds(HardSyncSupermarket dto) {
// 查询所有的超市部门
mqttEventService.sendSupermarket(dto.getMchDeptIdList());
}
}
@@ -56,6 +56,13 @@ public interface RemoteMqttEventService {
@GetMapping("/mqtt/send-supermarket-classify-change-msg")
R<Boolean> sendSupermarketClassifyChangeMsg(@RequestParam Long deptId);
/**
* 超市分类变化
*/
@NoToken
@GetMapping("/mqtt/send-supermarket")
R<Boolean> sendSupermarket(@RequestParam List<Long> deptIdList);
/**
* 人脸变化
*/
@@ -14,6 +14,7 @@ public enum MqttActionEnum {
CANTEEN_CLASSIFY("食堂分类变化"),
SUPERMARKET_PRODUCT("超市商品变化"),
SUPERMARKET_CLASSIFY("超市分类变化"),
SUPERMARKET("超市变化"),
PRINT("打印变化"),
FACE("人脸变化"),
TAKE_FOOD_BROADCAST("定餐广播"),
@@ -15,6 +15,8 @@ import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/mqtt")
@@ -99,6 +101,23 @@ public class MqttEventController {
return R.ok(mqttEventService.defaultAction(dto));
}
/**
* 超市分类变化
*/
@Inner
@GetMapping("/send-supermarket")
public R<Boolean> sendSupermarket(@RequestParam List<Long> deptIdList) {
if (ObjectUtil.isNotEmpty(deptIdList)) return R.failed(false);
for (Long v : deptIdList) {
MqttBaseDto dto = new MqttBaseDto<>();
if (ObjectUtil.isNotEmpty(v)) dto.setMerchantDeptId(v);
dto.setAction(MqttActionEnum.SUPERMARKET);
mqttEventService.defaultAction(dto);
}
return R.ok(true);
}
/**
* 人脸变化
*/
@@ -52,6 +52,18 @@ public class WalletManageController {
private final WalletManageMapper walletManageMapper;
/* ************************************* start android start ************************************* */
@Operation(summary = "根据短码查询加密信息", description = "根据短码查询加密信息")
@GetMapping("/ad/wallet/list")
public R<List<WalletManageVo>> adWalletList(@RequestParam Long userId) {
WalletManageDto dto = new WalletManageDto();
dto.setUserId(userId);
return R.ok(walletManageMapper.joinList(dto));
}
/* ************************************* end android end ************************************* */
/* ************************************* start 远程调用 start ************************************* */
@Inner
@GetMapping("/get-or-create-wallet")