Prechádzať zdrojové kódy

退款时用户已被删除问题处理

小么熊🐻 2 rokov pred
rodič
commit
a168193fef

+ 41 - 0
jsjp-admin/src/test/java/com/miaxis/test/Test03.java

@@ -5,13 +5,26 @@ import org.apache.commons.io.IOUtils;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.OutputStreamWriter;
 import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
 import java.net.URL;
+import java.net.URLEncoder;
 
 public class Test03 {
 
 
     public static void main(String[] args) throws IOException {
+        //test1();
+
+        String token = "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImIzZjQ2MjgwLTA0OTAtNGI5Zi1iNGI1LTE3NzU5OTJlYTQ1YiJ9.5-Ho3p7WH2LOVLo5KVquos26obPQMf3xtMGYAm60jSAelg4QibTWbhfReppL-RrG4M3NLunlCy9WXMjZn8ePjQ";
+
+
+        test2("12023021514503529883838685788487",token);
+
+    }
+
+    public static void test1() throws IOException {
         URL url = new URL("https://jsjp-admin1.zzxcx.net/jsjp-admin/login/noCode");
         HttpURLConnection conn = (HttpURLConnection) url.openConnection();
         conn.setDoOutput(true);
@@ -39,4 +52,32 @@ public class Test03 {
         conn.disconnect();
     }
 
+    public static void test2(String outTradeNo,String token) throws IOException {
+
+        //String token = "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImIzZjQ2MjgwLTA0OTAtNGI5Zi1iNGI1LTE3NzU5OTJlYTQ1YiJ9.5-Ho3p7WH2LOVLo5KVquos26obPQMf3xtMGYAm60jSAelg4QibTWbhfReppL-RrG4M3NLunlCy9WXMjZn8ePjQ";
+        String urls = "https://jsjp-admin1.zzxcx.net/jsjp-admin/order/info/refund/"+outTradeNo;
+        URL url = new URL(urls);
+        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+        conn.setDoOutput(true);
+        conn.setDoInput(true);
+        conn.setUseCaches(false);
+        conn.setRequestMethod("PUT");
+        conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
+        conn.setRequestProperty("Authorization", token);
+        conn.connect();
+        OutputStreamWriter out = new OutputStreamWriter(conn.getOutputStream());
+        // 把数据写入请求的Body
+        String urlParameters  = "reason=" + URLEncoder.encode("退学退款", "UTF-8");
+        out.write(urlParameters);
+        out.flush();
+        out.close();
+        // 从服务器读取响应
+        InputStream inputStream = conn.getInputStream();
+        String encoding = "utf-8";
+        String body = IOUtils.toString(inputStream, encoding);
+        System.out.println(body);
+        conn.disconnect();
+
+    }
+
 }

+ 3 - 3
jsjp-service/src/main/java/com/miaxis/newgzpt/mapper/GzptSchActivationMapper.java

@@ -18,9 +18,9 @@ public interface GzptSchActivationMapper extends BaseMapper<GzptSchActivation> {
 
     void saveSchActivation(GzptSchActivation schActivation);
 
-    GzptSchActivation getSchActivation(Long stuId);
+    GzptSchActivation getSchActivation(Long userId);
 
-    void delSchActivationByStuId(Long stuId);
+    void delSchActivationByUserId(Long userId);
 
-    void upDelSchActivationByStuId(@Param("stuId")Long stuId,@Param("state")Integer state);
+    void upDelSchActivationByUserId(@Param("userId")Long stuId,@Param("state")Integer state);
 }

+ 3 - 3
jsjp-service/src/main/java/com/miaxis/newgzpt/service/IGzptSchActivationService.java

@@ -20,11 +20,11 @@ public interface IGzptSchActivationService extends IService<GzptSchActivation> {
 
     void saveSchActivation(GzptSchActivation gzptSchActivation);
 
-    int isSchActivation(Long stuId);
+    int isSchActivation(Long userId);
 
-    void delSchActivationByStuId(Long stuId);
+    void delSchActivationByUserId(Long userId);
 
-    void upDelSchActivationByStuId(Long stuId,Integer state);
+    void upDelSchActivationByUserId(Long userId,Integer state);
 
     List<GzptSchActivation> selectSchActivationList(GzptSchActivationDTO gzptSchActivationDTO);
 }

+ 5 - 5
jsjp-service/src/main/java/com/miaxis/newgzpt/service/impl/GzptSchActivationServiceImpl.java

@@ -38,8 +38,8 @@ public class GzptSchActivationServiceImpl extends ServiceImpl<GzptSchActivationM
     }
 
     @Override
-    public int isSchActivation(Long stuId) {
-        GzptSchActivation schActivation= mapper.getSchActivation(stuId);
+    public int isSchActivation(Long userId) {
+        GzptSchActivation schActivation= mapper.getSchActivation(userId);
         if(schActivation!=null){
             if(schActivation.getIsDel()!=null && schActivation.getIsDel()==0) {
                 return 1;
@@ -53,12 +53,12 @@ public class GzptSchActivationServiceImpl extends ServiceImpl<GzptSchActivationM
     }
 
     @Override
-    public void delSchActivationByStuId(Long stuId) {
-        mapper.delSchActivationByStuId(stuId);
+    public void delSchActivationByUserId(Long userId) {
+        mapper.delSchActivationByUserId(userId);
     }
 
     @Override
-    public void upDelSchActivationByStuId(Long stuId,Integer state) { mapper.upDelSchActivationByStuId(stuId,state); }
+    public void upDelSchActivationByUserId(Long userId,Integer state) { mapper.upDelSchActivationByUserId(userId,state); }
 
     @Override
     public List<GzptSchActivation> selectSchActivationList(GzptSchActivationDTO gzptSchActivationDTO) {

+ 16 - 16
jsjp-service/src/main/java/com/miaxis/order/service/impl/OrderInfoServiceImpl.java

@@ -92,14 +92,14 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
 
 
         GzptUserInfo userInfo = userInfoService.getInfoById(order.getUserId());
-        int isActiva = schActivationService.isSchActivation(userInfo.getOutId());
+        int isActiva = schActivationService.isSchActivation(order.getUserId());
         if ("理论实操计时".equals(order.getGoodsName())) {
             //激活操作
             if(isActiva==0) {  //未激活
                 saveActiva(order, userInfo);
                 this.save(orderInfo);
             } else if (isActiva==2) {  //激活过,退款
-                schActivationService.upDelSchActivationByStuId(userInfo.getOutId(),0);
+                schActivationService.upDelSchActivationByUserId(order.getUserId(),0);
             }
         } else if ("科一专项VIP(含计时)".equals(order.getGoodsName())) {
             UserVip userVip = userVipService.getUserVipByUserId(order.getUserId());
@@ -1345,11 +1345,11 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
         Date now = new Date();
 
         GzptUserInfo userInfo = userInfoService.getInfoById(order.getUserId());
-        int isActiva = schActivationService.isSchActivation(userInfo.getOutId());
+        int isActiva = schActivationService.isSchActivation(order.getUserId());
         if ("理论实操计时".equals(order.getGoodsName())) {
             //删除激活
             if(isActiva==1) {
-                schActivationService.upDelSchActivationByStuId(userInfo.getOutId(),1);
+                schActivationService.upDelSchActivationByUserId(order.getUserId(),1);
             }
         } else if ("科一专项VIP(含计时)".equals(order.getGoodsName())) {
             UserVip userVip = userVipService.getUserVipByUserId(order.getUserId());
@@ -1365,7 +1365,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
             }
             //删除激活
             if(isActiva==1) {
-                schActivationService.upDelSchActivationByStuId(userInfo.getOutId(),1);
+                schActivationService.upDelSchActivationByUserId(order.getUserId(),1);
             }
         } else if ("科一专项VIP".equals(order.getGoodsName())) {
             UserVip userVip = userVipService.getUserVipByUserId(order.getUserId());
@@ -1393,7 +1393,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
             }
             //删除激活
             if(isActiva==1) {
-                schActivationService.upDelSchActivationByStuId(userInfo.getOutId(),1);
+                schActivationService.upDelSchActivationByUserId(userInfo.getOutId(),1);
             }
         } else if ("科二专项VIP".equals(order.getGoodsName())) {
             UserVip userVip = userVipService.getUserVipByUserId(order.getUserId());
@@ -1421,7 +1421,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
             }
             //删除激活
             if(isActiva==1) {
-                schActivationService.upDelSchActivationByStuId(userInfo.getOutId(),1);
+                schActivationService.upDelSchActivationByUserId(order.getUserId(),1);
             }
         } else if ("科三专项VIP".equals(order.getGoodsName())) {
             UserVip userVip = userVipService.getUserVipByUserId(order.getUserId());
@@ -1449,7 +1449,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
             }
             //删除激活
             if(isActiva==1) {
-                schActivationService.upDelSchActivationByStuId(userInfo.getOutId(),1);
+                schActivationService.upDelSchActivationByUserId(order.getUserId(),1);
             }
         } else if ("科四专项VIP".equals(order.getGoodsName())) {
             UserVip userVip = userVipService.getUserVipByUserId(order.getUserId());
@@ -1514,7 +1514,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
             }
             //删除激活
             if(isActiva==1) {
-                schActivationService.upDelSchActivationByStuId(userInfo.getOutId(),1);
+                schActivationService.upDelSchActivationByUserId(order.getUserId(),1);
             }
         } else if ("科一+科四VIP".equals(order.getGoodsName())) {
             UserVip userVip = userVipService.getUserVipByUserId(order.getUserId());
@@ -1554,7 +1554,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
             }
             //删除激活
             if(isActiva==1) {
-                schActivationService.upDelSchActivationByStuId(userInfo.getOutId(),1);
+                schActivationService.upDelSchActivationByUserId(order.getUserId(),1);
             }
         } else if ("科二+科三VIP".equals(order.getGoodsName())) {
             UserVip userVip = userVipService.getUserVipByUserId(order.getUserId());
@@ -1600,7 +1600,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
             }
             //删除激活
             if(isActiva==1) {
-                schActivationService.upDelSchActivationByStuId(userInfo.getOutId(),1);
+                schActivationService.upDelSchActivationByUserId(order.getUserId(),1);
             }
         } else if ("科二+科三+科四".equals(order.getGoodsName())) {
             UserVip userVip = userVipService.getUserVipByUserId(order.getUserId());
@@ -1646,7 +1646,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
             }
             //删除激活
             if(isActiva==1) {
-                schActivationService.upDelSchActivationByStuId(userInfo.getOutId(),1);
+                schActivationService.upDelSchActivationByUserId(order.getUserId(),1);
             }
         } else if ("科三+科四VIP".equals(order.getGoodsName())) {
             UserVip userVip = userVipService.getUserVipByUserId(order.getUserId());
@@ -1699,7 +1699,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
             }
             //删除激活
             if(isActiva==1) {
-                schActivationService.upDelSchActivationByStuId(userInfo.getOutId(),1);
+                schActivationService.upDelSchActivationByUserId(order.getUserId(),1);
             }
         } else if ("全科目超级VIP".equals(order.getGoodsName())) {
             UserVip userVip = userVipService.getUserVipByUserId(order.getUserId());
@@ -1734,7 +1734,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
             }
             //删除激活
             if(isActiva==1) {
-                schActivationService.upDelSchActivationByStuId(userInfo.getOutId(),1);
+                schActivationService.upDelSchActivationByUserId(order.getUserId(),1);
             }
         }
         int isShare = schPayConfigService.isSchPayConfigByUser(userInfo);
