Merge remote-tracking branch 'origin/master'

This commit is contained in:
zjf committed 2026-08-10 00:07:37 +08:00
commit 17015621e1
11 files changed
+170 -159

No files matched your search

+4 -1
View File
@@ -1,4 +1,7 @@
MYSQL_HOST=123.157.250.162
MYSQL_PORT=33905
MYSQL_USER=root@sys
MYSQL_PWD=bsd.1799
MYSQL_PWD=bsd.1799
NACOS_HOST=127.0.0.1
NACOS_PORT=8848
@@ -30,28 +30,32 @@
<result property="hourType" column="hour_type"/>
<result property="isPriceIncreased" column="is_price_increased"/>
</resultMap>
<select id="selectTimeFood" resultType="com.bsd.pjcloud.canteen.vo.DailyMenuVO">
SELECT
DISTINCT(sp.id),
t.id as tid,
<select id="selectTimeFood"
resultType="com.bsd.pjcloud.canteen.vo.DailyMenuVO">
SELECT DISTINCT
sp.id,
t.id AS tid,
sp.name,
sp.pic_url,
t.hour_type,
sp.price,
sp.category_id
sp.category_id,
sp.sort
FROM canteen_daily_menu t
LEFT JOIN canteen_spu sp
on t.spu_id=sp.id
ON t.spu_id = sp.id
<where>
AND t.merchant_id = #{merchantId}
<if test="categoryId != null">
AND sp.category_id = #{categoryId}
</if>
AND sp.del_flag = 0
AND t.start_time = #{time}
And t.del_flag = 0
AND t.del_flag = 0
</where>
order by sp.sort asc
ORDER BY sp.sort ASC
</select>
<select id="getCanteenMenuList" resultMap="adCanteenDailyMenuListVO">
SELECT
@@ -57,11 +57,25 @@ public interface HardOrderMapper extends PjcloudBaseMapper<HardOrderEntity> {
}
default Page<HardOrderVo> pageJoin(Page page, HardOrderDto dto) {
MPJLambdaWrapper<HardOrderEntity> wrapper = new MPJLambdaWrapper<HardOrderEntity>()
.selectAll(HardOrderEntity.class)
MPJLambdaWrapper<HardOrderEntity> wrapper = new MPJLambdaWrapper<HardOrderEntity>("a")
.selectAll(HardOrderEntity.class, HardOrderEntity::getMerchantType)
.selectAs("coalesce(mch.types, a.merchant_type)", HardOrderVo::getMerchantType)
.selectAs(HardManagerEntity::getName, HardOrderVo::getHardName)
.selectAs(HardManagerEntity::getType, HardOrderVo::getHardType)
.selectAs("u.name", HardOrderVo::getUsername)
.selectAs("u.phone", HardOrderVo::getUserMobile)
.selectAs("u.avatar", HardOrderVo::getUserAvatar)
.selectAs("user_dept.name", HardOrderVo::getUserDeptName)
.selectAs("mch.name", HardOrderVo::getMerchantName)
.selectAs("mch.logo_pic", HardOrderVo::getLogoPic)
.selectAs("w_m.wallet_type_id", HardOrderVo::getWalletTypeId)
.selectAs("w_t.unique_code", HardOrderVo::getWalletTypeUniqueCode)
.leftJoin(HardManagerEntity.class, HardManagerEntity::getId, HardOrderEntity::getHardId)
.leftJoin("pjcloudx.sys_user u ON u.user_id = a.user_id AND u.tenant_id = a.tenant_id AND u.del_flag = '0'")
.leftJoin("pjcloudx.sys_dept user_dept ON user_dept.dept_id = a.user_dept_id AND user_dept.tenant_id = a.tenant_id AND user_dept.del_flag = '0'")
.leftJoin("pjcloudx_wallet.mch_manage mch ON mch.id = a.merchant_id AND mch.tenant_id = a.tenant_id AND mch.del_flag = '0'")
.leftJoin("pjcloudx_wallet.wallet_manage w_m ON w_m.id = a.wallet_id AND w_m.tenant_id = a.tenant_id AND w_m.del_flag = '0'")
.leftJoin("pjcloudx_wallet.wallet_type w_t ON w_t.id = w_m.wallet_type_id AND w_t.tenant_id = a.tenant_id AND w_t.del_flag = '0'")
.eqIfExists(HardOrderEntity::getMerchantId, dto.getMerchantId())
.eqIfExists(HardOrderEntity::getUserId, dto.getUserId())
.eqIfExists(HardOrderEntity::getDeptId, dto.getDeptId())
@@ -179,4 +193,4 @@ public interface HardOrderMapper extends PjcloudBaseMapper<HardOrderEntity> {
List<PanelPorductVo> shopGroupByTimeAndHourType(@Param("dto") PanelProductDto dto);
List<PanelPorductVo> shopGroupByProduct(@Param("dto") PanelProductDto dto);
}
}
@@ -10,9 +10,7 @@ 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.dto.UserInfo;
import com.bsd.pjcloud.admin.api.entity.SysDept;
import com.bsd.pjcloud.admin.api.entity.SysUser;
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.admin.api.vo.UserVO;
@@ -38,7 +36,6 @@ import com.bsd.pjcloud.hard.api.dto.ali.AliMicropayDto;
import com.bsd.pjcloud.hard.api.dto.ali.AliReverseDto;
import com.bsd.pjcloud.hard.api.dto.hard.HandCancelActCodeDto;
import com.bsd.pjcloud.hard.api.dto.hard.HardDoneHardQrCodeScanOrderDto;
import com.bsd.pjcloud.hard.api.dto.manager.HardManagerDto;
import com.bsd.pjcloud.hard.api.dto.hard.HandCancelCodeDto;
import com.bsd.pjcloud.hard.api.dto.hard.HardCreateOrderDto;
import com.bsd.pjcloud.hard.api.dto.order.HardCreateCarDto;
@@ -56,7 +53,6 @@ import com.bsd.pjcloud.hard.api.entity.order.HardCarEntity;
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
import com.bsd.pjcloud.hard.api.entity.order.HardParentCarEntity;
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
import com.bsd.pjcloud.hard.api.utils.HardUtil;
import com.bsd.pjcloud.hard.api.vo.HardDoorFlowVo;
import com.bsd.pjcloud.hard.api.vo.manager.HardManagerVo;
import com.bsd.pjcloud.hard.api.vo.order.HardCarVo;
@@ -64,10 +60,8 @@ import com.bsd.pjcloud.hard.api.vo.order.HardCreateHardQrCodeScanOrderVo;
import com.bsd.pjcloud.hard.api.vo.order.HardOrderVo;
import com.bsd.pjcloud.hard.api.vo.wechat.WechatMicropayVo;
import com.bsd.pjcloud.hard.mapper.HardThirdMiOrderMapper;
import com.bsd.pjcloud.hard.mapper.manager.HardManagerMapper;
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
import com.bsd.pjcloud.hard.service.*;
import com.bsd.pjcloud.hard.utils.RemoteBatchQueryUtil;
import com.bsd.pjcloud.supermarket.api.feign.RemoteMallProductService;
import com.bsd.pjcloud.supermarket.api.feign.RemoteShopSkuService;
import com.bsd.pjcloud.supermarket.api.feign.RemoteSupermarketSpuService;
@@ -107,8 +101,6 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import java.math.BigDecimal;
import java.math.RoundingMode;
@@ -117,6 +109,7 @@ import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* 订单表
@@ -150,7 +143,6 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
private final RemoteWalletTransactionService walletTransactionService;
private final RemoteWalletSettingService walletSettingService;
private final RemoteUserService userService;
private final RemoteDeptService deptService;
private final RemoteMchRuleJoinService mchRuleJoinService;
private final RemoteOnlineCanteenSpuService onlineCanteenSpuService;
@@ -161,7 +153,6 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
private final RemoteActCouponCancelService remoteActCouponCancelService;
private final RemoteMallProductService remoteMallProductService;
private final HardManagerMapper hardManagerMapper;
private final YyxService yyxService;
private final StringRedisTemplate redisTemplate;
@@ -1719,91 +1710,25 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
private void disposeList(List<HardOrderVo> list, HardOrderDto dto) {
if (ObjectUtil.isEmpty(list)) return;
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
// 用户部门
CompletableFuture<Void> deptFuture = CompletableFuture.runAsync(() -> {
RequestContextHolder.setRequestAttributes(requestAttributes);
List<Long> userIds = list.stream().map(HardOrderVo::getUserId).filter(ObjectUtil::isNotEmpty).distinct().toList();
if (ObjectUtil.isNotEmpty(userIds)) {
List<UserVO> userList = userService.getUserDeptByIds(userIds).getData();
if (ObjectUtil.isNotEmpty(userList)) {
Map<Long, UserVO> map = CollectionUtils.convertMap(userList, UserVO::getUserId);
for (HardOrderVo item : list) {
UserVO userVO = map.get(item.getUserId());
if (ObjectUtil.isEmpty(userVO)) continue;
item.setUsername(userVO.getName());
item.setUserMobile(userVO.getPhone());
item.setUserAvatar(userVO.getAvatar());
}
}
}
});
// 当前部门
CompletableFuture<Void> currentDeptFuture = CompletableFuture.runAsync(() -> {
RequestContextHolder.setRequestAttributes(requestAttributes);
List<Long> deptIds = list.stream().map(HardOrderVo::getUserDeptId).filter(ObjectUtil::isNotEmpty).distinct().toList();
if (ObjectUtil.isNotEmpty(deptIds)) {
Map<Long, SysDept> deptList = deptService.getDeptByDeptIds(deptIds).getData();
if (ObjectUtil.isNotEmpty(deptList)) {
for (HardOrderVo item : list) {
SysDept dept = deptList.get(item.getUserDeptId());
if (ObjectUtil.isEmpty(dept)) continue;
item.setUserDeptName(dept.getName());
}
}
}
});
// 商户
CompletableFuture<Void> mchFuture = CompletableFuture.runAsync(() -> {
RequestContextHolder.setRequestAttributes(requestAttributes);
List<Long> mchIds = list.stream().map(HardOrderVo::getMerchantId).filter(ObjectUtil::isNotEmpty).distinct().toList();
if (ObjectUtil.isNotEmpty(mchIds)) {
R<List<MchManageVo>> mchList = remoteMchService.getByIds(mchIds);
if (ObjectUtil.isNotEmpty(mchList.getData())) {
WalletDataUtil.convertMchList(list, CollectionUtils.convertMap(mchList.getData(), MchManageVo::getId));
}
}
});
// 设备
CompletableFuture<Void> deviceFuture = CompletableFuture.runAsync(() -> {
RequestContextHolder.setRequestAttributes(requestAttributes);
List<Long> hardIds = list.stream().map(HardOrderVo::getHardId).filter(ObjectUtil::isNotEmpty).distinct().toList();
if (ObjectUtil.isNotEmpty(hardIds)) {
HardManagerDto hardManagerDto = new HardManagerDto();
hardManagerDto.setIds(hardIds);
List<HardManagerEntity> hardList = hardManagerMapper.list(hardManagerDto);
if (ObjectUtil.isNotEmpty(hardList)) {
HardUtil.convertHardList(list, CollectionUtils.convertMap(hardList, HardManagerEntity::getId));
}
}
});
// 钱包
CompletableFuture<Void> walletFuture = CompletableFuture.runAsync(() -> {
RequestContextHolder.setRequestAttributes(requestAttributes);
List<Long> walletIds = list.stream().map(HardOrderVo::getWalletId).filter(ObjectUtil::isNotEmpty).distinct().toList();
if (ObjectUtil.isNotEmpty(walletIds)) {
List<WalletManageVo> walletList = getWalletListByIds(walletIds);
Map<Long, WalletManageVo> walletMap = CollectionUtils.convertMap(walletList, WalletManageVo::getId);
for (HardOrderVo v : list) {
WalletManageVo target = walletMap.get(v.getWalletId());
if (ObjectUtil.isEmpty(target)) continue;
v.setWalletTypeUniqueCode(target.getWalletTypeUniqueCode());
}
}
});
// 购物车
if (dto.getIsFindCarList()) {
for (HardOrderVo v : list) {
if (ObjectUtil.isEmpty(v.getParentCarId())) continue;
List<HardCarEntity> carList = hardCarService.getByParentCarId(v.getParentCarId());
List<HardCarVo> carVoList = BeanUtils.toBean(carList, HardCarVo.class);
v.setCarList(carVoList);
}
}
CompletableFuture.allOf(deptFuture, mchFuture, deviceFuture, currentDeptFuture, walletFuture).join();
}
if (!Boolean.TRUE.equals(dto.getIsFindCarList())) return;
private List<WalletManageVo> getWalletListByIds(List<Long> walletIds) {
return RemoteBatchQueryUtil.queryByIds(walletIds, ids -> remoteWalletService.getWalletByIds(ids).getData());
List<Long> parentCarIds = list.stream()
.map(HardOrderVo::getParentCarId)
.filter(ObjectUtil::isNotEmpty)
.distinct()
.toList();
if (ObjectUtil.isEmpty(parentCarIds)) return;
List<HardCarVo> carList = BeanUtils.toBean(
hardCarService.list(new LambdaQueryWrapper<HardCarEntity>()
.in(HardCarEntity::getParentCarId, parentCarIds)),
HardCarVo.class
);
Map<Long, List<HardCarVo>> carMap = carList.stream()
.collect(Collectors.groupingBy(HardCarVo::getParentCarId));
for (HardOrderVo order : list) {
if (ObjectUtil.isEmpty(order.getParentCarId())) continue;
order.setCarList(carMap.getOrDefault(order.getParentCarId(), Collections.emptyList()));
}
}
}
@@ -3,7 +3,8 @@ package com.bsd.pjcloud.hard.service.impl.yyx;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSON;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -40,6 +41,7 @@ public class YyxServiceImpl implements YyxService {
public void send(Long mchId, Integer payPrice, String phone) {
try {
if (!ObjectUtil.isAllNotEmpty(mchId, payPrice, phone)) {
log.warn("|{}|发送语音跳过,参数不完整,mchId:|{}|payPrice:|{}|phone:|{}|", TAG, mchId, payPrice, phone);
return;
}
// 查询商户绑定的云音箱设备
@@ -47,6 +49,7 @@ public class YyxServiceImpl implements YyxService {
.in(HardManagerEntity::getType, List.of(HardTypeEnum.YYX.getType(), HardTypeEnum.YYX_WIFI.getType()))
);
if (ObjectUtil.isEmpty(yyxList)) {
log.info("|{}|发送语音跳过,商户未绑定云音箱,mchId:|{}|payPrice:|{}|phone:|{}|", TAG, mchId, payPrice, phone);
return;
}
@@ -71,13 +74,17 @@ public class YyxServiceImpl implements YyxService {
}
});
} catch (Exception e) {
log.error("|{}|发送失败,异常:{}", TAG, e.getMessage());
log.error("|{}|发送语音异常,mchId:|{}|payPrice:|{}|phone:|{}|", TAG, mchId, payPrice, phone, e);
}
}
// 发送语音
private boolean yyx4gHttpSend(String deviceId, String msg) {
String msgid = LocalDateTime.now().toEpochSecond(ZoneOffset.UTC) + RandomUtil.randomString(8);
String url = yyxConf.getUrl();
String requestBody = null;
String responseBody = null;
long startTime = System.currentTimeMillis();
try {
HashMap<String, Object> data = new HashMap<>();
data.put("cmd", "voice");
@@ -88,20 +95,30 @@ public class YyxServiceImpl implements YyxService {
body.put("sbx_id", deviceId);
body.put("agent_id", JSONUtil.toJsonStr(data));
String res = HttpUtil.post(yyxConf.getUrl(), JSONUtil.toJsonStr(body));
if (ObjectUtil.isEmpty(res)) {
log.error("|{}|4G版云音箱发送语音,发送失败,返回结果为空", TAG);
requestBody = JSONUtil.toJsonStr(body);
log.info("|{}|4G版云音箱发送语音,请求开始,url:|{}|deviceId:|{}|msgid:|{}|msg:|{}|requestBody:|{}|", TAG, url, deviceId, msgid, msg, requestBody);
try (HttpResponse response = HttpRequest.post(url).body(requestBody).execute()) {
responseBody = response.body();
log.info("|{}|4G版云音箱发送语音,请求完成,url:|{}|deviceId:|{}|msgid:|{}|httpStatus:|{}|contentType:|{}|timeConsumingMs:|{}|responseBody:|{}|", TAG, url, deviceId, msgid, response.getStatus(), response.header("Content-Type"), System.currentTimeMillis() - startTime, responseBody);
if (!response.isOk()) {
log.error("|{}|4G版云音箱发送语音,HTTP请求失败,url:|{}|deviceId:|{}|msgid:|{}|httpStatus:|{}|responseBody:|{}|", TAG, url, deviceId, msgid, response.getStatus(), responseBody);
return false;
}
}
if (ObjectUtil.isEmpty(responseBody)) {
log.error("|{}|4G版云音箱发送语音,发送失败,返回结果为空,url:|{}|deviceId:|{}|msgid:|{}|requestBody:|{}|", TAG, url, deviceId, msgid, requestBody);
return false;
}
JSON resJson = JSONUtil.parse(res);
JSON resJson = JSONUtil.parse(responseBody);
String requestId = resJson.getByPath("RequestId", String.class);
if (ObjectUtil.isEmpty(requestId)) {
log.error("|{}|4G版云音箱发送语音,发送失败,返回结果错误res:|{}|", res, TAG);
log.error("|{}|4G版云音箱发送语音,发送失败,响应缺少RequestId,url:|{}|deviceId:|{}|msgid:|{}|requestBody:|{}|responseBody:|{}|", TAG, url, deviceId, msgid, requestBody, responseBody);
}
return true;
} catch (Exception e) {
e.printStackTrace();
log.error("|{}|4G版云音箱发送语音,发送失败,异常:{}", TAG, e.getMessage());
log.error("|{}|4G版云音箱发送语音异常,url:|{}|deviceId:|{}|msgid:|{}|msg:|{}|requestBody:|{}|responseBody:|{}|timeConsumingMs:|{}|", TAG, url, deviceId, msgid, msg, requestBody, responseBody, System.currentTimeMillis() - startTime, e);
return false;
}
}
@@ -35,29 +35,31 @@
</if>
</sql>
<select id="getByCarPrentId" resultType="com.bsd.pjcloud.hard.api.entity.order.HardAfterSaleCarEntity">
select a.id,
a.refund_id,
a.parent_car_id,
<select id="getByCarPrentId"
resultType="com.bsd.pjcloud.hard.api.entity.order.HardAfterSaleCarEntity">
SELECT
MIN(a.id) AS id,
MIN(a.refund_id) AS refund_id,
MIN(a.parent_car_id) AS parent_car_id,
a.product_id,
a.product_name,
a.product_pic,
a.product_nature,
a.product_price,
sum(a.product_count) as productCount,
sum(a.product_weight) as productWeight,
sum(a.total_price) as totalPrice,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.del_flag,
a.tenant_id
from hard_after_sale_car a
MIN(a.product_name) AS product_name,
MIN(a.product_pic) AS product_pic,
MIN(a.product_nature) AS product_nature,
MIN(a.product_price) AS product_price,
SUM(a.product_count) AS product_count,
SUM(a.product_weight) AS product_weight,
SUM(a.total_price) AS total_price,
MIN(a.create_by) AS create_by,
MIN(a.create_time) AS create_time,
MIN(a.update_by) AS update_by,
MIN(a.update_time) AS update_time,
MIN(a.del_flag) AS del_flag,
MIN(a.tenant_id) AS tenant_id
FROM hard_after_sale_car a
<where>
a.del_flag = '0'
and a.parent_car_id = #{carParentId}
AND a.parent_car_id = #{carParentId}
</where>
group by a.product_id
GROUP BY a.product_id
</select>
</mapper>
@@ -203,7 +203,7 @@
a.user_id,
a.user_dept_id,
a.merchant_id,
a.merchant_type,
coalesce(mch.types, a.merchant_type) as merchant_type,
a.merchant_dept_id,
a.hard_id,
a.dept_id,
@@ -239,11 +239,36 @@
m.name as hardName,
m.type as hardType,
m.dept_id as hardTypeDeptId,
u.name as username,
u.phone as userMobile,
u.avatar as userAvatar,
user_dept.name as userDeptName,
mch.name as merchantName,
mch.logo_pic as logoPic,
s.id as afterSaleId,
s.no as afterSaleNo,
w_m.wallet_type_id as walletTypeId
from (select a.id
w_m.wallet_type_id as walletTypeId,
w_t.unique_code as walletTypeUniqueCode
from hard_order a
left join hard_manager m
on m.id = a.hard_id and m.tenant_id = a.tenant_id and m.del_flag = '0'
left join pjcloudx.sys_user u
on u.user_id = a.user_id and u.tenant_id = a.tenant_id and u.del_flag = '0'
left join pjcloudx.sys_dept user_dept
on user_dept.dept_id = a.user_dept_id and user_dept.tenant_id = a.tenant_id and user_dept.del_flag = '0'
left join pjcloudx_wallet.mch_manage mch
on mch.id = a.merchant_id and mch.tenant_id = a.tenant_id and mch.del_flag = '0'
left join pjcloudx_wallet.wallet_manage w_m
on w_m.id = a.wallet_id and w_m.tenant_id = a.tenant_id and w_m.del_flag = '0'
left join pjcloudx_wallet.wallet_type w_t
on w_t.id = w_m.wallet_type_id and w_t.tenant_id = a.tenant_id and w_t.del_flag = '0'
left join (select tenant_id, order_id, max(id) as id
from hard_after_sale
where del_flag = '0'
group by tenant_id, order_id) sx
on sx.order_id = a.id and sx.tenant_id = a.tenant_id
left join hard_after_sale s
on s.id = sx.id and s.tenant_id = a.tenant_id and s.del_flag = '0'
<where>
<include refid="whereA"/>
<if test="dto.hardTypeCode != null and dto.hardTypeCode != '' ">
@@ -258,17 +283,6 @@
<if test="dto.afterSaleNo != null and dto.afterSaleNo != ''">
and s.no = #{dto.afterSaleNo}
</if>
</where>
order by a.create_time desc, a.user_id desc) t
join hard_order a on a.id = t.id
left join hard_manager m on m.id = a.hard_id
left join pjcloudx_wallet.wallet_manage w_m on w_m.id = a.wallet_id
left join (select order_id, max(id) as id
from hard_after_sale
where tenant_id = 1
group by order_id) sx on sx.order_id = a.id
left join hard_after_sale s on s.id = sx.id
<where>
<if test="dto.walletTypeId != null">
and w_m.wallet_type_id = #{dto.walletTypeId}
</if>
@@ -1086,4 +1100,4 @@
</if>
</select>
</mapper>
</mapper>
@@ -213,25 +213,31 @@ public class ThirdDoorApiServiceImpl implements ThirdDoorApiService {
DoorBaseVo doorBaseVo = new DoorBaseVo();
DoorApi.Api api = DoorApi.OPEN.setBaseUrl(doorConfig.getBaseUrl());
ThirdDoorLogEntity logEntity = api.getInitLogEntity();
String requestUrl = api.getBaseUrl() + api.getUrl();
String body = null;
Map<String, List<String>> requestHeaders = null;
try {
dto.setLockNotifyUrl(doorConfig.getCallbackBaseUrl() + doorConfig.getCallbackLockUrl());
dto.setVideoNotifyUrl(doorConfig.getCallbackBaseUrl() + doorConfig.getCallbackVideoUrl());
logEntity.setReq(JSONUtil.toJsonStr(dto));
String body = JSONUtil.toJsonStr(dto);
String res = api.getHttpRequest().header(apiCountersign(body)).body(body).execute().body();
body = JSONUtil.toJsonStr(dto);
requestHeaders = apiCountersign(body);
String res = api.getHttpRequest().header(requestHeaders).body(body).execute().body();
if (ObjectUtil.isEmpty(res)) throw new RuntimeException("response响应为空");
logEntity.setRes(res);
doorBaseVo = JSONUtil.toBean(res, DoorBaseVo.class);
if (!doorBaseVo.isSuccess()) {
String errorLog = String.format("请求错误res|%s|url|%s|body|%s|", res, api, body);
String errorLog = String.format("|%s||open|请求错误|url|%s|headers|%s|body|%s|res|%s|", TAG, requestUrl, JSONUtil.toJsonStr(requestHeaders), body, res);
log.error(errorLog);
logEntity.setError(errorLog);
DoorOpenVo errorVo = new DoorOpenVo();
errorVo.setMessage(doorBaseVo.getMessage());
return errorVo;
}
} catch (Exception e) {
String error = String.format("|%s||volume|意外的错误error|%s|stack|%s|", TAG, e.getMessage(), Arrays.toString(e.getStackTrace()));
log.error(error);
String error = String.format("|%s||open|意外错误|url|%s|headers|%s|body|%s|exception|%s|message|%s|",
TAG, requestUrl, JSONUtil.toJsonStr(requestHeaders), body, e.getClass().getName(), e.getMessage());
log.error(error, e);
logEntity.setError(error);
} finally {
logEntity.setTimeConsuming(Long.toString(System.currentTimeMillis() - startTime));
@@ -188,6 +188,13 @@ public class MchManageController {
return R.ok();
}
@Operation(summary = "刷新全部商户二维码", description = "刷新全部商户二维码")
@GetMapping("/refresh-all-qrcode")
@PreAuthorize("@pms.hasPermission('wallet_mchManage_refresh_qrcode')")
public R<Integer> refreshAllQrcode() {
return R.ok(mchManageService.refreshAllQrcode());
}
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
@PreAuthorize("@pms.hasPermission('wallet_mchManage_view')")
@@ -258,4 +265,4 @@ public class MchManageController {
public List<MchManageEntity> export(MchManageEntity mchManage, Long[] ids) {
return mchManageService.list(Wrappers.lambdaQuery(mchManage).in(ArrayUtil.isNotEmpty(ids), MchManageEntity::getId, ids));
}
}
}
@@ -54,6 +54,13 @@ public interface MchManageService extends IService<MchManageEntity> {
*/
void refreshQrcode(Long mchId);
/**
* 刷新全部商户二维码
*
* @return 处理的商户数量
*/
int refreshAllQrcode();
/**
* 宁波银行登录
*/
@@ -63,4 +70,4 @@ public interface MchManageService extends IService<MchManageEntity> {
* 判断用户是否能查看到所有食堂
*/
boolean getIsConsumeUser(Long id);
}
}
@@ -362,6 +362,18 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
}
}
/**
* 刷新全部商户二维码
*/
@Override
public int refreshAllQrcode() {
List<MchManageEntity> mchList = baseMapper.selectList(
new LambdaQueryWrapper<MchManageEntity>().select(MchManageEntity::getId)
);
mchList.forEach(mch -> refreshQrcode(mch.getId()));
return mchList.size();
}
/**
* 宁波银行登录
*/
@@ -477,4 +489,4 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
private MchManageServiceImpl getSelf() {
return SpringUtil.getBean(getClass());
}
}
}