Преглед изворни кода

Merge tag 'refs/tags/jenkins-back-end-3271' into SiChuan

release
release_toaliyun_real
Stormeye Wu пре 6 година
родитељ
комит
0fc9b4c34a
18 измењених фајлова са 336 додато и 15 уклоњено
  1. +18
    -0
      mallinkAdmin/src/main/java/com/iformall/config/RedisConfig.java
  2. +18
    -0
      mallinkBApi/src/main/java/com/iformall/config/RedisConfig.java
  3. +3
    -0
      mallinkBApi/src/main/java/com/iformall/controller/WxInfoController.java
  4. +18
    -0
      mallinkCallback/src/main/java/com/iformall/config/RedisConfig.java
  5. +18
    -0
      mallinkMQConsumer/src/main/java/com/iformall/config/RedisConfig.java
  6. +18
    -0
      mallinkPosApi/src/main/java/com/iformall/config/RedisConfig.java
  7. +14
    -3
      mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java
  8. +18
    -0
      mallinkSchedule/src/main/java/com/iformall/config/RedisConfig.java
  9. +13
    -2
      mallinkSchedule/src/main/java/com/iformall/schedule/CouponOrderExpiringSchedule.java
  10. +16
    -1
      mallinkSchedule/src/main/java/com/iformall/schedule/OrderExpiringSchedule.java
  11. +1
    -0
      mallinkService/src/main/java/com/iformall/common/ErrorCode.java
  12. +6
    -4
      mallinkService/src/main/java/com/iformall/enums/EnumNeuPosPamentType.java
  13. +18
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java
  14. +22
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  15. +61
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java
  16. +38
    -3
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml
  17. +18
    -0
      mallinkSysAdmin/src/main/java/com/iformall/config/RedisConfig.java
  18. +18
    -0
      mallinkWebSocketServer/src/main/java/com/iformall/config/RedisConfig.java

+ 18
- 0
mallinkAdmin/src/main/java/com/iformall/config/RedisConfig.java Прегледај датотеку

@@ -2,6 +2,7 @@ package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -194,4 +195,21 @@ public class RedisConfig extends CachingConfigurerSupport {
return template;
}

@Bean("couponDetailRedisTemplate")
public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>();

Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}

}

+ 18
- 0
mallinkBApi/src/main/java/com/iformall/config/RedisConfig.java Прегледај датотеку

@@ -2,6 +2,7 @@ package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -154,4 +155,21 @@ public class RedisConfig extends CachingConfigurerSupport {
template.setConnectionFactory(connectionFactory);
return template;
}

@Bean("couponDetailRedisTemplate")
public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>();

Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}
}

+ 3
- 0
mallinkBApi/src/main/java/com/iformall/controller/WxInfoController.java Прегледај датотеку

@@ -219,6 +219,9 @@ public class WxInfoController extends BaseController {
}

WxAppinfo wxAppinfo = getAppInfo(appId);
if (wxAppinfo == null) {
return new ResultData(Result.ERROR, "APP无权限");
}
TenantEntity tenantEntity = new TenantEntity() {{
setTenantId(wxAppinfo.getTenantId());
}};


+ 18
- 0
mallinkCallback/src/main/java/com/iformall/config/RedisConfig.java Прегледај датотеку

@@ -2,6 +2,7 @@ package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -192,4 +193,21 @@ public class RedisConfig extends CachingConfigurerSupport {
template.setConnectionFactory(connectionFactory);
return template;
}

@Bean("couponDetailRedisTemplate")
public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>();

Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}
}

+ 18
- 0
mallinkMQConsumer/src/main/java/com/iformall/config/RedisConfig.java Прегледај датотеку

@@ -2,6 +2,7 @@ package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -178,4 +179,21 @@ public class RedisConfig extends CachingConfigurerSupport {
template.setConnectionFactory(connectionFactory);
return template;
}

@Bean("couponDetailRedisTemplate")
public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>();

Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}
}

+ 18
- 0
mallinkPosApi/src/main/java/com/iformall/config/RedisConfig.java Прегледај датотеку

@@ -2,6 +2,7 @@ package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -156,4 +157,21 @@ public class RedisConfig extends CachingConfigurerSupport {
template.setConnectionFactory(connectionFactory);
return template;
}

@Bean("couponDetailRedisTemplate")
public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>();

Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}
}

+ 14
- 3
mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java Прегледај датотеку

@@ -1891,7 +1891,13 @@ public class PosServiceImpl implements PosService {
Long posOrderId, Long memId, Integer orderAmount, Date orderTime, String orderCreateSn) {
WxOrder order = createOrderByPos(buUser, memId, posOrderId, orderAmount, orderTime, orderCreateSn);
String payDetail = params.get(WxPayConstant.PAY_DETAIL);
JSONObject payDetailObj = JSON.parseObject(payDetail);
JSONObject payDetailObj = null;
try {
payDetailObj = JSON.parseObject(payDetail);
} catch (Exception e) {
logger.error("parse PAY_DETAIL error: {}", e.getMessage());
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR);
}
PromotionCalc scoreCreditCalc = new PromotionCalc();
scoreCreditCalc.setScore(0);
scoreCreditCalc.setCredit(0);
@@ -2185,8 +2191,13 @@ public class PosServiceImpl implements PosService {
throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR);
}
WxCardSpend cardSpend = cardSpendService.getById(cardSpendId);
cardSpend.setOrderId(order.getId());
cardSpendService.cardSpendForPosPay(scoreCreditCalc, cardSpend, merchant, buUser);
if (cardSpend != null) {
cardSpend.setOrderId(order.getId());
cardSpendService.cardSpendForPosPay(scoreCreditCalc, cardSpend, merchant, buUser);
} else {
logger.error("卡支付ID未发现: " + cardSpendId);
throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR);
}
return payOrder;
}



+ 18
- 0
mallinkSchedule/src/main/java/com/iformall/config/RedisConfig.java Прегледај датотеку

@@ -2,6 +2,7 @@ package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -179,4 +180,21 @@ public class RedisConfig extends CachingConfigurerSupport {
return template;
}

@Bean("couponDetailRedisTemplate")
public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>();

Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}

}

+ 13
- 2
mallinkSchedule/src/main/java/com/iformall/schedule/CouponOrderExpiringSchedule.java Прегледај датотеку

@@ -1,6 +1,7 @@
package com.iformall.schedule;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.iformall.common.ErrorCode;
import com.iformall.domain.dto.WxSharingOrderDto;
import com.iformall.domain.po.*;
import com.iformall.enums.*;
@@ -9,6 +10,7 @@ import com.iformall.mapper.*;
import com.iformall.service.WxOrderService;
import com.iformall.service.WxProfitSharingOrderService;
import com.iformall.service.WxRefundOrderService;
import com.iformall.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -119,11 +121,20 @@ public class CouponOrderExpiringSchedule {
appinfo.setType(EnumAppType.B.getCode());
appinfo = wxAppinfoMapper.findList(appinfo).get(0);

Date limitDate = DateUtils.getTimeAfterDays(360, co.getCreateDate());
if (limitDate.before(new Date())) {
// 系统只自动处理360天内的订单
return;
}

try {
wxRefundOrderService.createRefundOrder(appinfo, co.getId(), EnumPayType.PAY_AUTO_REFUND, null);
} catch (MallinkException e) {
logger.error("退款失败:"+e.getMessage()+"couponOrderId="+co.getId());
throw new MallinkException(e.getErrorCode(), e.getMessage());
if (e.getErrorCode() == ErrorCode.REFUND_NOT_ALLOW.getCode()) {
} else {
logger.error("退款失败:" + e.getMessage() + "couponOrderId=" + co.getId());
throw new MallinkException(e.getErrorCode(), e.getMessage());
}
}
}



+ 16
- 1
mallinkSchedule/src/main/java/com/iformall/schedule/OrderExpiringSchedule.java Прегледај датотеку

@@ -1,18 +1,21 @@
package com.iformall.schedule;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.iformall.common.ErrorCode;
import com.iformall.domain.po.WxAppinfo;
import com.iformall.domain.po.WxOrder;
import com.iformall.enums.EnumAppType;
import com.iformall.enums.EnumOrderStatus;
import com.iformall.enums.EnumOrderType;
import com.iformall.enums.EnumRefundStatus;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.WxAppinfoMapper;
import com.iformall.mapper.WxCouponMapper;
import com.iformall.mapper.WxOrderGroupMapper;
import com.iformall.mapper.WxOrderMapper;
import com.iformall.service.WxOrderService;
import com.iformall.service.WxRefundOrderService;
import com.iformall.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -208,10 +211,22 @@ public class OrderExpiringSchedule {
appinfo.updateTenantInfo(order);
appinfo.setType(EnumAppType.C.getCode());
appinfo = wxAppinfoMapper.findList(appinfo).get(0);
Date limitDate = DateUtils.getTimeAfterDays(360, order.getCreateDate());
if (limitDate.before(new Date())) {
// 系统只自动处理180内的订单
return;
}
//退款流程
boolean has = wxRefundOrderService.hasRefundOrder(order.getId(), EnumRefundStatus.REFUND_SUCCESS.getCode());
if (!has) {
wxRefundOrderService.returnMoney(appinfo, order.getId());
try {
wxRefundOrderService.returnMoney(appinfo, order.getId());
} catch (MallinkException e) {
if (e.getErrorCode() == ErrorCode.REFUND_NOT_ALLOW.getCode()) {

}
throw new MallinkException(e.getErrorCode(), e.getMessage());
}
}
}


+ 1
- 0
mallinkService/src/main/java/com/iformall/common/ErrorCode.java Прегледај датотеку

@@ -296,6 +296,7 @@ public enum ErrorCode{
REFUND_ORDER_NOTIFY_CHECK_SIGN_ERROR(12014, "退款验签失败"),
REFUND_ORDER_BUSER_IS_NULL(12015, "B端用户不存在"),
REFUND_ORDER_BUSER_NOT_EQUAL(12016, "B端用户无操作权限"),
REFUND_NOT_ALLOW(12017, "退款订单不允许退款"),

APP_ID_NOT_FOUND(12020, "APPID没找到"),
MCH_INFO_NOT_FOUND(12021, "微信商户平台信息没找到"),


+ 6
- 4
mallinkService/src/main/java/com/iformall/enums/EnumNeuPosPamentType.java Прегледај датотеку

@@ -5,13 +5,15 @@ package com.iformall.enums;
*/
public enum EnumNeuPosPamentType {

// 来源于Neusoft的定义 0微信;1支付宝;2现金;3优惠券;4预付卡;5银行卡
// 来源于Neusoft的定义 0微信;1支付宝;2现金;3-会员折扣, 4优惠券;5预付卡;6银行卡7记账
WECHAT(0, "微信"),
ALIPAY(1, "支付宝"),
CASH(2, "现金"),
MEM_COUPON(3, "优惠券"),
MEM_CARD(4, "预付卡"),
MEM_BANKCARD(5, "银行卡"),
MEM_DEDUCT(3, "会员折扣"),
MEM_COUPON(4, "优惠券"),
MEM_CARD(5, "预付卡"),
MEM_BANKCARD(6, "银行卡"),
RECORD(7, "记账"),
;
public static EnumNeuPosPamentType getEnum(Integer code) {
for (EnumNeuPosPamentType value : values()) {


+ 18
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java Прегледај датотеку

@@ -10,6 +10,7 @@ import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker;
import com.iformall.common.ResultData;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponChannelVo;
import com.iformall.enums.EnumCouponChannelStatus;
import com.iformall.enums.EnumCouponChannelType;
@@ -24,11 +25,15 @@ import com.iformall.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;
import java.util.concurrent.TimeUnit;

@Service
public class WxGameServiceImpl implements WxGameService {
@@ -58,6 +63,10 @@ public class WxGameServiceImpl implements WxGameService {
@Autowired
private QrCodeService qrCodeService;

@Autowired
@Qualifier("couponDetailRedisTemplate")
RedisTemplate<String, WxCouponCVo> cdRedisTemplate;

@Override
public PageInfo<WxGame> listAsPage(WxGame record, Integer pageIndex, Integer pageSize) {
PageInfo<WxGame> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxGameMapper.findList(record));
@@ -176,6 +185,7 @@ public class WxGameServiceImpl implements WxGameService {
// get game's coupon
List couponIdsList = new ArrayList();
JSONArray couponChannelIds = JSON.parseArray(record.getCouponIds());
ValueOperations<String, WxCouponCVo> operations = cdRedisTemplate.opsForValue();
for(int i=0; i<couponChannelIds.size();i++) {
JSONObject couponChanObj = (JSONObject) couponChannelIds.get(i);
Long couponId = couponChanObj.getLong("couponId");
@@ -184,6 +194,14 @@ public class WxGameServiceImpl implements WxGameService {
if (couponChannelVo != null) {
couponChannelVo.setGameWeight(couponChanObj.getInteger("weight"));
couponIdsList.add(couponChannelVo);
String key = "cc:" + couponChannelVo.getId();
if (!cdRedisTemplate.hasKey(key)) {
WxCouponCVo couponCVo = wxCouponChannelService.findVoStatusDetail(couponChannelVo.getId());
if(Objects.nonNull(couponCVo)) {
// 插入缓存
operations.set(key, couponCVo, 3600, TimeUnit.SECONDS);
}
}
}
}



+ 22
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java Прегледај датотеку

@@ -1,5 +1,6 @@
package com.iformall.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
@@ -19,9 +20,12 @@ import com.iformall.mapper.*;
import com.iformall.mq.MqBaseProducer;
import com.iformall.service.*;
import com.iformall.utils.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@@ -32,6 +36,7 @@ import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

@Service
@@ -660,7 +665,7 @@ public class WxOrderServiceImpl implements WxOrderService {
}
record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode());
record.setPayment(payment);
record.setTotalPayment(payment);
record.setTotalPayment(payment);
record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode());
record.setDetail(bodyStr);
record.setCreateDate(curr);
@@ -697,7 +702,7 @@ public class WxOrderServiceImpl implements WxOrderService {
record.setCUserId(cUserId);
record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode());
record.setPayment(payment);
record.setTotalPayment(payment);
record.setTotalPayment(payment);
record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode());
record.setDetail(bodyStr);
record.setCreateDate(curr);
@@ -1618,11 +1623,26 @@ public class WxOrderServiceImpl implements WxOrderService {
wxOrderMapper.updateStatusByPressCouponId(updateOrder);
}

@Autowired
@Qualifier("cuserTokenRedisTemplate")
RedisTemplate<String, WxCUser> cUserTokenRedisTemplate;

@Override
public WxOrder saveOrderForCoupon(WxCUser user, WxCoupon coupon, OrderSaveDto orderSaveDto, boolean isPress) {
WxOrder order = null;
// 防止同一用户重复抽奖(一分钟内)
// 1. 订单保存时 加入redis缓存,key --> action:userId:couponId , 时间1000ms
// 2. 如果存在,说明该用户正在下单,返回异常提示
// 3. 方法结束时清除 key
if (checkCouponIsFree(coupon)) {
// 免费券
String key = StringUtils.join("action", ":", user.getId(), coupon.getId());
boolean hasKey = cUserTokenRedisTemplate.hasKey(key);
if (hasKey) {
logger.error("用户正在下单,请求异常返回,user: {} " + JSON.toJSONString(user));
throw new MallinkException(ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION);
}
cUserTokenRedisTemplate.opsForValue().set(key, user, 1000, TimeUnit.MILLISECONDS);
order = saveFreeOrderForCoupon(user, coupon, orderSaveDto.getCouponChannelId(), orderSaveDto.getFormId(), null);
if (order != null) {
// 6. 下订单完成,发送内部消息


+ 61
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java Прегледај датотеку

@@ -511,6 +511,12 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR);
}
} else {
String errDesc = returnMap.get("err_code_des");
if (errDesc.equalsIgnoreCase("订单已全额退款")) {
record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_SUCCESS.getCode());
wxRefundOrderMapper.updateById(record);
return new ResultData(Result.SUCCESS, "退款订单申请成功", returnMap);
}
logger.error("微信退款订单申请失败: " + response);
String errMsg = "";
JSONObject errObj = errorRefundReqMap.getJSONObject(result_no);
@@ -523,6 +529,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
}
record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode());
wxRefundOrderMapper.updateById(record);
if (errDesc.equalsIgnoreCase("超期订单不允许退款")) {
// 更新券状态
throw new MallinkException(ErrorCode.REFUND_NOT_ALLOW);
}
return new ResultData(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg, returnMap);
}
} else {
@@ -590,6 +600,13 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), "订单状态更新失败");
}
} else {
// 特殊处理
String errDesc = returnMap.get("err_code_des");
if (errDesc.equalsIgnoreCase("订单已全额退款")) {
record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_SUCCESS.getCode());
wxRefundOrderMapper.updateById(record);
return new ResultData(Result.SUCCESS, "退款订单申请成功", returnMap);
}
logger.error("微信退款订单申请失败: " + response);
String errMsg = "";
JSONObject errObj = errorRefundReqMap.getJSONObject(result_no);
@@ -602,6 +619,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
}
record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode());
wxRefundOrderMapper.updateById(record);
if (errDesc.equalsIgnoreCase("超期订单不允许退款")) {
// 更新券状态
throw new MallinkException(ErrorCode.REFUND_NOT_ALLOW);
}
throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg);
}
}
@@ -800,6 +821,12 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR);
}
} else {
String errDesc = returnMap.get("err_code_des");
if (errDesc.equalsIgnoreCase("订单已全额退款")) {
record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_SUCCESS.getCode());
wxRefundOrderMapper.updateById(record);
return new ResultData(Result.SUCCESS, "退款订单申请成功", returnMap);
}
logger.error("微信退款订单申请失败: " + response);
String errMsg = "";
JSONObject errObj = errorRefundReqMap.getJSONObject(result_no);
@@ -812,6 +839,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
}
record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode());
wxRefundOrderMapper.updateById(record);
if (errDesc.equalsIgnoreCase("超期订单不允许退款")) {
// 更新券状态
throw new MallinkException(ErrorCode.REFUND_NOT_ALLOW);
}
return new ResultData(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg, returnMap);
}
} else {
@@ -879,6 +910,12 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), "订单状态更新失败");
}
} else {
String errDesc = returnMap.get("err_code_des");
if (errDesc.equalsIgnoreCase("订单已全额退款")) {
record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_SUCCESS.getCode());
wxRefundOrderMapper.updateById(record);
return new ResultData(Result.SUCCESS, "退款订单申请成功", returnMap);
}
logger.error("微信退款订单申请失败: " + response);
String errMsg = "";
JSONObject errObj = errorRefundReqMap.getJSONObject(result_no);
@@ -891,6 +928,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
}
record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode());
wxRefundOrderMapper.updateById(record);
if (errDesc.equalsIgnoreCase("超期订单不允许退款")) {
// 更新券状态
throw new MallinkException(ErrorCode.REFUND_NOT_ALLOW);
}
throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg);
}
}
@@ -1404,6 +1445,12 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR);
}
} else {
String errDesc = returnMap.get("err_code_des");
if (errDesc.equalsIgnoreCase("订单已全额退款")) {
record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_SUCCESS.getCode());
wxRefundOrderMapper.updateById(record);
return new ResultData(Result.SUCCESS, "退款订单申请成功", returnMap);
}
logger.error("微信退款订单申请失败: " + response);
String errMsg = "";
JSONObject errObj = errorRefundReqMap.getJSONObject(result_no);
@@ -1416,6 +1463,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
}
record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode());
wxRefundOrderMapper.updateById(record);
if (errDesc.equalsIgnoreCase("超期订单不允许退款")) {
// 更新券状态
throw new MallinkException(ErrorCode.REFUND_NOT_ALLOW);
}
return new ResultData(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg, returnMap);
}
} else {
@@ -1476,6 +1527,12 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), "订单状态更新失败");
}
} else {
String errDesc = returnMap.get("err_code_des");
if (errDesc.equalsIgnoreCase("订单已全额退款")) {
record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_SUCCESS.getCode());
wxRefundOrderMapper.updateById(record);
return new ResultData(Result.SUCCESS, "退款订单申请成功", returnMap);
}
logger.error("微信退款订单申请失败: " + response);
String errMsg = "";
JSONObject errObj = errorRefundReqMap.getJSONObject(result_no);
@@ -1488,6 +1545,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
}
record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode());
wxRefundOrderMapper.updateById(record);
if (errDesc.equalsIgnoreCase("超期订单不允许退款")) {
// 更新券状态
throw new MallinkException(ErrorCode.REFUND_NOT_ALLOW);
}
throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg);
}
}


