Przeglądaj źródła

小程序显示和退款

xw 3 tygodni temu
rodzic
commit
b7731f9b9a

+ 1 - 0
fs-admin/src/main/java/com/fs/course/controller/FsCoursePlaySourceConfigController.java

@@ -280,6 +280,7 @@ public class FsCoursePlaySourceConfigController extends BaseController {
         if(companyId != null){
             queryWrapper.and(e -> e.eq("company_id", companyId).or().isNull("company_id"));
         }
+        queryWrapper.in("status","0","1");//查询正常、半封禁小程序
         return R.ok().put("data", fsCoursePlaySourceConfigService.list(queryWrapper));
     }
 

+ 4 - 0
fs-service/src/main/java/com/fs/company/domain/Company.java

@@ -143,4 +143,8 @@ public class Company extends BaseEntity
 
     @TableField(exist = false)
     private List<Long> ids;
+
+    //小程序名称
+    @TableField(exist = false)
+    private String queryAppName;
 }

+ 13 - 1
fs-service/src/main/java/com/fs/company/mapper/CompanyMapper.java

@@ -156,10 +156,14 @@ public interface CompanyMapper
 
     @Select({"<script> " +
             "select c.*,cu.user_name,qu.used_num," +
+            "MAX(CASE WHEN cm.type = 0 THEN sc.`name` END) AS masterAppName,"+
+            "MAX(CASE WHEN cm.type = 1 THEN sc.`name` END) AS backupAppName,"+
             "CASE WHEN JSON_VALID(t1.config_value) THEN t1.config_value->>'$.mchId' ELSE NULL END as mchId" +
             " FROM company c LEFT JOIN company_user cu ON c.user_id =cu.user_id  " +
             " left join company_config t1 on t1.config_key = 'redPacket:config' and t1.company_id = c.company_id " +
             "LEFT JOIN (select company_id, count(id) as used_num from qw_user where server_id is not null and server_status = 1 group by company_id) qu ON qu.company_id = c.company_id " +
+            "LEFT JOIN company_miniapp cm ON c.company_id = cm.company_id\n" +
+            "LEFT JOIN fs_course_play_source_config sc ON sc.appid = cm.app_id "+
             "where c.is_del=0 " +
             "            <if test=\"companyName != null  and companyName != ''\"> and c.company_name like concat('%', #{companyName}, '%')</if>\n" +
             "            <if test=\"companyMobile != null  and companyMobile != ''\"> and c.company_mobile = #{companyMobile}</if>\n" +
@@ -174,7 +178,15 @@ public interface CompanyMapper
             "            <if test=\"limitUserCount != null \"> and c.limit_user_count = #{limitUserCount}</if>\n" +
             "            <if test=\"isDel != null \"> and c.is_del = #{isDel}</if>\n" +
             "            <if test=\"deptId != null \"> and c.dept_id = #{deptId}</if> " +
-            "        " +
+            "            <if test=\"queryAppName != null and queryAppName != ''\">\n" +
+            "                AND EXISTS (\n" +
+            "                SELECT 1 FROM company_miniapp cm2\n" +
+            "                LEFT JOIN fs_course_play_source_config sc2 ON sc2.appid = cm2.app_id\n" +
+            "                WHERE cm2.company_id = c.company_id\n" +
+            "                AND sc2.`name` LIKE CONCAT('%', #{queryAppName}, '%')\n" +
+            "                )\n" +
+            "            </if> "+
+            " GROUP BY c.company_id " +
             " order by company_id desc" +
             "</script>"})
     List<CompanyVO> selectCompanyListVO(Company param);

+ 8 - 0
fs-service/src/main/java/com/fs/company/vo/CompanyVO.java

@@ -1,5 +1,6 @@
 package com.fs.company.vo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.annotation.Excel;
 import lombok.Data;
@@ -107,4 +108,11 @@ public class CompanyVO implements Serializable
 
     // 控制休息提示是否打开要暂停  0-关闭 1-打开 null-默认打开
     private Integer isOpenRestReminder;
+    //主程序
+   @TableField(exist = false)
+   private String masterAppName;
+
+   //备小程序
+   @TableField(exist = false)
+   private String backupAppName;
 }

+ 15 - 4
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreAfterSalesScrmServiceImpl.java

@@ -62,9 +62,11 @@ import com.fs.tzBankPay.doman.RefundParam;
 import com.fs.tzBankPay.doman.RefundResult;
 import com.fs.tzBankPay.doman.TzBankResult;
 import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
