Althars123 пре 2 година
родитељ
комит
8f11c10108

+ 0 - 158
nbjk-admin/src/main/java/com/miaxis/app/controller/tt/TtController.java

@@ -1,158 +0,0 @@
-package com.miaxis.app.controller.tt;
-
-import cn.hutool.core.bean.BeanUtil;
-import com.alibaba.fastjson.JSONObject;
-import com.miaxis.common.config.WxpayConfig;
-import com.miaxis.common.constant.Constants;
-import com.miaxis.common.core.controller.BaseController;
-import com.miaxis.common.core.domain.Response;
-import com.miaxis.common.core.domain.entity.UserInfo;
-import com.miaxis.common.exception.CustomException;
-import com.miaxis.common.utils.SecurityUtils;
-import com.miaxis.system.service.ISysConfigService;
-import com.miaxis.system.service.ISysUserService;
-import com.miaxis.tt.domain.TtOrder;
-import com.miaxis.tt.service.ITtOrderService;
-import com.miaxis.feign.dto.ToutiaoCreatOrderDTO;
-import com.miaxis.feign.service.ToutiaoService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import lombok.Data;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpPost;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.*;
-
-import static com.miaxis.common.utils.OrderCodeFactory.getOrderCode;
-import static com.miaxis.common.utils.ttUtils.getSign;
-
-/**
- * 【小程序-微信支付】Controller
- *
- * @author miaxis
- * @date 2021-03-10
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping(Constants.STUDENT_PREFIX+"/tt")
-@Api(tags = {"【小程序-头条支付】"})
-@Slf4j
-public class TtController extends BaseController {
-
-    @Autowired
-    private HttpClient httpClient;
-
-    @Autowired
-    private WxpayConfig wxpayConfig;
-
-    @Autowired
-    private ITtOrderService ttOrderService;
-
-    @Autowired
-    private ToutiaoService toutiaoService;
-    @Autowired
-    private ISysConfigService configService;
-
-    @Autowired
-    private ISysUserService sysUserService;
-
-    @Value("${tt.appid}")
-    private String ttappid;
-    @Value("${tt.notifyUrl}")
-    private  String ttnotifyUrl ;
-
-
-
-    /**
-     * 微信支付获取预订单id
-     */
-    @PostMapping(value = "/prepareOrder")
-    @ApiOperation("小程序头条支付下单")
-    public Response<TtParamEntity> getPrepareOrder() throws Exception{
-
-        //创建本地抖音订单
-        TtOrder order = new TtOrder();
-        UserInfo student = SecurityUtils.getLoginUser().getStudent();
-        String orderCode = getOrderCode(student.getId());
-        order.setCpOrderno(orderCode);
-        order.setXcxOpenid(student.getXcxOpenid());
-        order.setUnionId(student.getUnionId());
-        ttOrderService.save(order);
-        return Response.success(placeWxOrder(order));
-
-
-    }
-
-
-
-
-    //下单
-    private TtParamEntity placeWxOrder(TtOrder order) throws Exception {
-        ToutiaoCreatOrderDTO dto = new ToutiaoCreatOrderDTO();
-        dto.setApp_id(ttappid);
-        dto.setOut_order_no(order.getCpOrderno());
-        dto.setTotal_amount(getTotal());
-
-        dto.setSubject("速达驾考会员");
-        dto.setBody("速达驾考会员,可以观看付费内容");
-        dto.setValid_time(900);
-        dto.setNotify_url(ttnotifyUrl);
-        dto.setStore_uid("70963547131799657030");
-        dto.setSign(getSign(BeanUtil.beanToMap(dto,false,true)));
-        String ttReturnStr = toutiaoService.createOrder(dto);
-        System.out.println("tt支付返回"+ttReturnStr);
-        return getWxParamJson(ttReturnStr);
-
-    }
-
-
-
-    private int getTotal() {
-        String price = configService.selectConfigByKey("vip_price");
-        Double dprice = Double.valueOf(price);
-        Double v =dprice* 100;
-        return v.intValue();
-    }
-
-    // 生成调用调起微信支付所需参数
-    private TtParamEntity getWxParamJson(String bodyAsString) throws Exception {
-        JSONObject TtReturn = JSONObject.parseObject(bodyAsString);
-        if (TtReturn.getInteger("err_no") != 0){
-            throw new CustomException(TtReturn.getString("err_tips"));
-        }
-        JSONObject data = TtReturn.getJSONObject("data");
-        TtParamEntity ttParamEntity = new TtParamEntity();
-        ttParamEntity.setOrder_id(data.getString("order_id"));
-        ttParamEntity.setOrder_token(data.getString("order_token"));
-        return ttParamEntity;
-    }
-
-    private HttpPost initHttpPost() {
-        HttpPost httpPost = new HttpPost(wxpayConfig.getV3url());
-        httpPost.addHeader("Accept", "application/json");
-        httpPost.addHeader("Content-type","application/json; charset=utf-8");
-        return httpPost;
-    }
-
-    @Data
-    class  TtParamEntity{
-        String order_id;
-        String order_token;
-
-    }
-
-
-
-
-
-
-
-
-
-
-}

+ 0 - 221
nbjk-admin/src/main/java/com/miaxis/app/controller/tt/TtNotifyController.java

@@ -1,221 +0,0 @@
-package com.miaxis.app.controller.tt;
-
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.miaxis.common.config.WxpayConfig;
-import com.miaxis.common.constant.Constants;
-import com.miaxis.common.core.domain.entity.UserInfo;
-import com.miaxis.common.exception.CustomException;
-import com.miaxis.common.utils.AesUtil;
-import com.miaxis.tt.domain.TtOrder;
-import com.miaxis.tt.dto.TtNotifyReturnDTO;
-import com.miaxis.tt.dto.TtpayNotifyDTO;
-import com.miaxis.tt.dto.TtpaySource;
-import com.miaxis.tt.service.ITtOrderService;
-import com.miaxis.user.service.IUserInfoService;
-import com.miaxis.vip.domain.VipCode;
-import com.miaxis.vip.service.IVipCodeService;
-import com.miaxis.wx.domain.RefundRecord;
-import com.miaxis.wx.domain.WxOrder;
-import com.miaxis.wx.dto.WxNotifyReturnDTO;
-import com.miaxis.wx.dto.WxpayNotifyDTO;
-import com.miaxis.wx.service.IRefundRecordService;
-import com.miaxis.wx.service.IWxOrderService;
-import com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.joda.time.DateTime;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.Base64Utils;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.security.*;
-import java.security.cert.X509Certificate;
-import java.util.Date;
-import java.util.Random;
-
-@RestController
-@RequiredArgsConstructor
-@RequestMapping(Constants.OPEN_PREFIX+"/tt/notify")
-@Api(tags = {"【小程序-微信回调】"})
-@Slf4j
-public class TtNotifyController {
-
-
-    @Autowired
-    private WxpayConfig wxpayConfig;
-
-
-    @Autowired
-    private IWxOrderService wxOrderService;
-
-    @Autowired
-    private ITtOrderService ttOrderService;
-
-    @Autowired
-    private IVipCodeService vipCodeService;
-
-
-    @Autowired
-    private IUserInfoService userInfoService;
-
-
-    @Autowired
-    private  IRefundRecordService  refundRecordService;
-
-    @Autowired
-    private AutoUpdateCertificatesVerifier verifier;
-
-
-    /**
-     * 微信支付回调接口
-     */
-    @PostMapping(value = "/ttpay")
-    @ApiOperation("头条支付回调")
-    public TtNotifyReturnDTO wxpayNotify(@RequestBody TtpayNotifyDTO ttpayNotifyDTO) {
-
-        //将回调数据写入数据库
-        TtpaySource msg = JSONObject.parseObject(ttpayNotifyDTO.getMsg(), TtpaySource.class);
-        writeNotifyDataToDb(msg);
-        //创建兑换码
-        String code = createCode();
-        //激活用户
-        avtivityCode(msg.getCp_orderno(),code);
-
-        TtNotifyReturnDTO ttNotifyReturnDTO = new TtNotifyReturnDTO();
-        ttNotifyReturnDTO.setErr_no(0);
-        ttNotifyReturnDTO.setErr_tips("success");
-        return ttNotifyReturnDTO;
-    }
-
-    private void avtivityCode(String outTradeNo, String vipCode) {
-        TtOrder order= ttOrderService.getOne(new QueryWrapper<TtOrder>().eq("cp_orderno",outTradeNo));
-        if (order ==  null){
-            throw new CustomException("该订单不存在");
-        }
-        UserInfo userInfo = userInfoService.getOne(new QueryWrapper<UserInfo>().eq("union_id", order.getUnionId()));
-        QueryWrapper<VipCode> queryWrapper = new QueryWrapper<VipCode>();
-        queryWrapper.eq("vip_code", vipCode);
-        VipCode vipCodeEntity = vipCodeService.getOne(queryWrapper);
-        if (vipCodeEntity == null){
-            throw new CustomException("该激活码不存在");
-        }
-        if (vipCodeEntity.getStatus() == 1){
-            throw new CustomException("该激活码已被激活");
-        }
-        if (vipCodeEntity.getStatus() == 2){
-            throw new CustomException("该激活码已作废");
-        }
-        vipCodeEntity.setStatus(1);
-        vipCodeEntity.setActivationUserId(userInfo.getId());
-        vipCodeEntity.setActivationTime(new Date());
-        vipCodeService.updateById(vipCodeEntity);
-        userInfo.setIsVip(1);
-        userInfoService.updateById(userInfo);
-
-
-
-
-    }
-
-    private String createCode() {
-        VipCode vipCode = new VipCode();
-        String rVipCode = null ;
-        do {
-            rVipCode  = randomVipcode();
-        }while (isRepeat(rVipCode));
-        vipCode.setVipCode(rVipCode);
-        vipCodeService.save(vipCode);
-        return rVipCode;
-    }
-
-
-    private Boolean validate(HttpServletRequest request, String bodyString) throws  NoSuchAlgorithmException, InvalidKeyException, SignatureException {
-        String sign = request.getHeader("Wechatpay-Signature");
-        String timestamp = request.getHeader("Wechatpay-Timestamp");
-        String nonce = request.getHeader("Wechatpay-Nonce");
-
-        StringBuffer sb = new StringBuffer();
-        sb.append(timestamp + "\n");
-        sb.append(nonce + "\n");
-        sb.append(bodyString + "\n");
-        X509Certificate validCertificate = verifier.getValidCertificate();
-        // 进行签名服务
-        Signature signature = Signature.getInstance("SHA256withRSA");
-        // 用微信平台公钥对签名器进行初始化
-        signature.initVerify(validCertificate);
-        // 把我们构造的验签名串更新到签名器中
-        signature.update(sb.toString().getBytes(StandardCharsets.UTF_8));
-        Boolean result = signature.verify(Base64Utils.decodeFromString(sign));
-        log.info("微信支付回调验签:"+result.toString());
-        return result;
-
-    }
-
-
-
-
-
-
-
-
-
-    public void writeNotifyDataToDb(TtpaySource msg) {
-        TtOrder order= ttOrderService.getOne(new QueryWrapper<TtOrder>().eq("cp_orderno",msg.getCp_orderno()));
-        if (order == null) {
-            throw new CustomException("该订单不存在");
-        }
-        order.setPaymentOrderNo(msg.getPayment_order_no());
-        order.setChannelNo(msg.getChannel_no());
-        order.setWay(msg.getWay());
-        order.setCpExtra(msg.getCp_extra());
-        order.setItemId(msg.getItem_id());
-        order.setSellerUid(msg.getSeller_uid());
-        order.setStatus(msg.getStatus());
-        order.setTotalAmount(msg.getTotal_amount());
-        order.setPaidAt(new Date(msg.getPaid_at()));
-        ttOrderService.updateById(order);
-
-    }
-
-    private String getSourString(WxpayNotifyDTO wxpayNotifyDTO) throws GeneralSecurityException, IOException {
-        AesUtil aesUtil = new AesUtil(wxpayConfig.getV3key().getBytes());
-        WxpayNotifyDTO.WxpaySource wxpaySource = wxpayNotifyDTO.getResource();
-        return aesUtil.decryptToString(wxpaySource.getAssociated_data().getBytes(), wxpaySource.getNonce().getBytes(), wxpaySource.getCiphertext());
-    }
-
-    private String randomVipcode() {
-        String result = "";
-        Random random = new Random();
-        for(int i =0 ;i <11 ;i ++){
-            result+=random.nextInt(10);
-        }
-        return  result;
-
-
-    }
-    private boolean isRepeat(String rVipCode) {
-        QueryWrapper<VipCode> wrapper = new QueryWrapper<VipCode>();
-        wrapper.eq("vip_code",rVipCode);
-        VipCode one = vipCodeService.getOne(wrapper);
-        return one!= null;
-
-    }
-
-
-
-
-
-
-}

