This commit is contained in:
2023-08-17 10:07:35 +08:00
3 changed files with 34 additions and 6 deletions

View File

@@ -11,11 +11,14 @@ import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.id.IdUtils;
import com.jsowell.pile.domain.MemberBasicInfo;
import com.jsowell.pile.dto.GetPayModeDTO;
import com.jsowell.pile.dto.PayOrderDTO;
import com.jsowell.pile.dto.PaymentScenarioDTO;
import com.jsowell.pile.dto.WeixinPayDTO;
import com.jsowell.pile.service.IMemberBasicInfoService;
import com.jsowell.pile.vo.uniapp.PayModeVO;
import com.jsowell.service.AgentDevService;
import com.jsowell.service.MemberService;
import com.jsowell.service.OrderService;
import com.jsowell.pile.dto.ApplyRefundDTO;
@@ -47,6 +50,8 @@ public class PayController extends BaseController {
@Autowired
private RedisCache redisCache;
@Autowired
private IMemberBasicInfoService memberBasicInfoService;
/**
* 充值余额支付/微信余额充值
* 提供给小程序使用
@@ -258,11 +263,14 @@ public class PayController extends BaseController {
// 设置appId
dto.setAppId(request.getHeader("appId"));
// 获取openId
String openId = memberService.getOpenIdByCode(dto.getCode());
if (StringUtils.isBlank(openId)) {
throw new BusinessException(ReturnCodeEnum.CODE_GET_OPEN_ID_BY_CODE_ERROR);
MemberBasicInfo memberBasicInfo = memberBasicInfoService.selectInfoByMemberId(memberId);
if (memberBasicInfo == null) {
throw new BusinessException(ReturnCodeEnum.CODE_HANDLE_USER_INFO_ERROR);
}
dto.setOpenId(openId);
// if (StringUtils.isBlank(openId)) {
// throw new BusinessException(ReturnCodeEnum.CODE_GET_OPEN_ID_BY_CODE_ERROR);
// }
dto.setOpenId(memberBasicInfo.getOpenId());
// 充值余额 附加参数
Map<String, Object> weixinMap = memberService.rechargeBalanceWithAdapay(dto);
response = new RestApiResponse<>(ImmutableMap.of("weixinMap", weixinMap));

View File

@@ -629,6 +629,26 @@ public class SpringBootTestController {
}
}
@Test
public void testFault() {
StringBuffer sb = new StringBuffer("0100");
String lowOrder = sb.substring(0, 2);
String highOrder = sb.substring(2, 4);
// String hardwareFault = highOrder + lowOrder;
byte[] hardwareFaultByteArr = BytesUtil.str2Bcd(highOrder + lowOrder);
String binStr = BytesUtil.bytes2BinStr(hardwareFaultByteArr);
// log.info("binStr:{}", binStr); // 0000 0000 0000 0001
int faultCode = 0;
for (int i = 0; i < binStr.length(); i++) {
if (binStr.charAt(i) == '1') {
faultCode = 15 - i;
break;
}
}
String faultReason = YKCPileFaultReasonEnum.getValueByCode(faultCode);
System.out.println(faultReason);
}
@Test