Pu Zhibing
4 天以前 25cf266e99714ac5d428e66b40ce272325c91dd8
ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TEnterpriseWithdrawalController.java
@@ -2,35 +2,31 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.beetl.ShiroExtUtil;
import com.stylefeng.guns.core.log.LogObjectHolder;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.cloudPayment.example.MchApplicationExample;
import com.stylefeng.guns.modular.system.controller.util.Base64Util;
import com.stylefeng.guns.modular.system.model.TBank;
import com.stylefeng.guns.modular.system.model.TBankNext;
import com.stylefeng.guns.modular.system.model.TEnterpriseWithdrawal;
import com.stylefeng.guns.modular.system.model.TImgMid;
import com.stylefeng.guns.modular.system.service.ITBankNextService;
import com.stylefeng.guns.modular.system.service.ITBankService;
import com.stylefeng.guns.modular.system.service.ITEnterpriseWithdrawalService;
import com.stylefeng.guns.modular.system.service.ITImgMidService;
import com.unionpay.upyzt.exception.UpyztException;
import com.unionpay.upyzt.resp.MchApplicationResp;
import com.unionpay.upyzt.resp.MchApplicationStoreResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.stylefeng.guns.core.log.LogObjectHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.stylefeng.guns.modular.system.model.TEnterpriseWithdrawal;
import com.stylefeng.guns.modular.system.service.ITEnterpriseWithdrawalService;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Base64;
import java.util.List;
/**
@@ -58,8 +54,8 @@
     * 跳转到首页
     */
    @RequestMapping("")
    public String index(Model model) throws UpyztException {
        TEnterpriseWithdrawal companyId = tEnterpriseWithdrawalService.selectOne(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", ShiroKit.getUser().getObjectId()));
    public String index(Model model) {
        TEnterpriseWithdrawal companyId = tEnterpriseWithdrawalService.selectOne(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", ShiroExtUtil.getUser().getObjectId()));
        if(companyId!=null){
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            model.addAttribute("item",companyId);
@@ -81,15 +77,6 @@
            }else if("account_need_verify".equals(companyId.getApplicationStatus())){
                model.addAttribute("bank",bankService.selectList(null));
                model.addAttribute("bankOne",bankNextService.selectList(null));
                MchApplicationResp mchApplicationResp = MchApplicationExample.retrieveById(companyId.getMchApplicationId());
                System.out.println(mchApplicationResp);
                String type = mchApplicationResp.getAcctValidation().getType();
                model.addAttribute("type",Integer.valueOf(type));
                if("1".equals(type)){
                    model.addAttribute("money",mchApplicationResp.getAcctValidation().getPayAmount());
                    model.addAttribute("no",mchApplicationResp.getAcctValidation().getDestAcctNo());
                }
                return PREFIX + "tEnterpriseWithdrawal_edit.html";
            }else if("succeeded".equals(companyId.getApplicationStatus())){
                model.addAttribute("bank",bankService.selectList(null));
@@ -151,7 +138,7 @@
    @Transactional(readOnly = false,propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
    public Object add(TEnterpriseWithdrawal tEnterpriseWithdrawal,Integer accountType,String code,String businessExpireTimeOne,String unifiedSocialCreditCodeExpireTimeOne,String certificateExpireTimeOne) {
        tEnterpriseWithdrawal.setCode(code);
        List<TEnterpriseWithdrawal> companyId = tEnterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", ShiroKit.getUser().getObjectId()));
        List<TEnterpriseWithdrawal> companyId = tEnterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", ShiroExtUtil.getUser().getObjectId()));
        if(companyId.size()>0){
            return "5001";
        }
@@ -173,7 +160,7 @@
        }
        tEnterpriseWithdrawal.setIsAudit(1);
        tEnterpriseWithdrawal.setCompanyId(ShiroKit.getUser().getObjectId());
        tEnterpriseWithdrawal.setCompanyId(ShiroExtUtil.getUser().getObjectId());
        tEnterpriseWithdrawal.setAccountType(accountType);
        String randomString = ToolUtil.getRandomString(32);
        tEnterpriseWithdrawal.setOutRequestNo(randomString);
@@ -189,13 +176,8 @@
            tEnterpriseWithdrawal.setCopy2(itImgMidService.selectOne(new EntityWrapper<TImgMid>().eq("url",tEnterpriseWithdrawal.getCorporateIdCardFrontPicture())).getMid());
            tEnterpriseWithdrawal.setCopy3(itImgMidService.selectOne(new EntityWrapper<TImgMid>().eq("url",tEnterpriseWithdrawal.getCorporateIdCardReversePicture())).getMid());
            System.out.println("----------"+"进件gogogo"+"----------");
            MchApplicationStoreResp mchApplicationStoreResp = MchApplicationExample.create(tEnterpriseWithdrawal);
            System.out.println("----------"+mchApplicationStoreResp+"----------");
            tEnterpriseWithdrawal.setOutRequestNo(mchApplicationStoreResp.getOutRequestNo());
            tEnterpriseWithdrawal.setMchApplicationId(mchApplicationStoreResp.getMchApplicationId());
            tEnterpriseWithdrawal.setTransactionAuthorizationCode(Base64Util.encode(tEnterpriseWithdrawal.getTransactionAuthorizationCode()));
            tEnterpriseWithdrawal.setBusinessLicense(tEnterpriseWithdrawal.getBusinessLicense());
            tEnterpriseWithdrawal.setCorporateIdCardFrontPicture(tEnterpriseWithdrawal.getCorporateIdCardFrontPicture());
@@ -203,9 +185,6 @@
            tEnterpriseWithdrawal.setApplicationStatus("auditing");
            tEnterpriseWithdrawalService.insert(tEnterpriseWithdrawal);
            return SUCCESS_TIP;
        }catch (UpyztException e){
            e.printStackTrace();
            return e.getIssue();
        } catch (Exception e) {
            e.printStackTrace();
            return  ERROR;
@@ -253,12 +232,8 @@
        try {
            TEnterpriseWithdrawal enterpriseWithdrawal = tEnterpriseWithdrawalService.selectById(tEnterpriseWithdrawal.getId());
            MchApplicationResp mchApplicationResp = MchApplicationExample.retrieveById(enterpriseWithdrawal.getMchApplicationId());
            System.err.println(mchApplicationResp);
            if(enterpriseWithdrawal.getMchId()!=null){
                tEnterpriseWithdrawal.setMchId(enterpriseWithdrawal.getMchId());
            }else {
                tEnterpriseWithdrawal.setMchId(mchApplicationResp.getMchId());
            }
            tEnterpriseWithdrawal.setOutRequestNo(ToolUtil.getRandomString(32));
            String copy1 = tEnterpriseWithdrawalService.getmid(tEnterpriseWithdrawal.getCorporateIdCardFrontPicture());
@@ -274,9 +249,6 @@
            tEnterpriseWithdrawal.setBankBranchCode(tBankNext.getBankCode());
            MchApplicationResp renew = MchApplicationExample.renew(tEnterpriseWithdrawal);
            tEnterpriseWithdrawal.setOutRequestNo(renew.getOutRequestNo());
            tEnterpriseWithdrawal.setMchApplicationId(renew.getMchApplicationId());
            tEnterpriseWithdrawalService.updateById(tEnterpriseWithdrawal);
            return SUCCESS_TIP;
        }catch (Exception e){