订单管理--修改
parent
693839a486
commit
29e43885c5
|
@ -75,17 +75,5 @@
|
||||||
<groupId>com.github.pagehelper</groupId>
|
<groupId>com.github.pagehelper</groupId>
|
||||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
|
||||||
<artifactId>yudao-module-member-biz</artifactId>
|
|
||||||
<version>1.7.2-snapshot</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
|
||||||
<artifactId>yudao-module-system-biz</artifactId>
|
|
||||||
<version>1.7.2-snapshot</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
|
@ -1,5 +1,6 @@
|
||||||
package cn.iocoder.yudao.module.shop.service.order.impl;
|
package cn.iocoder.yudao.module.shop.service.order.impl;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrderInfo;
|
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrderInfo;
|
||||||
import cn.iocoder.yudao.module.shop.dal.mysql.order.StoreOrderInfoMapper;
|
import cn.iocoder.yudao.module.shop.dal.mysql.order.StoreOrderInfoMapper;
|
||||||
import cn.iocoder.yudao.module.shop.service.order.StoreOrderInfoService;
|
import cn.iocoder.yudao.module.shop.service.order.StoreOrderInfoService;
|
||||||
|
@ -7,7 +8,6 @@ import cn.iocoder.yudao.module.shop.service.product.StoreProductReplyService;
|
||||||
import cn.iocoder.yudao.module.shop.vo.order.OrderInfoDetailVo;
|
import cn.iocoder.yudao.module.shop.vo.order.OrderInfoDetailVo;
|
||||||
import cn.iocoder.yudao.module.shop.vo.order.StoreOrderInfoOldVo;
|
import cn.iocoder.yudao.module.shop.vo.order.StoreOrderInfoOldVo;
|
||||||
import cn.iocoder.yudao.module.shop.vo.order.StoreOrderInfoVo;
|
import cn.iocoder.yudao.module.shop.vo.order.StoreOrderInfoVo;
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
@ -58,7 +58,7 @@ public class StoreOrderInfoServiceImpl extends ServiceImpl<StoreOrderInfoMapper,
|
||||||
//解析商品详情JSON
|
//解析商品详情JSON
|
||||||
StoreOrderInfoOldVo StoreOrderInfoVo = new StoreOrderInfoOldVo();
|
StoreOrderInfoOldVo StoreOrderInfoVo = new StoreOrderInfoOldVo();
|
||||||
BeanUtils.copyProperties(storeOrderInfo, StoreOrderInfoVo, "info");
|
BeanUtils.copyProperties(storeOrderInfo, StoreOrderInfoVo, "info");
|
||||||
StoreOrderInfoVo.setInfo(JSON.parseObject(storeOrderInfo.getInfo(), OrderInfoDetailVo.class));
|
StoreOrderInfoVo.setInfo(JSONUtil.toBean(storeOrderInfo.getInfo(), OrderInfoDetailVo.class));
|
||||||
if(map.containsKey(storeOrderInfo.getOrderId())){
|
if(map.containsKey(storeOrderInfo.getOrderId())){
|
||||||
map.get(storeOrderInfo.getOrderId()).add(StoreOrderInfoVo);
|
map.get(storeOrderInfo.getOrderId()).add(StoreOrderInfoVo);
|
||||||
}else{
|
}else{
|
||||||
|
@ -84,7 +84,7 @@ public class StoreOrderInfoServiceImpl extends ServiceImpl<StoreOrderInfoMapper,
|
||||||
//解析商品详情JSON
|
//解析商品详情JSON
|
||||||
StoreOrderInfoOldVo storeOrderInfoVo = new StoreOrderInfoOldVo();
|
StoreOrderInfoOldVo storeOrderInfoVo = new StoreOrderInfoOldVo();
|
||||||
BeanUtils.copyProperties(storeOrderInfo, storeOrderInfoVo, "info");
|
BeanUtils.copyProperties(storeOrderInfo, storeOrderInfoVo, "info");
|
||||||
storeOrderInfoVo.setInfo(JSON.parseObject(storeOrderInfo.getInfo(), OrderInfoDetailVo.class));
|
storeOrderInfoVo.setInfo(JSONUtil.toBean(storeOrderInfo.getInfo(), OrderInfoDetailVo.class));
|
||||||
storeOrderInfoVo.getInfo().setIsReply(
|
storeOrderInfoVo.getInfo().setIsReply(
|
||||||
storeProductReplyService.isReply(storeOrderInfoVo.getUnique(), storeOrderInfoVo.getOrderId()) ? 1 : 0
|
storeProductReplyService.isReply(storeOrderInfoVo.getUnique(), storeOrderInfoVo.getOrderId()) ? 1 : 0
|
||||||
);
|
);
|
||||||
|
@ -140,7 +140,7 @@ public class StoreOrderInfoServiceImpl extends ServiceImpl<StoreOrderInfoMapper,
|
||||||
//解析商品详情JSON
|
//解析商品详情JSON
|
||||||
StoreOrderInfoVo storeOrderInfoVo = new StoreOrderInfoVo();
|
StoreOrderInfoVo storeOrderInfoVo = new StoreOrderInfoVo();
|
||||||
BeanUtils.copyProperties(storeOrderInfo, storeOrderInfoVo, "info");
|
BeanUtils.copyProperties(storeOrderInfo, storeOrderInfoVo, "info");
|
||||||
storeOrderInfoVo.setInfo(JSON.parseObject(storeOrderInfo.getInfo(), OrderInfoDetailVo.class));
|
storeOrderInfoVo.setInfo(JSONUtil.toBean(storeOrderInfo.getInfo(), OrderInfoDetailVo.class));
|
||||||
storeOrderInfoVoList.add(storeOrderInfoVo);
|
storeOrderInfoVoList.add(storeOrderInfoVo);
|
||||||
}
|
}
|
||||||
return storeOrderInfoVoList;
|
return storeOrderInfoVoList;
|
||||||
|
|
|
@ -2,20 +2,14 @@ package cn.iocoder.yudao.module.shop.service.order.impl;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.Constants;
|
import cn.iocoder.yudao.framework.common.enums.Constants;
|
||||||
import cn.iocoder.yudao.module.infra.api.config.ApiConfigApi;
|
import cn.iocoder.yudao.module.infra.api.config.ApiConfigApi;
|
||||||
import cn.iocoder.yudao.module.shop.constants.PayConstants;
|
|
||||||
import cn.iocoder.yudao.module.shop.controller.admin.order.vo.WxRefundVo;
|
|
||||||
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder;
|
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder;
|
||||||
import cn.iocoder.yudao.module.shop.dal.mysql.order.StoreOrderMapper;
|
import cn.iocoder.yudao.module.shop.dal.mysql.order.StoreOrderMapper;
|
||||||
import cn.iocoder.yudao.module.shop.request.order.StoreOrderRefundRequest;
|
import cn.iocoder.yudao.module.shop.request.order.StoreOrderRefundRequest;
|
||||||
import cn.iocoder.yudao.module.shop.service.order.StoreOrderRefundService;
|
import cn.iocoder.yudao.module.shop.service.order.StoreOrderRefundService;
|
||||||
import cn.iocoder.yudao.module.shop.service.wechat.WechatNewService;
|
|
||||||
import cn.iocoder.yudao.module.shop.utils.WxPayUtil;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* StoreOrderServiceImpl 接口实现
|
* StoreOrderServiceImpl 接口实现
|
||||||
* +----------------------------------------------------------------------
|
* +----------------------------------------------------------------------
|
||||||
|
@ -34,9 +28,6 @@ public class StoreOrderRefundServiceImpl extends ServiceImpl<StoreOrderMapper, S
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApiConfigApi apiConfigApi;
|
private ApiConfigApi apiConfigApi;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private WechatNewService wechatNewService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refund(StoreOrderRefundRequest request, StoreOrder storeOrder) {
|
public void refund(StoreOrderRefundRequest request, StoreOrder storeOrder) {
|
||||||
refundWx(request, storeOrder);
|
refundWx(request, storeOrder);
|
||||||
|
@ -78,20 +69,7 @@ public class StoreOrderRefundServiceImpl extends ServiceImpl<StoreOrderMapper, S
|
||||||
|
|
||||||
String apiDomain = apiConfigApi.getConfigKey(Constants.CONFIG_KEY_API_URL).toString();
|
String apiDomain = apiConfigApi.getConfigKey(Constants.CONFIG_KEY_API_URL).toString();
|
||||||
|
|
||||||
//统一下单数据
|
// TODO 微信退款
|
||||||
WxRefundVo wxRefundVo = new WxRefundVo();
|
|
||||||
wxRefundVo.setAppid(appId);
|
|
||||||
wxRefundVo.setMch_id(mchId);
|
|
||||||
wxRefundVo.setNonce_str(WxPayUtil.getNonceStr());
|
|
||||||
wxRefundVo.setOut_trade_no(storeOrder.getOutTradeNo());
|
|
||||||
wxRefundVo.setOut_refund_no(storeOrder.getOrderId());
|
|
||||||
wxRefundVo.setTotal_fee(storeOrder.getPayPrice().multiply(BigDecimal.TEN).multiply(BigDecimal.TEN).intValue());
|
|
||||||
wxRefundVo.setRefund_fee(request.getAmount().multiply(BigDecimal.TEN).multiply(BigDecimal.TEN).intValue());
|
|
||||||
wxRefundVo.setNotify_url(apiDomain + PayConstants.WX_PAY_REFUND_NOTIFY_API_URI);
|
|
||||||
String sign = WxPayUtil.getSign(wxRefundVo, signKey);
|
|
||||||
wxRefundVo.setSign(sign);
|
|
||||||
|
|
||||||
wechatNewService.payRefund(wxRefundVo, path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.DateLimitUtilVo;
|
import cn.iocoder.yudao.framework.common.pojo.DateLimitUtilVo;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder;
|
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder;
|
||||||
import cn.iocoder.yudao.module.shop.dal.mysql.order.StoreOrderMapper;
|
import cn.iocoder.yudao.module.shop.dal.mysql.order.StoreOrderMapper;
|
||||||
import cn.iocoder.yudao.module.shop.request.order.StoreOrderRefundRequest;
|
import cn.iocoder.yudao.module.shop.request.order.StoreOrderRefundRequest;
|
||||||
|
@ -28,7 +28,6 @@ import cn.iocoder.yudao.module.shop.utils.RedisUtil;
|
||||||
import cn.iocoder.yudao.module.shop.vo.order.LogisticsResultVo;
|
import cn.iocoder.yudao.module.shop.vo.order.LogisticsResultVo;
|
||||||
import cn.iocoder.yudao.module.shop.vo.order.StoreDateRangeSqlPram;
|
import cn.iocoder.yudao.module.shop.vo.order.StoreDateRangeSqlPram;
|
||||||
import cn.iocoder.yudao.module.shop.vo.order.StoreOrderInfoOldVo;
|
import cn.iocoder.yudao.module.shop.vo.order.StoreOrderInfoOldVo;
|
||||||
import cn.iocoder.yudao.module.system.service.sms.SmsTemplateService;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
@ -73,7 +72,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
private StoreOrderInfoService StoreOrderInfoService;
|
private StoreOrderInfoService StoreOrderInfoService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MemberUserService userService;
|
private MemberUserApi userService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private StoreOrderStatusService storeOrderStatusService;
|
private StoreOrderStatusService storeOrderStatusService;
|
||||||
|
@ -93,9 +92,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
@Autowired
|
@Autowired
|
||||||
private StoreOrderInfoService storeOrderInfoService;
|
private StoreOrderInfoService storeOrderInfoService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SmsTemplateService smsTemplateService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表(PC)
|
* 列表(PC)
|
||||||
*
|
*
|
||||||
|
@ -241,7 +237,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
}
|
}
|
||||||
request.setOrderId(storeOrder.getId());
|
request.setOrderId(storeOrder.getId());
|
||||||
//用户
|
//用户
|
||||||
MemberUserDO user = userService.getUser(storeOrder.getUid());
|
MemberUserRespDTO user = userService.getUser(storeOrder.getUid());
|
||||||
|
|
||||||
//退款
|
//退款
|
||||||
if (storeOrder.getPayType().equals(Constants.PAY_TYPE_WE_CHAT) && request.getAmount().compareTo(BigDecimal.ZERO) > 0) {
|
if (storeOrder.getPayType().equals(Constants.PAY_TYPE_WE_CHAT) && request.getAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
@ -303,7 +299,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//用户信息
|
//用户信息
|
||||||
MemberUserDO user = userService.getUser(storeOrder.getUid());
|
MemberUserRespDTO user = userService.getUser(storeOrder.getUid());
|
||||||
storeOrderInfoResponse.setNikeName(user.getNickname());
|
storeOrderInfoResponse.setNikeName(user.getNickname());
|
||||||
storeOrderInfoResponse.setPhone(user.getMobile());
|
storeOrderInfoResponse.setPhone(user.getMobile());
|
||||||
|
|
||||||
|
@ -371,7 +367,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
storeOrder.setRefundReason(reason);
|
storeOrder.setRefundReason(reason);
|
||||||
storeOrder.setRefundStatus(0);
|
storeOrder.setRefundStatus(0);
|
||||||
|
|
||||||
MemberUserDO user = userService.getUser(storeOrder.getUid());
|
MemberUserRespDTO user = userService.getUser(storeOrder.getUid());
|
||||||
|
|
||||||
Boolean execute = transactionTemplate.execute(e -> {
|
Boolean execute = transactionTemplate.execute(e -> {
|
||||||
updateById(storeOrder);
|
updateById(storeOrder);
|
||||||
|
@ -1266,7 +1262,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
* @param storeOrder 订单
|
* @param storeOrder 订单
|
||||||
*/
|
*/
|
||||||
private void sendGoodsNotify(StoreOrder storeOrder) {
|
private void sendGoodsNotify(StoreOrder storeOrder) {
|
||||||
MemberUserDO user = userService.getUser(storeOrder.getUid());
|
MemberUserRespDTO user = userService.getUser(storeOrder.getUid());
|
||||||
//TODO 发送发货短信提醒
|
//TODO 发送发货短信提醒
|
||||||
|
|
||||||
// 发送消息通知
|
// 发送消息通知
|
||||||
|
@ -1314,7 +1310,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
});
|
});
|
||||||
if (!execute) throw new ServiceException("订单更新送货失败");
|
if (!execute) throw new ServiceException("订单更新送货失败");
|
||||||
|
|
||||||
MemberUserDO user = userService.getUser(storeOrder.getUid());
|
MemberUserRespDTO user = userService.getUser(storeOrder.getUid());
|
||||||
// TODO 发送消息通知
|
// TODO 发送消息通知
|
||||||
// pushMessageDeliveryOrder(storeOrder, user, request, productNameList);
|
// pushMessageDeliveryOrder(storeOrder, user, request, productNameList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ import cn.iocoder.yudao.framework.common.enums.Constants;
|
||||||
import cn.iocoder.yudao.framework.common.exception.ServerException;
|
import cn.iocoder.yudao.framework.common.exception.ServerException;
|
||||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||||
import cn.iocoder.yudao.module.infra.api.config.ApiConfigApi;
|
import cn.iocoder.yudao.module.infra.api.config.ApiConfigApi;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper;
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder;
|
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder;
|
||||||
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrderInfo;
|
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrderInfo;
|
||||||
import cn.iocoder.yudao.module.shop.service.order.StoreOrderInfoService;
|
import cn.iocoder.yudao.module.shop.service.order.StoreOrderInfoService;
|
||||||
|
@ -19,7 +19,6 @@ import cn.iocoder.yudao.module.shop.service.order.StoreOrderStatusService;
|
||||||
import cn.iocoder.yudao.module.shop.service.order.StoreOrderTaskService;
|
import cn.iocoder.yudao.module.shop.service.order.StoreOrderTaskService;
|
||||||
import cn.iocoder.yudao.module.shop.service.product.StoreProductAttrValueService;
|
import cn.iocoder.yudao.module.shop.service.product.StoreProductAttrValueService;
|
||||||
import cn.iocoder.yudao.module.shop.service.product.StoreProductService;
|
import cn.iocoder.yudao.module.shop.service.product.StoreProductService;
|
||||||
import cn.iocoder.yudao.module.system.service.sms.SmsTemplateService;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -61,11 +60,12 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||||
private StoreOrderStatusService storeOrderStatusService;
|
private StoreOrderStatusService storeOrderStatusService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MemberUserMapper memberUserMapper;
|
private MemberUserApi memberUserApi;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TransactionTemplate transactionTemplate;
|
private TransactionTemplate transactionTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
private ApiConfigApi apiConfigApi;
|
private ApiConfigApi apiConfigApi;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -74,9 +74,6 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private StoreProductAttrValueService attrValueService;
|
private StoreProductAttrValueService attrValueService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SmsTemplateService smsTemplateService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {RuntimeException.class, Error.class, ServerException.class})
|
@Transactional(rollbackFor = {RuntimeException.class, Error.class, ServerException.class})
|
||||||
public Boolean cancelByUser(StoreOrder storeOrder) {
|
public Boolean cancelByUser(StoreOrder storeOrder) {
|
||||||
|
@ -144,7 +141,7 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||||
* 实际上2-5就是user数据的处理+userBill的记录
|
* 实际上2-5就是user数据的处理+userBill的记录
|
||||||
*/
|
*/
|
||||||
// 获取用户对象
|
// 获取用户对象
|
||||||
MemberUserDO user = memberUserMapper.selectById(storeOrder.getUid());
|
MemberUserRespDTO user = memberUserApi.getUser(storeOrder.getUid());
|
||||||
if (ObjectUtil.isNull(user)) {
|
if (ObjectUtil.isNull(user)) {
|
||||||
logger.error("订单退款处理,对应的用户不存在,storeOrder===>" + storeOrder);
|
logger.error("订单退款处理,对应的用户不存在,storeOrder===>" + storeOrder);
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
|
@ -159,7 +156,7 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||||
storeOrderStatusService.saveRefund(storeOrder.getId(), storeOrder.getRefundPrice(), "成功");
|
storeOrderStatusService.saveRefund(storeOrder.getId(), storeOrder.getRefundPrice(), "成功");
|
||||||
|
|
||||||
// 更新用户数据
|
// 更新用户数据
|
||||||
memberUserMapper.updateById(user);
|
memberUserApi.updateById(user);
|
||||||
|
|
||||||
// 回滚库存
|
// 回滚库存
|
||||||
rollbackStock(storeOrder);
|
rollbackStock(storeOrder);
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
package cn.iocoder.yudao.module.shop.service.wechat;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.shop.controller.admin.order.vo.WxRefundResponseVo;
|
|
||||||
import cn.iocoder.yudao.module.shop.controller.admin.order.vo.WxRefundVo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信公用服务
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | Author: CRMEB Team <admin@crmeb.com>
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
public interface WechatNewService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信申请退款
|
|
||||||
* @param wxRefundVo 微信申请退款对象
|
|
||||||
* @param path 商户p12证书绝对路径
|
|
||||||
* @return 申请退款结果对象
|
|
||||||
*/
|
|
||||||
WxRefundResponseVo payRefund(WxRefundVo wxRefundVo, String path);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,102 +0,0 @@
|
||||||
package cn.iocoder.yudao.module.shop.service.wechat.impl;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
|
||||||
import cn.iocoder.yudao.module.shop.constants.WeChatConstants;
|
|
||||||
import cn.iocoder.yudao.module.shop.controller.admin.order.vo.WxRefundResponseVo;
|
|
||||||
import cn.iocoder.yudao.module.shop.controller.admin.order.vo.WxRefundVo;
|
|
||||||
import cn.iocoder.yudao.module.shop.service.wechat.WechatNewService;
|
|
||||||
import cn.iocoder.yudao.module.shop.utils.CrmebUtil;
|
|
||||||
import cn.iocoder.yudao.module.shop.utils.RedisUtil;
|
|
||||||
import cn.iocoder.yudao.module.shop.utils.RestTemplateUtil;
|
|
||||||
import cn.iocoder.yudao.module.shop.utils.XmlUtil;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信公用服务实现类
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | Author: CRMEB Team <admin@crmeb.com>
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class WechatNewServiceImpl implements WechatNewService {
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(WechatNewServiceImpl.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RedisUtil redisUtil;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RestTemplateUtil restTemplateUtil;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信申请退款
|
|
||||||
* @param wxRefundVo 微信申请退款对象
|
|
||||||
* @param path 商户p12证书绝对路径
|
|
||||||
* @return 申请退款结果对象
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public WxRefundResponseVo payRefund(WxRefundVo wxRefundVo, String path) {
|
|
||||||
String xmlStr = XmlUtil.objectToXml(wxRefundVo);
|
|
||||||
String url = WeChatConstants.PAY_API_URL + WeChatConstants.PAY_REFUND_API_URI_WECHAT;
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
String xml = "";
|
|
||||||
try {
|
|
||||||
xml = restTemplateUtil.postWXRefundXml(url, xmlStr, wxRefundVo.getMch_id(), path);
|
|
||||||
map = XmlUtil.xmlToMap(xml);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
throw new ServiceException("xmlToMap错误,xml = " + xml);
|
|
||||||
}
|
|
||||||
if (null == map) {
|
|
||||||
throw new ServiceException("微信无信息返回,微信申请退款失败!");
|
|
||||||
}
|
|
||||||
|
|
||||||
WxRefundResponseVo responseVo = CrmebUtil.mapToObj(map, WxRefundResponseVo.class);
|
|
||||||
if (responseVo.getReturnCode().toUpperCase().equals("FAIL")) {
|
|
||||||
// wxPayExceptionDispose(map, "微信申请退款异常1");
|
|
||||||
throw new ServiceException("微信申请退款失败1!" + responseVo.getReturnMsg());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (responseVo.getResultCode().toUpperCase().equals("FAIL")) {
|
|
||||||
// wxPayExceptionDispose(map, "微信申请退款业务异常");
|
|
||||||
throw new ServiceException("微信申请退款失败2!" + responseVo.getErrCodeDes());
|
|
||||||
}
|
|
||||||
System.out.println("================微信申请退款结束=========================");
|
|
||||||
return responseVo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信支付异常处理
|
|
||||||
* @param map 微信返回数据
|
|
||||||
* @param remark 备注
|
|
||||||
*/
|
|
||||||
// private void wxPayExceptionDispose(HashMap<String, Object> map, String remark) {
|
|
||||||
// WechatExceptions wechatExceptions = new WechatExceptions();
|
|
||||||
// String returnCode = (String) map.get("return_code");
|
|
||||||
// if (returnCode.toUpperCase().equals("FAIL")) {
|
|
||||||
// wechatExceptions.setErrcode("-100");
|
|
||||||
// wechatExceptions.setErrmsg(map.get("return_msg").toString());
|
|
||||||
// } else {
|
|
||||||
// wechatExceptions.setErrcode(map.get("err_code").toString());
|
|
||||||
// wechatExceptions.setErrmsg(map.get("err_code_des").toString());
|
|
||||||
// }
|
|
||||||
// wechatExceptions.setData(JSONObject.toJSONString(map));
|
|
||||||
// wechatExceptions.setRemark(remark);
|
|
||||||
// wechatExceptions.setCreateTime(DateUtil.date());
|
|
||||||
// wechatExceptions.setUpdateTime(DateUtil.date());
|
|
||||||
// wechatExceptionsService.save(wechatExceptions);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.shop.utils;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.crypto.SecureUtil;
|
import cn.hutool.crypto.SecureUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.iocoder.yudao.framework.common.enums.Constants;
|
import cn.iocoder.yudao.framework.common.enums.Constants;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
|
@ -62,7 +62,7 @@ public class CrmebUtil {
|
||||||
*/
|
*/
|
||||||
public static <T> T mapToObj(HashMap<String,Object> map, Class<T> clz){
|
public static <T> T mapToObj(HashMap<String,Object> map, Class<T> clz){
|
||||||
if (map == null) return null;
|
if (map == null) return null;
|
||||||
return JSONObject.parseObject(JSONObject.toJSONString(map), clz);
|
return JSONUtil.toBean(JSONUtil.toJsonStr(map), clz);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,111 +0,0 @@
|
||||||
package cn.iocoder.yudao.module.shop.utils;
|
|
||||||
|
|
||||||
import org.apache.http.HttpResponse;
|
|
||||||
import org.apache.http.client.HttpClient;
|
|
||||||
import org.apache.http.client.config.RequestConfig;
|
|
||||||
import org.apache.http.client.methods.HttpPost;
|
|
||||||
import org.apache.http.config.RegistryBuilder;
|
|
||||||
import org.apache.http.conn.socket.ConnectionSocketFactory;
|
|
||||||
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
|
|
||||||
import org.apache.http.conn.ssl.DefaultHostnameVerifier;
|
|
||||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
|
||||||
import org.apache.http.entity.StringEntity;
|
|
||||||
import org.apache.http.impl.client.HttpClientBuilder;
|
|
||||||
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
|
|
||||||
import org.apache.http.util.EntityUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
|
||||||
|
|
||||||
import javax.net.ssl.KeyManagerFactory;
|
|
||||||
import javax.net.ssl.SSLContext;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.security.KeyStore;
|
|
||||||
import java.security.SecureRandom;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | Author: CRMEB Team <admin@crmeb.com>
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* httpClient 工具类
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class RestTemplateUtil {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RestTemplate restTemplate;
|
|
||||||
|
|
||||||
public static final String WXPAYSDK_VERSION = "WXPaySDK/3.0.9";
|
|
||||||
public static final String USER_AGENT = WXPAYSDK_VERSION +
|
|
||||||
" (" + System.getProperty("os.arch") + " " + System.getProperty("os.name") + " " + System.getProperty("os.version") +
|
|
||||||
") Java/" + System.getProperty("java.version") + " HttpClient/" + HttpClient.class.getPackage().getImplementationVersion();
|
|
||||||
/**
|
|
||||||
* 发送POST-JSON请求(微信退款专用)
|
|
||||||
*
|
|
||||||
* @param url
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
|
|
||||||
public String postWXRefundXml(String url, String xml, String mchId, String path) throws Exception {
|
|
||||||
KeyStore clientStore = KeyStore.getInstance("PKCS12");
|
|
||||||
// 读取本机存放的PKCS12证书文件
|
|
||||||
FileInputStream instream = new FileInputStream(path);
|
|
||||||
try {
|
|
||||||
// 指定PKCS12的密码(商户ID)
|
|
||||||
clientStore.load(instream, mchId.toCharArray());
|
|
||||||
} finally {
|
|
||||||
instream.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 实例化密钥库 & 初始化密钥工厂
|
|
||||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
|
|
||||||
kmf.init(clientStore, mchId.toCharArray());
|
|
||||||
|
|
||||||
// 创建 SSLContext
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
|
||||||
sslContext.init(kmf.getKeyManagers(), null, new SecureRandom());
|
|
||||||
|
|
||||||
SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(
|
|
||||||
sslContext,
|
|
||||||
// new String[]{"TLSv1"},
|
|
||||||
// null,
|
|
||||||
new DefaultHostnameVerifier());
|
|
||||||
|
|
||||||
BasicHttpClientConnectionManager connManager = new BasicHttpClientConnectionManager(
|
|
||||||
RegistryBuilder.<ConnectionSocketFactory>create()
|
|
||||||
.register("http", PlainConnectionSocketFactory.getSocketFactory())
|
|
||||||
.register("https", sslConnectionSocketFactory)
|
|
||||||
.build(),
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null
|
|
||||||
);
|
|
||||||
|
|
||||||
HttpClient httpClient = HttpClientBuilder.create()
|
|
||||||
.setConnectionManager(connManager)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
HttpPost httpPost = new HttpPost(url);
|
|
||||||
|
|
||||||
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(8*1000).setConnectTimeout(6*1000).build();
|
|
||||||
httpPost.setConfig(requestConfig);
|
|
||||||
|
|
||||||
StringEntity postEntity = new StringEntity(xml, "UTF-8");
|
|
||||||
httpPost.addHeader("Content-Type", "text/xml");
|
|
||||||
httpPost.addHeader("User-Agent", USER_AGENT + " " + mchId);
|
|
||||||
httpPost.setEntity(postEntity);
|
|
||||||
|
|
||||||
HttpResponse httpResponse = httpClient.execute(httpPost);
|
|
||||||
org.apache.http.HttpEntity httpEntity = httpResponse.getEntity();
|
|
||||||
return EntityUtils.toString(httpEntity, "UTF-8");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,88 +0,0 @@
|
||||||
package cn.iocoder.yudao.module.shop.utils;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.hutool.crypto.SecureUtil;
|
|
||||||
import cn.iocoder.yudao.module.shop.constants.PayConstants;
|
|
||||||
import cn.iocoder.yudao.module.shop.controller.admin.order.vo.WxRefundVo;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信支付工具类
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | Author: CRMEB Team <admin@crmeb.com>
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
public class WxPayUtil {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取sign
|
|
||||||
* @param wxRefundVo 微信退款对象
|
|
||||||
* @param signKey 微信签名key
|
|
||||||
* @return String
|
|
||||||
*/
|
|
||||||
public static String getSign(WxRefundVo wxRefundVo, String signKey) {
|
|
||||||
// 对象转map
|
|
||||||
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(wxRefundVo), Map.class);
|
|
||||||
// map排序
|
|
||||||
Set<String> keySet = map.keySet();
|
|
||||||
String[] keyArray = keySet.toArray(new String[keySet.size()]);
|
|
||||||
Arrays.sort(keyArray);
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
for (String k : keyArray) {
|
|
||||||
if (k.equals(PayConstants.FIELD_SIGN)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotNull(map.get(k))) // 参数值为空,则不参与签名
|
|
||||||
sb.append(k).append("=").append(map.get(k)).append("&");
|
|
||||||
}
|
|
||||||
sb.append("key=").append(signKey);
|
|
||||||
String sign = SecureUtil.md5(sb.toString()).toUpperCase();
|
|
||||||
System.out.println("sign ========== " + sign);
|
|
||||||
return sign;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取sign
|
|
||||||
* @param map 待签名数据
|
|
||||||
* @param signKey 微信签名key
|
|
||||||
* @return String
|
|
||||||
*/
|
|
||||||
public static String getSign(Map<String, String> map, String signKey) {
|
|
||||||
// map排序
|
|
||||||
Set<String> keySet = map.keySet();
|
|
||||||
String[] keyArray = keySet.toArray(new String[keySet.size()]);
|
|
||||||
Arrays.sort(keyArray);
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
for (String k : keyArray) {
|
|
||||||
if (k.equals(PayConstants.FIELD_SIGN)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (StrUtil.isNotBlank(map.get(k)) && map.get(k).trim().length() > 0) // 参数值为空,则不参与签名
|
|
||||||
sb.append(k).append("=").append(map.get(k).trim()).append("&");
|
|
||||||
}
|
|
||||||
sb.append("key=").append(signKey);
|
|
||||||
String sign = SecureUtil.md5(sb.toString()).toUpperCase();
|
|
||||||
System.out.println("sign ========== " + sign);
|
|
||||||
return sign;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取随机字符串,长度要求在32位以内。
|
|
||||||
*/
|
|
||||||
public static String getNonceStr() {
|
|
||||||
return DigestUtils.md5Hex(CrmebUtil.getUuid() + CrmebUtil.randomCount(111111, 666666));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,95 +0,0 @@
|
||||||
package cn.iocoder.yudao.module.shop.utils;
|
|
||||||
|
|
||||||
import com.thoughtworks.xstream.XStream;
|
|
||||||
import com.thoughtworks.xstream.io.naming.NoNameCoder;
|
|
||||||
import com.thoughtworks.xstream.io.xml.Xpp3Driver;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.dom4j.Document;
|
|
||||||
import org.dom4j.DocumentException;
|
|
||||||
import org.dom4j.Element;
|
|
||||||
import org.dom4j.io.SAXReader;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* XML 工具类
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
* | Author: CRMEB Team <admin@crmeb.com>
|
|
||||||
* +----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
public class XmlUtil {
|
|
||||||
public static Map<String, String> xmlToMap(HttpServletRequest request) {
|
|
||||||
Map<String, String> map = new HashMap<>();
|
|
||||||
SAXReader reader = new SAXReader();
|
|
||||||
|
|
||||||
InputStream in = null;
|
|
||||||
try {
|
|
||||||
in = request.getInputStream();
|
|
||||||
Document doc = reader.read(in);
|
|
||||||
Element root = doc.getRootElement();
|
|
||||||
List<Element> list = root.elements();
|
|
||||||
for (Element element : list) {
|
|
||||||
map.put(element.getName(), element.getText());
|
|
||||||
}
|
|
||||||
} catch (IOException | DocumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
assert in != null;
|
|
||||||
in.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将发送消息封装成对应的xml格式
|
|
||||||
*/
|
|
||||||
public static HashMap<String, Object> xmlToMap(String strxml) throws Exception {
|
|
||||||
strxml = strxml.replaceFirst("encoding=\".*\"", "encoding=\"UTF-8\"");
|
|
||||||
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
SAXReader reader = new SAXReader();
|
|
||||||
InputStream inputStream = new ByteArrayInputStream(strxml.getBytes(StandardCharsets.UTF_8));
|
|
||||||
|
|
||||||
if (StringUtils.isBlank(strxml)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Document document = reader.read(inputStream);
|
|
||||||
Element root = document.getRootElement();
|
|
||||||
List<Element> list = root.elements();
|
|
||||||
|
|
||||||
for (Element e : list) {
|
|
||||||
map.put(e.getName(), e.getText());
|
|
||||||
}
|
|
||||||
inputStream.close();
|
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将发送消息封装成对应的xml格式
|
|
||||||
*/
|
|
||||||
public static String objectToXml(Object object) {
|
|
||||||
XStream xstream = new XStream(new Xpp3Driver(new NoNameCoder())); //不需要转义
|
|
||||||
xstream.alias("xml", object.getClass());
|
|
||||||
return xstream.toXML(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -57,4 +57,11 @@ public interface MemberUserApi {
|
||||||
*/
|
*/
|
||||||
MemberUserRespDTO getUserByMobile(String mobile);
|
MemberUserRespDTO getUserByMobile(String mobile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据会员ID更新用户信息
|
||||||
|
* @param member
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int updateById(MemberUserRespDTO member);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,4 +44,9 @@ public class MemberUserApiImpl implements MemberUserApi {
|
||||||
return UserConvert.INSTANCE.convert2(userService.getUserByMobile(mobile));
|
return UserConvert.INSTANCE.convert2(userService.getUserByMobile(mobile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateById(MemberUserRespDTO member) {
|
||||||
|
return userService.updateById(UserConvert.INSTANCE.convert3(member));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ public interface UserConvert {
|
||||||
AppUserInfoRespVO convert(MemberUserDO bean);
|
AppUserInfoRespVO convert(MemberUserDO bean);
|
||||||
AdminUserInfoRespVO convertAdmin(MemberUserDO bean);
|
AdminUserInfoRespVO convertAdmin(MemberUserDO bean);
|
||||||
MemberUserRespDTO convert2(MemberUserDO bean);
|
MemberUserRespDTO convert2(MemberUserDO bean);
|
||||||
|
MemberUserDO convert3(MemberUserRespDTO bean);
|
||||||
|
|
||||||
List<MemberUserRespDTO> convertList2(List<MemberUserDO> list);
|
List<MemberUserRespDTO> convertList2(List<MemberUserDO> list);
|
||||||
|
|
||||||
|
|
|
@ -109,4 +109,11 @@ public interface MemberUserService {
|
||||||
*/
|
*/
|
||||||
PageResult<MemberUserDO> findPageList(AdminUserQueryDTO queryDTO);
|
PageResult<MemberUserDO> findPageList(AdminUserQueryDTO queryDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据会员ID更新用户信息
|
||||||
|
* @param member
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int updateById(MemberUserDO member);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||||
|
@ -159,6 +158,17 @@ public class MemberUserServiceImpl implements MemberUserService {
|
||||||
PageResult<MemberUserDO> commonLableEntityList = memberUserMapper.selectPage(queryDTO);
|
PageResult<MemberUserDO> commonLableEntityList = memberUserMapper.selectPage(queryDTO);
|
||||||
return commonLableEntityList;
|
return commonLableEntityList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据会员ID更新用户信息
|
||||||
|
* @param member
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateById(MemberUserDO member) {
|
||||||
|
return memberUserMapper.updateById(member);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对密码进行加密
|
* 对密码进行加密
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue