提交代码

yy_dev
胡锐 2 years ago
parent 7668a3b0cc
commit e8b240e318
  1. 68
      cweb/src/main/java/com/cweb/controller/TestController.java
  2. 2
      service/src/main/java/com/hfkj/service/impl/BsTradeOrderProfitSharingServiceImpl.java
  3. 74
      service/src/main/java/com/hfkj/service/impl/BsTradeOrderRefundServiceImpl.java
  4. 1
      service/src/main/java/com/hfkj/sysenum/TradeOrderRefundStatusEnum.java

@ -24,11 +24,11 @@ import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.config.device.SoundService; import com.hfkj.config.device.SoundService;
import com.hfkj.config.mqtt.MqttProviderService; import com.hfkj.config.mqtt.MqttProviderService;
import com.hfkj.entity.BsLklMcc; import com.hfkj.entity.BsLklMcc;
import com.hfkj.entity.BsTradeOrder;
import com.hfkj.entity.BsTradeOrderProfitSharing;
import com.hfkj.entity.SecRegion; import com.hfkj.entity.SecRegion;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.service.BsLklMccService; import com.hfkj.service.*;
import com.hfkj.service.CommonService;
import com.hfkj.service.SecRegionService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
@ -81,20 +81,10 @@ public class TestController {
@Resource @Resource
private LaKaLaLedgerService laKaLaLedgerService; private LaKaLaLedgerService laKaLaLedgerService;
@RequestMapping(value="/rotationQueryTrade",method = RequestMethod.GET) @Resource
@ResponseBody private BsTradeOrderService tradeOrderService;
@ApiOperation(value = "交易【被扫】") @Resource
public ResponseData rotationQueryTrade() { private BsTradeOrderProfitSharingService tradeOrderProfitSharingService;
try {
// return ResponseMsgUtil.success(LaKaLaConfig.queryCardBin("3100020709200056842"));
return ResponseMsgUtil.success(laKaLaLedgerService.queryLedgerMer("8221210701101SB"));
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/saasGetToken",method = RequestMethod.GET) @RequestMapping(value="/saasGetToken",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ -121,7 +111,8 @@ public class TestController {
// return ResponseMsgUtil.success(saasCommon.getArea("1")); // return ResponseMsgUtil.success(saasCommon.getArea("1"));
// return ResponseMsgUtil.success(saasCommon.getBank("6530", "大坪支行")); // return ResponseMsgUtil.success(saasCommon.getBank("6530", "大坪支行"));
return ResponseMsgUtil.success(laKaLaLedgerService); tradeOrderProfitSharingService.createProfitSharing(tradeOrderService.getOrderByOutTradeNo(""));
return ResponseMsgUtil.success("");
// return ResponseMsgUtil.success(""); // return ResponseMsgUtil.success("");
// 1200 // 1200
// return ResponseMsgUtil.success(saasCommon.fileUpload(new HashMap<>())); // return ResponseMsgUtil.success(saasCommon.fileUpload(new HashMap<>()));
@ -142,47 +133,6 @@ public class TestController {
} }
} }
public static String test(String str, Integer type) {
char[] chars = str.toCharArray();
// oP: '省' 的偏移, oC: '市' 的偏移, oR: "自治区" 的偏移
int oP = -1, oC = -1, oR = -1;
char ch;
for (int i = 0; i < chars.length; i++) {
ch = chars[i];
// 一般来说 '省' 的位置会比 '市' 早出现
if (ch == '省') {
oP = i;
} else if (ch == '市') {
oC = i;
// 找到 '市' 后就可以跳出循环了
break;
} else if (ch == '自'
&& i + 2 < chars.length
&& chars[i + 1] == '治'
&& chars[i + 2] == '区') {
// "自治区" 出现的几率挺小
oR = i + 2;
}
}
if (type == 1) {
if (oC != -1) {
str = str.substring(oC + 1);
} else if (oP != -1) {
str = str.substring(oP + 1);
} else if (oR != -1) {
str = str.substring(oR + 1);
}
} else if (type == 2) {
if (oP != -1) {
str = str.substring(oP + 1);
} else if (oR != -1) {
str = str.substring(oR + 1);
}
}
return str;
}
@RequestMapping(value="/soundSendMsg",method = RequestMethod.GET) @RequestMapping(value="/soundSendMsg",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "音响发送消息") @ApiOperation(value = "音响发送消息")

