| | |
| | | import com.java110.core.smo.fee.IFeeInnerServiceSMO; |
| | | import com.java110.core.smo.community.IParkingSpaceInnerServiceSMO; |
| | | import com.java110.core.smo.community.IRoomInnerServiceSMO; |
| | | import com.java110.core.smo.store.ISmallWeChatInnerServiceSMO; |
| | | import com.java110.dto.smallWeChat.SmallWeChatDto; |
| | | import com.java110.entity.center.AppService; |
| | | import com.java110.entity.order.Orders; |
| | | import com.java110.core.event.service.api.ServiceDataFlowEvent; |
| | |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @ClassName PayFeeListener |
| | |
| | | |
| | | @Autowired |
| | | private IParkingSpaceInnerServiceSMO parkingSpaceInnerServiceSMOImpl; |
| | | @Autowired |
| | | private ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl; |
| | | |
| | | |
| | | @Override |
| | |
| | | JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody()); |
| | | paramOut.put("receivableAmount", paramObj.getString("receivableAmount")); |
| | | |
| | | SmallWeChatDto smallWeChatDto = new SmallWeChatDto(); |
| | | smallWeChatDto.setObjId((String) paramObj.get("communityId")); |
| | | smallWeChatDto.setAppId((String) paramObj.get("appId")); |
| | | List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto); |
| | | if(smallWeChatDtos.size() <= 0){ |
| | | throw new IllegalArgumentException("支付失败,小区未配置小程序信息"); |
| | | } |
| | | //指定支付小区 |
| | | if("1000".equals(smallWeChatDtos.get(0).getObjType())){ |
| | | paramOut.put("payAppId",smallWeChatDtos.get(0).getAppId()); |
| | | paramOut.put("payMchId",smallWeChatDtos.get(0).getMchId()); |
| | | } |
| | | |
| | | responseEntity = new ResponseEntity<>(paramOut.toJSONString(), HttpStatus.OK); |
| | | dataFlowContext.setResponseEntity(responseEntity); |
| | | } |
| | |
| | | import com.java110.core.smo.fee.IFeeInnerServiceSMO; |
| | | import com.java110.core.smo.common.ICarInoutInnerServiceSMO; |
| | | import com.java110.core.smo.community.IRoomInnerServiceSMO; |
| | | import com.java110.core.smo.store.ISmallWeChatInnerServiceSMO; |
| | | import com.java110.dto.smallWeChat.SmallWeChatDto; |
| | | import com.java110.entity.center.AppService; |
| | | import com.java110.entity.order.Orders; |
| | | import com.java110.core.event.service.api.ServiceDataFlowEvent; |
| | |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl; |
| | | @Autowired |
| | | private ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl; |
| | | |
| | | |
| | | @Override |
| | |
| | | |
| | | JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody()); |
| | | paramOut.put("receivableAmount", paramObj.getString("receivableAmount")); |
| | | SmallWeChatDto smallWeChatDto = new SmallWeChatDto(); |
| | | smallWeChatDto.setObjId((String) paramObj.get("communityId")); |
| | | smallWeChatDto.setAppId((String) paramObj.get("appId")); |
| | | List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto); |
| | | if(smallWeChatDtos.size() <= 0){ |
| | | throw new IllegalArgumentException("支付失败,小区未配置小程序信息"); |
| | | } |
| | | //指定支付小区 |
| | | if("1000".equals(smallWeChatDtos.get(0).getObjType())){ |
| | | paramOut.put("payAppId",smallWeChatDtos.get(0).getAppId()); |
| | | paramOut.put("payMchId",smallWeChatDtos.get(0).getMchId()); |
| | | } |
| | | |
| | | responseEntity = new ResponseEntity<>(paramOut.toJSONString(), HttpStatus.OK); |
| | | dataFlowContext.setResponseEntity(responseEntity); |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | protected Map<String, String> java110Payment(RestTemplate outRestTemplate,String feeName, String tradeType,String orderNum, double money, String openId) throws Exception { |
| | | protected Map<String, String> java110Payment(RestTemplate outRestTemplate, |
| | | String feeName, String tradeType, |
| | | String orderNum, double money, |
| | | String openId,String payAppId,String payMchId) throws Exception { |
| | | logger.info("【小程序支付】 统一下单开始, 订单编号=" + orderNum); |
| | | SortedMap<String, String> resultMap = new TreeMap<String, String>(); |
| | | //生成支付金额,开发环境处理支付金额数到0.01、0.02、0.03元 |
| | |
| | | Map<String, String> resMap = this.java110UnifieldOrder(outRestTemplate,feeName, orderNum, tradeType, payAmount, openId); |
| | | if ("SUCCESS".equals(resMap.get("return_code")) && "SUCCESS".equals(resMap.get("result_code"))) { |
| | | if(WechatAuthProperties.TRADE_TYPE_JSAPI.equals(tradeType)) { |
| | | resultMap.put("appId", wechatAuthProperties.getAppId()); |
| | | if(payAppId != null){ |
| | | resultMap.put("appId", payAppId); |
| | | }else{ |
| | | resultMap.put("appId", wechatAuthProperties.getAppId()); |
| | | } |
| | | if(payMchId != null){ |
| | | resultMap.put("sign", PayUtil.createSign(resultMap, payMchId)); |
| | | }else{ |
| | | resultMap.put("sign", PayUtil.createSign(resultMap, wechatAuthProperties.getKey())); |
| | | } |
| | | resultMap.put("timeStamp", PayUtil.getCurrentTimeStamp()); |
| | | resultMap.put("nonceStr", PayUtil.makeUUID(32)); |
| | | resultMap.put("package", "prepay_id=" + resMap.get("prepay_id")); |
| | | resultMap.put("signType", "MD5"); |
| | | resultMap.put("sign", PayUtil.createSign(resultMap, wechatAuthProperties.getKey())); |
| | | }else if(WechatAuthProperties.TRADE_TYPE_APP.equals(tradeType)){ |
| | | resultMap.put("appId", wechatAuthProperties.getAppId()); |
| | | resultMap.put("timeStamp", PayUtil.getCurrentTimeStamp()); |
| | |
| | | JSONObject realUserInfo = userResult.getJSONArray("users").getJSONObject(0); |
| | | |
| | | String openId = realUserInfo.getString("openId"); |
| | | String payAppId = orderInfo.getString("payAppId"); |
| | | String payMchId = orderInfo.getString("payMchId"); |
| | | |
| | | //微信下单PayUtil |
| | | Map result = super.java110Payment(outRestTemplate,paramIn.getString("feeName"),paramIn.getString("tradeType"), orderId, money, openId); |
| | | |
| | | Map result = super.java110Payment(outRestTemplate,paramIn.getString("feeName"),paramIn.getString("tradeType"), orderId, money, openId,payAppId,payMchId); |
| | | responseEntity = new ResponseEntity(JSONObject.toJSONString(result), HttpStatus.OK); |
| | | |
| | | return responseEntity; |
| | |
| | | JSONObject realUserInfo = userResult.getJSONArray("users").getJSONObject(0); |
| | | |
| | | String openId = realUserInfo.getString("openId"); |
| | | String payAppId = orderInfo.getString("payAppId"); |
| | | String payMchId = orderInfo.getString("payMchId"); |
| | | |
| | | //微信下单PayUtil |
| | | Map result = super.java110Payment(restTemplate,paramIn.getString("feeName"),paramIn.getString("tradeType"), orderId, money, openId); |
| | | Map result = super.java110Payment(restTemplate,paramIn.getString("feeName"),paramIn.getString("tradeType"), orderId, money, openId,payAppId,payMchId); |
| | | responseEntity = new ResponseEntity(JSONObject.toJSONString(result), HttpStatus.OK); |
| | | |
| | | return responseEntity; |