|  |  |  | 
|---|
|  |  |  | package cc.mrbird.febs; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import cc.mrbird.febs.common.entity.FebsResponse; | 
|---|
|  |  |  | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; | 
|---|
|  |  |  | import cc.mrbird.febs.common.enumerates.FlowTypeEnum; | 
|---|
|  |  |  | import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; | 
|---|
|  |  |  | import cc.mrbird.febs.common.enumerates.OrderStatusEnum; | 
|---|
|  |  |  | import cc.mrbird.febs.common.exception.FebsException; | 
|---|
|  |  |  | import cc.mrbird.febs.common.utils.HttpCurlUtil; | 
|---|
|  |  |  | import cc.mrbird.febs.common.utils.MallUtils; | 
|---|
|  |  |  | import cc.mrbird.febs.common.utils.RedisUtils; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.dto.ApiLeaderRefundOrderDto; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.dto.MallMemberCouponDto; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.entity.*; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.mapper.*; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.service.*; | 
|---|
|  |  |  | import cc.mrbird.febs.pay.model.WxGenerateQrCodeDto; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.vo.MallMemberCouponVo; | 
|---|
|  |  |  | import cc.mrbird.febs.pay.model.BrandWCPayRequestData; | 
|---|
|  |  |  | import cc.mrbird.febs.pay.model.HeaderDto; | 
|---|
|  |  |  | import cc.mrbird.febs.pay.service.IXcxPayService; | 
|---|
|  |  |  | import cc.mrbird.febs.pay.service.WxFaPiaoService; | 
|---|
|  |  |  | import cc.mrbird.febs.pay.util.WechatConfigure; | 
|---|
|  |  |  | import cc.mrbird.febs.rabbit.consumer.AgentConsumer; | 
|---|
|  |  |  | import cn.hutool.core.collection.CollUtil; | 
|---|
|  |  |  | import cn.hutool.core.date.DateTime; | 
|---|
|  |  |  | import cn.hutool.core.date.DateUtil; | 
|---|
|  |  |  | import cn.hutool.core.util.ObjectUtil; | 
|---|
|  |  |  | import cn.hutool.json.JSONUtil; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import okhttp3.HttpUrl; | 
|---|
|  |  |  | import org.apache.commons.collections.CollectionUtils; | 
|---|
|  |  |  | import org.apache.commons.httpclient.HttpClient; | 
|---|
|  |  |  | import org.apache.commons.httpclient.HttpStatus; | 
|---|
|  |  |  | import org.apache.commons.httpclient.methods.GetMethod; | 
|---|
|  |  |  | import org.apache.commons.httpclient.methods.PostMethod; | 
|---|
|  |  |  | import org.apache.commons.httpclient.methods.RequestEntity; | 
|---|
|  |  |  | import org.apache.commons.httpclient.methods.StringRequestEntity; | 
|---|
|  |  |  | import org.apache.http.HttpEntity; | 
|---|
|  |  |  | import org.apache.http.HttpResponse; | 
|---|
|  |  |  | import org.apache.http.client.methods.CloseableHttpResponse; | 
|---|
|  |  |  | import org.apache.http.client.methods.HttpPost; | 
|---|
|  |  |  | import org.apache.http.entity.StringEntity; | 
|---|
|  |  |  | import org.apache.http.impl.client.CloseableHttpClient; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.junit.jupiter.api.Test; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.boot.test.context.SpringBootTest; | 
|---|
|  |  |  | import org.springframework.core.io.ClassPathResource; | 
|---|
|  |  |  | import org.springframework.core.io.ResourceLoader; | 
|---|
|  |  |  | import org.springframework.web.client.RestTemplate; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.net.URLConnection; | 
|---|
|  |  |  | import java.nio.charset.Charset; | 
|---|
|  |  |  | import java.security.KeyPair; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.io.ByteArrayOutputStream; | 
|---|
|  |  |  | import java.io.InputStream; | 
|---|
|  |  |  | 
|---|
|  |  |  | public void thankfulProfit() { | 
|---|
|  |  |  | memberProfitService.thankfulProfit(new Date()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private MallMemberCouponMapper mallMemberCouponMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private MallGoodsMapper mallGoodsMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CouponGoodsMapper couponGoodsMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private WxFaPiaoService wxFaPiaoService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | ResourceLoader resourceLoader; | 
|---|
|  |  |  | @Test | 
|---|
|  |  |  | public void rankProfit() throws IOException { | 
|---|
|  |  |  | //        System.out.println(new ClassPathResource("wxP12/apiclient_cert.p12").getFile().exists()); | 
|---|
|  |  |  | //        System.out.println(new File("src/main/resources/wxP12/apiclient_cert.p12").exists()); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        InputStream inputStream = new FileInputStream(file); | 
|---|
|  |  |  | //        System.out.println(resourceLoader.getResource("classpath:/wxP12/apiclient_cert.p12").exists()); | 
|---|
|  |  |  | KeyPair privateKey = wxFaPiaoService.getPrivateKey(); | 
|---|
|  |  |  | HeaderDto headerDto = new HeaderDto(); | 
|---|
|  |  |  | headerDto.setCallback_url("https://api.blnka.cn/api/xcxPay/fapiaoCallBack"); | 
|---|
|  |  |  | headerDto.setShow_fapiao_cell(true); | 
|---|
|  |  |  | String parseObj = JSONUtil.parseObj(headerDto).toString(); | 
|---|
|  |  |  | String baseUrl = "https://api.mch.weixin.qq.com"; | 
|---|
|  |  |  | String canonicalUrl = "/v3/new-tax-control-fapiao/merchant/development-config"; | 
|---|
|  |  |  | String postStr = wxFaPiaoService.createAuthorization( | 
|---|
|  |  |  | "POST", | 
|---|
|  |  |  | canonicalUrl, | 
|---|
|  |  |  | parseObj, | 
|---|
|  |  |  | privateKey | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | // 创建httppost | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | HttpClient httpClient = new HttpClient(); | 
|---|
|  |  |  | PostMethod post = new PostMethod("https://api.mch.weixin.qq.com/v3/new-tax-control-fapiao/merchant/development-config"); | 
|---|
|  |  |  | post.setRequestHeader("Accept", "application/json"); | 
|---|
|  |  |  | post.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36"); | 
|---|
|  |  |  | post.setRequestHeader("Content-Type", "application/json; charset=UTF-8"); | 
|---|
|  |  |  | post.setRequestHeader("Connection", "keep-alive"); | 
|---|
|  |  |  | post.setRequestHeader("Authorization",  "WECHATPAY2-SHA256-RSA2048 "+postStr); | 
|---|
|  |  |  | RequestEntity entity = new StringRequestEntity(parseObj, "text/html", "utf-8"); | 
|---|
|  |  |  | post.setRequestEntity(entity); | 
|---|
|  |  |  | httpClient.executeMethod(post); | 
|---|
|  |  |  | String responseBodyAsString = post.getResponseBodyAsString(); | 
|---|
|  |  |  | cn.hutool.json.JSONObject maps = JSONUtil.parseObj(responseBodyAsString); | 
|---|
|  |  |  | System.out.println(maps); | 
|---|
|  |  |  | } catch (IOException e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Test | 
|---|
|  |  |  | public void rankProfit() { | 
|---|
|  |  |  | memberProfitService.rankProfit(); | 
|---|
|  |  |  | public void rankProfit2() throws IOException { | 
|---|
|  |  |  | KeyPair privateKey = wxFaPiaoService.getPrivateKey(); | 
|---|
|  |  |  | String baseUrl = "https://api.mch.weixin.qq.com"; | 
|---|
|  |  |  | String canonicalUrl = "/v3/new-tax-control-fapiao/merchant/development-config"; | 
|---|
|  |  |  | String postStr = wxFaPiaoService.createAuthorization( | 
|---|
|  |  |  | "GET", | 
|---|
|  |  |  | canonicalUrl, | 
|---|
|  |  |  | "", | 
|---|
|  |  |  | privateKey | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | HttpClient httpClient = new HttpClient(); | 
|---|
|  |  |  | GetMethod method = new GetMethod(baseUrl+canonicalUrl); | 
|---|
|  |  |  | method.setRequestHeader("Accept", "application/json"); | 
|---|
|  |  |  | method.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36"); | 
|---|
|  |  |  | method.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); | 
|---|
|  |  |  | method.setRequestHeader("Connection", "keep-alive"); | 
|---|
|  |  |  | method.setRequestHeader("Authorization", "WECHATPAY2-SHA256-RSA2048 "+postStr); | 
|---|
|  |  |  | httpClient.executeMethod(method); | 
|---|
|  |  |  | System.out.println(method); | 
|---|
|  |  |  | String responseBodyAsString = method.getResponseBodyAsString(); | 
|---|
|  |  |  | cn.hutool.json.JSONObject maps = JSONUtil.parseObj(responseBodyAsString); | 
|---|
|  |  |  | System.out.println(maps); | 
|---|
|  |  |  | } catch (IOException e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private MallOrderInfoMapper mallOrderInfoMapper; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private IXcxPayService iXcxPayService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private IAdminMallTeamLeaderService iAdminMallTeamLeaderService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Test | 
|---|
|  |  |  | public void qrcodeBase64(){ | 
|---|
|  |  |  | WxGenerateQrCodeDto wxGenerateQrCodeDto = new WxGenerateQrCodeDto(); | 
|---|
|  |  |  | wxGenerateQrCodeDto.setPage("pages/product/details"); | 
|---|
|  |  |  | wxGenerateQrCodeDto.setScene("35"); | 
|---|
|  |  |  | FebsResponse febsResponse = iXcxPayService.generateQrCode(wxGenerateQrCodeDto); | 
|---|
|  |  |  | String data = febsResponse.get("data").toString(); | 
|---|
|  |  |  | System.out.println(data); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //        Integer integer = mallGoodsMapper.upDateStockAndVolumeByGoodsId(35L, 3); | 
|---|
|  |  |  | //        System.out.println(integer); | 
|---|
|  |  |  | //        WxGenerateQrCodeDto wxGenerateQrCodeDto = new WxGenerateQrCodeDto(); | 
|---|
|  |  |  | //        wxGenerateQrCodeDto.setPage("pages/product/details"); | 
|---|
|  |  |  | //        wxGenerateQrCodeDto.setScene("35"); | 
|---|
|  |  |  | //        FebsResponse febsResponse = iXcxPayService.generateQrCode(wxGenerateQrCodeDto); | 
|---|
|  |  |  | //        String data = febsResponse.get("data").toString(); | 
|---|
|  |  |  | //        System.out.println(data); | 
|---|
|  |  |  | //        trackServiceInfo("e024c63342930addc57189c8608cdb01",null); | 
|---|
|  |  |  | //        String e024c63342930addc57189c8608cdb01 = trackServiceDel("e024c63342930addc57189c8608cdb01", "792477"); | 
|---|
|  |  |  | //        System.out.println(e024c63342930addc57189c8608cdb01); | 
|---|
|  |  |  | String ss = fenceDel("95ede7157929f5f6b6c758971be924b1", "795278","795554"); | 
|---|
|  |  |  | System.out.println(ss); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //电子围栏删除 | 
|---|
|  |  |  | public String fenceDel(String gaodeKey, String sid,String fenceId) { | 
|---|
|  |  |  | String url = "https://tsapi.amap.com/v1/track/geofence/delete?key="+gaodeKey+"&sid="+sid+"&gfids="+fenceId; | 
|---|
|  |  |  | HttpPost httpPost = new HttpPost(url); | 
|---|
|  |  |  | Map<String,String> map = new HashMap<>(); | 
|---|
|  |  |  | map.put("key",gaodeKey); | 
|---|
|  |  |  | map.put("sid",sid); | 
|---|
|  |  |  | map.put("gfids",fenceId); | 
|---|
|  |  |  | String  param= JSON.toJSONString(map); | 
|---|
|  |  |  | String result = null; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | result = HttpCurlUtil.sendPostHttp(url, param); | 
|---|
|  |  |  | } catch (IOException e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | cn.hutool.json.JSONObject maps = JSONUtil.parseObj(result); | 
|---|
|  |  |  | System.out.println(maps); | 
|---|
|  |  |  | String errcode = maps.get("errcode").toString(); | 
|---|
|  |  |  | if(!"10000".equals(errcode)){ | 
|---|
|  |  |  | return "fail"; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | return maps.toString(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //服务删除 | 
|---|
|  |  |  | public String trackServiceDel(String gaodeKey, String sid) { | 
|---|
|  |  |  | String url = "https://tsapi.amap.com/v1/track/service/delete?key="+gaodeKey+"&sid="+sid; | 
|---|
|  |  |  | HttpPost httpPost = new HttpPost(url); | 
|---|
|  |  |  | Map<String,String> map = new HashMap<>(); | 
|---|
|  |  |  | map.put("key",gaodeKey); | 
|---|
|  |  |  | map.put("sid",sid); | 
|---|
|  |  |  | String  param= JSON.toJSONString(map); | 
|---|
|  |  |  | String result = null; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | result = HttpCurlUtil.sendPostHttp(url, param); | 
|---|
|  |  |  | } catch (IOException e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | cn.hutool.json.JSONObject maps = JSONUtil.parseObj(result); | 
|---|
|  |  |  | System.out.println(maps); | 
|---|
|  |  |  | String errcode = maps.get("errcode").toString(); | 
|---|
|  |  |  | if(!"10000".equals(errcode)){ | 
|---|
|  |  |  | return "fail"; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | return maps.toString(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //        String str2 = maps.get("data").toString(); | 
|---|
|  |  |  | //        cn.hutool.json.JSONObject maps2 = JSONUtil.parseObj(str2); | 
|---|
|  |  |  | //        String serviceId = maps2.get("sid").toString(); | 
|---|
|  |  |  | //        if(null!=serviceId&&!"".equals(serviceId)){ | 
|---|
|  |  |  | //            return serviceId; | 
|---|
|  |  |  | //        }else{ | 
|---|
|  |  |  | //            return "fail"; | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String trackServiceInfo(String gaodeKey, String serviceName) { | 
|---|
|  |  |  | String url = "https://tsapi.amap.com/v1/track/service/list"; | 
|---|
|  |  |  | HttpPost httpPost = new HttpPost(url); | 
|---|
|  |  |  | Map<String,String> map = new HashMap<>(); | 
|---|
|  |  |  | //高德Key | 
|---|
|  |  |  | //用户在高德地图官网申请Web服务API类型Key | 
|---|
|  |  |  | map.put("key",gaodeKey); | 
|---|
|  |  |  | System.out.println("==高德返回"+map); | 
|---|
|  |  |  | String result = null; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | result = HttpCurlUtil.sendGetHttp(url, map); | 
|---|
|  |  |  | } catch (IOException e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | System.out.println("==高德返回"+result); | 
|---|
|  |  |  | cn.hutool.json.JSONObject maps = JSONUtil.parseObj(result); | 
|---|
|  |  |  | String errCode = maps.get("errcode").toString(); | 
|---|
|  |  |  | if("10000".equals(errCode)){ | 
|---|
|  |  |  | String dataStr = maps.get("data").toString(); | 
|---|
|  |  |  | cn.hutool.json.JSONObject dataResults = JSONUtil.parseObj(dataStr); | 
|---|
|  |  |  | String resultsStr = dataResults.get("results").toString(); | 
|---|
|  |  |  | return resultsStr; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | return "fail"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Test | 
|---|
|  |  |  | public void qrcode(){ | 
|---|
|  |  |  | MallMember member = mallMemberMapper.selectById(58L); | 
|---|
|  |  |  | Long id = 320L; | 
|---|
|  |  |  | MallMember member = mallMemberMapper.selectById(402L); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //        ApiRechargeWalletDto apiRechargeWalletDto = new ApiRechargeWalletDto(); | 
|---|
|  |  |  | //        apiRechargeWalletDto.setAmount(new BigDecimal(1)); | 
|---|
|  |  |  | //        apiRechargeWalletDto.setMemberId(402L); | 
|---|
|  |  |  | //        BrandWCPayRequestData brandWCPayRequestData = null; | 
|---|
|  |  |  | //        try { | 
|---|
|  |  |  | //            brandWCPayRequestData = iXcxPayService.startRechargeWallet(apiRechargeWalletDto); | 
|---|
|  |  |  | //        } catch (Exception e) { | 
|---|
|  |  |  | //            throw new FebsException("支付失败"); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        String wxResultStr = JSONUtil.toJsonStr(brandWCPayRequestData); | 
|---|
|  |  |  | //        String payResultStr = brandWCPayRequestData.getPrepay_id(); | 
|---|
|  |  |  | //        Map<String, Object> map = new HashMap<>(); | 
|---|
|  |  |  | //        map.put("orderInfo", payResultStr); | 
|---|
|  |  |  | //        map.put("wxResultStr", wxResultStr); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Long id = 345417L; | 
|---|
|  |  |  | MallOrderInfo mallOrderInfo = mallOrderInfoMapper.selectById(id); | 
|---|
|  |  |  | if(ObjectUtil.isEmpty(mallOrderInfo)){ | 
|---|
|  |  |  | BrandWCPayRequestData brandWCPayRequestData = null; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | brandWCPayRequestData = iXcxPayService.startPayment(mallOrderInfo); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | throw new FebsException("支付失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Integer status = mallOrderInfo.getStatus(); | 
|---|
|  |  |  | if(OrderStatusEnum.WAIT_SHIPPING.getValue() != status){ | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Integer deliveryState = mallOrderInfo.getDeliveryState(); | 
|---|
|  |  |  | if(1 != deliveryState){ | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //根据子订单生成退款记录 | 
|---|
|  |  |  | List<MallOrderItem> mallOrderItemList = mallOrderItemMapper.selectListByOrderId(id); | 
|---|
|  |  |  | if(CollUtil.isEmpty(mallOrderItemList)){ | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for(MallOrderItem mallOrderItem : mallOrderItemList){ | 
|---|
|  |  |  | QueryWrapper<MallRefundEntity> objectQueryWrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | objectQueryWrapper.eq("member_id",member.getId()); | 
|---|
|  |  |  | objectQueryWrapper.eq("order_id",mallOrderInfo.getId()); | 
|---|
|  |  |  | objectQueryWrapper.eq("item_id",mallOrderItem.getId()); | 
|---|
|  |  |  | MallRefundEntity mallRefund = mallRefundMapper.selectOne(objectQueryWrapper); | 
|---|
|  |  |  | MallRefundEntity mallRefundEntity = new MallRefundEntity(); | 
|---|
|  |  |  | if(ObjectUtil.isEmpty(mallRefund)){ | 
|---|
|  |  |  | mallRefundEntity.setRefundNo(mallOrderInfo.getOrderNo()+"_RITEM"+mallOrderItem.getId()); | 
|---|
|  |  |  | mallRefundEntity.setMemberId(member.getId()); | 
|---|
|  |  |  | mallRefundEntity.setOrderId(mallOrderInfo.getId()); | 
|---|
|  |  |  | mallRefundEntity.setItemId(mallOrderItem.getId()); | 
|---|
|  |  |  | if("余额支付".equals(mallOrderInfo.getPayMethod())){ | 
|---|
|  |  |  | mallRefundEntity.setType(3); | 
|---|
|  |  |  | }else if("微信支付".equals(mallOrderInfo.getPayMethod())){ | 
|---|
|  |  |  | mallRefundEntity.setType(1); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | mallRefundEntity.setType(3); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | mallRefundEntity.setState(3); | 
|---|
|  |  |  | mallRefundEntity.setAmount(mallOrderItem.getAmount()); | 
|---|
|  |  |  | mallRefundMapper.insert(mallRefundEntity); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | if(mallRefund.getState() == 2){ | 
|---|
|  |  |  | mallRefundEntity.setId(mallRefund.getId()); | 
|---|
|  |  |  | mallRefundEntity.setRefundNo(mallRefund.getRefundNo()); | 
|---|
|  |  |  | mallRefundEntity.setMemberId(mallRefund.getMemberId()); | 
|---|
|  |  |  | mallRefundEntity.setOrderId(mallRefund.getOrderId()); | 
|---|
|  |  |  | mallRefundEntity.setItemId(mallRefund.getItemId()); | 
|---|
|  |  |  | mallRefundEntity.setType(mallRefund.getType()); | 
|---|
|  |  |  | mallRefundEntity.setState(3); | 
|---|
|  |  |  | mallRefundEntity.setAmount(mallRefund.getAmount()); | 
|---|
|  |  |  | mallRefundMapper.updateById(mallRefundEntity); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ApiLeaderRefundOrderDto apiLeaderRefundOrderDto = new ApiLeaderRefundOrderDto(); | 
|---|
|  |  |  | apiLeaderRefundOrderDto.setOrderId(mallOrderInfo.getId()); | 
|---|
|  |  |  | apiLeaderRefundOrderDto.setItemId(mallOrderItem.getId()); | 
|---|
|  |  |  | apiLeaderRefundOrderDto.setAgreeState(1); | 
|---|
|  |  |  | iApiMallTeamLeaderService.leaderRefundOrder(apiLeaderRefundOrderDto); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String s = JSONUtil.toJsonStr(brandWCPayRequestData); | 
|---|
|  |  |  | String prepay_id = brandWCPayRequestData.getPrepay_id(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //        if(ObjectUtil.isEmpty(mallOrderInfo)){ | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        Integer status = mallOrderInfo.getStatus(); | 
|---|
|  |  |  | //        if(OrderStatusEnum.WAIT_SHIPPING.getValue() != status){ | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        Integer deliveryState = mallOrderInfo.getDeliveryState(); | 
|---|
|  |  |  | //        if(1 != deliveryState){ | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        //根据子订单生成退款记录 | 
|---|
|  |  |  | //        List<MallOrderItem> mallOrderItemList = mallOrderItemMapper.selectListByOrderId(id); | 
|---|
|  |  |  | //        if(CollUtil.isEmpty(mallOrderItemList)){ | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        for(MallOrderItem mallOrderItem : mallOrderItemList){ | 
|---|
|  |  |  | //            QueryWrapper<MallRefundEntity> objectQueryWrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | //            objectQueryWrapper.eq("member_id",member.getId()); | 
|---|
|  |  |  | //            objectQueryWrapper.eq("order_id",mallOrderInfo.getId()); | 
|---|
|  |  |  | //            objectQueryWrapper.eq("item_id",mallOrderItem.getId()); | 
|---|
|  |  |  | //            MallRefundEntity mallRefund = mallRefundMapper.selectOne(objectQueryWrapper); | 
|---|
|  |  |  | //            MallRefundEntity mallRefundEntity = new MallRefundEntity(); | 
|---|
|  |  |  | //            if(ObjectUtil.isEmpty(mallRefund)){ | 
|---|
|  |  |  | //                mallRefundEntity.setRefundNo(mallOrderInfo.getOrderNo()+"_RITEM"+mallOrderItem.getId()); | 
|---|
|  |  |  | //                mallRefundEntity.setMemberId(member.getId()); | 
|---|
|  |  |  | //                mallRefundEntity.setOrderId(mallOrderInfo.getId()); | 
|---|
|  |  |  | //                mallRefundEntity.setItemId(mallOrderItem.getId()); | 
|---|
|  |  |  | //                if("余额支付".equals(mallOrderInfo.getPayMethod())){ | 
|---|
|  |  |  | //                    mallRefundEntity.setType(3); | 
|---|
|  |  |  | //                }else if("微信支付".equals(mallOrderInfo.getPayMethod())){ | 
|---|
|  |  |  | //                    mallRefundEntity.setType(1); | 
|---|
|  |  |  | //                }else{ | 
|---|
|  |  |  | //                    mallRefundEntity.setType(3); | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //                mallRefundEntity.setState(3); | 
|---|
|  |  |  | //                mallRefundEntity.setAmount(mallOrderItem.getAmount()); | 
|---|
|  |  |  | //                mallRefundMapper.insert(mallRefundEntity); | 
|---|
|  |  |  | //            }else{ | 
|---|
|  |  |  | //                if(mallRefund.getState() == 2){ | 
|---|
|  |  |  | //                    mallRefundEntity.setId(mallRefund.getId()); | 
|---|
|  |  |  | //                    mallRefundEntity.setRefundNo(mallRefund.getRefundNo()); | 
|---|
|  |  |  | //                    mallRefundEntity.setMemberId(mallRefund.getMemberId()); | 
|---|
|  |  |  | //                    mallRefundEntity.setOrderId(mallRefund.getOrderId()); | 
|---|
|  |  |  | //                    mallRefundEntity.setItemId(mallRefund.getItemId()); | 
|---|
|  |  |  | //                    mallRefundEntity.setType(mallRefund.getType()); | 
|---|
|  |  |  | //                    mallRefundEntity.setState(3); | 
|---|
|  |  |  | //                    mallRefundEntity.setAmount(mallRefund.getAmount()); | 
|---|
|  |  |  | //                    mallRefundMapper.updateById(mallRefundEntity); | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //            ApiLeaderRefundOrderDto apiLeaderRefundOrderDto = new ApiLeaderRefundOrderDto(); | 
|---|
|  |  |  | //            apiLeaderRefundOrderDto.setOrderId(mallOrderInfo.getId()); | 
|---|
|  |  |  | //            apiLeaderRefundOrderDto.setItemId(mallOrderItem.getId()); | 
|---|
|  |  |  | //            apiLeaderRefundOrderDto.setAgreeState(1); | 
|---|
|  |  |  | //            iApiMallTeamLeaderService.leaderRefundOrder(apiLeaderRefundOrderDto); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|