+ 38
- 3
mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml Прегледај датотеку

@@ -538,12 +538,12 @@

<select id="findExpiredFreeCouponOrderByValidDate" parameterType="com.iformall.domain.po.WxCouponOrder" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_coupon_order
where expired_time &lt; now() and coupon_price = 0 and coupon_order_status = 0
where expired_time >= date_sub(curdate(),interval 360 day) and expired_time &lt; now() and coupon_price = 0 and coupon_order_status = 0
</select>

<select id="findExpiredCouponOrderByValidDate" parameterType="com.iformall.domain.po.WxCouponOrder" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_coupon_order
where expired_time &lt; now() and coupon_price &gt; 0 and coupon_order_status = 0
where expired_time >= date_sub(curdate(),interval 360 day) and expired_time &lt; now() and coupon_price &gt; 0 and coupon_order_status = 0
</select>


@@ -588,6 +588,41 @@
</collection>
</resultMap>

<resultMap id="AdminBVoResultMap" type="com.iformall.domain.vo.WxCouponOrderBVo">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="coupon_id" jdbcType="BIGINT" property="couponId" />
<result column="coupon_type" jdbcType="INTEGER" property="couponType" />
<result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
<result column="owner_id" jdbcType="BIGINT" property="ownerId" />
<result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
<result column="order_id" jdbcType="BIGINT" property="orderId" />
<result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" />
<result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
<result column="coupon_price" jdbcType="INTEGER" property="couponPrice" />