@ -76,7 +76,7 @@ public class BsTradeOrderProfitSharingServiceImpl implements BsTradeOrderProfitS
// 渠道平台手续费 // 渠道平台手续费
BigDecimal platformServiceCharge = null; BigDecimal platformServiceCharge = null;
if (tradeOrder.getPlatformType().equals(PlatformTypeEnum.type1.getNumber())) { if (tradeOrder.getPlatformType().equals(PlatformTypeEnum.type1.getNumber())) {
platformServiceCharge = new BigDecimal("0.002"); platformServiceCharge = new BigDecimal("0.000");
} else if (tradeOrder.getPlatformType().equals(PlatformTypeEnum.type4.getNumber())) { } else if (tradeOrder.getPlatformType().equals(PlatformTypeEnum.type4.getNumber())) {
platformServiceCharge = new BigDecimal("0.002"); platformServiceCharge = new BigDecimal("0.002");
} }

@ -2,12 +2,17 @@ package com.hfkj.service.impl;
import com.hfkj.channel.ccb.CCBTradeService; import com.hfkj.channel.ccb.CCBTradeService;
import com.hfkj.channel.weixin.WeiXinPayService; import com.hfkj.channel.weixin.WeiXinPayService;
import com.hfkj.common.exception.BizException;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.dao.BsTradeOrderRefundMapper; import com.hfkj.dao.BsTradeOrderRefundMapper;
import com.hfkj.entity.*; import com.hfkj.entity.*;
import com.hfkj.channel.lakala.LaKaLaTradeService; import com.hfkj.channel.lakala.LaKaLaTradeService;
import com.hfkj.service.*; import com.hfkj.service.*;
import com.hfkj.sysenum.PlatformTypeEnum; import com.hfkj.sysenum.PlatformTypeEnum;
import com.hfkj.sysenum.StoreDiscountActivityPartakeWayEnum; import com.hfkj.sysenum.StoreDiscountActivityPartakeWayEnum;
import com.hfkj.sysenum.TradeOrderRefundStatusEnum;
import com.hfkj.sysenum.TradeOrderStatusEnum; import com.hfkj.sysenum.TradeOrderStatusEnum;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -58,44 +63,55 @@ public class BsTradeOrderRefundServiceImpl implements BsTradeOrderRefundService
@Override @Override
public Map<String, Object> tradeOrderRefund(BsTradeOrderRefund tradeOrderRefund) throws Exception { public Map<String, Object> tradeOrderRefund(BsTradeOrderRefund tradeOrderRefund) throws Exception {
editOrderRefund(tradeOrderRefund); try {
editOrderRefund(tradeOrderRefund);
Map<String, Object> refund = new HashMap<>(); Map<String, Object> refund = new HashMap<>();
if (tradeOrderRefund.getPlatformType().equals(PlatformTypeEnum.type1.getNumber())) { if (tradeOrderRefund.getPlatformType().equals(PlatformTypeEnum.type1.getNumber())) {
refund = laKaLaTradeService.refund(tradeOrderRefund.getRefundNo(), tradeOrderRefund.getRefundAmount()); refund = laKaLaTradeService.refund(tradeOrderRefund.getRefundNo(), tradeOrderRefund.getRefundAmount());
} else if (tradeOrderRefund.getPlatformType().equals(PlatformTypeEnum.type3.getNumber())) { } else if (tradeOrderRefund.getPlatformType().equals(PlatformTypeEnum.type3.getNumber())) {
refund = ccbTradeService.refund(tradeOrderRefund.getRefundNo(), tradeOrderRefund.getRefundAmount()); refund = ccbTradeService.refund(tradeOrderRefund.getRefundNo(), tradeOrderRefund.getRefundAmount());
} else if (tradeOrderRefund.getPlatformType().equals(PlatformTypeEnum.type4.getNumber())) { } else if (tradeOrderRefund.getPlatformType().equals(PlatformTypeEnum.type4.getNumber())) {
refund = weiXinPayService.refund(tradeOrderRefund.getRefundNo(), tradeOrderRefund.getRefundAmount()); refund = weiXinPayService.refund(tradeOrderRefund.getRefundNo(), tradeOrderRefund.getRefundAmount());
} }
// 交易订单 // 交易订单
BsTradeOrder tradeOrder = tradeOrderService.getOrderByTradeNoId(tradeOrderRefund.getTradeOrderId()); BsTradeOrder tradeOrder = tradeOrderService.getOrderByTradeNoId(tradeOrderRefund.getTradeOrderId());
if (tradeOrder != null) { if (tradeOrder != null) {
// 退回门店优惠活动 // 退回门店优惠活动
if (tradeOrder.getStoreDiscountId() != null) { if (tradeOrder.getStoreDiscountId() != null) {
BsStoreDiscountActivity storeDiscountActivity = storeDiscountActivityService.getDetailById(tradeOrder.getStoreDiscountId()); BsStoreDiscountActivity storeDiscountActivity = storeDiscountActivityService.getDetailById(tradeOrder.getStoreDiscountId());
if (storeDiscountActivity != null if (storeDiscountActivity != null
&& !storeDiscountActivity.getPartakeWay().equals(StoreDiscountActivityPartakeWayEnum.type1.getNumber()) && !storeDiscountActivity.getPartakeWay().equals(StoreDiscountActivityPartakeWayEnum.type1.getNumber())
&& StringUtils.isNotBlank(tradeOrder.getUserPhone())) { && StringUtils.isNotBlank(tradeOrder.getUserPhone())) {
BsStoreDiscountActivityPartakeUser partakeUser = discountActivityPartakeUserService.getPartakeUser(tradeOrder.getUserPhone(), tradeOrder.getStoreDiscountId()); BsStoreDiscountActivityPartakeUser partakeUser = discountActivityPartakeUserService.getPartakeUser(tradeOrder.getUserPhone(), tradeOrder.getStoreDiscountId());
if (partakeUser != null) { if (partakeUser != null) {
partakeUser.setPartakeSurplusNum(partakeUser.getPartakeSurplusNum() + 1); partakeUser.setPartakeSurplusNum(partakeUser.getPartakeSurplusNum() + 1);
partakeUser.setPartakeUseNum(partakeUser.getPartakeUseNum() - 1); partakeUser.setPartakeUseNum(partakeUser.getPartakeUseNum() - 1);
discountActivityPartakeUserService.editData(partakeUser); discountActivityPartakeUserService.editData(partakeUser);
}
} }
} }
}
if (tradeOrder.getUserDiscountId() != null) { if (tradeOrder.getUserDiscountId() != null) {
userDiscountService.userDiscountReturn(tradeOrder.getUserDiscountId(), tradeOrder.getUserPhone()); userDiscountService.userDiscountReturn(tradeOrder.getUserDiscountId(), tradeOrder.getUserPhone());
}
} }
} return refund;
} catch (BizException e) {
tradeOrderRefund.setStatus(TradeOrderRefundStatusEnum.status0.getNumber());
editOrderRefund(tradeOrderRefund);
throw e;
return refund; } catch (Exception e) {
tradeOrderRefund.setStatus(TradeOrderRefundStatusEnum.status0.getNumber());
editOrderRefund(tradeOrderRefund);
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, e.getMessage());
}
} }
@Override @Override

@ -5,6 +5,7 @@ package com.hfkj.sysenum;
* @author hurui * @author hurui
*/ */
public enum TradeOrderRefundStatusEnum { public enum TradeOrderRefundStatusEnum {
status0(0, "删除"),
status1(1, "退款中"), status1(1, "退款中"),
status2(2, "已退款"), status2(2, "已退款"),
status3(3, "退款失败"), status3(3, "退款失败"),

Loading…
Cancel
Save