+import com.github.binarywang.wxpay.bean.request.WxPayRefundV3Request;
 import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
 import com.github.binarywang.wxpay.bean.result.WxPayRefundQueryResult;
 import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
+import com.github.binarywang.wxpay.bean.result.WxPayRefundV3Result;
 import com.github.binarywang.wxpay.config.WxPayConfig;
 import com.github.binarywang.wxpay.exception.WxPayException;
 import com.github.binarywang.wxpay.service.WxPayService;
@@ -880,16 +882,25 @@ public class FsStoreAfterSalesScrmServiceImpl implements IFsStoreAfterSalesScrmS
                         payConfig.setMchId(fsPayConfig.getWxMchId());
                         payConfig.setMchKey(fsPayConfig.getWxMchKey());
                         payConfig.setKeyPath(fsPayConfig.getKeyPath());
+                        payConfig.setPublicKeyId(fsPayConfig.getPublicKeyId());
+                        payConfig.setPublicKeyPath(fsPayConfig.getPublicKeyPath());
+                        payConfig.setApiV3Key(fsPayConfig.getWxApiV3Key());
+                        payConfig.setPrivateKeyPath(fsPayConfig.getPrivateKeyPath());
+                        payConfig.setPrivateCertPath(fsPayConfig.getPrivateCertPath());
                         payConfig.setSubAppId(org.apache.commons.lang3.StringUtils.trimToNull(null));
                         payConfig.setSubMchId(org.apache.commons.lang3.StringUtils.trimToNull(null));
                         wxPayService.setConfig(payConfig);
-                        WxPayRefundRequest refundRequest = new WxPayRefundRequest();
+                        WxPayRefundV3Request refundRequest = new WxPayRefundV3Request();
                         refundRequest.setOutTradeNo("store-"+payment.getPayCode());
                         refundRequest.setOutRefundNo("store-"+payment.getPayCode());