<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>

<result column="type" jdbcType="INTEGER" property="type" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="sale_price" jdbcType="INTEGER" property="salePrice" />
<result column="use_price" jdbcType="INTEGER" property="usePrice" />
<result column="price" jdbcType="INTEGER" property="price" />
<result column="auto_refund" jdbcType="INTEGER" property="autoRefund" />
<result column="business" jdbcType="INTEGER" property="business"/>
<result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/>
<result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/>

<result column="name" jdbcType="VARCHAR" property="bUserName" />
<result column="bphone" jdbcType="VARCHAR" property="bUserPhone" />
<result column="phone" jdbcType="VARCHAR" property="cUserPhone" />
<result column="merchant_name" jdbcType="VARCHAR" property="merchantName" />

<result column="verify_merchant_name" jdbcType="VARCHAR" property="verifyMerchantName"/>
</resultMap>

<sql id="allAdminCouponOrderListColumns">
co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type,ms.subsidy subsidy_num,
@@ -607,7 +642,7 @@
m.name as merchant_name,m.id as merchant_id
</sql>

<select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="BVoResultMap">
<select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="AdminBVoResultMap">
select <include refid="allAdminCouponOrderListColumns" />
from wx_coupon_order co
inner join wx_coupon c on c.id = co.coupon_id


+ 18
- 0
mallinkSysAdmin/src/main/java/com/iformall/config/RedisConfig.java Прегледај датотеку

@@ -2,6 +2,7 @@ package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -192,4 +193,21 @@ public class RedisConfig extends CachingConfigurerSupport {
return template;
}

@Bean("couponDetailRedisTemplate")
public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>();

Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}

}

+ 18
- 0
mallinkWebSocketServer/src/main/java/com/iformall/config/RedisConfig.java Прегледај датотеку

@@ -2,6 +2,7 @@ package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -177,4 +178,21 @@ public class RedisConfig extends CachingConfigurerSupport {
template.setConnectionFactory(connectionFactory);
return template;
}

@Bean("couponDetailRedisTemplate")
public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>();

Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}
}

Loading…
Откажи
Сачувај