@@ -1781,8 +1781,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
         schActivationService.saveSchActivation(schActivation);
     }
 
-    private void delActiva(Long stuId) {
-        schActivationService.delSchActivationByStuId(stuId);
+    private void delActiva(Long userId) {
+        schActivationService.delSchActivationByUserId(userId);
     }
 
 }

+ 5 - 5
jsjp-service/src/main/resources/mapper/newgzpt/GzptSchActivationMapper.xml

@@ -19,10 +19,10 @@
     </insert>
 
 
-    <update id="upDelSchActivationByStuId" >
+    <update id="upDelSchActivationByUserId" >
         update gzpt_sch_activation
         set SYNC = 0, IS_DEL = #{state}
-        where STU_ID = #{stuId}
+        where user_id = #{userId}
     </update>
 
 
@@ -30,12 +30,12 @@
 
 
     <select id="getSchActivation" resultType="com.miaxis.newgzpt.domain.GzptSchActivation">
-        select * from GZPT_SCH_ACTIVATION where STU_ID = #{stuId}
+        select * from GZPT_SCH_ACTIVATION where user_id = #{userId}
     </select>
 
 
-    <delete id="delSchActivationByStuId" parameterType="Long">
-        delete GZPT_SCH_ACTIVATION where STU_ID = #{stuId}
+    <delete id="delSchActivationByUserId" parameterType="Long">
+        delete GZPT_SCH_ACTIVATION where user_id = #{userId}
     </delete>