Browse Source

Merge remote-tracking branch 'refs/remotes/origin/master' into cqtyt_master

xgb 1 tuần trước cách đây
mục cha
commit
93d90b620e

+ 94 - 0
fs-admin/src/main/java/com/fs/his/controller/FsUserExtractController.java

@@ -3,17 +3,35 @@ package com.fs.his.controller;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.IPUtils;
 import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.core.config.WxPayProperties;
+import com.fs.his.domain.FsUser;
 import com.fs.his.domain.FsUserExtract;
 import com.fs.his.param.FsUserExtractParam;
+import com.fs.his.service.IFsUserBillService;
 import com.fs.his.service.IFsUserExtractService;
+import com.fs.his.service.IFsUserService;
 import com.fs.his.vo.FsUserExtractVO;
+import com.fs.hisStore.enums.BillDetailEnum;
+import com.fs.hisStore.service.IFsUserBillScrmService;
+import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
+import com.github.binarywang.wxpay.bean.entpay.EntPayResult;
+import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
+import com.github.binarywang.wxpay.config.WxPayConfig;
+import com.github.binarywang.wxpay.exception.WxPayException;
+import com.github.binarywang.wxpay.service.EntPayService;
+import com.github.binarywang.wxpay.service.WxPayService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
 /**
@@ -29,6 +47,17 @@ public class FsUserExtractController extends BaseController
     @Autowired
     private IFsUserExtractService fsUserExtractService;
 
+    @Autowired
+    private WxPayProperties wxPayProperties;
+    @Autowired
+    private IFsUserService fsUserService;
+
+    @Autowired
+    private WxPayService wxPayService;
+
+    @Autowired
+    private IFsUserBillScrmService billService;
+
     /**
      * 查询用户提现管理列表
      */
@@ -96,4 +125,69 @@ public class FsUserExtractController extends BaseController
     {
         return toAjax(fsUserExtractService.deleteFsUserExtractByExtractIds(extractIds));
     }
+
+
+
+    @PreAuthorize("@ss.hasPermi('his:userExtract:audit')")
+    @PostMapping("/audit")
+    @Transactional
+    public R audit(@RequestBody FsUserExtract fsUserExtract, HttpServletRequest servletRequest)
+    {
+        FsUserExtract extract=fsUserExtractService.selectFsUserExtractByExtractId(fsUserExtract.getExtractId());
+        if(extract.getStatus().equals(0)){
+            FsUser user=fsUserService.selectFsUserById(Long.valueOf(extract.getUserId()));
+            if(fsUserExtract.getStatus()==1){
+                WxPayConfig payConfig = new WxPayConfig();
+                payConfig.setAppId(wxPayProperties.getAppId());
+                payConfig.setMchId(wxPayProperties.getMchId());
+                payConfig.setMchKey(wxPayProperties.getMchKey());
+                payConfig.setSubAppId(org.apache.commons.lang3.StringUtils.trimToNull(null));
+                payConfig.setSubMchId(org.apache.commons.lang3.StringUtils.trimToNull(null));
+                payConfig.setKeyPath(null);
+                payConfig.setNotifyUrl(wxPayProperties.getNotifyUrl());
+                wxPayService.setConfig(payConfig);
+                EntPayService entPayService=wxPayService.getEntPayService();
+                EntPayRequest request=new EntPayRequest();
+                request.setAppid(wxPayProperties.getAppId());
+                request.setMchId(wxPayProperties.getMchId());
+                request.setOpenid(user.getMaOpenId());
+                request.setCheckName("NO_CHECK");
+                request.setSpbillCreateIp(IPUtils.getIpAddr(servletRequest));
+                request.setReUserName(user.getRealName());
+                request.setPartnerTradeNo(extract.getExtractId().toString());
+                request.setDescription("会员提现");
+                request.setAmount(WxPayUnifiedOrderRequest.yuanToFen(extract.getExtractPrice().toString()));
+                try {
+                    EntPayResult result=entPayService.entPay(request);
+                    if(result.getResultCode().equals(0)){
+                        extract.setStatus(1L);
+                        fsUserExtractService.updateFsUserExtract(extract);
+                    }
+                    return R.ok();
+                } catch (WxPayException e) {
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    e.printStackTrace();
+                    return R.error(e.getMessage());
+                }
+
+            }
+            else if(fsUserExtract.getStatus()==-1){
+                extract.setStatus(-1L);
+                extract.setFailMsg(fsUserExtract.getFailMsg());
+                fsUserExtractService.updateFsUserExtract(extract);
+                user.setNowMoney(user.getNowMoney().add(extract.getExtractPrice()));
+                fsUserService.updateFsUser(user);
+                //插入流水
+                billService.addBill(user.getUserId(), BillDetailEnum.CATEGORY_1.getValue(),1,BillDetailEnum.TYPE_5.getDesc(),extract.getExtractPrice(),user.getNowMoney(),"提现申请驳回",extract.getExtractId().toString(),0l);
+                return R.ok();
+            }
+            else{
+                return R.error("非法操作");
+            }
+        }
+        else{
+            return R.error("非法操作");
+        }
+
+    }
 }

