| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/weixinPayHuiminCallback1") |
| | | public void weixinPayHuiminCallback1(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | @ResponseBody |
| | | @PostMapping("/testWeiXinV3") |
| | | @ApiOperation(value = "获取添加人员、选择人员说明文案") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil getContentForStudent() throws Exception { |
| | | // Map<String, Object> stringObjectMap = wechatPaymentService.weChatDoUnifiedOrder(); |
| | | // ... 在你的下单方法中调用 ... |
| | | @PostMapping("/weiXinPartnerPay") |
| | | @ApiOperation(value = "微信服务商版本APP支付") |
| | | public ResultUtil weiXinPartnerPay(){ |
| | | try { |
| | | // 将 payParams 返回给你的APP前端,前端使用这些参数调起微信支付SDK |
| | | ResultUtil resultUtil = payMoneyUtil.weixinpayV3("1720719391","购买玩湃惠民卡","15645654askjak13", |
| | | "/base/huimin/callBack/weixinPayHuiminCallback1","99"); |
| | | return resultUtil; |
| | | |
| | | // 将 payParams 返回给你的APP前端,前端使用这些参数调起微信支付SDK |
| | | // return ResponseEntity.ok(payParams); // 示例 |
| | | |
| | | } catch (Exception e) { |
| | | // 处理异常 |
| | | // return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("下单失败"); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | |
| | | request.amount = new PartnerAppPrepay.CommonAmountInfo(); |
| | | request.amount.total = (long) i;// 金额 单位分 |
| | | request.amount.currency = "CNY"; |
| | | request.attach="";// 额外参数 |
| | | String prepayId =""; |
| | | Map<String, Object> map3 = new HashMap<>(); |
| | | try { |
| | |
| | | #{appUserId} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.operatorId !=null "> |
| | | AND thc.operatorId = #{query.operatorId} |
| | | </if> |
| | | <if test="query.paymentTimeStart != null and query.paymentTimeEnd!=null"> |
| | | AND tph.paymentTime BETWEEN #{query.paymentTimeStart} AND #{query.paymentTimeEnd} |
| | | </if> |
| | |
| | | |
| | | @Component |
| | | public class WxV3PayConfig { |
| | | // 服务商AppId |
| | | |
| | | // AppId |
| | | private String appIdValue = "wx41d32f362ba0f911"; |
| | | public static String APP_ID= "wx41d32f362ba0f911"; |
| | | |
| | |
| | | private String mchIdValue= "1681873607"; |
| | | public static String Mch_ID= "1681873607"; |
| | | |
| | | // 平台收款商户号 todo 待申请 |
| | | // 平台收款商户号 弃用 |
| | | public static String smidVx= "2088330203191220"; |
| | | private String smidVxValue= "2088330203191220"; |
| | | |
| | |
| | | private String apiV3KeyValue= "1skiujh28376shznxmslwosiusytersq"; |
| | | public static String apiV3Key= "1skiujh28376shznxmslwosiusytersq"; |
| | | // 证书序列号 |
| | | |
| | | private String mchSerialNoValue= "55714944F7A7E52526F708280B176DCC838F371A"; |
| | | public static String mchSerialNo= "55714944F7A7E52526F708280B176DCC838F371A"; |
| | | |
| | | // 证书路径 |
| | | private String privateKeyPathValue= "/usr/playpai/server/wxV3/1681873607_20250424_cert/apiclient_key.pem"; |
| | | public static String privateKeyPath= "/usr/playpai/server/wxV3/1681873607_20250424_cert/apiclient_key.pem"; |
| | | |
| | |
| | | apiV3Key = this.apiV3KeyValue; |
| | | mchSerialNo = this.mchSerialNoValue; |
| | | privateKeyPath = this.privateKeyPathValue; // WXPaySignatureCertificateUtil 会用到这个路径 |
| | | |
| | | |
| | | // 可以在这里加一些非空检查 |
| | | if (APP_ID == null || Mch_ID == null || apiV3Key == null || mchSerialNo == null || privateKeyPath == null) { |
| | | System.err.println("微信支付V3配置加载不完整,请检查配置文件!"); |
| | |
| | | System.out.println("微信支付V3配置加载完成。"); |
| | | } |
| | | } |
| | | |
| | | // 注意: WXPaySignatureCertificateUtil 中的 getPrivateKey() 方法现在应该使用 WxV3PayConfig.privateKeyPath |
| | | // 你需要稍微修改 WXPaySignatureCertificateUtil.getPrivateKey() 方法: |
| | | /* |
| | | public static PrivateKey getPrivateKey() { |
| | | if (cachedPrivateKey != null) { |
| | | return cachedPrivateKey; |
| | | } |
| | | try { |
| | | String filePath = WxV3PayConfig.privateKeyPath; // 使用配置类中的路径 |
| | | // ... rest of the method ... |
| | | } // ... catch blocks ... |
| | | } |
| | | */ |
| | | } |
| | |
| | | @Param("storeName") String storeName, |
| | | @Param("storeId") Integer storeId |
| | | ); |
| | | List<Map<String, Object>> querySiteListOfpageOperator(@Param("provinceCode") String provinceCode, |
| | | @Param("cityCode") String cityCode, |
| | | @Param("operatorId") Integer operatorId, |
| | | @Param("storeName") String storeName, |
| | | @Param("storeIds") List<Integer> storeIds |
| | | ); |
| | | |
| | | |
| | | } |
| | |
| | | @RequestMapping("/siteDetailsOfSearch") |
| | | @ResponseBody |
| | | public Object siteDetailsOfSearch(String provinceId,String cityId,Integer operatorId,String storeName){ |
| | | List<Map<String, Object>> res = new ArrayList<>(); |
| | | Integer storeId = null; |
| | | if (UserExt.getUser().getObjectType()== 2){ |
| | | // 筛选这个运营商下的门店 |
| | | operatorId = UserExt.getUser().getObjectId(); |
| | | List<Integer> storeIds = storeService.lambdaQuery().eq(TStore::getOperatorId, operatorId).list() |
| | | .stream().map(TStore::getId).collect(Collectors.toList()); |
| | | if (storeIds.isEmpty()){ |
| | | storeIds.add(0); |
| | | } |
| | | if (UserExt.getUser().getObjectType()== 3){ |
| | | res = storeService.querySiteListOfpageOperator(provinceId,cityId,operatorId,storeName,storeIds); |
| | | }else if (UserExt.getUser().getObjectType()== 3){ |
| | | // 筛选这个运营商下的门店 |
| | | storeId = UserExt.getUser().getObjectId(); |
| | | res = storeService.querySiteListOfpage(provinceId,cityId,operatorId,storeName,storeId); |
| | | }else{ |
| | | List<Integer> storeIds = new ArrayList<>(); |
| | | res = storeService.querySiteListOfpageOperator(provinceId,cityId,operatorId,storeName,storeIds); |
| | | } |
| | | List<Map<String,Object>> storeList = storeService.querySiteListOfpage(provinceId,cityId,operatorId,storeName,storeId); |
| | | if (storeList.size() > 0 ){ |
| | | for (Map<String, Object> stringObjectMap : storeList) { |
| | | if (res.size() > 0 ){ |
| | | for (Map<String, Object> stringObjectMap : res) { |
| | | String provinceName = (String) stringObjectMap.get("province"); |
| | | String cityName = (String) stringObjectMap.get("city"); |
| | | stringObjectMap.put("provinceCity",provinceName+cityName); |
| | |
| | | |
| | | } |
| | | } |
| | | return storeList; |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | |
| | | @RequestMapping("/getStaticsData") |
| | | @ResponseBody |
| | | public ResultUtil<Map<String, BigDecimal>> getStaticsData(HuiminPayQuery query) { |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | if (objectType.equals(2)){ |
| | | //查询运营商 |
| | | TOperator operator = operatorService.getOne(new QueryWrapper<TOperator>() |
| | | .eq("userId", UserExt.getUser().getId()) |
| | | .ne("state", 3) |
| | | .last("LIMIT 1")); |
| | | if (Objects.nonNull(operator)) { |
| | | query.setOperatorId(Long.valueOf(operator.getId())); |
| | | } |
| | | } |
| | | Map<String, BigDecimal> map = new HashMap<>(); |
| | | map.put("totalAmount",BigDecimal.ZERO); |
| | | map.put("refundAmount",BigDecimal.ZERO); |
| | |
| | | site.setCityManagerId(cityManagerId); |
| | | site.setInsertTime(new Date()); |
| | | site.setState(1); |
| | | site.setOperatorId(store.getOperatorId()); |
| | | // site.setOperatorId(UserExt.getUser().getObjectId()); |
| | | |
| | | // 添加场地 |
| | |
| | | if(site.getInsuranceImg().equals("")){ |
| | | site.setInsuranceImg(null); |
| | | } |
| | | |
| | | TSite byId = siteService.getById(site.getId()); |
| | | |
| | | Store store = storeClient.getStoreById(site.getStoreId()); |
| | | |
| | | String province = store.getProvince(); |
| | | String provinceCode = store.getProvinceCode(); |
| | | String city = store.getCity(); |
| | | String cityCode = store.getCityCode(); |
| | | Integer cityManagerId = store.getCityManagerId(); |
| | | |
| | | site.setOperatorId(store.getOperatorId()); |
| | | site.setProvince(province); |
| | | site.setProvinceCode(provinceCode); |
| | | site.setCity(city); |
| | | site.setCityCode(cityCode); |
| | | site.setCityManagerId(cityManagerId); |
| | | |
| | | site.setCityManagerId(store.getOperatorId()); |
| | | site.setInsertTime(new Date()); |
| | | site.setState(1); |
| | | siteClient.addSite(site); |
| | | |
| | | /** |
| | | * 取消闸机输入 新增模块闸机管理 |
| | | */ |
| | | // String ids = byId.getIds(); |
| | | // HashMap<String, String> map = new HashMap<>(); |
| | | // map.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // if(StringUtils.hasLength(ids)) { |
| | | // for (String s : ids.split(",")) { |
| | | // String s1 = HttpRequestUtil.postRequest("https://port.daowepark.com/v7/user_api/general/deleteDevice/ids/" + s, map); |
| | | // System.out.println(s1); |
| | | // } |
| | | // } |
| | | // if(StringUtils.hasLength( site.getIds())) { |
| | | // for (String s : site.getIds().split(",")) { |
| | | // HashMap<String, String> map1 = new HashMap<>(); |
| | | // map1.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // map1.put("space_id", store.getId() + ""); |
| | | // map1.put("device_id", s); |
| | | // map1.put("region_id", site.getId() + ""); |
| | | // // 添加门禁 |
| | | // String s1 = HttpRequestUtil.postRequest("https://port.daowepark.com/v7/user_api/general/addDevice", map1); |
| | | // System.out.println(s1); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | /** |
| | |
| | | } |
| | | |
| | | if (objectType == 2){ |
| | | model.addAttribute("is3","true"); |
| | | model.addAttribute("is2","true"); |
| | | model.addAttribute("oId",UserExt.getUser().getObjectId()); |
| | | return PREFIX+"ball_pre_add2.html"; |
| | | } |
| | |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | @TableField("operatorId") |
| | | private Integer operatorId; |
| | | |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | |
| | | |
| | | List<Map<String, Object>> listStoreAllByIds(List<Integer> ids); |
| | | List<Map<String, Object>> querySiteListOfpage(String provinceCode, String cityCode, Integer operatorId, String storeName,Integer storeId); |
| | | List<Map<String, Object>> querySiteListOfpageOperator(String provinceCode, String cityCode, Integer operatorId, String storeName,List<Integer> storeIds); |
| | | |
| | | } |
| | |
| | | public List<Map<String, Object>> querySiteListOfpage(String provinceCode, String cityCode, Integer operatorId, String storeName, Integer storeId) { |
| | | return this.baseMapper.querySiteListOfpage(provinceCode,cityCode,operatorId,storeName,storeId); |
| | | } |
| | | @Override |
| | | public List<Map<String, Object>> querySiteListOfpageOperator(String provinceCode, String cityCode, Integer operatorId, String storeName, List<Integer> storeIds) { |
| | | return this.baseMapper.querySiteListOfpageOperator(provinceCode,cityCode,operatorId,storeName,storeIds); |
| | | } |
| | | |
| | | /** |
| | | * 获取所有省 |
| | |
| | | </if> |
| | | </select> |
| | | <select id="querySiteListOfpage" resultType="java.util.Map"> |
| | | SELECT t1.id, t1.operatorId, t1.province, t1.city, t2.name,t1.ids,t1.name as siteName |
| | | SELECT t1.id, t2.operatorId, t1.province, t1.city, t2.name,t1.ids,t1.name as siteName |
| | | ,t2.type as `type` |
| | | from t_site t1 |
| | | left join t_store t2 on t1.storeId =t2.id |
| | |
| | | and t1.storeId = #{storeId} |
| | | </if> |
| | | </select> |
| | | <select id="querySiteListOfpageOperator" resultType="java.util.Map"> |
| | | SELECT t1.id, t2.operatorId, t1.province, t1.city, t2.name,t1.ids,t1.name as siteName |
| | | ,t2.type as `type` |
| | | from t_site t1 |
| | | left join t_store t2 on t1.storeId =t2.id |
| | | where t1.state=1 and t2.state=1 and t1.isCanBeBooked = 0 and t1.reservation=0 |
| | | <if test="provinceCode != null and provinceCode!=''"> |
| | | and t1.provinceCode = #{provinceCode} |
| | | </if> |
| | | <if test="cityCode != null and cityCode!=''"> |
| | | and t1.cityCode = #{cityCode} |
| | | </if> |
| | | |
| | | <if test="storeName != null and storeName != ''"> |
| | | and t2.name like CONCAT('%',#{storeName},'%') |
| | | </if> |
| | | <if test="storeIds != null and storeIds.size()>0"> |
| | | AND t1.storeId IN |
| | | <foreach collection="storeIds" separator="," item="id" open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | |
| | | </select> |
| | | |
| | | <select id="listStoreAll" resultType="map"> |
| | | select |
| | |
| | | }, |
| | | "source": { |
| | | "method": "post", |
| | | "url": "/coursePackage/queryStore1/$city", |
| | | "url": "/coursePackage/queryStore1/$city/$operationId", |
| | | "messages": { |
| | | }, |
| | | "sendOn": "this.city != null &&this.city != ' '", |
| | |
| | | {title: '生日', field: 'birthday', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '性别', field: 'gender', visible: true, align: 'center', valign: 'middle', |
| | | formatter:function (data) { |
| | | return {1:"男",2:"女"}[data] |
| | | return {0:"男",1:"男",2:"女"}[data] |
| | | } |
| | | }, |
| | | {title: '销售人员', field: 'salesmanUserName', visible: true, align: 'center', valign: 'middle'}, |
| | |
| | | private static String METHOD = "POST"; |
| | | private static String PATH = "/v3/pay/partner/transactions/app"; |
| | | |
| | | // public static void main(String[] args) { |
| | | // // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 |
| | | // PartnerAppPrepay client = new PartnerAppPrepay( |
| | | // "1681873607", // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考https://pay.weixin.qq.com/doc/v3/partner/4013080340 |
| | | // "55714944F7A7E52526F708280B176DCC838F371A", // 商户API证书序列号,如何获取请参考https://pay.weixin.qq.com/doc/v3/partner/4013058924 |
| | | // "E:\\wanpai\\1681873607_20250424_cert\\apiclient_key.pem", // 商户API证书私钥文件路径,本地文件路径 |
| | | // "PUB_KEY_ID_0116818736072025042400351694002605", // 微信支付公钥ID,如何获取请参考https://pay.weixin.qq.com/doc/v3/partner/4013038589 |
| | | // "E:\\wanpai\\pub_key.pem" // 微信支付公钥文件路径,本地文件路径 |
| | | // ); |
| | | // |
| | | // PartnerAPIv3CommonPrepayRequest request = new PartnerAPIv3CommonPrepayRequest(); |
| | | // request.spAppid = "wx41d32f362ba0f911"; |
| | | // request.spMchid = WxV3PayConfig.Mch_ID; |
| | | // request.subMchid = "1720719391"; |
| | | // request.description = "Image形象店-深圳腾大-QQ公仔"; |
| | | // request.outTradeNo = "12177525012014070332333680182"; |
| | | // request.notifyUrl = "https://www.weixin.qq.com/wxpay/pay.php"; |
| | | //// request.goodsTag = "WXG"; |
| | | //// request.settleInfo = new PartnerSettleInfo(); |
| | | //// request.settleInfo.profitSharing = false; |
| | | // request.amount = new CommonAmountInfo(); |
| | | // request.amount.total = 100L; |
| | | // request.amount.currency = "CNY"; |
| | | //// request.detail = new CouponInfo(); |
| | | //// request.detail.costPrice = 1L; |
| | | //// request.detail.invoiceId = "wx123"; |
| | | //// request.detail.goodsDetail = new ArrayList<>(); |
| | | //// { |
| | | //// GoodsDetail item0 = new GoodsDetail(); |
| | | //// item0.merchantGoodsId = "1246464644"; |
| | | //// item0.wechatpayGoodsId = "1001"; |
| | | //// item0.goodsName = "iPhone6s 16G"; |
| | | //// item0.quantity = 1L; |
| | | //// item0.unitPrice = 528800L; |
| | | //// request.detail.goodsDetail.add(item0); |
| | | //// }; |
| | | //// request.sceneInfo = new CommonSceneInfo(); |
| | | //// request.sceneInfo.payerClientIp = "14.23.150.211"; |
| | | //// request.sceneInfo.deviceId = "013467007045764"; |
| | | //// request.sceneInfo.storeInfo = new StoreInfo(); |
| | | //// request.sceneInfo.storeInfo.id = "0001"; |
| | | //// request.sceneInfo.storeInfo.name = "腾讯大厦分店"; |
| | | //// request.sceneInfo.storeInfo.areaCode = "440305"; |
| | | //// request.sceneInfo.storeInfo.address = "广东省深圳市南山区科技中一道10000号"; |
| | | // try { |
| | | // PartnerAPIv3AppPrepayResponse response = client.run(request); |
| | | // |
| | | // // TODO: 请求成功,继续业务逻辑 |
| | | // System.err.println("微信申请成功,预支付ID: " + response.prepayId); |
| | | // } catch (WXPayUtility.ApiException e) { |
| | | // // TODO: 请求失败,根据状态码执行不同的逻辑 |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | |
| | | public PartnerAPIv3AppPrepayResponse run(PartnerAPIv3CommonPrepayRequest request) { |
| | | String uri = PATH; |
| | | String reqBody = WXPayUtility.toJson(request); |
| | |
| | | @Component |
| | | public class WxV3PayConfig { |
| | | // 服务商AppId |
| | | |
| | | private String appIdValue = "wx41d32f362ba0f911"; |
| | | public static String APP_ID= "wx41d32f362ba0f911"; |
| | | |
| | |
| | | private String mchIdValue= "1681873607"; |
| | | public static String Mch_ID= "1681873607"; |
| | | |
| | | // 平台收款商户号 todo 待申请 |
| | | // 平台收款商户号 弃用 |
| | | public static String smidVx= "2088330203191220"; |
| | | private String smidVxValue= "2088330203191220"; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // 注意: WXPaySignatureCertificateUtil 中的 getPrivateKey() 方法现在应该使用 WxV3PayConfig.privateKeyPath |
| | | // 你需要稍微修改 WXPaySignatureCertificateUtil.getPrivateKey() 方法: |
| | | /* |
| | | public static PrivateKey getPrivateKey() { |
| | | if (cachedPrivateKey != null) { |
| | | return cachedPrivateKey; |
| | | } |
| | | try { |
| | | String filePath = WxV3PayConfig.privateKeyPath; // 使用配置类中的路径 |
| | | // ... rest of the method ... |
| | | } // ... catch blocks ... |
| | | } |
| | | */ |
| | | |
| | | } |