-                        refundRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(payment.getPayMoney().toString()));
-                        refundRequest.setRefundFee(WxPayUnifiedOrderRequest.yuanToFen(refundAmount.toString()));
+                        WxPayRefundV3Request.Amount amount = new WxPayRefundV3Request.Amount();
+                        Integer money = WxPayUnifiedOrderRequest.yuanToFen(payment.getPayMoney().toString());
+                        amount.setRefund(money);
+                        amount.setTotal(money);
+                        amount.setCurrency("CNY");
+                        refundRequest.setAmount(amount);
                         try {
-                            WxPayRefundResult refundResult = wxPayService.refund(refundRequest);
+                            WxPayRefundV3Result refundResult = wxPayService.refundV3(refundRequest);
                             WxPayRefundQueryResult refundQueryResult = wxPayService.refundQuery("", refundResult.getOutTradeNo(), refundResult.getOutRefundNo(), refundResult.getRefundId());
                             if(refundQueryResult!=null&&refundQueryResult.getResultCode().equals("SUCCESS")){
                                 FsStorePaymentScrm paymentMap=new FsStorePaymentScrm();

+ 5 - 0
fs-service/src/main/java/com/fs/qw/domain/QwCompany.java

@@ -1,5 +1,6 @@
 package com.fs.qw.domain;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fs.common.annotation.Excel;
 import com.fs.common.core.domain.BaseEntity;
 import lombok.Data;
@@ -101,4 +102,8 @@ public class QwCompany extends BaseEntity
 
     /** 批量操作的ID数组 */
     private Long[] ids;
+
+    /**小程序名称**/
+    @TableField(exist = false)
+    private String miniName;
 }

+ 8 - 0
fs-service/src/main/java/com/fs/qw/mapper/QwCompanyMapper.java

@@ -31,6 +31,14 @@ public interface QwCompanyMapper
      */
     public List<QwCompany> selectQwCompanyList(QwCompany qwCompany);
 
+    /**
+     * 查询企微主体列表带小程序信息
+     *
+     * @param qwCompany 企微主体
+     * @return 企微主体集合
+     */
+    public List<QwCompany> selectQwCompanyMiniProgramList(QwCompany qwCompany);
+
     /**
      * 新增企微主体
      *

+ 1 - 1
fs-service/src/main/java/com/fs/qw/service/impl/QwCompanyServiceImpl.java

@@ -70,7 +70,7 @@ public class QwCompanyServiceImpl implements IQwCompanyService
     @Override
     public List<QwCompany> selectQwCompanyList(QwCompany qwCompany)
     {
-        return qwCompanyMapper.selectQwCompanyList(qwCompany);
+        return qwCompanyMapper.selectQwCompanyMiniProgramList(qwCompany);
     }
 
     /**

+ 60 - 0
fs-service/src/main/resources/mapper/qw/QwCompanyMapper.xml

@@ -67,6 +67,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
     </select>
 
+    <select id="selectQwCompanyMiniProgramList" resultType="com.fs.qw.domain.QwCompany">
+        SELECT
+            qc.id,
+            qc.corp_id,
+            qc.corp_name,
+            qc.open_secret,
+            qc.open_corp_id,
+            qc.server_agent_id,
+            qc.server_book_corp_id,
+            qc.server_book_secret,
+            qc.token,
+            qc.encoding_aes_key,
+            qc.provider_secret,
+            qc.realm_name_url,
+            qc.notify_url,
+            qc.chat_toolbar,
+            qc.chat_toolbar_oauth,
+            qc.company_ids,
+            qc.STATUS,
+            qc.create_time,
+            qc.update_time,
+            qc.create_by,
+            qc.is_buy,
+            qc.mini_app_id,
+            qc.company_server_num,
+            qc.share_app_id,
+            qc.share_agent_id,
+            qc.share_schema,
+            sc.`name` AS mini_name
+        FROM
+            qw_company qc
+                LEFT JOIN
+            fs_course_play_source_config sc ON qc.mini_app_id = sc.appid
+        <where>
+            <if test="corpId != null  and corpId != ''"> and qc.corp_id = #{corpId}</if>
+            <if test="corpName != null  and corpName != ''"> and qc.corp_name like concat('%', #{corpName}, '%')</if>
+            <if test="openSecret != null  and openSecret != ''"> and qc.open_secret = #{openSecret}</if>
+            <if test="openCorpId != null  and openCorpId != ''"> and qc.open_corp_id = #{openCorpId}</if>
+            <if test="serverAgentId != null  and serverAgentId != ''"> and qc.server_agent_id = #{serverAgentId}</if>
+            <if test="serverBookCorpId != null  and serverBookCorpId != ''"> and qc.server_book_corp_id = #{serverBookCorpId}</if>
+            <if test="serverBookSecret != null  and serverBookSecret != ''"> and qc.server_book_secret = #{serverBookSecret}</if>
+            <if test="token != null  and token != ''"> and qc.token = #{token}</if>
+            <if test="encodingAesKey != null  and encodingAesKey != ''"> and qc.encoding_aes_key = #{encodingAesKey}</if>
+            <if test="providerSecret != null  and providerSecret != ''"> and qc.provider_secret = #{providerSecret}</if>
+            <if test="realmNameUrl != null  and realmNameUrl != ''"> and qc.realm_name_url = #{realmNameUrl}</if>
+            <if test="notifyUrl != null  and notifyUrl != ''"> and qc.notify_url = #{notifyUrl}</if>
+            <if test="chatToolbar != null  and chatToolbar != ''"> and qc.chat_toolbar = #{chatToolbar}</if>
+            <if test="chatToolbarOauth != null  and chatToolbarOauth != ''"> and qc.chat_toolbar_oauth = #{chatToolbarOauth}</if>
+            <if test="companyIds != null  and companyIds != ''"> and FIND_IN_SET(#{companyIds}, qc.company_ids) > 0</if>
+            <if test="status != null "> and qc.status = #{status}</if>
+            <if test="isBuy != null "> and qc.isBuy = #{isBuy}</if>
+            <if test="createDeptId != null "> and qc.create_dept_id = #{createDeptId}</if>
+            <if test="createUserId != null "> and qc.create_user_id = #{createUserId}</if>
+            <if test="shareAppId != null  and shareAppId != ''"> and qc.share_app_id = #{shareAppId}</if>
+            <if test="shareAgentId != null  and shareAgentId != ''"> and qc.share_agent_id = #{shareAgentId}</if>
+            <if test="shareSchema != null  and shareSchema != ''"> and qc.share_schema = #{shareSchema}</if>
+            <if test="miniName != null  and miniName != ''">and sc.`name` like concat('%', #{miniName}, '%') </if>
+        </where>
+    </select>
+
     <select id="selectQwCompanyById" parameterType="Long" resultMap="QwCompanyResult">
         <include refid="selectQwCompanyVo"/>
         where id = #{id}