+ 1 - 1
fs-live-app/src/main/resources/application.yml

@@ -6,4 +6,4 @@ server:
 # Spring配置
 spring:
   profiles:
-    active: dev
+    active: druid-bjzm-test

+ 3 - 3
fs-service/src/main/java/com/fs/hisStore/domain/FsUserBillScrm.java

@@ -46,7 +46,7 @@ public class FsUserBillScrm extends BaseEntity
 
     /** 明细数字 */
     @Excel(name = "明细数字")
-    private Double number;
+    private BigDecimal number;
 
     @Excel(name = "金额")
     private BigDecimal money;
@@ -139,11 +139,11 @@ public class FsUserBillScrm extends BaseEntity
         this.title = title;
     }
 
-    public Double getNumber() {
+    public BigDecimal getNumber() {
         return number;
     }
 
-    public void setNumber(Double number) {
+    public void setNumber(BigDecimal number) {
         this.number = number;
     }
 

+ 1 - 1
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreOrderScrmMapper.java

@@ -509,7 +509,7 @@ public interface FsStoreOrderScrmMapper
     @Select("select * from fs_store_order_scrm where extend_order_id=#{extendOrderId}")
     FsStoreOrderScrm selectFsStoreOrderByExtendOrderId(String extendOrderId);
     @Select({"<script> " +
-            "select b.number as tui_price,b.bill_type,b.create_time,o.id as order_id,o.order_code,o.pay_price,u.nickname,u.avatar from fs_user_bill b inner join  fs_store_order_scrm o on b.business_id=o.id left join fs_user u on u.user_id=o.user_id  " +
+            "select b.money as tui_price,b.bill_type,b.create_time,o.id as order_id,o.order_code,o.pay_price,u.nickname,u.avatar from fs_user_bill b inner join  fs_store_order_scrm o on b.business_id=o.id left join fs_user u on u.user_id=o.user_id  " +
             "where b.user_id=#{userId} and b.category='brokerage_price'   " +
             " order by b.bill_id desc"+
             "</script>"})

+ 6 - 1
fs-service/src/main/java/com/fs/hisStore/service/impl/FsUserBillScrmServiceImpl.java

@@ -3,6 +3,7 @@ package com.fs.hisStore.service.impl;
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
+import java.util.Optional;
 
 import cn.hutool.json.JSONUtil;
 import com.fs.common.utils.DateUtils;
@@ -55,7 +56,11 @@ public class FsUserBillScrmServiceImpl implements IFsUserBillScrmService
     @Override
     public List<FsUserBillScrm> selectFsUserBillList(FsUserBillScrm fsUserBill)
     {
-        return fsUserBillMapper.selectFsUserBillList(fsUserBill);
+        List<FsUserBillScrm> bills=fsUserBillMapper.selectFsUserBillList(fsUserBill);
+        Optional.ofNullable( bills).ifPresent(list -> list.forEach(bill -> {
+            bill.setNumber(bill.getMoney());
+        }));
+        return bills;
     }
 
     /**

+ 1 - 1
fs-service/src/main/resources/application-config-druid-bjzm.yml

@@ -71,7 +71,7 @@ nuonuo:
 tencent_cloud_config:
   secret_id: AKIDiMq9lDf2EOM9lIfqqfKo7FNgM5meD0sT
   secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
-  bucket: bjzm-1323137866
+  bucket: bjzmky-1323137866
   app_id: 1323137866
   region: ap-guangzhou
   proxy: bjzm

+ 2 - 2
fs-service/src/main/resources/application-druid-yxj.yml

@@ -168,6 +168,6 @@ openIM:
 im:
     type: OPENIM
 #是否为新商户,新商户不走mpOpenId
-isNewWxMerchant: true
-enableRedPackAccount: 0
+isNewWxMerchant: false
+enableRedPackAccount: 1
 

+ 16 - 0
fs-user-app/src/main/java/com/fs/app/controller/store/H5ScrmController.java

@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 @Controller
@@ -31,6 +32,21 @@ public class H5ScrmController
         //return R.ok().put("userAgreement", config.getUserRegister());
         return mv;
     }
+    @GetMapping("/userAgreementNew")
+    @ResponseBody
+    public String userAgreementNew(){
+        String json=configService.selectConfigByKey("store.agreement");
+        AgreementConfig config= JSONUtil.toBean(json, AgreementConfig.class);
+        return config.getUserAgreement();
+    }
+    @GetMapping("/privacyPolicyNew")
+    @ResponseBody
+    public String privacyPolicyNew( )
+    {
+        String json=configService.selectConfigByKey("store.agreement");
+        AgreementConfig config= JSONUtil.toBean(json, AgreementConfig.class);
+        return config.getPrivacyPolicy();
+    }
     @GetMapping("/privacyPolicy")
     public ModelAndView privacyPolicy( )
     {