+ 104 - 114
nbjk-admin/src/main/java/com/miaxis/system/controller/system/SysLoginController.java

@@ -98,17 +98,7 @@ public class SysLoginController
     @Value("${app.appSecret}")
     private String appSecret;
 
-    @Value("${dy.appId}")
-    private String dyappid;
 
-    @Value("${dy.appSecret}")
-    private String dyappSecret;
-
-    @Value("${tt.appId}")
-    private String ttappid;
-
-    @Value("${tt.appSecret}")
-    private String ttappSecret;
 
 
 
@@ -177,110 +167,110 @@ public class SysLoginController
 
     }
 
-    /**
-     *
-     */
-    @PostMapping("/login/ttcode")
-    @ApiOperation("字节小程序授权码模式登录")
-    public Response<TokenDTO> loginByTtAuthorizationCode(String authorizationCode ){
-        ToutiaoTokenDTO toutiaoTokenDTO  = new ToutiaoTokenDTO();
-        toutiaoTokenDTO.setCode(authorizationCode);
-        toutiaoTokenDTO.setAppid(ttappid);
-        toutiaoTokenDTO.setSecret(ttappSecret);
-        String ttResultStr = toutiaoService.getTtUserInfo(toutiaoTokenDTO);
-        logger.info("字节小程序授权码登录返回值:"+ttResultStr);
-        TtResult ttResult = JSONObject.parseObject(ttResultStr,TtResult.class);
-
-        // 生成令牌
-        if (ttResult.getErr_no() != 0){
-            throw new CustomException("抖音授权登录无效,错误原因:"+ttResult.getErr_tips());
-        }
-
-
-        ServletUtils.getRequest().setAttribute("third","douyin");
-        ServletUtils.getRequest().setAttribute("headImage","");
-        ServletUtils.getRequest().setAttribute("nickName","");
-        ServletUtils.getRequest().setAttribute("openid",ttResult.getData().getOpenid());
-
-        String token = loginService.login(ttResult.getData().getUnionid(),null, StudentLoginTypeEnum.AUTHORIZATION_CODE_TT_LOGIN.getCode());
-        TokenDTO tokenDTO = new TokenDTO();
-        tokenDTO.setToken(token);
-        tokenDTO.setThirdResult(ttResult);
-        return Response.success(tokenDTO) ;
-
-
-
-    }
-
-    /**
-     *
-     */
-    @PostMapping("/login/ttcodeTest")
-    @ApiOperation("字节小程序授权码模式登录(测试,固定uionid)")
-    public Response<TokenDTO> loginByTtAuthorizationCodeTest(){
-
-
-        ServletUtils.getRequest().setAttribute("third","douyin");
-        ServletUtils.getRequest().setAttribute("headImage","");
-        ServletUtils.getRequest().setAttribute("nickName","");
-        ServletUtils.getRequest().setAttribute("openid","a99b2d43-0609-4273-8d5f-ae3fdc0dec35");
-
-        String token = loginService.login("0e412d99-1186-40c2-a004-213f06f75df9",null, StudentLoginTypeEnum.AUTHORIZATION_CODE_TT_LOGIN.getCode());
-        TokenDTO tokenDTO = new TokenDTO();
-        tokenDTO.setToken(token);
-        tokenDTO.setThirdResult(null);
-        return Response.success(tokenDTO) ;
-
-
-
-    }
-
-    /**
-     * 用户 openid登录
-     *
-     */
-    @PostMapping("/login/dycode")
-    @ApiOperation("抖音用户授权码模式登录")
-    public Response<TokenDTO> loginByDyAuthorizationCode(String authorizationCode ){
-        DyTokenDTO dyTokenDTO = new DyTokenDTO();
-        MultiValueMap<String,Object> paramsMap = new LinkedMultiValueMap<String,Object>();
-        paramsMap.add("grant_type","authorization_code");
-        paramsMap.add("client_secret",dyappSecret);
-        paramsMap.add("code",authorizationCode);
-        paramsMap.add("client_key",dyappid);
-//        dyTokenDTO.setGrantType("authorization_code");
-//        dyTokenDTO.setClientKey(dyappid);
-//        dyTokenDTO.setClientSecret(dyappSecret);
-//        dyTokenDTO.setCode(authorizationCode);
-        String dyResultStr = dyService.getDyToken1(dyappSecret,authorizationCode,"authorization_code",dyappid);
-        //HttpUtils.sendPost()
-       // String dyResultStr = dyService.getDyToken1(dyappSecret,authorizationCode,"authorization_code",dyappid);
-        logger.info("抖音授权码登录返回值:"+dyResultStr);
-        DyResult dyResult = JSONObject.parseObject(dyResultStr,DyResult.class);
-
-        // 生成令牌
-        if (dyResult.getData().getError_code() != 0){
-            throw new CustomException("抖音授权登录无效,错误原因:"+dyResult.getData().getDescription());
-        }
-        DyUserInfoDTO dyUserInfoDTO= new DyUserInfoDTO();
-        dyUserInfoDTO.setOpen_id(dyResult.getData().getOpen_id());
-        dyUserInfoDTO.setAccess_token(dyResult.getData().getAccess_token());
-        String userInfoStr = dyService.getUserInfo(dyUserInfoDTO);
-        DyUserInfoResult dyUserInfoResult = JSONObject.parseObject(userInfoStr,DyUserInfoResult.class);
-
-        ServletUtils.getRequest().setAttribute("third","douyin");
-        ServletUtils.getRequest().setAttribute("headImage",dyUserInfoResult.getData().getAvatar());
-        ServletUtils.getRequest().setAttribute("nickName",dyUserInfoResult.getData().getNickname());
-        ServletUtils.getRequest().setAttribute("openid",dyUserInfoResult.getData().getOpen_id());
-        String token = loginService.login(dyUserInfoResult.getData().getUnion_id(),null, StudentLoginTypeEnum.AUTHORIZATION_CODE_DY_LOGIN.getCode());
-        TokenDTO tokenDTO = new TokenDTO();
-        tokenDTO.setToken(token);
-        tokenDTO.setThirdResult(dyUserInfoResult);
-        return Response.success(tokenDTO) ;
-
-
-
-    }
+//    /**
+//     *
+//     */
+//    @PostMapping("/login/ttcode")
+//    @ApiOperation("字节小程序授权码模式登录")
+//    public Response<TokenDTO> loginByTtAuthorizationCode(String authorizationCode ){
+//        ToutiaoTokenDTO toutiaoTokenDTO  = new ToutiaoTokenDTO();
+//        toutiaoTokenDTO.setCode(authorizationCode);
+//        toutiaoTokenDTO.setAppid(ttappid);
+//        toutiaoTokenDTO.setSecret(ttappSecret);
+//        String ttResultStr = toutiaoService.getTtUserInfo(toutiaoTokenDTO);
+//        logger.info("字节小程序授权码登录返回值:"+ttResultStr);
+//        TtResult ttResult = JSONObject.parseObject(ttResultStr,TtResult.class);
+//
+//        // 生成令牌
+//        if (ttResult.getErr_no() != 0){
+//            throw new CustomException("抖音授权登录无效,错误原因:"+ttResult.getErr_tips());
+//        }
+//
+//
+//        ServletUtils.getRequest().setAttribute("third","douyin");
+//        ServletUtils.getRequest().setAttribute("headImage","");
+//        ServletUtils.getRequest().setAttribute("nickName","");
+//        ServletUtils.getRequest().setAttribute("openid",ttResult.getData().getOpenid());
+//
+//        String token = loginService.login(ttResult.getData().getUnionid(),null, StudentLoginTypeEnum.AUTHORIZATION_CODE_TT_LOGIN.getCode());
+//        TokenDTO tokenDTO = new TokenDTO();
+//        tokenDTO.setToken(token);
+//        tokenDTO.setThirdResult(ttResult);
+//        return Response.success(tokenDTO) ;
+//
+//
+//
+//    }
+//
+//    /**
+//     *
+//     */
+//    @PostMapping("/login/ttcodeTest")
+//    @ApiOperation("字节小程序授权码模式登录(测试,固定uionid)")
+//    public Response<TokenDTO> loginByTtAuthorizationCodeTest(){
+//
+//
+//        ServletUtils.getRequest().setAttribute("third","douyin");
+//        ServletUtils.getRequest().setAttribute("headImage","");
+//        ServletUtils.getRequest().setAttribute("nickName","");
+//        ServletUtils.getRequest().setAttribute("openid","a99b2d43-0609-4273-8d5f-ae3fdc0dec35");
+//
+//        String token = loginService.login("0e412d99-1186-40c2-a004-213f06f75df9",null, StudentLoginTypeEnum.AUTHORIZATION_CODE_TT_LOGIN.getCode());
+//        TokenDTO tokenDTO = new TokenDTO();
+//        tokenDTO.setToken(token);
+//        tokenDTO.setThirdResult(null);
+//        return Response.success(tokenDTO) ;
+//
+//
+//
+//    }
+//
+//    /**
+//     * 用户 openid登录
+//     *
+//     */
+//    @PostMapping("/login/dycode")
+//    @ApiOperation("抖音用户授权码模式登录")
+//    public Response<TokenDTO> loginByDyAuthorizationCode(String authorizationCode ){
+//        DyTokenDTO dyTokenDTO = new DyTokenDTO();
+//        MultiValueMap<String,Object> paramsMap = new LinkedMultiValueMap<String,Object>();
+//        paramsMap.add("grant_type","authorization_code");
+//        paramsMap.add("client_secret",dyappSecret);
+//        paramsMap.add("code",authorizationCode);
+//        paramsMap.add("client_key",dyappid);
+////        dyTokenDTO.setGrantType("authorization_code");
+////        dyTokenDTO.setClientKey(dyappid);
+////        dyTokenDTO.setClientSecret(dyappSecret);
+////        dyTokenDTO.setCode(authorizationCode);
+//        String dyResultStr = dyService.getDyToken1(dyappSecret,authorizationCode,"authorization_code",dyappid);
+//        //HttpUtils.sendPost()
+//       // String dyResultStr = dyService.getDyToken1(dyappSecret,authorizationCode,"authorization_code",dyappid);
+//        logger.info("抖音授权码登录返回值:"+dyResultStr);
+//        DyResult dyResult = JSONObject.parseObject(dyResultStr,DyResult.class);
+//
+//        // 生成令牌
+//        if (dyResult.getData().getError_code() != 0){
+//            throw new CustomException("抖音授权登录无效,错误原因:"+dyResult.getData().getDescription());
+//        }
+//        DyUserInfoDTO dyUserInfoDTO= new DyUserInfoDTO();
+//        dyUserInfoDTO.setOpen_id(dyResult.getData().getOpen_id());
+//        dyUserInfoDTO.setAccess_token(dyResult.getData().getAccess_token());
+//        String userInfoStr = dyService.getUserInfo(dyUserInfoDTO);
+//        DyUserInfoResult dyUserInfoResult = JSONObject.parseObject(userInfoStr,DyUserInfoResult.class);
+//
+//        ServletUtils.getRequest().setAttribute("third","douyin");
+//        ServletUtils.getRequest().setAttribute("headImage",dyUserInfoResult.getData().getAvatar());
+//        ServletUtils.getRequest().setAttribute("nickName",dyUserInfoResult.getData().getNickname());
+//        ServletUtils.getRequest().setAttribute("openid",dyUserInfoResult.getData().getOpen_id());
+//        String token = loginService.login(dyUserInfoResult.getData().getUnion_id(),null, StudentLoginTypeEnum.AUTHORIZATION_CODE_DY_LOGIN.getCode());
+//        TokenDTO tokenDTO = new TokenDTO();
+//        tokenDTO.setToken(token);
+//        tokenDTO.setThirdResult(dyUserInfoResult);
+//        return Response.success(tokenDTO) ;
+//
+//
+//
+//    }
     @PostMapping("/login/code/test")
     @ApiOperation("微信用户授权码模式登录--测试")
     public Response<TokenDTO> testloginByAuthorizationCode(String authorizationCode ){

+ 0 - 11
nbjk-admin/src/main/resources/application-dev.yml

@@ -110,17 +110,6 @@ app:
     appId: wxc439503456129660
     appSecret: f9e43ce4a2709eb118e268827aa63cae
 
-# 抖音
-dy:
-    appId: awbewr7xlianfnew
-    appSecret: dd979dc2a5ddcc0c761fcbe899d87ba1
-
-# 字节小程序
-tt:
-    appId: tta896de2b37a8562901
-    appSecret: d00d88459e539cc086e035d8376810f2506ad064
-    notifyUrl: https://nbjk-admin1.zzxcx.net/nbjk-admin/open-api/tt/notify/ttpay
-    notifyUrlRefund: https://nbjk-admin1.zzxcx.net/nbjk-admin/open-api/tt/notify/refund
 
 
 # 微信支付

+ 1 - 6
nbjk-admin/src/main/resources/application-prodtest.yml

@@ -111,12 +111,7 @@ app:
 dy:
     appId: awbewr7xlianfnew
     appSecret: dd979dc2a5ddcc0c761fcbe899d87ba1
-# 字节小程序
-tt:
-    appId: tta896de2b37a8562901
-    appSecret: d00d88459e539cc086e035d8376810f2506ad064
-    notifyUrl: https://nbjk-admin.zzxcx.net/nbjk-admin/open-api/tt/notify/ttpay
-    notifyUrlRefund: https://nbjk-admin.zzxcx.net/nbjk-admin/open-api/tt/notify/refund
+
 # 微信支付
 wxpay:
     v3url: https://api.mch.weixin.qq.com/v3/pay/transactions/app

+ 0 - 222
nbjk-service/src/main/java/com/miaxis/tt/domain/TtOrder.java

@@ -1,222 +0,0 @@
-package com.miaxis.tt.domain;
-
-import java.util.Date;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import com.miaxis.common.annotation.Excel;
-import com.miaxis.common.core.domain.BaseEntity;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.miaxis.common.core.domain.BaseBusinessEntity;
-import lombok.Data;
-/**
- * 头条订单对象 tt_order
- *
- * @author miaxis
- * @date 2022-05-19
- */
-@Data
-@TableName("tt_order")
-@ApiModel(value = "TtOrder", description = "头条订单对象 tt_order")
-public class TtOrder extends BaseBusinessEntity{
-    private static final long serialVersionUID = 1L;
-
-    /** id */
-    @TableId(value = "id")
-    @ApiModelProperty(value = "id")
-    private Long id;
-
-    /** 商户订单号 */
-    @Excel(name = "商户订单号")
-    @TableField("cp_orderno")
-    @ApiModelProperty(value = "商户订单号")
-    private String cpOrderno;
-
-    /** 退款单号 */
-    @Excel(name = "退款单号")
-    @TableField("out_refund_no")
-    @ApiModelProperty(value = "退款单号")
-    private String outRefundNo;
-
-    /** way 字段中标识了支付渠道:
-1-微信支付,2-支付宝支付,10-抖音支付 */
-    @Excel(name = "way 字段中标识了支付渠道: 1-微信支付,2-支付宝支付,10-抖音支付")
-    @TableField("way")
-    @ApiModelProperty(value = "way 字段中标识了支付渠道: 1-微信支付,2-支付宝支付,10-抖音支付")
-    private String way;
-
-    /** 退款原因 */
-    @Excel(name = "退款原因")
-    @TableField("refund_reason")
-    @ApiModelProperty(value = "退款原因")
-    private String refundReason;
-
-    /** 支付渠道侧单号 */
-    @Excel(name = "支付渠道侧单号")
-    @TableField("channel_no")
-    @ApiModelProperty(value = "支付渠道侧单号")
-    private String channelNo;
-
-    /** 支付渠道侧商家订单号 */
-    @Excel(name = "支付渠道侧商家订单号")
-    @TableField("payment_order_no")
-    @ApiModelProperty(value = "支付渠道侧商家订单号")
-    private String paymentOrderNo;
-
-
-    /** 固定SUCCESS */
-    @Excel(name = "固定SUCCESS")
-    @TableField("status")
-    @ApiModelProperty(value = "固定SUCCESS")
-    private String status;
-
-
-    /** 附加数据 */
-    @Excel(name = "附加数据")
-    @TableField("cp_extra")
-    @ApiModelProperty(value = "附加数据")
-    private String cpExtra;
-
-    /** 支付完成时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "支付完成时间", width = 30, dateFormat = "yyyy-MM-dd")
-    @TableField("paid_at")
-    @ApiModelProperty(value = "支付完成时间")
-    private Date paidAt;
-
-    /** 订单来源视频对应视频 id */
-    @Excel(name = "订单来源视频对应视频 id")
-    @TableField("item_id")
-    @ApiModelProperty(value = "订单来源视频对应视频 id")
-    private String itemId;
-
-    /** 该笔交易卖家商户号 */
-    @Excel(name = "该笔交易卖家商户号")
-    @TableField("seller_uid")
-    @ApiModelProperty(value = "该笔交易卖家商户号")
-    private String sellerUid;
-
-    /** unionid */
-    @Excel(name = "unionid")
-    @TableField("union_id")
-    @ApiModelProperty(value = "unionid")
-    private String unionId;
-
-    /** 小程序端openid */
-    @Excel(name = "小程序端openid")
-    @TableField("xcx_openid")
-    @ApiModelProperty(value = "小程序端openid")
-    private String xcxOpenid;
-
-    /** 用户在直连商户appid下的唯一标识 */
-    @Excel(name = "用户在直连商户appid下的唯一标识")
-    @TableField("app_openid")
-    @ApiModelProperty(value = "用户在直连商户appid下的唯一标识")
-    private String appOpenid;
-
-    /** 总金额 */
-    @Excel(name = "总金额")
-    @TableField("total_amount")
-    @ApiModelProperty(value = "总金额")
-    private Integer totalAmount;
-
-    public void setId(Long id){
-        this.id = id;
-    }
-
-    public Long getId(){
-        return id;
-    }
-    public void setCpOrderno(String cpOrderno){
-        this.cpOrderno = cpOrderno;
-    }
-
-    public String getCpOrderno(){
-        return cpOrderno;
-    }
-    public void setOutRefundNo(String outRefundNo){
-        this.outRefundNo = outRefundNo;
-    }
-
-    public String getOutRefundNo(){
-        return outRefundNo;
-    }
-    public void setWay(String way){
-        this.way = way;
-    }
-
-    public String getWay(){
-        return way;
-    }
-    public void setRefundReason(String refundReason){
-        this.refundReason = refundReason;
-    }
-
-    public String getRefundReason(){
-        return refundReason;
-    }
-    public void setChannelNo(String channelNo){
-        this.channelNo = channelNo;
-    }
-
-    public String getChannelNo(){
-        return channelNo;
-    }
-    public void setPaymentOrderNo(String paymentOrderNo){
-        this.paymentOrderNo = paymentOrderNo;
-    }
-
-
-    public String getCpExtra(){
-        return cpExtra;
-    }
-    public void setPaidAt(Date paidAt){
-        this.paidAt = paidAt;
-    }
-
-    public Date getPaidAt(){
-        return paidAt;
-    }
-    public void setItemId(String itemId){
-        this.itemId = itemId;
-    }
-
-    public String getItemId(){
-        return itemId;
-    }
-    public void setSellerUid(String sellerUid){
-        this.sellerUid = sellerUid;
-    }
-
-    public String getSellerUid(){
-        return sellerUid;
-    }
-    public void setUnionId(String unionId){
-        this.unionId = unionId;
-    }
-
-    public String getUnionId(){
-        return unionId;
-    }
-    public void setXcxOpenid(String xcxOpenid){
-        this.xcxOpenid = xcxOpenid;
-    }
-
-    public String getXcxOpenid(){
-        return xcxOpenid;
-    }
-    public void setAppOpenid(String appOpenid){
-        this.appOpenid = appOpenid;
-    }
-
-    public String getAppOpenid(){
-        return appOpenid;
-    }
-
-
-}

+ 0 - 9
nbjk-service/src/main/java/com/miaxis/tt/dto/TtNotifyReturnDTO.java

@@ -1,9 +0,0 @@
-package com.miaxis.tt.dto;
-
-import lombok.Data;
-
-@Data
-public class TtNotifyReturnDTO {
-    Integer err_no;
-    String err_tips;
-}

+ 0 - 35
nbjk-service/src/main/java/com/miaxis/tt/dto/TtpayNotifyDTO.java

@@ -1,35 +0,0 @@
-package com.miaxis.tt.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-/**
- * 微信支付回调 dto
- */
-@Data
-public class TtpayNotifyDTO {
-
-
-    @ApiModelProperty(value = "Unix 时间戳,10 位,整型数")
-    private Long timestamp;
-
-    @ApiModelProperty(value = "随机数")
-    private String nonce;
-
-    @ApiModelProperty(value = "订单信息的 json 字符串")
-    private String msg;
-
-
-    @ApiModelProperty(value = "回调类型标记,支付成功回调为\"payment\"")
-    private String type;
-
-
-    @ApiModelProperty(value = "签名")
-    private String msg_signature;
-
-
-
-
-
-
-}

+ 0 - 34
nbjk-service/src/main/java/com/miaxis/tt/dto/TtpaySource.java

@@ -1,34 +0,0 @@
-package com.miaxis.tt.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-public class TtpaySource {
-    @ApiModelProperty(value = "当前交易发起的小程序id")
-    private String appid;
-    @ApiModelProperty(value = "开发者侧的订单号")
-    private String cp_orderno;
-    @ApiModelProperty(value = "预下单时开发者传入字段")
-    private String cp_extra;
-    @ApiModelProperty(value = "way 字段中标识了支付渠道1-微信支付,2-支付宝支付,10-抖音支付")
-    private String way;
-    @ApiModelProperty(value = "支付渠道侧单号")
-    private String channel_no;
-
-
-    @ApiModelProperty(value = "支付渠道侧商家订单号")
-    private String payment_order_no;
-    @ApiModelProperty(value = "支付金额,单位为分")
-    private Integer total_amount;
-    @ApiModelProperty(value = "固定SUCCESS")
-    private String status;
-    @ApiModelProperty(value = "订单来源视频对应视频 id")
-    private String item_id;
-    @ApiModelProperty(value = "该笔交易卖家商户号")
-    private String seller_uid;
-    @ApiModelProperty(value = "支付时间,Unix 时间戳,10 位,整型数")
-    private Long paid_at;
-    @ApiModelProperty(value = "抖音侧订单号")
-    private String order_id;
-}

+ 0 - 22
nbjk-service/src/main/java/com/miaxis/tt/mapper/TtOrderMapper.java

@@ -1,22 +0,0 @@
-package com.miaxis.tt.mapper;
-
-import java.util.List;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.miaxis.tt.domain.TtOrder;
-
-/**
- * 头条订单Mapper接口
- *
- * @author miaxis
- * @date 2022-05-19
- */
-public interface TtOrderMapper extends BaseMapper<TtOrder> {
-    /**
-     * 查询头条订单列表
-     *
-     * @param ttOrder 头条订单
-     * @return 头条订单集合
-     */
-    public List<TtOrder> selectTtOrderList(TtOrder ttOrder);
-
-}

+ 0 - 21
nbjk-service/src/main/java/com/miaxis/tt/service/ITtOrderService.java

@@ -1,21 +0,0 @@
-package com.miaxis.tt.service;
-
-import java.util.List;
-import com.miaxis.tt.domain.TtOrder;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- * 头条订单Service接口
- *
- * @author miaxis
- * @date 2022-05-19
- */
-public interface ITtOrderService extends IService<TtOrder>{
-    /**
-     * 查询头条订单列表
-     *
-     * @param ttOrder 头条订单
-     * @return 头条订单集合
-     */
-    public List<TtOrder> selectTtOrderList(TtOrder ttOrder);
-}

+ 0 - 36
nbjk-service/src/main/java/com/miaxis/tt/service/impl/TtOrderServiceImpl.java

@@ -1,36 +0,0 @@
-package com.miaxis.tt.service.impl;
-
-import java.util.List;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.miaxis.common.utils.DateUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.apache.commons.lang3.StringUtils;
-import com.miaxis.tt.mapper.TtOrderMapper;
-import com.miaxis.tt.domain.TtOrder;
-import com.miaxis.tt.service.ITtOrderService;
-
-/**
- * 头条订单Service业务层处理
- *
- * @author miaxis
- * @date 2022-05-19
- */
-@Service
-public class TtOrderServiceImpl extends ServiceImpl<TtOrderMapper, TtOrder> implements ITtOrderService {
-    @Autowired
-    private TtOrderMapper ttOrderMapper;
-
-    /**
-     * 查询头条订单列表
-     *
-     * @param ttOrder 头条订单
-     * @return 头条订单
-     */
-    @Override
-    public List<TtOrder> selectTtOrderList(TtOrder ttOrder){
-        return ttOrderMapper.selectTtOrderList(ttOrder);
-    }
-}

+ 0 - 57
nbjk-service/src/main/resources/mapper/tt/TtOrderMapper.xml

@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.miaxis.tt.mapper.TtOrderMapper">
-
-    <resultMap type="TtOrder" id="TtOrderResult">
-        <result property="id"    column="id"    />
-        <result property="cpOrderno"    column="cp_orderno"    />
-        <result property="outRefundNo"    column="out_refund_no"    />
-        <result property="way"    column="way"    />
-        <result property="refundReason"    column="refund_reason"    />
-        <result property="channelNo"    column="channel_no"    />
-        <result property="paymentOrderNo"    column="payment_order_no"    />
-        <result property="tradeType"    column="trade_type"    />
-        <result property="status"    column="status"    />
-        <result property="bankType"    column="bank_type"    />
-        <result property="cpExtra"    column="cp_extra"    />
-        <result property="paidAt"    column="paid_at"    />
-        <result property="itemId"    column="item_id"    />
-        <result property="sellerUid"    column="seller_uid"    />
-        <result property="unionId"    column="union_id"    />
-        <result property="xcxOpenid"    column="xcx_openid"    />
-        <result property="appOpenid"    column="app_openid"    />
-        <result property="totalAmount"    column="total_amount"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateTime"    column="update_time"    />
-    </resultMap>
-
-    <sql id="selectTtOrderVo">
-        select * from tt_order
-    </sql>
-
-    <select id="selectTtOrderList" parameterType="TtOrder" resultMap="TtOrderResult">
-        <include refid="selectTtOrderVo"/>
-        <where>
-            <if test="cpOrderno != null  and cpOrderno != ''"> and cp_orderno = #{cpOrderno}</if>
-            <if test="outRefundNo != null  and outRefundNo != ''"> and out_refund_no = #{outRefundNo}</if>
-            <if test="way != null  and way != ''"> and way = #{way}</if>
-            <if test="refundReason != null  and refundReason != ''"> and refund_reason = #{refundReason}</if>
-            <if test="channelNo != null  and channelNo != ''"> and channel_no = #{channelNo}</if>
-            <if test="paymentOrderNo != null  and paymentOrderNo != ''"> and payment_order_no = #{paymentOrderNo}</if>
-            <if test="tradeType != null  and tradeType != ''"> and trade_type = #{tradeType}</if>
-            <if test="status != null  and status != ''"> and status = #{status}</if>
-            <if test="bankType != null  and bankType != ''"> and bank_type = #{bankType}</if>
-            <if test="cpExtra != null  and cpExtra != ''"> and cp_extra = #{cpExtra}</if>
-            <if test="paidAt != null "> and paid_at = #{paidAt}</if>
-            <if test="itemId != null  and itemId != ''"> and item_id = #{itemId}</if>
-            <if test="sellerUid != null  and sellerUid != ''"> and seller_uid = #{sellerUid}</if>
-            <if test="unionId != null  and unionId != ''"> and union_id = #{unionId}</if>
-            <if test="xcxOpenid != null  and xcxOpenid != ''"> and xcx_openid = #{xcxOpenid}</if>
-            <if test="appOpenid != null  and appOpenid != ''"> and app_openid = #{appOpenid}</if>
-            <if test="totalAmount != null "> and total_amount = #{totalAmount}</if>
-        </where>
-    </select>
-
-</mapper>