| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import cn.hutool.core.codec.Base64; |
| | | import cn.hutool.core.util.ZipUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.SuccessTip; |
| | | import com.stylefeng.guns.core.common.constant.state.ManagerStatus; |
| | | import com.stylefeng.guns.core.exception.GunsException; |
| | | import com.stylefeng.guns.core.exception.ServiceExceptionEnum; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TAgentResp; |
| | | import com.stylefeng.guns.modular.system.controller.util.ExcelUtil; |
| | | import com.stylefeng.guns.modular.system.controller.util.UUIDUtil; |
| | | import com.stylefeng.guns.modular.system.enums.OrderStateEnum; |
| | | import com.stylefeng.guns.modular.system.enums.PayStatusEnum; |
| | | import com.stylefeng.guns.modular.system.enums.UserTypeEnum; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.model.BindAccount; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.model.Register; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.model.*; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.util.TrhRequest; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.OutputStream; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.net.InetAddress; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | private IUserService userService; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private ISettlementRecordService settlementRecordService; |
| | | |
| | | @Autowired |
| | | private IRechargeRecordService rechargeRecordService; |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | |
| | | user.setSex(1); |
| | | userService.insert(user); |
| | | |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | registeredMerchant(tAgent); |
| | | } |
| | | }).start(); |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | |
| | | |
| | | public void registeredMerchant(TAgent tAgent){ |
| | | Register registerVO = new Register(); |
| | | registerVO.setMerUserId("agent_" + tAgent.getId()); |
| | | registerVO.setPhone(tAgent.getPrincipalPhone()); |
| | | registerVO.setUserType(tAgent.getUserType().toString()); |
| | | registerVO.setUserName(tAgent.getMerchantName()); |
| | | registerVO.setCertId(tAgent.getMerchantIDCode()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | registerVO.setCertIdExpires(sdf.format(tAgent.getCertIdExpires())); |
| | | registerVO.setBusinessScope(tAgent.getBusinessScope()); |
| | | registerVO.setSocialCreditCode(tAgent.getSocialCreditCode()); |
| | | registerVO.setSocialCreditCodeExpires(sdf.format(tAgent.getSocialCreditCodeExpires())); |
| | | registerVO.setLegalPhone(tAgent.getLegalPhone()); |
| | | registerVO.setLegalPerson(tAgent.getLegalPerson()); |
| | | registerVO.setAddress(tAgent.getAddress()); |
| | | /** |
| | | * 省份编码(子商户类型非小微必填) 字段长度最长:4位 |
| | | */ |
| | | registerVO.setProvCode("0035"); |
| | | /** |
| | | * 地区编码(子商户类型非小微必填) 字段长度最长:4位 |
| | | */ |
| | | registerVO.setAreaCode("3501"); |
| | | registerVO.setFileNo(tAgent.getFileNo()); |
| | | registerVO.setNotifyUrl(callbackPath + "/base/driver/microenterpriseCallback"); |
| | | registerVO.setParameter1(tAgent.getId().toString()); |
| | | |
| | | TrhRequest<Register> request = new TrhRequest(); |
| | | InterfaceResponse response = request.execute(registerVO, Register.SERVICE_CODE); |
| | | if("0000".equals(response.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(response.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | tAgent.setMerchantStatus(2); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("注册代理商子商户失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | tAgent.setMerchantStatus(0); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("注册代理商子商户处理中"); |
| | | } |
| | | if("1".equals(status)){ |
| | | String userId = jsonObject.getString("userId"); |
| | | tAgent.setMerchantNumber(userId); |
| | | tAgent.setMerchantStatus(1); |
| | | tAgentService.updateById(tAgent); |
| | | |
| | | //开始绑定结算账户 |
| | | BindAccount bindAccount = new BindAccount(); |
| | | bindAccount.setUserId(tAgent.getMerchantNumber()); |
| | | bindAccount.setCertId(tAgent.getMerchantIDCode()); |
| | | bindAccount.setCardName(tAgent.getCardName()); |
| | | bindAccount.setCardNo(tAgent.getCardNo()); |
| | | bindAccount.setBankAcctType(tAgent.getBankAcctType().toString()); |
| | | bindAccount.setPhone(tAgent.getPhone()); |
| | | bindAccount.setBankCode(tAgent.getBankCode()); |
| | | /** |
| | | * 省份编码 |
| | | */ |
| | | bindAccount.setProvCode("0035"); |
| | | /** |
| | | * 地区编码 |
| | | */ |
| | | bindAccount.setAreaCode("3501"); |
| | | TrhRequest<BindAccount> request1 = new TrhRequest(); |
| | | InterfaceResponse execute = request1.execute(bindAccount, BindAccount.SERVICE_CODE); |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(execute.getResult()); |
| | | String status1 = jsonObject1.getString("status"); |
| | | if("2".equals(status1)){ |
| | | tAgent.setBankStatus(2); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户失败" ); |
| | | } |
| | | if("1".equals(status1)){ |
| | | tAgent.setBankStatus(1); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户成功"); |
| | | } |
| | | if("0".equals(status1)){ |
| | | tAgent.setBankStatus(0); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户处理中"); |
| | | } |
| | | }else{ |
| | | System.err.println("绑定结算账户失败:" + execute.getMsg()); |
| | | if(tAgent.getUserType() == 0){ |
| | | Register registerVO = new Register(); |
| | | registerVO.setMerUserId("agent_" + tAgent.getId()); |
| | | registerVO.setPhone(tAgent.getPrincipalPhone()); |
| | | registerVO.setUserType("0"); |
| | | registerVO.setUserName(tAgent.getMerchantName()); |
| | | registerVO.setCertId(tAgent.getMerchantIDCode()); |
| | | registerVO.setNotifyUrl(callbackPath + "/base/driver/microenterpriseCallback"); |
| | | TrhRequest<Register> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(registerVO, Register.SERVICE_CODE); |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | tAgent.setMerchantStatus(2); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("注册代理商子商户失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | tAgent.setMerchantStatus(0); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("注册代理商子商户处理中"); |
| | | } |
| | | if("1".equals(status)){ |
| | | String userId = jsonObject.getString("userId"); |
| | | tAgent.setMerchantNumber(userId); |
| | | tAgent.setMerchantStatus(1); |
| | | tAgentService.updateById(tAgent); |
| | | |
| | | BindAccount bindAccount = new BindAccount(); |
| | | bindAccount.setUserId(tAgent.getMerchantNumber()); |
| | | bindAccount.setCertId(tAgent.getMerchantIDCode()); |
| | | bindAccount.setCardName(tAgent.getCardName()); |
| | | bindAccount.setCardNo(tAgent.getCardNo()); |
| | | bindAccount.setBankAcctType(tAgent.getBankAcctType().toString()); |
| | | bindAccount.setPhone(tAgent.getPhone()); |
| | | TrhRequest<BindAccount> request1 = new TrhRequest(); |
| | | InterfaceResponse execute1 = request1.execute(bindAccount, BindAccount.SERVICE_CODE); |
| | | if("0000".equals(execute1.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(execute1.getResult()); |
| | | String status1 = jsonObject1.getString("status"); |
| | | if("2".equals(status1)){ |
| | | tAgent.setBankStatus(2); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户失败" ); |
| | | } |
| | | if("1".equals(status1)){ |
| | | tAgent.setBankStatus(1); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户成功"); |
| | | } |
| | | if("0".equals(status1)){ |
| | | tAgent.setBankStatus(0); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户处理中"); |
| | | } |
| | | }else{ |
| | | System.err.println("绑定结算账户失败:" + execute.getMsg()); |
| | | } |
| | | } |
| | | }else{ |
| | | System.err.println("注册代理商子商户异常:" + execute.getMsg()); |
| | | } |
| | | }else{ |
| | | System.err.println("注册代理商子商户异常:" + response.getMsg()); |
| | | Register registerVO = new Register(); |
| | | registerVO.setMerUserId("agent_" + tAgent.getId()); |
| | | registerVO.setPhone(tAgent.getPrincipalPhone()); |
| | | registerVO.setUserType(tAgent.getUserType().toString()); |
| | | registerVO.setUserName(tAgent.getMerchantName()); |
| | | registerVO.setCertId(tAgent.getMerchantIDCode()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | registerVO.setCertIdExpires(sdf.format(tAgent.getCertIdExpires())); |
| | | registerVO.setBusinessScope(tAgent.getBusinessScope()); |
| | | registerVO.setSocialCreditCode(tAgent.getSocialCreditCode()); |
| | | registerVO.setSocialCreditCodeExpires(sdf.format(tAgent.getSocialCreditCodeExpires())); |
| | | registerVO.setLegalPhone(tAgent.getLegalPhone()); |
| | | registerVO.setLegalPerson(tAgent.getLegalPerson()); |
| | | registerVO.setAddress(tAgent.getAddress()); |
| | | /** |
| | | * 省份编码(子商户类型非小微必填) 字段长度最长:4位 |
| | | */ |
| | | registerVO.setProvCode("0035"); |
| | | /** |
| | | * 地区编码(子商户类型非小微必填) 字段长度最长:4位 |
| | | */ |
| | | registerVO.setAreaCode("3501"); |
| | | registerVO.setFileNo(tAgent.getFileNo()); |
| | | registerVO.setNotifyUrl(callbackPath + "/base/driver/microenterpriseCallback"); |
| | | registerVO.setParameter1(tAgent.getId().toString()); |
| | | |
| | | TrhRequest<Register> request = new TrhRequest(); |
| | | InterfaceResponse response = request.execute(registerVO, Register.SERVICE_CODE); |
| | | if("0000".equals(response.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(response.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | tAgent.setMerchantStatus(2); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("注册代理商子商户失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | tAgent.setMerchantStatus(0); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("注册代理商子商户处理中"); |
| | | } |
| | | if("1".equals(status)){ |
| | | String userId = jsonObject.getString("userId"); |
| | | tAgent.setMerchantNumber(userId); |
| | | tAgent.setMerchantStatus(1); |
| | | tAgentService.updateById(tAgent); |
| | | |
| | | //开始绑定结算账户 |
| | | BindAccount bindAccount = new BindAccount(); |
| | | bindAccount.setUserId(tAgent.getMerchantNumber()); |
| | | bindAccount.setCertId(tAgent.getMerchantIDCode()); |
| | | bindAccount.setCardName(tAgent.getCardName()); |
| | | bindAccount.setCardNo(tAgent.getCardNo()); |
| | | bindAccount.setBankAcctType(tAgent.getBankAcctType().toString()); |
| | | bindAccount.setPhone(tAgent.getPhone()); |
| | | bindAccount.setBankCode(tAgent.getBankCode()); |
| | | /** |
| | | * 省份编码 |
| | | */ |
| | | bindAccount.setProvCode("0035"); |
| | | /** |
| | | * 地区编码 |
| | | */ |
| | | bindAccount.setAreaCode("3501"); |
| | | TrhRequest<BindAccount> request1 = new TrhRequest(); |
| | | InterfaceResponse execute = request1.execute(bindAccount, BindAccount.SERVICE_CODE); |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(execute.getResult()); |
| | | String status1 = jsonObject1.getString("status"); |
| | | if("2".equals(status1)){ |
| | | tAgent.setBankStatus(2); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户失败" ); |
| | | } |
| | | if("1".equals(status1)){ |
| | | tAgent.setBankStatus(1); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户成功"); |
| | | } |
| | | if("0".equals(status1)){ |
| | | tAgent.setBankStatus(0); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户处理中"); |
| | | } |
| | | }else{ |
| | | System.err.println("绑定结算账户失败:" + execute.getMsg()); |
| | | } |
| | | |
| | | } |
| | | }else{ |
| | | System.err.println("注册代理商子商户异常:" + response.getMsg()); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/uploadFile") |
| | | public String uploadFile(MultipartFile file){ |
| | | File srcFile = null; |
| | | String originalFilename = file.getOriginalFilename(); |
| | | String substring = originalFilename.substring(originalFilename.lastIndexOf(".")); |
| | | String fileName = ""; |
| | | try { |
| | | fileName = UUIDUtil.getRandomCode(28) + ".png"; |
| | | srcFile = multipartFileToFile(file, fileName); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | ImageUpload imageUpload = new ImageUpload(); |
| | | imageUpload.setMerUserId("33567678901213221"); |
| | | File zip = ZipUtil.zip(srcFile); |
| | | imageUpload.setName(zip.getName()); |
| | | imageUpload.setFile(Base64.encode(zip)); |
| | | TrhRequest<ImageUpload> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(imageUpload, ImageUpload.SERVICE_CODE); |
| | | if(execute.getCode().equals("0000")){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | return jsonObject.getString("fileNo"); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | public File multipartFileToFile(MultipartFile file, String fileName) throws Exception { |
| | | File toFile = null; |
| | | if (file.equals("") || file.getSize() <= 0) { |
| | | file = null; |
| | | } else { |
| | | InputStream ins = null; |
| | | ins = file.getInputStream(); |
| | | toFile = new File("D:\\logs\\" + fileName); |
| | | inputStreamToFile(ins, toFile); |
| | | ins.close(); |
| | | } |
| | | return toFile; |
| | | |
| | | } |
| | | |
| | | |
| | | private static void inputStreamToFile(InputStream ins, File file) { |
| | | try { |
| | | OutputStream os = new FileOutputStream(file); |
| | | int bytesRead = 0; |
| | | byte[] buffer = new byte[8192]; |
| | | while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) { |
| | | os.write(buffer, 0, bytesRead); |
| | | } |
| | | os.close(); |
| | | ins.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到企业信息页 |
| | | * @return |
| | | */ |
| | | @GetMapping("/showEnterprisePage") |
| | | public String showEnterprisePage(Model model){ |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | Integer objectId = user.getObjectId(); |
| | | Integer roleType = user.getRoleType(); |
| | | User user1 = userService.selectById(user.getId()); |
| | | TAgent tAgent = new TAgent(); |
| | | if(roleType == 1){//平台 |
| | | tAgent.setPrincipal(user1.getName()); |
| | | tAgent.setPrincipalPhone(user1.getPhone()); |
| | | tAgent.setEmail(user1.getEmail()); |
| | | tAgent.setMerchantNumber("553021440975"); |
| | | } |
| | | if(roleType == 3){//代理商 |
| | | tAgent = tAgentService.selectById(objectId); |
| | | } |
| | | model.addAttribute("roleType", roleType); |
| | | model.addAttribute("item", tAgent); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | model.addAttribute("socialCreditCodeExpires", roleType == 1 ? "" : sdf.format(tAgent.getSocialCreditCodeExpires())); |
| | | model.addAttribute("certIdExpires", roleType == 1 ? "" : sdf.format(tAgent.getCertIdExpires())); |
| | | Wrapper<SettlementRecord> settlementRecordWrapper = new EntityWrapper<SettlementRecord>().eq("type", roleType == 1 ? 1 : 2); |
| | | if(roleType == 2){ |
| | | settlementRecordWrapper.eq("objectId", objectId); |
| | | } |
| | | List<SettlementRecord> settlementRecords = settlementRecordService.selectList(settlementRecordWrapper.isNotNull("arrivalTime").orderBy("insertTime desc")); |
| | | model.addAttribute("settlementRecords", settlementRecords); |
| | | |
| | | QueryBalance queryBalance = new QueryBalance(); |
| | | queryBalance.setUserId(tAgent.getMerchantNumber()); |
| | | TrhRequest<QueryBalance> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(queryBalance, QueryBalance.SERVICE_CODE); |
| | | model.addAttribute("balance", 0); |
| | | model.addAttribute("marketingAmount", 0); |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | model.addAttribute("balance", jsonObject.getDoubleValue("settledAmount") / 100); |
| | | if(roleType == 1){ |
| | | model.addAttribute("marketingAmount", jsonObject.getDoubleValue("marketingAmount") / 100); |
| | | } |
| | | } |
| | | return PREFIX + "enterprisePage.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 提现申请 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/withdrawCash") |
| | | public ResultUtil withdrawCash(){ |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | Integer objectId = user.getObjectId(); |
| | | Integer roleType = user.getRoleType(); |
| | | User user1 = userService.selectById(user.getId()); |
| | | TAgent tAgent = new TAgent(); |
| | | if(roleType == 1){//平台 |
| | | tAgent.setLegalPerson(user1.getName()); |
| | | tAgent.setLegalPhone(user1.getPhone()); |
| | | tAgent.setEmail(user1.getEmail()); |
| | | tAgent.setMerchantNumber("553021440975"); |
| | | } |
| | | if(roleType == 3){//代理商 |
| | | tAgent = tAgentService.selectById(objectId); |
| | | } |
| | | QueryBalance queryBalance = new QueryBalance(); |
| | | queryBalance.setUserId(tAgent.getMerchantNumber()); |
| | | TrhRequest<QueryBalance> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(queryBalance, QueryBalance.SERVICE_CODE); |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | double settledAmount = jsonObject.getDoubleValue("settledAmount"); |
| | | if(0 == settledAmount){ |
| | | return ResultUtil.error("余额不足"); |
| | | } |
| | | SettlementRecord settlementRecord = new SettlementRecord(); |
| | | settlementRecord.setType(roleType == 1 ? 1 : 2); |
| | | if(roleType == 3){ |
| | | settlementRecord.setObjectId(tAgent.getId()); |
| | | } |
| | | settlementRecord.setAmount(settledAmount); |
| | | settlementRecord.setInsertTime(new Date()); |
| | | settlementRecordService.insert(settlementRecord); |
| | | |
| | | |
| | | Withdraw withdraw = new Withdraw(); |
| | | withdraw.setUserId(tAgent.getMerchantNumber()); |
| | | withdraw.setAmount(settledAmount + ""); |
| | | withdraw.setOrderName("账户余额提现"); |
| | | withdraw.setRemark("账户余额提现"); |
| | | withdraw.setNotifyUrl(callbackPath + "/tAgent/withdrawCashCallback"); |
| | | withdraw.setParameter1(settlementRecord.getId().toString()); |
| | | TrhRequest<Withdraw> request1 = new TrhRequest(); |
| | | InterfaceResponse execute1 = request1.execute(withdraw, Withdraw.SERVICE_CODE);//结算(提现) |
| | | if("0000".equals(execute1.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(execute1.getResult()); |
| | | String merOrderId1 = jsonObject1.getString("merOrderId"); |
| | | Integer status = jsonObject1.getInteger("status");//0:待处理;1:成功;2:失败 |
| | | if(0 == status){ |
| | | return ResultUtil.error("申请处理中"); |
| | | } |
| | | if(1 == status){ |
| | | settlementRecord.setOrderNumber(merOrderId1); |
| | | settlementRecord.setArrivalTime(new Date()); |
| | | settlementRecordService.updateById(settlementRecord); |
| | | return ResultUtil.success(); |
| | | } |
| | | if(2 == status){ |
| | | return ResultUtil.error("结算接口异常【提现】:" + jsonObject1.getString("statusMsg")); |
| | | } |
| | | }else{ |
| | | return ResultUtil.error("结算接口异常【提现】:" + execute.getMsg()); |
| | | } |
| | | |
| | | }else{ |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | return ResultUtil.error("未知异常"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 提现回调 |
| | | * @param interfaceResponse |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/withdrawCashCallback") |
| | | public void withdrawCashCallback(@RequestBody InterfaceResponse interfaceResponse) { |
| | | if("0000".equals(interfaceResponse.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(interfaceResponse.getResult()); |
| | | String merOrderId1 = jsonObject1.getString("merOrderId"); |
| | | Integer status = jsonObject1.getInteger("status");//0:待处理;1:成功;2:失败 |
| | | if(1 == status){ |
| | | String parameter1 = jsonObject1.getString("parameter1"); |
| | | SettlementRecord settlementRecord = settlementRecordService.selectById(parameter1); |
| | | settlementRecord.setOrderNumber(merOrderId1); |
| | | settlementRecord.setArrivalTime(new Date()); |
| | | settlementRecordService.updateById(settlementRecord); |
| | | } |
| | | if(2 == status){ |
| | | System.err.println("结算接口异常【提现】:" + jsonObject1.getString("statusMsg")); |
| | | } |
| | | }else{ |
| | | System.err.println("结算接口异常【提现】:" + interfaceResponse.getMsg()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 充值补贴金额 |
| | | * @param amount |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/accountRecharge") |
| | | public ResultUtil accountRecharge(Double amount){ |
| | | try { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String out_trade_no = sdf.format(new Date()) + UUIDUtil.getNumberRandom(3); |
| | | RechargeRecord rechargeRecord = new RechargeRecord(); |
| | | rechargeRecord.setCode(out_trade_no); |
| | | rechargeRecord.setType(4); |
| | | rechargeRecord.setAmount(amount); |
| | | rechargeRecord.setPayType(2); |
| | | rechargeRecord.setPayStatus(1); |
| | | rechargeRecord.setCreateTime(new Date()); |
| | | rechargeRecordService.insert(rechargeRecord); |
| | | |
| | | Deposit deposit = new Deposit(); |
| | | deposit.setAmount(String.valueOf(Double.valueOf(amount * 100).intValue())); |
| | | deposit.setOrderName("补贴充值"); |
| | | deposit.setPayType("ALI_CB"); |
| | | deposit.setTerminalIp(InetAddress.getLocalHost().getHostAddress()); |
| | | deposit.setFrontUrl(callbackPath + "/tAgent/accountRechargeCallback"); |
| | | deposit.setNotifyUrl(callbackPath + "/tAgent/accountRechargeCallback"); |
| | | deposit.setParameter1(rechargeRecord.getId().toString()); |
| | | TrhRequest<Deposit> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(deposit, Deposit.SERVICE_CODE); |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | Integer status = jsonObject.getInteger("status"); |
| | | if(2 == status){ |
| | | return ResultUtil.error("支付异常"); |
| | | } |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String payCode = jsonObject.getString("payCode"); |
| | | if(ToolUtil.isNotEmpty(payCode)){ |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 10){ |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | RechargeRecord rechargeRecord1 = rechargeRecordService.selectById(rechargeRecord.getId()); |
| | | if(rechargeRecord1.getPayStatus() != 1){ |
| | | return; |
| | | } |
| | | QueryOrder queryOrder = new QueryOrder(); |
| | | queryOrder.setOriginalMerOrderId(merOrderId); |
| | | /** |
| | | * 1:支付查询 2:退款查询 3:确认收货查询 4:结算查询 5:充值查询 6:转账查询 7:异步分账查询(必填) 字段长度最长:1位 |
| | | */ |
| | | queryOrder.setQueryType("5"); |
| | | TrhRequest<QueryOrder> request = new TrhRequest(); |
| | | InterfaceResponse execute1 = request.execute(queryOrder, QueryOrder.SERVICE_CODE); |
| | | if("0000".equals(execute1.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(execute1.getResult()); |
| | | String status1 = jsonObject1.getString("status"); |
| | | if("0".equals(status1)){//待处理 |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | if("1".equals(status1)){//成功 |
| | | String merOrderId = jsonObject1.getString("merOrderId"); |
| | | rechargeRecord1.setPayTime(new Date()); |
| | | rechargeRecord1.setPayStatus(2); |
| | | rechargeRecord1.setOrderNumber(merOrderId); |
| | | rechargeRecord1.setSurplusDividedAmount(rechargeRecord1.getAmount()); |
| | | rechargeRecordService.updateById(rechargeRecord1); |
| | | break; |
| | | } |
| | | if("2".equals(status1) || 10 == num){//失败 |
| | | rechargeRecordService.deleteById(rechargeRecord1.getId()); |
| | | break; |
| | | } |
| | | }else{ |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | return ResultUtil.success(payCode); |
| | | }else{ |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 补贴金额充值回调 |
| | | * @param interfaceResponse |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/accountRechargeCallback") |
| | | public void accountRechargeCallback(@RequestBody InterfaceResponse interfaceResponse){ |
| | | if("0000".equals(interfaceResponse.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(interfaceResponse.getResult()); |
| | | Integer status = jsonObject.getInteger("status"); |
| | | if(2 == status){ |
| | | System.err.println("支付异常"); |
| | | return; |
| | | } |
| | | if(1 == status){ |
| | | String parameter1 = jsonObject.getString("parameter1"); |
| | | RechargeRecord rechargeRecord = rechargeRecordService.selectById(parameter1); |
| | | rechargeRecord.setPayStatus(2); |
| | | rechargeRecord.setPayTime(new Date()); |
| | | rechargeRecord.setOrderNumber(jsonObject.getString("merOrderId")); |
| | | rechargeRecord.setSurplusDividedAmount(rechargeRecord.getAmount()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | }else{ |
| | | System.err.println(interfaceResponse.getMsg()); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.RechargeRecord; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/2 14:25 |
| | | */ |
| | | public interface RechargeRecordMapper extends BaseMapper<RechargeRecord> { |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.SettlementRecord; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/2 12:46 |
| | | */ |
| | | public interface SettlementRecordMapper extends BaseMapper<SettlementRecord> { |
| | | } |
New file |
| | |
| | | <?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.stylefeng.guns.modular.system.dao.RechargeRecordMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.RechargeRecord"> |
| | | <id column="id" property="id" /> |
| | | <result column="type" property="type" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="code" property="code" /> |
| | | <result column="amount" property="amount"/> |
| | | <result column="payType" property="payType" /> |
| | | <result column="payTime" property="payTime" /> |
| | | <result column="payStatus" property="payStatus" /> |
| | | <result column="orderNumber" property="orderNumber" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="agentId" property="agentId" /> |
| | | <result column="surplusDividedAmount" property="surplusDividedAmount"/> |
| | | </resultMap> |
| | | </mapper> |
New file |
| | |
| | | <?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.stylefeng.guns.modular.system.dao.SettlementRecordMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.SettlementRecord"> |
| | | <id column="id" property="id" /> |
| | | <result column="type" property="type" /> |
| | | <result column="objectId" property="objectId" /> |
| | | <result column="amount" property="amount" /> |
| | | <result column="arrivalTime" property="arrivalTime" /> |
| | | <result column="insertTime" property="insertTime" /> |
| | | </resultMap> |
| | | </mapper> |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 系统充值记录 |
| | | * @author zhibing.pu |
| | | * @date 2023/3/21 23:08 |
| | | */ |
| | | @Data |
| | | @TableName("t_recharge_record") |
| | | public class RechargeRecord { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 数据类型(1=用户,2=司机,3=代理商,4=平台) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 流水号 |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 充值金额 |
| | | */ |
| | | @TableField("amount") |
| | | private Double amount; |
| | | /** |
| | | * 支付方式(1=微信,2=系统充值) |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 完成支付时间 |
| | | */ |
| | | @TableField("payTime") |
| | | private Date payTime; |
| | | /** |
| | | * 支付状态(1=待支付,2=已完成) |
| | | */ |
| | | @TableField("payStatus") |
| | | private Integer payStatus; |
| | | /** |
| | | * 第三方流水号 |
| | | */ |
| | | @TableField("orderNumber") |
| | | private String orderNumber; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 代理商id |
| | | */ |
| | | @TableField("agentId") |
| | | private Integer agentId; |
| | | /** |
| | | * 剩余待分账金额 |
| | | */ |
| | | @TableField("surplusDividedAmount") |
| | | private Double surplusDividedAmount; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 结算记录 |
| | | * @author zhibing.pu |
| | | * @date 2023/6/2 12:43 |
| | | */ |
| | | @Data |
| | | @TableName("t_settlement_record") |
| | | public class SettlementRecord { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 1=平台,2=代理商,3=司机 |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 结算对象id |
| | | */ |
| | | @TableField("objectId") |
| | | private Integer objectId; |
| | | /** |
| | | * 提现金额 |
| | | */ |
| | | @TableField("amount") |
| | | private Double amount; |
| | | /** |
| | | * 第三方流水号 |
| | | */ |
| | | @TableField("orderNumber") |
| | | private String orderNumber; |
| | | /** |
| | | * 到账时间 |
| | | */ |
| | | @TableField("arrivalTime") |
| | | private Date arrivalTime; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.RechargeRecord; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/2 14:26 |
| | | */ |
| | | public interface IRechargeRecordService extends IService<RechargeRecord> { |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.SettlementRecord; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/2 12:48 |
| | | */ |
| | | public interface ISettlementRecordService extends IService<SettlementRecord> { |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.RechargeRecordMapper; |
| | | import com.stylefeng.guns.modular.system.model.RechargeRecord; |
| | | import com.stylefeng.guns.modular.system.service.IRechargeRecordService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/2 14:26 |
| | | */ |
| | | @Service |
| | | public class RechargeRecordServiceImpl extends ServiceImpl<RechargeRecordMapper, RechargeRecord> implements IRechargeRecordService { |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.SettlementRecordMapper; |
| | | import com.stylefeng.guns.modular.system.model.SettlementRecord; |
| | | import com.stylefeng.guns.modular.system.service.ISettlementRecordService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/2 12:48 |
| | | */ |
| | | @Service |
| | | public class SettlementRecordServiceImpl extends ServiceImpl<SettlementRecordMapper, SettlementRecord> implements ISettlementRecordService { |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.model; |
| | | |
| | | public class Deposit { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "deposit"; |
| | | //充值金额 |
| | | private String amount; |
| | | //订单信息 |
| | | private String orderName; |
| | | //支付类型 |
| | | private String payType; |
| | | //微信或支付宝的appid |
| | | private String appid; |
| | | //微信或支付宝用户id |
| | | private String openid; |
| | | //终端IP |
| | | private String terminalIp; |
| | | //前台回调地址 |
| | | private String frontUrl; |
| | | //后台回调地址 |
| | | private String notifyUrl; |
| | | //自定义参数1 |
| | | private String parameter1; |
| | | //自定义参数2 |
| | | private String parameter2; |
| | | |
| | | private String bankCode; |
| | | |
| | | private String cardType; |
| | | |
| | | public String getBankCode() { |
| | | return bankCode; |
| | | } |
| | | |
| | | public void setBankCode(String bankCode) { |
| | | this.bankCode = bankCode; |
| | | } |
| | | |
| | | public String getCardType() { |
| | | return cardType; |
| | | } |
| | | |
| | | public void setCardType(String cardType) { |
| | | this.cardType = cardType; |
| | | } |
| | | |
| | | public String getAmount() { |
| | | return amount; |
| | | } |
| | | |
| | | public void setAmount(String amount) { |
| | | this.amount = amount; |
| | | } |
| | | |
| | | public String getOrderName() { |
| | | return orderName; |
| | | } |
| | | |
| | | public void setOrderName(String orderName) { |
| | | this.orderName = orderName; |
| | | } |
| | | |
| | | public String getPayType() { |
| | | return payType; |
| | | } |
| | | |
| | | public void setPayType(String payType) { |
| | | this.payType = payType; |
| | | } |
| | | |
| | | public String getAppid() { |
| | | return appid; |
| | | } |
| | | |
| | | public void setAppid(String appid) { |
| | | this.appid = appid; |
| | | } |
| | | |
| | | public String getOpenid() { |
| | | return openid; |
| | | } |
| | | |
| | | public void setOpenid(String openid) { |
| | | this.openid = openid; |
| | | } |
| | | |
| | | public String getTerminalIp() { |
| | | return terminalIp; |
| | | } |
| | | |
| | | public void setTerminalIp(String terminalIp) { |
| | | this.terminalIp = terminalIp; |
| | | } |
| | | |
| | | public String getFrontUrl() { |
| | | return frontUrl; |
| | | } |
| | | |
| | | public void setFrontUrl(String frontUrl) { |
| | | this.frontUrl = frontUrl; |
| | | } |
| | | |
| | | public String getNotifyUrl() { |
| | | return notifyUrl; |
| | | } |
| | | |
| | | public void setNotifyUrl(String notifyUrl) { |
| | | this.notifyUrl = notifyUrl; |
| | | } |
| | | |
| | | public String getParameter1() { |
| | | return parameter1; |
| | | } |
| | | |
| | | public void setParameter1(String parameter1) { |
| | | this.parameter1 = parameter1; |
| | | } |
| | | |
| | | public String getParameter2() { |
| | | return parameter2; |
| | | } |
| | | |
| | | public void setParameter2(String parameter2) { |
| | | this.parameter2 = parameter2; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.model; |
| | | |
| | | |
| | | /** |
| | | * @author huangh |
| | | * @version 1.0 |
| | | * @description |
| | | * @date 2021/9/18 16:10 |
| | | */ |
| | | |
| | | public class ImageUpload { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "fileUpload"; |
| | | //业务系统会员编号 |
| | | private String merUserId; |
| | | //文件名称 |
| | | private String file; |
| | | //文件 |
| | | private String name; |
| | | |
| | | public String getMerUserId() { |
| | | return merUserId; |
| | | } |
| | | |
| | | public void setMerUserId(String merUserId) { |
| | | this.merUserId = merUserId; |
| | | } |
| | | |
| | | public String getFile() { |
| | | return file; |
| | | } |
| | | |
| | | public void setFile(String file) { |
| | | this.file = file; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | } |
| | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.config.ChannelConfig; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.util.RSASignature; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.util.StringUtil; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.config.ChannelConfig; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.util.RSASignature; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.util.StringUtil; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | |
| | | |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.util.StringUtil; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.util.StringUtil; |
| | | |
| | | import java.io.Serializable; |
| | | |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.model; |
| | | |
| | | |
| | | public class QueryBalance { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "queryBalance"; |
| | | private String userId;//子商户编号 |
| | | |
| | | public String getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(String userId) { |
| | | this.userId = userId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.model; |
| | | |
| | | public class QueryOrder { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "queryOrder"; |
| | | /** |
| | | * 原请求订单号 |
| | | */ |
| | | private String originalMerOrderId; |
| | | |
| | | /** |
| | | * 查询类型 |
| | | */ |
| | | private String queryType; |
| | | |
| | | public String getOriginalMerOrderId() { |
| | | return originalMerOrderId; |
| | | } |
| | | |
| | | public void setOriginalMerOrderId(String originalMerOrderId) { |
| | | this.originalMerOrderId = originalMerOrderId; |
| | | } |
| | | |
| | | public String getQueryType() { |
| | | return queryType; |
| | | } |
| | | |
| | | public void setQueryType(String queryType) { |
| | | this.queryType = queryType; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.model; |
| | | |
| | | public class Withdraw { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "withdraw"; |
| | | /** |
| | | * 子商户编号(必填) |
| | | */ |
| | | private String userId; |
| | | |
| | | /** |
| | | * 结算金额(必填) |
| | | */ |
| | | private String amount; |
| | | |
| | | /** |
| | | * 订单名称 |
| | | */ |
| | | private String orderName; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * 后台回调地址(必填) |
| | | */ |
| | | private String notifyUrl; |
| | | |
| | | /** |
| | | * 自定义参数1 |
| | | */ |
| | | private String parameter1; |
| | | |
| | | /** |
| | | * 自定义参数2 |
| | | */ |
| | | private String parameter2; |
| | | |
| | | public String getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(String userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getAmount() { |
| | | return amount; |
| | | } |
| | | |
| | | public void setAmount(String amount) { |
| | | this.amount = amount; |
| | | } |
| | | |
| | | public String getOrderName() { |
| | | return orderName; |
| | | } |
| | | |
| | | public void setOrderName(String orderName) { |
| | | this.orderName = orderName; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public String getNotifyUrl() { |
| | | return notifyUrl; |
| | | } |
| | | |
| | | public void setNotifyUrl(String notifyUrl) { |
| | | this.notifyUrl = notifyUrl; |
| | | } |
| | | |
| | | public String getParameter1() { |
| | | return parameter1; |
| | | } |
| | | |
| | | public void setParameter1(String parameter1) { |
| | | this.parameter1 = parameter1; |
| | | } |
| | | |
| | | public String getParameter2() { |
| | | return parameter2; |
| | | } |
| | | |
| | | public void setParameter2(String parameter2) { |
| | | this.parameter2 = parameter2; |
| | | } |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.util; |
| | | |
| | | |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.config.ChannelConfig; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.config.ChannelConfig; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | |
| | | #正式环境 |
| | | #callbackPath: https://okyueche.com:8010 |
| | | #测试环境 |
| | | callbackPath: http://121.37.15.157:8010 |
| | | callbackPath: http://121.37.15.157:8010 |
| | | |
| | | |
| | | --- |
| | | |
| | | # mallbook 调起接口参数配置 |
| | | mallbook: |
| | | # pay_url:mallbook接口地址 测试环境: https://uat.mallbook.cn/api 生产环境:https://cloudpay.mallbook.cn/api |
| | | pay_url: https://cloudpay.mallbook.cn/api |
| | | # merchant_no 业务系统商户平台编号,需替换为mallbook工作人员提供的商户编号 |
| | | merchant_no: MBH23056 |
| | | # version 接口版本号 |
| | | version: 1.0.0 |
| | | # channel_type 渠道类型 HF:汇付 |
| | | channel_type: HF |
| | | # merchant_private_key 商户平台私钥,需要替换成商户平台自己生成的私钥 |
| | | merchant_private_key: MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBALHmyTrxPYcAwABnX+3VW9vxUftm57zBpnbfOT4vizMnKdpfCkIgtdbfdnSCtt637yWM2fxnZfItnhTeQA2lL8f4SXgZt/bVXfmAWi4IxQ+HJy0Qs8nNy2nnjICPBPcpWzHwUxQ/THHqU0a7b9B91J5DFcbQb25BHeRpHwkBw6A/AgMBAAECgYAmcWq2s/7Jt53F+JDAQkTRaHqAyyH0phwkv+QMzhVUfngK2lLLK2pf/nYIg16lDjY9dQx+AJIFHVp1w/kveayzOz3BIqPoznyIVYPolRGZCWPo+2vdp0CIdBh7zahST5g5Gem4cU47wO5hPYs1kXKPG4mUPtaIAMHFxhyLvIagAQJBAOS63AIZrRrldeNCVVNXbpAT52JuWLCgravM9coOh6scmG6UQwxxcott8hneHr9fazk2LHbHMxlG8F+dQPA0+D8CQQDHHJN7Dnske8oJ+1sq4uhQP3HMsmNIgth+ZcaZpiPcxnNKYVGhzAwTVV2ruFJle5ajebo6zfWuqJhtZGRNh1gBAkA/lRoXk1+lfGfa9tOVSVa4wm+t0xLgdqoQefdRZdyc2mQdSSWiTd8Tl0qXmkFd3X6G9uJBWnp/6lJjoektXOwtAkBsZTQsw99qJzIAaSRinpDWTxPG2j6OlR0DAqkxsG7JnAfbsEteh9TzGYAbIgdJVBTX/kbSCJn9ca85rnOkeVABAkAUbDfU3Z702z20NtwAxc1IkrtQ1lKuqSpj9/LuR1/6KRkYQsUWnUiOO9hu5YDWIcflFrnCenF8j8OnvGghltxT |
| | | # mall_book_public_key mallbook测试环境公钥 不需要替换 |
| | | mall_book_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq6OLZKgUHH5wOk9xSBgN7yC17r3PQwMlY9/IorqrOlaIqrU0eAVZ5+dWrJD/3bdu7Ctq8n8trTm/IUYs7wtMg5SKwyX4/N+KQc2N7LL4yCq4vNl41q9sYgrtA0QnZoucIZcq1mwyu7RTDC8Wp7LGddnlkJsmL8masgMxA6cc9NwIDAQAB |
| | | |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style type="text/css"> |
| | | table{ |
| | | width: 100%; |
| | | } |
| | | td, th{ |
| | | border: 1px solid #eee; |
| | | text-align: center; |
| | | height: 40px; |
| | | line-height: 40px; |
| | | } |
| | | td select, td div, td div input, td input{ |
| | | height: 100%; |
| | | width: 95%; |
| | | border: none; |
| | | text-indent: 10px; |
| | | } |
| | | </style> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="tAgentInfoForm"> |
| | | <input type="hidden" id="provCodeEnterprise1" value="${item.provCodeEnterprise}"> |
| | | <input type="hidden" id="areaCodeEnterprise1" value="${item.areaCodeEnterprise}"> |
| | | <input type="hidden" id="provCodeBank1" value="${item.provCodeBank}"> |
| | | <input type="hidden" id="areaCodeBank1" value="${item.areaCodeBank}"> |
| | | <div class="row"> |
| | | <div class="col-sm-6"> |
| | | <div class="form-group"> |
| | | 企业信息 |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*负责人姓名:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="principal" name="principal" value="${item.principal}" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*联系电话:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="principalPhone" name="principalPhone" value="${item.principalPhone}" maxlength="11" type="number" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" ${roleType == 1 ? 'hidden' : ''}> |
| | | <input id="areaId" type="hidden"> |
| | | <label class="col-sm-3 control-label">*代理区域:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="area" onclick="TAgent.area()" name="area" value="${item.provinceName}/${item.cityName}" placeholder="请选择" readonly> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*邮箱:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="email" name="email" type="email" value="${item.email}" maxlength="40" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row" ${roleType == 1 ? 'hidden' : ''}> |
| | | <div class="col-sm-6"> |
| | | <div class="form-group"> |
| | | 商户信息 |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*商户类型:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" id="userType"> |
| | | <option value="0" ${item.userType == 0 ? 'selected' : '' }>小微商户</option> |
| | | <option value="1" ${item.userType == 1 ? 'selected' : '' }>个体工商户</option> |
| | | <option value="2" ${item.userType == 2 ? 'selected' : '' }>企业</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*公司名称:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="merchantName" name="merchantName" value="${item.merchantName}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*经营范围:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="businessScope" name="businessScope" value="${item.businessScope}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*统一社会信用码:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="socialCreditCode" name="socialCreditCode" value="${item.socialCreditCode}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*统一社会信用证有效期:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="socialCreditCodeExpires" name="socialCreditCodeExpires" value="${socialCreditCodeExpires}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*地区:</label> |
| | | <div class="col-sm-4"> |
| | | <select class="form-control" id="provCodeEnterprise" name="provCodeEnterprise" onchange="initArea(this, 'areaCodeEnterprise')"></select> |
| | | </div> |
| | | <div class="col-sm-4"> |
| | | <select class="form-control" id="areaCodeEnterprise" name="areaCodeEnterprise"></select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*企业详细地址:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="address" name="address" value="${item.address}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*结算账户名:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="cardName" name="cardName" value="${item.cardName}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*结算账户号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="cardNo" name="cardNo" value="${item.cardNo}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*银行账户类型:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" id="bankAcctType"> |
| | | <option value="1" ${item.bankAcctType == 1 ? 'selected' : ''}>对公</option> |
| | | <option value="2" ${item.bankAcctType == 2 ? 'selected' : ''}>对私</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-6"> |
| | | <div class="form-group"> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*法人姓名:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="legalPerson" name="legalPerson" value="${item.legalPerson}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*法人身份证号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="merchantIDCode" name="merchantIDCode" value="${item.merchantIDCode}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*法人身份证有效期:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="certIdExpires" name="certIdExpires" value="${certIdExpires}"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*法人手机号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="legalPhone" name="legalPhone" value="${item.legalPhone}" type="text" maxlength="11" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">营业执照扫描件:</label> |
| | | <div class="col-sm-7"> |
| | | <input class="form-control" id="fileNo" name="fileNo" value="${item.fileNo}" value="" readonly style="height: 100%;width: 100%;border: none;"/> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <button class="form-control" id="fileNoBtnId">上传</button> |
| | | </div> |
| | | <input type="file" id="file" style="display: none;"> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*银行名称:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" id="bankCode" name="bankCode"> |
| | | <option value="01020000" ${item.bankAcctType == '01020000' ? 'selected' : ''}>工商银行</option> |
| | | <option value="01030000" ${item.bankAcctType == '01030000' ? 'selected' : ''}>农业银行</option> |
| | | <option value="01040000" ${item.bankAcctType == '01040000' ? 'selected' : ''}>中国银行</option> |
| | | <option value="01050000" ${item.bankAcctType == '01050000' ? 'selected' : ''}>建设银行</option> |
| | | <option value="03010000" ${item.bankAcctType == '03010000' ? 'selected' : ''}>交通银行</option> |
| | | <option value="03134402" ${item.bankAcctType == '03134402' ? 'selected' : ''}>平安银行</option> |
| | | <option value="03020000" ${item.bankAcctType == '03020000' ? 'selected' : ''}>中信银行</option> |
| | | <option value="03030000" ${item.bankAcctType == '03030000' ? 'selected' : ''}>光大银行</option> |
| | | <option value="03040000" ${item.bankAcctType == '03040000' ? 'selected' : ''}>华夏银行</option> |
| | | <option value="03050000" ${item.bankAcctType == '03050000' ? 'selected' : ''}>民生银行</option> |
| | | <option value="03060000" ${item.bankAcctType == '03060000' ? 'selected' : ''}>广发银行</option> |
| | | <option value="03080000" ${item.bankAcctType == '03080000' ? 'selected' : ''}>招商银行</option> |
| | | <option value="03090000" ${item.bankAcctType == '03090000' ? 'selected' : ''}>兴业银行</option> |
| | | <option value="03100000" ${item.bankAcctType == '03100000' ? 'selected' : ''}>浦发银行</option> |
| | | <option value="03130011" ${item.bankAcctType == '03130011' ? 'selected' : ''}>北京银行</option> |
| | | <option value="03130012" ${item.bankAcctType == '03130012' ? 'selected' : ''}>天津银行</option> |
| | | <option value="03130031" ${item.bankAcctType == '03130031' ? 'selected' : ''}>上海银行</option> |
| | | <option value="03130032" ${item.bankAcctType == '03130032' ? 'selected' : ''}>江苏银行</option> |
| | | <option value="03130050" ${item.bankAcctType == '03130050' ? 'selected' : ''}>重庆银行</option> |
| | | <option value="03132102" ${item.bankAcctType == '03132102' ? 'selected' : ''}>大连银行</option> |
| | | <option value="03132301" ${item.bankAcctType == '03132301' ? 'selected' : ''}>哈尔滨银行</option> |
| | | <option value="03133201" ${item.bankAcctType == '03133201' ? 'selected' : ''}>南京银行</option> |
| | | <option value="03133301" ${item.bankAcctType == '03133301' ? 'selected' : ''}>杭州银行</option> |
| | | <option value="03133302" ${item.bankAcctType == '03133302' ? 'selected' : ''}>宁波银行</option> |
| | | <option value="03133308" ${item.bankAcctType == '03133308' ? 'selected' : ''}>温州银行</option> |
| | | <option value="03150000" ${item.bankAcctType == '03150000' ? 'selected' : ''}>恒丰银行</option> |
| | | <option value="03160000" ${item.bankAcctType == '03160000' ? 'selected' : ''}>浙商银行</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*开户行地区:</label> |
| | | <div class="col-sm-4"> |
| | | <select class="form-control" id="provCodeBank" name="provCodeBank" onchange="initArea(this, 'areaCodeBank')"></select> |
| | | </div> |
| | | <div class="col-sm-4"> |
| | | <select class="form-control" id="areaCodeBank" name="areaCodeBank"></select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*银行预留手机号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="phone" name="phone" value="${item.phone}" type="number" maxlength="11" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*注册状态:</label> |
| | | <div class="col-sm-4"> |
| | | 商户开户状态: |
| | | </div> |
| | | <div class="col-sm-4"> |
| | | 结算账户绑定状态: |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row"> |
| | | <div class="col-sm-6"> |
| | | <div class="form-group"> |
| | | 账户信息 |
| | | </div> |
| | | <div class="form-group" ${roleType != 1 ? 'hidden' : ''}> |
| | | <label class="col-sm-3 control-label">充值余额:</label> |
| | | <div class="col-sm-3"> |
| | | <span>${marketingAmount}</span> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="amount" type="number" min="0" placeholder="请输入充值金额"> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <button onclick="accountRecharge()">充值</button> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">可提现余额:</label> |
| | | <div class="col-sm-3"> |
| | | <span id="balance">${balance}</span> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <button onclick="withdrawCash()">提现</button> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">提现记录:</label> |
| | | <div class="col-sm-9"> |
| | | <table> |
| | | <thead> |
| | | <tr><th>提现时间</th><th>提现金额</th><th>到账时间</th></tr> |
| | | </thead> |
| | | <tbody> |
| | | @for(obj in settlementRecords){ |
| | | <tr><td>${obj.insertTime}</td><td>${obj.amount}</td><td>${obj.arrivalTime}</td></tr> |
| | | @} |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/tAgent/tAgent_info.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/tAgent/tAgent.js"></script> |
| | | <script src="${ctxPath}/static/js/qrcode.js"></script> |
| | | <script src="${ctxPath}/static/js/jquery.qrcode.js"></script> |
| | | <script type="text/javascript"> |
| | | var citys = [{"value":"0011","title":"北京市","cities":[{"value":"1100","title":"北京市"}]},{"value":"0012","title":"天津市","cities":[{"value":"1200","title":"天津市"}]},{"value":"0013","title":"河北省","cities":[{"value":"1301","title":"石家庄"},{"value":"1302","title":"保定"},{"value":"1303","title":"沧州"},{"value":"1304","title":"承德"},{"value":"1305","title":"邯郸"},{"value":"1306","title":"衡水"},{"value":"1307","title":"廊坊"},{"value":"1308","title":"秦皇岛"},{"value":"1309","title":"唐山"},{"value":"1310","title":"邢台"},{"value":"1311","title":"张家口"}]},{"value":"0014","title":"山西省","cities":[{"value":"1401","title":"太原"},{"value":"1402","title":"长治"},{"value":"1403","title":"大同"},{"value":"1404","title":"晋城"},{"value":"1405","title":"离石"},{"value":"1406","title":"临汾"},{"value":"1407","title":"朔州"},{"value":"1408","title":"忻州"},{"value":"1409","title":"阳泉"},{"value":"1410","title":"榆次"},{"value":"1411","title":"运城"},{"value":"1412","title":"晋中"},{"value":"1413","title":"吕梁"}]},{"value":"0015","title":"内蒙古自治区","cities":[{"value":"1501","title":"呼和浩特"},{"value":"1502","title":"包头"},{"value":"1503","title":"阿拉善"},{"value":"1504","title":"巴彦淖尔"},{"value":"1505","title":"赤峰"},{"value":"1506","title":"呼伦贝尔"},{"value":"1507","title":"乌海"},{"value":"1508","title":"乌兰察布"},{"value":"1509","title":"锡林郭勒"},{"value":"1510","title":"兴安"},{"value":"1511","title":"鄂尔多斯"},{"value":"1512","title":"通辽"},{"value":"1513","title":"满洲里"}]},{"value":"0021","title":"辽宁省","cities":[{"value":"2101","title":"沈阳"},{"value":"2102","title":"大连"},{"value":"2103","title":"鞍山"},{"value":"2104","title":"本溪"},{"value":"2105","title":"朝阳"},{"value":"2106","title":"丹东"},{"value":"2107","title":"抚顺"},{"value":"2108","title":"阜新"},{"value":"2109","title":"葫芦岛"},{"value":"2110","title":"锦州"},{"value":"2111","title":"辽阳"},{"value":"2112","title":"盘锦"},{"value":"2113","title":"铁岭"},{"value":"2114","title":"营口"}]},{"value":"0022","title":"吉林省","cities":[{"value":"2201","title":"长春"},{"value":"2202","title":"白城"},{"value":"2203","title":"白山"},{"value":"2204","title":"吉林"},{"value":"2205","title":"辽源"},{"value":"2206","title":"四平"},{"value":"2207","title":"松原"},{"value":"2208","title":"通化"},{"value":"2209","title":"延边"}]},{"value":"0023","title":"黑龙江省","cities":[{"value":"2301","title":"哈尔滨"},{"value":"2302","title":"大庆"},{"value":"2303","title":"大兴安岭"},{"value":"2304","title":"鹤岗"},{"value":"2305","title":"黑河"},{"value":"2306","title":"鸡西"},{"value":"2307","title":"佳木斯"},{"value":"2308","title":"牡丹江"},{"value":"2309","title":"七台河"},{"value":"2310","title":"齐齐哈尔"},{"value":"2311","title":"双鸭山"},{"value":"2312","title":"绥化"},{"value":"2313","title":"伊春"}]},{"value":"0031","title":"上海市","cities":[{"value":"3100","title":"上海市"}]},{"value":"0032","title":"江苏省","cities":[{"value":"3201","title":"南京"},{"value":"3202","title":"常州"},{"value":"3203","title":"淮安"},{"value":"3204","title":"连云港"},{"value":"3205","title":"南通"},{"value":"3206","title":"苏州"},{"value":"3207","title":"宿迁"},{"value":"3208","title":"泰州"},{"value":"3209","title":"无锡"},{"value":"3210","title":"徐州"},{"value":"3211","title":"盐城"},{"value":"3212","title":"扬州"},{"value":"3213","title":"镇江"},{"value":"3214","title":"胥浦"},{"value":"3215","title":"昆山"}]},{"value":"0033","title":"浙江省","cities":[{"value":"3301","title":"杭州"},{"value":"3302","title":"宁波"},{"value":"3303","title":"湖州"},{"value":"3304","title":"嘉兴"},{"value":"3305","title":"金华"},{"value":"3306","title":"绍兴"},{"value":"3307","title":"台州"},{"value":"3308","title":"温州"},{"value":"3309","title":"舟山"},{"value":"3310","title":"衢州"},{"value":"3311","title":"丽水"}]},{"value":"0034","title":"安徽省","cities":[{"value":"3401","title":"合肥"},{"value":"3402","title":"安庆"},{"value":"3403","title":"蚌埠"},{"value":"3404","title":"巢湖"},{"value":"3405","title":"池州"},{"value":"3406","title":"滁州"},{"value":"3407","title":"阜阳"},{"value":"3408","title":"淮北"},{"value":"3409","title":"淮南"},{"value":"3410","title":"黄山"},{"value":"3411","title":"六安"},{"value":"3412","title":"马鞍山"},{"value":"3414","title":"铜陵"},{"value":"3415","title":"芜湖"},{"value":"3416","title":"宣城"},{"value":"3417","title":"亳州"},{"value":"3418","title":"宿州"}]},{"value":"0035","title":"福建省","cities":[{"value":"3501","title":"福州"},{"value":"3502","title":"厦门"},{"value":"3503","title":"龙岩"},{"value":"3504","title":"南平"},{"value":"3505","title":"宁德"},{"value":"3506","title":"莆田"},{"value":"3507","title":"泉州"},{"value":"3508","title":"三明"},{"value":"3509","title":"漳州"}]},{"value":"0036","title":"江西省","cities":[{"value":"3601","title":"南昌"},{"value":"3602","title":"抚州"},{"value":"3603","title":"赣州"},{"value":"3604","title":"吉安"},{"value":"3605","title":"景德镇"},{"value":"3606","title":"九江"},{"value":"3607","title":"萍乡"},{"value":"3608","title":"上饶"},{"value":"3609","title":"新余"},{"value":"3610","title":"宜春"},{"value":"3611","title":"鹰潭"}]},{"value":"0037","title":"山东省","cities":[{"value":"3701","title":"济南"},{"value":"3702","title":"青岛"},{"value":"3703","title":"滨州"},{"value":"3704","title":"德州"},{"value":"3705","title":"东营"},{"value":"3706","title":"菏泽"},{"value":"3707","title":"济宁"},{"value":"3708","title":"莱芜"},{"value":"3709","title":"聊城"},{"value":"3710","title":"临沂"},{"value":"3711","title":"日照"},{"value":"3712","title":"泰安"},{"value":"3713","title":"威海"},{"value":"3714","title":"潍坊"},{"value":"3715","title":"烟台"},{"value":"3716","title":"枣庄"},{"value":"3717","title":"淄博"}]},{"value":"0041","title":"河南省","cities":[{"value":"4101","title":"郑州"},{"value":"4102","title":"安阳"},{"value":"4103","title":"焦作"},{"value":"4104","title":"鹤壁"},{"value":"4105","title":"开封"},{"value":"4106","title":"洛阳"},{"value":"4107","title":"南阳"},{"value":"4108","title":"平顶山"},{"value":"4109","title":"三门峡"},{"value":"4110","title":"商丘"},{"value":"4111","title":"新乡"},{"value":"4112","title":"信阳"},{"value":"4113","title":"许昌"},{"value":"4114","title":"周口"},{"value":"4115","title":"驻马店"},{"value":"4116","title":"漯河"},{"value":"4117","title":"濮阳"},{"value":"4118","title":"济源"}]},{"value":"0042","title":"湖北省","cities":[{"value":"4201","title":"武汉"},{"value":"4202","title":"鄂州"},{"value":"4203","title":"恩施"},{"value":"4204","title":"黄冈"},{"value":"4205","title":"黄石"},{"value":"4206","title":"荆门"},{"value":"4207","title":"荆州"},{"value":"4208","title":"十堰"},{"value":"4209","title":"随州"},{"value":"4210","title":"咸宁"},{"value":"4211","title":"襄樊"},{"value":"4212","title":"孝感"},{"value":"4213","title":"神农架"},{"value":"4214","title":"天门"},{"value":"4215","title":"宜昌"},{"value":"4216","title":"三峡"},{"value":"4217","title":"潜江"},{"value":"4218","title":"仙桃"}]},{"value":"0043","title":"湖南省","cities":[{"value":"4301","title":"长沙"},{"value":"4302","title":"常德"},{"value":"4303","title":"郴州"},{"value":"4304","title":"衡阳"},{"value":"4305","title":"怀化"},{"value":"4306","title":"娄底"},{"value":"4307","title":"邵阳"},{"value":"4308","title":"湘潭"},{"value":"4309","title":"湘西"},{"value":"4310","title":"益阳"},{"value":"4311","title":"永州"},{"value":"4312","title":"岳阳"},{"value":"4313","title":"张家界"},{"value":"4314","title":"株洲"},{"value":"4331","title":"吉首"}]},{"value":"0044","title":"广东省","cities":[{"value":"4401","title":"广州"},{"value":"4402","title":"深圳"},{"value":"4403","title":"潮州"},{"value":"4404","title":"东莞"},{"value":"4405","title":"佛山"},{"value":"4406","title":"惠州"},{"value":"4407","title":"江门"},{"value":"4408","title":"揭阳"},{"value":"4409","title":"茂名"},{"value":"4410","title":"梅州"},{"value":"4411","title":"清远"},{"value":"4412","title":"汕头"},{"value":"4413","title":"汕尾"},{"value":"4414","title":"韶关"},{"value":"4415","title":"阳江"},{"value":"4416","title":"云浮"},{"value":"4417","title":"湛江"},{"value":"4418","title":"肇庆"},{"value":"4419","title":"中山"},{"value":"4420","title":"河源"},{"value":"4421","title":"珠海"}]},{"value":"0045","title":"广西壮族自治区","cities":[{"value":"4501","title":"南宁"},{"value":"4502","title":"百色"},{"value":"4503","title":"北海"},{"value":"4504","title":"桂林"},{"value":"4505","title":"河池"},{"value":"4506","title":"柳州"},{"value":"4507","title":"梧州"},{"value":"4508","title":"玉林"},{"value":"4509","title":"崇左"},{"value":"4510","title":"防城港"},{"value":"4511","title":"贵港"},{"value":"4512","title":"贺州"},{"value":"4513","title":"来宾"},{"value":"4514","title":"钦州"}]},{"value":"0046","title":"海南省","cities":[{"value":"4601","title":"海口"},{"value":"4602","title":"三亚"},{"value":"4603","title":"白沙"},{"value":"4604","title":"保亭"},{"value":"4605","title":"昌江"},{"value":"4606","title":"澄迈"},{"value":"4607","title":"儋州"},{"value":"4608","title":"定安"},{"value":"4609","title":"东方"},{"value":"4610","title":"乐东"},{"value":"4611","title":"临高"},{"value":"4612","title":"陵水"},{"value":"4613","title":"琼海"},{"value":"4614","title":"琼中"},{"value":"4615","title":"屯昌"},{"value":"4616","title":"万宁"},{"value":"4617","title":"文昌"},{"value":"4618","title":"五指山"},{"value":"4619","title":"洋浦"}]},{"value":"0050","title":"重庆市","cities":[{"value":"5000","title":"重庆市"}]},{"value":"0051","title":"四川省","cities":[{"value":"5101","title":"成都"},{"value":"5102","title":"巴中"},{"value":"5103","title":"达州"},{"value":"5104","title":"德阳"},{"value":"5105","title":"广安"},{"value":"5106","title":"广元"},{"value":"5107","title":"乐山"},{"value":"5108","title":"凉山"},{"value":"5109","title":"眉山"},{"value":"5110","title":"绵阳"},{"value":"5111","title":"南充"},{"value":"5112","title":"内江"},{"value":"5113","title":"攀枝花"},{"value":"5114","title":"遂宁"},{"value":"5115","title":"雅安"},{"value":"5116","title":"宜宾"},{"value":"5117","title":"自贡"},{"value":"5118","title":"泸州"},{"value":"5119","title":"阿坝"},{"value":"5120","title":"甘孜"},{"value":"5121","title":"资阳"}]},{"value":"0052","title":"贵州省","cities":[{"value":"5201","title":"贵阳"},{"value":"5202","title":"安顺"},{"value":"5203","title":"毕节"},{"value":"5204","title":"六盘水"},{"value":"5205","title":"铜仁"},{"value":"5206","title":"遵义"},{"value":"5207","title":"黔东南"},{"value":"5208","title":"黔南"},{"value":"5209","title":"黔西南"}]},{"value":"0053","title":"云南省","cities":[{"value":"5301","title":"昆明"},{"value":"5302","title":"西双版纳"},{"value":"5303","title":"保山"},{"value":"5304","title":"楚雄"},{"value":"5305","title":"大理"},{"value":"5306","title":"德宏"},{"value":"5307","title":"红河"},{"value":"5308","title":"丽江"},{"value":"5309","title":"临沧"},{"value":"5310","title":"怒江"},{"value":"5311","title":"曲靖"},{"value":"5312","title":"思茅"},{"value":"5313","title":"文山"},{"value":"5314","title":"玉溪"},{"value":"5315","title":"昭通"},{"value":"5316","title":"中甸"},{"value":"5317","title":"迪庆州"}]},{"value":"0054","title":"西藏自治区","cities":[{"value":"5401","title":"拉萨"},{"value":"5402","title":"阿里"},{"value":"5403","title":"昌都"},{"value":"5404","title":"林芝"},{"value":"5405","title":"那曲"},{"value":"5406","title":"日喀则"},{"value":"5407","title":"山南"},{"value":"5424","title":"樟木口岸"}]},{"value":"0061","title":"陕西省","cities":[{"value":"6101","title":"西安"},{"value":"6102","title":"安康"},{"value":"6103","title":"宝鸡"},{"value":"6104","title":"汉中"},{"value":"6105","title":"商洛"},{"value":"6106","title":"铜川"},{"value":"6107","title":"渭南"},{"value":"6108","title":"咸阳"},{"value":"6109","title":"延安"},{"value":"6110","title":"榆林"}]},{"value":"0062","title":"甘肃省","cities":[{"value":"6201","title":"兰州"},{"value":"6202","title":"白银"},{"value":"6203","title":"定西"},{"value":"6204","title":"东风"},{"value":"6205","title":"合作"},{"value":"6206","title":"嘉峪关"},{"value":"6207","title":"金昌"},{"value":"6208","title":"酒泉"},{"value":"6209","title":"矿区"},{"value":"6210","title":"临夏"},{"value":"6211","title":"陇南"},{"value":"6212","title":"平凉"},{"value":"6213","title":"庆阳"},{"value":"6214","title":"天水"},{"value":"6215","title":"武威"},{"value":"6216","title":"张掖"},{"value":"6217","title":"甘南州"}]},{"value":"0063","title":"青海省","cities":[{"value":"6301","title":"西宁"},{"value":"6302","title":"海东"},{"value":"6322","title":"海北"},{"value":"6323","title":"黄南"},{"value":"6325","title":"海南"},{"value":"6326","title":"果洛"},{"value":"6327","title":"玉树"},{"value":"6328","title":"海西"}]},{"value":"0064","title":"宁夏回族自治区","cities":[{"value":"6401","title":"银川"},{"value":"6402","title":"中卫"},{"value":"6403","title":"固原"},{"value":"6404","title":"石嘴山"},{"value":"6405","title":"吴忠"}]},{"value":"0065","title":"新疆维吾尔自治区","cities":[{"value":"6501","title":"乌鲁木齐"},{"value":"6502","title":"阿克苏"},{"value":"6503","title":"阿勒泰"},{"value":"6504","title":"巴州"},{"value":"6505","title":"博州"},{"value":"6506","title":"昌吉"},{"value":"6507","title":"哈密"},{"value":"6508","title":"和田"},{"value":"6509","title":"喀什"},{"value":"6510","title":"克拉玛依"},{"value":"6511","title":"马兰"},{"value":"6512","title":"石河子"},{"value":"6513","title":"塔城"},{"value":"6514","title":"吐鲁番"},{"value":"6515","title":"伊犁"},{"value":"6516","title":"克州"},{"value":"6517","title":"阿拉尔"},{"value":"6518","title":"五家渠"}]},{"value":"2003","title":"台湾省","cities":[{"value":"9903","title":"台湾省"}]},{"value":"2001","title":"香港特别行政区","cities":[{"value":"9901","title":"香港特别行政区"}]},{"value":"2002","title":"澳门特别行政区","cities":[{"value":"9902","title":"澳门特别行政区"}]}]; |
| | | laydate.render({ |
| | | elem: '#socialCreditCodeExpires', |
| | | type: "date" |
| | | }); |
| | | laydate.render({ |
| | | elem: '#certIdExpires', |
| | | type: "date" |
| | | }); |
| | | $('#userType').change(function () { |
| | | let userType = $(this).val(); |
| | | if(userType == 0){ |
| | | $('.qy').hide(); |
| | | $('#bankAcctType').html('<option value="2">对私</option>') |
| | | }else{ |
| | | $('.qy').show(); |
| | | $('#bankAcctType').html('<option value="1">对公</option>') |
| | | } |
| | | }) |
| | | $('#userType').click(); |
| | | |
| | | function initCity(id) { |
| | | let city = ""; |
| | | for(let i in citys){ |
| | | let p = citys[i]; |
| | | city += '<option value="' + p.value + '">' + p.title+ '</option>' |
| | | } |
| | | $('#' + id).html(city); |
| | | } |
| | | |
| | | function initArea(e, id) { |
| | | let city = ""; |
| | | let cityCode = $(e).val(); |
| | | for(let i in citys){ |
| | | let p = citys[i]; |
| | | if(p.value == cityCode){ |
| | | let a = p.cities; |
| | | for(let j in a){ |
| | | city += '<option value="' + a[j].value + '">' + a[j].title+ '</option>' |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | | $('#' + id).html(city); |
| | | } |
| | | |
| | | |
| | | $('#fileNoBtnId').click(function () { |
| | | $('#file').click(); |
| | | }) |
| | | |
| | | $('#file').change(function () { |
| | | var formData = new FormData(); |
| | | formData.append('file', $('#file')[0].files[0]) |
| | | $.ajax({ |
| | | url : Feng.ctxPath + "/tAgent/uploadFile", |
| | | type : "POST", |
| | | data : formData, |
| | | contentType : false, |
| | | processData : false, |
| | | success : function(data) { |
| | | if("" == data){ |
| | | Feng.error("上传失败"); |
| | | }else{ |
| | | $('#fileNo').val(data); |
| | | $('#file').val(''); |
| | | Feng.success("上传成功!"); |
| | | } |
| | | }, |
| | | error : function() { |
| | | Feng.error("上传失败"); |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | function withdrawCash(){ |
| | | $.ajax({ |
| | | url : Feng.ctxPath + "/tAgent/withdrawCash", |
| | | type : "POST", |
| | | success : function(data) { |
| | | if(data.code == 200){ |
| | | Feng.success("提现成功!"); |
| | | document.location.reload(); |
| | | }else{ |
| | | Feng.error(data.msg); |
| | | } |
| | | }, |
| | | error : function() { |
| | | Feng.error("提现失败"); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | function accountRecharge(){ |
| | | let amount = $('#amount').val(); |
| | | if(null == amount || '' == amount || 0 >= amount){ |
| | | Feng.error("请填入有效的充值金额"); |
| | | return |
| | | } |
| | | $.ajax({ |
| | | url : Feng.ctxPath + "/tAgent/accountRecharge", |
| | | type : "POST", |
| | | data: { |
| | | amount: amount |
| | | }, |
| | | success : function(data) { |
| | | if(data.code == 200){ |
| | | const str = '<div class="row">\n' + |
| | | ' <div class="form-group" style="height: 50px;">\n' + |
| | | ' <div class="col-sm-8">\n' + |
| | | ' <div id="canvas"></div>\n' + |
| | | ' </div>\n' + |
| | | ' </div>\n' + |
| | | ' </div>' |
| | | layer.open({ |
| | | type: 1 |
| | | ,title: '支付宝收款二维码' |
| | | ,area: ['343px', '386px'] |
| | | ,offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset |
| | | ,id: 'layerDemo' //防止重复弹出 |
| | | ,content: '<div style="padding: 20px">' + str + '</div>' |
| | | ,btnAlign: 'c' //按钮居中 |
| | | ,shade: 0.5 //不显示遮罩 |
| | | }); |
| | | $("#canvas").qrcode({ |
| | | render: "canvas", //设置渲染方式:table和canvas,使用canvas方式性能相对来说比较好. |
| | | width: 300, //默认宽度 |
| | | height: 300, //默认高度 |
| | | typeNumber: -1, //计算模式一般默认为-1 |
| | | correctLevel: 2, //二维码纠错级别 |
| | | background: "#ffffff", //背景颜色 |
| | | foreground: "#000000", //二维码颜色 |
| | | text: data.data, //二维码内容:可以直接填一个网址 |
| | | }); |
| | | }else{ |
| | | Feng.error(data.msg); |
| | | } |
| | | }, |
| | | error : function() { |
| | | Feng.error("提现失败"); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | |
| | | $(function () { |
| | | initCity('provCodeBank'); |
| | | initCity('provCodeEnterprise'); |
| | | |
| | | $('#provCodeBank').val($('#provCodeBank1').val()); |
| | | initArea($('#provCodeBank'), 'areaCodeBank'); |
| | | $('#areaCodeBank').val($('#areaCodeBank1').val()); |
| | | |
| | | $('#provCodeEnterprise').val($('#provCodeEnterprise1').val()); |
| | | initArea($('#provCodeEnterprise'), 'areaCodeEnterprise'); |
| | | $('#areaCodeEnterprise').val($('#areaCodeEnterprise1').val()); |
| | | }) |
| | | </script> |
| | | @} |
| | |
| | | <label class="col-sm-3 control-label">*商户类型:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" id="userType"> |
| | | <option value="0">小微商户</option> |
| | | <option value="1">个体工商户</option> |
| | | <option value="2">企业</option> |
| | | </select> |
| | |
| | | <input class="form-control" id="merchantName" name="merchantName" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*经营范围:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="businessScope" name="businessScope" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*统一社会信用码:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="socialCreditCode" name="socialCreditCode" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*统一社会信用证有效期:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="socialCreditCodeExpires" name="socialCreditCodeExpires" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*地区:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="provCodeEnterprise" name="provCodeEnterprise"> |
| | | <div class="col-sm-4"> |
| | | <select class="form-control" id="provCodeEnterprise" name="provCodeEnterprise" onchange="initArea(this, 'areaCodeEnterprise')"></select> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="cityCodeEnterprise" name="cityCodeEnterprise"> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="areaCodeEnterprise" name="areaCodeEnterprise"> |
| | | <div class="col-sm-4"> |
| | | <select class="form-control" id="areaCodeEnterprise" name="areaCodeEnterprise"></select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*企业详细地址:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="address" name="address" type="text" maxlength="20" placeholder="请输入"> |
| | |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*银行预留手机号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="phone" name="phone" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-6"> |
| | | <div class="form-group"> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*法人姓名:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="legalPerson" name="legalPerson" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*法人身份证号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="merchantIDCode" name="merchantIDCode" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*法人身份证有效期:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="certIdExpires" name="certIdExpires"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*法人手机号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="legalPhone" name="legalPhone" type="text" maxlength="11" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <#avatar id="fileNo" name="营业执照扫描件:" /> |
| | | <div class="form-group"> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">营业执照扫描件:</label> |
| | | <div class="col-sm-7"> |
| | | <input class="form-control" id="fileNo" name="fileNo" value="" readonly style="height: 100%;width: 100%;border: none;"/> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <button class="form-control" id="fileNoBtnId">上传</button> |
| | | </div> |
| | | <input type="file" id="file" style="display: none;"> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*银行名称:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="bankCode" name="bankCode" type="text" maxlength="20" placeholder="请输入"> |
| | | <select class="form-control" id="bankCode" name="bankCode"> |
| | | <option value="01020000">工商银行</option> |
| | | <option value="01030000">农业银行</option> |
| | | <option value="01040000">中国银行</option> |
| | | <option value="01050000">建设银行</option> |
| | | <option value="03010000">交通银行</option> |
| | | <option value="03134402">平安银行</option> |
| | | <option value="03020000">中信银行</option> |
| | | <option value="03030000">光大银行</option> |
| | | <option value="03040000">华夏银行</option> |
| | | <option value="03050000">民生银行</option> |
| | | <option value="03060000">广发银行</option> |
| | | <option value="03080000">招商银行</option> |
| | | <option value="03090000">兴业银行</option> |
| | | <option value="03100000">浦发银行</option> |
| | | <option value="03130011">北京银行</option> |
| | | <option value="03130012">天津银行</option> |
| | | <option value="03130031">上海银行</option> |
| | | <option value="03130032">江苏银行</option> |
| | | <option value="03130050">重庆银行</option> |
| | | <option value="03132102">大连银行</option> |
| | | <option value="03132301">哈尔滨银行</option> |
| | | <option value="03133201">南京银行</option> |
| | | <option value="03133301">杭州银行</option> |
| | | <option value="03133302">宁波银行</option> |
| | | <option value="03133308">温州银行</option> |
| | | <option value="03150000">恒丰银行</option> |
| | | <option value="03160000">浙商银行</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*开户行地区:</label> |
| | | <div class="col-sm-4"> |
| | | <select class="form-control" id="provCodeBank" name="provCodeBank" onchange="initArea(this, 'areaCodeBank')"></select> |
| | | </div> |
| | | <div class="col-sm-4"> |
| | | <select class="form-control" id="areaCodeBank" name="areaCodeBank"></select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*开户行地区:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="provCodeBank" name="provCodeBank"> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="cityCodeBank" name="cityCodeBank"> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="areaCodeBank" name="areaCodeBank"> |
| | | <label class="col-sm-3 control-label">*银行预留手机号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="phone" name="phone" type="number" maxlength="11" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | |
| | | <script src="${ctxPath}/static/modular/system/tAgent/tAgent_info.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/tAgent/tAgent.js"></script> |
| | | <script type="text/javascript"> |
| | | var citys = [{"value":"0011","title":"北京市","cities":[{"value":"1100","title":"北京市"}]},{"value":"0012","title":"天津市","cities":[{"value":"1200","title":"天津市"}]},{"value":"0013","title":"河北省","cities":[{"value":"1301","title":"石家庄"},{"value":"1302","title":"保定"},{"value":"1303","title":"沧州"},{"value":"1304","title":"承德"},{"value":"1305","title":"邯郸"},{"value":"1306","title":"衡水"},{"value":"1307","title":"廊坊"},{"value":"1308","title":"秦皇岛"},{"value":"1309","title":"唐山"},{"value":"1310","title":"邢台"},{"value":"1311","title":"张家口"}]},{"value":"0014","title":"山西省","cities":[{"value":"1401","title":"太原"},{"value":"1402","title":"长治"},{"value":"1403","title":"大同"},{"value":"1404","title":"晋城"},{"value":"1405","title":"离石"},{"value":"1406","title":"临汾"},{"value":"1407","title":"朔州"},{"value":"1408","title":"忻州"},{"value":"1409","title":"阳泉"},{"value":"1410","title":"榆次"},{"value":"1411","title":"运城"},{"value":"1412","title":"晋中"},{"value":"1413","title":"吕梁"}]},{"value":"0015","title":"内蒙古自治区","cities":[{"value":"1501","title":"呼和浩特"},{"value":"1502","title":"包头"},{"value":"1503","title":"阿拉善"},{"value":"1504","title":"巴彦淖尔"},{"value":"1505","title":"赤峰"},{"value":"1506","title":"呼伦贝尔"},{"value":"1507","title":"乌海"},{"value":"1508","title":"乌兰察布"},{"value":"1509","title":"锡林郭勒"},{"value":"1510","title":"兴安"},{"value":"1511","title":"鄂尔多斯"},{"value":"1512","title":"通辽"},{"value":"1513","title":"满洲里"}]},{"value":"0021","title":"辽宁省","cities":[{"value":"2101","title":"沈阳"},{"value":"2102","title":"大连"},{"value":"2103","title":"鞍山"},{"value":"2104","title":"本溪"},{"value":"2105","title":"朝阳"},{"value":"2106","title":"丹东"},{"value":"2107","title":"抚顺"},{"value":"2108","title":"阜新"},{"value":"2109","title":"葫芦岛"},{"value":"2110","title":"锦州"},{"value":"2111","title":"辽阳"},{"value":"2112","title":"盘锦"},{"value":"2113","title":"铁岭"},{"value":"2114","title":"营口"}]},{"value":"0022","title":"吉林省","cities":[{"value":"2201","title":"长春"},{"value":"2202","title":"白城"},{"value":"2203","title":"白山"},{"value":"2204","title":"吉林"},{"value":"2205","title":"辽源"},{"value":"2206","title":"四平"},{"value":"2207","title":"松原"},{"value":"2208","title":"通化"},{"value":"2209","title":"延边"}]},{"value":"0023","title":"黑龙江省","cities":[{"value":"2301","title":"哈尔滨"},{"value":"2302","title":"大庆"},{"value":"2303","title":"大兴安岭"},{"value":"2304","title":"鹤岗"},{"value":"2305","title":"黑河"},{"value":"2306","title":"鸡西"},{"value":"2307","title":"佳木斯"},{"value":"2308","title":"牡丹江"},{"value":"2309","title":"七台河"},{"value":"2310","title":"齐齐哈尔"},{"value":"2311","title":"双鸭山"},{"value":"2312","title":"绥化"},{"value":"2313","title":"伊春"}]},{"value":"0031","title":"上海市","cities":[{"value":"3100","title":"上海市"}]},{"value":"0032","title":"江苏省","cities":[{"value":"3201","title":"南京"},{"value":"3202","title":"常州"},{"value":"3203","title":"淮安"},{"value":"3204","title":"连云港"},{"value":"3205","title":"南通"},{"value":"3206","title":"苏州"},{"value":"3207","title":"宿迁"},{"value":"3208","title":"泰州"},{"value":"3209","title":"无锡"},{"value":"3210","title":"徐州"},{"value":"3211","title":"盐城"},{"value":"3212","title":"扬州"},{"value":"3213","title":"镇江"},{"value":"3214","title":"胥浦"},{"value":"3215","title":"昆山"}]},{"value":"0033","title":"浙江省","cities":[{"value":"3301","title":"杭州"},{"value":"3302","title":"宁波"},{"value":"3303","title":"湖州"},{"value":"3304","title":"嘉兴"},{"value":"3305","title":"金华"},{"value":"3306","title":"绍兴"},{"value":"3307","title":"台州"},{"value":"3308","title":"温州"},{"value":"3309","title":"舟山"},{"value":"3310","title":"衢州"},{"value":"3311","title":"丽水"}]},{"value":"0034","title":"安徽省","cities":[{"value":"3401","title":"合肥"},{"value":"3402","title":"安庆"},{"value":"3403","title":"蚌埠"},{"value":"3404","title":"巢湖"},{"value":"3405","title":"池州"},{"value":"3406","title":"滁州"},{"value":"3407","title":"阜阳"},{"value":"3408","title":"淮北"},{"value":"3409","title":"淮南"},{"value":"3410","title":"黄山"},{"value":"3411","title":"六安"},{"value":"3412","title":"马鞍山"},{"value":"3414","title":"铜陵"},{"value":"3415","title":"芜湖"},{"value":"3416","title":"宣城"},{"value":"3417","title":"亳州"},{"value":"3418","title":"宿州"}]},{"value":"0035","title":"福建省","cities":[{"value":"3501","title":"福州"},{"value":"3502","title":"厦门"},{"value":"3503","title":"龙岩"},{"value":"3504","title":"南平"},{"value":"3505","title":"宁德"},{"value":"3506","title":"莆田"},{"value":"3507","title":"泉州"},{"value":"3508","title":"三明"},{"value":"3509","title":"漳州"}]},{"value":"0036","title":"江西省","cities":[{"value":"3601","title":"南昌"},{"value":"3602","title":"抚州"},{"value":"3603","title":"赣州"},{"value":"3604","title":"吉安"},{"value":"3605","title":"景德镇"},{"value":"3606","title":"九江"},{"value":"3607","title":"萍乡"},{"value":"3608","title":"上饶"},{"value":"3609","title":"新余"},{"value":"3610","title":"宜春"},{"value":"3611","title":"鹰潭"}]},{"value":"0037","title":"山东省","cities":[{"value":"3701","title":"济南"},{"value":"3702","title":"青岛"},{"value":"3703","title":"滨州"},{"value":"3704","title":"德州"},{"value":"3705","title":"东营"},{"value":"3706","title":"菏泽"},{"value":"3707","title":"济宁"},{"value":"3708","title":"莱芜"},{"value":"3709","title":"聊城"},{"value":"3710","title":"临沂"},{"value":"3711","title":"日照"},{"value":"3712","title":"泰安"},{"value":"3713","title":"威海"},{"value":"3714","title":"潍坊"},{"value":"3715","title":"烟台"},{"value":"3716","title":"枣庄"},{"value":"3717","title":"淄博"}]},{"value":"0041","title":"河南省","cities":[{"value":"4101","title":"郑州"},{"value":"4102","title":"安阳"},{"value":"4103","title":"焦作"},{"value":"4104","title":"鹤壁"},{"value":"4105","title":"开封"},{"value":"4106","title":"洛阳"},{"value":"4107","title":"南阳"},{"value":"4108","title":"平顶山"},{"value":"4109","title":"三门峡"},{"value":"4110","title":"商丘"},{"value":"4111","title":"新乡"},{"value":"4112","title":"信阳"},{"value":"4113","title":"许昌"},{"value":"4114","title":"周口"},{"value":"4115","title":"驻马店"},{"value":"4116","title":"漯河"},{"value":"4117","title":"濮阳"},{"value":"4118","title":"济源"}]},{"value":"0042","title":"湖北省","cities":[{"value":"4201","title":"武汉"},{"value":"4202","title":"鄂州"},{"value":"4203","title":"恩施"},{"value":"4204","title":"黄冈"},{"value":"4205","title":"黄石"},{"value":"4206","title":"荆门"},{"value":"4207","title":"荆州"},{"value":"4208","title":"十堰"},{"value":"4209","title":"随州"},{"value":"4210","title":"咸宁"},{"value":"4211","title":"襄樊"},{"value":"4212","title":"孝感"},{"value":"4213","title":"神农架"},{"value":"4214","title":"天门"},{"value":"4215","title":"宜昌"},{"value":"4216","title":"三峡"},{"value":"4217","title":"潜江"},{"value":"4218","title":"仙桃"}]},{"value":"0043","title":"湖南省","cities":[{"value":"4301","title":"长沙"},{"value":"4302","title":"常德"},{"value":"4303","title":"郴州"},{"value":"4304","title":"衡阳"},{"value":"4305","title":"怀化"},{"value":"4306","title":"娄底"},{"value":"4307","title":"邵阳"},{"value":"4308","title":"湘潭"},{"value":"4309","title":"湘西"},{"value":"4310","title":"益阳"},{"value":"4311","title":"永州"},{"value":"4312","title":"岳阳"},{"value":"4313","title":"张家界"},{"value":"4314","title":"株洲"},{"value":"4331","title":"吉首"}]},{"value":"0044","title":"广东省","cities":[{"value":"4401","title":"广州"},{"value":"4402","title":"深圳"},{"value":"4403","title":"潮州"},{"value":"4404","title":"东莞"},{"value":"4405","title":"佛山"},{"value":"4406","title":"惠州"},{"value":"4407","title":"江门"},{"value":"4408","title":"揭阳"},{"value":"4409","title":"茂名"},{"value":"4410","title":"梅州"},{"value":"4411","title":"清远"},{"value":"4412","title":"汕头"},{"value":"4413","title":"汕尾"},{"value":"4414","title":"韶关"},{"value":"4415","title":"阳江"},{"value":"4416","title":"云浮"},{"value":"4417","title":"湛江"},{"value":"4418","title":"肇庆"},{"value":"4419","title":"中山"},{"value":"4420","title":"河源"},{"value":"4421","title":"珠海"}]},{"value":"0045","title":"广西壮族自治区","cities":[{"value":"4501","title":"南宁"},{"value":"4502","title":"百色"},{"value":"4503","title":"北海"},{"value":"4504","title":"桂林"},{"value":"4505","title":"河池"},{"value":"4506","title":"柳州"},{"value":"4507","title":"梧州"},{"value":"4508","title":"玉林"},{"value":"4509","title":"崇左"},{"value":"4510","title":"防城港"},{"value":"4511","title":"贵港"},{"value":"4512","title":"贺州"},{"value":"4513","title":"来宾"},{"value":"4514","title":"钦州"}]},{"value":"0046","title":"海南省","cities":[{"value":"4601","title":"海口"},{"value":"4602","title":"三亚"},{"value":"4603","title":"白沙"},{"value":"4604","title":"保亭"},{"value":"4605","title":"昌江"},{"value":"4606","title":"澄迈"},{"value":"4607","title":"儋州"},{"value":"4608","title":"定安"},{"value":"4609","title":"东方"},{"value":"4610","title":"乐东"},{"value":"4611","title":"临高"},{"value":"4612","title":"陵水"},{"value":"4613","title":"琼海"},{"value":"4614","title":"琼中"},{"value":"4615","title":"屯昌"},{"value":"4616","title":"万宁"},{"value":"4617","title":"文昌"},{"value":"4618","title":"五指山"},{"value":"4619","title":"洋浦"}]},{"value":"0050","title":"重庆市","cities":[{"value":"5000","title":"重庆市"}]},{"value":"0051","title":"四川省","cities":[{"value":"5101","title":"成都"},{"value":"5102","title":"巴中"},{"value":"5103","title":"达州"},{"value":"5104","title":"德阳"},{"value":"5105","title":"广安"},{"value":"5106","title":"广元"},{"value":"5107","title":"乐山"},{"value":"5108","title":"凉山"},{"value":"5109","title":"眉山"},{"value":"5110","title":"绵阳"},{"value":"5111","title":"南充"},{"value":"5112","title":"内江"},{"value":"5113","title":"攀枝花"},{"value":"5114","title":"遂宁"},{"value":"5115","title":"雅安"},{"value":"5116","title":"宜宾"},{"value":"5117","title":"自贡"},{"value":"5118","title":"泸州"},{"value":"5119","title":"阿坝"},{"value":"5120","title":"甘孜"},{"value":"5121","title":"资阳"}]},{"value":"0052","title":"贵州省","cities":[{"value":"5201","title":"贵阳"},{"value":"5202","title":"安顺"},{"value":"5203","title":"毕节"},{"value":"5204","title":"六盘水"},{"value":"5205","title":"铜仁"},{"value":"5206","title":"遵义"},{"value":"5207","title":"黔东南"},{"value":"5208","title":"黔南"},{"value":"5209","title":"黔西南"}]},{"value":"0053","title":"云南省","cities":[{"value":"5301","title":"昆明"},{"value":"5302","title":"西双版纳"},{"value":"5303","title":"保山"},{"value":"5304","title":"楚雄"},{"value":"5305","title":"大理"},{"value":"5306","title":"德宏"},{"value":"5307","title":"红河"},{"value":"5308","title":"丽江"},{"value":"5309","title":"临沧"},{"value":"5310","title":"怒江"},{"value":"5311","title":"曲靖"},{"value":"5312","title":"思茅"},{"value":"5313","title":"文山"},{"value":"5314","title":"玉溪"},{"value":"5315","title":"昭通"},{"value":"5316","title":"中甸"},{"value":"5317","title":"迪庆州"}]},{"value":"0054","title":"西藏自治区","cities":[{"value":"5401","title":"拉萨"},{"value":"5402","title":"阿里"},{"value":"5403","title":"昌都"},{"value":"5404","title":"林芝"},{"value":"5405","title":"那曲"},{"value":"5406","title":"日喀则"},{"value":"5407","title":"山南"},{"value":"5424","title":"樟木口岸"}]},{"value":"0061","title":"陕西省","cities":[{"value":"6101","title":"西安"},{"value":"6102","title":"安康"},{"value":"6103","title":"宝鸡"},{"value":"6104","title":"汉中"},{"value":"6105","title":"商洛"},{"value":"6106","title":"铜川"},{"value":"6107","title":"渭南"},{"value":"6108","title":"咸阳"},{"value":"6109","title":"延安"},{"value":"6110","title":"榆林"}]},{"value":"0062","title":"甘肃省","cities":[{"value":"6201","title":"兰州"},{"value":"6202","title":"白银"},{"value":"6203","title":"定西"},{"value":"6204","title":"东风"},{"value":"6205","title":"合作"},{"value":"6206","title":"嘉峪关"},{"value":"6207","title":"金昌"},{"value":"6208","title":"酒泉"},{"value":"6209","title":"矿区"},{"value":"6210","title":"临夏"},{"value":"6211","title":"陇南"},{"value":"6212","title":"平凉"},{"value":"6213","title":"庆阳"},{"value":"6214","title":"天水"},{"value":"6215","title":"武威"},{"value":"6216","title":"张掖"},{"value":"6217","title":"甘南州"}]},{"value":"0063","title":"青海省","cities":[{"value":"6301","title":"西宁"},{"value":"6302","title":"海东"},{"value":"6322","title":"海北"},{"value":"6323","title":"黄南"},{"value":"6325","title":"海南"},{"value":"6326","title":"果洛"},{"value":"6327","title":"玉树"},{"value":"6328","title":"海西"}]},{"value":"0064","title":"宁夏回族自治区","cities":[{"value":"6401","title":"银川"},{"value":"6402","title":"中卫"},{"value":"6403","title":"固原"},{"value":"6404","title":"石嘴山"},{"value":"6405","title":"吴忠"}]},{"value":"0065","title":"新疆维吾尔自治区","cities":[{"value":"6501","title":"乌鲁木齐"},{"value":"6502","title":"阿克苏"},{"value":"6503","title":"阿勒泰"},{"value":"6504","title":"巴州"},{"value":"6505","title":"博州"},{"value":"6506","title":"昌吉"},{"value":"6507","title":"哈密"},{"value":"6508","title":"和田"},{"value":"6509","title":"喀什"},{"value":"6510","title":"克拉玛依"},{"value":"6511","title":"马兰"},{"value":"6512","title":"石河子"},{"value":"6513","title":"塔城"},{"value":"6514","title":"吐鲁番"},{"value":"6515","title":"伊犁"},{"value":"6516","title":"克州"},{"value":"6517","title":"阿拉尔"},{"value":"6518","title":"五家渠"}]},{"value":"2003","title":"台湾省","cities":[{"value":"9903","title":"台湾省"}]},{"value":"2001","title":"香港特别行政区","cities":[{"value":"9901","title":"香港特别行政区"}]},{"value":"2002","title":"澳门特别行政区","cities":[{"value":"9902","title":"澳门特别行政区"}]}]; |
| | | laydate.render({ |
| | | elem: '#socialCreditCodeExpires', |
| | | type: "date" |
| | |
| | | elem: '#certIdExpires', |
| | | type: "date" |
| | | }); |
| | | $('.qy').hide(); |
| | | $('#userType').change(function () { |
| | | let userType = $(this).val(); |
| | | if(userType == 0){ |
| | | $('.qy').hide(); |
| | | $('#bankAcctType').html('<option value="2">对私</option>') |
| | | }else{ |
| | | $('.qy').show(); |
| | | $('#bankAcctType').html('<option value="1">对公</option>') |
| | | } |
| | | }) |
| | | |
| | | function initCity(id) { |
| | | let city = ""; |
| | | for(let i in citys){ |
| | | let p = citys[i]; |
| | | city += '<option value="' + p.value + '">' + p.title+ '</option>' |
| | | } |
| | | $('#' + id).html(city); |
| | | } |
| | | |
| | | function initArea(e, id) { |
| | | let city = ""; |
| | | let cityCode = $(e).val(); |
| | | for(let i in citys){ |
| | | let p = citys[i]; |
| | | if(p.value == cityCode){ |
| | | let a = p.cities; |
| | | for(let j in a){ |
| | | city += '<option value="' + a[j].value + '">' + a[j].title+ '</option>' |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | | $('#' + id).html(city); |
| | | } |
| | | |
| | | |
| | | $('#fileNoBtnId').click(function () { |
| | | $('#file').click(); |
| | | }) |
| | | |
| | | $('#file').change(function () { |
| | | var formData = new FormData(); |
| | | formData.append('file', $('#file')[0].files[0]) |
| | | $.ajax({ |
| | | url : Feng.ctxPath + "/tAgent/uploadFile", |
| | | type : "POST", |
| | | data : formData, |
| | | contentType : false, |
| | | processData : false, |
| | | success : function(data) { |
| | | if("" == data){ |
| | | Feng.error("上传失败"); |
| | | }else{ |
| | | $('#fileNo').val(data); |
| | | $('#file').val(''); |
| | | Feng.success("上传成功!"); |
| | | } |
| | | }, |
| | | error : function() { |
| | | Feng.error("上传失败"); |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | |
| | | $(function () { |
| | | initCity('provCodeBank'); |
| | | initCity('provCodeEnterprise'); |
| | | }) |
| | | </script> |
| | | @} |
New file |
| | |
| | | (function( $ ){ |
| | | $.fn.qrcode = function(options) { |
| | | // if options is string, |
| | | if( typeof options === 'string' ){ |
| | | options = { text: options }; |
| | | } |
| | | |
| | | // set default values |
| | | // typeNumber < 1 for automatic calculation |
| | | options = $.extend( {}, { |
| | | render : "canvas", |
| | | width : 256, |
| | | height : 256, |
| | | typeNumber : -1, |
| | | correctLevel : QRErrorCorrectLevel.H, |
| | | background : "#ffffff", |
| | | foreground : "#000000" |
| | | }, options); |
| | | |
| | | var createCanvas = function(){ |
| | | // create the qrcode itself |
| | | var qrcode = new QRCode(options.typeNumber, options.correctLevel); |
| | | qrcode.addData(options.text); |
| | | qrcode.make(); |
| | | |
| | | // create canvas element |
| | | var canvas = document.createElement('canvas'); |
| | | canvas.width = options.width; |
| | | canvas.height = options.height; |
| | | var ctx = canvas.getContext('2d'); |
| | | |
| | | // compute tileW/tileH based on options.width/options.height |
| | | var tileW = options.width / qrcode.getModuleCount(); |
| | | var tileH = options.height / qrcode.getModuleCount(); |
| | | |
| | | // draw in the canvas |
| | | for( var row = 0; row < qrcode.getModuleCount(); row++ ){ |
| | | for( var col = 0; col < qrcode.getModuleCount(); col++ ){ |
| | | ctx.fillStyle = qrcode.isDark(row, col) ? options.foreground : options.background; |
| | | var w = (Math.ceil((col+1)*tileW) - Math.floor(col*tileW)); |
| | | var h = (Math.ceil((row+1)*tileH) - Math.floor(row*tileH)); |
| | | ctx.fillRect(Math.round(col*tileW),Math.round(row*tileH), w, h); |
| | | } |
| | | } |
| | | // return just built canvas |
| | | return canvas; |
| | | } |
| | | |
| | | // from Jon-Carlos Rivera (https://github.com/imbcmdth) |
| | | var createTable = function(){ |
| | | // create the qrcode itself |
| | | var qrcode = new QRCode(options.typeNumber, options.correctLevel); |
| | | qrcode.addData(options.text); |
| | | qrcode.make(); |
| | | |
| | | // create table element |
| | | var $table = $('<table></table>') |
| | | .css("width", options.width+"px") |
| | | .css("height", options.height+"px") |
| | | .css("border", "0px") |
| | | .css("border-collapse", "collapse") |
| | | .css('background-color', options.background); |
| | | |
| | | // compute tileS percentage |
| | | var tileW = options.width / qrcode.getModuleCount(); |
| | | var tileH = options.height / qrcode.getModuleCount(); |
| | | |
| | | // draw in the table |
| | | for(var row = 0; row < qrcode.getModuleCount(); row++ ){ |
| | | var $row = $('<tr></tr>').css('height', tileH+"px").appendTo($table); |
| | | |
| | | for(var col = 0; col < qrcode.getModuleCount(); col++ ){ |
| | | $('<td></td>') |
| | | .css('width', tileW+"px") |
| | | .css('background-color', qrcode.isDark(row, col) ? options.foreground : options.background) |
| | | .appendTo($row); |
| | | } |
| | | } |
| | | // return just built canvas |
| | | return $table; |
| | | } |
| | | |
| | | |
| | | return this.each(function(){ |
| | | var element = options.render == "canvas" ? createCanvas() : createTable(); |
| | | $(element).appendTo(this); |
| | | }); |
| | | }; |
| | | })( jQuery ); |
New file |
| | |
| | | //--------------------------------------------------------------------- |
| | | // QRCode for JavaScript |
| | | // |
| | | // Copyright (c) 2009 Kazuhiko Arase |
| | | // |
| | | // URL: http://www.d-project.com/ |
| | | // |
| | | // Licensed under the MIT license: |
| | | // http://www.opensource.org/licenses/mit-license.php |
| | | // |
| | | // The word "QR Code" is registered trademark of |
| | | // DENSO WAVE INCORPORATED |
| | | // http://www.denso-wave.com/qrcode/faqpatent-e.html |
| | | // |
| | | //--------------------------------------------------------------------- |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QR8bitByte |
| | | //--------------------------------------------------------------------- |
| | | |
| | | function QR8bitByte(data) { |
| | | this.mode = QRMode.MODE_8BIT_BYTE; |
| | | this.data = data; |
| | | } |
| | | |
| | | QR8bitByte.prototype = { |
| | | |
| | | getLength : function(buffer) { |
| | | return this.data.length; |
| | | }, |
| | | |
| | | write : function(buffer) { |
| | | for (var i = 0; i < this.data.length; i++) { |
| | | // not JIS ... |
| | | buffer.put(this.data.charCodeAt(i), 8); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRCode |
| | | //--------------------------------------------------------------------- |
| | | |
| | | function QRCode(typeNumber, errorCorrectLevel) { |
| | | this.typeNumber = typeNumber; |
| | | this.errorCorrectLevel = errorCorrectLevel; |
| | | this.modules = null; |
| | | this.moduleCount = 0; |
| | | this.dataCache = null; |
| | | this.dataList = new Array(); |
| | | } |
| | | |
| | | QRCode.prototype = { |
| | | |
| | | addData : function(data) { |
| | | var newData = new QR8bitByte(data); |
| | | this.dataList.push(newData); |
| | | this.dataCache = null; |
| | | }, |
| | | |
| | | isDark : function(row, col) { |
| | | if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) { |
| | | throw new Error(row + "," + col); |
| | | } |
| | | return this.modules[row][col]; |
| | | }, |
| | | |
| | | getModuleCount : function() { |
| | | return this.moduleCount; |
| | | }, |
| | | |
| | | make : function() { |
| | | // Calculate automatically typeNumber if provided is < 1 |
| | | if (this.typeNumber < 1 ){ |
| | | var typeNumber = 1; |
| | | for (typeNumber = 1; typeNumber < 40; typeNumber++) { |
| | | var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel); |
| | | |
| | | var buffer = new QRBitBuffer(); |
| | | var totalDataCount = 0; |
| | | for (var i = 0; i < rsBlocks.length; i++) { |
| | | totalDataCount += rsBlocks[i].dataCount; |
| | | } |
| | | |
| | | for (var i = 0; i < this.dataList.length; i++) { |
| | | var data = this.dataList[i]; |
| | | buffer.put(data.mode, 4); |
| | | buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber) ); |
| | | data.write(buffer); |
| | | } |
| | | if (buffer.getLengthInBits() <= totalDataCount * 8) |
| | | break; |
| | | } |
| | | this.typeNumber = typeNumber; |
| | | } |
| | | this.makeImpl(false, this.getBestMaskPattern() ); |
| | | }, |
| | | |
| | | makeImpl : function(test, maskPattern) { |
| | | |
| | | this.moduleCount = this.typeNumber * 4 + 17; |
| | | this.modules = new Array(this.moduleCount); |
| | | |
| | | for (var row = 0; row < this.moduleCount; row++) { |
| | | |
| | | this.modules[row] = new Array(this.moduleCount); |
| | | |
| | | for (var col = 0; col < this.moduleCount; col++) { |
| | | this.modules[row][col] = null;//(col + row) % 3; |
| | | } |
| | | } |
| | | |
| | | this.setupPositionProbePattern(0, 0); |
| | | this.setupPositionProbePattern(this.moduleCount - 7, 0); |
| | | this.setupPositionProbePattern(0, this.moduleCount - 7); |
| | | this.setupPositionAdjustPattern(); |
| | | this.setupTimingPattern(); |
| | | this.setupTypeInfo(test, maskPattern); |
| | | |
| | | if (this.typeNumber >= 7) { |
| | | this.setupTypeNumber(test); |
| | | } |
| | | |
| | | if (this.dataCache == null) { |
| | | this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList); |
| | | } |
| | | |
| | | this.mapData(this.dataCache, maskPattern); |
| | | }, |
| | | |
| | | setupPositionProbePattern : function(row, col) { |
| | | |
| | | for (var r = -1; r <= 7; r++) { |
| | | |
| | | if (row + r <= -1 || this.moduleCount <= row + r) continue; |
| | | |
| | | for (var c = -1; c <= 7; c++) { |
| | | |
| | | if (col + c <= -1 || this.moduleCount <= col + c) continue; |
| | | |
| | | if ( (0 <= r && r <= 6 && (c == 0 || c == 6) ) |
| | | || (0 <= c && c <= 6 && (r == 0 || r == 6) ) |
| | | || (2 <= r && r <= 4 && 2 <= c && c <= 4) ) { |
| | | this.modules[row + r][col + c] = true; |
| | | } else { |
| | | this.modules[row + r][col + c] = false; |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | |
| | | getBestMaskPattern : function() { |
| | | |
| | | var minLostPoint = 0; |
| | | var pattern = 0; |
| | | |
| | | for (var i = 0; i < 8; i++) { |
| | | |
| | | this.makeImpl(true, i); |
| | | |
| | | var lostPoint = QRUtil.getLostPoint(this); |
| | | |
| | | if (i == 0 || minLostPoint > lostPoint) { |
| | | minLostPoint = lostPoint; |
| | | pattern = i; |
| | | } |
| | | } |
| | | |
| | | return pattern; |
| | | }, |
| | | |
| | | createMovieClip : function(target_mc, instance_name, depth) { |
| | | |
| | | var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth); |
| | | var cs = 1; |
| | | |
| | | this.make(); |
| | | |
| | | for (var row = 0; row < this.modules.length; row++) { |
| | | |
| | | var y = row * cs; |
| | | |
| | | for (var col = 0; col < this.modules[row].length; col++) { |
| | | |
| | | var x = col * cs; |
| | | var dark = this.modules[row][col]; |
| | | |
| | | if (dark) { |
| | | qr_mc.beginFill(0, 100); |
| | | qr_mc.moveTo(x, y); |
| | | qr_mc.lineTo(x + cs, y); |
| | | qr_mc.lineTo(x + cs, y + cs); |
| | | qr_mc.lineTo(x, y + cs); |
| | | qr_mc.endFill(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return qr_mc; |
| | | }, |
| | | |
| | | setupTimingPattern : function() { |
| | | |
| | | for (var r = 8; r < this.moduleCount - 8; r++) { |
| | | if (this.modules[r][6] != null) { |
| | | continue; |
| | | } |
| | | this.modules[r][6] = (r % 2 == 0); |
| | | } |
| | | |
| | | for (var c = 8; c < this.moduleCount - 8; c++) { |
| | | if (this.modules[6][c] != null) { |
| | | continue; |
| | | } |
| | | this.modules[6][c] = (c % 2 == 0); |
| | | } |
| | | }, |
| | | |
| | | setupPositionAdjustPattern : function() { |
| | | |
| | | var pos = QRUtil.getPatternPosition(this.typeNumber); |
| | | |
| | | for (var i = 0; i < pos.length; i++) { |
| | | |
| | | for (var j = 0; j < pos.length; j++) { |
| | | |
| | | var row = pos[i]; |
| | | var col = pos[j]; |
| | | |
| | | if (this.modules[row][col] != null) { |
| | | continue; |
| | | } |
| | | |
| | | for (var r = -2; r <= 2; r++) { |
| | | |
| | | for (var c = -2; c <= 2; c++) { |
| | | |
| | | if (r == -2 || r == 2 || c == -2 || c == 2 |
| | | || (r == 0 && c == 0) ) { |
| | | this.modules[row + r][col + c] = true; |
| | | } else { |
| | | this.modules[row + r][col + c] = false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | |
| | | setupTypeNumber : function(test) { |
| | | |
| | | var bits = QRUtil.getBCHTypeNumber(this.typeNumber); |
| | | |
| | | for (var i = 0; i < 18; i++) { |
| | | var mod = (!test && ( (bits >> i) & 1) == 1); |
| | | this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod; |
| | | } |
| | | |
| | | for (var i = 0; i < 18; i++) { |
| | | var mod = (!test && ( (bits >> i) & 1) == 1); |
| | | this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod; |
| | | } |
| | | }, |
| | | |
| | | setupTypeInfo : function(test, maskPattern) { |
| | | |
| | | var data = (this.errorCorrectLevel << 3) | maskPattern; |
| | | var bits = QRUtil.getBCHTypeInfo(data); |
| | | |
| | | // vertical |
| | | for (var i = 0; i < 15; i++) { |
| | | |
| | | var mod = (!test && ( (bits >> i) & 1) == 1); |
| | | |
| | | if (i < 6) { |
| | | this.modules[i][8] = mod; |
| | | } else if (i < 8) { |
| | | this.modules[i + 1][8] = mod; |
| | | } else { |
| | | this.modules[this.moduleCount - 15 + i][8] = mod; |
| | | } |
| | | } |
| | | |
| | | // horizontal |
| | | for (var i = 0; i < 15; i++) { |
| | | |
| | | var mod = (!test && ( (bits >> i) & 1) == 1); |
| | | |
| | | if (i < 8) { |
| | | this.modules[8][this.moduleCount - i - 1] = mod; |
| | | } else if (i < 9) { |
| | | this.modules[8][15 - i - 1 + 1] = mod; |
| | | } else { |
| | | this.modules[8][15 - i - 1] = mod; |
| | | } |
| | | } |
| | | |
| | | // fixed module |
| | | this.modules[this.moduleCount - 8][8] = (!test); |
| | | |
| | | }, |
| | | |
| | | mapData : function(data, maskPattern) { |
| | | |
| | | var inc = -1; |
| | | var row = this.moduleCount - 1; |
| | | var bitIndex = 7; |
| | | var byteIndex = 0; |
| | | |
| | | for (var col = this.moduleCount - 1; col > 0; col -= 2) { |
| | | |
| | | if (col == 6) col--; |
| | | |
| | | while (true) { |
| | | |
| | | for (var c = 0; c < 2; c++) { |
| | | |
| | | if (this.modules[row][col - c] == null) { |
| | | |
| | | var dark = false; |
| | | |
| | | if (byteIndex < data.length) { |
| | | dark = ( ( (data[byteIndex] >>> bitIndex) & 1) == 1); |
| | | } |
| | | |
| | | var mask = QRUtil.getMask(maskPattern, row, col - c); |
| | | |
| | | if (mask) { |
| | | dark = !dark; |
| | | } |
| | | |
| | | this.modules[row][col - c] = dark; |
| | | bitIndex--; |
| | | |
| | | if (bitIndex == -1) { |
| | | byteIndex++; |
| | | bitIndex = 7; |
| | | } |
| | | } |
| | | } |
| | | |
| | | row += inc; |
| | | |
| | | if (row < 0 || this.moduleCount <= row) { |
| | | row -= inc; |
| | | inc = -inc; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | }; |
| | | |
| | | QRCode.PAD0 = 0xEC; |
| | | QRCode.PAD1 = 0x11; |
| | | |
| | | QRCode.createData = function(typeNumber, errorCorrectLevel, dataList) { |
| | | |
| | | var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel); |
| | | |
| | | var buffer = new QRBitBuffer(); |
| | | |
| | | for (var i = 0; i < dataList.length; i++) { |
| | | var data = dataList[i]; |
| | | buffer.put(data.mode, 4); |
| | | buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber) ); |
| | | data.write(buffer); |
| | | } |
| | | |
| | | // calc num max data. |
| | | var totalDataCount = 0; |
| | | for (var i = 0; i < rsBlocks.length; i++) { |
| | | totalDataCount += rsBlocks[i].dataCount; |
| | | } |
| | | |
| | | if (buffer.getLengthInBits() > totalDataCount * 8) { |
| | | throw new Error("code length overflow. (" |
| | | + buffer.getLengthInBits() |
| | | + ">" |
| | | + totalDataCount * 8 |
| | | + ")"); |
| | | } |
| | | |
| | | // end code |
| | | if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) { |
| | | buffer.put(0, 4); |
| | | } |
| | | |
| | | // padding |
| | | while (buffer.getLengthInBits() % 8 != 0) { |
| | | buffer.putBit(false); |
| | | } |
| | | |
| | | // padding |
| | | while (true) { |
| | | |
| | | if (buffer.getLengthInBits() >= totalDataCount * 8) { |
| | | break; |
| | | } |
| | | buffer.put(QRCode.PAD0, 8); |
| | | |
| | | if (buffer.getLengthInBits() >= totalDataCount * 8) { |
| | | break; |
| | | } |
| | | buffer.put(QRCode.PAD1, 8); |
| | | } |
| | | |
| | | return QRCode.createBytes(buffer, rsBlocks); |
| | | } |
| | | |
| | | QRCode.createBytes = function(buffer, rsBlocks) { |
| | | |
| | | var offset = 0; |
| | | |
| | | var maxDcCount = 0; |
| | | var maxEcCount = 0; |
| | | |
| | | var dcdata = new Array(rsBlocks.length); |
| | | var ecdata = new Array(rsBlocks.length); |
| | | |
| | | for (var r = 0; r < rsBlocks.length; r++) { |
| | | |
| | | var dcCount = rsBlocks[r].dataCount; |
| | | var ecCount = rsBlocks[r].totalCount - dcCount; |
| | | |
| | | maxDcCount = Math.max(maxDcCount, dcCount); |
| | | maxEcCount = Math.max(maxEcCount, ecCount); |
| | | |
| | | dcdata[r] = new Array(dcCount); |
| | | |
| | | for (var i = 0; i < dcdata[r].length; i++) { |
| | | dcdata[r][i] = 0xff & buffer.buffer[i + offset]; |
| | | } |
| | | offset += dcCount; |
| | | |
| | | var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount); |
| | | var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1); |
| | | |
| | | var modPoly = rawPoly.mod(rsPoly); |
| | | ecdata[r] = new Array(rsPoly.getLength() - 1); |
| | | for (var i = 0; i < ecdata[r].length; i++) { |
| | | var modIndex = i + modPoly.getLength() - ecdata[r].length; |
| | | ecdata[r][i] = (modIndex >= 0)? modPoly.get(modIndex) : 0; |
| | | } |
| | | |
| | | } |
| | | |
| | | var totalCodeCount = 0; |
| | | for (var i = 0; i < rsBlocks.length; i++) { |
| | | totalCodeCount += rsBlocks[i].totalCount; |
| | | } |
| | | |
| | | var data = new Array(totalCodeCount); |
| | | var index = 0; |
| | | |
| | | for (var i = 0; i < maxDcCount; i++) { |
| | | for (var r = 0; r < rsBlocks.length; r++) { |
| | | if (i < dcdata[r].length) { |
| | | data[index++] = dcdata[r][i]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (var i = 0; i < maxEcCount; i++) { |
| | | for (var r = 0; r < rsBlocks.length; r++) { |
| | | if (i < ecdata[r].length) { |
| | | data[index++] = ecdata[r][i]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return data; |
| | | |
| | | } |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRMode |
| | | //--------------------------------------------------------------------- |
| | | |
| | | var QRMode = { |
| | | MODE_NUMBER : 1 << 0, |
| | | MODE_ALPHA_NUM : 1 << 1, |
| | | MODE_8BIT_BYTE : 1 << 2, |
| | | MODE_KANJI : 1 << 3 |
| | | }; |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRErrorCorrectLevel |
| | | //--------------------------------------------------------------------- |
| | | |
| | | var QRErrorCorrectLevel = { |
| | | L : 1, |
| | | M : 0, |
| | | Q : 3, |
| | | H : 2 |
| | | }; |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRMaskPattern |
| | | //--------------------------------------------------------------------- |
| | | |
| | | var QRMaskPattern = { |
| | | PATTERN000 : 0, |
| | | PATTERN001 : 1, |
| | | PATTERN010 : 2, |
| | | PATTERN011 : 3, |
| | | PATTERN100 : 4, |
| | | PATTERN101 : 5, |
| | | PATTERN110 : 6, |
| | | PATTERN111 : 7 |
| | | }; |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRUtil |
| | | //--------------------------------------------------------------------- |
| | | |
| | | var QRUtil = { |
| | | |
| | | PATTERN_POSITION_TABLE : [ |
| | | [], |
| | | [6, 18], |
| | | [6, 22], |
| | | [6, 26], |
| | | [6, 30], |
| | | [6, 34], |
| | | [6, 22, 38], |
| | | [6, 24, 42], |
| | | [6, 26, 46], |
| | | [6, 28, 50], |
| | | [6, 30, 54], |
| | | [6, 32, 58], |
| | | [6, 34, 62], |
| | | [6, 26, 46, 66], |
| | | [6, 26, 48, 70], |
| | | [6, 26, 50, 74], |
| | | [6, 30, 54, 78], |
| | | [6, 30, 56, 82], |
| | | [6, 30, 58, 86], |
| | | [6, 34, 62, 90], |
| | | [6, 28, 50, 72, 94], |
| | | [6, 26, 50, 74, 98], |
| | | [6, 30, 54, 78, 102], |
| | | [6, 28, 54, 80, 106], |
| | | [6, 32, 58, 84, 110], |
| | | [6, 30, 58, 86, 114], |
| | | [6, 34, 62, 90, 118], |
| | | [6, 26, 50, 74, 98, 122], |
| | | [6, 30, 54, 78, 102, 126], |
| | | [6, 26, 52, 78, 104, 130], |
| | | [6, 30, 56, 82, 108, 134], |
| | | [6, 34, 60, 86, 112, 138], |
| | | [6, 30, 58, 86, 114, 142], |
| | | [6, 34, 62, 90, 118, 146], |
| | | [6, 30, 54, 78, 102, 126, 150], |
| | | [6, 24, 50, 76, 102, 128, 154], |
| | | [6, 28, 54, 80, 106, 132, 158], |
| | | [6, 32, 58, 84, 110, 136, 162], |
| | | [6, 26, 54, 82, 110, 138, 166], |
| | | [6, 30, 58, 86, 114, 142, 170] |
| | | ], |
| | | |
| | | G15 : (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0), |
| | | G18 : (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0), |
| | | G15_MASK : (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1), |
| | | |
| | | getBCHTypeInfo : function(data) { |
| | | var d = data << 10; |
| | | while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) { |
| | | d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) ) ); |
| | | } |
| | | return ( (data << 10) | d) ^ QRUtil.G15_MASK; |
| | | }, |
| | | |
| | | getBCHTypeNumber : function(data) { |
| | | var d = data << 12; |
| | | while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) { |
| | | d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) ) ); |
| | | } |
| | | return (data << 12) | d; |
| | | }, |
| | | |
| | | getBCHDigit : function(data) { |
| | | |
| | | var digit = 0; |
| | | |
| | | while (data != 0) { |
| | | digit++; |
| | | data >>>= 1; |
| | | } |
| | | |
| | | return digit; |
| | | }, |
| | | |
| | | getPatternPosition : function(typeNumber) { |
| | | return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1]; |
| | | }, |
| | | |
| | | getMask : function(maskPattern, i, j) { |
| | | |
| | | switch (maskPattern) { |
| | | |
| | | case QRMaskPattern.PATTERN000 : return (i + j) % 2 == 0; |
| | | case QRMaskPattern.PATTERN001 : return i % 2 == 0; |
| | | case QRMaskPattern.PATTERN010 : return j % 3 == 0; |
| | | case QRMaskPattern.PATTERN011 : return (i + j) % 3 == 0; |
| | | case QRMaskPattern.PATTERN100 : return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 == 0; |
| | | case QRMaskPattern.PATTERN101 : return (i * j) % 2 + (i * j) % 3 == 0; |
| | | case QRMaskPattern.PATTERN110 : return ( (i * j) % 2 + (i * j) % 3) % 2 == 0; |
| | | case QRMaskPattern.PATTERN111 : return ( (i * j) % 3 + (i + j) % 2) % 2 == 0; |
| | | |
| | | default : |
| | | throw new Error("bad maskPattern:" + maskPattern); |
| | | } |
| | | }, |
| | | |
| | | getErrorCorrectPolynomial : function(errorCorrectLength) { |
| | | |
| | | var a = new QRPolynomial([1], 0); |
| | | |
| | | for (var i = 0; i < errorCorrectLength; i++) { |
| | | a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0) ); |
| | | } |
| | | |
| | | return a; |
| | | }, |
| | | |
| | | getLengthInBits : function(mode, type) { |
| | | |
| | | if (1 <= type && type < 10) { |
| | | |
| | | // 1 - 9 |
| | | |
| | | switch(mode) { |
| | | case QRMode.MODE_NUMBER : return 10; |
| | | case QRMode.MODE_ALPHA_NUM : return 9; |
| | | case QRMode.MODE_8BIT_BYTE : return 8; |
| | | case QRMode.MODE_KANJI : return 8; |
| | | default : |
| | | throw new Error("mode:" + mode); |
| | | } |
| | | |
| | | } else if (type < 27) { |
| | | |
| | | // 10 - 26 |
| | | |
| | | switch(mode) { |
| | | case QRMode.MODE_NUMBER : return 12; |
| | | case QRMode.MODE_ALPHA_NUM : return 11; |
| | | case QRMode.MODE_8BIT_BYTE : return 16; |
| | | case QRMode.MODE_KANJI : return 10; |
| | | default : |
| | | throw new Error("mode:" + mode); |
| | | } |
| | | |
| | | } else if (type < 41) { |
| | | |
| | | // 27 - 40 |
| | | |
| | | switch(mode) { |
| | | case QRMode.MODE_NUMBER : return 14; |
| | | case QRMode.MODE_ALPHA_NUM : return 13; |
| | | case QRMode.MODE_8BIT_BYTE : return 16; |
| | | case QRMode.MODE_KANJI : return 12; |
| | | default : |
| | | throw new Error("mode:" + mode); |
| | | } |
| | | |
| | | } else { |
| | | throw new Error("type:" + type); |
| | | } |
| | | }, |
| | | |
| | | getLostPoint : function(qrCode) { |
| | | |
| | | var moduleCount = qrCode.getModuleCount(); |
| | | |
| | | var lostPoint = 0; |
| | | |
| | | // LEVEL1 |
| | | |
| | | for (var row = 0; row < moduleCount; row++) { |
| | | |
| | | for (var col = 0; col < moduleCount; col++) { |
| | | |
| | | var sameCount = 0; |
| | | var dark = qrCode.isDark(row, col); |
| | | |
| | | for (var r = -1; r <= 1; r++) { |
| | | |
| | | if (row + r < 0 || moduleCount <= row + r) { |
| | | continue; |
| | | } |
| | | |
| | | for (var c = -1; c <= 1; c++) { |
| | | |
| | | if (col + c < 0 || moduleCount <= col + c) { |
| | | continue; |
| | | } |
| | | |
| | | if (r == 0 && c == 0) { |
| | | continue; |
| | | } |
| | | |
| | | if (dark == qrCode.isDark(row + r, col + c) ) { |
| | | sameCount++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (sameCount > 5) { |
| | | lostPoint += (3 + sameCount - 5); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // LEVEL2 |
| | | |
| | | for (var row = 0; row < moduleCount - 1; row++) { |
| | | for (var col = 0; col < moduleCount - 1; col++) { |
| | | var count = 0; |
| | | if (qrCode.isDark(row, col ) ) count++; |
| | | if (qrCode.isDark(row + 1, col ) ) count++; |
| | | if (qrCode.isDark(row, col + 1) ) count++; |
| | | if (qrCode.isDark(row + 1, col + 1) ) count++; |
| | | if (count == 0 || count == 4) { |
| | | lostPoint += 3; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // LEVEL3 |
| | | |
| | | for (var row = 0; row < moduleCount; row++) { |
| | | for (var col = 0; col < moduleCount - 6; col++) { |
| | | if (qrCode.isDark(row, col) |
| | | && !qrCode.isDark(row, col + 1) |
| | | && qrCode.isDark(row, col + 2) |
| | | && qrCode.isDark(row, col + 3) |
| | | && qrCode.isDark(row, col + 4) |
| | | && !qrCode.isDark(row, col + 5) |
| | | && qrCode.isDark(row, col + 6) ) { |
| | | lostPoint += 40; |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (var col = 0; col < moduleCount; col++) { |
| | | for (var row = 0; row < moduleCount - 6; row++) { |
| | | if (qrCode.isDark(row, col) |
| | | && !qrCode.isDark(row + 1, col) |
| | | && qrCode.isDark(row + 2, col) |
| | | && qrCode.isDark(row + 3, col) |
| | | && qrCode.isDark(row + 4, col) |
| | | && !qrCode.isDark(row + 5, col) |
| | | && qrCode.isDark(row + 6, col) ) { |
| | | lostPoint += 40; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // LEVEL4 |
| | | |
| | | var darkCount = 0; |
| | | |
| | | for (var col = 0; col < moduleCount; col++) { |
| | | for (var row = 0; row < moduleCount; row++) { |
| | | if (qrCode.isDark(row, col) ) { |
| | | darkCount++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5; |
| | | lostPoint += ratio * 10; |
| | | |
| | | return lostPoint; |
| | | } |
| | | |
| | | }; |
| | | |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRMath |
| | | //--------------------------------------------------------------------- |
| | | |
| | | var QRMath = { |
| | | |
| | | glog : function(n) { |
| | | |
| | | if (n < 1) { |
| | | throw new Error("glog(" + n + ")"); |
| | | } |
| | | |
| | | return QRMath.LOG_TABLE[n]; |
| | | }, |
| | | |
| | | gexp : function(n) { |
| | | |
| | | while (n < 0) { |
| | | n += 255; |
| | | } |
| | | |
| | | while (n >= 256) { |
| | | n -= 255; |
| | | } |
| | | |
| | | return QRMath.EXP_TABLE[n]; |
| | | }, |
| | | |
| | | EXP_TABLE : new Array(256), |
| | | |
| | | LOG_TABLE : new Array(256) |
| | | |
| | | }; |
| | | |
| | | for (var i = 0; i < 8; i++) { |
| | | QRMath.EXP_TABLE[i] = 1 << i; |
| | | } |
| | | for (var i = 8; i < 256; i++) { |
| | | QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] |
| | | ^ QRMath.EXP_TABLE[i - 5] |
| | | ^ QRMath.EXP_TABLE[i - 6] |
| | | ^ QRMath.EXP_TABLE[i - 8]; |
| | | } |
| | | for (var i = 0; i < 255; i++) { |
| | | QRMath.LOG_TABLE[QRMath.EXP_TABLE[i] ] = i; |
| | | } |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRPolynomial |
| | | //--------------------------------------------------------------------- |
| | | |
| | | function QRPolynomial(num, shift) { |
| | | |
| | | if (num.length == undefined) { |
| | | throw new Error(num.length + "/" + shift); |
| | | } |
| | | |
| | | var offset = 0; |
| | | |
| | | while (offset < num.length && num[offset] == 0) { |
| | | offset++; |
| | | } |
| | | |
| | | this.num = new Array(num.length - offset + shift); |
| | | for (var i = 0; i < num.length - offset; i++) { |
| | | this.num[i] = num[i + offset]; |
| | | } |
| | | } |
| | | |
| | | QRPolynomial.prototype = { |
| | | |
| | | get : function(index) { |
| | | return this.num[index]; |
| | | }, |
| | | |
| | | getLength : function() { |
| | | return this.num.length; |
| | | }, |
| | | |
| | | multiply : function(e) { |
| | | |
| | | var num = new Array(this.getLength() + e.getLength() - 1); |
| | | |
| | | for (var i = 0; i < this.getLength(); i++) { |
| | | for (var j = 0; j < e.getLength(); j++) { |
| | | num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i) ) + QRMath.glog(e.get(j) ) ); |
| | | } |
| | | } |
| | | |
| | | return new QRPolynomial(num, 0); |
| | | }, |
| | | |
| | | mod : function(e) { |
| | | |
| | | if (this.getLength() - e.getLength() < 0) { |
| | | return this; |
| | | } |
| | | |
| | | var ratio = QRMath.glog(this.get(0) ) - QRMath.glog(e.get(0) ); |
| | | |
| | | var num = new Array(this.getLength() ); |
| | | |
| | | for (var i = 0; i < this.getLength(); i++) { |
| | | num[i] = this.get(i); |
| | | } |
| | | |
| | | for (var i = 0; i < e.getLength(); i++) { |
| | | num[i] ^= QRMath.gexp(QRMath.glog(e.get(i) ) + ratio); |
| | | } |
| | | |
| | | // recursive call |
| | | return new QRPolynomial(num, 0).mod(e); |
| | | } |
| | | }; |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRRSBlock |
| | | //--------------------------------------------------------------------- |
| | | |
| | | function QRRSBlock(totalCount, dataCount) { |
| | | this.totalCount = totalCount; |
| | | this.dataCount = dataCount; |
| | | } |
| | | |
| | | QRRSBlock.RS_BLOCK_TABLE = [ |
| | | |
| | | // L |
| | | // M |
| | | // Q |
| | | // H |
| | | |
| | | // 1 |
| | | [1, 26, 19], |
| | | [1, 26, 16], |
| | | [1, 26, 13], |
| | | [1, 26, 9], |
| | | |
| | | // 2 |
| | | [1, 44, 34], |
| | | [1, 44, 28], |
| | | [1, 44, 22], |
| | | [1, 44, 16], |
| | | |
| | | // 3 |
| | | [1, 70, 55], |
| | | [1, 70, 44], |
| | | [2, 35, 17], |
| | | [2, 35, 13], |
| | | |
| | | // 4 |
| | | [1, 100, 80], |
| | | [2, 50, 32], |
| | | [2, 50, 24], |
| | | [4, 25, 9], |
| | | |
| | | // 5 |
| | | [1, 134, 108], |
| | | [2, 67, 43], |
| | | [2, 33, 15, 2, 34, 16], |
| | | [2, 33, 11, 2, 34, 12], |
| | | |
| | | // 6 |
| | | [2, 86, 68], |
| | | [4, 43, 27], |
| | | [4, 43, 19], |
| | | [4, 43, 15], |
| | | |
| | | // 7 |
| | | [2, 98, 78], |
| | | [4, 49, 31], |
| | | [2, 32, 14, 4, 33, 15], |
| | | [4, 39, 13, 1, 40, 14], |
| | | |
| | | // 8 |
| | | [2, 121, 97], |
| | | [2, 60, 38, 2, 61, 39], |
| | | [4, 40, 18, 2, 41, 19], |
| | | [4, 40, 14, 2, 41, 15], |
| | | |
| | | // 9 |
| | | [2, 146, 116], |
| | | [3, 58, 36, 2, 59, 37], |
| | | [4, 36, 16, 4, 37, 17], |
| | | [4, 36, 12, 4, 37, 13], |
| | | |
| | | // 10 |
| | | [2, 86, 68, 2, 87, 69], |
| | | [4, 69, 43, 1, 70, 44], |
| | | [6, 43, 19, 2, 44, 20], |
| | | [6, 43, 15, 2, 44, 16], |
| | | |
| | | // 11 |
| | | [4, 101, 81], |
| | | [1, 80, 50, 4, 81, 51], |
| | | [4, 50, 22, 4, 51, 23], |
| | | [3, 36, 12, 8, 37, 13], |
| | | |
| | | // 12 |
| | | [2, 116, 92, 2, 117, 93], |
| | | [6, 58, 36, 2, 59, 37], |
| | | [4, 46, 20, 6, 47, 21], |
| | | [7, 42, 14, 4, 43, 15], |
| | | |
| | | // 13 |
| | | [4, 133, 107], |
| | | [8, 59, 37, 1, 60, 38], |
| | | [8, 44, 20, 4, 45, 21], |
| | | [12, 33, 11, 4, 34, 12], |
| | | |
| | | // 14 |
| | | [3, 145, 115, 1, 146, 116], |
| | | [4, 64, 40, 5, 65, 41], |
| | | [11, 36, 16, 5, 37, 17], |
| | | [11, 36, 12, 5, 37, 13], |
| | | |
| | | // 15 |
| | | [5, 109, 87, 1, 110, 88], |
| | | [5, 65, 41, 5, 66, 42], |
| | | [5, 54, 24, 7, 55, 25], |
| | | [11, 36, 12], |
| | | |
| | | // 16 |
| | | [5, 122, 98, 1, 123, 99], |
| | | [7, 73, 45, 3, 74, 46], |
| | | [15, 43, 19, 2, 44, 20], |
| | | [3, 45, 15, 13, 46, 16], |
| | | |
| | | // 17 |
| | | [1, 135, 107, 5, 136, 108], |
| | | [10, 74, 46, 1, 75, 47], |
| | | [1, 50, 22, 15, 51, 23], |
| | | [2, 42, 14, 17, 43, 15], |
| | | |
| | | // 18 |
| | | [5, 150, 120, 1, 151, 121], |
| | | [9, 69, 43, 4, 70, 44], |
| | | [17, 50, 22, 1, 51, 23], |
| | | [2, 42, 14, 19, 43, 15], |
| | | |
| | | // 19 |
| | | [3, 141, 113, 4, 142, 114], |
| | | [3, 70, 44, 11, 71, 45], |
| | | [17, 47, 21, 4, 48, 22], |
| | | [9, 39, 13, 16, 40, 14], |
| | | |
| | | // 20 |
| | | [3, 135, 107, 5, 136, 108], |
| | | [3, 67, 41, 13, 68, 42], |
| | | [15, 54, 24, 5, 55, 25], |
| | | [15, 43, 15, 10, 44, 16], |
| | | |
| | | // 21 |
| | | [4, 144, 116, 4, 145, 117], |
| | | [17, 68, 42], |
| | | [17, 50, 22, 6, 51, 23], |
| | | [19, 46, 16, 6, 47, 17], |
| | | |
| | | // 22 |
| | | [2, 139, 111, 7, 140, 112], |
| | | [17, 74, 46], |
| | | [7, 54, 24, 16, 55, 25], |
| | | [34, 37, 13], |
| | | |
| | | // 23 |
| | | [4, 151, 121, 5, 152, 122], |
| | | [4, 75, 47, 14, 76, 48], |
| | | [11, 54, 24, 14, 55, 25], |
| | | [16, 45, 15, 14, 46, 16], |
| | | |
| | | // 24 |
| | | [6, 147, 117, 4, 148, 118], |
| | | [6, 73, 45, 14, 74, 46], |
| | | [11, 54, 24, 16, 55, 25], |
| | | [30, 46, 16, 2, 47, 17], |
| | | |
| | | // 25 |
| | | [8, 132, 106, 4, 133, 107], |
| | | [8, 75, 47, 13, 76, 48], |
| | | [7, 54, 24, 22, 55, 25], |
| | | [22, 45, 15, 13, 46, 16], |
| | | |
| | | // 26 |
| | | [10, 142, 114, 2, 143, 115], |
| | | [19, 74, 46, 4, 75, 47], |
| | | [28, 50, 22, 6, 51, 23], |
| | | [33, 46, 16, 4, 47, 17], |
| | | |
| | | // 27 |
| | | [8, 152, 122, 4, 153, 123], |
| | | [22, 73, 45, 3, 74, 46], |
| | | [8, 53, 23, 26, 54, 24], |
| | | [12, 45, 15, 28, 46, 16], |
| | | |
| | | // 28 |
| | | [3, 147, 117, 10, 148, 118], |
| | | [3, 73, 45, 23, 74, 46], |
| | | [4, 54, 24, 31, 55, 25], |
| | | [11, 45, 15, 31, 46, 16], |
| | | |
| | | // 29 |
| | | [7, 146, 116, 7, 147, 117], |
| | | [21, 73, 45, 7, 74, 46], |
| | | [1, 53, 23, 37, 54, 24], |
| | | [19, 45, 15, 26, 46, 16], |
| | | |
| | | // 30 |
| | | [5, 145, 115, 10, 146, 116], |
| | | [19, 75, 47, 10, 76, 48], |
| | | [15, 54, 24, 25, 55, 25], |
| | | [23, 45, 15, 25, 46, 16], |
| | | |
| | | // 31 |
| | | [13, 145, 115, 3, 146, 116], |
| | | [2, 74, 46, 29, 75, 47], |
| | | [42, 54, 24, 1, 55, 25], |
| | | [23, 45, 15, 28, 46, 16], |
| | | |
| | | // 32 |
| | | [17, 145, 115], |
| | | [10, 74, 46, 23, 75, 47], |
| | | [10, 54, 24, 35, 55, 25], |
| | | [19, 45, 15, 35, 46, 16], |
| | | |
| | | // 33 |
| | | [17, 145, 115, 1, 146, 116], |
| | | [14, 74, 46, 21, 75, 47], |
| | | [29, 54, 24, 19, 55, 25], |
| | | [11, 45, 15, 46, 46, 16], |
| | | |
| | | // 34 |
| | | [13, 145, 115, 6, 146, 116], |
| | | [14, 74, 46, 23, 75, 47], |
| | | [44, 54, 24, 7, 55, 25], |
| | | [59, 46, 16, 1, 47, 17], |
| | | |
| | | // 35 |
| | | [12, 151, 121, 7, 152, 122], |
| | | [12, 75, 47, 26, 76, 48], |
| | | [39, 54, 24, 14, 55, 25], |
| | | [22, 45, 15, 41, 46, 16], |
| | | |
| | | // 36 |
| | | [6, 151, 121, 14, 152, 122], |
| | | [6, 75, 47, 34, 76, 48], |
| | | [46, 54, 24, 10, 55, 25], |
| | | [2, 45, 15, 64, 46, 16], |
| | | |
| | | // 37 |
| | | [17, 152, 122, 4, 153, 123], |
| | | [29, 74, 46, 14, 75, 47], |
| | | [49, 54, 24, 10, 55, 25], |
| | | [24, 45, 15, 46, 46, 16], |
| | | |
| | | // 38 |
| | | [4, 152, 122, 18, 153, 123], |
| | | [13, 74, 46, 32, 75, 47], |
| | | [48, 54, 24, 14, 55, 25], |
| | | [42, 45, 15, 32, 46, 16], |
| | | |
| | | // 39 |
| | | [20, 147, 117, 4, 148, 118], |
| | | [40, 75, 47, 7, 76, 48], |
| | | [43, 54, 24, 22, 55, 25], |
| | | [10, 45, 15, 67, 46, 16], |
| | | |
| | | // 40 |
| | | [19, 148, 118, 6, 149, 119], |
| | | [18, 75, 47, 31, 76, 48], |
| | | [34, 54, 24, 34, 55, 25], |
| | | [20, 45, 15, 61, 46, 16] |
| | | ]; |
| | | |
| | | QRRSBlock.getRSBlocks = function(typeNumber, errorCorrectLevel) { |
| | | |
| | | var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel); |
| | | |
| | | if (rsBlock == undefined) { |
| | | throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel); |
| | | } |
| | | |
| | | var length = rsBlock.length / 3; |
| | | |
| | | var list = new Array(); |
| | | |
| | | for (var i = 0; i < length; i++) { |
| | | |
| | | var count = rsBlock[i * 3 + 0]; |
| | | var totalCount = rsBlock[i * 3 + 1]; |
| | | var dataCount = rsBlock[i * 3 + 2]; |
| | | |
| | | for (var j = 0; j < count; j++) { |
| | | list.push(new QRRSBlock(totalCount, dataCount) ); |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | QRRSBlock.getRsBlockTable = function(typeNumber, errorCorrectLevel) { |
| | | |
| | | switch(errorCorrectLevel) { |
| | | case QRErrorCorrectLevel.L : |
| | | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]; |
| | | case QRErrorCorrectLevel.M : |
| | | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]; |
| | | case QRErrorCorrectLevel.Q : |
| | | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]; |
| | | case QRErrorCorrectLevel.H : |
| | | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]; |
| | | default : |
| | | return undefined; |
| | | } |
| | | } |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRBitBuffer |
| | | //--------------------------------------------------------------------- |
| | | |
| | | function QRBitBuffer() { |
| | | this.buffer = new Array(); |
| | | this.length = 0; |
| | | } |
| | | |
| | | QRBitBuffer.prototype = { |
| | | |
| | | get : function(index) { |
| | | var bufIndex = Math.floor(index / 8); |
| | | return ( (this.buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1; |
| | | }, |
| | | |
| | | put : function(num, length) { |
| | | for (var i = 0; i < length; i++) { |
| | | this.putBit( ( (num >>> (length - i - 1) ) & 1) == 1); |
| | | } |
| | | }, |
| | | |
| | | getLengthInBits : function() { |
| | | return this.length; |
| | | }, |
| | | |
| | | putBit : function(bit) { |
| | | |
| | | var bufIndex = Math.floor(this.length / 8); |
| | | if (this.buffer.length <= bufIndex) { |
| | | this.buffer.push(0); |
| | | } |
| | | |
| | | if (bit) { |
| | | this.buffer[bufIndex] |= (0x80 >>> (this.length % 8) ); |
| | | } |
| | | |
| | | this.length++; |
| | | } |
| | | }; |
| | |
| | | |
| | | $(function() { |
| | | Feng.initValidator("tAgentInfoForm", TAgentInfoDlg.validateFields); |
| | | var carPhoto = new $WebUpload("fileNo"); |
| | | carPhoto.setUploadBarId("progressBar"); |
| | | carPhoto.init(); |
| | | }); |