New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <groupId>org.dromara</groupId> |
| | | <artifactId>ecosphere</artifactId> |
| | | <version>${revision}</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <artifactId>ecosphere-common</artifactId> |
| | | |
| | | <description> |
| | | ecosphere-common ä¾èµé¡¹ |
| | | </description> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger2</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>commons-beanutils</groupId> |
| | | <artifactId>commons-beanutils</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>cglib</groupId> |
| | | <artifactId>cglib</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.belerweb</groupId> |
| | | <artifactId>pinyin4j</artifactId> |
| | | </dependency> |
| | | |
| | | <!--MD5æç--> |
| | | <dependency> |
| | | <groupId>commons-codec</groupId> |
| | | <artifactId>commons-codec</artifactId> |
| | | <version>1.2</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.commons</groupId> |
| | | <artifactId>commons-lang3</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <!--æå
æ¨é--> |
| | | <dependency> |
| | | <groupId>cn.jpush.api</groupId> |
| | | <artifactId>jpush-client</artifactId> |
| | | <version>3.3.10</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.owasp.antisamy</groupId> |
| | | <artifactId>antisamy</artifactId> |
| | | <version>1.5.8</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.owasp.encoder</groupId> |
| | | <artifactId>encoder</artifactId> |
| | | <version>1.2.2</version> |
| | | </dependency> |
| | | |
| | | |
| | | <!--å°ç¨åº session_keyå è§£å¯ç¨å°çjar--> |
| | | <!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15 --> |
| | | <dependency> |
| | | <groupId>org.bouncycastle</groupId> |
| | | <artifactId>bcprov-jdk15</artifactId> |
| | | <version>1.45</version> |
| | | </dependency> |
| | | |
| | | <!--微信å°ç¨åºæ¨¡çæ¨é--> |
| | | <dependency> |
| | | <groupId>com.github.binarywang</groupId> |
| | | <artifactId>weixin-java-miniapp</artifactId> |
| | | <version>3.4.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>commons-httpclient</groupId> |
| | | <artifactId>commons-httpclient</artifactId> |
| | | <version>3.1</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.commons</groupId> |
| | | <artifactId>commons-text</artifactId> |
| | | <version>1.1</version> |
| | | </dependency> |
| | | |
| | | <!--åå·çä¿¡--> |
| | | <dependency> |
| | | <groupId>com.wisentsoft</groupId> |
| | | <artifactId>gsmpclient</artifactId> |
| | | <version>1.3.5</version> |
| | | <scope>system</scope> |
| | | <systemPath>${basedir}/../libs/gsmpclient-1.0.4.jar</systemPath> |
| | | </dependency> |
| | | |
| | | <!--éèï¼äºåéï¼--> |
| | | <dependency> |
| | | <groupId>com.allinpay</groupId> |
| | | <artifactId>yunst-sdk</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <scope>system</scope> |
| | | <systemPath>${basedir}/../libs/yunst-sdk-0.0.1-SNAPSHOT.jar</systemPath> |
| | | </dependency> |
| | | |
| | | <!--è¿æ»¤dto--> |
| | | <dependency> |
| | | <groupId>org.mapstruct</groupId> |
| | | <artifactId>mapstruct-jdk8</artifactId> |
| | | <version>1.2.0.Final</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.mapstruct</groupId> |
| | | <artifactId>mapstruct-processor</artifactId> |
| | | <version>1.2.0.Final</version> |
| | | </dependency> |
| | | |
| | | |
| | | <!--ä¸ªæ¨æ¨é--> |
| | | <dependency> |
| | | <groupId>com.gexin.platform</groupId> |
| | | <artifactId>gexin-rp-sdk-http</artifactId> |
| | | <version>4.1.0.5</version> |
| | | <scope>system</scope> |
| | | <systemPath>${basedir}/../libs/gexin-rp-sdk-http-4.1.0.5.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.gexin.platform</groupId> |
| | | <artifactId>gexin-rp-sdk-template</artifactId> |
| | | <version>4.0.0.24</version> |
| | | <scope>system</scope> |
| | | <systemPath>${basedir}/../libs/gexin-rp-sdk-template-4.0.0.24.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.gexin.platform</groupId> |
| | | <artifactId>gexin-rp-sdk-base</artifactId> |
| | | <version>4.0.0.30</version> |
| | | <scope>system</scope> |
| | | <systemPath>${basedir}/../libs/gexin-rp-sdk-base-4.0.0.30.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.gexin.platform</groupId> |
| | | <artifactId>gexin-rp-fastjson</artifactId> |
| | | <version>1.0.0.3</version> |
| | | <scope>system</scope> |
| | | <systemPath>${basedir}/../libs/gexin-rp-fastjson-1.0.0.3.jar</systemPath> |
| | | </dependency> |
| | | |
| | | <!--ç¾åº¦ocr--> |
| | | <dependency> |
| | | <groupId>com.baidu.aip</groupId> |
| | | <artifactId>java-sdk</artifactId> |
| | | <version>4.11.0</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-api</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-simple</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>cpcn.institution</groupId> |
| | | <artifactId>API</artifactId> |
| | | <version>2.5.0.0-SNAPSHOT</version> |
| | | <scope>system</scope> |
| | | <systemPath>${basedir}/../libs/cpcn-payment-api-2.6.0.9.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cpcn.institution</groupId> |
| | | <artifactId>InstitutionTools</artifactId> |
| | | <version>v1.0.1.4-RELEASE</version> |
| | | <scope>system</scope> |
| | | <systemPath>${basedir}/../libs/InstitutionTools-v1.0.1.4-RELEASE.jar</systemPath> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>com.csii</groupId> |
| | | <artifactId>sg</artifactId> |
| | | <scope>system</scope> |
| | | <version>1.0.3</version> |
| | | <systemPath>${basedir}/../libs/jinYanEPay-1.0.3.jar</systemPath> |
| | | </dependency> |
| | | |
| | | <!--æä¾ EOS S3 ç¸å
³åè½ï¼å¿
é¡»--> |
| | | <dependency> |
| | | <groupId>com.chinamobile.cmss.eos</groupId> |
| | | <artifactId>eos-java-s3-sdk</artifactId> |
| | | <version>1.11.820</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/../libs/eos-java-s3-sdk-1.11.820.jar</systemPath> |
| | | </dependency> |
| | | <!--æä¾ EOS 临æ¶è®¤è¯åè½ï¼å¯é--> |
| | | <dependency> |
| | | <groupId>com.chinamobile.cmss.eos</groupId> |
| | | <artifactId>eos-java-s3-sdk-sts</artifactId> |
| | | <version>1.11.820</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/../libs/eos-java-s3-sdk-sts-1.11.820.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>joda-time</groupId> |
| | | <artifactId>joda-time</artifactId> |
| | | <version>2.8.1</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.google.guava</groupId> |
| | | <artifactId>guava</artifactId> |
| | | <version>30.1-jre</version> |
| | | </dependency> |
| | | </dependencies> |
| | | </project> |
New file |
| | |
| | | package com.nuvole.common.domain.dataFile; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * [{"uid":1562829586751,"path":"","name":"","url":""}] |
| | | */ |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | public class DataFile { |
| | | |
| | | private Long uid; |
| | | |
| | | private String path; |
| | | |
| | | private String name; |
| | | |
| | | private String url; |
| | | |
| | | public Long getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(Long uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public String getPath() { |
| | | return path; |
| | | } |
| | | |
| | | public void setPath(String path) { |
| | | this.path = path; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.common.domain.dto; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description: |
| | | * @Company: TOO (psï¼å
¬å¸åç§°) |
| | | * @author: å |
| | | * @date: 2019/10/31 ä¸å6:59 |
| | | * @version: V1.0.0 |
| | | */ |
| | | |
| | | |
| | | @Data |
| | | public class AppDTO<T> { |
| | | |
| | | private Long attr; |
| | | |
| | | private Long attr2; |
| | | |
| | | private Long attr3; |
| | | |
| | | private Long attr4; |
| | | |
| | | private String pro; |
| | | |
| | | private String pro2; |
| | | |
| | | private String pro3; |
| | | |
| | | private String pro4; |
| | | |
| | | private Short small; |
| | | |
| | | private Short small2; |
| | | |
| | | private Integer integer; |
| | | |
| | | private Integer integer2; |
| | | |
| | | private Object object; |
| | | |
| | | private Map map; |
| | | |
| | | private Map map2; |
| | | |
| | | private Date date; |
| | | |
| | | private List<T> list; |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.nuvole.common.domain.emnu; |
| | | |
| | | public enum CommonResultEmnu { |
| | | |
| | | OK(10000,"OK"),//è¯·æ±æå |
| | | ERROR(50000,"ERROR"),//æä½å¤±è´¥ |
| | | INVALID_PARAMS(20000,"INVALID_PARAMS"),//鿳忰 |
| | | AUTHENTICATION_ERR(20001,"AUTHENTICATION_ERR"),//èº«ä»½æ ¡éªé误 |
| | | TOKEN_ERR(20002,"TOKEN_ERR"),//token error |
| | | NO_PERMISSION_ERR(20006,"NO_PERMISSION_ERR"),//æ è®¿é®æé |
| | | CRYPTO_ERR(20003,"CRYPTO_ERR"),//å å¯/è§£å¯é误 |
| | | DATA_EMPTY(20004,"EMPTY_ERR"),//ç©ºæ°æ® |
| | | SIGN_ERR(20005,"SIGN_ERR"),//ç¾åé误 |
| | | RENCAI_ERR(20006,"RENCAI_ERR"),//人æä¿¡æ¯é误 æ æ |
| | | SERVER_ERR(10001,"SERVER_ERR"),//æå¡å¼å¸¸ |
| | | REQUEST_LIMIT_ERR(20007,"REQUEST_LIMIT_ERR");//请æ±å¤ªé¢ç¹ |
| | | |
| | | private Integer code; |
| | | private String info; |
| | | |
| | | private CommonResultEmnu(Integer code, String info) { |
| | | this.code = code; |
| | | this.info = info; |
| | | } |
| | | |
| | | public static String getInfo(Integer code) { |
| | | for (CommonResultEmnu item : CommonResultEmnu.values()) { |
| | | if (item.getCode().equals(code)) { |
| | | return item.getInfo(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | public Integer getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(Integer code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getInfo() { |
| | | return info; |
| | | } |
| | | |
| | | public void setInfo(String info) { |
| | | this.info = info; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.common.domain.emnu; |
| | | |
| | | public enum SMSResultEmnu { |
| | | |
| | | OK("0", "OK"), //è¯·æ±æå |
| | | ERROR("-10000", "ERROR");//æä½å¤±è´¥ |
| | | |
| | | private String code; |
| | | private String msg; |
| | | |
| | | private SMSResultEmnu(String code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.common.domain.qdl; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * @ClassName QdlLedgerAccount |
| | | * @Author cy |
| | | * @Date 2023/9/1 |
| | | * @Description 翼æ¯ä»åè´¦å表 |
| | | * @Version 1.0 |
| | | **/ |
| | | @Data |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class QdlLedgerAccount { |
| | | |
| | | /** |
| | | * åæ·å· |
| | | */ |
| | | private String merchantNo; |
| | | /** |
| | | * åä½ï¼å |
| | | */ |
| | | private Long amount; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String memo; |
| | | } |
New file |
| | |
| | | package com.nuvole.common.domain.query; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å®ä½å°è£
|
| | | * |
| | | * @author liujun |
| | | * @Date 2019/6/17 10:35 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "å页æ¥è¯¢å°è£
") |
| | | public class PageQuery { |
| | | |
| | | @ApiModelProperty("页ç ") |
| | | private Integer pageNumber = 1; |
| | | |
| | | @ApiModelProperty("æ¡æ°") |
| | | private Integer pageSize = 10; |
| | | |
| | | @ApiModelProperty("æåºåç§°") |
| | | private String sortName; |
| | | |
| | | @ApiModelProperty("æåºæ¹å¼") |
| | | private String sortOrder; |
| | | } |
New file |
| | |
| | | package com.nuvole.common.domain.result; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.nuvole.common.domain.emnu.CommonResultEmnu; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class CommonResult<T> { |
| | | |
| | | public static final String STATUS_OK = "1";//æå |
| | | public static final String STATUS_ERR = "0";//失败 |
| | | |
| | | public static final Integer CODE_OK = 10000;//è¯·æ±æåè¿åç |
| | | |
| | | @ApiModelProperty("ç¶æå¼ 0:失败 1:æå ") |
| | | private String status = STATUS_OK; |
| | | |
| | | @ApiModelProperty("æ¥å£è¿åä¿¡æ¯") |
| | | private String info = CommonResultEmnu.OK.getInfo(); |
| | | |
| | | @ApiModelProperty("æ¥å£è¿åä¿¡æ¯ code ") |
| | | private Integer code = CommonResultEmnu.OK.getCode(); |
| | | |
| | | @ApiModelProperty("æ¥å£è¿åä¿¡æ¯æè¿° ") |
| | | private String description = ""; |
| | | |
| | | @ApiModelProperty("æ¥å£è¿åå¼ ") |
| | | private T data; |
| | | |
| | | public CommonResult() { |
| | | |
| | | } |
| | | |
| | | public CommonResult(T data) { |
| | | this.data = ObjectUtil.cloneIfPossible(data); |
| | | } |
| | | |
| | | public CommonResult(CommonResultEmnu resultEmnu) { |
| | | if (!resultEmnu.getCode().equals(CODE_OK)) { |
| | | this.status = STATUS_ERR; |
| | | } |
| | | this.code = resultEmnu.getCode(); |
| | | this.info = resultEmnu.getInfo(); |
| | | } |
| | | |
| | | public CommonResult(CommonResultEmnu resultEmnu, String description) { |
| | | if (!resultEmnu.getCode().equals(CODE_OK)) { |
| | | this.status = STATUS_ERR; |
| | | } |
| | | this.code = resultEmnu.getCode(); |
| | | this.info = resultEmnu.getInfo(); |
| | | this.description = description; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.common.domain.result; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * å¿«é鏿¥è¯¢ç©æµè¿ååæ° |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/6/17 18:46 |
| | | */ |
| | | @Data |
| | | public class ExpressResult { |
| | | |
| | | @ApiModelProperty("ç¨æ·ID ") |
| | | private String EBusinessID; |
| | | @ApiModelProperty("订åç¼å· ") |
| | | private String OrderCode; |
| | | @ApiModelProperty("å¿«éå
¬å¸ç¼ç ") |
| | | private String ShipperCode; |
| | | @ApiModelProperty("ç©æµè¿åå· ") |
| | | private String LogisticCode; |
| | | @ApiModelProperty("æåä¸å¦ãtrueï¼æå falseï¼å¤±è´¥ã ") |
| | | private String Success; |
| | | @ApiModelProperty("失败åå ") |
| | | private String Reason; |
| | | @ApiModelProperty("ç©æµç¶æï¼1-å·²æ½æ¶ 2-å¨éä¸,3-ç¾æ¶,4-é®é¢ä»¶ ") |
| | | private String State; |
| | | @ApiModelProperty("ç©æµä¿¡æ¯ãAcceptStationï¼æè¿°ï¼AcceptTimeï¼æ¶é´ã ") |
| | | private List<Map> Traces; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.common.domain.result; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.util.NumberUtil; |
| | | import com.nuvole.util.BeanUtil; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | // @formatter:off |
| | | /** |
| | | * .-~~~~~~~~~-._ _.-~~~~~~~~~-. |
| | | * __.' @Author ~. .~ ä»£ç æ Bug `.__ |
| | | * .'// liu.q \./ (ç§ç±) \\`. |
| | | * .'// [916000612@qq.com] | 欲ç»ç¥å å¼åèªå®« \\`. |
| | | * .'// .-~"""""""~~~~-._ | _,-~~~~"""""""~-. \\`. |
| | | * .'//.-" 2019-04-09 `-. | .-' 11:35 "-.\\`. |
| | | * .'//______.============-.. \ | / ..-============.______\\`. |
| | | *.'______________________________\|/______________________________`. |
| | | * |
| | | * @Description : |
| | | */ |
| | | // @formatter:on |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @ApiModel("å表 è¿åç»æå表å°è£
") |
| | | public class PageBean<T> implements Serializable { |
| | | private static final long serialVersionUID = 1000L; |
| | | |
| | | @ApiModelProperty("æ»è®°å½æ°") |
| | | private Integer total; //æ»è®°å½æ° |
| | | @ApiModelProperty("ç»æé") |
| | | private List<T> rows; //ç»æé |
| | | @ApiModelProperty("第å 页") |
| | | private int pageNumber; //第å 页 |
| | | @ApiModelProperty("æ¯é¡µè®°å½æ°") |
| | | private int pageSize; //æ¯é¡µè®°å½æ° |
| | | @ApiModelProperty("æ»é¡µæ°") |
| | | private int pages; // æ»é¡µæ° |
| | | @ApiModelProperty("å½åé¡µçæ°é<=pageSize") |
| | | private int size; //å½åé¡µçæ°é<=pageSize |
| | | |
| | | public PageBean(Object obj) { |
| | | Map map = BeanUtil.obj2Map(obj); |
| | | if(map!=null){ |
| | | this.pageNumber = Convert.toInt(map.get("pageNum")); |
| | | this.pageSize = Convert.toInt(map.get("pageSize")); |
| | | this.total = Convert.toInt(map.get("total")); |
| | | this.pages = Convert.toInt(map.get("pages")); |
| | | this.rows = obj == null ? new ArrayList<>() : (List<T>)obj; |
| | | this.size = this.rows.size(); |
| | | } |
| | | } |
| | | |
| | | public void setData(List list){ |
| | | if(list != null && list.size() >0){ |
| | | this.total = list.size(); |
| | | //å页 |
| | | if (this.total > 0) { |
| | | int start = Convert.toInt(NumberUtil.mul(pageNumber-1, pageSize)); |
| | | int end = Convert.toInt(NumberUtil.mul(pageNumber,pageSize)); |
| | | if (start <= total) { |
| | | if (end > total) { |
| | | end = total; |
| | | } |
| | | this.rows = list.subList(start, end); |
| | | } else { |
| | | this.rows = new ArrayList<>(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.common.domain.result; |
| | | |
| | | import com.nuvole.common.domain.emnu.SMSResultEmnu; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * çä¿¡è¿åç»æ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/8/5 11:48 |
| | | */ |
| | | @Data |
| | | public class SMSResult { |
| | | |
| | | @ApiModelProperty("ç¶æç ") |
| | | private String code; |
| | | |
| | | @ApiModelProperty("æè¿°") |
| | | private String msg; |
| | | |
| | | public SMSResult(SMSResultEmnu resultEmnu, String msg) { |
| | | this.code = resultEmnu.getCode(); |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public SMSResult(SMSResultEmnu resultEmnu) { |
| | | this.code = resultEmnu.getCode(); |
| | | this.msg = resultEmnu.getMsg(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.common.domain.token; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName UserToken |
| | | * @date 2019/5/6 18:45 |
| | | * @Description ç»å½ç¨æ·token |
| | | */ |
| | | @Data |
| | | @ToString |
| | | @ApiModel(value = "ç»å½ç¨æ·token") |
| | | public class UserToken { |
| | | |
| | | @ApiModelProperty("ç»å½æ è¯ï¼è°ç¨ä¸å¡æ¥å£æ¶éæ¾ç½®å°headerä¸") |
| | | String accessToken; |
| | | |
| | | @ApiModelProperty("è¿ææ¶é´ ç§") |
| | | Long expiresIn; |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.common.domain.user; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | |
| | | @Data |
| | | @ToString |
| | | @ApiModel(value = "åå°ç¨æ·ä¿¡æ¯") |
| | | public class SysUser { |
| | | |
| | | @ApiModelProperty("id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("ç¨æ·å") |
| | | private String userName; |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.common.domain.wx; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "微信å°ç¨åº-订é
æ¶æ¯") |
| | | public class PushMsg { |
| | | |
| | | @ApiModelProperty("æ¥åçç¨æ·openId") |
| | | private String touser; |
| | | |
| | | @ApiModelProperty("订é
çæ¨¡æ¿id") |
| | | private String template_id; |
| | | |
| | | @ApiModelProperty("模æ¿è·³è½¬ç详æ
页é¢ï¼å¯å¸¦åæ°ï¼ä¸ä¼ ä¸è·³è½¬") |
| | | private String page; |
| | | private String url; |
| | | |
| | | @ApiModelProperty("模æ¿å
容") |
| | | private JSONObject data; |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.constants; |
| | | |
| | | /** |
| | | * ç³»ç»é
置常é |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/7/30 19:22 |
| | | */ |
| | | public class PropertiesConstants { |
| | | |
| | | //æå¡å°åé
ç½® |
| | | /** |
| | | * åå°æ¥å£æå¡å°å |
| | | */ |
| | | public static final String STQ_SERVER = "https://yqzx.jinmingyuan.com"; |
| | | // public static final String STQ_SERVER = "https://daguogongjiang.top"; |
| | | /** |
| | | * h5æå¡å°å |
| | | */ |
| | | public static final String STQ_SERVER_WECHAT = "https://yqzx.jinmingyuan.com"; |
| | | // public static final String STQ_SERVER_WECHAT = "https://daguogongjiang.top"; |
| | | /** |
| | | * åæ·æ¨¡åæå¡å°å |
| | | */ |
| | | public static final String STQ_SERVER_MERCHANT = STQ_SERVER + "/service-merchant"; |
| | | /** |
| | | * å忍¡åæå¡å°å |
| | | */ |
| | | public static final String STQ_SERVER_SHOP = STQ_SERVER + "/service-shop"; |
| | | |
| | | /** |
| | | * 1 使ç¨sftp |
| | | * 2 使ç¨ç§»å¨äºoss |
| | | */ |
| | | public static final int UPLOAD_MODEL = 1; |
| | | public static final int KJ_PAY_WAY = 1; //å¿«æ·æ¯ä»æ¸ éã1:éèäºåé 2:åè¡å¿«æ·æ¯ä»ã |
| | | /** |
| | | * éæèµæºæå¡å°åï¼ftpï¼ |
| | | */ |
| | | public static String FILE_SERVER = null; |
| | | |
| | | |
| | | // public static final String FILE_SERVER = "https://daguogongjiang.top/sftp"; //å
¬å¸å°å |
| | | // public static final String FILE_SERVER = "http://172.16.2.77/f-static"; //æ£å¼ç¯å¢ |
| | | |
| | | //å
¬ä¼å¹³å°é
ç½® |
| | | /** |
| | | * å°ç¨åºappId |
| | | */ |
| | | // public static final String WX_APP_APPID = "wx044ba657d536fa6a"; |
| | | // æ¯å
´æ¶è´¹-å°ç¨åº |
| | | // public static final String WX_APP_APPID = "wx22159c42a5805166"; |
| | | //æ°ååçæå |
| | | public static final String WX_APP_APPID = "wxfc579973fbdde096"; |
| | | //京æºäº AppSecret |
| | | // public static final String WX_APP_APPID = "wxf6818b61cdbb80e4"; |
| | | |
| | | /** |
| | | * å°ç¨åºsecret æ¯å
´æ¶è´¹ |
| | | */ |
| | | // public static final String WX_APP_SECRET = "2635f74b77b0cd1057cb8266e5c2606d"; |
| | | // å°ç¨åºsecret æ°ååçæå |
| | | public static final String WX_APP_SECRET = "d5d7d0438028b8c29890784344df8216"; |
| | | //å°ç¨åºsecret 京æºäº |
| | | // public static final String WX_APP_SECRET = "d54f086bce09d291605dc57441fa4908"; |
| | | |
| | | |
| | | /** |
| | | * 微信æå¡å·appId |
| | | */ |
| | | // public static final String WX_WECHAT_APPID = "wx4e2cf88d5ffa708e"; |
| | | // å
¬å¸H5å
¬ä¼å· |
| | | public static final String WX_WECHAT_APPID = "wxad8cc511da676bd4"; |
| | | //H5å
¬ä¼å· 京æºäº |
| | | // public static final String WX_WECHAT_APPID = "wxd163440fc91fd9af"; |
| | | //æ¶å·¥ å°ç¨åº |
| | | // public static final String WX_WECHAT_APPID = "wx22159c42a5805166"; |
| | | |
| | | /** |
| | | * 微信æå¡å·secret |
| | | */ |
| | | // public static final String WX_WECHAT_SECRET = "dc3594f91ab86def1277133c45bd2584"; |
| | | // å
¬å¸H5å
¬ä¼å· |
| | | public static final String WX_WECHAT_SECRET = "d4f742cf77b1534055932a1d970cb8ce"; |
| | | //H5å
¬ä¼å· 京æºäº |
| | | // public static final String WX_WECHAT_SECRET = "d54f086bce09d291605dc57441fa4908"; |
| | | |
| | | /** |
| | | * 微信æå¡ååæ·å· |
| | | */ |
| | | |
| | | public static final String WX_SERVER_MCHID = "1633049026"; |
| | | // 京æºäº åæ·å· |
| | | // public static final String WX_SERVER_MCHID = "1648271607"; |
| | | /** |
| | | * 微信å°ç¨åºæ¯ä»å¹³å°çååæ·id |
| | | */ |
| | | public static final String WX_MINIPAY_PLATFORM_SUB_APPID = "1633682244"; |
| | | // 京æºäº |
| | | // public static final String WX_MINIPAY_PLATFORM_SUB_APPID = null; |
| | | |
| | | /** |
| | | * 微信æå¡å secret |
| | | */ |
| | | public static final String WX_SERVER_SECRET = "SKC2E1QGBRVFL7T35MYUN49IA06PZXOH"; |
| | | // // 京æºäº secret |
| | | // public static final String WX_SERVER_SECRET = "6Lk7s4QWqXr9Dv1OzIJlEM2aA5YbupKS"; |
| | | |
| | | |
| | | //æ¯ä»é
ç½® |
| | | public static final int PAY_WAY = 3; //å忝仿¸ éã1:éèæ¶é¶å® 2:éèäºåé æ°å¢3 纯微信æ¯ä» 4 ä¸éæ¯ä»ã |
| | | |
| | | static { |
| | | if (UPLOAD_MODEL == 1) { |
| | | FILE_SERVER = "https://yqzx.jinmingyuan.com/file"; //å
¬å¸å°å |
| | | } else if (PropertiesConstants.UPLOAD_MODEL == 2) { |
| | | FILE_SERVER = "https://ecosphere.eos.zhengzhou-4.cmecloud.cn"; |
| | | } |
| | | } |
| | | public static final int PAY_TYPE = 2; //æ¯ä»è¯»ååæ°ã1.é
ç½®æä»¶è¯»åï¼åºå®ä¸ä¸ªï¼ 2.表éå è½½ï¼ææºææ¥è¯¢ï¼ã |
| | | public static final String TL_PAY_APPID = "00143623"; //appid |
| | | public static final String TL_PAY_K = "123456"; //ç§é¥ |
| | | public static final String TL_PAY_ORGCODE = "55165106012TWGR"; //æºæå·ï¼å¹³å°å¯ä¸æ è¯ï¼ |
| | | |
| | | //å®¢ç®¡ç³»ç» |
| | | /** |
| | | * ä¼åä¿¡æ¯è¯»åç±»åã1.å®¢ç®¡ç³»ç» 2.æ¬ç³»ç»ï¼å¯¼å
¥æ¹å¼ï¼ã |
| | | */ |
| | | public static final int MEMBER_READ_TYPE = 2; |
| | | |
| | | /** |
| | | * h5æå¡å°å |
| | | */ |
| | | public static final String WX_SERVER_WECHAT = "https://api.mch.weixin.qq.com/pay/unifiedorder"; |
| | | /** |
| | | * 微信 仿¬¾ç æ¯ä» |
| | | */ |
| | | public static final String WX_SERVER_MICROPAY = "https://api.mch.weixin.qq.com/pay/micropay"; |
| | | |
| | | /** |
| | | * 微信 è®¢åæ¥è¯¢ |
| | | */ |
| | | public static final String WX_SERVER_ORDERQUERY = "https://api.mch.weixin.qq.com/pay/orderquery"; |
| | | |
| | | /** |
| | | * 仿¬¾ç æ¥è¯¢openid |
| | | */ |
| | | public static final String WX_SERVER_AUTHCODE2OPENID = "https://api.mch.weixin.qq.com/tools/authcodetoopenid"; |
| | | |
| | | /** |
| | | * éèæ¶é¶å®éécode |
| | | */ |
| | | public static final String CHANNEL_CODE_SYB = "allinPay"; |
| | | /** |
| | | * æ¯ä»å®å¾®ä¿¡ç´è¿éécode |
| | | */ |
| | | public static final String CHANNEL_CODE_DIRECTPAY = "directPay"; |
| | | |
| | | /** |
| | | * è¿å
¥åºéºçº¿ä¸æ«ç 仿±æ»è®¡ç®Key |
| | | */ |
| | | public static String JOB_SHOP_STATIS_SCANORDER_KEY = "JOB_SHOP_STATIS_SCANORDER_KEY"; |
| | | } |
New file |
| | |
| | | package com.nuvole.constants; |
| | | |
| | | /** |
| | | * @Description: æ¨é模æ¿ID常é |
| | | * @Author: liujun |
| | | * @Date: 2019-07-23 14:57 |
| | | **/ |
| | | public class PushTemplateConstants { |
| | | |
| | | /** |
| | | * å¼å¢æ¨éæ¨¡æ¿ |
| | | */ |
| | | // public static final String GROUP_START = "CI5XGGJdQb6IKok0tSrd8HpJHlqyChPc3U58yzAz4Y8"; |
| | | |
| | | /** |
| | | * å墿¨éæ¨¡æ¿ |
| | | */ |
| | | // public static final String GROUP_JOIN = "mnGXLJBcwk3vRlaBMowRe51zDpGLtGRDaBh4PIysCOs"; |
| | | |
| | | /** |
| | | * å¢è´æåæ¨é订é
æ¨¡æ¿æ¶æ¯id |
| | | */ |
| | | public static final String GROUP_SUCCESS = "a_ojaiKU0OFR3ihu5taT-F5PuZ3vCI4fxXsybLLdy1Q"; |
| | | |
| | | /** |
| | | * å¢è´å¤±è´¥æ¨é订é
æ¨¡æ¿æ¶æ¯id |
| | | */ |
| | | public static final String GROUP_FAIL = "Fe9IW6n-j7d1F7L-S3CTNfIS8mrxFDLVbYHivnPnvC8"; |
| | | |
| | | /** |
| | | * å¢è´é¾ææªæ¯ä»æ¨é订é
æ¨¡æ¿æ¶æ¯id |
| | | */ |
| | | public static final String GROUP_NO_PAY = "MAryTGFLOO9X6Pr15Z3iJ0j71boGBKcCMwFEHNHeAes"; |
| | | |
| | | /** |
| | | * è®¢åæ¯ä»æå |
| | | */ |
| | | public static final String PAY_SUCCESS= "fWkckzC4AtkJfJVQhX6r2PTz0YKNdXUV9yDXQ6r-svI"; |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.constants; |
| | | |
| | | /** |
| | | * @ClassName QdlConstant |
| | | * @Author cy |
| | | * @Date 2023/8/28 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | public class QdlConstant { |
| | | |
| | | /** |
| | | * ç产ç¯å¢å°å |
| | | */ |
| | | private static final String PROD_URL = "https://openapi.qdlpay.com"; |
| | | |
| | | /** |
| | | * 线ä¸èåä¸åæ¥å£ |
| | | * 微信å°ç¨åºã微信å
¬ä¼å·æ¯ä»ãAPP æèµ·æ¯ä»å®ãAPP æèµ·ç¿¼æ¯ä» |
| | | */ |
| | | public static String ONLINEPAYURL = PROD_URL + "/gapi/aggregate/aggregatepay/online/payOrder"; |
| | | |
| | | /** |
| | | * èåæ¶æ¬¾ç ï¼C æ« Bï¼ä¸å |
| | | * å¤é¨åæ·éè¿è¯¥æ¥å£è¿è¡è忝ä»ä¸åï¼å¹¶æèµ·ç¸åºç¬¬ä¸æ¹ APP è¿è¡æ¯ä» |
| | | */ |
| | | public static String OFFLINEC2BPAYURL = PROD_URL + "/gapi/aggregate/aggregatepay/offline/c2b/payOrder"; |
| | | |
| | | /** |
| | | * åè®®å· |
| | | * æµè¯ç¯å¢ 20200814030100033652190094557249 |
| | | * ç产ç¯å¢ 20200825030100037665282868641830 |
| | | */ |
| | | public static final String AGREE_ID = "20200825030100037665282868641830"; |
| | | |
| | | /** |
| | | * æ¡ç æ¥è¯¢ç¨æ·æ è¯ |
| | | * ç¨äºä»æ¬¾ç æ¯ä»åæ ¹æ®æ¡ç æ¥è¯¢ç¨æ·æ è¯ |
| | | */ |
| | | public static String CODE2IDENURL = PROD_URL + "/gapi/o2o/aggregatePay/services/barCodeIdentification"; |
| | | /** |
| | | * 订åè¶
æ¶æ¶é´ |
| | | */ |
| | | public static final String TIME_OUT = "86400"; |
| | | /** |
| | | * ç¾åç±»å |
| | | */ |
| | | public static final String SIGN_TYPE = "S002"; |
| | | /** |
| | | * èå仿¬¾ç ï¼B æ« Cï¼ä¸å |
| | | * åæ·ç«¯æ«ç¨æ·æ¯ä»æ¡ç å¹¶åèµ·æ£æ¬¾ |
| | | */ |
| | | public static String OFFLINEB2CPAYURL = PROD_URL + "/gapi/aggregate/aggregatepay/offline/b2c/pay"; |
| | | /** |
| | | * ä¸åç»ææ¥è¯¢ |
| | | * ç¨äºä¸åç»æçç¶æç¡®è®¤ä¸è®¢åä¿¡æ¯æ¥è¯¢ |
| | | */ |
| | | public static String TRADE_QUERY_URL = PROD_URL + "/gapi/aggregate/aggregatepay/tradeQuery"; |
| | | /** |
| | | * 鿬¾ |
| | | * å¤é¨åæ·å¹³å°åèµ·ç订å鿬¾ |
| | | */ |
| | | public static String OFFLINE_REFUND_URL = PROD_URL + "/gapi/o2o/aggregatePay/services/offlineRefund"; |
| | | } |
New file |
| | |
| | | package com.nuvole.constants; |
| | | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * å¤ç½æå¡è°ç¨ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/7/25 14:44 |
| | | */ |
| | | @Component |
| | | public class ServiceConstants { |
| | | |
| | | /** |
| | | * 坹夿¯å¦èµ°å¤ç½æå¡è°ç¨ãtrue æ¯ false å¦ã |
| | | */ |
| | | public static Boolean SERVICE_TYPE; |
| | | |
| | | |
| | | @Value("${service-type}") |
| | | public void setType(Boolean type) { |
| | | SERVICE_TYPE = type; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è°ç¨ç»ä¸url |
| | | */ |
| | | public static final String SERVICE_URL = "http://localhost:9080"; |
| | | |
| | | /** |
| | | * åæ·è®¢åæ¥è¯¢æ¥å£ |
| | | */ |
| | | public static final String MERCHANT_PAY_RESULT = SERVICE_URL + "/v1/web/pay/queryorder"; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç©æµå°å |
| | | */ |
| | | public static final String SERVICE_EXPRESS_URL = SERVICE_URL + "/v1/shop/web/express/queryExpress"; |
| | | |
| | | /** |
| | | * éå°åè§£æï¼è
¾è®¯å°å¾ï¼ |
| | | */ |
| | | public static final String SERVICE_TENCENT_LOCATION_URL = SERVICE_URL + "/v1/shop/web/map/tencent/location"; |
| | | |
| | | /** |
| | | * å°ç¨åºæ¯ä»å°å |
| | | */ |
| | | public static final String SERVICE_UNIFIED_URL = SERVICE_URL + "/v1/web/pay/miniProgramPay"; |
| | | |
| | | /** |
| | | * Bæ«Cæ¯ä»å°å |
| | | */ |
| | | public static final String SERVICE_B_SWEEP_C_URL = SERVICE_URL + "/v1/web/pay/bSweepCPay"; |
| | | /** |
| | | * æ ¹æ®ææç (仿¬¾ç )è·åç¨æ·ID å°å |
| | | */ |
| | | public static final String SERVICE_AUTHCODE2USERID_URL = SERVICE_URL + "/apiweb/unitorder/authcodetouserid"; |
| | | |
| | | /** |
| | | * bæ«cæ¯ä»ç»ææ¥è¯¢å°å |
| | | */ |
| | | public static final String SERVICE_PAY_RESULT_URL = SERVICE_URL + "/v1/web/pay/bSweepCPayResult"; |
| | | |
| | | /** |
| | | * çä¿¡å°å |
| | | */ |
| | | public static final String SERVICE_SMS_URL = SERVICE_URL + "/v1/sms/sendSMS"; |
| | | |
| | | /** |
| | | * 微信jscode转SessionKeyå°å |
| | | */ |
| | | public static final String SERVICE_JSCODE2SESSION_URL = SERVICE_URL + "/v1/sns/jscode2session"; |
| | | |
| | | /** |
| | | * 微信è·åAccessToken |
| | | */ |
| | | public static final String SERVICE_TOKEN_URL = SERVICE_URL + "/v1/cgi-bin/token"; |
| | | /** |
| | | * 微信è·å jsapiTicket |
| | | */ |
| | | public static final String SERVICE_JSAPITICKET_URL = SERVICE_URL + "/v1/cgi-bin/jsapiTicket"; |
| | | |
| | | /** |
| | | * 微信å
¬ä¼å·è·åaccess_token |
| | | */ |
| | | public static final String SERVICE_ACCESS_TOKEN_URL = SERVICE_URL + "/v1/sns/oauth2/access_token"; |
| | | |
| | | /** |
| | | * 微信å
¬ä¼å·è·åç¨æ·ä¿¡æ¯ |
| | | */ |
| | | public static final String SERVICE_USERINFO_URL = SERVICE_URL + "/v1/sns/userinfo"; |
| | | |
| | | /** |
| | | * 微信è·åå°ç¨åºç ï¼åææ¯å·²åå¸ï¼ |
| | | */ |
| | | public static final String SERVICE_WXACODEUNLIMIT_URL = SERVICE_URL + "/v1/wxa/getwxacodeunlimit"; |
| | | |
| | | /** |
| | | * 微信æ¨éæ¶æ¯ |
| | | */ |
| | | public static final String SERVICE_TEMPLATE_SEND_URL = SERVICE_URL + "/v1/cgi-bin/message/wxopen/template/send"; |
| | | |
| | | /** |
| | | * 微信订é
æ¶æ¯-æ¨é |
| | | */ |
| | | public static final String SERVICE_SUBSCRIBER_SEND_URL = SERVICE_URL + "/v1/cgi-bin/message/wxopen/subscribe/send"; |
| | | |
| | | /** |
| | | * åè¡¨å¯¼åº |
| | | */ |
| | | public static final String SERVICE_EXPORT_TABLE_URL = SERVICE_URL + "/v1/export/table"; |
| | | |
| | | /** |
| | | * æå
æ¨é |
| | | */ |
| | | public static final String SERVICE_JG_PUSH_URL = SERVICE_URL + "/v1/jg/push"; |
| | | |
| | | /** |
| | | * ç¾åº¦è¯é³ |
| | | */ |
| | | public static final String SERVICE_BAI_DU_API = SERVICE_URL + "/v1/merchant/app/baidu/api/speech"; |
| | | |
| | | /** |
| | | * 个æ¨ï¼åæ¨ï¼ |
| | | */ |
| | | public static final String SERVICE_GE_TUI_URL = SERVICE_URL + "/v1/gt/push"; |
| | | |
| | | /** |
| | | * 个æ¨ï¼æ¨éä¸ä¸ªåè¡¨ï¼ |
| | | */ |
| | | public static final String SERVICE_GE_TUI_LIST_URL = SERVICE_URL + "/v1/gt/pushList"; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.constants; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName SystemConstants |
| | | * @date 2019/4/24 17:07 |
| | | * @Description ç³»ç»å
¬ç¨å¸¸é |
| | | */ |
| | | public class SystemConstants { |
| | | |
| | | /** |
| | | * 综ååå°ç¨æ·é»è®¤å¯ç |
| | | */ |
| | | public static final String USER_KEY = "Adu_8097"; |
| | | |
| | | /** |
| | | * åæ·åå°ç¨æ·é»è®¤å¯ç |
| | | */ |
| | | public static final String MERCHANT_USER_K = "Sel_8099"; |
| | | |
| | | /** |
| | | * ç§¯åæµæ£é»è®¤å¼ï¼åï¼ |
| | | */ |
| | | public static final Long INTEGRAL_DEDUCTION_VAL = 100L; |
| | | |
| | | /** |
| | | * ç§¯åæµæ£ä»·å¼key |
| | | */ |
| | | public static final String INTEGRAL_DEDUCATION = "deducation"; |
| | | |
| | | /********************************************** ç»å½æ è¯ ************************************/ |
| | | /** |
| | | * ç»ä¸åå°pcè§è²api |
| | | */ |
| | | public static final String BASE_PC_ROLE_API_PREFIX = "basePcRoleApi:"; |
| | | /** |
| | | * ç»ä¸åå°pcè§è² rest api |
| | | */ |
| | | public static final String BASE_PC_ROLE_RESTAPI_PREFIX = "basePcRoleRestApi:"; |
| | | /** |
| | | * åæ·pcè§è²api |
| | | */ |
| | | public static final String MERCHANT_PC_ROLE_API_PREFIX = "merchantPcRoleApi:"; |
| | | /** |
| | | * åæ·pcè§è² rest api |
| | | */ |
| | | public static final String MERCHANT_PC_ROLE_RESTAPI_PREFIX = "merchantPcRoleRestApi:"; |
| | | /** |
| | | * ç»ä¸åå°pcç»å½æ è¯ |
| | | */ |
| | | public static final String BASE_PC_USER_PREFIX = "basePcUser:"; |
| | | |
| | | /** |
| | | * åæ·pcç»å½æ è¯ |
| | | */ |
| | | public static final String MERCHANT_PC_USER_PREFIX = "merchantPcUser:"; |
| | | public static final String SUPPLIER_PC_USER_PREFIX = "supplierPcUser:"; |
| | | |
| | | /** |
| | | * åæ·appç»å½æ è¯ |
| | | */ |
| | | public static final String MERCHANT_APP_USER_PREFIX = "merchantAppUser:"; |
| | | |
| | | /** |
| | | * åå微信ç»å½æ è¯ï¼å
å«åæ·H5ï¼ |
| | | */ |
| | | public static final String SHOP_WECHAT_USER_PREFIX = "shopWechatUser:"; |
| | | |
| | | /** |
| | | * 客æ·ç»çappç»å½æ è¯ |
| | | */ |
| | | public static final String MANAGER_APP_USER_PREFIX = "managerAppUser:"; |
| | | |
| | | /** |
| | | * æ«ç 仿æç»å½æ è¯ |
| | | */ |
| | | public static final String SCAN_WECHAT_USER_PREFIX = "scanWechatUser:"; |
| | | |
| | | |
| | | /********************************************** token headeræ è¯ ************************************/ |
| | | |
| | | /** |
| | | * 综åpc token header æ è¯ |
| | | */ |
| | | public static final String BASE_PC_TOKEN_HEADER = "BASE-PC-TOKEN-HEADER"; |
| | | |
| | | /** |
| | | * åæ·pc token header æ è¯ |
| | | */ |
| | | public static final String MERCHANT_PC_TOKEN_HEADER = "MERCHANT-PC-TOKEN-HEADER"; |
| | | |
| | | /** |
| | | * ä¾è´§å |
| | | */ |
| | | public static final String SUPPLIER_PC_TOKEN_HEADER = "SUPPLIER-PC-TOKEN-HEADER"; |
| | | |
| | | /** |
| | | * åæ·app token header æ è¯ |
| | | */ |
| | | public static final String MERCHANT_APP_TOKEN_HEADER = "MERCHANT-APP-TOKEN-HEADER"; |
| | | |
| | | /** |
| | | * åå微信 token header æ è¯ï¼å
å«åæ·H5ï¼ |
| | | */ |
| | | public static final String SHOP_WECHAT_TOKEN_HEADER = "SHOP-WECHAT-TOKEN-HEADER"; |
| | | |
| | | /** |
| | | * 客æ·ç»çapp token header æ è¯ |
| | | */ |
| | | public static final String MANAGER_APP_TOKEN_HEADER = "MANAGER-APP-TOKEN-HEADER"; |
| | | |
| | | /** |
| | | * åæ·æ«ç ä»å¾®ä¿¡ token header æ è¯ï¼å
å«åæ·H5ï¼ |
| | | */ |
| | | public static final String SCAN_WECHAT_TOKEN_HEADER = "SCAN-WECHAT-TOKEN-HEADER"; |
| | | |
| | | |
| | | /********************************************** å¯¼åºæ è¯ ************************************/ |
| | | |
| | | /* |
| | | * @Author : liu.q [916000612@qq.com] |
| | | * @Date : 2019-07-18 15:11 |
| | | * @Description : 导åºå å¯ç¾å-æ è¯ |
| | | */ |
| | | public static final String EXPORT_SIGN_K = "bc29ru982ur8923jr923hr9y2389"; |
| | | /* |
| | | * @Author : liu.q [916000612@qq.com] |
| | | * @Date : 2019-07-18 15:11 |
| | | * @Description : å¯¼åºæ°æ®ç¼åkey å¼å¤´ |
| | | */ |
| | | public static final String EXPORT_DATA_K = "exportDataK:"; |
| | | |
| | | /********************************************** 鮿¼å¢æ è¯ ************************************/ |
| | | |
| | | /** |
| | | * å¢è´æ¯ä»è¶
æ¶æ¶é´key |
| | | */ |
| | | public static final String GROUP_PAY_TIMEOUT = "groupPayTimeout"; |
| | | |
| | | /** |
| | | * å¢è´æå¢è¶
æ¶æ¶é´key |
| | | */ |
| | | public static final String GROUP_COMPLETE_TIMEOUT = "groupCompleteTimeout"; |
| | | |
| | | /** |
| | | * å¢è´è§æ ¼key |
| | | */ |
| | | public static final String GROUP_RULE = "groupRule"; |
| | | |
| | | /********************************************** åå设置æ è¯ ************************************/ |
| | | |
| | | /** |
| | | * å忝仿¶é´è®¾ç½®key |
| | | */ |
| | | public static final String PAY_TIMEOUT = "pay_timeout"; |
| | | |
| | | /** |
| | | * æ¶è´§æ¶é´è®¾ç½®key |
| | | */ |
| | | public static final String RECEIVING_TIMEOUT = "receiving_timeout"; |
| | | /** |
| | | * æ¥å¿å®æ¶æ¸
ç设置 |
| | | */ |
| | | public static final String LOG_CLEAN_TIME = "logCleanTime"; |
| | | /** |
| | | * 客æ·èè§å设置key |
| | | */ |
| | | public static final String MEMBER_DAY_RULE = "member_day_rule"; |
| | | |
| | | /** |
| | | * 忬¡æç°éé¢ä¸ä½äº |
| | | */ |
| | | public static final String DRAW_CASH_EACH_MIN_RULE = "draw_cash_each_min"; |
| | | /** |
| | | * æ¯å¤©æç°éé¢ä¸è¶
è¿ |
| | | */ |
| | | public static final String DRAW_CASH_DAY_MAX_RULE = "draw_cash_day_max"; |
| | | /** |
| | | * ä¼åæ¥æ´»å¨è§å |
| | | */ |
| | | public static final String MEMBER_FLASH_ACT_RULE = "member_flash_act_rule"; |
| | | /** |
| | | * ä¼åæ¥æ´»å¨åä¸å¯¹è±¡ |
| | | */ |
| | | public static final String MEMBER_FLASH_ACT_JOIN_OBJ = "MEMBER_FLASH_ACT_JOIN_OBJ"; |
| | | /** |
| | | * æçº§æçæ´»å¨è§å |
| | | */ |
| | | public static final String STAR_POWER_ACT_RULE = "star_power_act_rule"; |
| | | public static final String STAR_POWER_ACT_JOIN_OBJ = "star_power_act_join_obj"; |
| | | |
| | | /* |
| | | åºç¨å¹³å°ç±»å(䏿¹å¹³å°ç»å®ç¨æ·ä½¿ç¨) |
| | | appType 1.æ¯ä»å®-å°ç¨åº, 2.æ¯ä»å®-çæ´»å·, 3.微信-å°ç¨åº, 4.微信-å
¬ä¼å· |
| | | */ |
| | | /** åºç¨å¹³å°ç±»å-æ¯ä»å®-å°ç¨åº */ |
| | | public static final String APP_TYPE_ALI_MINI = "1"; |
| | | /** åºç¨å¹³å°ç±»å-æ¯ä»å®-çæ´»å· */ |
| | | public static final String APP_TYPE_ALI_SHH = "2"; |
| | | /** åºç¨å¹³å°ç±»å-微信-å°ç¨åº */ |
| | | public static final String APP_TYPE_WECHAT_MINI = "3"; |
| | | /** åºç¨å¹³å°ç±»å-微信-å
¬ä¼å· */ |
| | | public static final String APP_TYPE_WECHAT_GZH = "4"; |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.hnnx.conf; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.date.format.FastDateFormat; |
| | | import cn.hutool.core.util.CharsetUtil; |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.Method; |
| | | import com.nuvole.hnnx.hnnxPay.HnnxConstant; |
| | | import com.nuvole.hnnx.hnnxPay.KeyMetadata; |
| | | import com.nuvole.hnnx.hnnxPay.KeyRegistry; |
| | | import com.nuvole.hnnx.hnnxPay.KeyRegistryImpl; |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.PropertySource; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.BufferedInputStream; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.security.Key; |
| | | import java.security.PrivateKey; |
| | | import java.security.PublicKey; |
| | | import java.security.cert.Certificate; |
| | | import java.security.cert.CertificateException; |
| | | import java.security.cert.CertificateFactory; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @ClassName NxPayConfig |
| | | * @Author cy |
| | | * @Date 2023/10/5 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | //@ConditionalOnProperty(name = "offLinePay.hnnx", havingValue = "true") |
| | | @Data |
| | | @PropertySource("classpath:hnnx.properties") |
| | | @ConfigurationProperties(prefix = "hnnx") |
| | | @Component |
| | | public class NxPayConfig { |
| | | private String merNbr; |
| | | private String url; |
| | | private String appCode; |
| | | private String certPath; |
| | | private String certPwd; |
| | | private String pubKey; |
| | | private String platSubMerchantId; |
| | | private String branchId; |
| | | public static final String KEYSTORE_TYPE = "PKCS12"; // ç§é¥ç±»å |
| | | // private static String keyPath = "C:\\Users\\cy\\Desktop\\merchant-rsa.pfx"; // ç§é¥å®¹å¨è·¯å¾ |
| | | // private static String cardPwdAlias = "HNNX"; // ç§é¥è¯ä¹¦å«å |
| | | /** |
| | | * å¿«æ·æ¯ä»å
¬é¥ |
| | | */ |
| | | private String kjUrl; |
| | | private String kjMerNbr; |
| | | |
| | | @Bean(name = "nxPayPrivateKey") |
| | | public PrivateKey payPrivateKey() { |
| | | KeyRegistry keyRegistry = new KeyRegistryImpl(); |
| | | KeyMetadata keyMetadata = new KeyMetadata("nxPay", certPath, certPwd, null, certPwd); |
| | | System.out.println(keyMetadata); |
| | | Key privatekey = keyRegistry.getKey(keyMetadata); |
| | | System.out.println(privatekey); |
| | | return (PrivateKey) privatekey; |
| | | } |
| | | |
| | | @Bean(name = "nxPayPublicKey") |
| | | public PublicKey payPublicKey() { |
| | | BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(("-----BEGIN CERTIFICATE-----\n" + pubKey + "\n-----END CERTIFICATE-----\n").getBytes())); |
| | | Certificate certificate = null; |
| | | CertificateFactory cf = null; |
| | | try { |
| | | cf = CertificateFactory.getInstance("X.509"); |
| | | certificate = cf.generateCertificate(bis); |
| | | return certificate.getPublicKey(); |
| | | } catch (CertificateException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | private String kjPubKey; |
| | | private String kjCertPath; |
| | | private String kjCertPwd; |
| | | private String kjPlatSubMerchantId; |
| | | |
| | | // public static void main(String[] args) throws Exception { |
| | | // InputStream key = new FileInputStream(keyPath); |
| | | // KeyStore ks = KeyStore.getInstance(KEYSTORE_TYPE); |
| | | // ks.load(key, cardPwdAlias.toCharArray()); |
| | | // Enumeration<String> keyAlias = ks.aliases(); |
| | | // PrivateKey privateKey = null; |
| | | // while (keyAlias.hasMoreElements()) { |
| | | // String nextElement = keyAlias.nextElement(); |
| | | // boolean keyEntryFlag = ks.isKeyEntry(nextElement); |
| | | // if (keyEntryFlag) { |
| | | // privateKey = (PrivateKey) ks.getKey(nextElement, cardPwdAlias.toCharArray()); |
| | | // break; |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // } |
| | | |
| | | @Bean(name = "nxKjPayPrivateKey") |
| | | public PrivateKey nxKjPayPrivateKey() throws Exception { |
| | | KeyRegistry keyRegistry = new KeyRegistryImpl(); |
| | | KeyMetadata keyMetadata = new KeyMetadata("nxKjPay", kjCertPath, kjCertPwd, null, kjCertPwd); |
| | | Key privatekey = keyRegistry.getKey(keyMetadata); |
| | | return (PrivateKey) privatekey; |
| | | // InputStream key = new FileInputStream(keyPath); |
| | | // KeyStore ks = KeyStore.getInstance(KEYSTORE_TYPE); |
| | | // ks.load(key, cardPwdAlias.toCharArray()); |
| | | // Enumeration<String> keyAlias = ks.aliases(); |
| | | // PrivateKey privateKey = null; |
| | | // while (keyAlias.hasMoreElements()) { |
| | | // String nextElement = keyAlias.nextElement(); |
| | | // boolean keyEntryFlag = ks.isKeyEntry(nextElement); |
| | | // if (keyEntryFlag) { |
| | | // privateKey = (PrivateKey) ks.getKey(nextElement, cardPwdAlias.toCharArray()); |
| | | // break; |
| | | // } |
| | | // } |
| | | // return privateKey; |
| | | |
| | | } |
| | | |
| | | @Bean(name = "nxKjPayPublicKey") |
| | | public PublicKey nxKjPayPublicKey() { |
| | | BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(("-----BEGIN CERTIFICATE-----\n" + kjPubKey + "\n-----END CERTIFICATE-----\n").getBytes())); |
| | | Certificate certificate = null; |
| | | CertificateFactory cf = null; |
| | | try { |
| | | cf = CertificateFactory.getInstance("X.509"); |
| | | certificate = cf.generateCertificate(bis); |
| | | return certificate.getPublicKey(); |
| | | } catch (CertificateException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | // @Bean(name = "nxPayHttpClient") |
| | | public HttpRequest getPayCloseableHttpClient() { |
| | | HttpRequest postRequest = new HttpRequest(url).method(Method.POST); |
| | | String charset = CharsetUtil.CHARSET_UTF_8.toString(); |
| | | postRequest.header("appCode", appCode); |
| | | postRequest.header("version", "1.0"); |
| | | postRequest.header("charset", charset); |
| | | postRequest.header("algorithm", HnnxConstant.ALGORITHM); |
| | | postRequest.header("deviceId", HnnxConstant.DEVICEID); |
| | | postRequest.header("channelId", HnnxConstant.CHANNELID); |
| | | postRequest.header("sequenceId", getSequenceId()); |
| | | return postRequest; |
| | | } |
| | | |
| | | /** |
| | | * 请æ±åºåå·ãæ¸ é端产çï¼ä¸ç¬ä¸å¡çå¯ä¸æ è¯ï¼è´¯ç©¿æ´ä¸ªäº¤æå§ç»ãæ¸ é代ç ï¼2ä½ï¼+æ¥æï¼yyMMdd 6ä½ï¼+æµæ°´å·ï¼24ä½ï¼appCode+å©ä½ä½æ°æµæ°´å·ï¼ |
| | | * |
| | | * @return |
| | | */ |
| | | private String getSequenceId() { |
| | | StringBuilder sequenceIdSb = new StringBuilder(); |
| | | sequenceIdSb.append(HnnxConstant.CHANNELID) |
| | | .append(DateUtil.format(new Date(), FastDateFormat.getInstance("yyMMdd"))) |
| | | .append(appCode); |
| | | int length = 32 - sequenceIdSb.length(); |
| | | |
| | | String timeTemp = System.currentTimeMillis() + ""; |
| | | while (length > 0) { |
| | | if (length > timeTemp.length()) { |
| | | sequenceIdSb.append(timeTemp); |
| | | } else { |
| | | sequenceIdSb.append(timeTemp.substring(0, length)); |
| | | } |
| | | length = 32 - sequenceIdSb.length(); |
| | | } |
| | | return sequenceIdSb.toString(); |
| | | } |
| | | |
| | | public Map getHeadMap(String sequenceId, String timestamp, String branchId) { |
| | | Map headMap = new HashMap<>(); |
| | | String charset = CharsetUtil.CHARSET_UTF_8.toString(); |
| | | headMap.put("appCode", appCode); |
| | | headMap.put("version", "1.0"); |
| | | headMap.put("charset", charset); |
| | | headMap.put("algorithm", HnnxConstant.ALGORITHM); |
| | | headMap.put("deviceId", HnnxConstant.DEVICEID); |
| | | headMap.put("channelId", HnnxConstant.CHANNELID); |
| | | headMap.put("sequenceId", sequenceId); |
| | | headMap.put("timestamp", timestamp); |
| | | // headMap.put("transCode", transCode); |
| | | headMap.put("branchId", branchId); |
| | | return headMap; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.hnnx.hnnxPay; |
| | | |
| | | /** |
| | | * @ClassName HnnxConstant |
| | | * @Author cy |
| | | * @Date 2023/10/5 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | public class HnnxConstant { |
| | | |
| | | /** |
| | | * åä¿¡åªè½è®¾ç½®ä¸ä¸ªåè° |
| | | */ |
| | | public static String ALL_CALL_BACK = "/v1/web/payBack/nx/allBack"; |
| | | /** |
| | | * ç¨æ·è¢«æ«æ¯ä» |
| | | */ |
| | | public static String TRANS_CODE_CORETOALL_PAY = "hnnx.trade.sandbox.upp.coretoall"; |
| | | |
| | | /** |
| | | * éç¨éè´§ |
| | | */ |
| | | public static String TRANS_CODE_RETURNTRANS_PAY = "hnnx.trade.sandbox.upp.returntrans"; |
| | | |
| | | /** |
| | | * 颿¯ä» |
| | | */ |
| | | public static String TRANS_CODE_QRCODEPREPAY_PAY = "hnnx.trade.sandbox.upp.qrCodePrePay"; |
| | | |
| | | /** |
| | | * ç¨æ·ä¸»å¨æ«ç çæ |
| | | */ |
| | | public static String TRANS_CODE_DYACTIVEQRCODE_PAY = "hnnx.trade.sandbox.upp.dyActiveQrCode"; |
| | | /** |
| | | * 订å交æç¶ææ¥è¯¢ |
| | | */ |
| | | public static String TRANS_CODE_QRYQRORDERSTATUS_PAY = "hnnx.trade.sandbox.upp.qryQrOrderStatus"; |
| | | |
| | | /** |
| | | * 对账æ¥è¯¢ |
| | | */ |
| | | public static String TRANS_CODE_ACCOUNTQRY_PAY = "hnnx.trade.sandbox.upp.accountqry"; |
| | | /** |
| | | * å¸ç§ |
| | | */ |
| | | public static String CURRENCYCD = "CNY"; |
| | | |
| | | /** |
| | | * å å¯ç®æ³ |
| | | */ |
| | | public static String ALGORITHM = "SHA256withRSA"; |
| | | /** |
| | | * åä¿¡å¿«æ·åªè½è®¾ç½®ä¸ä¸ªåè° |
| | | */ |
| | | public static String NX_KJ_ALL_CALL_BACK = "/v1/web/payBack/nxKj/allBack"; |
| | | /** |
| | | * åä¿¡å¿«æ·æ¯ä»å端åè°URL |
| | | */ |
| | | public static String NX_KJ_FRONT_URL ="https://jmy.jinmingyuan.com/payTest/pages/pay/paySuccess?orderId=${ORDERID}&youHuiInfo=${YOUHUIINFO}"; |
| | | /** |
| | | * åä¿¡å¿«æ·æ¯ä»å å¯ç®æ³ |
| | | */ |
| | | public static String KJ_ALGORITHM = "SHA1WithRSA"; |
| | | //äº¤ææ¸ éå·:45 |
| | | public static String CHANNELID = "45"; |
| | | //é个å®å¼å³å¯ |
| | | public static String DEVICEID = "JMY"; |
| | | //å°åºä¿¡æ¯ |
| | | public static String AREAINFO = "1564960"; |
| | | |
| | | |
| | | /** |
| | | * åä¿¡å¿«æ·æ¯ä»url |
| | | */ |
| | | public static String QUICK_PAY_URL = "/pmPay/quickPayRequest.do"; |
| | | /** |
| | | * è®¢åæ¥è¯¢ |
| | | */ |
| | | public static String QUICK_PAY_QUERY_URL = "/common/orderQuery.do"; |
| | | /** |
| | | * 鿬¾ |
| | | */ |
| | | public static String QUICK_PAY_RETURN_URL = "/common/returnTrans.do"; |
| | | } |
New file |
| | |
| | | package com.nuvole.hnnx.hnnxPay; |
| | | |
| | | /** |
| | | * @author awlwen |
| | | * @since 2017/11/30 |
| | | */ |
| | | public class KeyMetadata { |
| | | private String id; |
| | | private String file; |
| | | private String keyStorePassword; |
| | | private String keyAlias; |
| | | private String keyPassword; |
| | | public KeyMetadata() { |
| | | } |
| | | public KeyMetadata(String id, String file, String keyStorePassword, String keyAlias, String keyPassword) { |
| | | this.id = id; |
| | | this.file = file; |
| | | this.keyStorePassword = keyStorePassword; |
| | | this.keyAlias = keyAlias; |
| | | this.keyPassword = keyPassword; |
| | | } |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | public String getFile() { |
| | | return file; |
| | | } |
| | | public void setFile(String file) { |
| | | this.file = file; |
| | | } |
| | | public String getKeyStorePassword() { |
| | | return keyStorePassword; |
| | | } |
| | | public void setKeyStorePassword(String keyStorePassword) { |
| | | this.keyStorePassword = keyStorePassword; |
| | | } |
| | | public String getKeyAlias() { |
| | | return keyAlias; |
| | | } |
| | | public void setKeyAlias(String keyAlias) { |
| | | this.keyAlias = keyAlias; |
| | | } |
| | | public String getKeyPassword() { |
| | | return keyPassword; |
| | | } |
| | | public void setKeyPassword(String keyPassword) { |
| | | this.keyPassword = keyPassword; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.hnnx.hnnxPay; |
| | | |
| | | import java.security.Key; |
| | | import java.security.cert.Certificate; |
| | | |
| | | /** |
| | | * @author awlwen |
| | | * @since 2017/11/30 |
| | | */ |
| | | public interface KeyProvider { |
| | | Key getKey(String id, String password); |
| | | Certificate getCertificate(String id); |
| | | Certificate[] getCertificateChain(String id); |
| | | } |
New file |
| | |
| | | package com.nuvole.hnnx.hnnxPay; |
| | | |
| | | import org.springframework.core.io.ClassPathResource; |
| | | import org.springframework.util.Assert; |
| | | |
| | | import java.io.BufferedInputStream; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.security.Key; |
| | | import java.security.KeyStore; |
| | | import java.security.cert.Certificate; |
| | | import java.util.Enumeration; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author awlwen |
| | | * @since 2017/11/30 |
| | | */ |
| | | public class KeyProviderImpl implements KeyProvider { |
| | | private static final Map<String, String> SUPPORTED_KEY_TYPE = new HashMap<String, String>(); |
| | | |
| | | static { |
| | | SUPPORTED_KEY_TYPE.put("ks", "jks"); |
| | | SUPPORTED_KEY_TYPE.put("jks", "jks"); |
| | | SUPPORTED_KEY_TYPE.put("pfx", "pkcs12"); |
| | | SUPPORTED_KEY_TYPE.put("p12", "pkcs12"); |
| | | } |
| | | |
| | | /** |
| | | * å¯é¥å®¹å¨æä»¶è·¯å¾ |
| | | */ |
| | | private String file; |
| | | /** |
| | | * å¯é¥å®¹å¨å¯ç |
| | | */ |
| | | private String password; |
| | | /** |
| | | * å¯é¥å®¹å¨ |
| | | */ |
| | | private KeyStore keystore; |
| | | /** |
| | | * åå§åæ å¿ |
| | | */ |
| | | private boolean initialized = false; |
| | | |
| | | /** |
| | | * æé å¨ |
| | | * |
| | | * @param file å¯é¥å®¹å¨æä»¶è·¯å¾ |
| | | * @param password å¯é¥å®¹å¨å¯ç |
| | | */ |
| | | public KeyProviderImpl(String file, String password) { |
| | | super(); |
| | | Assert.notNull(file, "file is required; it must not be null"); |
| | | init(file, password); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æä»¶æ©å±åè·åå¯é¥å®¹å¨ç±»å |
| | | * |
| | | * @param file |
| | | * @return |
| | | */ |
| | | private String resolveType(String file) { |
| | | Assert.notNull(file, "file is required; it must not be null"); |
| | | String suffix = file.substring(file.lastIndexOf(".") + 1); |
| | | Assert.notNull(suffix, "suffix could not be resolved"); |
| | | String supportedType = SUPPORTED_KEY_TYPE.get(suffix.toLowerCase()); |
| | | Assert.notNull(supportedType, "unsupported key type"); |
| | | return supportedType; |
| | | } |
| | | |
| | | /** |
| | | * åå§åï¼å è½½å¯é¥å®¹å¨ |
| | | * |
| | | * @param file å¯é¥å®¹å¨æä»¶è·¯å¾ |
| | | * @param password å¯é¥å®¹å¨å¯ç |
| | | */ |
| | | private void init(String file, String password) { |
| | | InputStream is = null; |
| | | try { |
| | | //å»ºç«æä»¶è¾å
¥æµè¯»åå¯é¥å®¹å¨ |
| | | if (file.startsWith("classpath:")) { |
| | | is = new ClassPathResource(file.replace("classpath:", "")).getInputStream(); |
| | | } else { |
| | | is = new BufferedInputStream(new FileInputStream(file)); |
| | | } |
| | | |
| | | //æ ¹æ®æä»¶æ©å±å建ç«ç¸åºçå¯é¥å®¹å¨ç±»å |
| | | keystore = KeyStore.getInstance(resolveType(file)); |
| | | //å°å¯é¥å®¹å¨å¯ç 转æ¢ä¸ºcharæ°ç» |
| | | char[] pwd = password == null ? null : password.toCharArray(); |
| | | //仿å®çè¾å
¥æµä¸å è½½å¯é¥å®¹å¨ |
| | | keystore.load(is, pwd); |
| | | initialized = true; |
| | | } catch (Exception ex) { |
| | | throw new RuntimeException(ex); |
| | | } finally { |
| | | if (is != null) { |
| | | try { |
| | | is.close(); |
| | | } catch (IOException ex) { |
| | | throw new RuntimeException(ex); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /* (non-Javadoc) |
| | | * @see com.csii.sg.security.KeyProvider#getKey(java.lang.String, java.lang.String) |
| | | */ |
| | | public Key getKey(String id, String password) { |
| | | Assert.isTrue(initialized, "keyProvider not been initialized"); |
| | | try { |
| | | if (id == null) { |
| | | Enumeration<String> aliases = keystore.aliases(); |
| | | for (int count = 0; aliases.hasMoreElements(); count++) { |
| | | if (count > 1) { |
| | | throw new IllegalArgumentException("key id not specified"); |
| | | } |
| | | String alias = aliases.nextElement(); |
| | | if (keystore.isKeyEntry(alias)) { |
| | | id = alias; |
| | | } |
| | | } |
| | | } |
| | | char[] pwd = password == null ? null : password.toCharArray(); |
| | | return keystore.getKey(id, pwd); |
| | | } catch (Exception ex) { |
| | | throw new RuntimeException(ex); |
| | | } |
| | | } |
| | | |
| | | /* (non-Javadoc) |
| | | * @see com.csii.sg.security.KeyProvider#getCertificate(java.lang.String) |
| | | */ |
| | | public Certificate getCertificate(String id) { |
| | | Assert.isTrue(initialized, "keyProvider not been initialized"); |
| | | try { |
| | | return keystore.getCertificate(id); |
| | | } catch (Exception ex) { |
| | | throw new RuntimeException(ex); |
| | | } |
| | | } |
| | | |
| | | /* (non-Javadoc) |
| | | * @see com.csii.sg.security.KeyProvider#getCertificateChain(java.lang.String) |
| | | */ |
| | | public Certificate[] getCertificateChain(String id) { |
| | | Assert.isTrue(initialized, "keyProvider not been initialized"); |
| | | try { |
| | | return keystore.getCertificateChain(id); |
| | | } catch (Exception ex) { |
| | | throw new RuntimeException(ex); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @param file the file to set |
| | | */ |
| | | public void setFile(String file) { |
| | | this.file = file; |
| | | } |
| | | |
| | | /** |
| | | * @param password the password to set |
| | | */ |
| | | public void setPassword(String password) { |
| | | this.password = password; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.hnnx.hnnxPay; |
| | | |
| | | import java.security.Key; |
| | | import java.security.cert.Certificate; |
| | | |
| | | /** |
| | | * @author awlwen |
| | | * @since 2017/11/30 |
| | | */ |
| | | public interface KeyRegistry { |
| | | Key getKey(KeyMetadata metadata); |
| | | Certificate getCertificate(String base64); |
| | | } |
New file |
| | |
| | | package com.nuvole.hnnx.hnnxPay; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.util.Assert; |
| | | |
| | | import java.io.BufferedInputStream; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import java.security.Key; |
| | | import java.security.cert.Certificate; |
| | | import java.security.cert.CertificateException; |
| | | import java.security.cert.CertificateFactory; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | /** |
| | | * @author awlwen |
| | | * @since 2017/11/30 |
| | | */ |
| | | public class KeyRegistryImpl implements KeyRegistry { |
| | | private Map<String, Key> cache = new ConcurrentHashMap<>(); |
| | | private Logger logger = LoggerFactory.getLogger(this.getClass()); |
| | | private volatile boolean sync = false; |
| | | @Override |
| | | public Key getKey(KeyMetadata metadata) { |
| | | Assert.notNull(metadata, "[Assertion failed] - metadata is required; it must not be null"); |
| | | Key key = cache.get(metadata.getId()); |
| | | if (key == null || sync) { |
| | | key = getKeyInternal(metadata); |
| | | cache.put(metadata.getId(), key); |
| | | } |
| | | return key; |
| | | } |
| | | @Override |
| | | public Certificate getCertificate(String base64) { |
| | | Assert.hasText(base64, "[Assertion failed] - base64 must have text; it must not be null, empty, or blank"); |
| | | BufferedInputStream is = null; |
| | | try { |
| | | is = new BufferedInputStream(new ByteArrayInputStream(base64.trim().getBytes())); |
| | | CertificateFactory cf = CertificateFactory.getInstance("X.509"); |
| | | Certificate cert = cf.generateCertificate(is); |
| | | return cert; |
| | | } catch (CertificateException ex) { |
| | | throw new RuntimeException(ex); |
| | | } finally { |
| | | if (is != null) { |
| | | try { |
| | | is.close(); |
| | | } catch (IOException ex) { |
| | | logger.error("close stream error.", ex); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | private Key getKeyInternal(KeyMetadata metadata) { |
| | | KeyProvider provider = new KeyProviderImpl(metadata.getFile(), metadata.getKeyStorePassword()); |
| | | Key key = provider.getKey(metadata.getKeyAlias(), metadata.getKeyPassword()); |
| | | Assert.notNull(key, "[Assertion failed] - key must not be null"); |
| | | return key; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.hnnx.hnnxPay; |
| | | |
| | | import cn.hutool.core.date.DatePattern; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.parser.Feature; |
| | | import com.csii.sg.codec.Hex; |
| | | import com.csii.sg.security.ValidationException; |
| | | import com.csii.sg.security.impl.Permutation; |
| | | import com.csii.sg.security.impl.SignatureVerifier; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.nuvole.hnnx.conf.NxPayConfig; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileWriter; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.security.PrivateKey; |
| | | import java.security.PublicKey; |
| | | import java.util.Base64; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @ClassName HttpClientUtils |
| | | * @Author cy |
| | | * @Date 2023/9/27 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | |
| | | @Component |
| | | @Slf4j |
| | | //@ConditionalOnClass(name = "com.nuvole.hnnx.conf.NxPayConfig") |
| | | public class NXHttpClientUtils { |
| | | @Autowired |
| | | private PrivateKey nxPayPrivateKey; |
| | | @Autowired |
| | | private PrivateKey nxKjPayPrivateKey; |
| | | |
| | | @Autowired |
| | | private PublicKey nxPayPublicKey; |
| | | @Autowired |
| | | private PublicKey nxKjPayPublicKey; |
| | | |
| | | @Autowired |
| | | private NxPayConfig nxPayConfig; |
| | | |
| | | private static SignatureSigner signable = new SignatureSigner(); |
| | | |
| | | private static SignatureVerifier verifier = new SignatureVerifier(); |
| | | |
| | | public String getPlatSubMerchantId() { |
| | | return nxPayConfig.getPlatSubMerchantId(); |
| | | } |
| | | |
| | | public String getKjPlatSubMerchantId() { |
| | | return nxPayConfig.getKjPlatSubMerchantId(); |
| | | } |
| | | |
| | | public String getBranchId() { |
| | | return nxPayConfig.getBranchId(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å转为å
|
| | | * |
| | | * @param payMoney |
| | | * @return |
| | | */ |
| | | public static BigDecimal convertToYuan(long payMoney) { |
| | | BigDecimal totalAmount = new BigDecimal("" + payMoney).divide(new BigDecimal("100")); |
| | | return totalAmount; |
| | | } |
| | | |
| | | public static void writeToFile(String sign, String plainStr) { |
| | | File file = new File("D:\\dev_nginx-1.18.0\\html\\testNetPay4.html"); |
| | | |
| | | String content = "<!DOCTYPE html>\n" + |
| | | "<html lang=\"en\">\n" + |
| | | "<head>\n" + |
| | | " <meta charset=\"UTF-8\">\n" + |
| | | " <title>Title</title>\n" + |
| | | "\n" + |
| | | "</head>\n" + |
| | | "<body>\n" + |
| | | "\n" + |
| | | "</body>\n" + |
| | | "<script>\n" + |
| | | // " var url = \"http://221.176.112.3:8006/pmPay/pmPay/quickPayRequest.do\";\n" + |
| | | " var url = \"http://https://pay.hnnx.com/pmPay/pmPay/quickPayRequest.do\";\n" + |
| | | " var data ={\n" + |
| | | " \"deviceType\":\"5\",\n" + |
| | | " \"signature\": \"" + sign + "\",\n" + |
| | | " \"plain\": JSON.stringify(" + plainStr + ")\n" + |
| | | " }\n" + |
| | | " post(url, data);\n" + |
| | | " var myForm;\n" + |
| | | "\n" + |
| | | " function post(URL, pram) {\n" + |
| | | " var temp = document.createElement(\"form\");\n" + |
| | | " temp.action = URL;\n" + |
| | | " temp.method = \"post\";\n" + |
| | | " temp.style.display = \"none\";\n" + |
| | | " for (var x in pram) {\n" + |
| | | " var opt = document.createElement(\"textarea\");\n" + |
| | | " opt.name = x;\n" + |
| | | " opt.value = pram[x];\n" + |
| | | " // alert(opt.name)\n" + |
| | | " temp.appendChild(opt);\n" + |
| | | " }\n" + |
| | | " document.body.appendChild(temp);\n" + |
| | | " temp.submit();\n" + |
| | | "// myForm=temp;\n" + |
| | | " }\n" + |
| | | "</script>\n" + |
| | | "</html>\n"; |
| | | |
| | | try (FileWriter writer = new FileWriter(file)) { |
| | | writer.write(content); |
| | | System.out.println("å
容æååå
¥æä»¶ã"); |
| | | } catch (IOException e) { |
| | | System.err.println("åå
¥æä»¶æ¶åçé误ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | public static void writeToFile(String url) { |
| | | File file = new File("D:\\dev_nginx-1.18.0\\html\\redirect1.html"); |
| | | |
| | | String content = "<!DOCTYPE html>\n" + |
| | | "<html>\n" + |
| | | "<head>\n" + |
| | | " <meta http-equiv=\"refresh\" content=\"0; URL='" + url + |
| | | "'\" />\n" + |
| | | "</head>\n" + |
| | | "<body>\n" + |
| | | " <h1>æ£å¨è·³è½¬ï¼è¯·ç¨ç...</h1>\n" + |
| | | "</body>\n" + |
| | | "</html>\n"; |
| | | |
| | | try (FileWriter writer = new FileWriter(file)) { |
| | | writer.write(content); |
| | | System.out.println("å
容æååå
¥æä»¶ã"); |
| | | } catch (IOException e) { |
| | | System.err.println("åå
¥æä»¶æ¶åçé误ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å ç¾æ¹æ³ |
| | | * |
| | | * @param headerMap å 坿¥æå¤´ |
| | | * @param payloadJson å 坿¥æä½ |
| | | * @return |
| | | */ |
| | | public String sign(Map headerMap, String payloadJson) { |
| | | log.info("----------- ç¾åå¼å§ ----------- "); |
| | | log.info("请æ±åæ°payloadJson:{}", payloadJson); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | String palin = null; |
| | | try { |
| | | if (payloadJson != null) { |
| | | Map payloadMap = objectMapper.readValue(payloadJson, Map.class); |
| | | headerMap.putAll(payloadMap); |
| | | } |
| | | palin = Permutation.sort(headerMap, "UTF-8"); |
| | | log.info("å¾
ç¾åå符串ï¼{}", palin); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String sign = signable.sign(palin, nxPayPrivateKey); |
| | | log.info("ç¾åç»æ:{}", sign); |
| | | log.info("----------- ç¾åç»æ ----------- "); |
| | | return sign; |
| | | } |
| | | |
| | | public String kjSign(String palin) { |
| | | log.info("----------- ç¾åå¼å§ ----------- "); |
| | | log.info("请æ±åæ° palin:{}", palin); |
| | | String sign = signable.kjSign(palin, nxKjPayPrivateKey).replaceAll("\\s", ""); |
| | | log.info("ç¾åç»æ:{}", sign); |
| | | log.info("----------- ç¾åç»æ ----------- "); |
| | | return sign; |
| | | } |
| | | |
| | | // åè°éç¥æ ¡éª |
| | | public boolean notifyRespVerify(String notifyParam) { |
| | | log.info("åè°éç¥éªç¾ body 为: {}", notifyParam); |
| | | int signIndex = notifyParam.lastIndexOf("&signature="); |
| | | |
| | | if (signIndex == -1) { |
| | | return false; |
| | | } |
| | | |
| | | String palin = notifyParam.substring(0, signIndex); |
| | | String sign = notifyParam.substring(signIndex).replace("&signature=", ""); |
| | | |
| | | boolean verfiy = false; |
| | | try { |
| | | verfiy = verifier.verify(HnnxConstant.ALGORITHM, palin.getBytes(), Hex.toByte(sign), nxPayPublicKey); |
| | | } catch (ValidationException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | if (verfiy) { |
| | | log.info("è¿åå¼éªç¾ ç»æï¼{}", verfiy); |
| | | } else { |
| | | log.error("è¿åå¼éªç¾ ç»æï¼{}", verfiy); |
| | | } |
| | | log.info("----------- è¿åå¼éªç¾ ç»æ ----------- "); |
| | | return verfiy; |
| | | } |
| | | |
| | | public String sendForm(HttpRequest nxPayHttpClient, HashMap<String, Object> payLoadMap) { |
| | | log.info("transCode : {}", nxPayHttpClient.header("transCode")); |
| | | Map headerMap = nxPayConfig.getHeadMap(nxPayHttpClient.header("sequenceId"), nxPayHttpClient.header("timestamp"), nxPayHttpClient.header("branchId")); |
| | | HashMap<String, Object> formData = new HashMap<>(); |
| | | formData.put("payload", JSONObject.toJSONString(payLoadMap)); |
| | | // åå
·ä½æ¥å£çè¯·æ±æ¥æææã |
| | | log.info("请æ±å¤´: {}", JSONObject.toJSONString(headerMap)); |
| | | formData.put("signature", sign(headerMap, (String) formData.get("payload"))); |
| | | log.info("请æ±åæ°: {}", JSONObject.toJSONString(formData)); |
| | | HttpResponse httpResponse = nxPayHttpClient.form(formData).execute(); |
| | | String body = httpResponse.body(); |
| | | verify(body); |
| | | return body; |
| | | } |
| | | |
| | | /** |
| | | * 颿¯ä» |
| | | * å¯ä»¥å®ç°ç¨æ·å°æ¯ä»å®æå¾®ä¿¡ç颿¯ä»åè½ã |
| | | * |
| | | * @param subMerchantId äºçº§åæ·å· |
| | | * @param branchId äº¤ææºæå· |
| | | * @param merSeqNbr åæ·æ»äº¤ææµæ°´å· |
| | | * @param transAmt äº¤ææ»éé¢ |
| | | * @param timeStamp åæ·äº¤ææ¶é´ |
| | | * @param channelNbr æ¸ éç¼å· 01-O2O 02-B2C 03-æ«ç |
| | | * @param payTypCd B-æ¯ä»å®æ«ç æ¯ä»ï C-微信æ«ç æ¯ä»ï D-é¶èæ«ç æ¯ä» |
| | | * @param orderTitle è®¢åæ é¢ |
| | | */ |
| | | public String qrCodePrePay(String subMerchantId, String branchId, String operatorId, String merSeqNbr, String authCode, long transAmt, String timeStamp, String channelNbr, char payTypCd, |
| | | String merUrl, String orderTitle) { |
| | | log.info("----------------- 颿¯ä» å¼å§ 订åå·ä¸º: {}ï¼è®¢åéé¢ä¸º:{}----------------- ", merSeqNbr, transAmt); |
| | | HttpRequest nxPayHttpClient = nxPayConfig.getPayCloseableHttpClient(); |
| | | //请æ±åºåå·ãæ¸ é端产çï¼ä¸ç¬ä¸å¡çå¯ä¸æ è¯ï¼è´¯ç©¿æ´ä¸ªäº¤æå§ç»ãæ¸ é代ç ï¼2ä½ï¼+æ¥æï¼yyMMdd 6ä½ï¼+æµæ°´å·ï¼24ä½ï¼appCode+å©ä½ä½æ°æµæ°´å·ï¼ |
| | | // String sequenceId = getSequenceId(timeStamp, nxPayConfig.getAppCode()); |
| | | // nxPayHttpClient.header("sequenceId", sequenceId); |
| | | nxPayHttpClient.header("timestamp", timeStamp); |
| | | nxPayHttpClient.header("transCode", HnnxConstant.TRANS_CODE_QRCODEPREPAY_PAY); |
| | | nxPayHttpClient.header("branchId", branchId); |
| | | |
| | | // æ¼æ¥ä¸å¡æ°æ® |
| | | HashMap<String, Object> formData = new HashMap<>(); |
| | | // ä¸çº§åæ·å· |
| | | formData.put("MerNbr", nxPayConfig.getMerNbr()); |
| | | // äºçº§åæ·ç¼å· |
| | | formData.put("SubMerchantId", subMerchantId); |
| | | //åæ·äº¤ææ¶é´ |
| | | formData.put("MerTransDateTime", timeStamp); |
| | | //äº¤ææ»éé¢ |
| | | formData.put("TransAmt", convertToYuan(transAmt)); |
| | | formData.put("AuthCode", authCode); |
| | | |
| | | //æ¸ éç¼å· 01-O2O 02-B2C 03-æ«ç |
| | | formData.put("ChannelNbr", channelNbr); |
| | | //æ¯ä»æ¹å¼ 8-çº¿ä¸æ¯ä»å®æ«ç æ¯ä»ï 9-线ä¸å¾®ä¿¡æ«ç æ¯ä»ï A-线ä¸é¶èæ«ç æ¯ä»ï B-çº¿ä¸æ¯ä»å®æ«ç æ¯ä»ï C-线ä¸å¾®ä¿¡æ«ç æ¯ä»ï D-线ä¸é¶èæ«ç æ¯ä» |
| | | formData.put("PayTypCd", payTypCd); |
| | | formData.put("OrderTitle", orderTitle); |
| | | formData.put("CurrencyCd", "CNY"); |
| | | //弿¥éç¥Url |
| | | formData.put("MerUrl", merUrl); |
| | | //æä½å |
| | | formData.put("OperatorId", operatorId); |
| | | |
| | | //æ¯ä»è®¢åå· |
| | | formData.put("MerSeqNbr", merSeqNbr); |
| | | String body = sendForm(nxPayHttpClient, formData); |
| | | log.info("----------------- 颿¯ä» ç»æ ----------------- "); |
| | | return body; |
| | | } |
| | | |
| | | /** |
| | | * ç¨æ·ä¸»å¨æ«ç çæ |
| | | * ç¨æ·éè¦æ«æåæ·æ¶æ¬¾ç å¨ç è¿è¡æ¯ä»æ¶ï¼éè¿æ¤æ¥å£çæåæ·æ¶æ¬¾ç å¨ç ï¼ç产ä¸ç°å¨å¾®ä¿¡ä¸»æ«å¨ç å·²ç»åæ¢ä½¿ç¨ã |
| | | * |
| | | * @param subMerchantId äºçº§åæ·å· |
| | | * @param branchId äº¤ææºæå· |
| | | * @param merSeqNbr åæ·æ»äº¤ææµæ°´å· |
| | | * @param transAmt äº¤ææ»éé¢ |
| | | * @param timeStamp åæ·äº¤ææ¶é´ |
| | | * @param channelNbr æ¸ éç¼å· 01-O2O 02-B2C 03-æ«ç |
| | | * @param payTypCd B æ¯ä»å®æ«ç æ¯ä» C 微信æ«ç æ¯ä» D é¶èæ«ç æ¯ä» |
| | | * @param orderTitle è®¢åæ é¢ |
| | | */ |
| | | public String dyActiveQrCode(String subMerchantId, String branchId, String merSeqNbr, long transAmt, String timeStamp, String channelNbr, char payTypCd, |
| | | String merUrl, String orderTitle) { |
| | | log.info("----------------- ç¨æ·ä¸»å¨æ«ç çæ å¼å§ 订åå·ä¸º: {}ï¼è®¢åéé¢ä¸º:{}----------------- ", merSeqNbr, transAmt); |
| | | HttpRequest nxPayHttpClient = nxPayConfig.getPayCloseableHttpClient(); |
| | | //请æ±åºåå·ãæ¸ é端产çï¼ä¸ç¬ä¸å¡çå¯ä¸æ è¯ï¼è´¯ç©¿æ´ä¸ªäº¤æå§ç»ãæ¸ é代ç ï¼2ä½ï¼+æ¥æï¼yyMMdd 6ä½ï¼+æµæ°´å·ï¼24ä½ï¼appCode+å©ä½ä½æ°æµæ°´å·ï¼ |
| | | // String sequenceId = getSequenceId(timeStamp, nxPayConfig.getAppCode()); |
| | | // nxPayHttpClient.header("sequenceId", sequenceId); |
| | | nxPayHttpClient.header("timestamp", timeStamp); |
| | | nxPayHttpClient.header("transCode", HnnxConstant.TRANS_CODE_DYACTIVEQRCODE_PAY); |
| | | nxPayHttpClient.header("branchId", branchId); |
| | | |
| | | // æ¼æ¥ä¸å¡æ°æ® |
| | | HashMap<String, Object> formData = new HashMap<>(); |
| | | // ä¸çº§åæ·å· |
| | | formData.put("MerNbr", nxPayConfig.getMerNbr()); |
| | | //åæ·æ»äº¤ææµæ°´å· |
| | | formData.put("MerSeqNbr", merSeqNbr); |
| | | //äº¤ææ»éé¢ |
| | | formData.put("TransAmt", convertToYuan(transAmt)); |
| | | //åæ·äº¤ææ¶é´ |
| | | formData.put("MerTransDateTime", timeStamp); |
| | | //æ¸ éç¼å· 01-O2O 02-B2C 03-æ«ç |
| | | formData.put("ChannelNbr", channelNbr); |
| | | formData.put("CurrencyCd", "CNY"); |
| | | //æ¯ä»æ¹å¼ B æ¯ä»å®æ«ç æ¯ä» C 微信æ«ç æ¯ä» D é¶èæ«ç æ¯ä» |
| | | formData.put("PayTypCd", payTypCd); |
| | | // äºçº§åæ·ç¼å· |
| | | formData.put("SubMerchantId", subMerchantId); |
| | | //弿¥éç¥Url |
| | | formData.put("MerUrl", merUrl); |
| | | formData.put("OrderTitle", orderTitle); |
| | | |
| | | String body = sendForm(nxPayHttpClient, formData); |
| | | log.info("----------------- ç¨æ·ä¸»å¨æ«ç çæ ç»æ ----------------- "); |
| | | return body; |
| | | } |
| | | |
| | | /** |
| | | * ç¨æ·è¢«æ«æ¯ä» |
| | | * ç¬¬ä¸æ¹å¹³å°æ«æç¨æ·ä»æ¬¾ç ï¼éè¿æ¤æ¥å£æäº¤æ¯ä» |
| | | */ |
| | | public String coretoall(String subMerchantId, String branchId, String merSeqNbr, long transAmt, String payAuthCode, String timeStamp, String channelNbr, |
| | | String merUrl, String orderTitle, String terminalCode) { |
| | | log.info("----------------- ç¨æ·è¢«æ«æ¯ä» å¼å§, 订åç¼å·= {} ï¼è®¢åéé¢ä¸º:{}----------------- ", merSeqNbr, transAmt); |
| | | HttpRequest nxPayHttpClient = nxPayConfig.getPayCloseableHttpClient(); |
| | | |
| | | nxPayHttpClient.header("timestamp", timeStamp); |
| | | nxPayHttpClient.header("transCode", HnnxConstant.TRANS_CODE_CORETOALL_PAY); |
| | | nxPayHttpClient.header("branchId", branchId); |
| | | |
| | | // æ¼æ¥ä¸å¡æ°æ® |
| | | HashMap<String, Object> formData = new HashMap<>(); |
| | | // ä¸çº§åæ·å· |
| | | formData.put("MerNbr", nxPayConfig.getMerNbr()); |
| | | //åæ·æ»äº¤ææµæ°´å· |
| | | formData.put("MerSeqNbr", merSeqNbr); |
| | | //äº¤ææ»éé¢ |
| | | formData.put("TransAmt", convertToYuan(transAmt)); |
| | | //åæ·äº¤ææ¶é´ |
| | | formData.put("MerTransDateTime", timeStamp); |
| | | //äºç»´ç |
| | | formData.put("QrCodeInfo", payAuthCode); |
| | | //æ¸ éç¼å· 01-O2O 02-B2C 03-æ«ç |
| | | formData.put("ChannelNbr", channelNbr); |
| | | formData.put("CurrencyCd", HnnxConstant.CURRENCYCD); |
| | | formData.put("AreaInfo", HnnxConstant.AREAINFO); |
| | | |
| | | // äºçº§åæ·ç¼å· |
| | | formData.put("SubMerchantId", subMerchantId); |
| | | //订å详æ
|
| | | formData.put("OrderTitle", orderTitle); |
| | | //弿¥éç¥Url |
| | | formData.put("MerUrl", merUrl); |
| | | //åæ·ç»ç«¯è®¾å¤ç±»å |
| | | formData.put("TerminalType", "04"); |
| | | //ç»ç«¯ç¼å· ç±æåå¨å管添å ç»ç«¯æ¶çæ |
| | | formData.put("Equipid", "002000156"); |
| | | //ç»ç«¯åºåå· |
| | | formData.put("Equipseqnbr", "000002041170132246"); |
| | | formData.put("Lgtude", "113.988007"); |
| | | formData.put("Lttude", "34.819642"); |
| | | formData.put("AppVersion", "01234567"); |
| | | String body = sendForm(nxPayHttpClient, formData); |
| | | log.info("----------------- ç¨æ·è¢«æ«æ¯ä» ç»æ ----------------- "); |
| | | return body; |
| | | } |
| | | |
| | | /** |
| | | * 订å交æç¶ææ¥è¯¢ |
| | | * ï¬æ¥å£è¯´æ |
| | | * 该æ¥å£æä¾æ¯ä»ã鿬¾äº¤æç交æç¶ææ¥è¯¢ã |
| | | * æ ¹æ®äº¤æç¶æTransStatusç¡®å®äº¤æç»æï¼ |
| | | * å¾®ä¿¡éæ¬¾äº¤æç¶ææ¥è¯¢ï¼éé¶è¡å¡äº¤æä¸è¬å¨15ç§å
坿¥è¯¢äº¤ææåï¼é¶è¡å¡äº¤æé款éå¨ä¸¤åéå坿¥è¯¢å°äº¤ææåã |
| | | * |
| | | * @param merSeqNbr è®¢åæµæ°´å· |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public String qryQrOrderStatus(String merSeqNbr, String branchId) { |
| | | log.info("----------------- 订å交æç¶ææ¥è¯¢ å¼å§----------------- "); |
| | | HttpRequest nxPayHttpClient = nxPayConfig.getPayCloseableHttpClient(); |
| | | String timeStamp = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN); |
| | | //请æ±åºåå·ãæ¸ é端产çï¼ä¸ç¬ä¸å¡çå¯ä¸æ è¯ï¼è´¯ç©¿æ´ä¸ªäº¤æå§ç»ãæ¸ é代ç ï¼2ä½ï¼+æ¥æï¼yyMMdd 6ä½ï¼+æµæ°´å·ï¼24ä½ï¼appCode+å©ä½ä½æ°æµæ°´å·ï¼ |
| | | // String sequenceId = getSequenceId(timeStamp, nxPayConfig.getAppCode()); |
| | | // nxPayHttpClient.header("sequenceId", sequenceId); |
| | | nxPayHttpClient.header("timestamp", timeStamp); |
| | | nxPayHttpClient.header("transCode", HnnxConstant.TRANS_CODE_QRYQRORDERSTATUS_PAY); |
| | | nxPayHttpClient.header("branchId", branchId); |
| | | |
| | | // æ¼æ¥ä¸å¡æ°æ® |
| | | HashMap<String, Object> formData = new HashMap<>(); |
| | | // ä¸çº§åæ·å· |
| | | formData.put("MerNbr", nxPayConfig.getMerNbr()); |
| | | //åæ·æ»äº¤ææµæ°´å· |
| | | formData.put("MerSeqNbr", merSeqNbr); |
| | | |
| | | String body = sendForm(nxPayHttpClient, formData); |
| | | log.info("----------------- 订å交æç¶ææ¥è¯¢ ç»æ ----------------- "); |
| | | return body; |
| | | } |
| | | |
| | | /** |
| | | * 鿬¾ |
| | | * |
| | | * @param subMerchantId 忝ä»äº¤æäºçº§åæ·å· |
| | | * @param branchId |
| | | * @param merSeqNbr è¦é款ç订åå· |
| | | * @param merSeqDate è¦é款ç订åäº¤ææ¥æ ä¾ï¼20190810 |
| | | * @param origTransAmt è¦é款ç订åç交æéé¢ |
| | | * @param transAmt 鿬¾éé¢ |
| | | * @param timeStamp å½åæ¥æ ä¾ï¼yyyyMMddHHmmss |
| | | * @return |
| | | */ |
| | | public String returntrans(String subMerchantId, String branchId, String merSeqNbr, String merSeqDate, long origTransAmt, |
| | | long transAmt, String timeStamp) { |
| | | log.info("----------------- 鿬¾ å¼å§----------------- "); |
| | | HttpRequest nxPayHttpClient = nxPayConfig.getPayCloseableHttpClient(); |
| | | nxPayHttpClient.header("timestamp", timeStamp); |
| | | nxPayHttpClient.header("transCode", HnnxConstant.TRANS_CODE_RETURNTRANS_PAY); |
| | | nxPayHttpClient.header("branchId", branchId); |
| | | |
| | | // æ¼æ¥ä¸å¡æ°æ® |
| | | HashMap<String, Object> formData = new HashMap<>(); |
| | | // ä¸çº§åæ·å· |
| | | formData.put("MerNbr", nxPayConfig.getMerNbr()); |
| | | //åæ·æ»äº¤ææµæ°´å· |
| | | formData.put("MerSeqNbr", "TK_" + merSeqNbr); |
| | | //éè´§äº¤ææ¶é´ |
| | | formData.put("MerTransDateTime", timeStamp); |
| | | |
| | | //ååæ·æµæ°´ |
| | | formData.put("OrigMerSeqNbr", merSeqNbr); |
| | | //ååæ·æ¥æ |
| | | formData.put("OrigMerDate", merSeqDate); |
| | | //忝ä»äº¤æéé¢ |
| | | formData.put("OrigTransAmt", convertToYuan(origTransAmt)); |
| | | //äºçº§åæ·å· |
| | | formData.put("SubMerchantId", subMerchantId); |
| | | |
| | | //éè´§äºçº§åæ·æµæ°´å·ï¼éæºçæï¼ä¸å
许åºç°éå¤ï¼å¯ä»¥åä¸çº§åæ·äº¤ææµæ°´å·ä¿æä¸è´ï¼ |
| | | formData.put("SubMerSeqNo", "TK_" + merSeqNbr); |
| | | //äºçº§åæ·æ¶é´ |
| | | formData.put("SubMerDateTime", timeStamp); |
| | | //äºçº§åæ·é货交æéè´§éé¢ |
| | | formData.put("SubTransAmt", convertToYuan(transAmt)); |
| | | //åäºçº§åæ·æ¯ä»æµæ°´å·ï¼ä¸åæ¯ä»äº¤æä¸çº§åæ·å·æµæ°´å·ä¸è´ï¼ |
| | | formData.put("OrigSubMerSeqNo", merSeqNbr); |
| | | //åäºçº§åæ·æ¯ä»äº¤ææ¥æï¼ä¾ï¼20190810ï¼ |
| | | formData.put("OrigSubMerDate", merSeqDate); |
| | | //订åå· ä¸äºçº§åæ·æµæ°´å·ä¿æä¸è´ |
| | | formData.put("OrderNbr", merSeqNbr); |
| | | String body = sendForm(nxPayHttpClient, formData); |
| | | log.info("----------------- 鿬¾ ç»æ----------------- "); |
| | | return body; |
| | | } |
| | | |
| | | /** |
| | | * 对账æ¥è¯¢ |
| | | * String subMerchantId, String branchId, |
| | | * |
| | | * @param clearDate å¯¹è´¦æ¥æ YYYY-MM-DD |
| | | * @param branchId äº¤ææºæå· |
| | | * @return |
| | | */ |
| | | public String accountqry(String clearDate, String branchId) { |
| | | log.info("----------------- å¯¹å¸ å¼å§----------------- "); |
| | | HttpRequest nxPayHttpClient = nxPayConfig.getPayCloseableHttpClient(); |
| | | nxPayHttpClient.header("timestamp", DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN)); |
| | | nxPayHttpClient.header("transCode", HnnxConstant.TRANS_CODE_ACCOUNTQRY_PAY); |
| | | nxPayHttpClient.header("branchId", branchId); |
| | | |
| | | // æ¼æ¥ä¸å¡æ°æ® |
| | | HashMap<String, Object> formData = new HashMap<>(); |
| | | formData.put("ClearDate", clearDate); |
| | | |
| | | String body = sendForm(nxPayHttpClient, formData); |
| | | log.info("----------------- å¯¹å¸ ç»æ----------------- "); |
| | | return body; |
| | | } |
| | | |
| | | // 订åå·çæè§å âæ¸ éç®ç§°-订åå·-主/伿 -åèµ·æ¯ä»æ¬¡æ°âææ |
| | | // ä¾å¦ååç主订åç¬¬ä¸æ¬¡åèµ·æ¯ä»ï¼è®¢åå·å°±æ¯âSQ-åå订åid-Z-1â |
| | | // 妿è¿ä¸ªè®¢åå
³èæä¼æ éï¼ä¼æ é订åå·å°±æ¯"SQ-åå订åid-Y-1" |
| | | public static String getNxPayOrderId(String prefix, long orderId, char orderType, short tryNum) { |
| | | return new StringBuilder(prefix).append("-").append(orderId).append("-").append(orderType).append("-").append(tryNum).toString(); |
| | | } |
| | | |
| | | /** |
| | | * éªç¾ |
| | | * |
| | | * @return |
| | | */ |
| | | public boolean verify(String body) { |
| | | log.info("è¿åå¼éªç¾ body 为: {}", body); |
| | | log.info("----------- è¿åå¼éªç¾ å¼å§ ----------- "); |
| | | boolean verfiy = false; |
| | | try { |
| | | Map<String, Object> bodyMap = JSON.parseObject(body, Feature.OrderedField); |
| | | String sign = (String) bodyMap.remove("signature"); |
| | | String payload = (String) bodyMap.remove("payload"); |
| | | |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | if (payload != null) { |
| | | Map payloadMap = objectMapper.readValue(payload, Map.class); |
| | | bodyMap.putAll(payloadMap); |
| | | } |
| | | String palin = null; |
| | | palin = Permutation.sort(bodyMap, "UTF-8"); |
| | | log.info("æåºåçå符串ï¼{}", palin); |
| | | if (StringUtils.isNotEmpty(sign)) { |
| | | verfiy = verifier.verify(HnnxConstant.ALGORITHM, palin.getBytes(), Hex.toByte(sign), nxPayPublicKey); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | log.error("è¿åå¼éªç¾ ç»æï¼{}", verfiy); |
| | | log.info("----------- è¿åå¼éªç¾ ç»æ ----------- "); |
| | | return verfiy; |
| | | } |
| | | |
| | | public boolean kjVerify(String sign, String palin) { |
| | | log.info("è¿åå¼éªç¾ palin 为: {}", palin); |
| | | log.info("è¿åå¼éªç¾ sign 为: {}", sign); |
| | | log.info("----------- è¿åå¼éªç¾ å¼å§ ----------- "); |
| | | boolean verfiy = false; |
| | | try { |
| | | if (StringUtils.isNotEmpty(sign)) { |
| | | verfiy = verifier.verify(HnnxConstant.KJ_ALGORITHM, palin.getBytes(), Base64.getDecoder().decode(sign), nxKjPayPublicKey); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | log.error("è¿åå¼éªç¾ ç»æï¼{}", verfiy); |
| | | log.info("----------- è¿åå¼éªç¾ ç»æ ----------- "); |
| | | return verfiy; |
| | | } |
| | | |
| | | /** |
| | | * éç¨å¿«æ·æ¯ä» |
| | | * |
| | | * @param merSeqNbr åæ·æµæ°´å· |
| | | * @param subMerchantId äºçº§åæ·å· |
| | | * @param backURL åå°éç¥URL |
| | | * @param frontURL è¿åå端URL |
| | | */ |
| | | public String quickPayRequest(String subMerchantId, String merSeqNbr, long transAmt, String nowTime, |
| | | String frontURL, String backURL, String orderTitle) { |
| | | log.info("----------------- éç¨å¿«æ·æ¯ä» å¼å§, 订åç¼å·= {} ï¼è®¢åéé¢ä¸º:{}----------------- ", merSeqNbr, transAmt); |
| | | |
| | | |
| | | // æ¼æ¥ä¸å¡æ°æ® |
| | | JSONObject formData = new JSONObject(); |
| | | formData.put("deviceType", "5"); |
| | | |
| | | HashMap<String, Object> plainData = new HashMap<>(); |
| | | // plain å¼å§ |
| | | //ä¸çº§åæ·id |
| | | // plainData.put("merchId", "010020170801000001"); |
| | | plainData.put("merchId", nxPayConfig.getKjMerNbr()); |
| | | //伿 åéé¢ disCountAmt |
| | | //订ååç§° orderName |
| | | plainData.put("orderName", orderTitle); |
| | | //å¸ç§ ccy |
| | | plainData.put("ccy", "01"); |
| | | //è¿åå端URL frontURL |
| | | plainData.put("frontURL", frontURL); |
| | | //åå°éç¥URL backURL |
| | | plainData.put("backURL", backURL); |
| | | //订å夿³¨ orderRemark |
| | | plainData.put("orderRemark", ""); |
| | | //æ¸ éå· channelNbr |
| | | plainData.put("channelNbr", "02"); |
| | | //äº¤ææ»éé¢ txnAmt |
| | | plainData.put("txnAmt", convertToYuan(transAmt)); |
| | | //åæ·æµæ°´å· merSeqNbr |
| | | plainData.put("merSeqNbr", merSeqNbr); |
| | | //äº¤ææ¶é´ orderTime |
| | | plainData.put("orderTime", nowTime); |
| | | //æ¶æ¬¾æ¹åç§° payee |
| | | //伿 æ´»å¨åç§° specialOffers |
| | | |
| | | //åæ·è®¢åå· merchOrderId |
| | | plainData.put("merchOrderId", merSeqNbr); |
| | | |
| | | JSONArray plainMerTrans = new JSONArray(); |
| | | JSONObject plainMerTransData1 = new JSONObject(); |
| | | //å交æéé¢ |
| | | plainMerTransData1.put("subTransAmt", convertToYuan(transAmt)); |
| | | //äºçº§åæ·å· |
| | | plainMerTransData1.put("subMerchantId", subMerchantId); |
| | | //äºçº§åæ·äº¤ææ¶é´ subMerDateTime |
| | | plainMerTransData1.put("subMerDateTime", nowTime); |
| | | //åæµæ°´å· subMerSeqNo |
| | | plainMerTransData1.put("subMerSeqNo", merSeqNbr); |
| | | //äºçº§åæ·åç§° subMerchantName |
| | | plainMerTransData1.put("subMerchantName", ""); |
| | | //äºçº§åæ·ååä¿¡æ¯ productInfo |
| | | plainMerTransData1.put("productInfo", ""); |
| | | //äºçº§åæ·ä¿¡æ¯ subMerImport |
| | | // plainMerTransData1.put("subMerImport", "å¦è´¹"); |
| | | // plainMerTransData1.put("subMerImport", orderTitle); |
| | | //å¡å¸å· platCouponId |
| | | plainMerTransData1.put("platCouponId", ""); |
| | | //åå¡å¸äº¤æéé¢ platCouponAmount |
| | | plainMerTransData1.put("platCouponAmount", ""); |
| | | //åç§¯åæ° bonusPoint |
| | | plainMerTransData1.put("bonusPoint", ""); |
| | | //å积å交æéé¢ bonusPointAmount |
| | | plainMerTransData1.put("bonusPointAmount", ""); |
| | | |
| | | // plainMerTransData1.put("subInteralAmt", "0.01"); |
| | | // plainMerTransData1.put("subCouponAmt", ""); |
| | | |
| | | plainMerTrans.add(plainMerTransData1); |
| | | plainData.put("MerTransList", plainMerTrans); |
| | | |
| | | String plainStr = JSONObject.toJSONString(plainData); |
| | | log.info("请æ±åæ°ï¼{}", plainStr); |
| | | // formData.put("plain", plainData); |
| | | formData.put("plain", plainStr); |
| | | // plain ç»æ |
| | | |
| | | // å¼å§ç¾å |
| | | String signature = kjSign(plainStr); |
| | | formData.put("signature", signature); |
| | | // writeToFile(signature, plainStr); |
| | | |
| | | HttpResponse httpResponse = HttpRequest.post(nxPayConfig.getKjUrl() + HnnxConstant.QUICK_PAY_URL) |
| | | .contentType("application/x-www-form-urlencoded;") |
| | | .form(formData.getInnerMap()) |
| | | .timeout(20000)//è¶
æ¶ï¼æ¯«ç§ |
| | | .execute(); |
| | | String location = null; |
| | | log.info("----------------- éç¨å¿«æ·æ¯ä» ç»æ ----------------- "); |
| | | if (httpResponse.getStatus() == 302) { |
| | | location = httpResponse.header("Location"); |
| | | // writeToFile(location); |
| | | return location; |
| | | }else { |
| | | throw new RuntimeException(httpResponse.body()); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * å¿«æ·æ¯ä» 订åç¶ææ¥è¯¢ |
| | | * |
| | | * @param orderNbr 订åç¼å· |
| | | * @param startDate èµ·å§æ¥æ yyyyMMdd |
| | | * @param endDate ç»ææ¥æ yyyyMMdd |
| | | * @param pageSize æ¯é¡µè®°å½æ° |
| | | * @param pageNum å½å第å 页 |
| | | * @return |
| | | */ |
| | | |
| | | public String quickPayOrderQueryRequest(String orderNbr, String startDate, String endDate, int pageSize, int pageNum) { |
| | | log.info("----------------- å¿«æ·æ¯ä»è®¢å交æç¶ææ¥è¯¢ å¼å§----------------- "); |
| | | String body = null; |
| | | JSONObject formData = new JSONObject(); |
| | | formData.put("MerNbr", nxPayConfig.getKjMerNbr()); |
| | | //订åç¼å· |
| | | if (StringUtils.isNotEmpty(orderNbr)) { |
| | | formData.put("OrderNbr", orderNbr); |
| | | } |
| | | //èµ·å§æ¥æ |
| | | if (StringUtils.isNotEmpty(orderNbr)) { |
| | | formData.put("StartDate", startDate); |
| | | } |
| | | //ç»ææ¥æ |
| | | if (StringUtils.isNotEmpty(orderNbr)) { |
| | | formData.put("EndDate", endDate); |
| | | } |
| | | //æ¯é¡µè®°å½æ° |
| | | formData.put("PageSize", pageSize); |
| | | //å½å第å 页 |
| | | formData.put("PageNum", pageNum); |
| | | log.info("å¿«æ·æ¯ä»è®¢åæ¥è¯¢åæ°:{}", formData); |
| | | body = HttpRequest.post(nxPayConfig.getKjUrl() + HnnxConstant.QUICK_PAY_QUERY_URL) |
| | | .contentType("application/x-www-form-urlencoded;") |
| | | .form(formData.getInnerMap()) |
| | | .timeout(20000)//è¶
æ¶ï¼æ¯«ç§ |
| | | .execute().body(); |
| | | log.info("å¿«æ·æ¯ä»è®¢åæ¥è¯¢è¯·æ±ç»æ:{}", body); |
| | | log.info("----------------- å¿«æ·æ¯ä»è®¢å交æç¶ææ¥è¯¢ ç»æ ----------------- "); |
| | | return body; |
| | | } |
| | | |
| | | /** |
| | | * 鿬¾ |
| | | * |
| | | * @param subMerchantId 忝ä»äº¤æäºçº§åæ·å· |
| | | * @param merSeqNbr è¦é款ç订åå· |
| | | * @param merSeqDate è¦é款ç订åäº¤ææ¥æ yyyyMMdd ä¾ï¼20190810 |
| | | * @param origTransAmt è¦é款ç订åç交æéé¢ |
| | | * @param transAmt 鿬¾éé¢ |
| | | * @param timeStamp å½åæ¥æ ä¾ï¼yyyyMMddHHmmss |
| | | * @return |
| | | */ |
| | | public String quickPayReturntrans(String subMerchantId, String merSeqNbr, String merSeqDate, long origTransAmt, |
| | | long transAmt, String timeStamp) { |
| | | log.info("----------------- 鿬¾ å¼å§----------------- "); |
| | | String timeStampWithSpace = timeStamp.substring(0, 8) + " " + timeStamp.substring(8); |
| | | // æ¼æ¥ä¸å¡æ°æ® |
| | | HashMap<String, Object> formData = new HashMap<>(); |
| | | // ä¸çº§åæ·å· |
| | | formData.put("MerNbr", nxPayConfig.getKjMerNbr()); |
| | | //åæ·æ»äº¤ææµæ°´å· |
| | | formData.put("MerSeqNbr", "TK_" + merSeqNbr); |
| | | //éè´§äº¤ææ¶é´ yyyyMMdd HHmmss å·®å¼!!!! |
| | | formData.put("MerTransDateTime", timeStampWithSpace); |
| | | // formData.put("MerTransDateTime", timeStamp); |
| | | |
| | | //ååæ·æµæ°´ |
| | | formData.put("OrigMerSeqNbr", merSeqNbr); |
| | | //ååæ·æ¥æ |
| | | formData.put("OrigMerDate", merSeqDate); |
| | | //忝ä»äº¤æéé¢ |
| | | formData.put("OrigTransAmt", convertToYuan(origTransAmt)); |
| | | |
| | | //äºçº§åæ·å· |
| | | formData.put("SubMerchantId", subMerchantId); |
| | | //éè´§äºçº§åæ·æµæ°´å·ï¼éæºçæï¼ä¸å
许åºç°éå¤ï¼å¯ä»¥åä¸çº§åæ·äº¤ææµæ°´å·ä¿æä¸è´ï¼ |
| | | formData.put("SubMerSeqNo", "TK_" + merSeqNbr); |
| | | //äºçº§åæ·æ¶é´ |
| | | formData.put("SubMerDateTime", timeStampWithSpace); |
| | | // formData.put("SubMerDateTime", timeStamp); |
| | | //äºçº§åæ·é货交æéè´§éé¢ |
| | | formData.put("SubTransAmt", convertToYuan(transAmt)); |
| | | |
| | | |
| | | //åäºçº§åæ·æ¯ä»æµæ°´å·ï¼ä¸åæ¯ä»äº¤æä¸çº§åæ·å·æµæ°´å·ä¸è´ï¼ |
| | | formData.put("OrigSubMerSeqNo", merSeqNbr); |
| | | //åäºçº§åæ·æ¯ä»äº¤ææ¥æï¼ä¾ï¼20190810ï¼ |
| | | formData.put("OrigSubMerDate", merSeqDate); |
| | | //订åå· ä¸äºçº§åæ·æµæ°´å·ä¿æä¸è´ |
| | | formData.put("OrderNbr", merSeqNbr); |
| | | log.info("å¿«æ·æ¯ä»è®¢å鿬¾åæ°ï¼{}", formData); |
| | | |
| | | String body = null; |
| | | HttpResponse httpResponse = HttpRequest.post(nxPayConfig.getKjUrl() + HnnxConstant.QUICK_PAY_RETURN_URL) |
| | | .contentType("application/x-www-form-urlencoded;") |
| | | .form(formData) |
| | | .timeout(20000)//è¶
æ¶ï¼æ¯«ç§ |
| | | .execute(); |
| | | body = httpResponse.body(); |
| | | log.info(" å¿«æ·æ¯ä»éæ¬¾ç»æï¼{}", body); |
| | | log.info("----------------- 鿬¾ ç»æ----------------- "); |
| | | return body; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.hnnx.hnnxPay; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fasterxml.jackson.databind.node.ContainerNode; |
| | | import com.nuvole.common.domain.emnu.CommonResultEmnu; |
| | | import com.nuvole.common.domain.result.CommonResult; |
| | | import com.nuvole.constants.PropertiesConstants; |
| | | import com.nuvole.hnnx.conf.NxPayConfig; |
| | | import com.nuvole.hnnx.orderQueryTask.OrderQueryTask; |
| | | import com.nuvole.hnnx.orderQueryTask.OrderQueryUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @ClassName NXPayService |
| | | * @Author cy |
| | | * @Date 2023/10/6 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | @Service |
| | | @Slf4j |
| | | //@ConditionalOnClass(name = "com.nuvole.hnnx.conf.NxPayConfig") |
| | | public class NXPayService { |
| | | |
| | | @Autowired(required = false) |
| | | private NXHttpClientUtils nxHttpClientUtils; |
| | | @Autowired |
| | | private NxPayConfig nxPayConfig; |
| | | @Autowired |
| | | private ApplicationEventPublisher eventPublisher; |
| | | |
| | | public String getPlatSubMerchantId() { |
| | | return nxHttpClientUtils.getPlatSubMerchantId(); |
| | | } |
| | | public String getKjPlatSubMerchantId() { |
| | | return nxHttpClientUtils.getKjPlatSubMerchantId(); |
| | | } |
| | | public String getBranchId() { |
| | | return nxHttpClientUtils.getBranchId(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * C æ« B ç»ä¸ä¸å |
| | | * |
| | | * @param payConfig æ¯ä»åæ°èå对象 |
| | | * @param orderId åæ·è®¢åå· |
| | | * @param payMoney è®¢åæ»éé¢ï¼åªè½ä¸ºæ´æ° |
| | | * @param title è®¢åæ é¢ |
| | | * @param authCode 微信/æ¯ä»å®ï¼è¿åçææç ï¼æ¯ä»ä¸å¿éè¿ææç è·åç¨æ·openId,以便è¿è¡åç»ä¸å交æã |
| | | * @param timeStamp æ¶é´æ³ |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public CommonResult<JSONObject> wxScanUnifiedorder(JSONObject payConfig, String orderId, Long payMoney, String title, String goodsInfo, String authCode, String notifyUrl, |
| | | String timeStamp) { |
| | | log.info("ãæ²³ååä¿¡-Cæ«B微信æ¯ä»ã ç»ä¸ä¸åå¼å§, 订åç¼å·=" + orderId); |
| | | //éªè¯éé¢ |
| | | if (payMoney <= 0 && payMoney <= 0) { |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, "æ¯ä»å¤±è´¥,ä¸è½0å
æ¯ä»ï¼"); |
| | | } |
| | | // äºçº§åæ·å· |
| | | String subMerchantId = payConfig.getString("subMerchantId"); |
| | | //äº¤ææºæå· |
| | | String branchId = payConfig.getString("branchId"); |
| | | String operatorId = payConfig.getString("operatorId"); |
| | | |
| | | // åä¿¡ 微信æ¯ä» |
| | | String onlinePayResp = null; |
| | | |
| | | onlinePayResp = nxHttpClientUtils.qrCodePrePay(subMerchantId, branchId, operatorId, orderId, authCode, payMoney, timeStamp, "03", 'C', notifyUrl, title); |
| | | |
| | | JSONObject onlinePayRespObj = JSONObject.parseObject(onlinePayResp); |
| | | String respCode = onlinePayRespObj.getString("code"); |
| | | if (!"000000".equals(respCode)) { |
| | | log.error("æ²³ååä¿¡-Cæ«Bæ¯ä»ä¸å失败ï¼éè¯¯ç»æç :{},éè¯¯ç»ææè¿°:{}", respCode, onlinePayRespObj.getString("message")); |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, onlinePayRespObj.getString("message")); |
| | | } |
| | | JSONObject onlinePayResult = onlinePayRespObj.getJSONObject("payload"); |
| | | onlinePayRespObj.put("toPayMethod", "2"); |
| | | JSONObject resultMap = nxPreConvertWxParam(onlinePayResult); |
| | | onlinePayRespObj.put("paymentData", resultMap); |
| | | onlinePayRespObj.remove("payload"); |
| | | // OrderQueryTask orderQueryTask = ApplicationContextUtil.getBean(OrderQueryTask.class); |
| | | // orderQueryTask.setOrderId(orderId); |
| | | // orderQueryTask.setPayService((short) 7); |
| | | // orderQueryTask.setPayType((short) 1); |
| | | // orderQueryTask.setOrderPayTime(new Date()); |
| | | OrderQueryTask orderQueryTask = new OrderQueryTask(eventPublisher, this,nxPayConfig,orderId,(short)7,(short)1,new Date()); |
| | | OrderQueryUtil.addTask(orderQueryTask); |
| | | return new CommonResult(onlinePayRespObj); |
| | | } |
| | | |
| | | public static String getFrontUrl(String orderId, Map youHuiInfo){ |
| | | return HnnxConstant.NX_KJ_FRONT_URL.substring(0,56); |
| | | // String frontUrl = HnnxConstant.NX_KJ_FRONT_URL.replace("${ORDERID}", orderId + ""); |
| | | // if (youHuiInfo == null){ |
| | | // return URLEncoder.encode(frontUrl.replace("${YOUHUIINFO}", "")); |
| | | // } |
| | | // return URLEncoder.encode(frontUrl.replace("${YOUHUIINFO}", JSONObject.toJSONString(youHuiInfo))); |
| | | } |
| | | |
| | | private JSONObject nxPreConvertWxParam(JSONObject payload) { |
| | | if (payload == null) { |
| | | return payload; |
| | | } |
| | | payload.put("appId", payload.remove("AppId")); |
| | | payload.put("timeStamp", payload.remove("TimeStamp")); |
| | | payload.put("nonceStr", payload.remove("Charset")); |
| | | payload.put("package", payload.remove("Subject")); |
| | | payload.put("signType", payload.remove("SignType")); |
| | | payload.put("paySign", payload.remove("Sign")); |
| | | payload.put("orderNo", payload.remove("MerSeqNbr")); |
| | | return payload; |
| | | } |
| | | |
| | | /** |
| | | * C æ« B ç»ä¸ä¸å |
| | | * |
| | | * @param payConfig æ¯ä»åæ°èå对象 |
| | | * @param orderId åæ·è®¢åå· |
| | | * @param payMoney è®¢åæ»éé¢ï¼åªè½ä¸ºæ´æ° |
| | | * @param title è®¢åæ é¢ |
| | | * @param authCode 微信/æ¯ä»å®ï¼è¿åçææç ï¼æ¯ä»ä¸å¿éè¿ææç è·åç¨æ·openId,以便è¿è¡åç»ä¸å交æã |
| | | * @param timeStamp æ¶é´æ³ |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public CommonResult<JSONObject> zfbScanUnifiedorder(JSONObject payConfig, String orderId, Long payMoney, String title, String goodsInfo, String authCode, String notifyUrl, |
| | | String timeStamp) { |
| | | log.info("ãæ²³ååä¿¡-Cæ«Bæ¯ä»-æ¯ä»å®ã ç»ä¸ä¸åå¼å§, 订åç¼å·=" + orderId); |
| | | //éªè¯éé¢ |
| | | if (payMoney <= 0 && payMoney <= 0) { |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, "æ¯ä»å¤±è´¥,ä¸è½0å
æ¯ä»ï¼"); |
| | | } |
| | | // äºçº§åæ·å· |
| | | String subMerchantId = payConfig.getString("subMerchantId"); |
| | | //äº¤ææºæå· |
| | | String branchId = payConfig.getString("branchId"); |
| | | String operatorId = payConfig.getString("operatorId"); |
| | | |
| | | // åä¿¡ 微信æ¯ä» |
| | | String onlinePayResp = null; |
| | | onlinePayResp = nxHttpClientUtils.qrCodePrePay(subMerchantId, branchId, operatorId, orderId, authCode, payMoney, timeStamp, "03", 'B', notifyUrl, title); |
| | | JSONObject onlinePayRespObj = JSONObject.parseObject(onlinePayResp); |
| | | String respCode = onlinePayRespObj.getString("code"); |
| | | if (!"000000".equals(respCode)) { |
| | | log.error("æ²³ååä¿¡-Cæ«Bæ¯ä»æ¯ä»å®ä¸å失败ï¼éè¯¯ç»æç :{},éè¯¯ç»ææè¿°:{}", respCode, onlinePayRespObj.getString("message")); |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, onlinePayRespObj.getString("message")); |
| | | } |
| | | JSONObject onlinePayResult = onlinePayRespObj.getJSONObject("payload"); |
| | | onlinePayResult.put("toPayMethod", "2"); |
| | | JSONObject paymentData = new JSONObject(); |
| | | paymentData.put("tradeNO", onlinePayResult.remove("TradeNo")); |
| | | onlinePayResult.put("paymentData", paymentData); |
| | | // OrderQueryTask orderQueryTask = ApplicationContextUtil.getBean(OrderQueryTask.class); |
| | | // orderQueryTask.setOrderId(orderId); |
| | | // orderQueryTask.setPayService((short) 7); |
| | | // orderQueryTask.setPayType((short) 1); |
| | | // orderQueryTask.setOrderPayTime(new Date()); |
| | | OrderQueryTask orderQueryTask = new OrderQueryTask(eventPublisher, this,nxPayConfig,orderId,(short)7,(short)1,new Date()); |
| | | OrderQueryUtil.addTask(orderQueryTask); |
| | | return new CommonResult(onlinePayResult); |
| | | } |
| | | |
| | | /** |
| | | * 卿C æ« B ç»ä¸ä¸å |
| | | * |
| | | * @param payConfig æ¯ä»åæ°èå对象 |
| | | * @param orderId åæ·è®¢åå· |
| | | * @param payMoney è®¢åæ»éé¢ï¼åªè½ä¸ºæ´æ° |
| | | * @param title è®¢åæ é¢ |
| | | * @param authCode 微信/æ¯ä»å®ï¼è¿åçææç ï¼æ¯ä»ä¸å¿éè¿ææç è·åç¨æ·openId,以便è¿è¡åç»ä¸å交æã |
| | | * @param timeStamp æ¶é´æ³ |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public CommonResult<JSONObject> zfbActiveScanUnifiedorder(JSONObject payConfig, String orderId, Long payMoney, String title, String goodsInfo, String authCode, String notifyUrl, |
| | | String timeStamp) { |
| | | log.info("ãæ²³ååä¿¡-卿Cæ«Bæ¯ä»-æ¯ä»å®ã ç»ä¸ä¸åå¼å§, 订åç¼å·=" + orderId); |
| | | return wxAliActiveScanUnifiedorder(payConfig, orderId, payMoney, title, goodsInfo, authCode, notifyUrl, timeStamp, "03", 'B'); |
| | | } |
| | | |
| | | /** |
| | | * 卿C æ« B ç»ä¸ä¸å |
| | | * |
| | | * @param payConfig æ¯ä»åæ°èå对象 |
| | | * @param orderId åæ·è®¢åå· |
| | | * @param payMoney è®¢åæ»éé¢ï¼åªè½ä¸ºæ´æ° |
| | | * @param title è®¢åæ é¢ |
| | | * @param authCode 微信/æ¯ä»å®ï¼è¿åçææç ï¼æ¯ä»ä¸å¿éè¿ææç è·åç¨æ·openId,以便è¿è¡åç»ä¸å交æã |
| | | * @param timeStamp æ¶é´æ³ |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public CommonResult<JSONObject> wxActiveScanUnifiedorder(JSONObject payConfig, String orderId, Long payMoney, String title, String goodsInfo, String authCode, String notifyUrl, |
| | | String timeStamp) { |
| | | log.info("ãæ²³ååä¿¡-卿Cæ«Bæ¯ä»-微信ã ç»ä¸ä¸åå¼å§, 订åç¼å·=" + orderId); |
| | | return wxAliActiveScanUnifiedorder(payConfig, orderId, payMoney, title, goodsInfo, authCode, notifyUrl, timeStamp, "03", 'C'); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¯ä»å®ã微信 卿cæ«B |
| | | * |
| | | * @param payConfig |
| | | * @param orderId |
| | | * @param payMoney |
| | | * @param title |
| | | * @param goodsInfo |
| | | * @param authCode |
| | | * @param notifyUrl |
| | | * @param timeStamp |
| | | * @param channelNbr |
| | | * @param payTypCd |
| | | * @return |
| | | */ |
| | | private CommonResult<JSONObject> wxAliActiveScanUnifiedorder(JSONObject payConfig, String orderId, Long payMoney, String title, String goodsInfo, String authCode, String notifyUrl, |
| | | String timeStamp, String channelNbr, char payTypCd) { |
| | | //éªè¯éé¢ |
| | | if (payMoney <= 0 && payMoney <= 0) { |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, "æ¯ä»å¤±è´¥,ä¸è½0å
æ¯ä»ï¼"); |
| | | } |
| | | // äºçº§åæ·å· |
| | | String subMerchantId = payConfig.getString("subMerchantId"); |
| | | //äº¤ææºæå· |
| | | String branchId = payConfig.getString("branchId"); |
| | | |
| | | // åä¿¡ 微信æ¯ä» |
| | | String onlinePayResp = null; |
| | | |
| | | onlinePayResp = nxHttpClientUtils.dyActiveQrCode(subMerchantId, branchId, orderId, payMoney, timeStamp, channelNbr, payTypCd, notifyUrl, title); |
| | | JSONObject onlinePayRespObj = JSONObject.parseObject(onlinePayResp); |
| | | String respCode = onlinePayRespObj.getString("code"); |
| | | if (!"000000".equals(respCode)) { |
| | | log.error("æ²³ååä¿¡-卿Cæ«Bæ¯ä» ä¸å失败ï¼éè¯¯ç»æç :{},éè¯¯ç»ææè¿°:{}", respCode, onlinePayRespObj.getString("message")); |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, onlinePayRespObj.getString("message")); |
| | | } |
| | | JSONObject onlinePayResult = onlinePayRespObj.getJSONObject("payload"); |
| | | onlinePayResult.put("paymentUrl", onlinePayResult.remove("QrCodeInfo")); |
| | | onlinePayResult.put("codeUrl", onlinePayResult.get("paymentUrl")); |
| | | // OrderQueryTask orderQueryTask = ApplicationContextUtil.getBean(OrderQueryTask.class); |
| | | // orderQueryTask.setOrderId(orderId); |
| | | // orderQueryTask.setPayService((short) 7); |
| | | // orderQueryTask.setPayType((short) 1); |
| | | // orderQueryTask.setOrderPayTime(new Date()); |
| | | OrderQueryTask orderQueryTask = new OrderQueryTask(eventPublisher, this,nxPayConfig,orderId,(short)7,(short)1,new Date()); |
| | | OrderQueryUtil.addTask(orderQueryTask); |
| | | return new CommonResult(onlinePayResult); |
| | | } |
| | | |
| | | |
| | | public CommonResult<JSONObject> offlinePayB2COrder(JSONObject payConfig, String orderNum, String timeStamp, String title, String goodsInfo, |
| | | ContainerNode detail, String notifyUrl, Long money, String authPayCode, String terminalCode) { |
| | | // äºçº§åæ·å· |
| | | String subMerchantId = payConfig.getString("subMerchantId"); |
| | | //äº¤ææºæå· |
| | | String branchId = payConfig.getString("branchId"); |
| | | |
| | | String offlineB2CPayResp = null; |
| | | try { |
| | | offlineB2CPayResp = nxHttpClientUtils.coretoall(subMerchantId, branchId, orderNum, money, authPayCode, timeStamp, "03", notifyUrl, title, terminalCode); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, e.getMessage()); |
| | | } |
| | | JSONObject offlineB2CPayRespObj = JSONObject.parseObject(offlineB2CPayResp); |
| | | String respCode = offlineB2CPayRespObj.getString("code"); |
| | | |
| | | if (!"000000".equals(respCode)) { |
| | | log.error("æ²³ååä¿¡-仿¬¾ç ï¼B æ« Cï¼ä¸å失败ï¼éè¯¯ç»æç :{},éè¯¯ç»ææè¿°:{}", respCode, offlineB2CPayRespObj.getString("message")); |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, offlineB2CPayRespObj.getString("message")); |
| | | } |
| | | |
| | | //0 交ææå 1 交æå¤±è´¥ 2 æ¤é 3 é¨åéè´§ 4 å
¨é¨éè´§ 5 å¤çä¸ 9 交æè¶
æ¶ |
| | | JSONObject payloadJson = offlineB2CPayRespObj.getJSONObject("payload"); |
| | | String tradeStatus = payloadJson.getString("TransStatus"); |
| | | if ("0".equals(tradeStatus)) { |
| | | payloadJson.put("waterNo", payloadJson.getString("TransSeqNbr")); |
| | | // æ¯ä»æå |
| | | return new CommonResult<>(payloadJson); |
| | | } else { |
| | | int count = 4; |
| | | for (int index = 0; index < count; index++) { |
| | | try { |
| | | Thread.sleep(10 * 1000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | CommonResult<JSONObject> tradeQueryResult = tradeQuery(payConfig, orderNum); |
| | | if (!tradeQueryResult.getCode().equals(CommonResultEmnu.OK.getCode())) { |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, tradeQueryResult.getDescription()); |
| | | } |
| | | payloadJson = tradeQueryResult.getData().getJSONObject("payload"); |
| | | tradeStatus = payloadJson.getString("TransStatus"); |
| | | if ("0".equals(tradeStatus)) { |
| | | payloadJson.put("waterNo", payloadJson.getString("TransSeqNbr")); |
| | | // æ¯ä»æå |
| | | return new CommonResult<>(payloadJson); |
| | | } else if ("1".equals(tradeStatus)) { |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, "交æå¤±è´¥ï¼è®¢åå·²å
³é"); |
| | | } else if ("2".equals(tradeStatus)) { |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, "交æå¤±è´¥ï¼è®¢å已被æ¤é"); |
| | | } else if ("3,4".contains(tradeStatus)) { |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, "交æå¤±è´¥ï¼è®¢å已被éè´§"); |
| | | } else if ("9".equals(tradeStatus)) { |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, "交æè¶
æ¶"); |
| | | } else if ("5".equals(tradeStatus)) { |
| | | log.info("交æä¸ï¼ç»§ç»æ¥è¯¢"); |
| | | count++; |
| | | } else { |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, tradeQueryResult.getDescription()); |
| | | } |
| | | } |
| | | } |
| | | return new CommonResult(payloadJson); |
| | | } |
| | | |
| | | /** |
| | | * 订å交æç¶ææ¥è¯¢ |
| | | * |
| | | * @return |
| | | */ |
| | | public CommonResult<JSONObject> tradeQuery(JSONObject payConfig, String orderNum) { |
| | | //äº¤ææºæå· |
| | | String branchId = payConfig.getString("branchId"); |
| | | String tradeQueryResp = nxHttpClientUtils.qryQrOrderStatus(orderNum, branchId); |
| | | JSONObject tradeQueryRespObj = JSONObject.parseObject(tradeQueryResp); |
| | | String respCode = tradeQueryRespObj.getString("code"); |
| | | if (!"000000".equals(respCode)) { |
| | | log.error("æ²³ååä¿¡-订å交æç¶ææ¥è¯¢å¤±è´¥ï¼éè¯¯ç»æç :{},éè¯¯ç»ææè¿°:{}", respCode, tradeQueryRespObj.getString("message")); |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, tradeQueryRespObj.getString("message")); |
| | | } |
| | | return new CommonResult(tradeQueryRespObj); |
| | | } |
| | | |
| | | /** |
| | | * 鿬¾ |
| | | * |
| | | * @param orderNum è¦é款ç订åå· |
| | | * @param merSeqDate è¦é款ç订åäº¤ææ¥æ ä¾ï¼20190810 |
| | | * @param origTransAmt è¦é款ç订åç交æéé¢ |
| | | * @param transAmt 鿬¾éé¢ |
| | | * @param timeStamp å½åæ¥æ ä¾ï¼yyyyMMddHHmmss |
| | | * @return |
| | | */ |
| | | public CommonResult<JSONObject> returntrans(JSONObject payConfig, String orderNum, String merSeqDate, long origTransAmt, |
| | | long transAmt, String timeStamp) { |
| | | // äºçº§åæ·å· |
| | | String subMerchantId = payConfig.getString("subMerchantId"); |
| | | //äº¤ææºæå· |
| | | String branchId = payConfig.getString("branchId"); |
| | | String tradeQueryResp = nxHttpClientUtils.returntrans(subMerchantId, branchId, orderNum, merSeqDate, origTransAmt, transAmt, timeStamp); |
| | | JSONObject tradeQueryRespObj = JSONObject.parseObject(tradeQueryResp); |
| | | String respCode = tradeQueryRespObj.getString("code"); |
| | | if (!"000000".equals(respCode)) { |
| | | log.error("æ²³ååä¿¡-鿬¾å¤±è´¥ï¼éè¯¯ç»æç :{},éè¯¯ç»ææè¿°:{}", respCode, tradeQueryRespObj.getString("message")); |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, tradeQueryRespObj.getString("message")); |
| | | } |
| | | return new CommonResult(tradeQueryRespObj); |
| | | } |
| | | |
| | | /*** 对账æ¥è¯¢ |
| | | * String subMerchantId, String branchId, |
| | | * |
| | | * @param clearDate å¯¹è´¦æ¥æ YYYY-MM-DD |
| | | * @param branchId äº¤ææºæå· |
| | | * @return |
| | | */ |
| | | public CommonResult<JSONObject> accountqry(String clearDate, String branchId) { |
| | | String tradeQueryResp = nxHttpClientUtils.accountqry(clearDate, branchId); |
| | | JSONObject tradeQueryRespObj = JSONObject.parseObject(tradeQueryResp); |
| | | String respCode = tradeQueryRespObj.getString("code"); |
| | | if (!"000000".equals(respCode)) { |
| | | log.error("æ²³ååä¿¡-订å交æç¶ææ¥è¯¢å¤±è´¥ï¼éè¯¯ç»æç :{},éè¯¯ç»ææè¿°:{}", respCode, tradeQueryRespObj.getString("message")); |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, tradeQueryRespObj.getString("message")); |
| | | } |
| | | return new CommonResult(tradeQueryRespObj); |
| | | } |
| | | |
| | | /** |
| | | * 微信å°ç¨åºæ¯ä» |
| | | * |
| | | * @param payConfig |
| | | * @param orderId |
| | | * @param payMoney |
| | | * @param title |
| | | * @param goodsInfo |
| | | * @param authCode |
| | | * @param notifyUrl |
| | | * @param timeStamp |
| | | * @return |
| | | */ |
| | | public CommonResult<JSONObject> wechatMiniPay(JSONObject payConfig, String orderId, Long payMoney, String title, String goodsInfo, String authCode, String notifyUrl, |
| | | String timeStamp) { |
| | | log.info("ãæ²³ååä¿¡-Cæ«B微信æ¯ä»ã ç»ä¸ä¸åå¼å§, 订åç¼å·=" + orderId); |
| | | //éªè¯éé¢ |
| | | if (payMoney <= 0 && payMoney <= 0) { |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, "æ¯ä»å¤±è´¥,ä¸è½0å
æ¯ä»ï¼"); |
| | | } |
| | | // äºçº§åæ·å· |
| | | String subMerchantId = payConfig.getString("subMerchantId"); |
| | | //äº¤ææºæå· |
| | | String branchId = payConfig.getString("branchId"); |
| | | String operatorId = payConfig.getString("operatorId"); |
| | | |
| | | // åä¿¡ 微信æ¯ä» |
| | | String onlinePayResp = null; |
| | | |
| | | onlinePayResp = nxHttpClientUtils.qrCodePrePay(subMerchantId, branchId, operatorId, orderId, authCode, payMoney, timeStamp, "03", 'C', notifyUrl, title); |
| | | |
| | | JSONObject onlinePayRespObj = JSONObject.parseObject(onlinePayResp); |
| | | String respCode = onlinePayRespObj.getString("code"); |
| | | if (!"000000".equals(respCode)) { |
| | | log.error("æ²³ååä¿¡-Cæ«Bæ¯ä»ä¸å失败ï¼éè¯¯ç»æç :{},éè¯¯ç»ææè¿°:{}", respCode, onlinePayRespObj.getString("message")); |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, onlinePayRespObj.getString("message")); |
| | | } |
| | | JSONObject onlinePayResult = onlinePayRespObj.getJSONObject("payload"); |
| | | onlinePayRespObj.put("toPayMethod", "2"); |
| | | JSONObject resultMap = nxPreConvertWxParam(onlinePayResult); |
| | | onlinePayRespObj.put("paymentData", resultMap); |
| | | onlinePayRespObj.remove("payload"); |
| | | // OrderQueryTask orderQueryTask = ApplicationContextUtil.getBean(OrderQueryTask.class); |
| | | // orderQueryTask.setOrderId(orderId); |
| | | // orderQueryTask.setPayService((short) 7); |
| | | // orderQueryTask.setPayType((short) 1); |
| | | // orderQueryTask.setOrderPayTime(new Date()); |
| | | OrderQueryTask orderQueryTask = new OrderQueryTask(eventPublisher, this,nxPayConfig,orderId,(short)7,(short)1,new Date()); |
| | | OrderQueryUtil.addTask(orderQueryTask); |
| | | return new CommonResult(resultMap); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param payConfig |
| | | * @param orderId |
| | | * @param payMoney |
| | | * @param title |
| | | * @param goodsInfo |
| | | * @param timeStamp yyyyMMddHHmmssSSSæ ¼å¼ |
| | | * @return |
| | | */ |
| | | public CommonResult<JSONObject> kjTrade(JSONObject payConfig, String orderId, Long payMoney, String title, String goodsInfo, |
| | | String timeStamp, String frontUrl) { |
| | | String kjSubMerchantId = payConfig.getString("kjSubMerchantId"); |
| | | String location = null; |
| | | try { |
| | | location = nxHttpClientUtils.quickPayRequest(kjSubMerchantId, orderId, payMoney, |
| | | timeStamp, frontUrl, |
| | | PropertiesConstants.STQ_SERVER + HnnxConstant.NX_KJ_ALL_CALL_BACK, |
| | | // "http://1.14.252.104:7101/service-merchant" + HnnxConstant.NX_KJ_ALL_CALL_BACK, |
| | | title); |
| | | } catch (Exception e) { |
| | | log.error("æ²³ååä¿¡-å¿«æ·æ¯ä» ä¸å失败ï¼éè¯¯ç»ææè¿°:{}", e.getMessage()); |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, e.getMessage()); |
| | | } |
| | | |
| | | JSONObject onlinePayResult = new JSONObject(); |
| | | onlinePayResult.put("paymentUrl", location); |
| | | onlinePayResult.put("codeUrl", location); |
| | | onlinePayResult.put("toPayMethod", "3"); |
| | | // OrderQueryTask orderQueryTask = ApplicationContextUtil.getBean(OrderQueryTask.class); |
| | | // orderQueryTask.setOrderId(orderId); |
| | | // orderQueryTask.setPayService((short) 7); |
| | | // orderQueryTask.setPayType((short) 1); |
| | | // orderQueryTask.setOrderPayTime(new Date()); |
| | | OrderQueryTask orderQueryTask = new OrderQueryTask(eventPublisher, this,nxPayConfig,orderId,(short)7,(short)1,new Date()); |
| | | OrderQueryUtil.addTask(orderQueryTask); |
| | | return new CommonResult(onlinePayResult); |
| | | } |
| | | |
| | | /** |
| | | * 订å交æç¶ææ¥è¯¢ |
| | | * |
| | | * @return |
| | | */ |
| | | public CommonResult<JSONArray> kjTradeQuery(String orderNum, String startDate, String endDate, Integer pageSize, Integer pageNum) { |
| | | String tradeQueryResp = nxHttpClientUtils.quickPayOrderQueryRequest(orderNum, startDate, endDate, Convert.toInt(pageSize, 1), Convert.toInt(pageNum, 1)); |
| | | if (StringUtils.isEmpty(tradeQueryResp)) { |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, "æªæ¥è¯¢å°æ°æ®"); |
| | | } |
| | | JSONObject tradeQueryRespObj = JSONObject.parseObject(tradeQueryResp); |
| | | Integer totalNum = tradeQueryRespObj.getInteger("TotalNum"); |
| | | if (totalNum == null || totalNum == 0) { |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, "æªæ¥è¯¢å°æ°æ®"); |
| | | } |
| | | JSONArray orderList = tradeQueryRespObj.getJSONArray("OrderList"); |
| | | return new CommonResult(orderList); |
| | | } |
| | | |
| | | /** |
| | | * 鿬¾ |
| | | * |
| | | * @param orderNum è¦é款ç订åå· |
| | | * @param merSeqDate è¦é款ç订åäº¤ææ¥æ ä¾ï¼20190810 |
| | | * @param origTransAmt è¦é款ç订åç交æéé¢ |
| | | * @param transAmt 鿬¾éé¢ |
| | | * @param timeStamp å½åæ¥æ ä¾ï¼yyyyMMddHHmmss |
| | | * @return |
| | | */ |
| | | public CommonResult<JSONObject> kjReturntrans(JSONObject payConfig, String orderNum, String merSeqDate, long origTransAmt, |
| | | long transAmt, String timeStamp) { |
| | | // äºçº§åæ·å· |
| | | String subMerchantId = payConfig.getString("kjSubMerchantId"); |
| | | //äº¤ææºæå· |
| | | String tradeQueryResp = nxHttpClientUtils.quickPayReturntrans(subMerchantId, orderNum, merSeqDate, origTransAmt, transAmt, timeStamp); |
| | | JSONObject tradeQueryRespObj = JSONObject.parseObject(tradeQueryResp); |
| | | String respCode = tradeQueryRespObj.getString("ReturnCode"); |
| | | if (!"000000".equals(respCode)) { |
| | | log.error("æ²³ååä¿¡-鿬¾å¤±è´¥ï¼éè¯¯ç»æç :{},éè¯¯ç»ææè¿°:{}", respCode, tradeQueryRespObj.getString("ReturnMsg")); |
| | | return new CommonResult<>(CommonResultEmnu.ERROR, tradeQueryRespObj.getString("ReturnMsg")); |
| | | } |
| | | return new CommonResult(tradeQueryRespObj); |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.hnnx.hnnxPay; |
| | | |
| | | import com.csii.sg.codec.Hex; |
| | | import org.springframework.util.Assert; |
| | | |
| | | import javax.crypto.Mac; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.PrivateKey; |
| | | import java.security.Signature; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author awlwen |
| | | * @since 2017/11/30 |
| | | */ |
| | | public class SignatureSigner { |
| | | /** |
| | | * å°åèæ°ç»è½¬æ¢ä¸º16è¿å¶å符串 |
| | | * ç®æ³ï¼ |
| | | * å°åèæ°ç»ä¸æ¯ä¸ªåèååºå转æ¢ä¸º16è¿å¶ï¼æªåä½å
«ä½ |
| | | * å°ä¸è¶³2ä½çå符åè¡¥0ï¼è§£ææ¶å¯æ2ä½åé |
| | | * |
| | | * @param byteArray åèæ°ç» |
| | | * @return 16è¿å¶å符 |
| | | */ |
| | | private String byteToHex(byte[] byteArray) { |
| | | if (byteArray == null) { |
| | | return ""; |
| | | } |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < byteArray.length; i++) { |
| | | String hexString = Integer.toHexString(byteArray[i] & 0x00ff); |
| | | if (hexString.length() != 2) { |
| | | //妿å符é¿åº¦ä¸ä¸º2ä½ï¼åè¡¥0å ä½ |
| | | sb.append("0"); |
| | | } |
| | | sb.append(hexString); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | private static byte[] signLow(String plain, String algorithm, PrivateKey privateKey) { |
| | | Assert.notNull(plain, "plain is null."); |
| | | Assert.notNull(algorithm, "algorithm is null."); |
| | | Assert.notNull(privateKey, "private key is null."); |
| | | try { |
| | | Signature sign = Signature.getInstance(algorithm); |
| | | sign.initSign(privateKey); |
| | | sign.update(plain.getBytes()); |
| | | return sign.sign(); |
| | | } catch (Exception ex) { |
| | | throw new RuntimeException(ex); |
| | | } |
| | | } |
| | | |
| | | private static byte[] signLowByte(byte[] plain, String algorithm, PrivateKey privateKey) { |
| | | Assert.notNull(plain, "plain is null."); |
| | | Assert.notNull(algorithm, "algorithm is null."); |
| | | Assert.notNull(privateKey, "private key is null."); |
| | | try { |
| | | Signature sign = Signature.getInstance(algorithm); |
| | | sign.initSign(privateKey); |
| | | sign.update(plain); |
| | | return sign.sign(); |
| | | } catch (Exception ex) { |
| | | throw new RuntimeException(ex); |
| | | } |
| | | } |
| | | |
| | | public static String laBaSign(Map<String, String> parameters, String accessKeySecret) { |
| | | // Step 1: Sort the parameters by key in ascending order |
| | | List<Map.Entry<String, String>> sortedParams = new ArrayList<>(parameters.entrySet()); |
| | | Collections.sort(sortedParams, Comparator.comparing(Map.Entry::getKey)); |
| | | |
| | | // Step 2: Generate the string to sign |
| | | StringBuilder stringToSign = new StringBuilder(); |
| | | for (Map.Entry<String, String> param : sortedParams) { |
| | | if (param.getValue() != null && !param.getValue().isEmpty()) { |
| | | stringToSign.append(param.getKey()).append("=").append(param.getValue()).append("&"); |
| | | } |
| | | } |
| | | stringToSign.deleteCharAt(stringToSign.length() - 1); // Remove the last '&' |
| | | |
| | | // Step 3: Generate the signature |
| | | try { |
| | | Mac hmacSha256 = Mac.getInstance("HmacSHA256"); |
| | | SecretKeySpec keySpec = new SecretKeySpec(accessKeySecret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"); |
| | | hmacSha256.init(keySpec); |
| | | byte[] signData = hmacSha256.doFinal(stringToSign.toString().getBytes(StandardCharsets.UTF_8)); |
| | | |
| | | // Step 4: Base64 encode the signature |
| | | return Base64.getEncoder().encodeToString(signData); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | /** |
| | | * ä½¿ç¨æä¾çç®æ³ä¸ç§é¥å¯¹äº¤ææ°æ®ç¾å |
| | | * |
| | | * @param plain äº¤ææ°æ®ææ |
| | | * @param privateKey java.security.PrivateKey ç§é¥ |
| | | * @return ç¾å |
| | | */ |
| | | public String sign(String plain, PrivateKey privateKey) { |
| | | byte[] bytes = signLow(plain, HnnxConstant.ALGORITHM, privateKey); |
| | | return Hex.toHex(bytes); |
| | | } |
| | | |
| | | /** |
| | | * å¿«æ·æ¯ä»sign |
| | | * |
| | | * @param plain |
| | | * @param privateKey |
| | | * @return |
| | | */ |
| | | public String kjSign(String plain, PrivateKey privateKey) { |
| | | byte[] bytes = new byte[0]; |
| | | try { |
| | | bytes = signLowByte(plain.getBytes("utf-8"), HnnxConstant.KJ_ALGORITHM, privateKey); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return Base64.getEncoder().encodeToString(bytes); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.hnnx.orderQueryTask; |
| | | |
| | | import org.springframework.context.ApplicationEvent; |
| | | |
| | | /** |
| | | * @ClassName OrderQueryEvent |
| | | * @Author cy |
| | | * @Date 2024/1/2 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | public class OrderQueryEvent extends ApplicationEvent { |
| | | private OrderQueryMessageEntity messageEntity; |
| | | |
| | | public OrderQueryEvent(Object source, OrderQueryMessageEntity messageEntity) { |
| | | super(source); |
| | | this.messageEntity = messageEntity; |
| | | } |
| | | |
| | | public OrderQueryMessageEntity getMessageEntity() { |
| | | return this.messageEntity; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.hnnx.orderQueryTask; |
| | | |
| | | /** |
| | | * @ClassName OrderQueryMessageEntity |
| | | * @Author cy |
| | | * @Date 2024/1/2 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * @Description æ¶æ¯å®ä½ç±» |
| | | **/ |
| | | @Data |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | public class OrderQueryMessageEntity { |
| | | /** |
| | | * 10000 è®¢åæ¥è¯¢,åç»å¯æ·»å å
¶ä» |
| | | */ |
| | | String code; |
| | | /** |
| | | * SQ åå订å |
| | | * SC åå订å |
| | | * SM H5æ«ç ä»è®¢å |
| | | * DTCSB åå®¶APP卿䏻æ«ï¼Cæ«Bï¼ |
| | | * BSC ç¨æ·åºç¤ºä»æ¬¾ç Bæ«C |
| | | */ |
| | | String orderChannel; |
| | | /** |
| | | * ç³»ç»è®¢åå· |
| | | */ |
| | | String orderId; |
| | | /** |
| | | * åä¿¡ç䏿¹æ¯ä»ç³»ç»ç订åå· |
| | | */ |
| | | String outTradeNo; |
| | | /** |
| | | * 1.微信æ¯ä» 2.å¿«æ·æ¯ä» |
| | | */ |
| | | Short orderType; |
| | | |
| | | /** |
| | | * æ¯ä»æå¡æä¾å |
| | | */ |
| | | Short payService; |
| | | |
| | | /** |
| | | * å°è¯æ¯ä»ç次æ°ï¼ç¨äºçæéèåå· |
| | | */ |
| | | Short tryPayNum; |
| | | } |
New file |
| | |
| | | package com.nuvole.hnnx.orderQueryTask; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.nuvole.common.domain.emnu.CommonResultEmnu; |
| | | import com.nuvole.common.domain.result.CommonResult; |
| | | import com.nuvole.hnnx.conf.NxPayConfig; |
| | | import com.nuvole.hnnx.hnnxPay.NXPayService; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @ClassName OrderQueryTask |
| | | * @Author cy |
| | | * @Date 2024/1/2 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | @Slf4j |
| | | //@Component |
| | | //@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) |
| | | public class OrderQueryTask implements Runnable { |
| | | // @Autowired |
| | | private ApplicationEventPublisher eventPublisher; |
| | | // @Autowired |
| | | private NXPayService nxPayService; |
| | | // @Autowired |
| | | private NxPayConfig nxPayConfig; |
| | | |
| | | @ApiModelProperty("订åID") |
| | | private String orderId; |
| | | |
| | | @ApiModelProperty("æ¯ä»æå¡å") |
| | | private Short payService; |
| | | |
| | | @ApiModelProperty("åä¿¡éè¦åºåæ¯å¦ä¸ºå¿«æ·æ¯ä» 1 æ®éæ¯ä» 2å¿«æ·æ¯ä»") |
| | | private Short payType; |
| | | |
| | | @ApiModelProperty("订åå°è¯æ¯ä»æ¶é´") |
| | | private Date orderPayTime; |
| | | |
| | | |
| | | @Override |
| | | public void run() { |
| | | Date nowTime = new Date(); |
| | | long lastDuration = nowTime.getTime() - orderPayTime.getTime(); |
| | | if (lastDuration > 10 * 60 * 1000) { |
| | | log.error("10éåç订åï¼åæ¶ä»»å¡:{}", orderId); |
| | | OrderQueryUtil.cancelTask(orderId); |
| | | return; |
| | | } |
| | | log.info("æ¥è¯¢è®¢å为{}, 订ååå§æ¯ä»æ¶é´ä¸º{}", orderId, orderPayTime); |
| | | boolean isPaySuccess = false; |
| | | |
| | | String[] orderInfoArr = orderId.split("-"); |
| | | String orderChannel = orderInfoArr[0]; |
| | | String myOrderId = orderInfoArr[1]; |
| | | Short tryPayNum = Convert.toShort(orderInfoArr[3],null); |
| | | String outTradeNo = null; |
| | | |
| | | if (payService == 7) { |
| | | if (payType == 1) { |
| | | JSONObject payConfig = new JSONObject(); |
| | | payConfig.put("branchId", nxPayConfig.getBranchId()); |
| | | CommonResult<JSONObject> tradeQueryResult = nxPayService.tradeQuery(payConfig, orderId); |
| | | // TransStatus 0 交ææå 1 交æå¤±è´¥ 2 æ¤é 3 é¨åéè´§ 4 å
¨é¨éè´§ 5 å¤çä¸ 9 交æè¶
æ¶ |
| | | if (!tradeQueryResult.getCode().equals(CommonResultEmnu.OK.getCode())) { |
| | | OrderQueryUtil.cancelTask(orderId); |
| | | return; |
| | | } |
| | | JSONObject tradeQueryResultJson = tradeQueryResult.getData(); |
| | | JSONObject payload = tradeQueryResultJson.getJSONObject("payload"); |
| | | Integer transStatus = payload.getInteger("TransStatus"); |
| | | if (transStatus != null) { |
| | | if (transStatus == 0) { |
| | | isPaySuccess = true; |
| | | outTradeNo = payload.getString("TransSeqNbr"); |
| | | } else if (transStatus == 1 || transStatus == 9) { |
| | | log.error("交æå¤±è´¥ æ 交æè¶
æ¶ï¼åæ¶ä»»å¡.{}", orderId); |
| | | OrderQueryUtil.cancelTask(orderId); |
| | | } |
| | | } |
| | | } else if (payType == 2) { |
| | | //orderStatus 0-å¾
æ¯ä» 1-æå 2-失败 3-å¤çä¸ 4-订ååæ¶ |
| | | CommonResult<JSONArray> tradeQueryResult = nxPayService.kjTradeQuery(orderId, null, null, 1, 1); |
| | | if (!tradeQueryResult.getCode().equals(CommonResultEmnu.OK.getCode())) { |
| | | OrderQueryUtil.cancelTask(orderId); |
| | | return; |
| | | } |
| | | JSONArray tradeQueryResultJsonArr = tradeQueryResult.getData(); |
| | | if (tradeQueryResultJsonArr != null && tradeQueryResultJsonArr.size() > 0){ |
| | | JSONObject tradeQueryResultJson = (JSONObject) tradeQueryResultJsonArr.get(0); |
| | | Integer transStatus = tradeQueryResultJson.getInteger("orderStatus"); |
| | | if (transStatus != null) { |
| | | if (transStatus == 1) { |
| | | isPaySuccess = true; |
| | | outTradeNo = tradeQueryResultJson.getString("TransSeqNbr"); |
| | | } else if (transStatus == 2 || transStatus == 4) { |
| | | log.error("交æå¤±è´¥ æ 订ååæ¶ï¼åæ¶ä»»å¡.{}", orderId); |
| | | OrderQueryUtil.cancelTask(orderId); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } else { |
| | | log.error("æ¯ä»æ¹å¼é误ï¼åæ¶ä»»å¡.{}", orderId); |
| | | OrderQueryUtil.cancelTask(orderId); |
| | | } |
| | | } else { |
| | | log.error("ç®åé¤åä¿¡å¤ï¼å
¶ä»æä¸æ¥è¯¢"); |
| | | OrderQueryUtil.cancelTask(orderId); |
| | | } |
| | | // 夿æ¯ä»ç¶æï¼ç¡®å®æ¯å¦åééç¥ |
| | | if (isPaySuccess) { |
| | | eventPublisher.publishEvent(new OrderQueryEvent(this, |
| | | OrderQueryMessageEntity.builder().code("10000").orderChannel(orderChannel).orderId(myOrderId).outTradeNo(outTradeNo).payService(payService).tryPayNum(tryPayNum).build())); |
| | | OrderQueryUtil.cancelTask(orderId); |
| | | } |
| | | |
| | | } |
| | | |
| | | public OrderQueryTask(ApplicationEventPublisher eventPublisher, NXPayService nxPayService, NxPayConfig nxPayConfig, String orderId, Short payService, Short payType, Date orderPayTime) { |
| | | this.eventPublisher = eventPublisher; |
| | | this.nxPayService = nxPayService; |
| | | this.nxPayConfig = nxPayConfig; |
| | | this.orderId = orderId; |
| | | this.payService = payService; |
| | | this.payType = payType; |
| | | this.orderPayTime = orderPayTime; |
| | | } |
| | | |
| | | public String getOrderId() { |
| | | return orderId; |
| | | } |
| | | |
| | | public Short getPayService() { |
| | | return payService; |
| | | } |
| | | |
| | | public Short getPayType() { |
| | | return payType; |
| | | } |
| | | |
| | | public Date getOrderPayTime() { |
| | | return orderPayTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.hnnx.orderQueryTask; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springframework.scheduling.Trigger; |
| | | import org.springframework.scheduling.TriggerContext; |
| | | |
| | | import java.time.Instant; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @ClassName OrderQueryTrigger |
| | | * @Author cy |
| | | * @Date 2024/1/2 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | public class OrderQueryTrigger implements Trigger { |
| | | @ApiModelProperty("订åå°è¯æ¯ä»æ¶é´") |
| | | private Date orderPayTime; |
| | | |
| | | // @Override |
| | | // public Date nextExecutionTime(TriggerContext triggerContext) { |
| | | // // æ ¹æ®ä¸åçæ¶é´æ®µè¿åä¸ä¸æ¬¡æ§è¡ä»»å¡çæ¶é´ |
| | | // Date nowTime = new Date(); |
| | | // |
| | | // long lastDuration = nowTime.getTime() - orderPayTime.getTime(); |
| | | // |
| | | // // æ ¹æ®æ¶é´æ®µè®¾ç½®ä¸åçæ§è¡é´é |
| | | // //é´éæ¶é´ æ¥è¯¢é¢ç |
| | | // //(0~10] 2s |
| | | // //(10~30] 5s |
| | | // //(30~60] 15s |
| | | // //(60~180] 60s |
| | | // if (lastDuration <= 10000) { |
| | | // return new Date(System.currentTimeMillis() + 2000); |
| | | // } else if (lastDuration <= 30000) { |
| | | // return new Date(System.currentTimeMillis() + 5000); |
| | | // } else if (lastDuration <= 60000) { |
| | | // return new Date(System.currentTimeMillis() + 15000); |
| | | // } else { |
| | | // return new Date(System.currentTimeMillis() + 60000); |
| | | // } |
| | | // } |
| | | |
| | | @Override |
| | | public Instant nextExecution(TriggerContext triggerContext) { |
| | | |
| | | // æ ¹æ®ä¸åçæ¶é´æ®µè¿åä¸ä¸æ¬¡æ§è¡ä»»å¡çæ¶é´ |
| | | long lastDuration = System.currentTimeMillis() - orderPayTime.getTime(); |
| | | |
| | | // æ ¹æ®æ¶é´æ®µè®¾ç½®ä¸åçæ§è¡é´é |
| | | //é´éæ¶é´ æ¥è¯¢é¢ç |
| | | //(0~10] 2s |
| | | //(10~30] 5s |
| | | //(30~60] 15s |
| | | //(60~180] 60s |
| | | if (lastDuration <= 10000) { |
| | | return Instant.ofEpochMilli(System.currentTimeMillis() + 2000); |
| | | } else if (lastDuration <= 30000) { |
| | | return Instant.ofEpochMilli(System.currentTimeMillis() + 5000); |
| | | } else if (lastDuration <= 60000) { |
| | | return Instant.ofEpochMilli(System.currentTimeMillis() + 15000); |
| | | } else { |
| | | return Instant.ofEpochMilli(System.currentTimeMillis() + 60000); |
| | | } |
| | | } |
| | | public OrderQueryTrigger(Date orderPayTime) { |
| | | this.orderPayTime = orderPayTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.hnnx.orderQueryTask; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.scheduling.TaskScheduler; |
| | | import org.springframework.scheduling.concurrent.DefaultManagedTaskScheduler; |
| | | |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.ScheduledFuture; |
| | | |
| | | /** |
| | | * @ClassName OrderQueryUtil |
| | | * @Author cy |
| | | * @Date 2024/1/2 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | @Slf4j |
| | | //@Component |
| | | public class OrderQueryUtil { |
| | | |
| | | private static TaskScheduler taskScheduler = new DefaultManagedTaskScheduler(); |
| | | |
| | | // @Autowired |
| | | // public void setTaskScheduler(TaskScheduler taskScheduler) { |
| | | // OrderQueryUtil.taskScheduler = taskScheduler; |
| | | // } |
| | | |
| | | // ç¨äºåæ¶ä»»å¡ |
| | | private static Map<String, ScheduledFuture> taskMap = new ConcurrentHashMap<>(); |
| | | |
| | | public static Map<String, ScheduledFuture> getTaskMap() { |
| | | return taskMap; |
| | | } |
| | | |
| | | private static TaskScheduler getExecutor() { |
| | | return taskScheduler; |
| | | } |
| | | |
| | | |
| | | public static ScheduledFuture addTask(OrderQueryTask task) { |
| | | |
| | | ScheduledFuture scheduledFuture = getExecutor().schedule(task, new OrderQueryTrigger(task.getOrderPayTime())); |
| | | taskMap.put(task.getOrderId(), scheduledFuture); |
| | | log.info("æ°å¢è®¢åå·ä¸º{}, 订ååå§æ¯ä»æ¶é´ä¸º{}", task.getOrderId(), task.getOrderPayTime()); |
| | | return scheduledFuture; |
| | | } |
| | | |
| | | public static void cancelTask(ScheduledFuture future) { |
| | | future.cancel(true); |
| | | } |
| | | |
| | | public static void cancelTask(String taskId) { |
| | | log.info("åæ¶è®¢åå·ä¸º{}", taskId); |
| | | ScheduledFuture future = taskMap.remove(taskId); |
| | | if (future != null) { |
| | | future.cancel(true); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | //package com.nuvole.laba; |
| | | // |
| | | //import com.nuvole.laba.conf.LaBaPushConfig; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.stereotype.Component; |
| | | // |
| | | ///** |
| | | // * @ClassName laba |
| | | // * @Author cy |
| | | // * @Date 2023/12/4 |
| | | // * @Description |
| | | // * @Version 1.0 |
| | | // **/ |
| | | //@Component |
| | | //public class LabaPushUtil { |
| | | // private static LaBaPushConfig laBaPushConfig; |
| | | // |
| | | // @Autowired |
| | | // public void setLaBaPushConfig(LaBaPushConfig laBaPushConfig) { |
| | | // LabaPushUtil.laBaPushConfig = laBaPushConfig; |
| | | // } |
| | | // |
| | | // public static void sendMsg(String message) { |
| | | // // 使ç¨apiPropertiesä¸çkeyåsecretæ¥åéæ¶æ¯ |
| | | // String serverUrl = laBaPushConfig.getServerUrl(); |
| | | // String key = laBaPushConfig.getAccessKeyId(); |
| | | // String secret = laBaPushConfig.getAccessKeySecret(); |
| | | // |
| | | // // å®ç°æ¶æ¯åéé»è¾... |
| | | // } |
| | | //} |
New file |
| | |
| | | package com.nuvole.poscom.api; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.nuvole.common.domain.result.CommonResult; |
| | | import com.nuvole.poscom.config.PoscomConfig; |
| | | import com.nuvole.poscom.config.PoscomPrintData; |
| | | import com.nuvole.poscom.config.TempletParams; |
| | | import com.nuvole.poscom.util.PoscomRequest; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | |
| | | import java.util.Calendar; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description ä½³åäºæå°æºæ¥å£ |
| | | * @Author ZHAOXL |
| | | * @Date 2024/3/6 16:24 |
| | | * @Version 1.0 |
| | | */ |
| | | @Slf4j |
| | | public class PoscomService { |
| | | |
| | | /** |
| | | * æ·»å æå°æº |
| | | * @param deviceID* ç»ç«¯ç¼å·ã |
| | | * @param deviceName* 设å¤åç§°ï¼æå¤§64使°æ®é¿åº¦ã |
| | | * @param grpID åç» ID ã |
| | | * @return CommonResult |
| | | * @Author ZHAOXL |
| | | * @Date 2024/3/6 16:53 |
| | | * @Version 1.0 |
| | | */ |
| | | public static CommonResult<JSONObject> addDev(String deviceID, String deviceName, Integer grpID) { |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | String reqTime = String.valueOf(Calendar.getInstance().getTimeInMillis()); |
| | | params.put("reqTime", reqTime); |
| | | String securityCode = DigestUtils.md5Hex(PoscomConfig.memberCode + reqTime + PoscomConfig.apiKey + deviceID); |
| | | params.put("securityCode", securityCode); |
| | | params.put("memberCode", PoscomConfig.memberCode); |
| | | params.put("deviceID", deviceID); |
| | | params.put("devName", deviceName); |
| | | if (grpID != null) { |
| | | params.put("grpID", grpID + ""); |
| | | } |
| | | log.debug("=====请æ±åæ° START=====\r\n" + "---> adddev <---\r\n" + params + "\r\n=====请æ±åæ° END====="); |
| | | String result = PoscomRequest.sendPost("http://api.poscom.cn/apisc/adddev", params); |
| | | log.debug("=====请æ±è¿å START=====\r\n" + result + "\r\n=====请æ±è¿å END====="); |
| | | JSONObject resultObject = JSONObject.parseObject(result); |
| | | return new CommonResult(resultObject); |
| | | } |
| | | |
| | | /** |
| | | * æå°æºåæ¢ææ¥ç±»å |
| | | * @param deviceID* ç»ç«¯ç¼å·ã |
| | | * @param voiceType* è¯é³ç±»åã0 ç人è¯é³ï¼1 æ»´æ»´è¯é³ï¼2 ä¸èªå¨ææ¾æ°è®¢åï¼ç人è¯é³ï¼3 ä¸èªå¨ææ¾æ°è®¢åï¼æ»´æ»´è¯é³ã |
| | | * @return |
| | | * @Author ZHAOXL |
| | | * @Date 2024/3/7 15:48 |
| | | * @Version 1.0 |
| | | */ |
| | | public static CommonResult<JSONObject> setVoiceType(String deviceID, String voiceType) { |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | String reqTime = String.valueOf(Calendar.getInstance().getTimeInMillis()); |
| | | params.put("reqTime", reqTime); |
| | | String securityCode = DigestUtils.md5Hex(PoscomConfig.memberCode + reqTime + PoscomConfig.apiKey + deviceID); |
| | | params.put("securityCode", securityCode); |
| | | params.put("memberCode", PoscomConfig.memberCode); |
| | | params.put("deviceID", deviceID); |
| | | params.put("voiceType", voiceType); |
| | | log.debug("=====请æ±åæ° START=====\r\n" + "---> setVoiceType <---\r\n" + params + "\r\n=====请æ±åæ° END====="); |
| | | String result = PoscomRequest.sendPost("http://api.poscom.cn/apisc/setVoiceType", params); |
| | | log.debug("=====请æ±è¿å START=====\r\n" + result + "\r\n=====请æ±è¿å END====="); |
| | | JSONObject resultObject = JSONObject.parseObject(result); |
| | | return new CommonResult(resultObject); |
| | | } |
| | | |
| | | /** |
| | | * å 餿尿º |
| | | * @param deviceID* ç»ç«¯ç¼å·ã |
| | | * @return CommonResult |
| | | * @Author ZHAOXL |
| | | * @Date 2024/3/7 9:47 |
| | | * @Version 1.0 |
| | | */ |
| | | public static CommonResult<JSONObject> delDev(String deviceID) { |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | String reqTime = String.valueOf(Calendar.getInstance().getTimeInMillis()); |
| | | params.put("reqTime", reqTime); |
| | | String securityCode = DigestUtils.md5Hex(PoscomConfig.memberCode + reqTime + PoscomConfig.apiKey + deviceID); |
| | | params.put("securityCode", securityCode); |
| | | params.put("memberCode", PoscomConfig.memberCode); |
| | | params.put("deviceID", deviceID); |
| | | log.debug("=====请æ±åæ° START=====\r\n" + "---> deldev <---\r\n" + params + "\r\n=====请æ±åæ° END====="); |
| | | String result = PoscomRequest.sendPost("http://api.poscom.cn/apisc/deldev", params); |
| | | log.debug("=====请æ±è¿å START=====\r\n" + result + "\r\n=====请æ±è¿å END====="); |
| | | JSONObject resultObject = JSONObject.parseObject(result); |
| | | return new CommonResult(resultObject); |
| | | } |
| | | |
| | | /** |
| | | * æå®æ¨¡æ¿æå° |
| | | * @param deviceID* ç»ç«¯ç¼å·ã |
| | | * @param templetParams* 模æ¿åæ° |
| | | * @return CommonResult |
| | | * @Author ZHAOXL |
| | | * @Date 2024/3/7 10:19 |
| | | * @Version 1.0 |
| | | */ |
| | | public static CommonResult<JSONObject> templetPrint(String deviceID, TempletParams templetParams) { |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | String reqTime = String.valueOf(Calendar.getInstance().getTimeInMillis()); |
| | | params.put("reqTime", reqTime); |
| | | String securityCode = DigestUtils.md5Hex(PoscomConfig.memberCode + deviceID + reqTime + PoscomConfig.apiKey); |
| | | params.put("securityCode", securityCode); |
| | | params.put("memberCode", PoscomConfig.memberCode); |
| | | params.put("deviceID", deviceID); |
| | | params.put("templetID", PoscomConfig.templetId); |
| | | String tData = JSONObject.toJSONString(templetParams); |
| | | params.put("tData", tData); |
| | | params.put("charset","1"); //Default:1, 1:GB18030, 2:GB2312, 3:GBK, 4:UTF-8, 5:Unicode, 6:ISO8859-1, 7:BIG5 |
| | | params.put("msgNo",""); |
| | | params.put("reprint","0"); |
| | | params.put("multi","0"); |
| | | params.put("times",""); |
| | | params.put("token", ""); |
| | | log.debug("=====请æ±åæ° START=====\r\n" + "---> templetPrint <---\r\n" + params + "\r\n=====请æ±åæ° END====="); |
| | | String result = PoscomRequest.sendPost("http://api.poscom.cn/apisc/templetPrint", params); |
| | | log.debug("=====请æ±è¿å START=====\r\n" + result + "\r\n=====请æ±è¿å END====="); |
| | | JSONObject resultObject = JSONObject.parseObject(result); |
| | | return new CommonResult(resultObject); |
| | | } |
| | | |
| | | /** |
| | | * åéè¯é³å°æå°æº |
| | | * @param* ç»ç«¯ç¼å·ã |
| | | * @param* è¯é³å
容ã |
| | | * @return |
| | | * @Author ZHAOXL |
| | | * @Date 2024/3/7 10:29 |
| | | * @Version 1.0 |
| | | */ |
| | | public static CommonResult<JSONObject> sendVoice(String deviceID, String voice) { |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | String reqTime = String.valueOf(Calendar.getInstance().getTimeInMillis()); |
| | | params.put("reqTime", reqTime); |
| | | String securityCode = DigestUtils.md5Hex(PoscomConfig.memberCode + deviceID + reqTime + PoscomConfig.apiKey); |
| | | params.put("securityCode", securityCode); |
| | | params.put("memberCode", PoscomConfig.memberCode); |
| | | params.put("deviceID", deviceID); |
| | | params.put("voice", voice); |
| | | params.put("token", ""); |
| | | log.debug("=====请æ±åæ° START=====\r\n" + "---> sendVoice <---\r\n" + params + "\r\n=====请æ±åæ° END====="); |
| | | String result = PoscomRequest.sendPost("http://api.poscom.cn/apisc/sendVoice", params); |
| | | log.debug("=====请æ±è¿å START=====\r\n" + result + "\r\n=====请æ±è¿å END====="); |
| | | JSONObject resultObject = JSONObject.parseObject(result); |
| | | return new CommonResult(resultObject); |
| | | } |
| | | |
| | | public static CommonResult<JSONObject> sendMsg(String deviceID) { |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | String reqTime = String.valueOf(Calendar.getInstance().getTimeInMillis()); |
| | | params.put("reqTime", reqTime); |
| | | String securityCode = DigestUtils.md5Hex(PoscomConfig.memberCode + deviceID + reqTime + reqTime + PoscomConfig.apiKey); |
| | | params.put("securityCode", securityCode); |
| | | params.put("memberCode", PoscomConfig.memberCode); |
| | | params.put("deviceID", deviceID); |
| | | //-----ç¥¨æ®æå°æº æ ¼å¼ç±»å:2 |
| | | params.put("mode", "2"); |
| | | params.put("msgDetail", PoscomPrintData.ReceiptData2); |
| | | //-----ç¥¨æ®æå°æº æ ¼å¼ç±»å:2 |
| | | params.put("charset","1"); //Default:1, 1:GB18030, 2:GB2312, 3:GBK, 4:UTF-8, 5:Unicode, 6:ISO8859-1, 7:BIG5 |
| | | params.put("msgNo", reqTime); |
| | | log.debug("=====请æ±åæ° START=====\r\n" + "---> sendMsg <---\r\n" + params + "\r\n=====请æ±åæ° END====="); |
| | | String result = PoscomRequest.sendPost("http://api.poscom.cn/apisc/sendMsg", params); |
| | | log.debug("=====请æ±è¿å START=====\r\n" + result + "\r\n=====请æ±è¿å END====="); |
| | | JSONObject resultObject = JSONObject.parseObject(result); |
| | | return new CommonResult(resultObject); |
| | | } |
| | | |
| | | public static CommonResult<JSONObject> queryState(String deviceID) { |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | String reqTime = String.valueOf(Calendar.getInstance().getTimeInMillis()); |
| | | params.put("reqTime", reqTime); |
| | | String securityCode = DigestUtils.md5Hex(PoscomConfig.memberCode + reqTime + PoscomConfig.apiKey + reqTime); |
| | | params.put("securityCode", securityCode); |
| | | params.put("memberCode", PoscomConfig.memberCode); |
| | | params.put("msgNo", reqTime); |
| | | log.debug("=====请æ±åæ° START=====\r\n" + "---> sendMsg <---\r\n" + params + "\r\n=====请æ±åæ° END====="); |
| | | String result = PoscomRequest.sendPost("http://api.poscom.cn/apisc/queryState", params); |
| | | log.debug("=====请æ±è¿å START=====\r\n" + result + "\r\n=====请æ±è¿å END====="); |
| | | JSONObject resultObject = JSONObject.parseObject(result); |
| | | return new CommonResult(resultObject); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.poscom.config; |
| | | |
| | | import com.nuvole.util.PropertyUtil; |
| | | |
| | | /** |
| | | * @Description ä½³åäºæå°æºé
ç½® |
| | | * @Author ZHAOXL |
| | | * @Date 2024/3/6 16:23 |
| | | * @Version 1.0 |
| | | */ |
| | | public class PoscomConfig { |
| | | |
| | | private static String fileName = "poscom.properties"; |
| | | |
| | | // åæ·ç¼ç |
| | | public static String memberCode; |
| | | // 请æ±APIKEY |
| | | public static String apiKey; |
| | | // 模æ¿ç¼å· |
| | | public static String templetId; |
| | | |
| | | static { |
| | | memberCode = PropertyUtil.getProp(fileName, "memberCode"); |
| | | apiKey = PropertyUtil.getProp(fileName, "apiKey"); |
| | | templetId = PropertyUtil.getProp(fileName, "templetId"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.poscom.config; |
| | | |
| | | /** |
| | | * @Description ä½³åäºæå°æºæå°ä¿¡æ¯çå
容 |
| | | * @Author ZHAOXL |
| | | * @Date 2024/3/6 17:28 |
| | | * @Version 1.0 |
| | | */ |
| | | public interface PoscomPrintData { |
| | | |
| | | //ç¥¨æ® mode:1 |
| | | String ReceiptData1 = "ä½³åäºæå°ï¼æ 线èåæºäºèç½+æ¶ä»£ï¼ä½³åäºæå°ç»ç«¯è½å¸®æ¨è½»æ¾å®ç°è¿ç¨æå°ï¼è®©æ¨éæ¶éå°æ¥åçå©ãç»ç«¯ç¼å·ï¼864031028000000!@#$%^&*()_+~{};'\\,../<>?èç³»é®ç®±ï¼service@poscom.cn ç½å:http://cloud.poscom.cn"; |
| | | |
| | | //ç¥¨æ® mode:2 |
| | | String ReceiptData2 = "ä½³åäºæå°ï¼æ 线èåæº\r\n" |
| | | + "äºèç½+æ¶ä»£ï¼ä½³åäºæå°ç»ç«¯è½å¸®æ¨è½»æ¾å®ç°è¿ç¨æå°ï¼è®©æ¨éæ¶éå°æ¥åçå©ã\r\n" |
| | | + "<gpBarCode Type=2 Height=20 Position=2>123456789012</gpBarCode>ç»ç«¯ç¼å·ï¼864031028000000\r\n" |
| | | + "1: UPC-A:\r\n" |
| | | + "<gpBarCode Type=1 Height=40 Position=0>11111111111</gpBarCode>" |
| | | + "2: JAN13(EAN13):\r\n" |
| | | + "<gpBarCode Type=2 Height=45 Position=1>222222222222</gpBarCode>" |
| | | + "3: JAN8(EAN8):\r\n" |
| | | + "<gpBarCode Type=3 Height=50 Position=2>3333333</gpBarCode>" |
| | | + "4: CODE39:\r\n" |
| | | + "<gpBarCode Type=4 Height=55 Position=3>33333</gpBarCode>" |
| | | + "5: ITF:\r\n" |
| | | + "<gpBarCode Type=5 Height=40 Position=2>444444</gpBarCode>" |
| | | + "6: CODABAR:\r\n" |
| | | + "<gpBarCode Type=6 Height=45 Position=1>A52$1+2-23C</gpBarCode>" |
| | | + "abcdefghijklmnopqrstuvwxyz\r\n" |
| | | + "ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n" |
| | | + "1234567890\r\n" |
| | | + "!@#$%^&*()_+~{};'\\,../<>?\r\n" |
| | | + "<gpQRCode>http://cloud.poscom.cn</gpQRCode>"; |
| | | |
| | | //ç¥¨æ® mode:3 |
| | | String ReceiptData3 = "1D21221B61010D0A4120434146450D0A1B401B6101382F462C204E6F2E382C204A696E677975616E20526F61640D0A4A6964612C205A68756861692C204775616E67646F6E670D0A353139303135204368696E610D0A303735362D3838383838380D0A1B402D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D0D0A494E56204E6F20B5A5BAC5C2EB3A2030312D3130303030310D0A44617465202020C8D5C6DA20203A2030362F31392F3230313720383A33353A323920414D0D0A53616C65736D616E20BEADCAD6C8CB3A20416E64790D0A437573746F6D657220B9CBBFCD20203A20434153480D0A20200D0A1B61011B2108494E564F49434520CAD5BEDD0D0A1B40200D0A4974656D0920202020205174792020202020205072696365202020202020202020202020546F74616C0D0AC6B7C3FB092020202020CAFDC1BF2020202020BCDBC7AE20202020202020202020202020D7DCCAFD0D0A2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D0D0A43617070756363696E6F20202020203120202020202032382E303020202020202020202020202032382E30300D0A4C61747465202020202020202020203120202020202032382E303020202020202020202020202032382E30300D0A0D0A0D0A2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D0D0A20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201B6102546F74616C3A35362E30300D0A0909090920202020202020202020202020202020202020202020202D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D0D0A4772616E6420546F74616C20D7DCCAFD3A35362E30300D0A0D0A0D0A1B401B61015468616E6B20596F752E20506C6561736520436F6D6520416761696E2E0D0A0D0A200D0A1D564200"; |
| | | |
| | | //æ ç¾ mode:2 |
| | | String LabelData2 = "^XA^MNN^PW480^LL0400^LH0,0^CW1,E:MSUNG.FNT^FS" |
| | | + "^CI28" |
| | | + "^FO30,20 ^A0,30,30 ^FD[190]^FS" |
| | | + "^FO20,50 ^A1,30,30 ^FDç®çå°^FS" |
| | | + "^FO120,50 ^A1,30,30 ^FDç®çå°ä»£ç ^FS" |
| | | + "^FO20,85 ^A1,30,30 ^FDå§åå°^FS" |
| | | + "^FO120,85 ^A1,30,30 ^FDå§åå°ä»£ç ^FS" |
| | | + "^FO300,60 ^A1,36,36 ^FDæ ·å¼ æµè¯^FS" |
| | | + "^FO20,120 ^A1,35,35 ^FDä»¶æ°^FS" |
| | | + "^FO100,122 ^A0,30,30 ^FD0^FS" |
| | | + "^FO120,122 ^A0,30,30 ^FD0325^FS" |
| | | + "^FO190,122 ^A0,30,30 ^FD16:08^FS" |
| | | + "^FO 330,110 ^A0,50,50 ^FD0-0^FS" |
| | | + "^FO28,200^BY4^BCN,110,Y,N,N,N ^FD>;160637000020^FS" |
| | | + "^FO0,170^GB480,0,4^FS" |
| | | + "^FO280,0^GB,170,4^FS" |
| | | + "^FO0,0^GB480,400,4^FS" |
| | | + "^XZ"; |
| | | |
| | | //æ ç¾ mode:3 |
| | | String LabelData3 = "EFBBBF5E58415E4D4E4E5E50573438305E4C4C303430305E4C48302C305E4357312C453A4D53554E472E464E545E46530D0A5E434932380D0A5E464F33302C3230205E41302C33302C3330205E46445B3139305D5E46530D0A5E464F32302C3530205E41312C33302C3330205E4644E79BAEE79A84E59CB05E46530D0A5E464F3132302C3530205E41312C33302C3330205E4644E79BAEE79A84E59CB0E4BBA3E7A0815E46530D0A5E464F32302C3835205E41312C33302C3330205E4644E5A78BE58F91E59CB05E4653220D0A5E464F3132302C3835205E41312C33302C3330205E4644E5A78BE58F91E59CB0E4BBA3E7A0815E46530D0A5E464F3330302C3630205E41312C33362C3336205E4644E6A0B7E5BCA0E6B58BE8AF955E46530D0A5E464F32302C313230205E41312C33352C3335205E4644E4BBB6E695B05E46530D0A5E464F3130302C313232205E41302C33302C3330205E4644305E46530D0A5E464F3132302C313232205E41302C33302C3330205E4644303332355E46530D0A5E464F3139302C313232205E41302C33302C3330205E464431363A30385E46530D0A5E464F203333302C313130205E41302C35302C3530205E4644302D305E46530D0A5E464F32382C3230305E4259345E42434E2C3131302C592C4E2C4E2C4E205E46443E3B3136303633373030303032305E46530D0A5E464F302C3137305E47423438302C302C345E46530D0A5E464F3238302C305E47422C3137302C345E46530D0A5E464F302C305E47423438302C3430302C345E46530D0A5E585A"; |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.poscom.config; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Description 模æ¿åæ° |
| | | * @Author ZHAOXL |
| | | * @Date 2024/3/7 10:11 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | @ApiModel(value ="模æ¿åæ°") |
| | | public class TempletParams { |
| | | |
| | | // ååºåç§° |
| | | private String shopName; |
| | | // äº¤ææµæ°´ |
| | | private String payWater; |
| | | // 订åä»·æ ¼ |
| | | private String orderPrice; |
| | | // 伿 叿µæ£ |
| | | private String couponFace; |
| | | // ç§¯åæµæ£ |
| | | private String payIntegral; |
| | | // æ¶æ¬¾äºº |
| | | private String cashier; |
| | | // æ¶æ¬¾æ¶é´ |
| | | private String createTime; |
| | | // 宿¶éé¢ |
| | | private String payMoney; |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.poscom.util; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.DataOutputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.Iterator; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description ä½³åäºæå°æºè¯·æ±ç±» |
| | | * @Author ZHAOXL |
| | | * @Date 2024/3/6 16:26 |
| | | * @Version 1.0 |
| | | */ |
| | | public class PoscomRequest { |
| | | |
| | | /** |
| | | * Http Request POST Method |
| | | * |
| | | * @param urlStr 请æ±URL |
| | | * @param params 请æ±åæ° |
| | | * @return |
| | | */ |
| | | public static String sendPost(String urlStr, Map<String, String> params){ |
| | | String result = ""; |
| | | HttpURLConnection conn = null; |
| | | String BOUNDARY = "----------------------------------------------"; |
| | | int retry = 0; |
| | | while (retry < 3) { |
| | | result = ""; |
| | | try { |
| | | URL url = new URL(urlStr); |
| | | conn = (HttpURLConnection) url.openConnection(); |
| | | conn.setConnectTimeout(5000); |
| | | conn.setReadTimeout(30000); |
| | | conn.setDoOutput(true); |
| | | conn.setDoInput(true); |
| | | conn.setUseCaches(false); |
| | | conn.setRequestMethod("POST"); |
| | | |
| | | conn.setRequestProperty("Connection", "Keep-Alive"); |
| | | conn.setRequestProperty("User-Agent", |
| | | "Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.6)"); |
| | | conn.setRequestProperty("Content-Type", |
| | | "multipart/form-data; boundary=" + BOUNDARY); |
| | | |
| | | DataOutputStream out = new DataOutputStream(conn.getOutputStream()); |
| | | |
| | | if (params != null) { |
| | | StringBuffer strBuf = new StringBuffer(); |
| | | Iterator iter = params.entrySet().iterator(); |
| | | while (iter.hasNext()) { |
| | | Map.Entry entry = (Map.Entry) iter.next(); |
| | | String inputName = (String) entry.getKey(); |
| | | String inputValue = (String) entry.getValue(); |
| | | if (inputValue == null) { |
| | | continue; |
| | | } |
| | | strBuf.append("\r\n").append("--").append(BOUNDARY) |
| | | .append("\r\n"); |
| | | strBuf.append("Content-Disposition: form-data; name=\"" |
| | | + inputName + "\"\r\n\r\n"); |
| | | strBuf.append(inputValue); |
| | | } |
| | | out.write(strBuf.toString().getBytes("UTF-8")); |
| | | } |
| | | String endData = "\r\n--" + BOUNDARY + "--\r\n"; |
| | | out.write(endData.getBytes()); |
| | | out.flush(); |
| | | out.close(); |
| | | // å®ä¹ BufferedReaderè¾å
¥æµæ¥è¯»åURLçååº |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader( |
| | | conn.getInputStream(),"UTF-8")); |
| | | String line; |
| | | while ((line = reader.readLine()) != null) { |
| | | result += line; |
| | | } |
| | | reader.close(); |
| | | reader = null; |
| | | JSONObject resultObject = JSONObject.parseObject(result); |
| | | int code = (int) resultObject.get("code"); |
| | | if (code > 1) { |
| | | throw new RuntimeException((String) resultObject.get("msg")); |
| | | } |
| | | break; |
| | | } catch (Exception e) { |
| | | retry++; |
| | | System.out.println("=====请æ±å¼å¸¸ START=====\r\n" + urlStr + "\r\n=====请æ±å¼å¸¸ END====="); |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if (conn != null) { |
| | | conn.disconnect(); |
| | | conn = null; |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * Http Request GET Method |
| | | * |
| | | * @param urlStr 请æ±URL |
| | | * @param params 请æ±åæ° |
| | | * @return |
| | | */ |
| | | public static String sendGet(String urlStr, Map<String, String> params) { |
| | | String result = "", paramsString = ""; |
| | | HttpURLConnection conn = null; |
| | | try { |
| | | if (params != null) { |
| | | Iterator iter = params.entrySet().iterator(); |
| | | while (iter.hasNext()) { |
| | | Map.Entry entry = (Map.Entry) iter.next(); |
| | | String inputName = (String) entry.getKey(); |
| | | String inputValue = (String) entry.getValue(); |
| | | if (inputValue == null) { |
| | | continue; |
| | | } |
| | | paramsString += inputName + "=" + inputValue + "&"; |
| | | } |
| | | } |
| | | |
| | | URL url = new URL(urlStr + "?" + paramsString); |
| | | conn = (HttpURLConnection) url.openConnection(); |
| | | conn.setConnectTimeout(5000); |
| | | conn.setReadTimeout(30000); |
| | | conn.setRequestProperty("Connection", "Keep-Alive"); |
| | | conn.setRequestProperty("User-Agent", |
| | | "Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.6)"); |
| | | |
| | | // 建ç«å®é
çè¿æ¥ |
| | | conn.connect(); |
| | | // å®ä¹ BufferedReaderè¾å
¥æµæ¥è¯»åURLçååº |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader( |
| | | conn.getInputStream())); |
| | | String line; |
| | | while ((line = reader.readLine()) != null) { |
| | | result += line; |
| | | } |
| | | reader.close(); |
| | | reader = null; |
| | | } catch (Exception e) { |
| | | System.out.println("=====请æ±å¼å¸¸ START=====\r\n" + urlStr + "\r\n=====请æ±å¼å¸¸ END====="); |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if (conn != null) { |
| | | conn.disconnect(); |
| | | conn = null; |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * è·åè¿å»ç¬¬å å¤©çæ¥æ |
| | | * |
| | | * @param past ä¸å½å¤©å·®å¼å¤©æ° |
| | | * @return |
| | | */ |
| | | public static String getPastDate(int past) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) - past); |
| | | Date today = calendar.getTime(); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String result = format.format(today); |
| | | return result; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.poscom.util; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @Description äºæå°æºå·¥å
·ç±» |
| | | * @Author ZHAOXL |
| | | * @Date 2024/3/8 16:36 |
| | | * @Version 1.0 |
| | | */ |
| | | public class PoscomUtil { |
| | | |
| | | /** |
| | | * å转为å
|
| | | * @Author ZHAOXL |
| | | * @Date 2024/3/8 16:48 |
| | | * @Version 1.0 |
| | | */ |
| | | public static String convertToYuan(Long payMoney) { |
| | | if (payMoney == null) { |
| | | return "0"; |
| | | } |
| | | BigDecimal totalAmount = new BigDecimal("" + payMoney).divide(new BigDecimal("100")); |
| | | return totalAmount + ""; |
| | | } |
| | | |
| | | /** |
| | | * long转String |
| | | * @Author ZHAOXL |
| | | * @Date 2024/3/8 16:39 |
| | | * @Version 1.0 |
| | | */ |
| | | public static String longToString(Long param) { |
| | | return param == null ? "0" : Long.toString(param); |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.poscom.util; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @Description è¯é³å
å®¹æ ¼å¼å |
| | | * @Author ZHAOXL |
| | | * @Date 2024/3/7 13:15 |
| | | * @Version 1.0 |
| | | */ |
| | | public class PoscomVoice { |
| | | |
| | | /** |
| | | * æ¯ä»å® |
| | | */ |
| | | public final static String ZFB = "2007"; |
| | | /** |
| | | * 微信 |
| | | */ |
| | | public final static String WX = "2008"; |
| | | |
| | | /** |
| | | * äºéªä» |
| | | */ |
| | | public final static String YSF = "2011"; |
| | | |
| | | /** |
| | | * ç°é |
| | | */ |
| | | public final static String XJ = "2014"; |
| | | |
| | | /** |
| | | * è¯é³ç±»åã |
| | | * 2 ä¸èªå¨ææ¾æ°è®¢åï¼ç人è¯é³ |
| | | */ |
| | | public final static String VOICE_TYPE_2 = "2"; |
| | | |
| | | /** |
| | | * è¯é³ä¸é¨å
容 |
| | | */ |
| | | public final static String VOICE_MIDDLE = "å·²æ¶æ¬¾"; |
| | | |
| | | /** |
| | | * åé符 |
| | | */ |
| | | public final static String SPLIT = "|"; |
| | | |
| | | private final static String unit[][] = {{"", "ä¸", "亿"}, {"", "å", "ç¾", "å"}}; |
| | | |
| | | /** |
| | | * æ ¼å¼åè¯é³å符串 |
| | | * @param strs åæ° |
| | | * @return String |
| | | * @Author ZHAOXL |
| | | * @Date 2024/3/7 13:57 |
| | | * @Version 1.0 |
| | | */ |
| | | public static String format(String strs) { |
| | | StringBuilder sb=new StringBuilder(); |
| | | for (char c : strs.toCharArray()) { |
| | | sb.append(c); |
| | | sb.append(SPLIT); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * æ ¼å¼åéé¢ |
| | | * @param price éé¢ |
| | | * @return String |
| | | * @Author ZHAOXL |
| | | * @Date 2024/3/7 16:07 |
| | | * @Version 1.0 |
| | | */ |
| | | public static String priceFormat(Long price) { |
| | | BigDecimal decimal = new BigDecimal("" + price).divide(new BigDecimal("100")); |
| | | Double n = decimal.doubleValue(); |
| | | StringBuilder sb = new StringBuilder(); |
| | | String numStr = String.valueOf(n); |
| | | int dotIndex = numStr.indexOf("."); |
| | | String decimalPart = numStr.substring(dotIndex); |
| | | if (".0".equals(decimalPart)) { |
| | | decimalPart = ""; |
| | | } |
| | | int integerPart = (int) Math.floor(n); |
| | | if (integerPart == 0) { |
| | | sb.append("0"); |
| | | }; |
| | | for (int i = 0; i < unit[0].length && integerPart > 0; i++) { |
| | | sb.insert(0, unit[0][i]); |
| | | for (int j = 0; j < unit[1].length && n > 0; j++) { |
| | | if (integerPart % 10 > 0) { |
| | | sb.insert(0, integerPart % 10 + unit[1][j]); |
| | | } |
| | | integerPart = integerPart / 10; |
| | | } |
| | | } |
| | | sb.append(decimalPart + "å
"); |
| | | return sb.toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.poscom.util; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | |
| | | public class StringToAscii { |
| | | |
| | | private static String toHexUtil(int n){ |
| | | String rt=""; |
| | | switch(n){ |
| | | case 10:rt+="A";break; |
| | | case 11:rt+="B";break; |
| | | case 12:rt+="C";break; |
| | | case 13:rt+="D";break; |
| | | case 14:rt+="E";break; |
| | | case 15:rt+="F";break; |
| | | default: |
| | | rt+=n; |
| | | } |
| | | return rt; |
| | | } |
| | | |
| | | public static String toHex(int n){ |
| | | StringBuilder sb=new StringBuilder(); |
| | | if(n/16==0){ |
| | | return toHexUtil(n); |
| | | }else{ |
| | | String t=toHex(n/16); |
| | | int nn=n%16; |
| | | sb.append(t).append(toHexUtil(nn)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public static String parseAscii(String str){ |
| | | StringBuilder sb=new StringBuilder(); |
| | | byte[] bs=str.getBytes(); |
| | | for(int i=0;i<bs.length;i++) { |
| | | sb.append("0x"); |
| | | sb.append(toHex(bs[i])); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public static void main(String[] args) throws UnsupportedEncodingException { |
| | | String s="10.5"; |
| | | System.out.println("转æ¢åçå符串æ¯ï¼"+ StringToAscii.parseAscii(s)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.poscom.util; |
| | | |
| | | import java.nio.charset.Charset; |
| | | |
| | | public class StringToGB18030 { |
| | | |
| | | public static String toGB18030(String str) { |
| | | StringBuilder sb=new StringBuilder("0x"); |
| | | Charset gb18030 = Charset.forName("GB18030"); |
| | | byte[] bytes = str.getBytes(gb18030); |
| | | for (byte b : bytes) { |
| | | sb.append(Integer.toHexString(b & 0xFF).toUpperCase()); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public static String parseGB18030(String strs) { |
| | | StringBuilder sb=new StringBuilder(); |
| | | for (char c : strs.toCharArray()) { |
| | | sb.append(toGB18030(Character.toString(c))); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String s = "å·²æ¶å°"; |
| | | System.out.println("转æ¢åçå符串æ¯ï¼"+ StringToGB18030.parseGB18030(s)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.rateLimit; |
| | | |
| | | import java.lang.annotation.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target({ElementType.METHOD}) |
| | | @Documented |
| | | public @interface ApiRateLimit { |
| | | /** |
| | | * èµæºçkey,å¯ä¸ |
| | | * ä½ç¨ï¼ä¸åçæ¥å£ï¼ä¸åçæµéæ§å¶ |
| | | */ |
| | | String key() default ""; |
| | | |
| | | /** |
| | | * æå¤ç访é®éå¶æ¬¡æ° |
| | | */ |
| | | double permitsPerSecond(); |
| | | |
| | | /** |
| | | * è·å令çæå¤§çå¾
æ¶é´ |
| | | */ |
| | | long timeout(); |
| | | |
| | | /** |
| | | * è·å令çæå¤§çå¾
æ¶é´,åä½(ä¾:åé/ç§/毫ç§) é»è®¤:æ¯«ç§ |
| | | */ |
| | | TimeUnit timeunit() default TimeUnit.MILLISECONDS; |
| | | |
| | | /** |
| | | * å¾ä¸å°ä»¤ççæç¤ºè¯ |
| | | */ |
| | | String msg() default "ç³»ç»ç¹å¿,请ç¨ååè¯."; |
| | | } |
New file |
| | |
| | | package com.nuvole.rateLimit; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.common.collect.Maps; |
| | | import com.google.common.util.concurrent.RateLimiter; |
| | | import com.nuvole.common.domain.emnu.CommonResultEmnu; |
| | | import com.nuvole.common.domain.result.CommonResult; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.reflect.MethodSignature; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.lang.reflect.Method; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Slf4j |
| | | @Aspect |
| | | @Component |
| | | public class ApiRateLimitAop { |
| | | /** |
| | | * ä¸åçæ¥å£ï¼ä¸åçæµéæ§å¶ |
| | | * mapçkey为 Limiter.key |
| | | */ |
| | | private final Map<String, RateLimiter> limitMap = Maps.newConcurrentMap(); |
| | | |
| | | @Around("@annotation(com.nuvole.rateLimit.ApiRateLimit)") |
| | | public Object around(ProceedingJoinPoint joinPoint) throws Throwable { |
| | | MethodSignature signature = (MethodSignature) joinPoint.getSignature(); |
| | | Method method = signature.getMethod(); |
| | | //æ¿limitçæ³¨è§£ |
| | | ApiRateLimit limit = method.getAnnotation(ApiRateLimit.class); |
| | | if (limit != null) { |
| | | //keyä½ç¨ï¼ä¸åçæ¥å£ï¼ä¸åçæµéæ§å¶ |
| | | String key = limit.key(); |
| | | RateLimiter rateLimiter = null; |
| | | //éªè¯ç¼åæ¯å¦æå½ä¸key |
| | | if (!limitMap.containsKey(key)) { |
| | | // åå»ºä»¤çæ¡¶ |
| | | rateLimiter = RateLimiter.create(limit.permitsPerSecond()); |
| | | limitMap.put(key, rateLimiter); |
| | | log.info("æ°å»ºäºä»¤çæ¡¶={}ï¼å®¹é={}", key, limit.permitsPerSecond()); |
| | | } |
| | | rateLimiter = limitMap.get(key); |
| | | // æ¿ä»¤ç |
| | | boolean acquire = rateLimiter.tryAcquire(limit.timeout(), limit.timeunit()); |
| | | // æ¿ä¸å°å½ä»¤ï¼ç´æ¥è¿åå¼å¸¸æç¤º |
| | | if (!acquire) { |
| | | log.debug("ä»¤çæ¡¶={}ï¼è·å令ç失败", key); |
| | | this.responseFail(limit.msg()); |
| | | return null; |
| | | } |
| | | } |
| | | return joinPoint.proceed(); |
| | | } |
| | | |
| | | /** |
| | | * @param msg æç¤ºä¿¡æ¯ |
| | | */ |
| | | private void responseFail(String msg) { |
| | | HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse(); |
| | | CommonResult resultData = new CommonResult(CommonResultEmnu.REQUEST_LIMIT_ERR, msg); |
| | | response.setContentType("application/json;charset=UTF-8"); |
| | | PrintWriter out = null; |
| | | try { |
| | | out = response.getWriter(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | out.print(JSONObject.toJSONString(resultData)); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | // @formatter:off |
| | | |
| | | import cn.hutool.core.util.CharsetUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import cn.hutool.crypto.symmetric.AES; |
| | | |
| | | /** |
| | | * .-~~~~~~~~~-._ _.-~~~~~~~~~-. |
| | | * __.' @Author ~. .~ ä»£ç æ Bug `.__ |
| | | * .'// liu.q \./ (ç§ç±) \\`. |
| | | * .'// [916000612@qq.com] | 欲ç»ç¥å å¼åèªå®« \\`. |
| | | * .'// .-~"""""""~~~~-._ | _,-~~~~"""""""~-. \\`. |
| | | * .'//.-" 2019-04-24 `-. | .-' 14:58 "-.\\`. |
| | | * .'//______.============-.. \ | / ..-============.______\\`. |
| | | *.'______________________________\|/______________________________`. |
| | | * |
| | | * @Description : |
| | | */ |
| | | // @formatter:on |
| | | |
| | | public class AESUtil { |
| | | |
| | | public static String k = "lNQqkL1BfSwt2MKw"; |
| | | |
| | | /* |
| | | * @Author : liu.q [916000612@qq.com] |
| | | * @Date : 2019-04-24 15:01 |
| | | * @param mixpd : å¯ç |
| | | * @return : java.lang.String å å¯åçå¯ç |
| | | * @Description : AESå å¯ |
| | | */ |
| | | public static String encode(String s){ |
| | | if (StrUtil.isBlank(s)) { |
| | | return ""; |
| | | } |
| | | AES aes = SecureUtil.aes(k.getBytes()); |
| | | return aes.encryptHex(s); |
| | | } |
| | | |
| | | /* |
| | | * @Author : liu.q [916000612@qq.com] |
| | | * @Date : 2019-04-24 15:01 |
| | | * @param mixpd : å å¯çå¯ç |
| | | * @return : java.lang.String è§£å¯åçå¯ç |
| | | * @Description :AESè§£å¯ |
| | | */ |
| | | public static String decode(String s){ |
| | | if (StrUtil.isBlank(s)) { |
| | | return ""; |
| | | } |
| | | AES aes = SecureUtil.aes(k.getBytes()); |
| | | return aes.decryptStr(s, CharsetUtil.CHARSET_UTF_8); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import java.security.AlgorithmParameters; |
| | | import java.security.Security; |
| | | |
| | | import javax.crypto.Cipher; |
| | | import javax.crypto.spec.IvParameterSpec; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.bouncycastle.jce.provider.BouncyCastleProvider; |
| | | |
| | | /** |
| | | * 微信å è§£å¯å·¥å
·ç±» |
| | | * |
| | | * @author liujun |
| | | * @Date 2019/5/27 17:36 |
| | | */ |
| | | public class AesCbcUtil { |
| | | |
| | | static { |
| | | // BouncyCastleæ¯ä¸ä¸ªå¼æºçå è§£å¯è§£å³æ¹æ¡ï¼ä¸»é¡µå¨http://www.bouncycastle.org/ |
| | | Security.addProvider(new BouncyCastleProvider()); |
| | | } |
| | | |
| | | /** |
| | | * AESè§£å¯ |
| | | * |
| | | * @param data |
| | | * //坿ï¼è¢«å å¯çæ°æ® |
| | | * @param key |
| | | * //ç§é¥ |
| | | * @param iv |
| | | * //åç§»é |
| | | * @param encodingFormat |
| | | * //è§£å¯åçç»æéè¦è¿è¡çç¼ç |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String decrypt(String data, String key, String iv, String encodingFormat) throws Exception { |
| | | // initialize(); |
| | | // 被å å¯çæ°æ® |
| | | byte[] dataByte = Base64.decodeBase64(data.getBytes()); |
| | | // å å¯ç§é¥ |
| | | byte[] keyByte = Base64.decodeBase64(key.getBytes()); |
| | | // åç§»é |
| | | byte[] ivByte = Base64.decodeBase64(iv.getBytes()); |
| | | Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); |
| | | SecretKeySpec spec = new SecretKeySpec(keyByte, "AES"); |
| | | AlgorithmParameters parameters = AlgorithmParameters.getInstance("AES"); |
| | | parameters.init(new IvParameterSpec(ivByte)); |
| | | // åå§å |
| | | cipher.init(Cipher.DECRYPT_MODE, spec, parameters); |
| | | byte[] resultByte = cipher.doFinal(dataByte); |
| | | if (null != resultByte && resultByte.length > 0) { |
| | | String result = new String(resultByte, encodingFormat); |
| | | return result; |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import org.springframework.beans.BeansException; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.context.ApplicationContextAware; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @ClassName ApplicationContextUtil |
| | | * @Author cy |
| | | * @Date 2023/6/20 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | @Component |
| | | public class ApplicationContextUtil implements ApplicationContextAware { |
| | | private static ApplicationContext applicationContext; |
| | | |
| | | public static Object getBean(String beanName){ |
| | | return applicationContext.getBean(beanName); |
| | | } |
| | | |
| | | public static <T> T getBean(Class<T> clazz){ |
| | | return (T)applicationContext.getBean(clazz); |
| | | } |
| | | |
| | | public ApplicationContext getApplicationContext(){ |
| | | return applicationContext; |
| | | } |
| | | |
| | | @Override |
| | | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
| | | ApplicationContextUtil.applicationContext = applicationContext; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import com.baidu.aip.speech.AipSpeech; |
| | | import com.baidu.aip.speech.TtsResponse; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * ç¾åº¦æºè½äºå·¥å
·ç±» |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2020/4/27 17:02 |
| | | */ |
| | | @Slf4j |
| | | public class BaiduUtil { |
| | | |
| | | //详ç»è¯·æç´¢ç¾åº¦æºè½äºæ¥ç |
| | | |
| | | //设置APPID/AK/SK |
| | | private static final String APP_ID = "19624255"; |
| | | private static final String API_KEY = "NqUfTfQUi31Gu5L0fD8YXRWZ"; |
| | | private static final String SECRET_KEY = "DrFxoeyOEz23x3NUVb6GMo2PsZTiXk1a"; |
| | | |
| | | /** |
| | | * åå§åä¸ä¸ªAipSpeech |
| | | */ |
| | | private static AipSpeech aipSpeech = new AipSpeech(APP_ID, API_KEY, SECRET_KEY); |
| | | |
| | | /** |
| | | * è¯é³åæ - éè¿æå转å为mp3 |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2020/4/27 17:03 |
| | | */ |
| | | public static byte[] speech(String text) { |
| | | // å¯éï¼è®¾ç½®ç½ç»è¿æ¥åæ° |
| | | aipSpeech.setConnectionTimeoutInMillis(2000); |
| | | aipSpeech.setSocketTimeoutInMillis(60000); |
| | | |
| | | // è°ç¨æ¥å£ |
| | | HashMap<String, Object> options = new HashMap<>(16); |
| | | /*è¯éï¼åå¼0-15ï¼é»è®¤ä¸º5ä¸è¯é*/ |
| | | options.put("spd", 5); |
| | | /*é³è°ï¼åå¼0-15ï¼é»è®¤ä¸º5ä¸è¯è°*/ |
| | | options.put("pit", 5); |
| | | /*é³éï¼åå¼0-15ï¼é»è®¤ä¸º5ä¸é³é*/ |
| | | options.put("vol", 10); |
| | | // åé³äººéæ©, åºç¡é³åºï¼0为度å°ç¾ï¼1为度å°å®ï¼3为度éé¥ï¼4ä¸ºåº¦ä¸«ä¸«ï¼ |
| | | // ç²¾åé³åºï¼5为度å°å¨ï¼103为度米æµï¼106为度åæï¼110为度å°ç«¥ï¼111为度å°èï¼é»è®¤ä¸ºåº¦å°ç¾ |
| | | options.put("per", 0); |
| | | |
| | | TtsResponse res = aipSpeech.synthesis(text, "zh", 1, options); |
| | | byte[] data = res.getData(); |
| | | JSONObject res1 = res.getResult(); |
| | | if (data != null) { |
| | | return data; |
| | | } |
| | | if (res1 != null) { |
| | | log.info(res1.toString(2)); |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import org.apache.commons.beanutils.BeanMap; |
| | | |
| | | import java.beans.BeanInfo; |
| | | import java.beans.IntrospectionException; |
| | | import java.beans.Introspector; |
| | | import java.beans.PropertyDescriptor; |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.lang.reflect.Method; |
| | | import java.util.Map; |
| | | // @formatter:off |
| | | /** |
| | | * .-~~~~~~~~~-._ _.-~~~~~~~~~-. |
| | | * __.' @Author ~. .~ ä»£ç æ Bug `.__ |
| | | * .'// liu.q \./ (ç§ç±) \\`. |
| | | * .'// [916000612@qq.com] | 欲ç»ç¥å å¼åèªå®« \\`. |
| | | * .'// .-~"""""""~~~~-._ | _,-~~~~"""""""~-. \\`. |
| | | * .'//.-" 2019-04-07 `-. | .-' 19:44 "-.\\`. |
| | | * .'//______.============-.. \ | / ..-============.______\\`. |
| | | *.'______________________________\|/______________________________`. |
| | | * |
| | | * @Description : bean map äºç¸è½¬æ¢å·¥å
·ç±» |
| | | */ |
| | | // @formatter:on |
| | | public class BeanUtil { |
| | | |
| | | public static <T> Map<String, Object> bean2Map(T bean, Map<String, Object> mp) { |
| | | if (bean == null) { |
| | | return mp; |
| | | } |
| | | try { |
| | | BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass()); |
| | | PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); |
| | | for (PropertyDescriptor property : propertyDescriptors) { |
| | | String k = property.getName(); |
| | | |
| | | if (!k.equals("class")) { |
| | | Method getter = property.getReadMethod();// Java䏿ä¾äºç¨æ¥è®¿é®æä¸ªå±æ§ç |
| | | // getter/setteræ¹æ³ |
| | | Object value; |
| | | value = getter.invoke(bean); |
| | | mp.put(k, value); |
| | | } |
| | | } |
| | | } catch (IntrospectionException e) { |
| | | e.printStackTrace(); |
| | | } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return mp; |
| | | |
| | | } |
| | | |
| | | |
| | | public static <T> T map2Bean(Map<String, Object> mp, Class<T> beanCls) throws IllegalAccessException, InstantiationException, InvocationTargetException, IntrospectionException { |
| | | T t = null; |
| | | BeanInfo beanInfo = Introspector.getBeanInfo(beanCls); |
| | | PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); |
| | | t = beanCls.newInstance(); |
| | | for (PropertyDescriptor property : propertyDescriptors) { |
| | | String k = property.getName(); |
| | | |
| | | if (mp.containsKey(k)) { |
| | | Object value = mp.get(k); |
| | | Method setter = property.getWriteMethod();// Java䏿ä¾äºç¨æ¥è®¿é®æä¸ªå±æ§ç |
| | | // getter/setteræ¹æ³ |
| | | setter.invoke(t, value); |
| | | } |
| | | } |
| | | return t; |
| | | } |
| | | |
| | | public static Map obj2Map(Object obj) { |
| | | if (obj == null) { |
| | | return new BeanMap(); |
| | | } |
| | | return new BeanMap(obj); |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.nuvole.common.domain.emnu.CommonResultEmnu; |
| | | import com.nuvole.common.domain.result.CommonResult; |
| | | import cpcn.institution.tools.net.RequestDgtEnvlp; |
| | | import cpcn.institution.tools.util.DigitalEnvelopeUtil; |
| | | import cpcn.institution.tools.util.StringUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | import payment.api.system.AggregateEnvironment; |
| | | import payment.api.system.Gateway4FileEnvironment; |
| | | import payment.api.system.PaymentEnvironment; |
| | | import payment.api.system.TxMessenger; |
| | | import payment.api.tx.TxBaseRequest; |
| | | import payment.api.tx.TxBaseResponse; |
| | | import payment.api.tx.aggregate.Tx5011Request; |
| | | import payment.api.tx.aggregate.Tx5011Response; |
| | | import payment.api.tx.foundationaccount.*; |
| | | import payment.api.tx.gatheringaccredit.Tx2751Request; |
| | | import payment.api.tx.gatheringaccredit.Tx2751Response; |
| | | import payment.api.tx.payroll.Tx4600Request; |
| | | import payment.api.tx.payroll.Tx4600Response; |
| | | import payment.api.tx.statement.Tx1850Request; |
| | | import payment.api.tx.statement.Tx1850Response; |
| | | import payment.api.util.GUIDGenerator; |
| | | import payment.api.vo.ImageInfo; |
| | | import payment.api.vo.SplitItem; |
| | | |
| | | import java.lang.reflect.Constructor; |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * @ClassName CncpUtil |
| | | * @Author cy |
| | | * @Date 2023/7/13 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | @Slf4j |
| | | public class CncpUtil { |
| | | public static void initUtil(String configPath) { |
| | | try { |
| | | PaymentEnvironment.initialize(configPath); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | CncpUtil.paymentConfigPath = configPath; |
| | | } |
| | | |
| | | private static String paymentConfigPath; |
| | | |
| | | public static String getPaymentConfigPath() { |
| | | return paymentConfigPath; |
| | | } |
| | | |
| | | /** |
| | | * å½±å°ä»¶éé |
| | | * |
| | | * @param businessType ä¸å¡ç±»åï¼ 10-壹ä¼ä»-弿·ä¸ä¼ 身份影å°å¾çï¼é»è®¤ï¼ 11-壹ä¼ä»-å®åç¨æ·è¡¥å
å½±å°ä»¶ 12-壹ä¼ä»-弿·ä¿¡æ¯ä¿®æ¹å½±å°ä»¶ 20-èªäº«ä»-ç¾çº¦ä¸ä¼ 身份影å°å¾ç 30-ä¿¡ç¨æ¯ä»-åå
¥ææå½±åä»¶ 40-ä¿¡ç¨æ¯ä»-ç¨ä¿¡ç³è¯·åè¯ |
| | | * @return |
| | | */ |
| | | public static Tx4600Response tx4600(short businessType, String userId, ArrayList<ImageInfo> imageTypes) { |
| | | Tx4600Request txRequest = new Tx4600Request(); |
| | | txRequest.setInstitutionID(PaymentEnvironment.institutionID); |
| | | txRequest.setTxSN(IdGenerator.getUUID()); |
| | | txRequest.setBusinessType(businessType + ""); |
| | | txRequest.setUserID(userId); |
| | | |
| | | txRequest.setImageInfoList(imageTypes); |
| | | // 3.æ§è¡æ¥æå¤ç |
| | | try { |
| | | txRequest.process(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | HashMap<String, String> map = new HashMap<String, String>(); |
| | | map.put("Flag", "50"); |
| | | putCommonParam(map, txRequest); |
| | | return dealRequestResult(map, Tx4600Response.class); |
| | | } |
| | | |
| | | /** |
| | | * 弿·æ¥å£ç¨äºä¸ªäººãä¼ä¸ç¨æ·æä¸ªä½å·¥åæ·å¨æºæç³»ç»å¼ç«é¶è¡çµåè´¦æ·ç¯èã |
| | | * |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static Tx4601Response tx4601(String userId) throws Exception { |
| | | |
| | | // 1.åå¾åæ° |
| | | String institutionID = PaymentEnvironment.institutionID; |
| | | String txSN = GUIDGenerator.genGUID(); |
| | | // String userID = null; |
| | | String userID = "cy88888888"; |
| | | String userType = "11"; |
| | | String parentUserID = null; |
| | | |
| | | String phoneNumber = "17721229769"; |
| | | String userName = "常è¿"; |
| | | String credentialType = "0"; |
| | | String credentialNumber = "410105199603076114"; |
| | | String issDate = "20230130"; |
| | | String expiryDate = "20231230"; |
| | | String indAddress = "ä¸å½æ²³åçéå·å¸éæ°´åºåæè·¯è¡é"; |
| | | String indEmail = "166459@qq.com"; |
| | | |
| | | String province = "41"; |
| | | String city = "410100"; |
| | | String district = "410105"; |
| | | |
| | | // String credentialAddress = request.getParameter("CredentialAddress"); |
| | | // String occupation = request.getParameter("Occupation"); |
| | | |
| | | // String corporationName = "CorporationName"; |
| | | // String corporationShort = "CorporationShort"; |
| | | // String categoryType = "CategoryType"; |
| | | // String corEmail = "CorEmail"; |
| | | // String corAddress = "CorAddress"; |
| | | |
| | | // String industryBelongType = "IndustryBelongType"; |
| | | // String industry = "Industry"; |
| | | // String scale = "Scale"; |
| | | // String basicAcctNo = "BasicAcctNo"; |
| | | // String approvalNo = "ApprovalNo"; |
| | | // String authCapital = "AuthCapital"; |
| | | // String businessScope = "BusinessScope"; |
| | | // String corType = "CorType"; |
| | | // String unifiedSocialCreditCode = "UnifiedSocialCreditCode"; |
| | | // String AllLicenceIssDate = "AllLicenceIssDate"; |
| | | // String allLicenceExpiryDate = "AllLicenceExpiryDate"; |
| | | // String legalPersonName = "LegalPersonName"; |
| | | // String legalCredentialType = "LegalCredentialType"; |
| | | // String legalCredentialNumber = "LegalCredentialNumber"; |
| | | // String legalPersonIssDate = "LegalPersonIssDate"; |
| | | // String legalPersonExpiryDate = "LegalPersonExpiryDate"; |
| | | // String legalPersonContactNumber = "LegalPersonContactNumber"; |
| | | // String legalPersonEmail = "LegalPersonEmail"; |
| | | // String shareholder = "Shareholder"; |
| | | // String controller = "Controller"; |
| | | // String beneficiary = "Beneficiary"; |
| | | // String consigneeName = "ConsigneeName"; |
| | | // String consigneeCredentialType = "ConsigneeCredentialType"; |
| | | // String consigneeCredentialNumber = "ConsigneeCredentialNumber"; |
| | | // String consigneeIssDate = "ConsigneeIssDate"; |
| | | // String consigneeExpiryDate = "ConsigneeExpiryDate"; |
| | | // String consigneeContactNumber = "ConsigneeContactNumber"; |
| | | //// |
| | | // String[] shareholderNames = "ShareholderName"; |
| | | // String[] shCredentialTypes = "ShCredentialType"; |
| | | // String[] shCredentialNumbers = "ShCredentialNumber"; |
| | | // String[] shPersonIssDates = "ShPersonIssDate"; |
| | | // String[] shPersonExpiryDates = "ShPersonExpiryDate"; |
| | | |
| | | // |
| | | // String managerName = "ManagerName"; |
| | | // String managerCredentialType = "ManagerCredentialType"; |
| | | // String managerCredentialNumber = "ManagerCredentialNumber"; |
| | | // String managerIssDate = "ManagerIssDate"; |
| | | // String managerExpiryDate = "ManagerExpiryDate"; |
| | | // String managerContactNumber = "ManagerContactNumber"; |
| | | // String managerEmail = "ManagerEmail"; |
| | | // String managerCredentialAddress = "ManagerCredentialAddress"; |
| | | // String managerOccupation = "ManagerOccupation"; |
| | | // String retailerRegNumber = "RetailerRegNumber"; |
| | | // String retailerName = "RetailerName"; |
| | | // String retailerLicenseIssDate = "RetailerLicenseIssDate"; |
| | | // String retailerLicenseExpiryDate = "RetailerLicenseExpiryDate"; |
| | | // String retailerFormation = "RetailerFormation"; |
| | | // String retailerAddress = "RetailerAddress"; |
| | | // String retailerProvince = "RetailerProvince"; |
| | | // String retailerCity = "RetailerCity"; |
| | | // String retailerDistrict = "RetailerDistrict"; |
| | | // String retailerBusinessScope = "RetailerBusinessScope"; |
| | | // |
| | | // String bankAbilityFlag = "BankAbilityFlag"; |
| | | // String bindingTxSN = "BindingTxSN"; |
| | | // String bankID = "BankID"; |
| | | // String bankAccountNumber = "BankAccountNumber"; |
| | | // String bankPhoneNumber = "BankPhoneNumber"; |
| | | // String cNAPSCode = "CNAPSCode"; |
| | | // String branchName = "BranchName"; |
| | | // String bankProvince = "BankProvince"; |
| | | // String bankCity = "BankCity"; |
| | | |
| | | |
| | | // 2.å建交æè¯·æ±å¯¹è±¡ |
| | | Tx4601Request tx4601Request = new Tx4601Request(); |
| | | tx4601Request.setInstitutionID(institutionID); |
| | | tx4601Request.setTxSN(txSN); |
| | | tx4601Request.setUserID(userID); |
| | | tx4601Request.setParentUserID(parentUserID); |
| | | tx4601Request.setUserType(userType); |
| | | // tx4601Request.setAcceptanceConfirmType(acceptanceConfirmType); |
| | | // tx4601Request.setAccountLevel(accountLevel); |
| | | // tx4601Request.setImageCollectionTxSN(imageCollectionTxSN); |
| | | // tx4601Request.setNoticeURL(noticeURL); |
| | | tx4601Request.setBusinessType("10"); |
| | | |
| | | tx4601Request.setPhoneNumber(phoneNumber); |
| | | tx4601Request.setUserName(userName); |
| | | tx4601Request.setCredentialType(credentialType); |
| | | tx4601Request.setCredentialNumber(credentialNumber); |
| | | tx4601Request.setIssDate(issDate); |
| | | tx4601Request.setExpiryDate(expiryDate); |
| | | tx4601Request.setIndAddress(indAddress); |
| | | tx4601Request.setIndEmail(indEmail); |
| | | // tx4601Request.setCredentialAddress(credentialAddress); |
| | | // tx4601Request.setOccupation(occupation); |
| | | |
| | | // tx4601Request.setCorporationName(corporationName); |
| | | // tx4601Request.setCorporationShort(corporationShort); |
| | | // tx4601Request.setCategoryType(categoryType); |
| | | // tx4601Request.setCorEmail(corEmail); |
| | | // tx4601Request.setCorAddress(corAddress); |
| | | tx4601Request.setProvince(province); |
| | | tx4601Request.setCity(city); |
| | | tx4601Request.setDistrict(district); |
| | | // tx4601Request.setIndustryBelongType(industryBelongType); |
| | | // tx4601Request.setIndustry(industry); |
| | | // tx4601Request.setScale(scale); |
| | | // tx4601Request.setBasicAcctNo(basicAcctNo); |
| | | // tx4601Request.setApprovalNo(approvalNo); |
| | | // tx4601Request.setAuthCapital(authCapital); |
| | | // tx4601Request.setBusinessScope(businessScope); |
| | | // tx4601Request.setCorType(corType); |
| | | // tx4601Request.setUnifiedSocialCreditCode(unifiedSocialCreditCode); |
| | | // tx4601Request.setAllLicenceIssDate(AllLicenceIssDate); |
| | | // tx4601Request.setAllLicenceExpiryDate(allLicenceExpiryDate); |
| | | // tx4601Request.setLegalPersonName(legalPersonName); |
| | | // tx4601Request.setLegalCredentialType(legalCredentialType); |
| | | // tx4601Request.setLegalCredentialNumber(legalCredentialNumber); |
| | | // tx4601Request.setLegalPersonIssDate(legalPersonIssDate); |
| | | // tx4601Request.setLegalPersonExpiryDate(legalPersonExpiryDate); |
| | | // tx4601Request.setLegalPersonContactNumber(legalPersonContactNumber); |
| | | // tx4601Request.setLegalPersonEmail(legalPersonEmail); |
| | | // tx4601Request.setShareholder(shareholder); |
| | | // tx4601Request.setController(controller); |
| | | // tx4601Request.setBeneficiary(beneficiary); |
| | | // tx4601Request.setConsigneeName(consigneeName); |
| | | // tx4601Request.setConsigneeCredentialType(consigneeCredentialType); |
| | | // tx4601Request.setConsigneeCredentialNumber(consigneeCredentialNumber); |
| | | // tx4601Request.setConsigneeIssDate(consigneeIssDate); |
| | | // tx4601Request.setConsigneeExpiryDate(consigneeExpiryDate); |
| | | // tx4601Request.setConsigneeContactNumber(consigneeContactNumber); |
| | | // |
| | | // ArrayList<ShareholderPart> shareholderPartsList = null; |
| | | // if(shareholderNames != null && shareholderNames.length > 0){ |
| | | // shareholderPartsList = new ArrayList<ShareholderPart>(); |
| | | // for(int i = 0; i < shareholderNames.length; i ++){ |
| | | // ShareholderPart shareholderPart = new ShareholderPart(); |
| | | // shareholderPart.setShareholderName(shareholderNames[i]); |
| | | // shareholderPart.setShCredentialType(shCredentialTypes[i]); |
| | | // shareholderPart.setShCredentialNumber(shCredentialNumbers[i]); |
| | | // shareholderPart.setShPersonIssDate(shPersonIssDates[i]); |
| | | // shareholderPart.setShPersonExpiryDate(shPersonExpiryDates[i]); |
| | | // |
| | | // shareholderPartsList.add(shareholderPart); |
| | | // } |
| | | // } |
| | | // tx4601Request.setShareholderPartsList(shareholderPartsList); |
| | | // |
| | | // tx4601Request.setManagerName(managerName); |
| | | // tx4601Request.setManagerCredentialType(managerCredentialType); |
| | | // tx4601Request.setManagerCredentialNumber(managerCredentialNumber); |
| | | // tx4601Request.setManagerIssDate(managerIssDate); |
| | | // tx4601Request.setManagerExpiryDate(managerExpiryDate); |
| | | // tx4601Request.setManagerContactNumber(managerContactNumber); |
| | | // tx4601Request.setManagerEmail(managerEmail); |
| | | // tx4601Request.setManagerCredentialAddress(managerCredentialAddress); |
| | | // tx4601Request.setManagerOccupation(managerOccupation); |
| | | // tx4601Request.setRetailerRegNumber(retailerRegNumber); |
| | | // tx4601Request.setRetailerName(retailerName); |
| | | // tx4601Request.setRetailerLicenseIssDate(retailerLicenseIssDate); |
| | | // tx4601Request.setRetailerLicenseExpiryDate(retailerLicenseExpiryDate); |
| | | // tx4601Request.setRetailerFormation(retailerFormation); |
| | | // tx4601Request.setRetailerAddress(retailerAddress); |
| | | // tx4601Request.setRetailerProvince(retailerProvince); |
| | | // tx4601Request.setRetailerCity(retailerCity); |
| | | // tx4601Request.setRetailerDistrict(retailerDistrict); |
| | | // tx4601Request.setRetailerBusinessScope(retailerBusinessScope); |
| | | |
| | | // tx4601Request.setBankAbilityFlag(bankAbilityFlag); |
| | | // tx4601Request.setBindingTxSN(bindingTxSN); |
| | | // tx4601Request.setBankID(bankID); |
| | | // tx4601Request.setBankAccountNumber(bankAccountNumber); |
| | | // tx4601Request.setBankPhoneNumber(bankPhoneNumber); |
| | | // tx4601Request.setCNAPSCode(cNAPSCode); |
| | | // tx4601Request.setBranchName(branchName); |
| | | // tx4601Request.setBankProvince(bankProvince); |
| | | // tx4601Request.setBankCity(bankCity); |
| | | |
| | | // 3.æ§è¡æ¥æå¤ç |
| | | tx4601Request.process(); |
| | | |
| | | // 4.å°åæ°æ¾ç½®å°request对象 |
| | | /* map.put("plainText", tx4601Request.getRequestPlainText()); |
| | | map.put("message", tx4601Request.getRequestMessage()); |
| | | map.put("signature", tx4601Request.getRequestSignature()); |
| | | map.put("txCode", "4601"); |
| | | map.put("txName", "弿·");*/ |
| | | HashMap<String, String> map = new HashMap<String, String>(); |
| | | putCommonParam(map, tx4601Request); |
| | | // 5.转åRequest.jspé¡µé¢ |
| | | return dealRequestResult(map, Tx4601Response.class); |
| | | } |
| | | |
| | | /** |
| | | * ç¨æ·ä¿¡æ¯æ¥è¯¢ |
| | | * |
| | | * @return |
| | | */ |
| | | public static Tx4691Response tx4691(String userId) { |
| | | Tx4691Request txRequest = new Tx4691Request(); |
| | | txRequest.setInstitutionID(PaymentEnvironment.institutionID); |
| | | txRequest.setUserID(userId); |
| | | // 3.æ§è¡æ¥æå¤ç |
| | | try { |
| | | txRequest.process(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | return dealRequestResult(putCommonParam(null, txRequest), Tx4691Response.class); |
| | | } |
| | | |
| | | public static Tx4691Response tx4691QueryUserInfo(Long businessId, char businessType) { |
| | | return tx4691(getUserId(businessId, businessType)); |
| | | } |
| | | |
| | | /** |
| | | * ç»å®é¶è¡å¡ï¼è§£ç»é¶è¡å¡ |
| | | * |
| | | * @param operationFlag æä½æ è¯: 10=ç»å¡ 20=è§£ç» 30=å级 |
| | | * @param bankAccountType è´¦æ·ç±»åï¼ 11=ä¸ªäººè´¦æ· 12=ä¼ä¸è´¦ æ· |
| | | * @param credentialNumber 身份è¯å· |
| | | * @return |
| | | */ |
| | | public static Tx4611Response tx4611(short operationFlag, String userId, short bankAccountType, |
| | | String credentialNumber |
| | | , String bankAccountName, String bankAccountNumber, String bankPhoneNumber, String |
| | | validDate, String cvn2) { |
| | | // æ¥è¯¢ é¶è¡å¡ |
| | | //ç»å®é¶è¡ ID åèãé¶è¡ç¼ç 表ã |
| | | String bankID = null; |
| | | //å¡ç±»å 10åè®°è´¦æ· 20è´·è®°è´¦æ· |
| | | String bankCardType = null; |
| | | Tx2751Response tx2751Response = tx2751(bankAccountNumber); |
| | | if (tx2751Response != null && "2000".equals(tx2751Response.getCode())) { |
| | | bankCardType = tx2751Response.getCardMediaType(); |
| | | bankID = tx2751Response.getBankID(); |
| | | } |
| | | |
| | | Tx4611Request txRequest = new Tx4611Request(); |
| | | txRequest.setInstitutionID(PaymentEnvironment.institutionID); |
| | | txRequest.setOperationFlag(operationFlag + ""); |
| | | txRequest.setBindingTxSN(IdGenerator.getUUID()); |
| | | txRequest.setUserID(userId); |
| | | txRequest.setBindingWay("10"); |
| | | //è´¦æ·ç±»åï¼ 11=ä¸ªäººè´¦æ· 12=ä¼ä¸è´¦ æ· |
| | | txRequest.setBankAccountType(bankAccountType + ""); |
| | | txRequest.setBankCardType(bankCardType + ""); |
| | | txRequest.setCredentialType("0"); |
| | | txRequest.setCredentialNumber(credentialNumber); |
| | | txRequest.setBankID(bankID); |
| | | txRequest.setBankAccountName(bankAccountName); |
| | | txRequest.setBankAccountNumber(bankAccountNumber); |
| | | txRequest.setBankPhoneNumber(bankPhoneNumber); |
| | | txRequest.setValidDate(validDate); |
| | | txRequest.setCVN2(cvn2); |
| | | // 3.æ§è¡æ¥æå¤ç |
| | | try { |
| | | txRequest.process(); |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | // 4.å°åæ°æ¾ç½®å°request对象 |
| | | /*map.put("txCode", "4611"); |
| | | map.put("txName", "ç»å¡&è§£ç»ï¼APIï¼");*/ |
| | | Tx4611Response tx4611Response = dealRequestResult(putCommonParam(null, txRequest), Tx4611Response.class); |
| | | return tx4611Response; |
| | | } |
| | | |
| | | public static Tx2751Response tx2751(String accountNumber) { |
| | | // 2.å建交æè¯·æ±å¯¹è±¡ |
| | | Tx2751Request txRequest = new Tx2751Request(); |
| | | txRequest.setInstitutionID(PaymentEnvironment.institutionID); |
| | | txRequest.setTxSN(IdGenerator.getUUID()); |
| | | txRequest.setAccountNumber(accountNumber); |
| | | |
| | | // 3.æ§è¡æ¥æå¤ç |
| | | try { |
| | | txRequest.process(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | Tx2751Response tx4613Response = dealRequestResult(putCommonParam(null, txRequest), Tx2751Response.class); |
| | | return tx4613Response; |
| | | } |
| | | |
| | | /** |
| | | * ç»å¡ç¡®è®¤ |
| | | * |
| | | * @param bindingTxSN tx4611è¿åå¼ä¸ é¶è¡è´¦æ·ç»å®æµæ°´å· |
| | | * @param businessType ä¸å¡ç±»åï¼ 10=ç»å¡ 20=弿· |
| | | * @param verifyWay éªè¯æ¹å¼ï¼10 çä¿¡éªè¯ 20 å°é¢ææ¬¾éªè¯ |
| | | * @return |
| | | */ |
| | | public static Tx4613Response tx4613(String bindingTxSN, short businessType, short verifyWay, String smsCode, Long amount) { |
| | | Tx4613Request txRequest = new Tx4613Request(); |
| | | txRequest.setInstitutionID(PaymentEnvironment.institutionID); |
| | | txRequest.setBusinessType(businessType + ""); |
| | | txRequest.setVerifyWay(verifyWay + ""); |
| | | txRequest.setSMSCode(smsCode); |
| | | txRequest.setAmount(Convert.toStr(amount)); |
| | | txRequest.setTxSN(bindingTxSN); |
| | | // 3.æ§è¡æ¥æå¤ç |
| | | try { |
| | | txRequest.process(); |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | Tx4613Response tx4613Response = dealRequestResult(putCommonParam(null, txRequest), Tx4613Response.class); |
| | | return tx4613Response; |
| | | } |
| | | |
| | | /** |
| | | * æ¯ä»API |
| | | * |
| | | * @param orderId 订åid |
| | | * @param payerUserID 仿¬¾ç¨æ· ID |
| | | * @param payeeUserID æ¶æ¬¾ç¨æ· ID |
| | | * @param paymentWay æ¯ä»æ¹å¼: 00=ä½é¢æ¯ä» 02=ä¿¡ç¨æ¯ä» 10=å¿«æ·æ¯ä» 12-é±å
æ¯ä» 20=ç½é¶æ¯ä» 30=ä»£æ¶æ¯ä» 40=è忝ä»(忢æ¥å
¥æ°åæ·) |
| | | * 42=æ¡ç æ¯ä» 43-æ«ç 颿æ 50=O2O 60=POSï¼æä¸æ¯æï¼ 70=ä¿¡ç¨æ¯ä» 80-跳转æ¯ä» |
| | | * @param amount åä½ï¼å, |
| | | * PaymentWay=42,ScanPaymentType =40 æ¶,éé¢å¯ä¸º 0 |
| | | * PaymentWay=42,InstallmentType=20,ScanPaymentType=20 æ¶,Amount å¿
须大äºçäº 100 å
|
| | | * PaymentWay=80,InstallmentType=20,PayType=32 æ¶,Amount å¿
须大äºçäº 100 å
|
| | | * @param pageURL åè° URL å°å |
| | | * @param goodsName åååç§° PaymentWay=02/12/40/42/80 å¿
å¡« |
| | | * @param platformName å¹³å°åç§° PaymentWay=80 å¿
å¡« |
| | | * @param clientIP ç¨æ· IP PaymentWay=12,80 å¿
å¡« |
| | | * @param hasSubsequentSplit æ¯å¦æåç»åè´¦:1-å¦ 2-æ¯ é»è®¤ä¸ºå¦ |
| | | * @param hasSubsequentSplit æ¯å¦æåç»åè´¦:1-å¦ 2-æ¯ é»è®¤ä¸ºå¦ |
| | | * @param remark 夿³¨ Payment=30 䏿¯å¯¹å
¬æ¯ä»ä¸å¡æ¶,å¿
ä¼ |
| | | * @param payWay æ¯ä»æ¹å¼ 45=H5æ¯ä»ï¼PayType=30ã31ã32ã33ï¼ |
| | | * 46=APP æ¯ä»ï¼PayType=30ã31ã32ã33ï¼ |
| | | * 47=ææºè¿·ä½ ä»ï¼PayType=33ï¼ |
| | | * 48=ææº Pay ï¼PayType=34ã35ï¼ |
| | | * 50=JSAPIï¼PayType=31ã32ï¼ |
| | | * 51=å°ç¨åºæ¯ä»ï¼PayType=31ã32ï¼ |
| | | * @param payType æ¯ä»ç±»å 30=ææºç½é¶ 31=微信 32=æ¯ä»å® 33=é¶è 34=Apple Pay 35=Android Pay |
| | | * @param subAppID AppIDï¼åæ·è¿ä»¶å½å
¥ï¼å¾®ä¿¡å¿
å¡«PayType=31 æ¯ä»å®éå¡«ï¼æ¯ä»å®ç´è¿ãæ¯ä»å®å°ç¨åºå¿
å¡«ï¼ |
| | | * @param subOpenID ç¨æ· ID 微信ï¼openid æ¯ä»å®ï¼ buyer_user_id ï¼PayWay=50/51 å¿
å¡«ï¼ |
| | | * @param redirectSource è·³è½¬åæ¥æº 10=App,20=H5, 30=å
¬ä¼å·,40=å°ç¨åº |
| | | * @param scanPaymentType æ¡ç æ¯ä»ç±»å: 10=微信 20=æ¯ä»å® 30=é¶è 40=èåç 50=æ°å人æ°å¸æ¯ä» |
| | | * @param scanPaymentWay æ¡ç æ¯ä»æ¹å¼: 41=æ£æ« 42=åæ« |
| | | * @param scanPaymentCode æ¡åæ«æ¯ä»ææç ScanPaymentWay=42 æ¶å¿
å¡« |
| | | * @param scanPageUrlType 页é¢è·³è½¬æ¹å¼ 10=å
¬ä¼å· 20=å°ç¨åº ScanPaymentType=10-微信æ«ç æ¶æ¤å段为å¿
填项ï¼é»è®¤ä¸ºå
¬ä¼å·ã |
| | | * @param splitItemsList åè´¦ç»ç®å |
| | | * @return |
| | | */ |
| | | public static Tx5011Response tx5011(String orderId, String payerUserID, String payeeUserID, String paymentWay, Long amount, String pageURL |
| | | , String goodsName, String platformName, String clientIP, Short hasSubsequentSplit, String remark, JSONObject extension |
| | | , String agreeId, String payWay, String payType, String subAppID, String subOpenID, String redirectSource |
| | | // æ¡ç åæ° |
| | | , String scanPaymentType, String scanPaymentWay, String scanPaymentCode, String scanPageUrlType |
| | | //åè´¦ç»ç®åæ° |
| | | , ArrayList<SplitItem> splitItemsList |
| | | ) { |
| | | Tx5011Request txRequest = new Tx5011Request(); |
| | | txRequest.setInstitutionID(PaymentEnvironment.institutionID); |
| | | txRequest.setTxSN(orderId); |
| | | txRequest.setOrderNo(orderId); |
| | | txRequest.setPayerUserID(payerUserID); |
| | | txRequest.setPayeeUserID(payeeUserID); |
| | | txRequest.setPaymentWay(paymentWay); |
| | | txRequest.setAmount(Convert.toStr(amount, "0")); |
| | | txRequest.setPageURL(pageURL); |
| | | txRequest.setGoodsName(goodsName); |
| | | txRequest.setPlatformName(platformName); |
| | | txRequest.setClientIP(clientIP); |
| | | txRequest.setHasSubsequentSplit(Convert.toStr(hasSubsequentSplit, "1")); |
| | | txRequest.setRemark(remark); |
| | | txRequest.setExtension(extension == null ? null : extension.toJSONString()); |
| | | //10=å¿«æ·æ¯ä» |
| | | if ("10".equals(paymentWay)) { |
| | | txRequest.setBindingTxSN(agreeId); |
| | | } else if ("80".equals(paymentWay)) { |
| | | // 跳转æ¯ä» |
| | | txRequest.setPayWay(payWay); |
| | | txRequest.setPayType(payType); |
| | | //æ¯ä»æ¹å¼éå¶ï¼10=ä¸éå® |
| | | txRequest.setLimitPay("10"); |
| | | txRequest.setSubAppID(subAppID); |
| | | txRequest.setSubOpenID(subOpenID); |
| | | //installmentType åææ§å¶æ è¯ 10-䏿å®åæ 20-æå®åæ PayType=32ã33ï¼PayWay=45-H5æ¯ä»æ¶å¿
å¡« |
| | | txRequest.setInstallmentType("10"); |
| | | txRequest.setRedirectSource(redirectSource); |
| | | } else if ("42".equals(paymentWay)) { |
| | | //æ¡ç æ¯ä»æ¹å¼éæ©å |
| | | txRequest.setScanPaymentType(scanPaymentType); |
| | | txRequest.setScanPaymentWay(scanPaymentWay); |
| | | txRequest.setScanPaymentCode(scanPaymentCode); |
| | | txRequest.setScanPageUrlType(scanPageUrlType); |
| | | } |
| | | txRequest.setSplitItemsList(splitItemsList); |
| | | |
| | | // 3.æ§è¡æ¥æå¤ç |
| | | try { |
| | | txRequest.process(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | Tx5011Response tx5011Response = dealRequestResult(putCommonParam(null, txRequest), Tx5011Response.class); |
| | | return tx5011Response; |
| | | } |
| | | |
| | | /** |
| | | * 微信h5 jsapiæ¯ä» |
| | | * |
| | | * @return |
| | | */ |
| | | public static Tx5011Response tx5011WxH5Pay(String orderId, String payerUserID, String payeeUserID, Long amount, String pageURL |
| | | , String goodsName, String shopName, String clientIP, Short hasSubsequentSplit, String remark, JSONObject extension |
| | | , String subAppID, String subOpenID, String redirectSource |
| | | //åè´¦ç»ç®åæ° |
| | | , ArrayList<SplitItem> splitItemsList |
| | | ) { |
| | | return tx5011(orderId, payerUserID, payeeUserID, "80", amount, pageURL, goodsName, shopName, clientIP, hasSubsequentSplit, remark, extension |
| | | , null, "50", "31", subAppID, subOpenID, redirectSource, |
| | | null, null, null, null |
| | | , splitItemsList); |
| | | } |
| | | |
| | | /** |
| | | * 微信å°ç¨åºæ¯ä» |
| | | * |
| | | * @return |
| | | */ |
| | | public static Tx5011Response tx5011WxMiniPay(String orderId, String payerUserID, String payeeUserID, Long amount, String pageURL |
| | | , String goodsName, String shopName, String clientIP, Short hasSubsequentSplit, String remark, JSONObject extension |
| | | , String subAppID, String subOpenID, String redirectSource |
| | | //åè´¦ç»ç®åæ° |
| | | , ArrayList<SplitItem> splitItemsList |
| | | ) { |
| | | return tx5011(orderId, payerUserID, payeeUserID, "80", amount, pageURL, goodsName, shopName, clientIP, hasSubsequentSplit, remark, extension |
| | | , null, "51", "31", subAppID, subOpenID, redirectSource, |
| | | null, null, null, null |
| | | , splitItemsList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * é¶è¡å¡å¿«æ·æ¯ä» |
| | | * |
| | | * @return |
| | | */ |
| | | public static Tx5011Response tx5011BankCardKjPay(String orderId, String payerUserID, String payeeUserID, Long amount, String pageURL |
| | | , String goodsName, String shopName, String clientIP, Short hasSubsequentSplit, String remark, JSONObject extension |
| | | , String agreeId |
| | | //åè´¦ç»ç®åæ° |
| | | , ArrayList<SplitItem> splitItemsList) { |
| | | return tx5011(orderId, payerUserID, payeeUserID, "10", amount, pageURL, goodsName, shopName, null, hasSubsequentSplit, remark, extension |
| | | , agreeId, null, null, null, null, null, |
| | | null, null, null, null |
| | | , splitItemsList); |
| | | } |
| | | |
| | | |
| | | public static Tx1850Response tx1850(LocalDate billDate) throws Exception { |
| | | // 1.åå¾åæ° |
| | | // String batchNO = request.getParameter("BatchNO"); |
| | | // String payeeUserID = request.getParameter("PayeeUserID"); |
| | | // 2.å建交æè¯·æ±å¯¹è±¡ |
| | | Tx1850Request txRequest = new Tx1850Request(); |
| | | txRequest.setInstitutionID(PaymentEnvironment.institutionID); |
| | | // txRequest.setBatchNO(batchNO); |
| | | txRequest.setBillDate(billDate.toString().replace("-", "")); |
| | | // txRequest.setPayeeUserID(payeeUserID); |
| | | |
| | | // 3.æ§è¡æ¥æå¤ç |
| | | txRequest.process(); |
| | | |
| | | // 4.å°åæ°æ¾ç½®å°request对象 |
| | | HashMap<String, String> map = new HashMap<String, String>(); |
| | | /* map.put("plainText", txRequest.getRequestPlainText()); |
| | | map.put("message", txRequest.getRequestMessage()); |
| | | map.put("signature", txRequest.getRequestSignature()); |
| | | map.put("txCode", "1850"); |
| | | map.put("txName", "对账æä»¶ä¸è½½");*/ |
| | | map.put("Flag", "50"); |
| | | |
| | | putCommonParam(map, txRequest); |
| | | return dealRequestResult(map, Tx1850Response.class); |
| | | } |
| | | |
| | | /** |
| | | * ç¨äºæ¥è¯¢è´¦æ·ä¸å¯è§£å»çéé¢ä¿¡æ¯ |
| | | * |
| | | * @param businessId |
| | | * @return |
| | | */ |
| | | public static Tx4660Response tx4660QueryDjBalance(Long businessId, char businessType) { |
| | | return tx4660(getUserId(businessId, businessType)); |
| | | } |
| | | |
| | | private static Tx4660Response tx4660(String userId) { |
| | | Tx4660Request txRequest = new Tx4660Request(); |
| | | txRequest.setInstitutionID(PaymentEnvironment.institutionID); |
| | | txRequest.setUserID(userId); |
| | | // 3.æ§è¡æ¥æå¤ç |
| | | try { |
| | | txRequest.process(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | return dealRequestResult(putCommonParam(null, txRequest), Tx4660Response.class); |
| | | } |
| | | |
| | | /** |
| | | * ä¸å¡ID çæè§å |
| | | * |
| | | * @param businessId |
| | | * @param businessType |
| | | * @return |
| | | */ |
| | | public static String getUserId(Long businessId, char businessType) { |
| | | return businessType + "" + businessId; |
| | | } |
| | | |
| | | /** |
| | | * æ¾å
¥å
Œ
±åæ° |
| | | * |
| | | * @param map |
| | | * @param baseRequest |
| | | */ |
| | | public static HashMap<String, String> putCommonParam(HashMap<String, String> map, TxBaseRequest baseRequest) { |
| | | if (map == null) { |
| | | map = new HashMap<>(); |
| | | } |
| | | map.put("plainText", baseRequest.getRequestPlainText()); |
| | | map.put("message", baseRequest.getRequestMessage()); |
| | | map.put("signature", baseRequest.getRequestSignature()); |
| | | map.put("txCode", baseRequest.getTxCode()); |
| | | |
| | | map.put("isDgEnv", PaymentEnvironment.isDgEnv); |
| | | map.put("dgtlEnvlp", baseRequest.getDgtlEnvlp()); |
| | | map.put("signAlgorithm", baseRequest.getSignAlgorithm()); |
| | | map.put("signSN", baseRequest.getSignSN()); |
| | | map.put("encryptSN", baseRequest.getEncryptSN()); |
| | | map.put("institutionID", PaymentEnvironment.institutionID); |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * åé请æ±ï¼è§£æè¯·æ± |
| | | * |
| | | * @param map |
| | | * @return |
| | | */ |
| | | public static <T extends TxBaseResponse> T |
| | | dealRequestResult(HashMap<String, String> map, Class<T> responseType) { |
| | | try { |
| | | // è·å¾åæ°messageåsignature |
| | | String message = map.get("message"); |
| | | String signature = map.get("signature"); |
| | | String txCode = map.get("txCode"); |
| | | String flag = map.get("Flag"); |
| | | // 䏿¯ä»å¹³å°è¿è¡é讯 |
| | | TxMessenger txMessenger = new TxMessenger(); |
| | | String[] respMsg = null; |
| | | // Flag=10:cmb, 20:paymentAccount |
| | | RequestDgtEnvlp requestDgtEnvlp = new RequestDgtEnvlp(); |
| | | if ("YES".equals(map.get("isDgEnv"))) { |
| | | requestDgtEnvlp.setIsDgEnv(map.get("isDgEnv")); |
| | | } else { |
| | | requestDgtEnvlp.setIsDgEnv("NO"); |
| | | } |
| | | requestDgtEnvlp.setDgtlEnvlp(map.get("dgtlEnvlp")); |
| | | requestDgtEnvlp.setSignAlgorithm(map.get("signAlgorithm")); |
| | | requestDgtEnvlp.setSignSN(map.get("signSN")); |
| | | requestDgtEnvlp.setEncryptSN(map.get("encryptSN")); |
| | | requestDgtEnvlp.setInstitutionID(map.get("institutionID")); |
| | | |
| | | if ("50".equals(flag)) { |
| | | respMsg = txMessenger.send(message, signature, requestDgtEnvlp, Gateway4FileEnvironment.GATEWAY4FILE_URL); |
| | | } else if ("90".equals(flag)) { |
| | | respMsg = txMessenger.send(message, signature, requestDgtEnvlp, AggregateEnvironment.aggregateTxURL);// 0:message; |
| | | } else { |
| | | respMsg = txMessenger.send(message, signature, requestDgtEnvlp);// 0:message; |
| | | } |
| | | |
| | | String plainText; |
| | | if ("YES".equals(respMsg[2])) { |
| | | //妿ååºæ¯æ°åä¿¡å°ï¼å¯¹æ¶æ¯è¿è¡å¯¹ç§°è§£å¯ |
| | | try { |
| | | log.info("å¼å§å¯¹ååºæ¶æ¯å对称解å¯ãããããã"); |
| | | if ("YES".equals(PaymentEnvironment.isDoubleCert)) { |
| | | log.info("åè¯è§£å¯ãããããã"); |
| | | respMsg[0] = DigitalEnvelopeUtil.doubleDecryptResponse(respMsg[0], respMsg[3], respMsg[5], respMsg[6]); |
| | | } else { |
| | | respMsg[0] = DigitalEnvelopeUtil.decryptResponse(respMsg[0], respMsg[3], respMsg[5], respMsg[6]); |
| | | } |
| | | plainText = respMsg[0]; |
| | | respMsg[0] = cpcn.institution.tools.util.Base64.encode(respMsg[0], "UTF-8"); |
| | | respMsg[0] = respMsg[0] + "," + respMsg[5] + "," + respMsg[4] + "," + respMsg[2]; |
| | | log.info("ååºæ¶æ¯å对称解å¯å®æãããããã"); |
| | | log.info("ååºæ¶æ¯æ¥æï¼[" + plainText + "]"); |
| | | } catch (Exception e) { |
| | | System.out.println("å¼å¸¸å
容ï¼" + e); |
| | | throw new Exception(e + "对称解å¯å¼å¸¸ï¼"); |
| | | } |
| | | } else { |
| | | // 1:signature |
| | | plainText = new String(cpcn.institution.tools.util.Base64.decode(respMsg[0]), "UTF-8"); |
| | | if (StringUtil.isNotEmpty(respMsg[5])) { |
| | | respMsg[0] = respMsg[0] + "," + respMsg[5] + "," + respMsg[4] + "," + respMsg[2]; |
| | | } |
| | | } |
| | | |
| | | log.debug("[message]=[" + respMsg[0] + "]"); |
| | | log.debug("[signature]=[" + respMsg[1] + "]"); |
| | | log.debug("[plainText]=[" + plainText + "]"); |
| | | |
| | | // å°ç»æä¿åå¨requestä¸ï¼ä»¥å¤å¨Response.jsp页颿¾ç¤º |
| | | return getResponse(respMsg[0], respMsg[1], responseType); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åå°å建è¿åå¼å¯¹è±¡ |
| | | * |
| | | * @param responseMessage |
| | | * @param responseSignature |
| | | * @param responseType |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | private static <T extends TxBaseResponse> T |
| | | getResponse(String responseMessage, String responseSignature, Class<T> responseType) { |
| | | // å建并è¿å对åºçå类对象 |
| | | T response = null; |
| | | try { |
| | | Constructor<T> constructor = responseType.getDeclaredConstructor(String.class, String.class); |
| | | response = constructor.newInstance(responseMessage, responseSignature); |
| | | } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return response; |
| | | } |
| | | |
| | | |
| | | //```````````````````````````````````````````````````````````` |
| | | public static CommonResult<Tx4611Response> testTx4611() { |
| | | String userId = "cy88888888"; |
| | | Tx4611Response tx4611Response = tx4611((short) 10, userId, (short) 11, "410105199603076114", |
| | | "常è¿", "6255861234567897910", "17721229769", null, null); |
| | | if ("2000".equals(tx4611Response.getCode())) { |
| | | String status = tx4611Response.getStatus(); |
| | | if ("40".equals(status)) { |
| | | return new CommonResult(CommonResultEmnu.ERROR, tx4611Response.getResponseMessage()); |
| | | } else { |
| | | return new CommonResult(tx4611Response); |
| | | } |
| | | // if ("15".equals(status)) { |
| | | // log.info("å¾
çä¿¡éªè¯ï¼æ¤ç¶ææ¶æ¯ä»å¹³å°å·²ç»ç»ç¨æ·ææºå·åéçä¿¡éªè¯ç ï¼æºæç³»ç»éè¦è°ç¨4613-ç»å¡ç¡®è®¤æ¥å£åå¡«çä¿¡éªè¯ç ï¼æ¯ä»å¹³å°éªè¯åè¿åç»å¡ç»æ"); |
| | | // } else if ("17".equals(status)) { |
| | | // log.info("å¾
è¢«å¨ææ¬¾éªè¯ï¼è¡¨ç¤ºæ¯ä»å¹³å°æ²¡æåä¼ä¸è´¦æ·è¿è¡ææ¬¾ï¼æºæç³»ç»å¯éè¿ 4616-ç»å¡æ¥è¯¢æ¥å£æ¥è¯¢ä¼ä¸è´¦æ·ç»å¡ç¶æ"); |
| | | // } else if ("18".equals(status)) { |
| | | // log.info("被å¨å·²ææ¬¾å¾
éªè¯ï¼è¡¨ç¤ºæ¯ä»å¹³å°å·²åä¼ä¸è´¦æ·è¿è¡ææ¬¾ï¼æºæç³»ç»å¯ä»¥è°ç¨ 4613-ç»å¡ç¡®è®¤æ¥å£åå¡«ææ¬¾éé¢ï¼æ¯ä»å¹³å°éªè¯åè¿åç»å¡ç»æã"); |
| | | // } else if ("40".equals(status)) { |
| | | // log.info("失败ï¼è¡¨ç¤ºç¨æ·æäº¤çèº«ä»½ä¿¡æ¯æè¯¯ï¼éè¦æ ¸å®åéæ°åèµ·ç»å¡è¯·æ±"); |
| | | // } |
| | | } else { |
| | | return new CommonResult(CommonResultEmnu.ERROR, tx4611Response.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * ç»å¡æµè¯ |
| | | */ |
| | | public static CommonResult testTx4613(String bindingTxSN) { |
| | | Tx4613Response tx4613Response = tx4613(bindingTxSN, (short) 10, (short) 10, "134679", null); |
| | | if (!"2000".equals(tx4613Response.getCode())) { |
| | | return new CommonResult(CommonResultEmnu.ERROR, tx4613Response.getMessage()); |
| | | } |
| | | return new CommonResult(); |
| | | } |
| | | |
| | | /** |
| | | * ç»å¡æµè¯ |
| | | */ |
| | | public static CommonResult testTx2751() { |
| | | Tx2751Response response = tx2751("6255861234567897910"); |
| | | if (!"2000".equals(response.getCode())) { |
| | | return new CommonResult(CommonResultEmnu.ERROR, response.getMessage()); |
| | | } |
| | | return new CommonResult(); |
| | | } |
| | | |
| | | public static CommonResult test4660() { |
| | | Tx4660Response response = tx4660("cy88888888"); |
| | | if (!"2000".equals(response.getCode())) { |
| | | return new CommonResult(CommonResultEmnu.ERROR, response.getMessage()); |
| | | } |
| | | return new CommonResult(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // åå§åæ¯ä»ç¯å¢ |
| | | try { |
| | | PaymentEnvironment.initialize("D:\\MyProjects\\jmy\\ecosphere\\ecosphere-merchant\\src\\main\\resources\\cncpConfig\\payment"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | String userId = "cy88888888"; |
| | | tx4691(userId); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | |
| | | /** |
| | | * ç çæç±» |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/6/13 10:29 |
| | | */ |
| | | public class CodeUtil { |
| | | |
| | | /** |
| | | * èªå®ä¹code++ |
| | | * |
| | | * @param maxCode æ¬çº§æå¤§code |
| | | * @param parentCode ç¶çº§code |
| | | * @Author: lc |
| | | * @Date: 2019/6/13 10:32 |
| | | */ |
| | | public static String getCode(String maxCode, String parentCode) { |
| | | if (StrUtil.isBlank(parentCode)) { |
| | | parentCode = ""; |
| | | } |
| | | if (StrUtil.isBlank(maxCode)) { |
| | | return parentCode + "001"; |
| | | } else { |
| | | maxCode = Convert.toStr(Convert.toLong(maxCode) + 1); |
| | | for (int i = 0; i < maxCode.length() % 3; i++) { |
| | | maxCode = "0" + maxCode; |
| | | } |
| | | return maxCode; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * çææ¥ææ ¼å¼çç¼å· |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/7/2 15:19 |
| | | */ |
| | | public static String getTimeCode() { |
| | | String time = DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss"); |
| | | return time + RandomUtil.randomNumbers(4); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(getCode("002001", "002")); |
| | | System.out.println(getTimeCode()); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | // @formatter:off |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.core.util.URLUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.nuvole.constants.SystemConstants; |
| | | import jakarta.servlet.ServletInputStream;import jakarta.servlet.http.HttpServletRequest;import jakarta.servlet.http.HttpServletResponse;import org.apache.commons.text.StringEscapeUtils; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * .-~~~~~~~~~-._ _.-~~~~~~~~~-. |
| | | * __.' @Author ~. .~ ä»£ç æ Bug `.__ |
| | | * .'// liu.q \./ (ç§ç±) \\`. |
| | | * .'// [916000612@qq.com] | 欲ç»ç¥å å¼åèªå®« \\`. |
| | | * .'// .-~"""""""~~~~-._ | _,-~~~~"""""""~-. \\`. |
| | | * .'//.-" 2019-04-09 `-. | .-' 10:48 "-.\\`. |
| | | * .'//______.============-.. \ | / ..-============.______\\`. |
| | | * .'______________________________\|/______________________________`. |
| | | * |
| | | * @Description : |
| | | */ |
| | | // @formatter:on |
| | | public class CommonUtil { |
| | | |
| | | /** |
| | | * @Author : liuq |
| | | * @Date : Create in 2018/7/1 ä¸å1:20 |
| | | * @Description : 驼峰转ä¸å线 |
| | | */ |
| | | public static String camel2Underline(String line) { |
| | | return StrUtil.toUnderlineCase(line); |
| | | } |
| | | |
| | | /* |
| | | * @Author : liu.q [916000612@qq.com] |
| | | * |
| | | * @Date : 2019-04-29 16:45 |
| | | * |
| | | * @Description : ä¸å线转驼峰 |
| | | */ |
| | | public static String Underline2camel(String para) { |
| | | return StrUtil.toCamelCase(para); |
| | | } |
| | | |
| | | /** |
| | | * @Author : liu.q |
| | | * @Date : 2019-03-01 09:49 |
| | | * @Description : è·årequest |
| | | */ |
| | | public static HttpServletRequest getRequest() { |
| | | ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder |
| | | .getRequestAttributes(); |
| | | HttpServletRequest request = requestAttributes.getRequest(); |
| | | return request; |
| | | } |
| | | |
| | | /** |
| | | * @Author : liu.q |
| | | * @Date : 2019-03-01 09:49 |
| | | * @Description : response |
| | | */ |
| | | public static HttpServletResponse getResponse() { |
| | | ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder |
| | | .getRequestAttributes(); |
| | | HttpServletResponse response = requestAttributes.getResponse(); |
| | | return response; |
| | | } |
| | | |
| | | /** |
| | | * @Author : liu.q |
| | | * @Date : 2019-03-01 09:51 |
| | | * @Description : è·å访é®å°å |
| | | */ |
| | | public static String getHost() { |
| | | HttpServletRequest request = getRequest(); |
| | | String scheme = request.getHeader("X-Forwarded-Scheme"); |
| | | if (scheme == null) { |
| | | scheme = request.getScheme(); |
| | | } |
| | | String port = request.getHeader("X-Forwarded-port"); |
| | | if (port == null) { |
| | | port = request.getServerPort() + ""; |
| | | } |
| | | if ("443".equals(port) || "80".equals(port)) { |
| | | return scheme + "://" + request.getServerName(); |
| | | } |
| | | return scheme + "://" + request.getServerName() + ":" + port;// +request.getRequestURI(); |
| | | } |
| | | |
| | | /** |
| | | * è·å请æ±åæ° |
| | | * |
| | | * @return |
| | | */ |
| | | public static Map getParameterMap() { |
| | | // åæ°Map |
| | | Map properties = CommonUtil.getRequest().getParameterMap(); |
| | | // è¿åå¼Map |
| | | Map returnMap = new HashMap(); |
| | | Iterator entries = properties.entrySet().iterator(); |
| | | Map.Entry entry; |
| | | String name = ""; |
| | | String value = ""; |
| | | while (entries.hasNext()) { |
| | | entry = (Map.Entry) entries.next(); |
| | | name = (String) entry.getKey(); |
| | | Object valueObj = entry.getValue(); |
| | | if (null == valueObj) { |
| | | continue; |
| | | } else if (valueObj instanceof String[]) { |
| | | String[] values = (String[]) valueObj; |
| | | for (int i = 0; i < values.length; i++) { |
| | | value = values[i] + ","; |
| | | } |
| | | value = value.substring(0, value.length() - 1); |
| | | } else { |
| | | value = valueObj.toString(); |
| | | // å½value为string empty为ææå¼ by zxc on 2020/5/11 15:00 |
| | | if ("".equals(value)) { |
| | | continue; |
| | | } |
| | | } |
| | | returnMap.put(name, value); |
| | | } |
| | | return returnMap; |
| | | } |
| | | |
| | | public static String getExportSign(String url, String timestamp) { |
| | | System.out.println("is url:" + URLUtil.getPath(url)); |
| | | return Convert |
| | | .toStr(SecureUtil.md5(SecureUtil.md5(URLUtil.getPath(url) + timestamp) + SystemConstants.EXPORT_SIGN_K).hashCode()); |
| | | } |
| | | |
| | | public static String listToString(List<String> items) { |
| | | String result = ""; |
| | | if (items != null && items.size() > 0) { |
| | | for (int i = 0; i < items.size(); i++) { |
| | | if (i == 0) { |
| | | result += items.get(i); |
| | | } else { |
| | | result += "," + items.get(i); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public static <T> T getObjFromReq(Class<T> clazz) { |
| | | String s = JSON.toJSONString(getParameterMap()); |
| | | return JSON.parseObject(StringEscapeUtils.unescapeHtml4(s), clazz); |
| | | } |
| | | |
| | | public static <T> T getObjFromReqBody(Class<T> clazz) { |
| | | String jsonStr = getRequestBody(); |
| | | return JSON.parseObject(StringEscapeUtils.unescapeHtml4(jsonStr), clazz); |
| | | } |
| | | |
| | | /** |
| | | * è·årequest bodyå¼ |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | private static String getRequestBody() { |
| | | HttpServletRequest request = getRequest(); |
| | | try { |
| | | return getStringFromInputStream(request.getInputStream()); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static String getStringFromInputStream(ServletInputStream stream) throws IOException { |
| | | StringBuilder sb = new StringBuilder(); |
| | | BufferedReader reader = null; |
| | | try { |
| | | reader = new BufferedReader(new InputStreamReader(stream, "UTF-8")); |
| | | char[] ch = new char[1024]; |
| | | int bytesRead; |
| | | while ((bytesRead = reader.read(ch)) != -1) { |
| | | sb.append(ch, 0, bytesRead); |
| | | } |
| | | } finally { |
| | | if (reader != null) { |
| | | try { |
| | | reader.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * è·åç¨æ·æ è¯ |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getUserAgent() { |
| | | HttpServletRequest request = getRequest(); |
| | | return request.getHeader("User-Agent"); |
| | | } |
| | | |
| | | /** |
| | | * è·å客æ·ç«¯æ è¯ |
| | | * |
| | | * @return 1.æ¯ä»å®-å°ç¨åº, 2.æ¯ä»å®-çæ´»å·, 3.微信-å°ç¨åº, 4.微信-å
¬ä¼å· |
| | | */ |
| | | public static String getClientType() { |
| | | HttpServletRequest request = getRequest(); |
| | | return request.getHeader("CLIENT-TYPE"); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºå¾®ä¿¡å°ç¨åº |
| | | * |
| | | * @return |
| | | */ |
| | | public static boolean isWxMin() { |
| | | String userAgent = getUserAgent(); |
| | | return userAgent.contains("MiniProgram"); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºå¾®ä¿¡å
ç½®æµè§å¨ |
| | | * |
| | | * @return |
| | | */ |
| | | public static boolean isWxBro() { |
| | | String userAgent = getUserAgent(); |
| | | return userAgent.contains("MicroMessenger"); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºæ¯ä»å®å
ç½®æµè§å¨ |
| | | * |
| | | * @return |
| | | */ |
| | | public static boolean isAliBro() { |
| | | String userAgent = getUserAgent(); |
| | | return userAgent.contains("Alipay"); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºæ¯ä»å®å°ç¨åºå®¢æ·ç«¯ |
| | | * |
| | | * @return |
| | | */ |
| | | public static boolean isAliMin() { |
| | | String userAgent = getUserAgent(); |
| | | String clientType = getClientType(); |
| | | return userAgent.contains("Alipay") && SystemConstants.APP_TYPE_ALI_MINI.equals(clientType); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºç¿¼æ¯ä» |
| | | * |
| | | * @return |
| | | */ |
| | | public static boolean isBestPayBro() { |
| | | String userAgent = getUserAgent(); |
| | | return userAgent.contains("Bestpay"); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºäºéªä» |
| | | * |
| | | * @return |
| | | */ |
| | | public static boolean isCloudPayBro() { |
| | | String userAgent = getUserAgent(); |
| | | return userAgent.contains("CloudPay"); |
| | | } |
| | | |
| | | public static boolean isUnionPayBro() { |
| | | String userAgent = getUserAgent(); |
| | | return userAgent.contains("UnionPay"); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import java.math.RoundingMode; |
| | | import java.text.DecimalFormat; |
| | | import java.text.NumberFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 计ç®å·¥å
·ç±» |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/5/23 19:10 |
| | | */ |
| | | public class ComputeUtil { |
| | | |
| | | /** |
| | | * 计ç®ç¾åæ¯ |
| | | * |
| | | * @param num å æ¯å¼ |
| | | * @param total æ»æ° |
| | | * @param scale å°æ° |
| | | * @Author: lc |
| | | * @Date: 2019/8/22 10:32 |
| | | */ |
| | | public static String percentum(double num, double total, int scale) { |
| | | if (num == 0 || total == 0) { |
| | | return "0"; |
| | | } |
| | | DecimalFormat df = (DecimalFormat) NumberFormat.getInstance(); |
| | | //å¯ä»¥è®¾ç½®ç²¾ç¡®å ä½å°æ° |
| | | df.setMaximumFractionDigits(scale); |
| | | //æ¨¡å¼ ä¾å¦åèäºå
¥ |
| | | df.setRoundingMode(RoundingMode.HALF_UP); |
| | | double accuracy_num = num / total * 100; |
| | | return df.format(accuracy_num); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·åä¸¤ä¸ªæ¥æä¹é´æææ¥æï¼å¹´ææ¥ï¼ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/8/23 13:41 |
| | | */ |
| | | public static List<String> getBetweenDates(String begin, String end, String formatString) { |
| | | SimpleDateFormat format = new SimpleDateFormat(formatString); |
| | | List<String> result = new ArrayList<String>(); |
| | | try { |
| | | Calendar tempStart = Calendar.getInstance(); |
| | | tempStart.setTime(format.parse(begin)); |
| | | tempStart.add(Calendar.DAY_OF_YEAR, 1); |
| | | |
| | | Calendar tempEnd = Calendar.getInstance(); |
| | | tempEnd.setTime(format.parse(end)); |
| | | result.add(format.format(format.parse(begin))); |
| | | while (tempStart.before(tempEnd)) { |
| | | result.add(format.format(tempStart.getTime())); |
| | | tempStart.add(Calendar.DAY_OF_YEAR, 1); |
| | | } |
| | | result.add(format.format(format.parse(end))); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * è·åä¿©ä¸ªæ¥æé´çæææ¥æï¼å¹´æï¼ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/8/24 16:31 |
| | | */ |
| | | public static List<String> getBetweenMonths(String minDate, String maxDate, String formatString) { |
| | | ArrayList<String> result = new ArrayList<String>(); |
| | | try { |
| | | SimpleDateFormat sdf = new SimpleDateFormat(formatString);//æ ¼å¼å为年æ |
| | | |
| | | Calendar min = Calendar.getInstance(); |
| | | Calendar max = Calendar.getInstance(); |
| | | min.setTime(sdf.parse(minDate)); |
| | | min.set(min.get(Calendar.YEAR), min.get(Calendar.MONTH), 1); |
| | | |
| | | max.setTime(sdf.parse(maxDate)); |
| | | max.set(max.get(Calendar.YEAR), max.get(Calendar.MONTH), 2); |
| | | |
| | | Calendar curr = min; |
| | | while (curr.before(max)) { |
| | | result.add(sdf.format(curr.getTime())); |
| | | curr.add(Calendar.MONTH, 1); |
| | | } |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.codec.Base64; |
| | | import cn.hutool.core.util.CharsetUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import cn.hutool.crypto.asymmetric.KeyType; |
| | | import cn.hutool.crypto.asymmetric.RSA; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName CryptoUtil |
| | | * @date 2019/5/6 11:47 |
| | | * @Description å å¯ï¼è§£å¯å·¥å
·ç±» |
| | | */ |
| | | public class CryptoUtil { |
| | | // ç³»ç»å
é¨ä½¿ç¨ |
| | | private static final String PUBK = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCTREknOkrusbeH7kBe3mSw4AwVT438IWmX/jKmcvYxaAWRrBJiMl7gk37L78HBG/ZstLLcdKBYYdj/5cvVWDQfv+uxbv/piZhOmQej98jWIXEA8aFEk724nFRJ7nfcEhHSWfzbTfgZw0KDO1mWdjWHnHIx/MtD0HIFFIyzg3aO7wIDAQAB"; |
| | | private static final String PRIK = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAJNESSc6Su6xt4fuQF7eZLDgDBVPjfwhaZf+MqZy9jFoBZGsEmIyXuCTfsvvwcEb9my0stx0oFhh2P/ly9VYNB+/67Fu/+mJmE6ZB6P3yNYhcQDxoUSTvbicVEnud9wSEdJZ/NtN+BnDQoM7WZZ2NYeccjH8y0PQcgUUjLODdo7vAgMBAAECgYBVu5Y+0Q/Yf/uRleFBmYTS98vxCBxnoOgBRUolXp32y1EaqisVoa9cXGGfxhdtHaNLS7Mo5niGm4giCZytuii1RO8kVXDAgMM2KRVIkOj2yTKJPRxgh9u0ja18MrpkCGnWYBYiU6irq+Ugu9+srkQSefPFX47U2QbLtxV5XF4iuQJBAMgh3FvAwV99tqGe+z+JtySRdtqEfK0M3Z4vpyqSH6miT1CbEqT942rPHbIUUqLwf6VMjxTYACwcLpVy/k3xrg0CQQC8YHkLxzE52o/wg817Rwwh0LpXz6dghQK7g6eMQyUi4C2PiOmqxpCFk2DOR0R4Rcw6SKxB4XQgyqM2zrdBsa3rAkEAtQcz/WbpQ8hCOAXHvNyEZjaSbOzkneACY0E1k+Njcp0X45CyF750RLweX2PUsACdZddPoYoU9dF0Lck70SNozQJBAIPBPiicw7NhSTfCGCBXSwcDxLHSTZFWttiMds3F0N2ZyoQQEM8fXsnukND2S8+LkhJZ7hGOLPkaghm9b7OFIM0CQEDvsXNcmF2+SWfFJDR57tblAIsOSLGeODWnlzaaFUFDHlbrCkexLJ+o1+C4xHMzUMHHMjHDJVpKt2EJdkfh4xU="; |
| | | // ç¬¬ä¸æ¹ äººææ¥å£ |
| | | private static final String RCMPUBK = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqmYlQIg1eA6bavzgUx6CjlPcJpoTmqY/lBph8VRYH2G0ez/7Yl/Ooc5J9/1nhJ7Ql4u7TRjYZrgw8z3Ul1/kQtel4GQdGOEadb1mmzHRlp5xeqiwj5/fJV+8CbqMNj+mobIJVbdV/oRpxTQMck3NRH1X52LsVFBixp079eGoSawIDAQAB"; |
| | | private static final String RCMPRIK = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKqZiVAiDV4Dptq/OBTHoKOU9wmmhOapj+UGmHxVFgfYbR7P/tiX86hzkn3/WeEntCXi7tNGNhmuDDzPdSXX+RC16XgZB0Y4Rp1vWabMdGWnnF6qLCPn98lX7wJuow2P6ahsglVt1X+hGnFNAxyTc1EfVfnYuxUUGLGnTv14ahJrAgMBAAECgYEAo/7kWPvjDbVE+JNJPfCJI7dXoxdIOtRVVzx36U2B2BjdDPm1alDoEc7HzAdkR2T7cFAudTrRVu5RJUPowXBUI4H/m19JrJiYKqlmhUUrlf+TxFajkUPC1fUSGKzj+Oh/H76/unZbOmhp+TMkopyeI0tU7xmXHuEZk9i2Zq1z+oECQQDbDPa9PpOFLdc0iONfMlYSh4wXUVfhiH2gQ6G10Mf3K6KN6ESnwULWuhrE/N7Zw6zuZBdEqveanJ6NVcaIR8Y5AkEAx2BeQSO0WSkUgKNB9xaVutDddDuKferRpomcecUEf2LN/z3u4DE7P3O9Gwi4iQTHrxMhfLq/VKa8yJjUv5a9wwJAYTk/yn8buuC9w/N996K/0TmYVEEmYFPUbm2WOLySBIK5g4Kz9kExCV1QxF34C29uMeD68t9vRpB9Tv3jQFmbAQJAKu2t/bqRV21H89azGl+rh5j3RdKYJDqOP5x7q6BnMoJ0tlOAfpc7GZNzEUIUcbQsxp6I5FFVZwWrukll7YaofwJBALRdRoP+FOkJv+MMP8Dytxe8c3Cy1OIEkRglPDydmwDoAp+sObm80vKgmfR/llsK2Z1DppvDRkpVHwWtHwZfqZQ="; |
| | | |
| | | public static String rsaEncode(String s, Short flag) { |
| | | RSA rsa = null; |
| | | if (flag == null || flag == 1) { |
| | | rsa = SecureUtil.rsa(PRIK, PUBK); |
| | | } else if (flag != null && flag == 2) { |
| | | rsa = SecureUtil.rsa(RCMPRIK, RCMPUBK); |
| | | } |
| | | return Base64.encode( |
| | | rsa.encrypt(StrUtil.bytes(s, CharsetUtil.CHARSET_UTF_8), KeyType.PublicKey)); |
| | | } |
| | | |
| | | public static String rsaDecode(String s, Short flag) { |
| | | RSA rsa = null; |
| | | if (flag == null || flag == 1) { |
| | | rsa = SecureUtil.rsa(PRIK, PUBK); |
| | | } else if (flag != null && flag == 2) { |
| | | rsa = SecureUtil.rsa(RCMPRIK, RCMPUBK); |
| | | } |
| | | return new String(rsa.decrypt(Base64.decode(s), KeyType.PrivateKey)); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String str = "zhangsan"; |
| | | System.out.println(rsaEncode(str, (short) 2)); |
| | | |
| | | str = "JyfPzIktNeH4VWkGIUzMpaJiOcCvlZQkE5q1tKnxH0xK/FNAcPgrLJYBscp6oHDCd7+FTkjkOicQepkE7UiceEY0zqvQrutVE1kjy4TNH0V4NIAoCk7y5qzo19m/247vh+GbZEW/C4qTRbtrFNoolO4hfMxuH7kqNB5VS8OdIRQ="; |
| | | System.out.println(rsaDecode(str, (short) 2)); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName DesensitizationUtil |
| | | * @date 2019/4/28 19:37 |
| | | * @Description è±æå·¥å
·ç±» |
| | | */ |
| | | public class DesensitizationUtil { |
| | | |
| | | public static String esensitizationdName(String str) { |
| | | if (StrUtil.isBlank(str)) { |
| | | return ""; |
| | | } |
| | | String res = str.substring(0, 1); |
| | | for (int i = 1; i < str.length(); i++) { |
| | | res += "*"; |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * Createed by PKZ |
| | | * Date 2019/6/4 13:35 |
| | | * Descriptionï¼ææºå·è±æ |
| | | **/ |
| | | public static String esensitizationdMobile(String mobile) { |
| | | if (StrUtil.isBlank(mobile)) { |
| | | return ""; |
| | | } |
| | | if (mobile.length() != 11) { |
| | | return ""; |
| | | } |
| | | String start = mobile.substring(0, 3); |
| | | String end = mobile.substring(mobile.length() - 4, mobile.length()); |
| | | return start + "****" + end; |
| | | } |
| | | |
| | | /** |
| | | * Createed by PKZ |
| | | * Date 2019/6/4 13:35 |
| | | * Descriptionï¼èº«ä»½è¯å·è±æ |
| | | **/ |
| | | public static String esensitizationdIdcard(String idcard) { |
| | | if (StrUtil.isBlank(idcard)) { |
| | | return ""; |
| | | } |
| | | if (idcard.length() != 18) { |
| | | return ""; |
| | | } |
| | | String start = idcard.substring(0, 4); |
| | | String end = idcard.substring(idcard.length() - 4, idcard.length()); |
| | | return start + "******" + end; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.util.NumberUtil; |
| | | import org.apache.commons.lang.StringUtils; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @ClassName DiscountUtil |
| | | * @Author cy |
| | | * @Date 2023/5/25 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | public class DiscountUtil { |
| | | /** |
| | | * @param totalMoney æ»éé¢ |
| | | * @param discount ææ£ |
| | | * @return |
| | | */ |
| | | public static Map<String, Long> getDiscount(long totalMoney, String discount) { |
| | | if (StringUtils.isBlank(discount)) { |
| | | return null; |
| | | } |
| | | HashMap<String, Long> map = new HashMap<>(); |
| | | if ("10".equals(discount)) { |
| | | map.put("disCountMoney", 0l); |
| | | map.put("payMoney", totalMoney); |
| | | return map; |
| | | } |
| | | Double disc = NumberUtil.div(Convert.toDouble(discount), Convert.toDouble(10)); //ææ£ |
| | | //ææ£ä¼æ ååºä»éé¢ |
| | | Long payMoney = Convert.toLong(Math.ceil(NumberUtil.mul(Convert.toDouble(totalMoney), disc))); // ææåéé¢ï¼åä¸åæ´ï¼ |
| | | |
| | | // 伿 éé¢ |
| | | Long disCountMoney = 0l; |
| | | if (Convert.toDouble(totalMoney) >= payMoney) { |
| | | disCountMoney = totalMoney - payMoney; |
| | | } else { |
| | | disCountMoney = totalMoney; |
| | | payMoney = 0L; |
| | | } |
| | | // map.put("totalMoney", totalMoney); |
| | | map.put("disCountMoney", disCountMoney); |
| | | map.put("payMoney", payMoney); |
| | | return map; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | /** |
| | | * 计ç®åæ è·ç¦»å·¥å
·ç±» |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/5/23 19:10 |
| | | */ |
| | | public class DistanceUtil { |
| | | |
| | | private static double EARTH_RADIUS = 6378.137; |
| | | |
| | | private static double rad(double d) { |
| | | return d * Math.PI / 180.0; |
| | | } |
| | | |
| | | /** |
| | | * éè¿ç»çº¬åº¦è·åè·ç¦»(åä½ï¼ç±³)ï¼è
¾è®¯åæ ï¼ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/5/23 19:14 |
| | | */ |
| | | public static double getDistance(double lat1, double lng1, double lat2, double lng2) { |
| | | double radLat1 = rad(lat1); |
| | | double radLat2 = rad(lat2); |
| | | double a = radLat1 - radLat2; |
| | | double b = rad(lng1) - rad(lng2); |
| | | double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) |
| | | + Math.cos(radLat1) * Math.cos(radLat2) |
| | | * Math.pow(Math.sin(b / 2), 2))); |
| | | s = s * EARTH_RADIUS; |
| | | s = Math.round(s * 10000d) / 10000d; |
| | | s = s * 1000; |
| | | return s; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | //éææº-æ¨éè·¯34.844000,113.743560 |
| | | double distance = getDistance(34.844222, 113.743300, 34.844000, 113.743560); |
| | | System.out.println("è·ç¦»" + distance + "ç±³"); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | // @formatter:off |
| | | import jakarta.servlet.http.HttpServletResponse;import lombok.val;import org.apache.poi.hssf.usermodel.*; |
| | | import java.net.URLEncoder;import java.util.Date;import java.util.List;import java.util.Locale; /** |
| | | * .-~~~~~~~~~-._ _.-~~~~~~~~~-. |
| | | * __.' @Author ~. .~ ä»£ç æ Bug `.__ |
| | | * .'// liu.q \./ (ç§ç±) \\`. |
| | | * .'// [916000612@qq.com] | 欲ç»ç¥å å¼åèªå®« \\`. |
| | | * .'// .-~"""""""~~~~-._ | _,-~~~~"""""""~-. \\`. |
| | | * .'//.-" 2019-07-17 `-. | .-' 16:54 "-.\\`. |
| | | * .'//______.============-.. \ | / ..-============.______\\`. |
| | | *.'______________________________\|/______________________________`. |
| | | * |
| | | * @Description : |
| | | */ |
| | | // @formatter:on |
| | | |
| | | public class ExportExcel { |
| | | public static void exportExcel(String fileName, List<String> titles, List<List<Object>> rows, HttpServletResponse response) throws Exception { |
| | | |
| | | // 声æä¸ä¸ªå·¥ä½è |
| | | HSSFWorkbook workbook = new HSSFWorkbook(); |
| | | // çæä¸ä¸ªè¡¨æ ¼ |
| | | HSSFSheet sheet = workbook.createSheet(); |
| | | // è®¾ç½®è¡¨æ ¼é»è®¤å宽度为15个åè |
| | | sheet.setDefaultColumnWidth((short) 18); |
| | | |
| | | //设置æ é¢ |
| | | HSSFRow title = sheet.createRow(0); |
| | | for (int i = 0; i < titles.size(); i++) { |
| | | HSSFCell cell = title.createCell(i); |
| | | HSSFRichTextString text = new HSSFRichTextString(titles.get(i)); |
| | | cell.setCellValue(text); |
| | | } |
| | | |
| | | //è®¾ç½®æ°æ® |
| | | HSSFCellStyle cellStyle = workbook.createCellStyle(); |
| | | for (int i = 0; i < rows.size(); i++) { |
| | | HSSFRow row = sheet.createRow(i + 1); |
| | | List<Object> clo = rows.get(i); |
| | | int index = 0; |
| | | for (Object o : clo) { |
| | | HSSFCell cell = row.createCell(index); |
| | | if (o instanceof Date) { |
| | | HSSFDataFormat format = workbook.createDataFormat(); |
| | | cellStyle.setDataFormat(format.getFormat("yyyy-mm-dd HH:mm:ss")); |
| | | cell.setCellStyle(cellStyle); |
| | | cell.setCellValue((Date) o); |
| | | } else if (o instanceof Double) { |
| | | HSSFDataFormat format = workbook.createDataFormat(); |
| | | cellStyle.setDataFormat(format.getFormat("#,##0.00")); |
| | | cell.setCellStyle(cellStyle); |
| | | cell.setCellValue(Double.valueOf(o.toString())); |
| | | } else { |
| | | HSSFDataFormat format = workbook.createDataFormat(); |
| | | cellStyle.setDataFormat(format.getFormat("@")); |
| | | cell.setCellStyle(cellStyle); |
| | | cell.setCellValue(o.toString()); |
| | | } |
| | | index++; |
| | | } |
| | | } |
| | | // åè¯æµè§å¨ç¨ä»ä¹è½¯ä»¶å¯ä»¥æå¼æ¤æä»¶ |
| | | response.setHeader("content-Type", "application/vnd.ms-excel"); |
| | | |
| | | //è§£å³ è¹ææµè§å¨ä¹±ç é®é¢ |
| | | val ua = CommonUtil.getRequest().getHeader("User-Agent").toLowerCase(Locale.ENGLISH); |
| | | if (ua.indexOf("macintosh") > -1 && ua.indexOf("chrome") < 0) { |
| | | fileName = new String(fileName.getBytes(), "iso8859-1"); |
| | | } else { |
| | | fileName = URLEncoder.encode(fileName, "utf-8"); |
| | | } |
| | | |
| | | // ä¸è½½æä»¶çé»è®¤åç§° |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.flushBuffer(); |
| | | workbook.write(response.getOutputStream()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import java.net.URLEncoder; |
| | | import java.util.HashMap; |
| | | |
| | | import com.nuvole.common.domain.result.ExpressResult; |
| | | |
| | | import cn.hutool.core.codec.Base64; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import cn.hutool.http.HttpUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * å¿«éé¸ç©æµæ¥å£ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/6/13 15:36 |
| | | */ |
| | | @Slf4j |
| | | public class ExpressUtil { |
| | | |
| | | private static String fileName = "express.properties"; |
| | | |
| | | |
| | | //çµåID |
| | | public static String EBusinessID = ""; |
| | | //çµåå å¯ç§é¥ï¼å¿«é鏿ä¾ï¼æ³¨æä¿ç®¡ï¼ä¸è¦æ³æ¼ |
| | | public static String AppKey = ""; |
| | | //请æ±url, |
| | | public static String ReqURL = ""; |
| | | //å¿«éç±»å |
| | | public static String Type = ""; |
| | | |
| | | static { |
| | | EBusinessID = PropertyUtil.getProp(fileName, "EBusinessID"); |
| | | AppKey = PropertyUtil.getProp(fileName, "AppKey"); |
| | | ReqURL = PropertyUtil.getProp(fileName, "ReqURL"); |
| | | Type = PropertyUtil.getProp(fileName, "Type"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢è®¢åç©æµè½¨è¿¹ï¼Jsonæ¹å¼ ï¼[3000次/天,æ¯åæ¯å¤©éæ¥ 5 次,å¹¶åä¸è¶
è¿ 10 次/S] |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/6/13 15:38 |
| | | */ |
| | | public static ExpressResult getOrderTracesByJson(String expressType, String expressCode) { |
| | | try { |
| | | //妿ä¸ä¼ å¿«éå
¬å¸æ è¯ååé»è®¤å¼ |
| | | if (StrUtil.isEmpty(expressType)) { |
| | | expressType = Type; |
| | | } |
| | | String requestData = "{'OrderCode':'','ShipperCode':'" + expressType + "','LogisticCode':'" + expressCode + "'}"; |
| | | |
| | | HashMap<String, Object> params = new HashMap<>(); |
| | | params.put("RequestData", URLEncoder.encode(requestData, "UTF-8")); |
| | | params.put("EBusinessID", EBusinessID); |
| | | params.put("RequestType", "1002"); //è¯·æ±æ¥å£æä»¤ |
| | | String dataSign = encrypt(requestData, AppKey, "UTF-8"); |
| | | params.put("DataSign", URLEncoder.encode(dataSign, "UTF-8")); |
| | | params.put("DataType", "2"); //jsonæ¹å¼ |
| | | String result = HttpUtil.post(ReqURL, params); |
| | | System.out.println(result); |
| | | return JSONUtil.toBean(result, ExpressResult.class); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return new ExpressResult(); |
| | | } |
| | | } |
| | | |
| | | |
| | | //å å¯ (è¿è¡MD5å å¯ï¼ç¶åBase64ç¼ç ï¼æå è¿è¡URL(utf-8)ç¼ç ) |
| | | private static String encrypt(String content, String keyValue, String charset) { |
| | | if (keyValue != null) { |
| | | return Base64.encode(SecureUtil.md5(content + keyValue).toLowerCase(), charset); |
| | | } |
| | | return Base64.encode(SecureUtil.md5(content).toLowerCase(), charset); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import com.nuvole.util.enums.FileType; |
| | | |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | // @formatter:off |
| | | /** |
| | | * .-~~~~~~~~~-._ _.-~~~~~~~~~-. |
| | | * __.' @Author ~. .~ ä»£ç æ Bug `.__ |
| | | * .'// liu.q \./ (ç§ç±) \\`. |
| | | * .'// [916000612@qq.com] | 欲ç»ç¥å å¼åèªå®« \\`. |
| | | * .'// .-~"""""""~~~~-._ | _,-~~~~"""""""~-. \\`. |
| | | * .'//.-" 2019-04-24 `-. | .-' 15:56 "-.\\`. |
| | | * .'//______.============-.. \ | / ..-============.______\\`. |
| | | *.'______________________________\|/______________________________`. |
| | | * |
| | | * @Description : |
| | | */ |
| | | // @formatter:on |
| | | |
| | | public class FileTypeJudge { |
| | | |
| | | private FileTypeJudge() { |
| | | } |
| | | |
| | | /** |
| | | * å°æä»¶å¤´è½¬æ¢æ16è¿å¶å符串 |
| | | * |
| | | * @return 16è¿å¶å符串 |
| | | */ |
| | | private static String bytesToHexString(byte[] src) { |
| | | |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | if (src == null || src.length <= 0) { |
| | | return null; |
| | | } |
| | | for (int i = 0; i < src.length; i++) { |
| | | int v = src[i] & 0xFF; |
| | | String hv = Integer.toHexString(v); |
| | | if (hv.length() < 2) { |
| | | stringBuilder.append(0); |
| | | } |
| | | stringBuilder.append(hv); |
| | | } |
| | | return stringBuilder.toString(); |
| | | } |
| | | |
| | | /** |
| | | * å¾å°æä»¶å¤´ |
| | | * |
| | | * @param filePath æä»¶è·¯å¾ |
| | | * @return æä»¶å¤´ |
| | | * @throws IOException |
| | | */ |
| | | private static String getFileContent(String filePath) throws IOException { |
| | | |
| | | byte[] b = new byte[28]; |
| | | |
| | | InputStream inputStream = null; |
| | | |
| | | try { |
| | | inputStream = new FileInputStream(filePath); |
| | | inputStream.read(b, 0, 28); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | throw e; |
| | | } finally { |
| | | if (inputStream != null) { |
| | | try { |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | throw e; |
| | | } |
| | | } |
| | | } |
| | | return bytesToHexString(b); |
| | | } |
| | | |
| | | private static String getFileContent(InputStream inputStream){ |
| | | InputStream is = inputStream; |
| | | byte[] b = new byte[28]; |
| | | try { |
| | | is.read(b, 0, 28); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return bytesToHexString(b); |
| | | } |
| | | |
| | | /** |
| | | * 夿æä»¶ç±»å |
| | | * |
| | | * @return æä»¶ç±»å |
| | | */ |
| | | public static String getType(InputStream inputStream){ |
| | | |
| | | String fileHead = getFileContent(inputStream); |
| | | |
| | | if (fileHead == null || fileHead.length() == 0) { |
| | | return null; |
| | | } |
| | | |
| | | fileHead = fileHead.toUpperCase(); |
| | | |
| | | FileType[] fileTypes = FileType.values(); |
| | | |
| | | for (FileType type : fileTypes) { |
| | | if (fileHead.startsWith(type.getValue())) { |
| | | return type.toString(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.io.FileUtil; |
| | | import cn.hutool.extra.ftp.Ftp; |
| | | import cn.hutool.extra.ftp.FtpMode; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.net.ftp.FTP; |
| | | import org.springframework.core.io.DefaultResourceLoader; |
| | | import org.springframework.core.io.ResourceLoader; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName FtpUtil |
| | | * @date 2019/4/15 14:16 |
| | | */ |
| | | @Slf4j |
| | | public class FtpUtil { |
| | | |
| | | public static Properties getFtpProp() { |
| | | Properties props = new Properties(); |
| | | InputStream in = null; |
| | | try { |
| | | ResourceLoader resourceLoader = new DefaultResourceLoader(); |
| | | in = resourceLoader.getResource("ftp.properties").getInputStream(); |
| | | props.load(in); |
| | | return props; |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return props; |
| | | } finally { |
| | | ResourceUtil.safeClose(in); |
| | | } |
| | | |
| | | } |
| | | |
| | | public static Ftp getFtp() { |
| | | |
| | | Properties props = getFtpProp(); |
| | | String url = props.getProperty("ftp.url"); |
| | | int port = Convert.toInt(props.getProperty("ftp.port")); |
| | | String username = props.getProperty("ftp.username"); |
| | | String mixpd = props.getProperty("ftp.mixpd"); |
| | | |
| | | Ftp ftp = new Ftp(url, port, username, mixpd); |
| | | ftp.setMode(FtpMode.Passive); |
| | | ftp.getClient().setActivePortRange(50000, 55000); |
| | | ftp.getClient().setRemoteVerificationEnabled(false); |
| | | try { |
| | | ftp.getClient().setFileType(FTP.BINARY_FILE_TYPE); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ftp; |
| | | } |
| | | |
| | | public static void upload(Ftp ftp, String sourceFilePath,String targetFilePath) { |
| | | String FileName = targetFilePath.substring(targetFilePath.lastIndexOf("/") + 1); |
| | | String targetPath = targetFilePath.substring(0, targetFilePath.lastIndexOf("/")); |
| | | ftp.upload(targetPath, FileName, new File(sourceFilePath)); |
| | | } |
| | | |
| | | public static void upload(Ftp ftp, String FileName,InputStream inputStream,String targetPath) { |
| | | ftp.upload(targetPath,FileName,inputStream); |
| | | } |
| | | |
| | | public static void download(Ftp ftp, String sourceFilePath,String targetFilePath) { |
| | | String sourceName = sourceFilePath.substring(sourceFilePath.lastIndexOf("/") + 1); |
| | | String sourcePath = sourceFilePath.substring(0, sourceFilePath.lastIndexOf("/")); |
| | | ftp.download(sourcePath, sourceName, FileUtil.file(targetFilePath)); |
| | | } |
| | | |
| | | public static void close(Ftp ftp) { |
| | | if (ftp != null) { |
| | | try { |
| | | ftp.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import com.gexin.rp.sdk.base.IAliasResult; |
| | | import com.gexin.rp.sdk.base.IPushResult; |
| | | import com.gexin.rp.sdk.base.impl.AppMessage; |
| | | import com.gexin.rp.sdk.base.impl.ListMessage; |
| | | import com.gexin.rp.sdk.base.impl.SingleMessage; |
| | | import com.gexin.rp.sdk.base.impl.Target; |
| | | import com.gexin.rp.sdk.base.notify.Notify; |
| | | import com.gexin.rp.sdk.base.payload.APNPayload; |
| | | import com.gexin.rp.sdk.exceptions.RequestException; |
| | | import com.gexin.rp.sdk.http.IGtPush; |
| | | import com.gexin.rp.sdk.template.AbstractTemplate; |
| | | import com.gexin.rp.sdk.template.TransmissionTemplate; |
| | | import com.nuvole.common.domain.emnu.CommonResultEmnu; |
| | | import com.nuvole.common.domain.result.CommonResult; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * æ¨éå·¥å
·ç±»ï¼ä¸ªæ¨ï¼ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2020/4/26 13:41 |
| | | */ |
| | | |
| | | public class GeTuiPush { |
| | | |
| | | private static String url = "http://sdk.open.api.igexin.com/apiex.htm"; |
| | | // private static String appId = "0TrCn76GcW8T4y3wediOn9"; |
| | | private static String appId = "g1FYuSXD2x5HY2KfWswP19"; |
| | | // private static String appKey = "FUPAiYeLSo5hbPIZrRDT21"; |
| | | private static String appKey = "kkMqLLBGLd7wx0mhIbG9l5"; |
| | | // private static String masterSecret = "ne5FG9hfS77RNyGAnQF5p1"; |
| | | private static String masterSecret = "AEuOKMlvTY9aLrdjtPhzy7"; |
| | | private static IGtPush igtPush = new IGtPush(url, appKey, masterSecret); |
| | | |
| | | |
| | | /** |
| | | * ä¸ºç¨æ·ç»å®å«å |
| | | * |
| | | * @param clientId 客æ·ç«¯èº«ä»½id |
| | | * @param alias å«å |
| | | * @Author: lc |
| | | * @Date: 2020/4/26 13:36 |
| | | */ |
| | | public static CommonResult bindAlias(String clientId, String alias) { |
| | | |
| | | IAliasResult ret = null; |
| | | try { |
| | | ret = igtPush.bindAlias(appId, alias, clientId); |
| | | System.out.println("is bindAlias res:" + ret.getResponse()); |
| | | } catch (RequestException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (ret != null) { |
| | | Map res = ret.getResponse(); |
| | | if ("ok".equals(res.get("result").toString())) { |
| | | return new CommonResult(res); |
| | | } else { |
| | | return new CommonResult(CommonResultEmnu.ERROR, res.get("error_msg").toString()); |
| | | } |
| | | } else { |
| | | return new CommonResult(CommonResultEmnu.ERROR, "ç»å®ä¸ªæ¨å«åæ¶åºç°å¼å¸¸ï¼"); |
| | | } |
| | | } |
| | | |
| | | |
| | | //æµè¯ |
| | | public static void main(String[] args) { |
| | | |
| | | bindAlias("0482fa489fe285cbb8b96054f81a0b4f", "123456789"); |
| | | pushMessageToSingle("æµè¯demo", "æµè¯demoå
容", 2, "123456789"); |
| | | } |
| | | |
| | | /** |
| | | * 忍ï¼å个clientId/å«åï¼ |
| | | * |
| | | * @param title æ é¢ |
| | | * @param content å
容 |
| | | * @param type ç±»åã1.设å¤idï¼clientIdï¼ 2.å«åã |
| | | * @param val ç±»åå¼ï¼clientId/å«åï¼ |
| | | * @Author: lc |
| | | * @Date: 2020/4/26 13:31 |
| | | */ |
| | | public static Map pushMessageToSingle(String title, String content, int type, String val) { |
| | | |
| | | /*éä¼ æ¶æ¯æ¨¡ç*/ |
| | | AbstractTemplate template = getTransmissionTemplate(title, content); |
| | | |
| | | // åæ¨æ¶æ¯ç±»å |
| | | SingleMessage message = getSingleMessage(template); |
| | | Target target = new Target(); |
| | | target.setAppId(appId); |
| | | if (type == 1) { |
| | | target.setClientId(val); |
| | | } else { |
| | | target.setAlias(val);//å«åéè¦æåç»å® |
| | | } |
| | | IPushResult ret = null; |
| | | try { |
| | | ret = igtPush.pushMessageToSingle(message, target); |
| | | System.out.println("is pushMessageToSingle res:" + ret.getResponse()); |
| | | } catch (RequestException e) { |
| | | e.printStackTrace(); |
| | | ret = igtPush.pushMessageToSingle(message, target, e.getRequestId()); |
| | | } |
| | | if (ret != null) { |
| | | return ret.getResponse(); |
| | | } else { |
| | | System.out.println("个æ¨åæ¡æ¨éæå¡å¨ååºå¼å¸¸"); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¨éä¸ä¸ªå表 |
| | | * |
| | | * @param title æ é¢ |
| | | * @param content å
容 |
| | | * @parma type ç±»åã1.设å¤idï¼clientIdï¼ 2.å«åã |
| | | * @parma jsonArray ç±»åå¼ï¼clientId/å«åï¼ |
| | | * @Author: lc |
| | | * @Date: 2020/4/26 13:37 |
| | | */ |
| | | public static Map pushMessageToList(String title, String content, int type, List<String> list) { |
| | | /*éä¼ æ¶æ¯æ¨¡ç*/ |
| | | AbstractTemplate template = getTransmissionTemplate(title, content); |
| | | |
| | | ListMessage message = new ListMessage(); |
| | | message.setData(template); |
| | | // è®¾ç½®æ¶æ¯ç¦»çº¿ï¼å¹¶è®¾ç½®ç¦»çº¿æ¶é´ |
| | | message.setOffline(true); |
| | | // ç¦»çº¿æææ¶é´ï¼åä½ä¸ºæ¯«ç§ï¼å¯é |
| | | message.setOfflineExpireTime(24 * 1000 * 3600); |
| | | message.setPriority(1); |
| | | String taskId = igtPush.getContentId(message); |
| | | // é
ç½®æ¨éç®æ |
| | | List targets = new ArrayList(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | String cid = list.get(i); |
| | | Target target = new Target(); |
| | | target.setAppId(appId); |
| | | if (type == 1) { |
| | | target.setClientId(cid); |
| | | } else { |
| | | target.setAlias(cid); |
| | | } |
| | | targets.add(target); |
| | | } |
| | | |
| | | IPushResult ret = null; |
| | | try { |
| | | ret = igtPush.pushMessageToList(taskId, targets); |
| | | System.out.println("is pushMessageToList:" + ret.getResponse()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (ret != null) { |
| | | return ret.getResponse(); |
| | | } else { |
| | | System.out.println("ä¸ªæ¨æ¨éä¸ä¸ªå表æå¡å¨ååºå¼å¸¸"); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¨éææææºç¨æ· |
| | | * |
| | | * @param title æ é¢ |
| | | * @param content å
容 |
| | | * @Author: lc |
| | | * @Date: 2020/4/26 13:36 |
| | | */ |
| | | public static Map pushMessageToApp(String title, String content) { |
| | | /*éä¼ æ¶æ¯æ¨¡ç*/ |
| | | AbstractTemplate template = getTransmissionTemplate(title, content); |
| | | |
| | | // åæ¨æ¶æ¯ç±»å |
| | | AppMessage message = new AppMessage(); |
| | | message.setData(template); |
| | | message.setOffline(true); |
| | | message.setOfflineExpireTime(24 * 1000 * 3600); //ç¦»çº¿æææ¶é´ï¼åä½ä¸ºæ¯«ç§ï¼å¯é |
| | | //å
¨éæ¨éæ¶å¸æè½æ§å¶æ¨éé度ä¸è¦å¤ªå¿«ï¼ç¼åæå¡å¨è¿æ¥ååï¼å¯è®¾ç½®å®éæ¨éã妿æªè®¾ç½®åæé»è®¤æ¨éé度åé |
| | | message.setSpeed(100); // 设置为100ï¼å«ä¹ä¸ºä¸ªæ¨æ§å¶ä¸åé度å¨100æ¡/ç§å·¦å³ |
| | | List<String> appIdList = new ArrayList<String>(); |
| | | appIdList.add(appId); |
| | | message.setAppIdList(appIdList); |
| | | |
| | | IPushResult ret = null; |
| | | try { |
| | | ret = igtPush.pushMessageToApp(message); |
| | | System.out.println("is pushMessageToApp res:" + ret.getResponse()); |
| | | } catch (RequestException e) { |
| | | e.printStackTrace(); |
| | | ret = igtPush.pushMessageToApp(message, e.getRequestId()); |
| | | } |
| | | if (ret != null) { |
| | | return ret.getResponse(); |
| | | } else { |
| | | System.out.println("ä¸ªæ¨æ¨éææææºç¨æ·æå¡å¨ååºå¼å¸¸"); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * éä¼ æ¶æ¯æ¨¡ç |
| | | * |
| | | * @param title æ é¢ |
| | | * @param content å
容 |
| | | * @Author: lc |
| | | * @Date: 2020/4/26 13:46 |
| | | */ |
| | | private static TransmissionTemplate getTransmissionTemplate(String title, String content) { |
| | | TransmissionTemplate template = new TransmissionTemplate(); |
| | | /*设置APPIDä¸APPKEY*/ |
| | | template.setAppId(appId); |
| | | template.setAppkey(appKey); |
| | | /*éä¼ æ¶æ¯è®¾ç½®ï¼1为强å¶å¯å¨åºç¨ï¼å®¢æ·ç«¯æ¥æ¶å°æ¶æ¯åå°±ä¼ç«å³å¯å¨åºç¨ï¼2为çå¾
åºç¨å¯å¨*/ |
| | | template.setTransmissionType(2); |
| | | template.setTransmissionContent(content); |
| | | /*iosæ¶æ¯æ¨é*/ |
| | | template.setAPNInfo(getAPNPayload()); |
| | | |
| | | Notify notify = new Notify(); |
| | | // notify.setIntent("intent:#intent;action=android.intent.action.oppopush;package=cn.com.pconline.android.browser;component=cn.com.android.browser/cn.com.android.browser.push.MultivendorPushActivity;S.protocol=pconlinebrowser://information-article/8270922;end"); |
| | | notify.setIntent("intent:#Intent;action=android.intent.action.oppopush;launchFlags=0x14000000;component=com.liuqit.notebook/io.dcloud.PandoraEntry;S.UP-OL-SU=true;S.title=" + title + ";S.content=" + content + ";S.payload=" + content + ";end"); |
| | | notify.setTitle(title); |
| | | notify.setContent(content); |
| | | /*ç¬¬ä¸æ¹*/ |
| | | template.set3rdNotifyInfo(notify); |
| | | return template; |
| | | } |
| | | |
| | | private static SingleMessage getSingleMessage(AbstractTemplate template) { |
| | | SingleMessage message = new SingleMessage(); |
| | | message.setData(template); |
| | | // è®¾ç½®æ¶æ¯ç¦»çº¿ï¼å¹¶è®¾ç½®ç¦»çº¿æ¶é´ |
| | | message.setOffline(true); |
| | | // ç¦»çº¿æææ¶é´ï¼åä½ä¸ºæ¯«ç§ï¼å¯é |
| | | message.setOfflineExpireTime(72 * 3600 * 1000); |
| | | message.setPriority(1); |
| | | // 夿客æ·ç«¯æ¯å¦wifiç¯å¢ä¸æ¨éã1为ä»
å¨wifiç¯å¢ä¸æ¨éï¼0为ä¸éå¶ç½ç»ç¯å¢ï¼é»è®¤ä¸é |
| | | message.setPushNetWorkType(0); |
| | | return message; |
| | | } |
| | | |
| | | private static APNPayload getAPNPayload() { |
| | | APNPayload payload = new APNPayload(); |
| | | //å¨å·²ææ°ååºç¡ä¸å 1æ¾ç¤ºï¼è®¾ç½®ä¸º-1æ¶ï¼å¨å·²ææ°åä¸å1æ¾ç¤ºï¼è®¾ç½®ä¸ºæ°åæ¶ï¼æ¾ç¤ºæå®æ°å |
| | | payload.setAutoBadge("+1"); |
| | | payload.setContentAvailable(1); |
| | | //ios 12.0 以ä¸å¯ä»¥ä½¿ç¨ Dictionary ç±»åç sound |
| | | payload.setSound("default"); |
| | | payload.setCategory("$ç±å®¢æ·ç«¯å®ä¹"); |
| | | payload.addCustomMsg("ç±å®¢æ·èªå®ä¹æ¶æ¯key", "ç±å®¢æ·èªå®ä¹æ¶æ¯value"); |
| | | |
| | | //ç®å模å¼APNPayload.SimpleMsg |
| | | payload.setAlertMsg(new APNPayload.SimpleAlertMsg("hello")); |
| | | // payload.setAlertMsg(getDictionaryAlertMsg()); //åå
¸æ¨¡å¼ä½¿ç¨APNPayload.DictionaryAlertMsg |
| | | |
| | | //设置è¯é³ææ¥ç±»åï¼intç±»åï¼0.ä¸å¯ç¨ 1.ææ¾body 2.ææ¾èªå®ä¹ææ¬ |
| | | payload.setVoicePlayType(0); |
| | | |
| | | return payload; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.nuvole.constants.ServiceConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description: |
| | | * @Company: TOO (psï¼å
¬å¸åç§°) |
| | | * @author: å |
| | | * @date: 2020/5/16 ä¸å8:47 |
| | | * @version: V1.0.0 |
| | | */ |
| | | @Slf4j |
| | | public class GeTuiPushCall { |
| | | |
| | | /** |
| | | * 忍ï¼å个clientId/å«åï¼ |
| | | * |
| | | * @param title æ é¢ |
| | | * @param content å
容 |
| | | * @param type ç±»åã1.设å¤idï¼clientIdï¼ 2.å«åã |
| | | * @param val ç±»åå¼ï¼clientId/å«åï¼ |
| | | * @Author: lc |
| | | * @Date: 2020/4/26 13:31 |
| | | */ |
| | | public static String pushMessageToSingle(String title, String content, int type, String val) { |
| | | String url = ServiceConstants.SERVICE_GE_TUI_URL; |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("title", title); |
| | | map.put("content", content); |
| | | map.put("type", type); |
| | | map.put("val", val); |
| | | return HttpUtil.post(url, map); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¨éä¸ä¸ªå表 |
| | | * |
| | | * @param title æ é¢ |
| | | * @param content å
容 |
| | | * @parma type ç±»åã1.设å¤idï¼clientIdï¼ 2.å«åã |
| | | * @parma jsonArray ç±»åå¼ï¼clientId/å«åï¼ |
| | | * @Author: lc |
| | | * @Date: 2020/4/26 13:37 |
| | | */ |
| | | public static String pushMessageToList(String title, String content, int type, List<String> list) { |
| | | String url = ServiceConstants.SERVICE_GE_TUI_LIST_URL; |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("title", title); |
| | | map.put("content", content); |
| | | map.put("type", type); |
| | | map.put("list", list); |
| | | return HttpUtil.post(url, map); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.io.IoUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import org.apache.commons.text.StringEscapeUtils; |
| | | |
| | | import java.io.IOException; |
| | | import java.nio.charset.Charset; |
| | | |
| | | /** |
| | | * @ClassName HttpUtilExtra |
| | | * @Description httpæ©å±å·¥å
·ç±» |
| | | * @Author Chen Long |
| | | * @Date 2019/8/23 |
| | | * @Version 1.0 |
| | | */ |
| | | public class HttpUtilExtra { |
| | | |
| | | /** |
| | | * è·årequest bodyå¼ |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static String getRequestBody(HttpServletRequest request) { |
| | | try { |
| | | return IoUtil.read(request.getInputStream(), Charset.forName("UTF-8")); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * request body 转对象 |
| | | * @param request |
| | | * @param classz |
| | | * @return |
| | | */ |
| | | public static <T> T getObjByRequestBody(HttpServletRequest request, Class<T> classz) { |
| | | String body = StringEscapeUtils.unescapeHtml4(getRequestBody(request)); |
| | | return JSON.parseObject(body, classz); |
| | | } |
| | | |
| | | public static <T> T getObjByRequestBody(Class<T> classz) { |
| | | String body = StringEscapeUtils.unescapeHtml4(getRequestBody(CommonUtil.getRequest())); |
| | | return JSON.parseObject(body, classz); |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.net.NetworkInterface; |
| | | import java.util.Enumeration; |
| | | |
| | | public class IPUtil { |
| | | |
| | | /* |
| | | * @Author : liu.q [916000612@qq.com] |
| | | * @Date : 2019-05-11 17:06 |
| | | * @Description :è·åç¨æ·çå®IPå°åï¼ä¸ä½¿ç¨request.getRemoteAddr()çåå æ¯æå¯è½ç¨æ·ä½¿ç¨äºä»£ç软件æ¹å¼é¿å
çå®IPå°å,坿¯ï¼å¦æéè¿äºå¤çº§åå代ççè¯ï¼X-Forwarded-Forçå¼å¹¶ä¸æ¢ä¸ä¸ªï¼èæ¯ä¸ä¸²IPå¼ |
| | | */ |
| | | public static String getIpAddr(HttpServletRequest request) { |
| | | String ip = request.getHeader("x-forwarded-for"); |
| | | if (ip != null && ip.length() != 0 && !"unknown".equalsIgnoreCase(ip)) { |
| | | // 夿¬¡åå代çå伿å¤ä¸ªipå¼ï¼ç¬¬ä¸ä¸ªipææ¯çå®ip |
| | | if (ip.indexOf(",") != -1) { |
| | | ip = ip.split(",")[0]; |
| | | } |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("WL-Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("HTTP_CLIENT_IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("HTTP_X_FORWARDED_FOR"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("X-Real-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getRemoteAddr(); |
| | | } |
| | | return ip; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·åæ¬å°IPå°åï¼å±åç½ï¼ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/11/8 11:59 |
| | | */ |
| | | public static String getLocalHostIp() { |
| | | try { |
| | | InetAddress candidateAddress = null; |
| | | // éåææçç½ç»æ¥å£ |
| | | for (Enumeration ifaces = NetworkInterface.getNetworkInterfaces(); ifaces.hasMoreElements(); ) { |
| | | NetworkInterface iface = (NetworkInterface) ifaces.nextElement(); |
| | | // 卿æçæ¥å£ä¸åéåIP |
| | | for (Enumeration inetAddrs = iface.getInetAddresses(); inetAddrs.hasMoreElements(); ) { |
| | | InetAddress inetAddr = (InetAddress) inetAddrs.nextElement(); |
| | | if (!inetAddr.isLoopbackAddress()) {// æé¤loopbackç±»åå°å |
| | | if (inetAddr.isSiteLocalAddress()) { |
| | | // 妿æ¯site-localå°å |
| | | return inetAddr.toString().replace("/", ""); |
| | | } else if (candidateAddress == null) { |
| | | //site-localç±»åçå°åæªè¢«åç°ï¼å
è®°å½åéå°å |
| | | candidateAddress = inetAddr; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (candidateAddress != null) { |
| | | return candidateAddress.toString().replace("/", ""); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import cn.hutool.core.util.RandomUtil; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName IdGenerator |
| | | * @Description idçæå¨ |
| | | * @date 2019/4/18 11:33 |
| | | */ |
| | | public class IdGenerator { |
| | | |
| | | private static Snowflake snowflake; |
| | | |
| | | public static Long getId() { |
| | | return snowflake.nextId(); |
| | | } |
| | | |
| | | static { |
| | | snowflake = IdUtil.createSnowflake(RandomUtil.randomInt(0, 31), RandomUtil.randomInt(0, 31)); |
| | | } |
| | | |
| | | public static String getUUID() { |
| | | |
| | | return IdUtil.simpleUUID(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.File; |
| | | |
| | | //// @formatter:off |
| | | //import javax.imageio.*;import javax.imageio.metadata.IIOMetadata;import javax.imageio.stream.ImageOutputStream;import java.awt.*;import java.awt.image.BufferedImage;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream; /** |
| | | // * .-~~~~~~~~~-._ _.-~~~~~~~~~-. |
| | | // * __.' @Author ~. .~ ä»£ç æ Bug `.__ |
| | | // * .'// liu.q \./ (ç§ç±) \\`. |
| | | // * .'// [916000612@qq.com] | 欲ç»ç¥å å¼åèªå®« \\`. |
| | | // * .'// .-~"""""""~~~~-._ | _,-~~~~"""""""~-. \\`. |
| | | // * .'//.-" 2019-04-24 `-. | .-' 12:53 "-.\\`. |
| | | // * .'//______.============-.. \ | / ..-============.______\\`. |
| | | // *.'______________________________\|/______________________________`. |
| | | // * |
| | | // * @Description : |
| | | // */ |
| | | //// @formatter:on |
| | | // |
| | | public class ImageUtil { |
| | | public static void main(String[] args) throws Exception { |
| | | byte[] imageBytes = getImageBytes("C:\\Users\\cy\\Pictures\\è¥ä¸æ§ç
§\\111.jpg"); |
| | | System.out.println(imageBytes.length); |
| | | } |
| | | public static byte[] getImageBytes(String imagePath) throws Exception { |
| | | // 读åå¾çæä»¶ |
| | | BufferedImage bufferedImage = ImageIO.read(new File(imagePath)); |
| | | |
| | | // å°å¾çåå
¥åèæµ |
| | | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | ImageIO.write(bufferedImage, "jpg", baos); |
| | | |
| | | // è¿ååèæ°ç» |
| | | return baos.toByteArray(); |
| | | } |
| | | // |
| | | // /* |
| | | // * @Author : liu.q [916000612@qq.com] |
| | | // * @Date : 2019-04-24 12:55 |
| | | // * @param OldInputStream : åå¾ |
| | | // * @param w : 宽 |
| | | // * @param h : é« |
| | | // * @param quality : è´¨é |
| | | // * @return : InputStream å缩åçå¾ |
| | | // * @Description : |
| | | // */ |
| | | // public static InputStream ImgCompress(InputStream OldInputStream,String suffix,int w, int h, float quality) { |
| | | // try { |
| | | // /** å¤çå®½é« */ |
| | | // BufferedImage bufferedImage = ImageIO.read(OldInputStream); |
| | | // int new_w = bufferedImage.getWidth(null); |
| | | // int new_h = bufferedImage.getHeight(null); |
| | | // if(new_w<=w || new_h<=h){//åå¾å®½é«å°äºè¦å缩ç宽é«å°±ä¸å缩äºã |
| | | // return OldInputStream; |
| | | // } |
| | | // double bili; |
| | | // if(w<=0 || h<=0){ |
| | | // if(w>0){ |
| | | // bili=(double)w/new_w; |
| | | // new_h = (int) (new_h*bili); |
| | | // new_w=w; |
| | | // }else{ |
| | | // if(h>0){ |
| | | // bili=(double)h/new_h; |
| | | // new_w = (int) (new_w*bili); |
| | | // new_h=h; |
| | | // } |
| | | // } |
| | | // }else{ |
| | | // new_w=w; |
| | | // new_h=h; |
| | | // } |
| | | // |
| | | // BufferedImage image_to_save = new BufferedImage(new_w, new_h,bufferedImage.getType()); |
| | | // image_to_save.getGraphics().drawImage(bufferedImage.getScaledInstance(new_w, new_h, Image.SCALE_SMOOTH), 0,0, null); |
| | | // ImageWriter imageWriter = ImageIO.getImageWritersBySuffix(suffix).next(); |
| | | // IIOMetadata imageMetaData = imageWriter.getDefaultImageMetadata(new ImageTypeSpecifier(image_to_save), null); |
| | | // //è´¨éå缩 |
| | | // if (quality >= 0 && quality <= 1f) { |
| | | // ImageWriteParam jpegParams = imageWriter.getDefaultWriteParam(); |
| | | // jpegParams.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); |
| | | // jpegParams.setCompressionQuality(quality); |
| | | // } |
| | | // //åå
¥å¾ç |
| | | // imageWriter.write(imageMetaData,new IIOImage(image_to_save, null, null), null); |
| | | // imageWriter.dispose(); |
| | | // |
| | | // return imageWriter; |
| | | // } catch (IOException ex) { |
| | | // ex.printStackTrace(); |
| | | // } |
| | | // } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.http.HttpUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.nuvole.constants.ServiceConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description: |
| | | * @Company: TOO (psï¼å
¬å¸åç§°) |
| | | * @author: å |
| | | * @date: 2019/12/2 ä¸å3:47 |
| | | * @version: V1.0.0 |
| | | */ |
| | | @Slf4j |
| | | public class JGPushCallUtil { |
| | | |
| | | public static String push(String content,String title,String userid,String businessid,String businesstype) { |
| | | String path = ServiceConstants.SERVICE_JG_PUSH_URL; |
| | | Map<String,Object> param = new HashMap<>(5); |
| | | param.put("content",content); |
| | | param.put("title",title); |
| | | param.put("userid",userid); |
| | | param.put("businessid",businessid); |
| | | param.put("businesstype",businesstype); |
| | | return HttpUtil.post(path,param); |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.jiguang.common.ClientConfig; |
| | | import cn.jiguang.common.resp.APIConnectionException; |
| | | import cn.jiguang.common.resp.APIRequestException; |
| | | import cn.jpush.api.JPushClient; |
| | | import cn.jpush.api.push.PushResult; |
| | | import cn.jpush.api.push.model.Platform; |
| | | import cn.jpush.api.push.model.PushPayload; |
| | | import cn.jpush.api.push.model.audience.Audience; |
| | | import cn.jpush.api.push.model.notification.AndroidNotification; |
| | | import cn.jpush.api.push.model.notification.IosNotification; |
| | | import cn.jpush.api.push.model.notification.Notification; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Createed by PKZ |
| | | * Date 2019/5/28 14:46 |
| | | * Description:æå
æ¨é |
| | | */ |
| | | public class JGPushUtil { |
| | | private static String MASTER_SECRET="142cc44b9a7031b1b461530a"; |
| | | private static String APP_KEY="382144e6869af95cb99ba6f3"; |
| | | /* |
| | | private static String MASTER_SECRET="7d926843009a59d013100ad9"; |
| | | private static String APP_KEY="050c7ed3f0218d5c96a9c73c"; |
| | | */ |
| | | //æå
æ¨é |
| | | private static PushPayload buildPushObject_ios_audienceMore_messageWithExtras(String content,String title,String userid,String businessid,String businesstype) { |
| | | Map m=new HashMap(); |
| | | m.put("id",businessid); |
| | | m.put("type",businesstype); |
| | | return PushPayload.newBuilder() |
| | | .setPlatform(Platform.all())//æ¨éææå¹³å° |
| | | .setAudience(Audience.alias(userid))//å«åæ¨é |
| | | //.setAudience(Audience.all())//å
¨é¨æ¨é |
| | | /* .setMessage(Message.newBuilder()//åééä¼ æ¶æ¯ |
| | | .setMsgContent(content) |
| | | .setTitle(title) |
| | | .addExtra("from", "JPush") |
| | | .addExtra("businessid",businessid) |
| | | .addExtra("businesstype",businesstype) |
| | | .build())*/ |
| | | .setNotification( |
| | | Notification.newBuilder() |
| | | .addPlatformNotification(AndroidNotification.newBuilder().setAlert(content).setTitle(title).addExtras(m).build()) |
| | | .addPlatformNotification(IosNotification.newBuilder().setAlert(content).addExtras(m).build()) |
| | | .build() |
| | | )//åééç¥ |
| | | .build(); |
| | | } |
| | | /** |
| | | * Createed by PKZ |
| | | * Date 2019/5/28 15:01 |
| | | * Descriptionï¼æå
æ¨é |
| | | * @param content æ¨éå
容 |
| | | * @param title æ é¢ |
| | | * @param userid æ¨éå«å |
| | | * @param businessid ä¸å¡id |
| | | * @param businesstype ä¸å¡ç±»åï¼1ï¼æ«ç æ¯ä»è®¢åï¼ |
| | | **/ |
| | | public static String push(String content,String title,String userid,String businessid,String businesstype){ |
| | | PushPayload payload=buildPushObject_ios_audienceMore_messageWithExtras(content,title,userid,businessid,businesstype); |
| | | JPushClient jpushClient = new JPushClient(MASTER_SECRET, APP_KEY, null, ClientConfig.getInstance()); |
| | | PushResult result=new PushResult(); |
| | | try { |
| | | result= jpushClient.sendPush(payload); |
| | | } catch (APIConnectionException e) { |
| | | e.printStackTrace(); |
| | | } catch (APIRequestException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return Convert.toStr(result.statusCode); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | push("æ¯ä»å®æ¶æ¬¾æå2å
","æ¯ä»å®æ¶æ¬¾æå2å
","1255396878833553408","1139417207521021952","1" |
| | | ); |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import io.jsonwebtoken.Claims; |
| | | import io.jsonwebtoken.Jwts; |
| | | import io.jsonwebtoken.SignatureAlgorithm; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @ClassName JWTUtil |
| | | * @Description JWTå·¥å
·ç±» |
| | | * @Author Chen Long |
| | | * @Date 2019/8/20 |
| | | * @Version 1.0 |
| | | */ |
| | | public class JWTUtil { |
| | | |
| | | /** |
| | | * PCç±»åJWT |
| | | */ |
| | | public static final String JWT_TYPE_PC = "PC"; |
| | | |
| | | /** |
| | | * 客æ·ç»çç±»åjwt |
| | | */ |
| | | public static final String JWT_TYPE_MANAGER_WX_MINI = "MANAGER_WX_MINI"; |
| | | /** |
| | | * APPç±»åJWT |
| | | */ |
| | | public static final String JWT_TYPE_APP = "APP"; |
| | | |
| | | /** |
| | | * SCANPAY JWT |
| | | */ |
| | | public static final String JWT_TYPE_SCANPAY = "SCANPAY"; |
| | | |
| | | /** |
| | | * PCç±»åJWTè¶
æ¶æ¶é¿ |
| | | */ |
| | | public static final long JWT_TYPE_PC_EXPIRE = 2 * 60 * 60 * 1000; |
| | | |
| | | /** |
| | | * 客æ·ç»çå°ç¨åºç±»åJWTè¶
æ¶æ¶é¿ |
| | | */ |
| | | public static final long JWT_TYPE_MANAGER_WX_MINI_EXPIRE = 7 * 24 * 60 * 60 * 1000; |
| | | |
| | | |
| | | /** |
| | | * APPç±»åJWTè¶
æ¶æ¶é¿ |
| | | */ |
| | | public static final long JWT_TYPE_APP_EXPIRE = 2 * 60 * 60 * 1000; |
| | | |
| | | /** |
| | | * SCANPAY JWTè¶
æ¶æ¶é¿ |
| | | */ |
| | | public static final long JWT_TYPE_SCANPAY_EXPIRE = 2 * 60 * 60 * 1000; |
| | | |
| | | /** |
| | | * èªå®ä¹åç¼ |
| | | */ |
| | | private static final String JWT_SIGN_PREFIX = "o6t48fVSqCUCu"; |
| | | /** |
| | | * å å¯å¯é¥ |
| | | */ |
| | | private static final String JWT_SECRET = "sHyPanQN8wAt3sKBix9Fla7iGvwWs4hfE4YhluMYvbtBdX6sOiEeGU4lHhVgdrsO"; |
| | | |
| | | |
| | | /** |
| | | * å建 JWT |
| | | * |
| | | * @param jwtType |
| | | * @param claims |
| | | * @return |
| | | * @Description jwtè·è½½ |
| | | * iss: jwtç¾åè
|
| | | * sub: jwtæé¢åçç¨æ· |
| | | * aud: æ¥æ¶jwtç䏿¹ |
| | | * exp: jwtçè¿ææ¶é´ï¼è¿ä¸ªè¿ææ¶é´å¿
é¡»è¦å¤§äºç¾åæ¶é´ |
| | | * nbf: å®ä¹å¨ä»ä¹æ¶é´ä¹åï¼è¯¥jwt齿¯ä¸å¯ç¨ç. |
| | | * iat: jwtçç¾åæ¶é´ |
| | | * jti: jwtçå¯ä¸èº«ä»½æ è¯ï¼ä¸»è¦ç¨æ¥ä½ä¸ºä¸æ¬¡æ§token,ä»èåé¿éæ¾æ»å»ã |
| | | */ |
| | | public static String generateJwt(String jwtType, Map<String, Object> claims) { |
| | | |
| | | //ç¾åæ¶é´ |
| | | long nowMillis = System.currentTimeMillis(); |
| | | //è¶
æ¶æ¶é´ |
| | | long expMillis = 0; |
| | | if (jwtType.equalsIgnoreCase(JWT_TYPE_PC)) { |
| | | expMillis = nowMillis + JWT_TYPE_PC_EXPIRE; |
| | | } else if (jwtType.equalsIgnoreCase(JWT_TYPE_APP)) { |
| | | expMillis = nowMillis + JWT_TYPE_APP_EXPIRE; |
| | | } else if (jwtType.equalsIgnoreCase(JWT_TYPE_SCANPAY)) { |
| | | expMillis = nowMillis + JWT_TYPE_SCANPAY_EXPIRE; |
| | | } else if (jwtType.equalsIgnoreCase(JWT_TYPE_MANAGER_WX_MINI)) { |
| | | expMillis = nowMillis + JWT_TYPE_MANAGER_WX_MINI_EXPIRE; |
| | | } |
| | | |
| | | for (Map.Entry<String, Object> entry : claims.entrySet()) { |
| | | entry.setValue(AESUtil.encode( |
| | | Convert.toStr( |
| | | entry.getValue()))); |
| | | |
| | | } |
| | | |
| | | String compactJws = Jwts.builder() |
| | | .setClaims(claims) |
| | | .setIssuedAt(new Date(nowMillis)) |
| | | .setExpiration(new Date(expMillis)) |
| | | .signWith(SignatureAlgorithm.HS512, JWT_SECRET) |
| | | .compact(); |
| | | |
| | | return JWT_SIGN_PREFIX + compactJws; |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªjwtæ¯å¦åæ³ |
| | | * |
| | | * @param jwt |
| | | * @return |
| | | */ |
| | | public static boolean checkJWT(String jwt) { |
| | | try { |
| | | getClaims(jwt); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åclaims |
| | | * |
| | | * @param jwt |
| | | * @return |
| | | */ |
| | | public static Claims getClaims(String jwt) { |
| | | jwt = jwt.substring(JWT_SIGN_PREFIX.length()); |
| | | Claims claims; |
| | | claims = Jwts.parser() |
| | | .setSigningKey(JWT_SECRET) |
| | | .parseClaimsJws(jwt) |
| | | .getBody(); |
| | | return claims; |
| | | } |
| | | |
| | | /** |
| | | * è·åclaims sub |
| | | * |
| | | * @param jwt |
| | | * @return |
| | | */ |
| | | public static String getSubOfClaims(String jwt) { |
| | | return getValOfClaims(jwt, "sub"); |
| | | } |
| | | |
| | | /** |
| | | * è·åclaims roles |
| | | * |
| | | * @param jwt |
| | | * @return |
| | | */ |
| | | public static String getRolesOfClaims(String jwt) { |
| | | return getValOfClaims(jwt, "roles"); |
| | | } |
| | | |
| | | /** |
| | | * @param jwt |
| | | * @param key |
| | | * @Method getValOfClaims |
| | | * @Description æ ¹æ®keyè·åclaimså¼ |
| | | * @Return java.lang.String |
| | | * @Author Chen Long |
| | | * @Date 2019/8/27 |
| | | * @Version 1.0 |
| | | */ |
| | | public static String getValOfClaims(String jwt, String key) { |
| | | return AESUtil.decode( |
| | | Convert.toStr( |
| | | getClaims(jwt).get(key))); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.nuvole.hnnx.hnnxPay.NXHttpClientUtils; |
| | | import com.nuvole.hnnx.hnnxPay.SignatureSigner; |
| | | import com.nuvole.util.enums.LaPushEnum; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @ClassName LaBaPushUtil |
| | | * @Author cy |
| | | * @Date 2023/12/7 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | @Slf4j |
| | | public class LaBaPushUtil { |
| | | private static final String DEVICE_ID = "202312080001"; |
| | | |
| | | private static String ACCESSKEYSECRET = "AtR4g5sa24fdy6GII3hts75_CSYH"; |
| | | private static String accessKeyId = "IOT_ACCOUNT_TEST_CSYH"; |
| | | |
| | | private static SignatureSigner signable = new SignatureSigner(); |
| | | //ç产ç¯å¢ |
| | | private static String scUrl = "https://voice.tysmartpos.com/api/bank/pushmsg"; |
| | | //æµè¯ç¯å¢ |
| | | private static String csUrl = "https://voicetest.tysmartpos.com/api/bank/pushmsg"; |
| | | |
| | | // public static void main(String[] args) { |
| | | // String deviceId = "202312080001"; |
| | | //// String 010859416327 = "202312080001"; |
| | | //// push(deviceId, LaPushEnum.YINHANG, 111); |
| | | // pushMessageToSingle(deviceId, LaPushEnum.ZFB, 222); |
| | | ////// push(deviceId, LaPushEnum.WX, 333); |
| | | // pushMessageToSingle(deviceId, LaPushEnum.CANCLE, 444); |
| | | // } |
| | | |
| | | public static void pushMessageToSingle(String deviceId, LaPushEnum pushType, long money) { |
| | | if (StringUtils.isEmpty(deviceId)){ |
| | | return; |
| | | } |
| | | Map<String, String> parameters = new HashMap<>(); |
| | | parameters.put("accessKeyId", accessKeyId); |
| | | parameters.put("requestId", String.valueOf(System.currentTimeMillis())); |
| | | //è¯·æ±æ¶é´æ³ï¼æ ¼å¼å¦ï¼1593532800000 |
| | | parameters.put("timestamp", String.valueOf(System.currentTimeMillis())); |
| | | //设å¤ç¼å· |
| | | parameters.put("deviceId", deviceId); |
| | | |
| | | String moneyYuan = NXHttpClientUtils.convertToYuan(money).toString(); |
| | | parameters.put("content", pushType.getName() + moneyYuan + "å
"); |
| | | String signStr = signable.laBaSign(parameters, ACCESSKEYSECRET); |
| | | parameters.put("sign", signStr); |
| | | String jsonBody = JSONObject.toJSONString(parameters); |
| | | |
| | | String result = null; |
| | | log.info("天å»äºé³å请æ±åæ°ï¼{}", jsonBody); |
| | | HttpResponse response = HttpRequest.post(csUrl) |
| | | .contentType("application/json") |
| | | .body(jsonBody) |
| | | .execute(); |
| | | // è·åååºç»æ |
| | | result = response.body(); |
| | | log.info("天å»äºé³åæ¨éè¿åå¼ï¼{}", result); |
| | | return; |
| | | } |
| | | |
| | | public static void pushMessageToList(LaPushEnum pushType, long money, List<String> deviceIdList) { |
| | | Map<String, String> parameters = new HashMap<>(); |
| | | parameters.put("accessKeyId", accessKeyId); |
| | | parameters.put("requestId", String.valueOf(System.currentTimeMillis())); |
| | | //è¯·æ±æ¶é´æ³ï¼æ ¼å¼å¦ï¼1593532800000 |
| | | parameters.put("timestamp", String.valueOf(System.currentTimeMillis())); |
| | | String moneyYuan = NXHttpClientUtils.convertToYuan(money).toString(); |
| | | parameters.put("content", pushType.getName() + moneyYuan + "å
"); |
| | | |
| | | deviceIdList.forEach(deviceId -> { |
| | | //设å¤ç¼å· |
| | | parameters.put("deviceId", deviceId); |
| | | String signStr = signable.laBaSign(parameters, ACCESSKEYSECRET); |
| | | parameters.put("sign", signStr); |
| | | String jsonBody = JSONObject.toJSONString(parameters); |
| | | |
| | | String result = null; |
| | | log.info("天åå忍é请æ±åæ°ï¼{}", jsonBody); |
| | | HttpResponse response = HttpRequest.post(csUrl) |
| | | .contentType("application/json") |
| | | .body(jsonBody) |
| | | .execute(); |
| | | // è·åååºç»æ |
| | | result = response.body(); |
| | | log.info("天åå忍éè¿åå¼ï¼{}", result); |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import com.amazonaws.auth.AWSCredentialsProvider; |
| | | import com.amazonaws.auth.AWSStaticCredentialsProvider; |
| | | import com.amazonaws.auth.BasicAWSCredentials; |
| | | import com.amazonaws.client.builder.AwsClientBuilder; |
| | | import com.amazonaws.services.s3.AmazonS3; |
| | | import com.amazonaws.services.s3.AmazonS3ClientBuilder; |
| | | import com.amazonaws.services.s3.model.*; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.core.io.DefaultResourceLoader; |
| | | import org.springframework.core.io.ResourceLoader; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.*; |
| | | import java.net.URL; |
| | | import java.time.Instant; |
| | | import java.util.Date; |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName SFtpUtil |
| | | * @date 2019/7/24 20:53 |
| | | */ |
| | | public class OSSUtil { |
| | | |
| | | private static String bucketName = null; |
| | | private static String endpoint = null; |
| | | private static String endpointNet = null; |
| | | private static String region = null; |
| | | private static String accessKey = null; |
| | | private static String secretKey = null; |
| | | |
| | | private static AmazonS3 amazonS3NetClient = null; |
| | | |
| | | public static Properties getYdOssProp() { |
| | | Properties props = new Properties(); |
| | | InputStream in = null; |
| | | try { |
| | | ResourceLoader resourceLoader = new DefaultResourceLoader(); |
| | | in = resourceLoader.getResource("ydOss.properties").getInputStream(); |
| | | props.load(in); |
| | | return props; |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return props; |
| | | } finally { |
| | | ResourceUtil.safeClose(in); |
| | | } |
| | | } |
| | | // private static AmazonS3 client = null; |
| | | |
| | | public static AmazonS3 ossInit() { |
| | | Properties props = getYdOssProp(); |
| | | bucketName = props.getProperty("ydOss.bucketName"); |
| | | endpoint = props.getProperty("ydOss.endpoint"); |
| | | region = props.getProperty("ydOss.region"); |
| | | accessKey = props.getProperty("ydOss.accessKey"); |
| | | secretKey = props.getProperty("ydOss.secretKey"); |
| | | // å建 AmazonS3 å®ä¾ã |
| | | AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(endpoint, region); |
| | | BasicAWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); |
| | | AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials); |
| | | AmazonS3 client = AmazonS3ClientBuilder.standard() |
| | | .withEndpointConfiguration(endpointConfiguration) |
| | | .withCredentials(credentialsProvider).build(); |
| | | return client; |
| | | } |
| | | |
| | | /** |
| | | * è·åå¤ç½osså°å |
| | | * |
| | | * @return |
| | | */ |
| | | public static AmazonS3 ossNetInit() { |
| | | if (amazonS3NetClient != null) { |
| | | return amazonS3NetClient; |
| | | } |
| | | Properties props = getYdOssProp(); |
| | | bucketName = props.getProperty("ydOss.bucketName"); |
| | | endpointNet = props.getProperty("ydOss.endpointNet"); |
| | | region = props.getProperty("ydOss.region"); |
| | | accessKey = props.getProperty("ydOss.accessKey"); |
| | | secretKey = props.getProperty("ydOss.secretKey"); |
| | | // å建 AmazonS3 å®ä¾ã |
| | | AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(endpointNet, region); |
| | | BasicAWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); |
| | | AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials); |
| | | amazonS3NetClient = AmazonS3ClientBuilder.standard() |
| | | .withEndpointConfiguration(endpointConfiguration) |
| | | .withCredentials(credentialsProvider).build(); |
| | | return amazonS3NetClient; |
| | | } |
| | | |
| | | // ä¸ä¼ æä»¶ã |
| | | public static void upload(AmazonS3 client, String fileName, InputStream inputStream, String targetPath) { |
| | | if (targetPath.startsWith("/")) { |
| | | targetPath = targetPath.substring(1); |
| | | } |
| | | String objectName = targetPath + "/" + fileName; |
| | | objectName = objectName.replace("//", "/"); |
| | | mkdirFolder(client, targetPath); |
| | | |
| | | ObjectMetadata objectMetadata = new ObjectMetadata(); |
| | | try { |
| | | // 设置对象ï¼Objectï¼å¤§å°ã |
| | | objectMetadata.setContentLength(inputStream.available()); |
| | | // 设置ä¸ä¼ å
容类åã |
| | | // objectMetadata.setContentType("text/plain"); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | // ä¸ä¼ åæ¶è®¾ç½®è®¿é®æéï¼ä¾å¦'Private'ç§ææéã |
| | | PutObjectRequest request = new PutObjectRequest(bucketName, objectName, inputStream, objectMetadata); |
| | | request.setCannedAcl(CannedAccessControlList.Private); |
| | | PutObjectResult putObjectResult = client.putObject(request); |
| | | // PutObjectResult putObjectResult = client.putObject(bucketName, objectName, inputStream, null); |
| | | if (putObjectResult == null) { |
| | | return; |
| | | } |
| | | try { |
| | | // return getShareUrl(objectName); |
| | | return; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | |
| | | public static void upload(AmazonS3 client, String sourceFilePath, String targetFilePath, boolean isDelSourceFile) { |
| | | String targetPath = targetFilePath.substring(0, targetFilePath.lastIndexOf("/")); |
| | | System.out.println("ä¸ä¼ æ¬å°è·¯å¾" + sourceFilePath+" ä¸ä¼ å° " + targetFilePath); |
| | | File file = new File(sourceFilePath); |
| | | FileInputStream fileInputStream = null; |
| | | try { |
| | | fileInputStream = new FileInputStream(file); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | return; |
| | | } |
| | | upload(client, file.getName(), fileInputStream, targetPath); |
| | | |
| | | if (isDelSourceFile) { |
| | | FileUtil.del(sourceFilePath); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | public static void upload(AmazonS3 client, String FileName, BufferedImage bufferedImage, String targetPath) |
| | | throws IOException { |
| | | if (FileName.lastIndexOf(".") <= -1) { |
| | | return; |
| | | } |
| | | String ext = FileName.substring(FileName.lastIndexOf(".") + 1); |
| | | String sourceFilePath = System.getProperty("user.dir") + ResourceUtil.createFileName(ext); |
| | | File tmpFile = FileUtil.touch(sourceFilePath); |
| | | ImageIO.write(bufferedImage, "png", tmpFile); |
| | | System.out.println("targetPath" + targetPath); |
| | | upload(client, sourceFilePath, targetPath + FileName, true); |
| | | } |
| | | |
| | | public static void download(AmazonS3 client, String sourceFilePath, String targetFilePath) { |
| | | if (StringUtils.isEmpty(sourceFilePath)){ |
| | | return; |
| | | } |
| | | if (sourceFilePath.startsWith("/")){ |
| | | sourceFilePath = sourceFilePath.substring(1); |
| | | } |
| | | // å°æä»¶ï¼Objectï¼ä¸è½½å°æä»¶ä¸ï¼å¹¶è¿åæä»¶ï¼Objectï¼çå
æ°æ®ã |
| | | GetObjectRequest request = new GetObjectRequest(bucketName, sourceFilePath); |
| | | ObjectMetadata meta = client.getObject(request, FileUtil.touch(targetFilePath)); |
| | | } |
| | | |
| | | /** |
| | | * å建æä»¶å¤¹ |
| | | * |
| | | * @return |
| | | */ |
| | | private static boolean mkdirFolder(AmazonS3 client, String directory) { |
| | | String folder = String.copyValueOf(directory.toCharArray()); |
| | | if (directory.startsWith("/")) { |
| | | folder = folder.substring(1); |
| | | } |
| | | if (!folder.endsWith("/")) { |
| | | folder = folder + "/"; |
| | | } |
| | | PutObjectResult putObjectResult = client.putObject(bucketName, folder, new ByteArrayInputStream(new byte[0]), null); |
| | | return putObjectResult != null; |
| | | } |
| | | |
| | | /** |
| | | * è·å对象çåäº«é¾æ¥ |
| | | * |
| | | * @param objectName |
| | | * @return |
| | | */ |
| | | public static String getShareUrl(String objectName) { |
| | | ossNetInit(); |
| | | // çæå¯é¢è§çå¤é¾ã |
| | | GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucketName, objectName); |
| | | |
| | | // è®¾ç½®è¿ææ¶é´ï¼å½å°è¾¾è¯¥æ¶é´ç¹æ¶ï¼URL å°±ä¼è¿æï¼å
¶ä»äººä¸åè½è®¿é®è¯¥å¯¹è±¡ï¼Objectï¼ã |
| | | Date expiration = new Date(); |
| | | // 设置 30 åéåè¿æã |
| | | long expTimeMillis = Instant.now().toEpochMilli(); |
| | | expTimeMillis += 1000 * 60 * 10; |
| | | expiration.setTime(expTimeMillis); |
| | | |
| | | request.setExpiration(expiration); |
| | | |
| | | // 设置è¿å头 |
| | | // 设置为 "inline" æ¶å¨æµè§å¨ä¸å±ç¤ºï¼è®¾ç½®ä¸º "attachment" æ¶ä»¥æä»¶å½¢å¼ä¸è½½ã |
| | | // æ¤å¤è®¾ç½®ä¸º "attachment;filename=\"filename.jpg\"" ï¼è¿å¯ä»¥è®©ä¸è½½çæä»¶ååéå½å为 "filename.jpg"ã |
| | | ResponseHeaderOverrides headerOverrides = new ResponseHeaderOverrides(); |
| | | headerOverrides.setContentDisposition("inline"); |
| | | request.setResponseHeaders(headerOverrides); |
| | | |
| | | URL url = amazonS3NetClient.generatePresignedUrl(request); |
| | | return url.toString(); |
| | | } |
| | | |
| | | public static void close(AmazonS3 client) { |
| | | if (client != null) { |
| | | client.shutdown(); |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // å建 AmazonS3 å®ä¾ã |
| | | endpoint = "https://eos-beijing-7.cmecloud.cn"; |
| | | region = "beijing7"; |
| | | accessKey = "EDVFWAO1INQKHGJ78MK0"; |
| | | secretKey = "rQSMQ02h6oQPMaZyXR85XxLVhZh92jrwXFRkX6FX"; |
| | | bucketName = "ecosphere"; |
| | | AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(endpoint, region); |
| | | BasicAWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); |
| | | AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials); |
| | | AmazonS3 amazonS3 = AmazonS3ClientBuilder.standard() |
| | | .withEndpointConfiguration(endpointConfiguration) |
| | | .withCredentials(credentialsProvider).build(); |
| | | OSSUtil.download(amazonS3, "/ecosphereBase/2024/1/3/5894af65566a44a791baa4246bd5910a.csv", "C:\\Users\\cy\\Desktop\\æ°å»ºæä»¶å¤¹\\b.csv"); |
| | | OSSUtil.close(amazonS3); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | /** |
| | | * @Description: |
| | | * @Company: TOO (psï¼å
¬å¸åç§°) |
| | | * @author: å |
| | | * @date: 2020/2/18 ä¸å12:49 |
| | | * @version: V1.0.0 |
| | | */ |
| | | public class PageUtils { |
| | | |
| | | public static String orderParser(String sortName, String sortOrder, String... prefix) { |
| | | |
| | | // Determine sortOrder equals 'asc' or 'desc' |
| | | if (!(sortOrder.equals("asc") || sortOrder.equals("desc"))) { |
| | | throw new IllegalArgumentException("Illegal sortOrder parameter"); |
| | | } |
| | | |
| | | // 夿ååç§°çåæ³æ§ï¼é²æ¢SQL注å
¥ãåªè½æ¯ãåæ¯ï¼æ°åï¼ä¸å线ã |
| | | if (!sortName.matches("[A-Za-z0-9_]+")) { |
| | | throw new IllegalArgumentException("Illegal sortName parameter"); |
| | | } |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | // åå¨åç¼ |
| | | if (prefix.length != 0) { |
| | | sb.append(prefix[0] + "."); |
| | | } |
| | | |
| | | sb.append(CommonUtil.camel2Underline("`" + sortName + "`") + " " + sortOrder); |
| | | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // System.out.println(orderParser("createTime", "asc")); |
| | | // System.out.println(orderParser("createTime", "asc", "abc")); |
| | | // System.out.println(orderParser("createTime,if((1=1),sleep(1),sleep(0))", "asc", "abc")); |
| | | System.out.println(orderParser("createTime", "asc,if((1=1),sleep(1),sleep(0))", "abc")); |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import org.dom4j.Document; |
| | | import org.dom4j.DocumentException; |
| | | import org.dom4j.DocumentHelper; |
| | | import org.dom4j.Element; |
| | | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.lang.reflect.Field; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.TreeMap; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName PayUtil |
| | | * @date 2019/7/30 21:51 |
| | | */ |
| | | public class PayUtil { |
| | | |
| | | public static Map getSignMap(Object f, String appKey) { |
| | | TreeMap<String, String> map = new TreeMap<String,String>(); |
| | | Field[] fields = f.getClass().getDeclaredFields(); |
| | | for (int i = 0, len = fields.length; i < len; i++) { |
| | | String varName = fields[i].getName(); |
| | | try { |
| | | boolean accessFlag = fields[i].isAccessible(); |
| | | //fields[i].setAccessible(true); |
| | | Object o = fields[i].get(f); |
| | | if (!"0".equals(String.valueOf(o)) && !"null".equals(String.valueOf(o)) && !String.valueOf(o).isEmpty()) { |
| | | map.put(varName, String.valueOf(o)); |
| | | } |
| | | System.out.println("ä¼ å
¥ç对象ä¸å
å«ä¸ä¸ªå¦ä¸çåéï¼" + varName + " = " + o); |
| | | //fields[i].setAccessible(accessFlag); |
| | | } catch (IllegalArgumentException ex) { |
| | | ex.printStackTrace(); |
| | | } catch (IllegalAccessException ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | } |
| | | map.remove("serialVersionUID"); |
| | | if (map.containsKey("validtime") && map.get("validtime").equals("null")) { |
| | | map.remove("validtime"); |
| | | } |
| | | map.put("sign", sign(map, appKey)); |
| | | return map; |
| | | } |
| | | |
| | | public static String sign(TreeMap<String, String> params, String appkey) { |
| | | if (params.containsKey("sign"))// ç¾åææç»è£
ä¸å
å«signåæ®µ |
| | | params.remove("sign"); |
| | | params.put("key", appkey); |
| | | StringBuilder sb = new StringBuilder(512); |
| | | for (Map.Entry<String, String> entry : params.entrySet()) { |
| | | if (entry.getValue() != null && entry.getValue().length() > 0) { |
| | | sb.append(entry.getKey()).append("=").append(entry.getValue()).append("&"); |
| | | } |
| | | } |
| | | if (sb.length() > 0) { |
| | | sb.deleteCharAt(sb.length() - 1); |
| | | } |
| | | String sign = SecureUtil.md5(sb.toString()); |
| | | params.remove("key"); |
| | | return sign; |
| | | } |
| | | public static Map<String,String> notify(HttpServletRequest request){ |
| | | InputStream inStream = null; |
| | | ByteArrayOutputStream outSteam=null; |
| | | Map<String, String> params =null; |
| | | try { |
| | | inStream = request.getInputStream(); |
| | | outSteam = new ByteArrayOutputStream(); |
| | | byte[] buffer = new byte[1024]; |
| | | int len = 0; |
| | | while ((len = inStream.read(buffer)) != -1) { |
| | | outSteam.write(buffer, 0, len); |
| | | } |
| | | String resultxml = new String(outSteam.toByteArray(), "utf-8"); |
| | | params = xmlStrToMap(resultxml); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | try { |
| | | outSteam.close(); |
| | | inStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return params; |
| | | } |
| | | public static String getNotifyParam(HttpServletRequest request) { |
| | | InputStream inStream = null; |
| | | ByteArrayOutputStream outSteam = null; |
| | | String resultStr = null; |
| | | try { |
| | | inStream = request.getInputStream(); |
| | | outSteam = new ByteArrayOutputStream(); |
| | | byte[] buffer = new byte[1024]; |
| | | int len = 0; |
| | | while ((len = inStream.read(buffer)) != -1) { |
| | | outSteam.write(buffer, 0, len); |
| | | } |
| | | resultStr = new String(outSteam.toByteArray(), "utf-8"); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outSteam.close(); |
| | | inStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return resultStr; |
| | | } |
| | | |
| | | /** |
| | | * Xmlå符串转æ¢ä¸ºMap |
| | | * |
| | | * @param xmlStr |
| | | * @return |
| | | */ |
| | | public static Map<String, String> xmlStrToMap(String xmlStr) { |
| | | Map<String, String> map = new HashMap<String, String>(); |
| | | Document doc; |
| | | try { |
| | | doc = DocumentHelper.parseText(xmlStr); |
| | | Element root = doc.getRootElement(); |
| | | List children = root.elements(); |
| | | if (children != null && children.size() > 0) { |
| | | for (int i = 0; i < children.size(); i++) { |
| | | Element child = (Element) children.get(i); |
| | | map.put(child.getName(), child.getTextTrim()); |
| | | } |
| | | } |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | // @formatter:off |
| | | import net.sourceforge.pinyin4j.PinyinHelper;import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; /** |
| | | * .-~~~~~~~~~-._ _.-~~~~~~~~~-. |
| | | * __.' @Author ~. .~ ä»£ç æ Bug `.__ |
| | | * .'// liu.q \./ (ç§ç±) \\`. |
| | | * .'// [916000612@qq.com] | 欲ç»ç¥å å¼åèªå®« \\`. |
| | | * .'// .-~"""""""~~~~-._ | _,-~~~~"""""""~-. \\`. |
| | | * .'//.-" 2019-04-10 `-. | .-' 17:35 "-.\\`. |
| | | * .'//______.============-.. \ | / ..-============.______\\`. |
| | | *.'______________________________\|/______________________________`. |
| | | * |
| | | * @Description : |
| | | */ |
| | | // @formatter:on |
| | | |
| | | public class Pinyin { |
| | | /** |
| | | * æµè¯mainæ¹æ³ |
| | | * |
| | | * @param args |
| | | */ |
| | | public static void main(String[] args) { |
| | | System.out.println(ToFirstChar("æ±å转æ¢ä¸ºæ¼é³").toUpperCase()); //转为é¦åæ¯å¤§å |
| | | System.out.println(ToPinyin("æ±å转æ¢ä¸ºæ¼é³")); |
| | | } |
| | | |
| | | /** |
| | | * è·åå符串æ¼é³ç第ä¸ä¸ªåæ¯ |
| | | * |
| | | * @param chinese |
| | | * @return |
| | | */ |
| | | public static String ToFirstChar(String chinese) { |
| | | String pinyinStr = ""; |
| | | char[] newChar = chinese.toCharArray(); //转为å个å符 |
| | | HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat(); |
| | | defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE); |
| | | defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE); |
| | | for (int i = 0; i < newChar.length; i++) { |
| | | if (newChar[i] > 128) { |
| | | try { |
| | | pinyinStr += PinyinHelper.toHanyuPinyinStringArray(newChar[i], defaultFormat)[0].charAt(0); |
| | | } catch (BadHanyuPinyinOutputFormatCombination e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } else { |
| | | pinyinStr += newChar[i]; |
| | | } |
| | | } |
| | | return pinyinStr; |
| | | } |
| | | |
| | | /** |
| | | * æ±å转为æ¼é³ |
| | | * |
| | | * @param chinese |
| | | * @return |
| | | */ |
| | | public static String ToPinyin(String chinese) { |
| | | String pinyinStr = ""; |
| | | char[] newChar = chinese.toCharArray(); |
| | | HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat(); |
| | | defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE); |
| | | defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE); |
| | | for (int i = 0; i < newChar.length; i++) { |
| | | if (newChar[i] > 128) { |
| | | try { |
| | | pinyinStr += PinyinHelper.toHanyuPinyinStringArray(newChar[i], defaultFormat)[0]; |
| | | } catch (BadHanyuPinyinOutputFormatCombination e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } else { |
| | | pinyinStr += newChar[i]; |
| | | } |
| | | } |
| | | return pinyinStr; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.core.io.DefaultResourceLoader; |
| | | import org.springframework.core.io.ResourceLoader; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | | * 读åé
ç½®æä»¶ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/6/13 15:31 |
| | | */ |
| | | @Slf4j |
| | | public class PropertyUtil { |
| | | |
| | | public static String getProp(String fileName, String k) { |
| | | Properties props = new Properties(); |
| | | InputStream in = null; |
| | | try { |
| | | ResourceLoader resourceLoader = new DefaultResourceLoader(); |
| | | in = resourceLoader.getResource(fileName).getInputStream(); |
| | | props.load(in); |
| | | return props.getProperty(k); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return ""; |
| | | } finally { |
| | | ResourceUtil.safeClose(in); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | |
| | | import java.io.Closeable; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.util.Calendar; |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName FileUtil |
| | | * @date 2019/4/15 13:06 |
| | | */ |
| | | public class ResourceUtil { |
| | | |
| | | public static void safeClose(Closeable closeable) { |
| | | if (closeable != null) { |
| | | try { |
| | | closeable.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // çæftp æä»¶ä¸ä¼ è·¯å¾ |
| | | public static String createFilePath() { |
| | | Calendar ca = Calendar.getInstance(); |
| | | String year = Convert.toStr(ca.get(Calendar.YEAR)); |
| | | String mon = Convert.toStr(ca.get(Calendar.MONTH) + 1); |
| | | String day = Convert.toStr(ca.get(Calendar.DAY_OF_MONTH)); |
| | | return "/" + year + "/" + mon + "/" + day + "/"; |
| | | } |
| | | |
| | | /** |
| | | * çææä»¶å |
| | | * @author ChenLong |
| | | * @date 2019/4/26 11:22 |
| | | * @version 1.0 |
| | | * @param ext æä»¶æ©å±å ï¼doc,xlsçï¼ |
| | | * @return : java.lang.String |
| | | */ |
| | | public static String createFileName(String ext) { |
| | | Calendar ca = Calendar.getInstance(); |
| | | String year = Convert.toStr(ca.get(Calendar.YEAR)); |
| | | String mon = Convert.toStr(ca.get(Calendar.MONTH) + 1); |
| | | String day = Convert.toStr(ca.get(Calendar.DAY_OF_MONTH)); |
| | | return "/" + year + "/" + mon + "/" + day + "/" + IdGenerator.getUUID() + "." + ext; |
| | | } |
| | | |
| | | /** |
| | | * çææä»¶å¤¹ |
| | | * @author ChenLong |
| | | * @date 2019/4/26 11:22 |
| | | * @version 1.0 |
| | | * @return : java.lang.String |
| | | */ |
| | | public static String createFileFolder() { |
| | | Calendar ca = Calendar.getInstance(); |
| | | String year = Convert.toStr(ca.get(Calendar.YEAR)); |
| | | String mon = Convert.toStr(ca.get(Calendar.MONTH) + 1); |
| | | String day = Convert.toStr(ca.get(Calendar.DAY_OF_MONTH)); |
| | | return "/" + year + "/" + mon + "/" + day + "/"; |
| | | } |
| | | |
| | | |
| | | // @formatter:off |
| | | /** çªçªä¿ä½ æ°¸æ bug |
| | | * _._ _..._ .-', _.._(`)) |
| | | * '-. ` ' /-._.-' ',/ |
| | | * ) \ '. |
| | | * / _ _ | \ |
| | | * | a a / | |
| | | * \ .-. ; |
| | | * '-('' ).-' ,' ; |
| | | * '-; | .' |
| | | * \ \ / |
| | | * | 7 .__ _.-\ \ |
| | | * | | | ``/ /` / |
| | | * /,_| | /,_/ / |
| | | * /,_/ '`-' |
| | | * |
| | | * @Author : liu.q [916000612@qq.com] |
| | | * @Date : 2019-04-24 15:32 |
| | | * @Description : è·åæä»¶çå®ç±»å |
| | | */ |
| | | // @formatter:on |
| | | // ç¼åæä»¶å¤´ä¿¡æ¯-æä»¶å¤´ä¿¡æ¯ |
| | | public static final HashMap<String, String> mFileTypes = new HashMap<String, String>(); |
| | | |
| | | static { |
| | | // images |
| | | mFileTypes.put("FFD8FF", "jpg"); |
| | | mFileTypes.put("89504E47", "png"); |
| | | mFileTypes.put("47494638", "gif"); |
| | | mFileTypes.put("49492A00", "tif"); |
| | | mFileTypes.put("424D", "bmp"); |
| | | // |
| | | mFileTypes.put("41433130", "dwg"); // CAD |
| | | mFileTypes.put("38425053", "psd"); |
| | | mFileTypes.put("7B5C727466", "rtf"); // æ¥è®°æ¬ |
| | | mFileTypes.put("3C3F786D6C", "xml"); |
| | | mFileTypes.put("68746D6C3E", "html"); |
| | | mFileTypes.put("44656C69766572792D646174653A", "eml"); // é®ä»¶ |
| | | mFileTypes.put("D0CF11E0", "doc"); |
| | | mFileTypes.put("D0CF11E0", "xls");//excel2003çæ¬æä»¶ |
| | | mFileTypes.put("5374616E64617264204A", "mdb"); |
| | | mFileTypes.put("252150532D41646F6265", "ps"); |
| | | mFileTypes.put("255044462D312E", "pdf"); |
| | | mFileTypes.put("504B0304", "docx"); |
| | | mFileTypes.put("504B0304", "xlsx");//excel2007以ä¸çæ¬æä»¶ |
| | | mFileTypes.put("52617221", "rar"); |
| | | mFileTypes.put("57415645", "wav"); |
| | | mFileTypes.put("41564920", "avi"); |
| | | mFileTypes.put("2E524D46", "rm"); |
| | | mFileTypes.put("000001BA", "mpg"); |
| | | mFileTypes.put("000001B3", "mpg"); |
| | | mFileTypes.put("6D6F6F76", "mov"); |
| | | mFileTypes.put("3026B2758E66CF11", "asf"); |
| | | mFileTypes.put("4D546864", "mid"); |
| | | mFileTypes.put("1F8B08", "gz"); |
| | | } |
| | | |
| | | public static String getFileType(FileInputStream is) { |
| | | String value = null; |
| | | try { |
| | | byte[] b = new byte[4]; |
| | | /* |
| | | * int read() 仿¤è¾å
¥æµä¸è¯»åä¸ä¸ªæ°æ®åèãint read(byte[] b) 仿¤è¾å
¥æµä¸å°æå¤ b.length |
| | | * 个åèçæ°æ®è¯»å
¥ä¸ä¸ª byte æ°ç»ä¸ã int read(byte[] b, int off, int len) |
| | | * 仿¤è¾å
¥æµä¸å°æå¤ len 个åèçæ°æ®è¯»å
¥ä¸ä¸ª byte æ°ç»ä¸ã |
| | | */ |
| | | is.read(b, 0, b.length); |
| | | |
| | | StringBuilder builder = new StringBuilder(); |
| | | if (b == null || b.length <= 0) { |
| | | return null; |
| | | } |
| | | String hv; |
| | | for (int i = 0; i < b.length; i++) { |
| | | // 以åå
è¿å¶ï¼åºæ° 16ï¼æ ç¬¦å·æ´æ°å½¢å¼è¿åä¸ä¸ªæ´æ°åæ°çå符串表示形å¼ï¼å¹¶è½¬æ¢ä¸ºå¤§å |
| | | hv = Integer.toHexString(b[i] & 0xFF).toUpperCase(); |
| | | if (hv.length() < 2) { |
| | | builder.append(0); |
| | | } |
| | | builder.append(hv); |
| | | } |
| | | value = builder.toString(); |
| | | } catch (Exception e) { |
| | | } finally { |
| | | if (null != is) { |
| | | try { |
| | | is.close(); |
| | | } catch (IOException e) { |
| | | } |
| | | } |
| | | } |
| | | return value; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import com.nuvole.common.domain.emnu.CommonResultEmnu; |
| | | import com.nuvole.common.domain.result.CommonResult; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.function.Supplier; |
| | | |
| | | /** |
| | | * åè½æè¿°ï¼CommonResultå·¥å
· |
| | | * @author xuekang |
| | | * @date 2024-04-16 10:59 |
| | | * @version 1.0 |
| | | * @param <E> dataç±»å |
| | | */ |
| | | public class ResultHandler<E> { |
| | | /** CommonResult */ |
| | | private final CommonResult<E> result; |
| | | /** 设置空å¤ç彿° */ |
| | | private Supplier<E> nullProcess; |
| | | /** 设置data空å¤ç彿° */ |
| | | private Supplier<E> dataNullProcess; |
| | | /** é误ç å¤ç彿° */ |
| | | private List<ErrorProcess<E>> errorProcessList; |
| | | |
| | | public ResultHandler(CommonResult<E> result) { |
| | | this.result = result; |
| | | } |
| | | |
| | | public ResultHandler(CommonResult<E> result, ResultHandler<E> resultHandler) { |
| | | this.result = result; |
| | | this.nullProcess = resultHandler.nullProcess; |
| | | this.dataNullProcess = resultHandler.dataNullProcess; |
| | | this.errorProcessList = resultHandler.errorProcessList; |
| | | } |
| | | |
| | | /** |
| | | * 设置空å¤ç彿° |
| | | * @param nullProcess 空å¤ç彿° |
| | | * @return ResultHandler |
| | | */ |
| | | public ResultHandler<E> setNullProcess(Supplier<E> nullProcess) { |
| | | this.nullProcess = nullProcess; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * 设置data空å¤ç彿° |
| | | * @param dataNullProcess data 空å¤ç彿° |
| | | * @return ResultHandler |
| | | */ |
| | | public ResultHandler<E> setDataNullProcess(Supplier<E> dataNullProcess) { |
| | | this.dataNullProcess = dataNullProcess; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * é误ç å¤ç彿° |
| | | * @param code é误ç |
| | | * @param errorProcessList 彿° |
| | | * @return ResultHandler |
| | | */ |
| | | public ResultHandler<E> appendError(Integer code, Supplier<E> errorProcessList) { |
| | | if (this.errorProcessList == null) { |
| | | this.errorProcessList = new LinkedList<>(); |
| | | } |
| | | this.errorProcessList.add(new ErrorProcess<>(code, errorProcessList)); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * CommonResultå·¥å
· |
| | | * @param result CommonResult |
| | | * @return ResultHandler |
| | | * @param <T> dataç±»å |
| | | */ |
| | | public static <T>ResultHandler<T> getInstance(CommonResult<T> result) { |
| | | return new ResultHandler<>(result); |
| | | } |
| | | |
| | | /** |
| | | * è·å |
| | | * @param result CommonResult |
| | | * @param resultHandler ResultHandler |
| | | * @return ResultHandler |
| | | * @param <T> dateç±»å |
| | | */ |
| | | public static <T>ResultHandler<T> getInstance(CommonResult<T> result, ResultHandler<T> resultHandler) { |
| | | return new ResultHandler<>(result, resultHandler); |
| | | } |
| | | |
| | | /** |
| | | * è·ådata |
| | | * @return data |
| | | */ |
| | | public E getDate() { |
| | | if (result == null) { |
| | | if (nullProcess != null) { |
| | | return nullProcess.get(); |
| | | } |
| | | return null; |
| | | } |
| | | Integer code = result.getCode(); |
| | | if (code.equals(CommonResultEmnu.OK.getCode())) { |
| | | E data = result.getData(); |
| | | if (data == null && dataNullProcess != null) { |
| | | return this.dataNullProcess.get(); |
| | | } |
| | | return data; |
| | | } |
| | | if (errorProcessList == null) { |
| | | return null; |
| | | } |
| | | for (ErrorProcess<E> process : this.errorProcessList) { |
| | | if (code.equals(process.getCode())) { |
| | | return process.getSupplier().get(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // Maps.EntryTransformer<BaseServiceClient, String, CommonResult<String>> getAllManagerByOrgCode = BaseServiceClient::getAllManagerByOrgCode; |
| | | // ClientUtil.getDate(BaseServiceClient.class, BaseServiceClient::getAllManagerByOrgCode, null); |
| | | ResultHandler.getInstance(new CommonResult<>()) |
| | | .setNullProcess(() -> { |
| | | throw new RuntimeException(""); |
| | | }) |
| | | .setDataNullProcess(() -> "") |
| | | .appendError(1, () -> "") |
| | | .getDate(); |
| | | } |
| | | |
| | | /** |
| | | * åè½æè¿°ï¼é误å¤çé»è¾ |
| | | * @author xuekang |
| | | * @date 2024-04-16 13:26 |
| | | * @version 1.0 |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | private static class ErrorProcess<E> { |
| | | /** é误ç */ |
| | | private Integer code; |
| | | /** å¤ç彿° */ |
| | | private Supplier<E> supplier; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import cn.hutool.extra.ssh.JschUtil; |
| | | import cn.hutool.extra.ssh.Sftp; |
| | | import org.springframework.core.io.DefaultResourceLoader; |
| | | import org.springframework.core.io.ResourceLoader; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName SFtpUtil |
| | | * @date 2019/7/24 20:53 |
| | | */ |
| | | public class SftpUtil { |
| | | |
| | | public static Properties getFtpProp() { |
| | | Properties props = new Properties(); |
| | | InputStream in = null; |
| | | try { |
| | | ResourceLoader resourceLoader = new DefaultResourceLoader(); |
| | | in = resourceLoader.getResource("sftp.properties").getInputStream(); |
| | | props.load(in); |
| | | return props; |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return props; |
| | | } finally { |
| | | ResourceUtil.safeClose(in); |
| | | } |
| | | } |
| | | |
| | | public static Sftp getSftp() { |
| | | Properties props = getFtpProp(); |
| | | String url = props.getProperty("ftp.url"); |
| | | String username = props.getProperty("ftp.username"); |
| | | String mixpd = props.getProperty("ftp.mixpd"); |
| | | return JschUtil.createSftp(url, 22, username, mixpd); |
| | | } |
| | | |
| | | public static void upload(Sftp sftp, String sourceFilePath, String targetFilePath, boolean isDelSourceFile) { |
| | | System.out.println("begin upload"); |
| | | String targetPath = targetFilePath.substring(0, targetFilePath.lastIndexOf("/")); |
| | | System.out.println("begin mkDirs"); |
| | | sftp.mkDirs(targetPath); |
| | | System.out.println("end mkDirs"); |
| | | sftp.put(sourceFilePath, targetFilePath); |
| | | System.out.println("upload finish"); |
| | | if (isDelSourceFile) { |
| | | FileUtil.del(sourceFilePath); |
| | | } |
| | | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // String url = "116.198.40.76"; |
| | | // String username = "mysftp"; |
| | | // String mixpd = "Bjjmy_2020"; |
| | | // Sftp sftp = JschUtil.createSftp(url, 22, username, mixpd); |
| | | // String sourceFilePath = "D:/tmp/2023/8/9/84cd0f68c1764e10a2f9307e7bd3333a/Excelæµè¯.zip"; |
| | | // String targetFilePath = "/ecosphereShopKf/goodsUploadMsgFile/2023/8/9/84cd0f68c1764e10a2f9307e7bd3333a/Excelæµè¯.zip"; |
| | | // upload(sftp, sourceFilePath, targetFilePath); |
| | | String paramsStr = "æè´¨#304ä¸éé¢|产å°#éå·"; |
| | | String[] paramsArr = paramsStr.split("\\|"); |
| | | for (String paramKV : paramsArr) { |
| | | String[] paramKVArr = paramKV.split("#"); |
| | | if (paramKVArr.length != 2) { |
| | | System.out.println(paramKVArr.length); |
| | | } |
| | | if (paramKVArr[0].length() > 20 || paramKVArr[1].length() > 300) { |
| | | System.out.println(paramKVArr[0].length()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | public static void upload(Sftp sftp, String FileName, InputStream inputStream, String targetPath) { |
| | | if (FileName.lastIndexOf(".") <= -1) { |
| | | return; |
| | | } |
| | | String ext = FileName.substring(FileName.lastIndexOf(".") + 1); |
| | | String sourceFilePath = System.getProperty("user.dir") + ResourceUtil.createFileName(ext); |
| | | System.out.println("begin "); |
| | | System.out.println("tmpFile.getPath(): "); |
| | | File tmpFile = FileUtil.touch(sourceFilePath); |
| | | FileUtil.writeFromStream(inputStream, tmpFile.getPath()); |
| | | System.out.println("tmpFile: " + tmpFile); |
| | | upload(sftp, sourceFilePath, targetPath + FileName, true); |
| | | } |
| | | |
| | | public static void upload(Sftp sftp, String FileName, BufferedImage bufferedImage, String targetPath) |
| | | throws IOException { |
| | | if (FileName.lastIndexOf(".") <= -1) { |
| | | return; |
| | | } |
| | | String ext = FileName.substring(FileName.lastIndexOf(".") + 1); |
| | | String sourceFilePath = System.getProperty("user.dir") + ResourceUtil.createFileName(ext); |
| | | File tmpFile = FileUtil.touch(sourceFilePath); |
| | | ImageIO.write(bufferedImage, "png", tmpFile); |
| | | System.out.println("targetPath" + targetPath); |
| | | upload(sftp, sourceFilePath, targetPath + FileName, true); |
| | | } |
| | | |
| | | public static void download(Sftp sftp, String sourceFilePath, String targetFilePath) { |
| | | sftp.download(sourceFilePath, FileUtil.touch(targetFilePath)); |
| | | } |
| | | |
| | | public static void del(Sftp sftp, String targetFilePath) { |
| | | sftp.delFile(targetFilePath); |
| | | } |
| | | |
| | | public static void close(Sftp sftp) { |
| | | if (sftp != null) { |
| | | sftp.close(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.http.HttpUtil; |
| | | import cn.hutool.json.JSON; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.mysql.fabric.xmlrpc.base.Params; |
| | | import com.nuvole.constants.ServiceConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description: å¤ç½æ¥å£å¯¼åºå·¥å
· |
| | | * @Company: TOO (psï¼å
¬å¸åç§°) |
| | | * @author: å |
| | | * @date: 2019/11/22 ä¸å10:20 |
| | | * @version: V1.0.0 |
| | | */ |
| | | @Slf4j |
| | | public class TableExportCallUtil { |
| | | |
| | | |
| | | public static String getResult(String url, String sign, Long time, HashMap params) { |
| | | String path = ServiceConstants.SERVICE_EXPORT_TABLE_URL; |
| | | Map<String,Object> param = new HashMap<>(4); |
| | | param.put("url",url); |
| | | param.put("sign",sign); |
| | | param.put("time",time); |
| | | |
| | | param.put("params", new JSONObject(params)); |
| | | return HttpUtil.get(path,param); |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import cn.hutool.http.HttpUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.Map; |
| | | import java.util.TreeMap; |
| | | |
| | | /** |
| | | * è
¾è®¯å°å¾å·¥å
·ç±» |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/6/28 14:57 |
| | | */ |
| | | @Slf4j |
| | | public class TencentMapUtil { |
| | | |
| | | //è
¾è®¯å°å¾ç§é¥ |
| | | public static String k = "5DUBZ-M5AKR-MZQWH-WPFLA-N4MNT-KBF44"; |
| | | |
| | | //è
¾è®¯å°å¾ä½ç½®å±ç¤ºå°å |
| | | public static String mapUrl = "https://apis.map.qq.com/tools/poimarker"; |
| | | |
| | | //éå°åè§£æå°å |
| | | public static String locationUrl = "https://apis.map.qq.com/ws/geocoder/v1"; |
| | | |
| | | //ç¾åæ ¡éªsk |
| | | public static String SK = "jCtZhEfr0u6FR8DrBqOI3XnUlZ7NTN0"; |
| | | |
| | | |
| | | /** |
| | | * ç»çº¬åº¦è§£æå°å |
| | | * |
| | | * @param lat 纬度 |
| | | * @param lng 纬度 |
| | | * @Author: lc |
| | | * @Date: 2019/6/28 15:13 |
| | | */ |
| | | public static String getLocation(String lat, String lng) { |
| | | //ç»è£
æ°æ® |
| | | Map<String, Object> r = new HashMap<>(); |
| | | String url = "/ws/geocoder/v1?"; |
| | | r.put("location", lat + "," + lng); |
| | | r.put("key", k); |
| | | String sign = SecureUtil.md5(url + coverMap2String(r) + SK); |
| | | r.put("sig", sign); |
| | | String result = HttpUtil.get(locationUrl, r); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * ç±æåå°åå°ç»çº¬åº¦ç转æ¢è½åï¼å¹¶åæ¶æä¾ç»æåççå¸åºå°åä¿¡æ¯ã |
| | | * @param address |
| | | * @return |
| | | */ |
| | | public static String geocoder(String address) { |
| | | //ç»è£
æ°æ® |
| | | Map<String, Object> r = new HashMap<>(); |
| | | String url = "/ws/geocoder/v1?"; |
| | | r.put("address", address); |
| | | r.put("key", k); |
| | | String sign = SecureUtil.md5(url + coverMap2String(r) + SK); |
| | | r.put("sig", sign); |
| | | String result = HttpUtil.get(locationUrl, r); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * å°åæ°ækeyè¿è¡åå
¸ååºæåkey1=value1 |
| | | */ |
| | | public static String coverMap2String(Map<String, Object> data) { |
| | | TreeMap<String, Object> tree = new TreeMap<>(); |
| | | Iterator<Map.Entry<String, Object>> it = data.entrySet().iterator(); |
| | | while (it.hasNext()) { |
| | | Map.Entry<String, Object> en = it.next(); |
| | | tree.put(en.getKey(), en.getValue()); |
| | | } |
| | | it = tree.entrySet().iterator(); |
| | | StringBuffer sf = new StringBuffer(512); |
| | | while (it.hasNext()) { |
| | | Map.Entry<String, Object> en = it.next(); |
| | | sf.append(en.getKey() + "=" + en.getValue() |
| | | + "&"); |
| | | } |
| | | return sf.substring(0, sf.length() - 1); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println("is result:" + getLocation("34.799145", "113.649445")); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName TreeUtil |
| | | * @Description treeå·¥å
·ç±» |
| | | * @date 2019/4/23 15:50 |
| | | */ |
| | | public class TreeUtil { |
| | | |
| | | public static <T> List<Map> convert2Tree(List<T> list) { |
| | | return convert2Tree(list, null, "children"); |
| | | } |
| | | |
| | | public static <T> List<Map> convert2Tree(List<T> list, String childrenKey) { |
| | | return convert2Tree(list, null, childrenKey); |
| | | } |
| | | |
| | | public static <T> List<Map> convert2Tree(List<T> list, Map<String, String> mapping) { |
| | | return convert2Tree(list, mapping, "children"); |
| | | } |
| | | |
| | | /** |
| | | * 对象æ°ç»æ ¼å¼å为treeç»æï¼å¯¹è±¡ä¸å¿
é¡»å
·æ{id,pid}屿§ |
| | | * |
| | | * @param list |
| | | * @param mapping {"label":"name"} å°æ°æ®åºæ¥è¯¢listä¸çlabel屿§æ¿æ¢ä¸ºname屿§ |
| | | * @param childrenKey èªèç¹keyåç§° é»è®¤ä¸ºchildren |
| | | * @return : java.util.List<java.util.Map> |
| | | * @author ChenLong |
| | | * @date 2019/4/23 18:44 |
| | | * @version 1.0 |
| | | */ |
| | | public static <T> List<Map> convert2Tree(List<T> list, Map<String, String> mapping, String childrenKey) { |
| | | if (list == null || list.size() <= 0) { |
| | | return new ArrayList<Map>(); |
| | | } |
| | | |
| | | Map root = new HashMap(); |
| | | root.put(childrenKey, new ArrayList<Map>()); |
| | | |
| | | LinkedHashMap<String, Map> dataSet = new LinkedHashMap<String, Map>(); |
| | | for (T obj : list) { |
| | | Map map; |
| | | if (obj instanceof Map) { |
| | | map = new HashMap(){{ |
| | | putAll((Map) obj); |
| | | }}; |
| | | } else { |
| | | map = TypeConvertUtil.obj2Map(obj); |
| | | } |
| | | //ç»æè½¬æ¢ |
| | | if (mapping != null) { |
| | | for (String key : mapping.keySet()) { |
| | | if (map.containsKey(key)) { |
| | | map.put(mapping.get(key), map.get(key)); |
| | | //ç§»é¤åæå±æ§ |
| | | map.remove(key); |
| | | } |
| | | } |
| | | } |
| | | dataSet.put(Convert.toStr(map.get("id")), map); |
| | | } |
| | | |
| | | //ç»è£
æ |
| | | for (String key : dataSet.keySet()) { |
| | | Object parentId = ((dataSet.get(key)).get("pid")); |
| | | if(parentId == null){ |
| | | /* å¢å ä¸ç§å¤§å°åç±»å |
| | | * @author dqh |
| | | * @date 2024-04-12 |
| | | **/ |
| | | parentId = ((dataSet.get(key)).get("PId")); |
| | | } |
| | | String pid = Convert.toStr(parentId); |
| | | if (pid.equals("0")) { |
| | | ((List<Map>) root.get(childrenKey)).add((Map) dataSet.get(key)); |
| | | } else { |
| | | Map pNode = (Map) dataSet.get(pid); |
| | | if (pNode != null) { |
| | | if (pNode.get(childrenKey) == null) { |
| | | List children = new ArrayList<Map>(); |
| | | pNode.put(childrenKey, children); |
| | | } |
| | | ((List<Map>) pNode.get(childrenKey)).add((Map) dataSet.get(key)); |
| | | } else { |
| | | ((List<Map>) root.get(childrenKey)).add((Map) dataSet.get(key)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (root.get(childrenKey) != null) { |
| | | return (List<Map>) root.get(childrenKey); |
| | | } else { |
| | | return new ArrayList<Map>(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import org.springframework.cglib.beans.BeanMap; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName TypeConvertUtil |
| | | * @Description ç±»å转æ¢å·¥å
·ç±» |
| | | * @date 2019/4/23 15:54 |
| | | */ |
| | | public class TypeConvertUtil { |
| | | |
| | | /** |
| | | * object转map |
| | | * @author ChenLong |
| | | * @date 2019/4/23 18:35 |
| | | * @version 1.0 |
| | | * @param obj é转æ¢å¯¹è±¡ |
| | | * @return : java.util.Map |
| | | */ |
| | | public static Map obj2Map(Object obj) { |
| | | HashMap map = new HashMap(); |
| | | if (obj != null) { |
| | | BeanMap beanMap = BeanMap.create(obj); |
| | | for (Object key : beanMap.keySet()) { |
| | | map.put(key + "", beanMap.get(key)); |
| | | } |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | // @formatter:off |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.*; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.security.SecureRandom; |
| | | import java.util.Base64; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * .-~~~~~~~~~-._ _.-~~~~~~~~~-. |
| | | * __.' @Author ~. .~ ä»£ç æ Bug `.__ |
| | | * .'// liu.q \./ (ç§ç±) \\`. |
| | | * .'// [916000612@qq.com] | 欲ç»ç¥å å¼åèªå®« \\`. |
| | | * .'// .-~"""""""~~~~-._ | _,-~~~~"""""""~-. \\`. |
| | | * .'//.-" 2019-06-24 `-. | .-' 15:43 "-.\\`. |
| | | * .'//______.============-.. \ | / ..-============.______\\`. |
| | | * .'______________________________\|/______________________________`. |
| | | * |
| | | * @Description : |
| | | */ |
| | | // @formatter:on |
| | | |
| | | public class VerifyImgUtil { |
| | | private static int T_WIDTH = 320; //æºæä»¶å®½åº¦ |
| | | private static int T_HEIGHT = 180; //æºæä»¶é«åº¦ |
| | | |
| | | |
| | | /* |
| | | * @Author : liu.q [916000612@qq.com] |
| | | * @Date : 2019-06-24 15:46 |
| | | * @Description : éæºçææ å¾åæ |
| | | */ |
| | | public static Map<String, Integer> generateCutoutCoordinates(int w, int h) { |
| | | Map<String, Integer> result = new HashMap(); |
| | | int x = new SecureRandom().nextInt(T_WIDTH - w); |
| | | int y = new SecureRandom().nextInt(T_HEIGHT - h); |
| | | while (x < w + 10) { |
| | | x = new SecureRandom().nextInt(275); |
| | | } |
| | | result.put("x", x); |
| | | result.put("y", y); |
| | | return result; |
| | | } |
| | | |
| | | /* |
| | | * @Author : liu.q [916000612@qq.com] |
| | | * @Date : 2019-06-24 16:22 |
| | | * @Description :çææ»å |
| | | */ |
| | | public static Map<String, BufferedImage> initSlidingBlock(BufferedImage sourceImg, int[][] templateImgData, int x, int y, int w, int h) throws Exception { |
| | | // æ¯æalphaééçrgbå¾å |
| | | BufferedImage newTemplateImg = new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR); |
| | | |
| | | for (int i = 0; i < templateImgData.length; i++) { |
| | | for (int j = 0; j < templateImgData[0].length; j++) { |
| | | int rgb = templateImgData[i][j]; |
| | | if (rgb == 1) { |
| | | int rgb_ori = sourceImg.getRGB(x + i, y + j); |
| | | int r = (0xff & rgb_ori); |
| | | int g = (0xff & (rgb_ori >> 8)); |
| | | int b = (0xff & (rgb_ori >> 16)); |
| | | rgb_ori = r + (g << 8) + (b << 16) + (255 << 24); |
| | | newTemplateImg.setRGB(i, j, rgb_ori); |
| | | |
| | | //å建é®ç½©å± |
| | | BufferedImage cover = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB); |
| | | Graphics2D coverG2 = (Graphics2D) cover.getGraphics(); |
| | | coverG2.setColor(Color.BLACK); |
| | | coverG2.fillRect(0, 0, 10, 10); |
| | | coverG2.dispose(); |
| | | Graphics2D bgG2 = (Graphics2D) sourceImg.getGraphics(); |
| | | //å¼å¯éæåº¦ |
| | | bgG2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.5f)); |
| | | //æç» |
| | | bgG2.drawImage(cover, i + x, y + j, 1, 1, null); |
| | | //ç»æéæåº¦ |
| | | bgG2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); |
| | | bgG2.dispose(); |
| | | } |
| | | if (rgb == 0) { |
| | | //ä¸ç¨æç |
| | | } |
| | | if (rgb == 2) { |
| | | //ç§è¾¹ |
| | | newTemplateImg.setRGB(i, j, 16777215); |
| | | sourceImg.setRGB(x + i, y + j, 16777215); |
| | | } |
| | | } |
| | | } |
| | | Map<String, BufferedImage> result = new HashMap<>(); |
| | | result.put("newTemplateImg", newTemplateImg); |
| | | result.put("newSourceImg", sourceImg); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /* |
| | | * @Author : liu.q [916000612@qq.com] |
| | | * @Date : 2019-06-21 15:37 |
| | | * @Description : è·åbase64 |
| | | */ |
| | | public static String getBase64(BufferedImage bi) { |
| | | ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
| | | String res = ""; |
| | | try { |
| | | ImageIO.write(bi, "png", outputStream); |
| | | res = Base64.getEncoder().encodeToString(outputStream.toByteArray()); |
| | | res = "data:image/png;base64," + res; |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /* |
| | | * @Author : liu.q [916000612@qq.com] |
| | | * @Date : 2019-06-24 17:22 |
| | | * @Description : çææ å¾å¾å½¢ç©éµ |
| | | */ |
| | | public static int[][] getTemplateData(BufferedImage bi) { |
| | | int[][] data = new int[bi.getWidth()][bi.getHeight()]; |
| | | for (int i = 0; i < bi.getWidth(); i++) { |
| | | for (int j = 0; j < bi.getHeight(); j++) { |
| | | int rgb = bi.getRGB(i, j); |
| | | int leftRgb = -1, rightRgb = -1, upRgb = -1, downRgb = -1; |
| | | if (j > 0) |
| | | leftRgb = bi.getRGB(i, j - 1); |
| | | if (j < bi.getHeight() - 1) |
| | | rightRgb = bi.getRGB(i, j + 1); |
| | | if (i > 0) |
| | | upRgb = bi.getRGB(i - 1, j); |
| | | if (i < bi.getWidth() - 1) |
| | | downRgb = bi.getRGB(i + 1, j); |
| | | if (rgb == -1 && (i == 0 || i == bi.getWidth() - 1 || j == 0 || j == bi.getHeight() - 1)) { |
| | | data[i][j] = 2; //è¾¹ |
| | | } else if (rgb == -1 && (leftRgb != -1 || rightRgb != -1 || upRgb != -1 || downRgb != -1)) { |
| | | data[i][j] = 2;//è¾¹ |
| | | } else if (rgb == -1) { |
| | | data[i][j] = 1;//å
容åºå |
| | | } else { |
| | | data[i][j] = 0;//éæåºå |
| | | } |
| | | } |
| | | } |
| | | return data; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.io.file.FileWriter; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | public class WriterUtil { |
| | | |
| | | private static String path = "F:\\data\\"; |
| | | |
| | | |
| | | /* @Test |
| | | public void test() { |
| | | login("nodata", 1122L, "ç·", "172.16.60.222", "https://www.baidu.com"); |
| | | member(11222L, "nodata", Convert.toShort(1), "12121"); |
| | | }*/ |
| | | |
| | | /** |
| | | * åå
¥ååç»å½æ°æ® |
| | | * |
| | | * @param code æºå¨ç |
| | | * @param memberId ä¼åid |
| | | * @param sex æ§å« |
| | | * @param ip ipå°å |
| | | * @param address ç»å½å°å |
| | | * @Author: lc |
| | | * @Date: 2019/10/23 15:13 |
| | | */ |
| | | public static void login(String code, Long memberId, String sex, String ip, String address) { |
| | | // String day = DateUtil.today(); |
| | | // FileWriter writer = new FileWriter(path + "login\\" + day + ".txt"); |
| | | // String time = CodeUtil.getTimeCode(); |
| | | // writer.append(time + " " + code + " " + memberId + " " + sex + " " + ip + " " + address + "\n"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åå
¥ä¼å注å/ä¿®æ¹æ°æ® |
| | | * |
| | | * @param memberId ä¼åid |
| | | * @param area å°åº |
| | | * @param type æä½ç±»åã1.æ°å¢ 2.å®åã |
| | | * @param birthday çæ¥ |
| | | * @Author: lc |
| | | * @Date: 2019/10/23 15:13 |
| | | */ |
| | | public static void member(Long memberId, String area, Short type, String birthday) { |
| | | // String day = DateUtil.today(); |
| | | // FileWriter writer = new FileWriter(path + "member\\" + day + ".txt"); |
| | | // String time = CodeUtil.getTimeCode(); |
| | | // writer.append(time + " " + memberId + " " + area + " " + type + " " + birthday + "\n"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åå
¥è®¢åæ°æ® |
| | | * |
| | | * @param orderId 订åid |
| | | * @param orderType 订åç±»åã1.åå 2.åæ·ã |
| | | * @param payMoney æ¯ä»éé¢ |
| | | * @param memberId ä¼åid |
| | | * @param orderState 订åç¶æã1.å¾
æ¯ä» 2.已宿 3.已鿬¾ 4.æ¯ä»å¤±è´¥ã |
| | | * @param payType æ¯ä»æ¸ éã1.æ¯ä»å® 2.微信 3.äºéªä»ã |
| | | * @param payWay æ¯ä»æ¹å¼ã1.æ«ç 2.çº¿ä¸ ã |
| | | * @param useScore 使ç¨ç§¯å |
| | | * @param couponId 使ç¨ä¼æ å¸id |
| | | * @param couponMoney 伿 å¸éé¢ |
| | | * @param areaId åæ·æå±åºåid |
| | | * @Author: lc |
| | | * @Date: 2019/10/23 15:13 |
| | | */ |
| | | public static void order(Long orderId, String orderType, Long payMoney, Long memberId, Short orderState, Short payType, Short payWay, Long useScore, Long couponId, Long couponMoney, String areaId) { |
| | | // String day = DateUtil.today(); |
| | | // FileWriter writer = new FileWriter(path + "order\\" + day + ".txt"); |
| | | // String time = CodeUtil.getTimeCode(); |
| | | // writer.append(time + " " + orderId + " " + orderType + " " + payMoney + " " + memberId + " " + orderState + " " + |
| | | // payType + " " + payWay + " " + useScore + " " + couponId + " " + couponMoney + " " + areaId + "\n"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åå
¥ååæ°æ® |
| | | * |
| | | * @param goodsSpuId ååSpuId |
| | | * @param goodsSkuId ååSkuId |
| | | * @param money éé¢ |
| | | * @param state ç¶æã1.æ°å¢ 2.䏿¶ 3.䏿¶ 4.åºå®ã |
| | | * @Author: lc |
| | | * @Date: 2019/10/23 15:13 |
| | | */ |
| | | public static void goods(Long goodsSpuId, Long goodsSkuId, Long money, Short state) { |
| | | // String day = DateUtil.today(); |
| | | // FileWriter writer = new FileWriter(path + "goods\\" + day + ".txt"); |
| | | // String time = CodeUtil.getTimeCode(); |
| | | // writer.append(time + " " + goodsSpuId + " " + goodsSkuId + " " + money + " " + state + "\n"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åå
¥ååéå® |
| | | * |
| | | * @param goodsSpuId ååSpuIdï¼è§æ ¼ï¼ |
| | | * @param goodsSkuId ååSkuIdï¼å±æ§ï¼ |
| | | * @Author: lc |
| | | * @Date: 2019/10/23 15:13 |
| | | */ |
| | | public static void goodsSell(Long goodsSpuId, Long goodsSkuId) { |
| | | // String day = DateUtil.today(); |
| | | // FileWriter writer = new FileWriter(path + "goodsSell\\" + day + ".txt"); |
| | | // String time = CodeUtil.getTimeCode(); |
| | | // writer.append(time + " " + goodsSpuId + " " + goodsSkuId + "\n"); |
| | | } |
| | | |
| | | /** |
| | | * æ§è¡æå¨åè°ç订åid |
| | | * @param builder |
| | | * @throws IOException |
| | | */ |
| | | public static void callBackGoodsInfo(StringBuilder builder) throws IOException { |
| | | String fileName = new SimpleDateFormat("yyyyMMdd").format(new Date()) + ".csv"; |
| | | String day = DateUtil.today(); |
| | | FileWriter writer = new FileWriter(path + "åè°è®¢å" +fileName ); |
| | | writer.append(String.valueOf(builder)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.nuvole.common.domain.wx.PushMsg; |
| | | import com.nuvole.constants.ServiceConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.httpclient.HttpClient; |
| | | import org.apache.commons.httpclient.HttpStatus; |
| | | import org.apache.commons.httpclient.methods.PostMethod; |
| | | import org.apache.commons.httpclient.params.HttpMethodParams; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description: å¤ç½æ¥å£è¯·æ±å·¥å
·ç±»ï¼å¾®ä¿¡ï¼ |
| | | * @Author: liujun |
| | | * @Date: 2019-07-25 11:59 |
| | | **/ |
| | | @Slf4j |
| | | public class WxCallUtil { |
| | | |
| | | /** |
| | | * è·å临æ¶ç»å½åè¯code |
| | | * |
| | | * @param jsCode |
| | | * @return |
| | | */ |
| | | public static String getOpenidSessionKey(String jsCode) { |
| | | String url = ServiceConstants.SERVICE_JSCODE2SESSION_URL; |
| | | Map<String, Object> paramMap = new HashMap<>(1); |
| | | paramMap.put("jsCode", jsCode); |
| | | return HttpUtil.get(url, paramMap); |
| | | } |
| | | |
| | | /** |
| | | * è·åAccessToken |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getAccessToken() { |
| | | String url = ServiceConstants.SERVICE_TOKEN_URL; |
| | | String result = HttpUtil.get(url); |
| | | log.info("getAccessToken è¿åå¼ï¼ {}", result); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * è·å jsapi_ticket |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getJsapTicket(String accessToken) { |
| | | String url = ServiceConstants.SERVICE_JSAPITICKET_URL; |
| | | Map<String, Object> paramMap = new HashMap<>(1); |
| | | paramMap.put("accessToken", accessToken); |
| | | return HttpUtil.get(url, paramMap); |
| | | } |
| | | |
| | | /** |
| | | * 微信å
¬ä¼å·è·åaccess_token |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static String getWechatAccessToken(String code) { |
| | | String url = ServiceConstants.SERVICE_ACCESS_TOKEN_URL; |
| | | Map<String, Object> paramMap = new HashMap<>(1); |
| | | paramMap.put("code", code); |
| | | return HttpUtil.get(url, paramMap); |
| | | } |
| | | |
| | | /** |
| | | * 微信å
¬ä¼å·è·åç¨æ·ä¿¡æ¯ |
| | | * |
| | | * @param accessToken |
| | | * @param openId |
| | | * @return |
| | | */ |
| | | public static String getWechatUserInfo(String accessToken, String openId) { |
| | | String url = ServiceConstants.SERVICE_USERINFO_URL; |
| | | Map<String, Object> paramMap = new HashMap<>(2); |
| | | paramMap.put("accessToken", accessToken); |
| | | paramMap.put("openId", openId); |
| | | return HttpUtil.get(url, paramMap); |
| | | } |
| | | |
| | | /** |
| | | * è·åå°ç¨åºç ï¼åææ¯å·²åå¸ï¼ |
| | | * |
| | | * @param accessToken |
| | | * @param scene |
| | | * @param width |
| | | * @param page |
| | | * @return |
| | | */ |
| | | public static byte[] getQRcode(String accessToken, String scene, int width, String page) { |
| | | byte[] result = null; |
| | | String url = ServiceConstants.SERVICE_WXACODEUNLIMIT_URL; |
| | | if (false) { |
| | | HttpClient client = new HttpClient(); |
| | | PostMethod method = new PostMethod(url); |
| | | HttpMethodParams paramMap = new HttpMethodParams(); |
| | | paramMap.setParameter("accessToken", accessToken); |
| | | paramMap.setParameter("scene", scene); |
| | | paramMap.setParameter("width", width); |
| | | paramMap.setParameter("page", page); |
| | | method.setParams(paramMap); |
| | | try { |
| | | int statusCode = client.executeMethod(method); |
| | | if (statusCode != HttpStatus.SC_OK) { |
| | | log.info("Method failed: " + method.getStatusLine()); |
| | | } else { |
| | | // è¿åååºæ¶æ¯ |
| | | result = method.getResponseBodyAsString().getBytes(method.getResponseCharSet()); |
| | | } |
| | | method.releaseConnection(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } else { |
| | | RestTemplate rest = new RestTemplate(); |
| | | try { |
| | | Map<String, Object> param = new HashMap<>(); |
| | | url = url + "?accessToken=" + accessToken + "&scene=" + scene + "&width=" + width + "&page=" + page; |
| | | MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); |
| | | HttpEntity requestEntity = new HttpEntity(param, headers); |
| | | ResponseEntity<byte[]> entity = rest.exchange(url, HttpMethod.POST, requestEntity, byte[].class, |
| | | new Object[0]); |
| | | result = entity.getBody(); |
| | | /*BASE64Encoder encoder = new BASE64Encoder(); |
| | | String imageStr = encoder.encode(result); |
| | | imageStr = HtmlUtils.htmlEscape(imageStr); |
| | | BASE64Decoder decoder = new BASE64Decoder(); |
| | | result = decoder.decodeBuffer(imageStr);*/ |
| | | } catch (Exception e) { |
| | | log.error("è°ç¨å°ç¨åºçæå¾®ä¿¡æ°¸ä¹
å°ç¨åºç URLæ¥å£å¼å¸¸", e); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 微信æ¨éæ¶æ¯ |
| | | * |
| | | * @param openId |
| | | * @param formId |
| | | * @param templateId |
| | | * @param page |
| | | * @param items |
| | | */ |
| | | public static void push(String openId, String formId, String templateId, String page, List<String> items) { |
| | | String url = ServiceConstants.SERVICE_TEMPLATE_SEND_URL; |
| | | Map<String, Object> paramMap = new HashMap<>(5); |
| | | paramMap.put("openId", openId); |
| | | paramMap.put("formId", formId); |
| | | paramMap.put("templateId", templateId); |
| | | paramMap.put("page", page); |
| | | paramMap.put("items", CommonUtil.listToString(items)); |
| | | HttpUtil.get(url, paramMap); |
| | | } |
| | | |
| | | |
| | | /* * |
| | | * 微信å°ç¨åºè®¢é
æ¶æ¯æ¨é |
| | | * |
| | | * @author lc |
| | | * @date 2020/1/2 14:28 |
| | | */ |
| | | public static void pushSend(PushMsg pushMsg, String accessToken) { |
| | | String url = ServiceConstants.SERVICE_SUBSCRIBER_SEND_URL; |
| | | Map<String, Object> paramMap = BeanUtil.beanToMap(pushMsg); |
| | | paramMap.put("accessToken", accessToken); |
| | | HttpUtil.get(url, paramMap); |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.binarywang.wx.miniapp.api.WxMaService; |
| | | import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; |
| | | import cn.binarywang.wx.miniapp.bean.WxMaTemplateData; |
| | | import cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage; |
| | | import cn.binarywang.wx.miniapp.config.WxMaInMemoryConfig; |
| | | import cn.hutool.http.HttpUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.nuvole.common.domain.dto.AppDTO; |
| | | import com.nuvole.common.domain.wx.PushMsg; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.chanjar.weixin.common.error.WxErrorException; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.client.RestTemplate; |
| | | import org.springframework.web.util.HtmlUtils; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * å°ç¨åºå·¥å
·ç±» |
| | | * |
| | | * @author liujun |
| | | * @Date 2019/5/27 16:40 |
| | | */ |
| | | @Slf4j |
| | | public class WxUtil { |
| | | |
| | | /** |
| | | * è·å临æ¶ç»å½åè¯code |
| | | * |
| | | * @param appid AppID(å°ç¨åºID) |
| | | * @param secret AppSecret(å°ç¨åºå¯é¥) |
| | | * @param jsCode ç»å½æ¶è·åçCode |
| | | * @return |
| | | */ |
| | | public static String getOpenidSessionKey(String appid, String secret, String jsCode) { |
| | | String url = "https://api.weixin.qq.com/sns/jscode2session"; |
| | | Map<String, Object> paramMap = new HashMap<>(3); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("secret", secret); |
| | | paramMap.put("js_code", jsCode); |
| | | paramMap.put("grant_type", "authorization_code"); |
| | | return HttpUtil.get(url, paramMap); |
| | | } |
| | | |
| | | /** |
| | | * è·åAccessToken |
| | | * |
| | | * @param appid AppID(å°ç¨åºID) |
| | | * @param secret AppSecret(å°ç¨åºå¯é¥) |
| | | * @return |
| | | */ |
| | | public static String getAccessToken(String appid, String secret) { |
| | | String url = "https://api.weixin.qq.com/cgi-bin/token"; |
| | | Map<String, Object> paramMap = new HashMap<>(3); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("secret", secret); |
| | | paramMap.put("grant_type", "client_credential"); |
| | | String s = HttpUtil.get(url, paramMap); |
| | | log.info("è·åAccessToken åæ°= ãappid:{},secret:{}", appid, secret); |
| | | log.info("è·åAccessToken = ã{}", s); |
| | | return s; |
| | | } |
| | | |
| | | /** |
| | | * è·åAccessToken |
| | | * |
| | | * @param accessToken getAccessTokenæ¹æ³è·åçaccess_token |
| | | * @return |
| | | */ |
| | | public static String getJsapTicket(String accessToken) { |
| | | String url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket"; |
| | | Map<String, Object> paramMap = new HashMap<>(3); |
| | | paramMap.put("type", "jsapi"); |
| | | paramMap.put("access_token", accessToken); |
| | | return HttpUtil.get(url, paramMap); |
| | | } |
| | | |
| | | /** |
| | | * Createed by PKZ Date 2019/6/18 17:11 Descriptionï¼å¾®ä¿¡å
¬ä¼å·è·åaccess_token |
| | | **/ |
| | | public static String getWechatAccessToken(String appid, String secret, String code) { |
| | | String url = "https://api.weixin.qq.com/sns/oauth2/access_token"; |
| | | Map<String, Object> paramMap = new HashMap<>(3); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("secret", secret); |
| | | paramMap.put("code", code); |
| | | paramMap.put("grant_type", "authorization_code"); |
| | | return HttpUtil.get(url, paramMap); |
| | | } |
| | | |
| | | /** |
| | | * Createed by PKZ Date 2019/6/18 17:13 Descriptionï¼å¾®ä¿¡å
¬ä¼å·è·åç¨æ·ä¿¡æ¯ |
| | | **/ |
| | | public static String getWechatUserInfo(String access_token, String openid) { |
| | | String url = "https://api.weixin.qq.com/sns/userinfo"; |
| | | Map<String, Object> paramMap = new HashMap<>(3); |
| | | paramMap.put("access_token", access_token); |
| | | paramMap.put("openid", openid); |
| | | paramMap.put("lang", "zh_CN"); |
| | | return HttpUtil.get(url, paramMap); |
| | | } |
| | | |
| | | /** |
| | | * 该æ¥å£ç¨äºå° code æ¢åç¨æ·ææºå· |
| | | * |
| | | * @param access_token |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static String getUserPhoneNumber(String access_token, String code) { |
| | | String url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" + access_token; |
| | | Map<String, Object> paramMap = new HashMap<>(1); |
| | | paramMap.put("code", code); |
| | | String result = HttpUtil.post(url, JSONUtil.toJsonStr(paramMap)); |
| | | log.info("getUserPhoneNumber=>{}", result); |
| | | JSONObject resultInfo = JSONObject.parseObject(result); |
| | | if (resultInfo.getIntValue("errcode") == 0) { |
| | | return resultInfo.getJSONObject("phone_info").getString("purePhoneNumber"); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * è·å URL Link |
| | | * |
| | | * @param access_token |
| | | * @return |
| | | */ |
| | | public static String generateUrllink(String access_token) { |
| | | String url = "https://api.weixin.qq.com/wxa/generate_urllink?access_token=" + access_token; |
| | | Map<String, Object> paramMap = new HashMap<>(1); |
| | | String result = HttpUtil.post(url, JSONUtil.toJsonStr(paramMap)); |
| | | log.info("generateUrllink=>{}", result); |
| | | JSONObject resultInfo = JSONObject.parseObject(result); |
| | | if (resultInfo.getIntValue("errcode") == 0) { |
| | | return resultInfo.getString("url_link"); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /* |
| | | * @Author : liu.q [916000612@qq.com] |
| | | * |
| | | * @Date : 2019-06-27 09:49 |
| | | * |
| | | * @Description :è·åå°ç¨åºç ï¼åææ¯å·²åå¸ï¼ |
| | | * |
| | | * @secne åæ° |
| | | * |
| | | * @width ç 宽 |
| | | * |
| | | * @page ç è·³è½¬è·¯å¾ |
| | | */ |
| | | public static byte[] getQRcode(String access_token, String scene, int width, String page) { |
| | | RestTemplate rest = new RestTemplate(); |
| | | byte[] result = null; |
| | | try { |
| | | String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + access_token; |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("scene", scene); |
| | | // param.put("access_token", access_token); //access_tokenæ¥å¨urlå |
| | | param.put("page", page); |
| | | param.put("width", width); |
| | | param.put("auto_color", true); |
| | | Map<String, Object> line_color = new HashMap<>(); |
| | | line_color.put("r", 54); |
| | | line_color.put("g", 56); |
| | | line_color.put("b", 115); |
| | | param.put("line_color", line_color); |
| | | MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); |
| | | AppDTO sto = new AppDTO(); |
| | | AppDTO s = new AppDTO(); |
| | | sto.setMap(param); |
| | | sto.setPro(url); |
| | | BeanUtils.copyProperties(sto, s); |
| | | // String result22 = HttpUtil.post(url, JSONUtil.toJsonStr(param)); |
| | | // log.info("getUserPhoneNumber=>{}",result22); |
| | | HttpEntity requestEntity = new HttpEntity(s.getMap(), headers); |
| | | ResponseEntity<byte[]> entity = rest.exchange(s.getPro(), HttpMethod.POST, requestEntity, byte[].class, |
| | | new Object[0]); |
| | | result = entity.getBody(); |
| | | if (entity.getHeaders().getContentType().isCompatibleWith(MediaType.APPLICATION_JSON)) { |
| | | log.error(new String(result)); |
| | | return null; |
| | | } |
| | | System.out.println(entity.toString()); |
| | | |
| | | String imageStr = Base64.getEncoder().encodeToString(result); |
| | | imageStr = HtmlUtils.htmlEscape(imageStr); |
| | | result = Base64.getDecoder().decode(imageStr); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("è°ç¨å°ç¨åºçæå¾®ä¿¡æ°¸ä¹
å°ç¨åºç URLæ¥å£å¼å¸¸", e); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æ¨éæ¶æ¯ |
| | | * |
| | | * @param appId |
| | | * @param secret |
| | | * @param openId |
| | | * @param formId |
| | | * @param templateId |
| | | * @param page |
| | | * @param items |
| | | */ |
| | | public static void push(String appId, String secret, String openId, String formId, String templateId, String page, |
| | | List<String> items) { |
| | | // 1,é
ç½®å°ç¨åºä¿¡æ¯ |
| | | WxMaInMemoryConfig wxConfig = new WxMaInMemoryConfig(); |
| | | // å°ç¨åºappid |
| | | wxConfig.setAppid(appId); |
| | | // å°ç¨åºAppSecret |
| | | wxConfig.setSecret(secret); |
| | | WxMaService wxMaService = new WxMaServiceImpl(); |
| | | wxMaService.setWxMaConfig(wxConfig); |
| | | // 2,设置模çä¿¡æ¯ï¼keyword1ï¼ç±»åï¼keyword2ï¼å
å®¹ï¼ |
| | | List<WxMaTemplateData> templateDataList = new ArrayList<>(items.size()); |
| | | for (int i = 0; i < items.size(); i++) { |
| | | WxMaTemplateData data = new WxMaTemplateData("keyword" + (i + 1), items.get(i)); |
| | | templateDataList.add(data); |
| | | } |
| | | // 3ï¼è®¾ç½®æ¨éæ¶æ¯ |
| | | WxMaTemplateMessage templateMessage = WxMaTemplateMessage.builder().toUser(openId).formId(formId) |
| | | .templateId(templateId).data(templateDataList).page(page).build(); |
| | | // 4ï¼åèµ·æ¨é |
| | | try { |
| | | wxMaService.getMsgService().sendTemplateMsg(templateMessage); |
| | | } catch (WxErrorException e) { |
| | | log.info("ä»»å¡å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /* * |
| | | * å°ç¨åº-订é
æ¶æ¯-æ¨éæ¶æ¯ |
| | | * |
| | | * @author lc |
| | | * @date 2019/12/30 9:52 |
| | | */ |
| | | public static String pushSend(PushMsg pushMsg, String accessToken) { |
| | | String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + accessToken; |
| | | try { |
| | | System.out.println("is :" + JSONUtil.toJsonStr(pushMsg)); |
| | | String result = HttpUtil.post(url, JSONUtil.toJsonStr(pushMsg)); |
| | | log.info("is push result:" + result); |
| | | return result; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /* * |
| | | * å
¬ä¼å·-æ¨¡æ¿æ¶æ¯ |
| | | * |
| | | */ |
| | | public static String h5PubpushSend(PushMsg pushMsg, String accessToken) { |
| | | String url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken; |
| | | try { |
| | | System.out.println("is :" + JSONUtil.toJsonStr(pushMsg)); |
| | | String result = HttpUtil.post(url, JSONUtil.toJsonStr(pushMsg)); |
| | | log.info("is push result:" + result); |
| | | return result; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import org.apache.commons.text.StringEscapeUtils; |
| | | import org.owasp.validator.html.AntiSamy; |
| | | import org.owasp.validator.html.Policy; |
| | | import org.owasp.validator.html.PolicyException; |
| | | import org.owasp.validator.html.ScanException; |
| | | |
| | | import java.io.InputStream; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName XSSUtil |
| | | * @date 2019/7/16 18:13 |
| | | */ |
| | | public class XssUtil { |
| | | |
| | | public static String clearXss(String val) { |
| | | if (StrUtil.isBlank(val)) { |
| | | return val; |
| | | } |
| | | try { |
| | | InputStream is = XssUtil.class.getResourceAsStream("/antisamy.xml"); |
| | | AntiSamy antiSamy = new AntiSamy(); |
| | | Policy policy = Policy.getInstance(is); |
| | | return StringEscapeUtils.unescapeHtml4(antiSamy.scan(val, policy).getCleanHTML()); |
| | | } catch (PolicyException e) { |
| | | e.printStackTrace(); |
| | | } catch (ScanException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return val; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.enums; |
| | | // @formatter:off |
| | | /** |
| | | * .-~~~~~~~~~-._ _.-~~~~~~~~~-. |
| | | * __.' @Author ~. .~ ä»£ç æ Bug `.__ |
| | | * .'// liu.q \./ (ç§ç±) \\`. |
| | | * .'// [916000612@qq.com] | 欲ç»ç¥å å¼åèªå®« \\`. |
| | | * .'// .-~"""""""~~~~-._ | _,-~~~~"""""""~-. \\`. |
| | | * .'//.-" 2019-04-24 `-. | .-' 15:58 "-.\\`. |
| | | * .'//______.============-.. \ | / ..-============.______\\`. |
| | | *.'______________________________\|/______________________________`. |
| | | * |
| | | * @Description : |
| | | */ |
| | | // @formatter:on |
| | | |
| | | public enum FileType { |
| | | |
| | | /** |
| | | * JEPG. |
| | | */ |
| | | JPEG("FFD8FF"), |
| | | |
| | | /** |
| | | * PNG. |
| | | */ |
| | | PNG("89504E47"), |
| | | |
| | | /** |
| | | * GIF. |
| | | */ |
| | | GIF("47494638"), |
| | | |
| | | /** |
| | | * TIFF. |
| | | */ |
| | | TIFF("49492A00"), |
| | | |
| | | /** |
| | | * Windows Bitmap. |
| | | */ |
| | | BMP("424D"), |
| | | |
| | | /** |
| | | * CAD. |
| | | */ |
| | | DWG("41433130"), |
| | | |
| | | /** |
| | | * Adobe Photoshop. |
| | | */ |
| | | PSD("38425053"), |
| | | |
| | | /** |
| | | * Rich Text Format. |
| | | */ |
| | | RTF("7B5C727466"), |
| | | |
| | | /** |
| | | * XML. |
| | | */ |
| | | XML("3C3F786D6C"), |
| | | |
| | | /** |
| | | * HTML. |
| | | */ |
| | | HTML("68746D6C3E"), |
| | | |
| | | /** |
| | | * Email [thorough only]. |
| | | */ |
| | | EML("44656C69766572792D646174653A"), |
| | | |
| | | /** |
| | | * Outlook Express. |
| | | */ |
| | | DBX("CFAD12FEC5FD746F"), |
| | | |
| | | /** |
| | | * Outlook (pst). |
| | | */ |
| | | PST("2142444E"), |
| | | |
| | | /** |
| | | * MS Word/Excel. |
| | | */ |
| | | XLS_DOC("D0CF11E0"), |
| | | |
| | | /** |
| | | * MS Access. |
| | | */ |
| | | MDB("5374616E64617264204A"), |
| | | |
| | | /** |
| | | * WordPerfect. |
| | | */ |
| | | WPD("FF575043"), |
| | | |
| | | /** |
| | | * Postscript. |
| | | */ |
| | | EPS("252150532D41646F6265"), |
| | | |
| | | /** |
| | | * Adobe Acrobat. |
| | | */ |
| | | PDF("255044462D312E"), |
| | | |
| | | /** |
| | | * Quicken. |
| | | */ |
| | | QDF("AC9EBD8F"), |
| | | |
| | | /** |
| | | * Windows Password. |
| | | */ |
| | | PWL("E3828596"), |
| | | |
| | | /** |
| | | * ZIP Archive. |
| | | */ |
| | | ZIP("504B0304"), |
| | | |
| | | /** |
| | | * RAR Archive. |
| | | */ |
| | | RAR("52617221"), |
| | | |
| | | /** |
| | | * Wave. |
| | | */ |
| | | WAV("57415645"), |
| | | |
| | | /** |
| | | * AVI. |
| | | */ |
| | | AVI("41564920"), |
| | | |
| | | /** |
| | | * Real Audio. |
| | | */ |
| | | RAM("2E7261FD"), |
| | | |
| | | /** |
| | | * Real Media. |
| | | */ |
| | | RM("2E524D46"), |
| | | |
| | | /** |
| | | * MPEG (mpg). |
| | | */ |
| | | MPG("000001BA"), |
| | | |
| | | /** |
| | | * Quicktime. |
| | | */ |
| | | MOV("6D6F6F76"), |
| | | |
| | | /** |
| | | * Windows Media. |
| | | */ |
| | | ASF("3026B2758E66CF11"), |
| | | |
| | | /** |
| | | * MIDI. |
| | | */ |
| | | MID("4D546864"); |
| | | |
| | | private String value = ""; |
| | | |
| | | /** |
| | | * Constructor. |
| | | * |
| | | * @param type |
| | | */ |
| | | private FileType(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util.enums; |
| | | |
| | | /** |
| | | * ææ¥ç±»å: |
| | | * 01-XXé¶è¡æ¶æ¬¾æå |
| | | * 02-æ¯ä»å®æ¶æ¬¾æå |
| | | * 03-å¾®ä¿¡æ¶æ¬¾æå |
| | | * 10-åæ¶æ¯ä» |
| | | */ |
| | | public enum LaPushEnum { |
| | | YINHANG("01", "XXé¶è¡æ¶æ¬¾æå"), |
| | | ZFB("02", "æ¯ä»å®æ¶æ¬¾æå"), |
| | | WX("03", "å¾®ä¿¡æ¶æ¬¾æå"), |
| | | YSF("04", "äºéªä»æ¶æ¬¾æå"), |
| | | KJZF("05", "å¿«æ·æ¯ä»æ¶æ¬¾æå"), |
| | | CANCLE("10", "åæ¶æ¯ä»"); |
| | | |
| | | private String code; |
| | | private String name; |
| | | |
| | | private LaPushEnum(String code, String name) { |
| | | this.code = code; |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util.enums; |
| | | |
| | | /** |
| | | * æ¯ä»åºæ¯ |
| | | */ |
| | | public enum QdlPayScene { |
| | | |
| | | H5("H5", "微信å
¬ä¼å·"), |
| | | APP("APP", "微信å°ç¨åº"), |
| | | ZFB_APP("ZFB-APP", "æ¯ä»å®å°ç¨åº"), |
| | | EXTERNAL_APP("EXTERNAL-APP", |
| | | "ç«¯å¤æ¨¡å¼ï¼æå®æ¯ä»å·¥å
·ç´æ¥è·³è½¬ paymentUrlï¼æªæå®å·¥å
·ä½¿ç¨å
¬å¸æä¾éæ©å·¥å
·é¡µé¢ä¹è·³è½¬ paymentUrlï¼"); |
| | | |
| | | private String code; |
| | | private String name; |
| | | |
| | | private QdlPayScene(String code, String name) { |
| | | this.code = code; |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util.enums; |
| | | |
| | | public enum QdlTradeStatus { |
| | | SUCCESS("SUCCESS", "交ææå", "ä¸åã鿬¾"), |
| | | FAIL("FAIL", "交æå¤±è´¥", "ä¸åã鿬¾"), |
| | | WAITFORPAY("WAITFORPAY", "订åä¸é´ç¶æ ä¸åï¼çå¾
æ¯ä» 鿬¾ï¼å¤çä¸", "ä¸åã鿬¾"), |
| | | CLOSE("CLOSE", "订åè¶
æ¶å
³é", "ä¸å"), |
| | | REFUNDED("REFUNDED", "å·²å
¨é¨é款", "鿬¾"), |
| | | REFUNDING("REFUNDING", "é¨å鿬¾", "鿬¾"), |
| | | REVOKED("REVOKED", "订åå·²æ¤é", "æ¤é"), |
| | | REVOKING("REVOKING", "è®¢åæ¤éä¸", "æ¤é"); |
| | | |
| | | private String code; |
| | | private String name; |
| | | /** |
| | | * ä½ç¨å |
| | | */ |
| | | private String scope; |
| | | |
| | | private QdlTradeStatus(String code, String name, String scope) { |
| | | this.code = code; |
| | | this.name = name; |
| | | this.scope = scope; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getScope() { |
| | | return scope; |
| | | } |
| | | |
| | | public void setScope(String scope) { |
| | | this.scope = scope; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util.enums; |
| | | |
| | | public enum QdlTradeType { |
| | | BESTPAY("BESTPAY", "翼æ¯ä»ç¨æ·"), |
| | | TENPAY("TENPAY", "å¾®ä¿¡ç¨æ·"), |
| | | QUICKPASS("QUICKPASS", "äºéªä»ç¨æ·"), |
| | | WEBANKPAY("WEBANKPAY", "å¾®ç²è´·ç¨æ·"), |
| | | ALIPAY("ALIPAY", "æ¯ä»å®ç¨æ·"), |
| | | REAL_TIME("REAL_TIME", "åè°éç¥ç±»å 峿¶å°è´¦"), |
| | | REAL_TIME_PRO("REAL_TIME_PRO", "åè°éç¥ç±»å é«çº§å³æ¶å°è´¦"), |
| | | REFUND("REFUND", "åè°éç¥ç±»å 鿬¾"); |
| | | private String code; |
| | | private String name; |
| | | |
| | | private QdlTradeType(String code, String name) { |
| | | this.code = code; |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util.oss; |
| | | |
| | | import com.amazonaws.AmazonServiceException; |
| | | import com.amazonaws.SdkClientException; |
| | | import com.amazonaws.auth.AWSCredentialsProvider; |
| | | import com.amazonaws.auth.AWSStaticCredentialsProvider; |
| | | import com.amazonaws.auth.BasicAWSCredentials; |
| | | import com.amazonaws.client.builder.AwsClientBuilder; |
| | | import com.amazonaws.services.s3.AmazonS3; |
| | | import com.amazonaws.services.s3.AmazonS3ClientBuilder; |
| | | import com.amazonaws.services.s3.model.GeneratePresignedUrlRequest; |
| | | import com.amazonaws.services.s3.model.PutObjectResult; |
| | | import com.amazonaws.services.s3.model.ResponseHeaderOverrides; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.File; |
| | | import java.io.InputStream; |
| | | import java.net.URL; |
| | | import java.time.Instant; |
| | | import java.util.Date; |
| | | |
| | | public class YiDongOss { |
| | | // å¡«åè¦ä¸ä¼ å°çå卿¡¶åç§°ï¼ä¾å¦'example-bucket'ã |
| | | private static final String bucketName = "ecosphere"; |
| | | // å¡«åå卿¡¶ï¼Bucketï¼æå¨å°å对åºç endpoint å Regionã |
| | | private static final String endpoint = "https://eos.zhengzhou-4.cmecloud.cn"; |
| | | private static final String region = "zhengzhou4"; |
| | | // å¡«å EOS è´¦å·ç认è¯ä¿¡æ¯ï¼æè
åè´¦å·ç认è¯ä¿¡æ¯ã |
| | | private static final String accessKey = "1PMC6XN2QVDEN6M6IWQB"; |
| | | private static final String secretKey = "tfbfDxHZGUIl7s3kb2fJyHCLtpZLydbzEhlTRmIy"; |
| | | private static AmazonS3 client = null; |
| | | |
| | | static { |
| | | // å建 AmazonS3 å®ä¾ã |
| | | AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(endpoint, region); |
| | | BasicAWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); |
| | | AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials); |
| | | client = AmazonS3ClientBuilder.standard() |
| | | .withEndpointConfiguration(endpointConfiguration) |
| | | .withCredentials(credentialsProvider).build(); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | try { |
| | | String filePath = "C:\\Users\\cy\\Pictures\\éçªæ³ª.jpg"; |
| | | File uploadFile = new File(filePath); |
| | | String fileName = uploadFile.getName(); |
| | | String foldName = "2023/12/19/"; |
| | | // mkdirFolder(client, bucketName,foldName); |
| | | // uploadFile(client, bucketName, foldName + fileName, new FileInputStream(uploadFile)); |
| | | String shareUrl = getShareUrl(foldName + fileName); |
| | | } catch (AmazonServiceException e) { |
| | | // ä¸ä¼ 失败ã |
| | | // System.out.println("åçå¼å¸¸ AmazonServiceExceptionï¼é常åå æ¯è¯·æ±å
容é误ã"); |
| | | System.out.println("Error Code: " + e.getErrorCode()); |
| | | } catch (SdkClientException e) { |
| | | System.out.println("Error Message: " + e.getMessage()); |
| | | } finally { |
| | | if (client != null) { |
| | | client.shutdown(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // ä¸ä¼ æä»¶ã |
| | | public static String upload(String fileName, InputStream inputStream, String targetPath) { |
| | | String objectName = targetPath + "/" + fileName; |
| | | mkdirFolder(targetPath); |
| | | PutObjectResult putObjectResult = client.putObject(bucketName, objectName, inputStream, null); |
| | | if (putObjectResult == null) { |
| | | return null; |
| | | } |
| | | try { |
| | | return getShareUrl(objectName); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * å建æä»¶å¤¹ |
| | | * |
| | | * @return |
| | | */ |
| | | private static boolean mkdirFolder(String directory) { |
| | | PutObjectResult putObjectResult = client.putObject(bucketName, directory, new ByteArrayInputStream(new byte[0]), null); |
| | | return putObjectResult != null; |
| | | } |
| | | |
| | | /** |
| | | * è·å对象çåäº«é¾æ¥ |
| | | * |
| | | * @param objectName |
| | | * @return |
| | | */ |
| | | public static String getShareUrl(String objectName) throws Exception { |
| | | // çæå¯é¢è§çå¤é¾ã |
| | | GeneratePresignedUrlRequest request = |
| | | new GeneratePresignedUrlRequest(bucketName, objectName); |
| | | |
| | | // è®¾ç½®è¿ææ¶é´ï¼å½å°è¾¾è¯¥æ¶é´ç¹æ¶ï¼URL å°±ä¼è¿æï¼å
¶ä»äººä¸åè½è®¿é®è¯¥å¯¹è±¡ï¼Objectï¼ã |
| | | Date expiration = new Date(); |
| | | // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); |
| | | // expiration = simpleDateFormat.parse("2024/12/20 23:59:59"); |
| | | // 设置 7 天åè¿æã |
| | | long expTimeMillis = Instant.now().toEpochMilli(); |
| | | expTimeMillis += 1000 * 60 * 60 * 24 * 7; |
| | | expiration.setTime(expTimeMillis); |
| | | |
| | | request.setExpiration(expiration); |
| | | |
| | | // 设置è¿å头 |
| | | // 设置为 "inline" æ¶å¨æµè§å¨ä¸å±ç¤ºï¼è®¾ç½®ä¸º "attachment" æ¶ä»¥æä»¶å½¢å¼ä¸è½½ã |
| | | // æ¤å¤è®¾ç½®ä¸º "attachment;filename=\"filename.jpg\"" ï¼è¿å¯ä»¥è®©ä¸è½½çæä»¶ååéå½å为 "filename.jpg"ã |
| | | ResponseHeaderOverrides headerOverrides = new ResponseHeaderOverrides(); |
| | | headerOverrides.setContentDisposition("inline"); |
| | | request.setResponseHeaders(headerOverrides); |
| | | |
| | | URL url = client.generatePresignedUrl(request); |
| | | System.out.println(url); |
| | | return url.toString(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay; |
| | | |
| | | /** |
| | | * æ¯ä»åè°å°å |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/8/27 14:57 |
| | | */ |
| | | |
| | | public class CallBackUrl { |
| | | |
| | | /** |
| | | * ååç»ä¸æ¯ä»ä¸ååè°å°å |
| | | */ |
| | | public static String unifiedStoreGoodsPayUrl = "/v1/shop/web/payBack/storeGoodsPayBack"; |
| | | |
| | | /** |
| | | * ååç»ä¸æ¯ä»ä¸ååè°å°å |
| | | */ |
| | | public static String storeShareFundRecordPayUrl = "/v1/shop/web/payBack/storeShareFundRecordCallBack"; |
| | | |
| | | /** |
| | | * ååå¿«æ·æ¯ä»ä¸ååè°å°å |
| | | */ |
| | | public static String shortcutStoreGoodsPayUrl = "/v1/shop/web/payBack/shortcutStoreGoodsPayBack"; |
| | | |
| | | /** |
| | | * 纯å°ç¨åºæ¯ä»åè°å°å |
| | | */ |
| | | public static String xcxGoodsPayUrl = "/v1/shop/web/payBack/xcxGoodsPayBack"; |
| | | |
| | | /** |
| | | * æ¶é¶å®ä¸ï¼å¾®ä¿¡æ¯ä»Cæ«Bæ«ç ä»2.0åè°url |
| | | */ |
| | | public static String sybWxC2BPayUrl = "v1/web/payBack/sybScanPayGoodsPayBack"; |
| | | /** |
| | | * H5æ«ç æ¯ä»--é¶è¡å¡å¿«æ·æ¯ä» åè° |
| | | */ |
| | | public static String sybKJPayUrl = "v1/web/payBack/scanPayGoodsSybPayBack"; |
| | | |
| | | /** |
| | | * psv为æ¯ä»å®æ¶ï¼æ¯ä»å®æ¯ä» Cæ«Bæ«ç ä»åè° |
| | | */ |
| | | public static String zfbC2BPayUrl = "v1/web/payBack/scanPayGoodsSybPayBack"; |
| | | |
| | | /** |
| | | * psv为微信æ¶ï¼æ¯ä»å®æ¯ä» Cæ«Bæ«ç ä»åè° |
| | | */ |
| | | public static String wxC2BPayUrl = "v1/web/payBack/scanPayGoodsPayBack"; |
| | | |
| | | |
| | | /** |
| | | * psv为äºåéæ¶ï¼ åæ·çº¿ä¸å¾®ä¿¡æ¯ä»åè° sc åå |
| | | */ |
| | | public static String ystScPayUrl = "v1/web/payBack/wechatMerchantBack"; |
| | | /** |
| | | * æç°ç¾çº¦éç¥(æ¥æ¶) |
| | | */ |
| | | public static String ystTxSignUrl = "v1/web/payBack/signAcctNotify"; |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.syb; |
| | | |
| | | |
| | | /** |
| | | * éè交æç¶æç ï¼å¿«æ·æ¯ä»ï¼ |
| | | * |
| | | * @author: lc |
| | | * @dateï¼ æ¥æï¼2018å¹´11æ26æ¥ æ¶é´ï¼ä¸å1:45:46 |
| | | */ |
| | | |
| | | public class SybPayCode { |
| | | |
| | | //å
¶ä½3å¼å¤´çé误,请读åerrmsg |
| | | |
| | | /** |
| | | * 交ææå |
| | | */ |
| | | public static final String PAY_MSG_0000 = "0000"; |
| | | |
| | | /** |
| | | * éè·åçä¿¡éªè¯ç ,è¿è¡ä¸ä¸æ¥ç¡®è®¤æä½ |
| | | */ |
| | | public static final String PAY_MSG_1999 = "1999"; |
| | | |
| | | /** |
| | | * 交æå·²åçï¼è¯·æ¥è¯¢ç»æï¼ |
| | | */ |
| | | public static final String PAY_MSG_2000 = "2000"; |
| | | |
| | | /** |
| | | * 交æå·²åçï¼è¯·æ¥è¯¢ç»æï¼ |
| | | */ |
| | | public static final String PAY_MSG_2018 = "2000"; |
| | | |
| | | /** |
| | | * 交æå¼å¸¸,请æ¥è¯¢äº¤æ |
| | | */ |
| | | public static final String PAY_MSG_3054 = "3054"; |
| | | |
| | | /** |
| | | * 交æå¼å¸¸,请æ¥è¯¢äº¤æ |
| | | */ |
| | | public static final String PAY_MSG_3004 = "3004"; |
| | | |
| | | /** |
| | | * å交æä¸å
许æ¤éæéè´§ |
| | | */ |
| | | public static final String PAY_MSG_3012 = "3012"; |
| | | |
| | | /** |
| | | * å交æä¸åå¨ |
| | | */ |
| | | public static final String PAY_MSG_3035 = "3035"; |
| | | /** |
| | | * å交æä¸åå¨ |
| | | */ |
| | | public static final String PAY_MSG_1001 = "1001"; |
| | | /** |
| | | * åè®®ä¸åå¨ |
| | | */ |
| | | public static final String PAY_MSG_3045 = "3045"; |
| | | |
| | | /** |
| | | * å¡ä¿¡æ¯æææºå·ç é误 |
| | | */ |
| | | public static final String PAY_MSG_3046 = "3046"; |
| | | |
| | | /** |
| | | * è¯·éæ°è·åéªè¯ç |
| | | */ |
| | | public static final String PAY_MSG_3057 = "3057"; |
| | | |
| | | /** |
| | | * çä¿¡éªè¯ç é误 |
| | | */ |
| | | public static final String PAY_MSG_3058 = "3058"; |
| | | |
| | | /** |
| | | * çä¿¡éªè¯ç åé失败 |
| | | */ |
| | | public static final String PAY_MSG_3059 = "3059"; |
| | | |
| | | /** |
| | | * å
¶ä»é误 |
| | | */ |
| | | public static final String PAY_MSG_3999 = "3999"; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.syb; |
| | | |
| | | /** |
| | | * éèæ¯ä»å°åï¼æ¶é¶å®ï¼ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/8/27 14:57 |
| | | */ |
| | | |
| | | public class SybPayUrl { |
| | | |
| | | |
| | | /** |
| | | * åæ·è®¢åæ¥è¯¢æ¥å£ |
| | | */ |
| | | public static final String MERCHANT_PAY_RESULT = "https://vsp.allinpay.com/apiweb/tranx/queryorder"; |
| | | |
| | | /** |
| | | * ç»ä¸ä¸åæ¥å£ |
| | | */ |
| | | public static String UNIFIED_ORDER_URL = "https://vsp.allinpay.com/apiweb/unitorder/pay"; |
| | | |
| | | /** |
| | | * éèæ¯ä»Bæ«Cä¸åæ¥å£å°å |
| | | */ |
| | | public static String ORDER_B_SWEEP_C_URL = "https://vsp.allinpay.com/apiweb/unitorder/scanqrpay"; |
| | | |
| | | //æ¶é¶å®è¿ä»¶æ¥å£åç¼ |
| | | // private static String SYB_PREFIX = "https://vsp.allinpay.com/cusapi"; |
| | | private static String SYB_PREFIX = "https://syb-test.allinpay.com/vsppcusapi"; |
| | | /** |
| | | * æ¶é¶å
åæ·è¿ä»¶URL |
| | | */ |
| | | public static String SYB_MERCHANT_ADD_URL = SYB_PREFIX + "/merchantapi/add"; |
| | | /** |
| | | * åæ·å®¡æ ¸ç¶ææ¥è¯¢ |
| | | */ |
| | | public static String SYB_MERCHANT_ADD_QUERYSTATUS_URL = SYB_PREFIX + "/merchantapi/querystatus"; |
| | | /** |
| | | * åè§æ§ç¶ææ¥è¯¢æ¥å£ |
| | | */ |
| | | public static String SYB_MERCHANT_ADD_QUERYCUSRGC_URL = SYB_PREFIX + "/merchantapi/querycusrgc"; |
| | | /** |
| | | * åè§æ§å®¡æ ¸è¡¥å½ç»ä¸h5æ¥å£ |
| | | */ |
| | | public static String SYB_MERCHANT_ADD_REPAIRCUSRGC_URL = SYB_PREFIX + "/merchantapi/repaircusrgc"; |
| | | |
| | | /** |
| | | * 微信/æ¯ä»å®è®¤è¯ç¶ææ¥è¯¢ |
| | | */ |
| | | public static String SYB_MERCHANT_ADD_QUERYWXVERIFYSTATE_URL = SYB_PREFIX + "/merchantapi/querywxverifystate"; |
| | | |
| | | /** |
| | | * 认è¯ç»ä¸H5 |
| | | */ |
| | | public static String SYB_MERCHANT_ADD_WXVERIFY_URL = SYB_PREFIX + "/merchantapi/wxverify"; |
| | | |
| | | /** |
| | | * æ 纸åè¿ä»¶åè®®ç¾çº¦ç¶ææ¥è¯¢ |
| | | */ |
| | | public static String SYB_MERCHANT_ADD_QUERYELECTSIGN_URL = SYB_PREFIX + "/merchantapi/queryelectsign"; |
| | | |
| | | /** |
| | | * æ 纸åè¿ä»¶åè®®éåæ¥å£ |
| | | */ |
| | | public static String SYB_MERCHANT_ADD_ELECTSIGN_URL = SYB_PREFIX + "/merchantapi/electsign"; |
| | | /** |
| | | * æ 纸åè¿ä»¶çµååè®®URLæ¥å£æ¥è¯¢ |
| | | */ |
| | | public static String SYB_MERCHANT_ADD_QUERYELECTURL_URL = SYB_PREFIX + "/merchantapi/queryelecturl"; |
| | | /** |
| | | * æ¶é¶å®æä»¶ä¸ä¼ URL |
| | | */ |
| | | public static String SYB_FILE_UPLOAD_URL = SYB_PREFIX + "/sybupfile"; |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®ææç (仿¬¾ç )è·åç¨æ·ID å°å |
| | | */ |
| | | public static final String SERVICE_AUTHCODE2USERID_URL = "https://vsp.allinpay.com/apiweb/unitorder/authcodetouserid"; |
| | | |
| | | /** |
| | | * éèæ¥è¯¢æ¯ä»ç»ææ¥å£ |
| | | */ |
| | | public static String PAY__RESULT_B_SWEEP_C_URL = "https://vsp.allinpay.com/apiweb/unitorder/query"; |
| | | |
| | | /** |
| | | * 卿Cæ«Bæ¯ä»åè°å°å |
| | | */ |
| | | public static String ACTIVE_C_SWEEP_B_URL_SYB = "/v1/web/payBack/activeCsweepBBack"; |
| | | public static String ACTIVE_C_SWEEP_B_URL_WX = "/v1/web/payBack/activeCsweepBBackWx"; |
| | | |
| | | /** |
| | | * éè对é¢ä»æ»å
¬å¸éå®åå°å |
| | | */ |
| | | public static String F2F_HEAD_BACK_URL = "https://syb.allinpay.com/sappweb/usertrans/cuspay"; |
| | | |
| | | /** |
| | | * é¶èäºéªä»ææuserid |
| | | */ |
| | | public static final String UNION_AUTH_URL = "https://vsp.allinpay.com/apiweb/unitorder/authcodetouserid"; |
| | | |
| | | /** |
| | | * é¶èäºéªä»æ¯ä» |
| | | */ |
| | | public static final String UNION_PAY_URL = "https://vsp.allinpay.com/apiweb/unitorder/pay"; |
| | | |
| | | |
| | | /** |
| | | * éèæ¥å£å°å |
| | | */ |
| | | public static String ALLINPAY_URL = "https://vsp.allinpay.com"; |
| | | // public static String ALLINPAY_URL = "https://syb-test.allinpay.com"; |
| | | |
| | | /** |
| | | * ç³è¯·ç¾çº¦ï¼éèå¿«æ·æ¯ä»ï¼ |
| | | */ |
| | | public static String AGREEAPPLY_URL = ALLINPAY_URL + "/apiweb/qpay/agreeapply"; |
| | | |
| | | /** |
| | | * ç³è¯·ç¡®è®¤ï¼éèå¿«æ·æ¯ä»ï¼ |
| | | */ |
| | | public static String AGREECONFIRM_URL = ALLINPAY_URL + "/apiweb/qpay/agreeconfirm"; |
| | | |
| | | /** |
| | | * æ¯ä»ç³è¯·éåéªè¯çä¿¡ï¼éèå¿«æ·æ¯ä»ï¼ |
| | | */ |
| | | public static String AGREEMS_URL = ALLINPAY_URL + "/apiweb/qpay/agreesms"; |
| | | |
| | | /** |
| | | * æ¯ä»ç³è¯·ï¼éèå¿«æ·æ¯ä»ï¼ |
| | | */ |
| | | public static String PAYAPPLYAGREE_URL = ALLINPAY_URL + "/apiweb/qpay/payapplyagree"; |
| | | |
| | | /** |
| | | * æ¯ä»ç¡®è®¤ï¼éèå¿«æ·æ¯ä»ï¼ |
| | | */ |
| | | public static String PAYAGREECONFIRM_URL = ALLINPAY_URL + "/apiweb/qpay/payagreeconfirm"; |
| | | |
| | | /** |
| | | * é忝ä»çä¿¡ï¼éèå¿«æ·æ¯ä»ï¼ |
| | | */ |
| | | public static String PAYSMSAGREE_URL = ALLINPAY_URL + "/apiweb/qpay/paysmsagree"; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¾çº¦ä¿¡æ¯ï¼éèå¿«æ·æ¯ä»ï¼ |
| | | */ |
| | | public static String AGREEQUERY_URL = ALLINPAY_URL + "/apiweb/qpay/agreequery"; |
| | | |
| | | /** |
| | | * é¶è¡å¡è§£ç»ï¼éèå¿«æ·æ¯ä»ï¼ |
| | | */ |
| | | public static String UNBIND_URL = ALLINPAY_URL + "/apiweb/qpay/unbind"; |
| | | |
| | | /** |
| | | * æ¥è¯¢äº¤æç»æ |
| | | */ |
| | | public static String QUERY_URL = ALLINPAY_URL + "/apiweb/qpay/query"; |
| | | |
| | | /** |
| | | * åååè°éç¥ |
| | | */ |
| | | public static String SHOP_CALL_BACK = "http://10.94.2.161:9010/service-shop/v1/shop/web/payBack/storeGoodsPayBack"; |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.syb; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.crypto.digest.DigestUtil; |
| | | import cn.hutool.http.HttpUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.nuvole.common.domain.emnu.CommonResultEmnu; |
| | | import com.nuvole.common.domain.result.CommonResult; |
| | | import com.nuvole.constants.PropertiesConstants; |
| | | import com.nuvole.constants.ServiceConstants; |
| | | import com.nuvole.util.IdGenerator; |
| | | import com.nuvole.util.pay.allinPay.syb.param.MerchantAddParam; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.http.HttpEntity; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.entity.mime.MultipartEntityBuilder; |
| | | import org.apache.http.entity.mime.content.FileBody; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.bouncycastle.asn1.ASN1EncodableVector; |
| | | import org.bouncycastle.asn1.ASN1Integer; |
| | | import org.bouncycastle.asn1.DERSequence; |
| | | import org.bouncycastle.jcajce.spec.SM2ParameterSpec; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.lang.reflect.Field; |
| | | import java.math.BigInteger; |
| | | import java.nio.charset.Charset; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.*; |
| | | import java.security.spec.PKCS8EncodedKeySpec; |
| | | import java.security.spec.X509EncodedKeySpec; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * éèæ¯ä»å·¥å
·ç±»ï¼æ¶é¶å®ï¼ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/8/27 14:57 |
| | | */ |
| | | |
| | | public class SybPayUtil { |
| | | |
| | | //çæ¬å· |
| | | private static final String version = "11"; |
| | | |
| | | //æ¯ä»ä¿¡æ¯ |
| | | private static final String k = PropertiesConstants.TL_PAY_K; |
| | | private static final String appId = PropertiesConstants.TL_PAY_APPID; |
| | | private static final String orgCode = PropertiesConstants.TL_PAY_ORGCODE; |
| | | |
| | | |
| | | //æµè¯ç¨ä¸ååæ° |
| | | //å¿«æ·æ¯ä»æµè¯ç¯å¢åæ° |
| | | private static final String tlk = "allinpay888"; |
| | | private static final String tlappId = "00000051"; |
| | | private static final String tlCusId = "990581007426001"; |
| | | //å¿«æ·æ¯ä»æ£å¼ç¯å¢æç¨æµè¯åæ° |
| | | /* private static final String tlk = "a0ea3fa20dbd7bb4d5abf1d59d63bae8"; |
| | | private static final String tlappId = "00000003"; |
| | | private static final String tlCusId = "990440148166000";*/ |
| | | |
| | | /**ç®æ³å¸¸é:SM3withSM2*/ |
| | | private static final String ALGORITHM_SM3SM2_BCPROV = "SM3withSM2"; |
| | | /** ç®æ³å¸¸é:SM3å å¯é¿åº¦ */ |
| | | private final static int SM3withSM2_RS_LEN=32; |
| | | |
| | | /** |
| | | * ç»ä¸æ¯ä» |
| | | * |
| | | * @param orgid:éèæºæå· |
| | | * @param cusid:éèåæ·å· |
| | | * @param appid:éèappid |
| | | * @param sub_appid:微信æ¯ä»APPID, |
| | | * @param acct:ç¨æ·æ è¯ï¼å¾®ä¿¡openidï¼ |
| | | * @param trxamt:交æéé¢(å) |
| | | * @param reqsn:åæ·äº¤æåå· |
| | | * @param paytype:äº¤ææ¹å¼ï¼W01:微信 A01:æ¯ä»å®ï¼ |
| | | * @param notify_url:交æç»æéç¥å°å |
| | | * @param key:忷坹åºçkey |
| | | * @param asinfo:å账信æ¯ï¼å¯ä»¥ä¸ºç©º |
| | | * @param body:æ é¢ |
| | | * @param remark:夿³¨ |
| | | * @Author: lc |
| | | * @Date: 2019/8/27 15:25 |
| | | */ |
| | | public static String unifiedOrder(String orgid, String cusid, String appid, String sub_appid, String acct, Integer trxamt, |
| | | String reqsn, String paytype, String notify_url, String key, String asinfo, String body, String remark) { |
| | | //ç»è£
æ°æ® |
| | | Map paramMap = new HashMap<String, String>(); |
| | | if (StrUtil.isNotEmpty(orgid)) { |
| | | paramMap.put("orgid", orgid); |
| | | } |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("trxamt", Convert.toStr(trxamt)); |
| | | paramMap.put("reqsn", reqsn); |
| | | paramMap.put("paytype", paytype); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | if (StrUtil.isNotEmpty(body)) { |
| | | paramMap.put("body", body); |
| | | } |
| | | if (StrUtil.isNotEmpty(remark)) { |
| | | paramMap.put("remark", remark); |
| | | } |
| | | if (StrUtil.isNotEmpty(acct)) { |
| | | paramMap.put("acct", acct); |
| | | } |
| | | paramMap.put("notify_url", notify_url); |
| | | |
| | | paramMap.put("signtype", "RSA"); |
| | | |
| | | if (StrUtil.isNotEmpty(asinfo)) { |
| | | paramMap.put("asinfo", asinfo); |
| | | } |
| | | if (StrUtil.isNotEmpty(sub_appid)) { |
| | | paramMap.put("sub_appid", sub_appid); |
| | | } |
| | | |
| | | |
| | | paramMap.put("signtype", "RSA"); |
| | | String signStr = coverMap2String(paramMap); |
| | | // String sign = DigestUtil.md5Hex(signStr).toUpperCase(Locale.ENGLISH); |
| | | // paramMap.put("sign", sign); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | |
| | | |
| | | paramMap.remove("key"); |
| | | // System.out.println("is param:" + JSONUtil.parseObj(paramMap)); |
| | | String result = ""; |
| | | if (ServiceConstants.SERVICE_TYPE) { //èµ°æå¡è°ç¨ |
| | | String url = ServiceConstants.SERVICE_UNIFIED_URL; |
| | | result = HttpUtil.post(url, paramMap); |
| | | } else { |
| | | result = HttpUtil.post(SybPayUrl.UNIFIED_ORDER_URL, paramMap); |
| | | } |
| | | System.out.println("is result:" + result); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ææç (仿¬¾ç )è·åç¨æ·ID |
| | | * 使ç¨åºæ¯ï¼ |
| | | * éè¿å¾®ä¿¡ä»æ¬¾ç æ¢åopenid |
| | | * éè¿é¶èuserAuthçcode(é仿¬¾ç )æ¢åuserid |
| | | * |
| | | * @param orgid:éå¢/代çååæ·å· |
| | | * @param cusid:éèåæ·å· |
| | | * @param appid:éèappid |
| | | * @param key:忷坹åºçkey |
| | | * @param authCode:æ¯ä»ææç ï¼å¾®ä¿¡ãæ¯ä»å®çææç ï¼ |
| | | * @param authType:ææç ç±»å 01-å¾®ä¿¡ä»æ¬¾ç 02-é¶èuserAuth |
| | | * @param identify:äºéªä»UAæ è¯ å½authtype=02æ¶éé |
| | | * @param subAppid:微信æ¯ä»appid é对01ææ |
| | | */ |
| | | public static String authCode2Userid(String orgid, String cusid, String appid, String key, String authCode, String authType, String identify, String subAppid) { |
| | | |
| | | Map paramMap = new HashMap<String, String>(); |
| | | if (StrUtil.isNotEmpty(orgid)) { |
| | | paramMap.put("orgid", orgid); |
| | | } |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("authcode", authCode); |
| | | paramMap.put("authtype", authType); |
| | | if (StringUtils.isNotBlank(identify)) { |
| | | paramMap.put("identify", identify); |
| | | } |
| | | if (StringUtils.isNotBlank(subAppid)) { |
| | | paramMap.put("sub_appid", subAppid); |
| | | } |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | |
| | | paramMap.put("signtype", "RSA"); |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | paramMap.remove("key"); |
| | | System.out.println("æ ¹æ®ææç (仿¬¾ç )è·åç¨æ·ID -->" + JSONUtil.toJsonStr(paramMap)); |
| | | String result = ""; |
| | | |
| | | //èµ°æå¡è°ç¨ |
| | | if (ServiceConstants.SERVICE_TYPE) { |
| | | String url = ServiceConstants.SERVICE_AUTHCODE2USERID_URL; |
| | | result = HttpUtil.post(url, paramMap); |
| | | } else { |
| | | result = HttpUtil.post(SybPayUrl.SERVICE_AUTHCODE2USERID_URL, paramMap); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * Bæ«Cæ¯ä»ï¼åæ·æ«ç¨æ·ï¼ |
| | | * |
| | | * @param orgid:éèæºæå· |
| | | * @param cusid:éèåæ·å· |
| | | * @param appid:éèappid |
| | | * @param key:忷坹åºçkey |
| | | * @param trxamt:交æéé¢(å) |
| | | * @param reqsn:åæ·äº¤æåå· |
| | | * @param body:è®¢åæ é¢, |
| | | * @param remark:订å夿³¨ |
| | | * @param authcode:æ¯ä»ææç ï¼å¾®ä¿¡ãæ¯ä»å®çææç ï¼ |
| | | * @param limit_pay:æ¯ä»éé¢ |
| | | * @Author: lc |
| | | * @Date: 2019/8/27 15:25 |
| | | */ |
| | | public static String orderBsweepC(String orgid, String cusid, String appid, String key, Integer trxamt, String reqsn, String body, String remark, String authcode, String limit_pay) { |
| | | |
| | | Map paramMap = new HashMap<String, String>(); |
| | | if (StrUtil.isNotEmpty(orgid)) { |
| | | paramMap.put("orgid", orgid); |
| | | } |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("trxamt", Convert.toStr(trxamt)); |
| | | paramMap.put("reqsn", reqsn); |
| | | |
| | | if (StrUtil.isNotEmpty(body)) { |
| | | paramMap.put("body", body); |
| | | } |
| | | if (StrUtil.isNotEmpty(remark)) { |
| | | paramMap.put("remark", remark); |
| | | } |
| | | paramMap.put("authcode", authcode); |
| | | |
| | | |
| | | if (StrUtil.isNotEmpty(body)) { |
| | | paramMap.put("body", body); |
| | | } |
| | | if (StrUtil.isNotEmpty(remark)) { |
| | | paramMap.put("remark", remark); |
| | | } |
| | | if (StrUtil.isNotEmpty(limit_pay)) { |
| | | paramMap.put("limit_pay", limit_pay); |
| | | } |
| | | |
| | | paramMap.put("signtype", "RSA"); |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | paramMap.remove("key"); |
| | | System.out.println("is tl b sweep c param -->" + JSONUtil.toJsonStr(paramMap)); |
| | | String result = ""; |
| | | |
| | | //èµ°æå¡è°ç¨ |
| | | if (ServiceConstants.SERVICE_TYPE) { |
| | | String url = ServiceConstants.SERVICE_B_SWEEP_C_URL; |
| | | result = HttpUtil.post(url, paramMap); |
| | | } else { |
| | | result = HttpUtil.post(SybPayUrl.ORDER_B_SWEEP_C_URL, paramMap); |
| | | } |
| | | Map resultMap = JSON.parseObject(result); |
| | | if (null != resultMap && resultMap.size() > 0) { |
| | | //è¿åç 2000çå¾
ç»æç¡®è®¤æ¯é10ç§æ§è¡ç»ææ¥è¯¢ï¼æå¤4次 |
| | | if ("2000".equals(resultMap.get("trxstatus") + "")) { |
| | | int index = 0; |
| | | final int count = 4; |
| | | do { |
| | | index++; |
| | | try { |
| | | result = getPayResult(orgid, cusid, appid, key, reqsn); |
| | | resultMap = JSON.parseObject(result); |
| | | Thread.sleep(10 * 1000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } while (index < count && "2000".equals(resultMap.get("trxstatus") + "")); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢äº¤ææ¯ä»ç»æ |
| | | * |
| | | * @param orgid éèæºæå· |
| | | * @param cusid éèåæ·å· |
| | | * @param appid éèappid |
| | | * @param key 忷坹åºçkey |
| | | * @param reqsn åæ·äº¤æåå· |
| | | * @Author: lc |
| | | * @Date: 2019/8/27 15:25 |
| | | */ |
| | | public static String getPayResult(String orgid, String cusid, String appid, String key, String reqsn) { |
| | | //ç»è£
æ°æ® |
| | | Map paramMap = new HashMap(); |
| | | if (StrUtil.isNotEmpty(orgid)) { |
| | | paramMap.put("orgid", orgid); |
| | | } |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("reqsn", reqsn); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("signtype", "RSA"); |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | paramMap.remove("key"); |
| | | String result = ""; |
| | | //èµ°æå¡è°ç¨ |
| | | if (ServiceConstants.SERVICE_TYPE) { |
| | | String url = ServiceConstants.SERVICE_PAY_RESULT_URL; |
| | | result = HttpUtil.post(url, paramMap); |
| | | } else { |
| | | result = HttpUtil.post(SybPayUrl.PAY__RESULT_B_SWEEP_C_URL, paramMap); |
| | | } |
| | | System.out.println("is tl b sweep c æ¥è¯¢äº¤æç»æ param -->" + JSONUtil.toJsonStr(paramMap)); |
| | | return result; |
| | | } |
| | | |
| | | private static String checkCardUrl = "https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&cardBinCheck=true&cardNo="; |
| | | |
| | | /** |
| | | * ç¾çº¦ç³è¯· |
| | | * |
| | | * @param key ç§é¥ |
| | | * @param cusid éèåé
çåæ·å· |
| | | * @param appid éèåé
çappid |
| | | * @param meruserid åæ·ç¨æ·å·(ä¼åid) |
| | | * @param accttype 00:åè®°å¡02:åè´·è®°å¡/è´·è®°å¡ |
| | | * @param acctno é¶è¡å¡å· |
| | | * @param idno è¯ä»¶å· |
| | | * @param acctname æ·å |
| | | * @param mobile ææºå·ç |
| | | * @param validdate æææMMyyä¿¡ç¨å¡ä¸è½ä¸ºç©º |
| | | * @param cvv2 Cvv2 ä¿¡ç¨å¡ä¸è½ä¸ºç©º |
| | | * @param signtype å 坿¹å¼ |
| | | * @Author: lc |
| | | * @Date: 2019/8/27 15:25 |
| | | */ |
| | | public static String agreeapply(String key, String cusid, String appid, |
| | | String meruserid, String accttype, String acctno, |
| | | String idno, String acctname, String mobile, String validdate, String cvv2 |
| | | , String signtype) { |
| | | Map paramMap = new HashMap(); |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | |
| | | paramMap.put("version", version); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | |
| | | // åæ·ç¨æ·å· |
| | | paramMap.put("meruserid", meruserid); |
| | | //åæ·ç¨æ·å· 00:åè®°å¡ 02:åè´·è®°å¡/è´·è®°å¡ |
| | | paramMap.put("accttype", accttype); |
| | | // é¶è¡å¡å· |
| | | paramMap.put("acctno", acctno); |
| | | // è¯ä»¶ç±»å 0:èº«ä»½è¯ 2:æ¤ç
§ 5:港澳éè¡è¯ 6:å°æ¹¾éè¡è¯ |
| | | paramMap.put("idtype", 0); |
| | | //è¯ä»¶å· |
| | | paramMap.put("idno", idno); |
| | | // æ·å |
| | | paramMap.put("acctname", acctname); |
| | | // ææºå·ç |
| | | paramMap.put("mobile", mobile); |
| | | if ("02".equals(accttype)) { |
| | | paramMap.put("validdate", validdate); |
| | | paramMap.put("cvv2", cvv2); |
| | | } |
| | | paramMap.put("signtype", "RSA"); |
| | | |
| | | String signStr = null; |
| | | String sign = null; |
| | | try { |
| | | signStr = coverMap2String(paramMap); |
| | | System.out.println("signStr==>" + signStr); |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | |
| | | System.out.println("is agreeapply url:" + SybPayUrl.AGREEAPPLY_URL); |
| | | System.out.println("is agreeapply param:" + JSONUtil.toJsonStr(paramMap)); |
| | | System.out.println("is agreeapply sign:" + sign); |
| | | |
| | | String result = HttpUtil.post(SybPayUrl.AGREEAPPLY_URL, paramMap); |
| | | System.out.println("is agreeapply result:" + result); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * éåç¾çº¦çä¿¡ |
| | | * |
| | | * @param key ç§é¥ |
| | | * @param cusid éèåé
çåæ·å· |
| | | * @param appid éèåé
çappid |
| | | * @param meruserid åæ·ç¨æ·å·(ä¼åid) |
| | | * @param accttype 00:åè®°å¡02:åè´·è®°å¡/è´·è®°å¡ |
| | | * @param acctno é¶è¡å¡å· |
| | | * @param idno è¯ä»¶å· |
| | | * @param acctname æ·å |
| | | * @param mobile ææºå·ç |
| | | * @param validdate æææMMyyä¿¡ç¨å¡ä¸è½ä¸ºç©º |
| | | * @param cvv2 Cvv2 ä¿¡ç¨å¡ä¸è½ä¸ºç©º |
| | | * @Author: lc |
| | | * @Date: 2019/8/27 15:25 |
| | | */ |
| | | public static String agreems(String key, String cusid, String appid, |
| | | String meruserid, String accttype, String acctno, String idno, |
| | | String acctname, String mobile, String validdate, String cvv2, String signtype) { |
| | | Map paramMap = new HashMap(); |
| | | if (PropertiesConstants.PAY_TYPE == 1) { |
| | | paramMap.put("appid", tlappId); |
| | | // paramMap.put("key", tlk); |
| | | key = tlk; |
| | | } else { |
| | | paramMap.put("appid", appid); |
| | | // paramMap.put("key", key); |
| | | } |
| | | paramMap.put("cusid", tlCusId); |
| | | // paramMap.put("version", version); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("meruserid", meruserid); |
| | | paramMap.put("accttype", accttype); |
| | | paramMap.put("acctno", acctno); |
| | | paramMap.put("idno", idno); |
| | | paramMap.put("mobile", mobile); |
| | | paramMap.put("acctname", acctname); |
| | | if ("02".equals(accttype)) { |
| | | paramMap.put("validdate", validdate); |
| | | paramMap.put("cvv2", cvv2); |
| | | } |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | if ("RSA".equals(signtype)) { |
| | | try { |
| | | sign = SybPayUtil.rsaSign(key, sign, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } else { |
| | | paramMap.put("key", key); |
| | | sign = DigestUtil.md5Hex(signStr).toUpperCase(Locale.ENGLISH); |
| | | paramMap.remove("key"); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | System.out.println("is agreeapply url:" + SybPayUrl.AGREEMS_URL); |
| | | System.out.println("is agreeapply param:" + JSONUtil.toJsonStr(paramMap)); |
| | | String result = HttpUtil.post(SybPayUrl.AGREEMS_URL, paramMap); |
| | | System.out.println("is agreeapply result:" + result); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * è§£é¤ç»å® |
| | | * |
| | | * @param key ç§é¥ |
| | | * @param cusid éèåé
çåæ·å· |
| | | * @param appid éèåé
çappid |
| | | * @param agreeid åè®®id |
| | | * @Author: lc |
| | | * @Date: 2019/8/27 15:25 |
| | | */ |
| | | public static String unbind(String key, String cusid, String appid, |
| | | String agreeid) { |
| | | Map paramMap = new HashMap(); |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("signtype", "RSA"); |
| | | paramMap.put("agreeid", agreeid); |
| | | |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | |
| | | System.out.println("is unbind url:" + SybPayUrl.UNBIND_URL); |
| | | System.out.println("is unbind param:" + JSONUtil.toJsonStr(paramMap)); |
| | | String result = HttpUtil.post(SybPayUrl.UNBIND_URL, paramMap); |
| | | System.out.println("is unbind result:" + result); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * ç¾çº¦ç³è¯·ç¡®è®¤ |
| | | * |
| | | * @param key ç§é¥ |
| | | * @param cusid éèåé
çåæ·å· |
| | | * @param appid éèåé
çappid |
| | | * @param meruserid åæ·ç¨æ·å·(ä¼åid) |
| | | * @param accttype 00:åè®°å¡02:åè´·è®°å¡/è´·è®°å¡ |
| | | * @param acctno é¶è¡å¡å· |
| | | * @param idno è¯ä»¶å· |
| | | * @param acctname æ·å |
| | | * @param mobile ææºå·ç |
| | | * @param validdate æææMMyyä¿¡ç¨å¡ä¸è½ä¸ºç©º |
| | | * @param cvv2 Cvv2 ä¿¡ç¨å¡ä¸è½ä¸ºç©º |
| | | * @param code çä¿¡éªè¯ç |
| | | * @param thpinfo éä¼ ä¿¡æ¯ï¼ç¾çº¦ç³è¯·æ¥å£è¿åï¼ |
| | | * @Author: lc |
| | | * @Date: 2019/8/27 15:25 |
| | | */ |
| | | public static String agreeconfirm(String key, String cusid, String appid, |
| | | String meruserid, String accttype, String acctno, |
| | | String idno, String acctname, String mobile, String validdate, |
| | | String cvv2, String code, String thpinfo, String signtype) { |
| | | Map paramMap = new HashMap(); |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | |
| | | paramMap.put("meruserid", meruserid); |
| | | paramMap.put("accttype", accttype); |
| | | paramMap.put("acctno", acctno); |
| | | paramMap.put("idtype", "0"); |
| | | paramMap.put("idno", idno); |
| | | paramMap.put("acctname", acctname); |
| | | paramMap.put("mobile", mobile); |
| | | paramMap.put("smscode", code); |
| | | if (StrUtil.isNotEmpty(thpinfo)) { |
| | | paramMap.put("thpinfo", thpinfo); |
| | | } |
| | | if ("02".equals(accttype)) { |
| | | paramMap.put("validdate", validdate); |
| | | paramMap.put("cvv2", cvv2); |
| | | } |
| | | paramMap.put("signtype", "RSA"); |
| | | |
| | | String signStr = null; |
| | | String sign = null; |
| | | if ("RSA".equals(signtype)) { |
| | | try { |
| | | signStr = coverMap2String(paramMap); |
| | | System.out.println("signStr==>" + signStr); |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } else { |
| | | paramMap.put("key", key); |
| | | signStr = coverMap2String(paramMap); |
| | | sign = DigestUtil.md5Hex(signStr).toUpperCase(Locale.ENGLISH); |
| | | paramMap.remove("key"); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | |
| | | System.out.println("is agreeconfirm url:" + SybPayUrl.AGREEAPPLY_URL); |
| | | System.out.println("is agreeconfirm param:" + JSONUtil.toJsonStr(paramMap)); |
| | | System.out.println("is agreeconfirm sign:" + sign); |
| | | |
| | | |
| | | String result = HttpUtil.post(SybPayUrl.AGREECONFIRM_URL, paramMap); |
| | | System.out.println("is agreeconfirm result:" + result); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æ¯ä»ç³è¯· |
| | | * |
| | | * @param key ç§é¥ |
| | | * @param cusid éèåé
çåæ·å· |
| | | * @param appid éèåé
çappid |
| | | * @param orderid 订åid |
| | | * @param agreeid åè®®id |
| | | * @param amount éé¢ï¼åä½åï¼ |
| | | * @param subject 订åçå±ç¤ºæ é¢ |
| | | * @param notifyurl 交æç»æéç¥å°å |
| | | * @Author: lc |
| | | * @Date: 2019/8/27 15:25 |
| | | */ |
| | | public static String payapplyagree(String key, String cusid, String appid, |
| | | String orderid, String agreeid, String amount, |
| | | String subject, String notifyurl) { |
| | | Map paramMap = new HashMap(); |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("signtype", "RSA"); |
| | | paramMap.put("reqsn", orderid); |
| | | paramMap.put("agreeid", agreeid); |
| | | paramMap.put("amount", amount); |
| | | paramMap.put("currency", "CNY"); |
| | | paramMap.put("subject", subject); |
| | | paramMap.put("notifyurl", notifyurl); |
| | | |
| | | String signStr = null; |
| | | String sign = null; |
| | | try { |
| | | signStr = coverMap2String(paramMap); |
| | | System.out.println("signStr==>" + signStr); |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | System.out.println("is payapplyagree url:" + SybPayUrl.PAYAPPLYAGREE_URL); |
| | | System.out.println("is payapplyagree param:" + JSONUtil.toJsonStr(paramMap)); |
| | | String result = HttpUtil.post(SybPayUrl.PAYAPPLYAGREE_URL, paramMap); |
| | | System.out.println("is payapplyagree result:" + result); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æ¯ä»ç¡®è®¤ |
| | | * |
| | | * @param key ç§é¥ |
| | | * @param cusid éèåé
çåæ·å· |
| | | * @param appid éèåé
çappid |
| | | * @param orderid 订åid |
| | | * @param agreeid åè®®id |
| | | * @param smscode çä¿¡æ¯ä»éªè¯ç |
| | | * @param thpinfo éä¼ ä¿¡æ¯ï¼æ¯ä»ç³è¯·æ¥å£è¿åï¼ |
| | | * @Author: lc |
| | | * @Date: 2019/8/27 15:25 |
| | | */ |
| | | public static String payagreeconfirm(String key, String cusid, String appid, |
| | | String orderid, String agreeid, String smscode, String thpinfo) { |
| | | Map paramMap = new HashMap(); |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("signtype", "RSA"); |
| | | paramMap.put("reqsn", orderid); |
| | | paramMap.put("agreeid", agreeid); |
| | | paramMap.put("smscode", smscode); |
| | | if (StrUtil.isNotEmpty(thpinfo)) { |
| | | paramMap.put("thpinfo", thpinfo); |
| | | } |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | paramMap.put("sign", sign); |
| | | System.out.println("is payagreeconfirm url:" + SybPayUrl.PAYAGREECONFIRM_URL); |
| | | System.out.println("is payagreeconfirm param:" + JSONUtil.toJsonStr(paramMap)); |
| | | String result = HttpUtil.post(SybPayUrl.PAYAGREECONFIRM_URL, paramMap); |
| | | System.out.println("is payagreeconfirm result:" + result); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * é忝ä»çä¿¡ |
| | | * |
| | | * @param key ç§é¥ |
| | | * @param cusid éèåé
çåæ·å· |
| | | * @param appid éèåé
çappid |
| | | * @param orderid 订åid |
| | | * @param agreeid åè®®id |
| | | * @param thpinfo 交æéä¼ ä¿¡æ¯ï¼æ¯ä»ç³è¯·æ¥å£è¿åï¼ |
| | | * @Author: lc |
| | | * @Date: 2019/8/27 15:25 |
| | | */ |
| | | public static String paysmsagree(String key, String cusid, String appid, String orderid, String agreeid, String thpinfo) { |
| | | Map paramMap = new HashMap(); |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("signtype", "RSA"); |
| | | paramMap.put("orderid", orderid); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("agreeid", agreeid); |
| | | |
| | | if (StrUtil.isNotEmpty(thpinfo)) { |
| | | paramMap.put("thpinfo", thpinfo); |
| | | } |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | System.out.println("is paysmsagree url:" + SybPayUrl.PAYSMSAGREE_URL); |
| | | System.out.println("is paysmsagree param:" + JSONUtil.toJsonStr(paramMap)); |
| | | String result = HttpUtil.post(SybPayUrl.PAYSMSAGREE_URL, paramMap); |
| | | System.out.println("is paysmsagree result:" + result); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢äº¤æç»æ |
| | | * |
| | | * @param key ç§é¥ |
| | | * @param cusid éèåé
çåæ·å· |
| | | * @param appid éèåé
çappid |
| | | * @param orderid 订åid |
| | | * @param transactionId å¹³å°è®¢å |
| | | */ |
| | | public static String query(String key, String cusid, String appid, |
| | | String orderid, String transactionId) { |
| | | Map paramMap = new HashMap(); |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("reqsn", orderid); |
| | | //æ¶é¶å®äº¤æåå· |
| | | paramMap.put("trxid", transactionId); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("signtype", "RSA"); |
| | | |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(key, signStr, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | paramMap.put("sign", sign); |
| | | String result = HttpUtil.post(SybPayUrl.QUERY_URL, paramMap); |
| | | System.out.println("is query result:" + result); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * å°Mapä¸çæ°æ®è½¬æ¢ææç
§Keyçasciiç æåºåçkey1=value1&key2=value2çå½¢å¼ |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | private static String coverMap2String(Map<String, String> data) { |
| | | TreeMap<String, String> tree = new TreeMap<String, String>(); |
| | | Iterator<Map.Entry<String, String>> it = data.entrySet().iterator(); |
| | | while (it.hasNext()) { |
| | | Map.Entry<String, String> en = it.next(); |
| | | tree.put(en.getKey(), en.getValue()); |
| | | } |
| | | it = tree.entrySet().iterator(); |
| | | StringBuffer sf = new StringBuffer(512); |
| | | while (it.hasNext()) { |
| | | Map.Entry<String, String> en = it.next(); |
| | | String value = en.getValue(); |
| | | if (StringUtils.isBlank(value)) { |
| | | continue; |
| | | } |
| | | sf.append(en.getKey() + "=" + Convert.toStr(value) |
| | | + "&"); |
| | | } |
| | | return sf.substring(0, sf.length() - 1); |
| | | } |
| | | |
| | | public static String getMerchantPayResult(String appId, String cusId, String key, String id, Date createTime, String orgId) { |
| | | //ç»è£
æ°æ® |
| | | Map paramMap = new HashMap(); |
| | | if (PropertiesConstants.PAY_TYPE == 1) { |
| | | paramMap.put("appid", tlappId); |
| | | } else { |
| | | paramMap.put("appid", appId); |
| | | } |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("cusid", cusId); |
| | | paramMap.put("resendnotify", "0"); |
| | | paramMap.put("signtype", "MD5"); |
| | | paramMap.put("orderid", id); |
| | | paramMap.put("orgid", orgId); |
| | | DateFormat format = new SimpleDateFormat("MMdd"); |
| | | paramMap.put("trxdate", format.format(createTime)); |
| | | paramMap.put("key", key); |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = DigestUtil.md5Hex(signStr).toUpperCase(Locale.ENGLISH); |
| | | paramMap.put("sign", sign); |
| | | paramMap.remove("key"); |
| | | String result = ""; |
| | | System.out.println(paramMap.toString()); |
| | | //èµ°æå¡è°ç¨ |
| | | if (ServiceConstants.SERVICE_TYPE) { |
| | | String url = ServiceConstants.MERCHANT_PAY_RESULT; |
| | | result = HttpUtil.post(url, paramMap); |
| | | } else { |
| | | result = HttpUtil.post(SybPayUrl.MERCHANT_PAY_RESULT, paramMap); |
| | | } |
| | | System.out.println(result); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * å忝仿å¨åè° |
| | | * |
| | | * @param cusorderid |
| | | * @param trxid |
| | | * @param trxstatus |
| | | */ |
| | | public static void callBack(String cusorderid, String trxid, String trxstatus) { |
| | | String url = SybPayUrl.SHOP_CALL_BACK; |
| | | HashMap paramMap = new HashMap(); |
| | | paramMap.put("cusorderid", cusorderid); |
| | | paramMap.put("trxid", trxid); |
| | | paramMap.put("trxstatus", trxstatus); |
| | | HttpUtil.get(url, paramMap); |
| | | } |
| | | |
| | | public static PrivateKey getPrivateKeyFromPKCS8(String algorithm, |
| | | byte[] encodedKey) throws Exception { |
| | | |
| | | KeyFactory keyFactory = KeyFactory.getInstance(algorithm); |
| | | |
| | | return keyFactory.generatePrivate(new PKCS8EncodedKeySpec(encodedKey)); |
| | | } |
| | | |
| | | public static String rsaSign(String content, String privateKey, |
| | | String charset) throws Exception { |
| | | PrivateKey priKey = getPrivateKeyFromPKCS8("RSA", |
| | | org.apache.commons.codec.binary.Base64.decodeBase64(privateKey.getBytes())); |
| | | return rsaSign(content, priKey, charset); |
| | | } |
| | | |
| | | public static String rsaSign(String content, byte[] privateKey, |
| | | String charset) throws Exception { |
| | | PrivateKey priKey = getPrivateKeyFromPKCS8("RSA", privateKey); |
| | | return rsaSign(content, priKey, charset); |
| | | } |
| | | |
| | | public static String rsaSign(String content, PrivateKey priKey, |
| | | String charset) throws Exception { |
| | | Signature signature = Signature |
| | | .getInstance("SHA1WithRSA"); |
| | | signature.initSign(priKey); |
| | | if (charset == null || "".equals(charset)) { |
| | | signature.update(content.getBytes()); |
| | | } else { |
| | | signature.update(content.getBytes(charset)); |
| | | } |
| | | byte[] signed = signature.sign(); |
| | | String signStr = new String(Base64.encodeBase64(signed)); |
| | | System.out.println("ææï¼" + content); |
| | | System.out.println("坿ï¼" + signStr); |
| | | return signStr; |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦ä½ä¿¡ç¨å¡ |
| | | * |
| | | * @param cardNo |
| | | * @return true ä¿¡ç¨å¡ false å¨èå¡ null å¡å·ä¸æ£ç¡® |
| | | */ |
| | | public static Boolean checkCardType(String cardNo) { |
| | | String resp = HttpUtil.get(checkCardUrl + cardNo, 30000); |
| | | System.out.println(resp); |
| | | try { |
| | | JSONObject jsonObject = JSONObject.parseObject(resp); |
| | | if (jsonObject.getBooleanValue("validated")) { |
| | | return "CC".equals(jsonObject.getString("cardType")); |
| | | } |
| | | return null; |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åæ·è¿ä»¶ |
| | | * |
| | | * @param merchantAddParam |
| | | * @param key 忷坹åºçkey |
| | | * @return |
| | | */ |
| | | public static CommonResult merchantAdd(MerchantAddParam merchantAddParam, String key) { |
| | | CommonResult validResult |
| | | = validMerchantAddParam(merchantAddParam); |
| | | if (validResult.getStatus() == CommonResult.STATUS_ERR) { |
| | | return validResult; |
| | | } |
| | | Map paramMap = new HashMap<String, String>(); |
| | | Field[] merchantAddFields = MerchantAddParam.class.getDeclaredFields(); |
| | | try { |
| | | for (Field field : merchantAddFields) { |
| | | String fieldName = field.getName(); |
| | | field.setAccessible(true); |
| | | Object o = field.get(merchantAddParam); |
| | | if (o != null) { |
| | | paramMap.put(fieldName, o); |
| | | } |
| | | } |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("signtype", "RSA"); |
| | | paramMap.put("version", version); |
| | | |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | paramMap.remove("key"); |
| | | System.out.println("åæ·è¿ä»¶åæ° -->" + JSONUtil.toJsonStr(paramMap)); |
| | | System.out.println("åæ·è¿ä»¶åæ° signStr -->" + signStr); |
| | | String result = ""; |
| | | result = HttpUtil.post(SybPayUrl.SYB_MERCHANT_ADD_URL, paramMap); |
| | | System.out.println("åæ·è¿ä»¶è¿åå¼ -->" + result); |
| | | Map resultMap = JSON.parseObject(result); |
| | | String retcode = Convert.toStr(resultMap.get("retcode")); |
| | | if ("success".equalsIgnoreCase(retcode)) { |
| | | |
| | | return new CommonResult(result); |
| | | } else { |
| | | return new CommonResult(CommonResultEmnu.ERROR, Convert.toStr(resultMap.get("retmsg"))); |
| | | } |
| | | } |
| | | |
| | | /*** |
| | | * åæ·å®¡æ ¸ç¶ææ¥è¯¢ |
| | | * @param |
| | | * @param merchantid ä¸å¡ç³»ç»çid |
| | | * @return |
| | | */ |
| | | public static CommonResult<Map<String, String>> merchantAddStatusQuery(String orgid, String cusid, String appid, String key, String merchantid) { |
| | | Map paramMap = new HashMap<String, String>(); |
| | | paramMap.put("orgid", orgid); |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("signtype", "RSA"); |
| | | paramMap.put("merchantid", merchantid); |
| | | |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | paramMap.remove("key"); |
| | | System.out.println("åæ·è¿ä»¶ åæ·å®¡æ ¸ç¶æ æ¥è¯¢åæ° -->" + JSONUtil.toJsonStr(paramMap)); |
| | | String result = ""; |
| | | result = HttpUtil.post(SybPayUrl.SYB_MERCHANT_ADD_QUERYSTATUS_URL, paramMap); |
| | | System.out.println("åæ·è¿ä»¶ åæ·å®¡æ ¸ç¶æ è¿åå¼ -->" + result); |
| | | Map resultMap = JSON.parseObject(result); |
| | | String retcode = Convert.toStr(resultMap.get("retcode")); |
| | | if ("success".equalsIgnoreCase(retcode)) { |
| | | return new CommonResult(resultMap); |
| | | } else { |
| | | return new CommonResult(CommonResultEmnu.ERROR, Convert.toStr(resultMap.get("retmsg"))); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 2.20 微信/æ¯ä»å®è®¤è¯ç¶ææ¥è¯¢ |
| | | * |
| | | * @param orgid |
| | | * @param cusid |
| | | * @param appid |
| | | * @param key |
| | | * @param chnltype æ¸ éç±»å 使ç¨ä¸æå¤§å缩å 微信ï¼WXP æ¯ä»å®:ALP |
| | | * @param pid 产åç±»å P0001ãP0002ãP0003 ==> æ¶é¶å®ãå½é¢ä»ãç½ä¸æ¶é¶ |
| | | * @return |
| | | */ |
| | | public static CommonResult<Map<String, String>> merchantAddQueryWxVerifyState(String orgid, String cusid, String appid, String key, String chnltype, String pid) { |
| | | Map paramMap = new HashMap<String, String>(); |
| | | paramMap.put("orgid", orgid); |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("signtype", "RSA"); |
| | | paramMap.put("chnltype", chnltype); |
| | | |
| | | if (StringUtils.isNotBlank(pid)) { |
| | | paramMap.put("pid", pid); |
| | | } |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | paramMap.remove("key"); |
| | | System.out.println("微信/æ¯ä»å®è®¤è¯ç¶ææ¥è¯¢ æ¥è¯¢åæ° -->" + JSONUtil.toJsonStr(paramMap)); |
| | | String result = ""; |
| | | result = HttpUtil.post(SybPayUrl.SYB_MERCHANT_ADD_QUERYWXVERIFYSTATE_URL, paramMap); |
| | | System.out.println("微信/æ¯ä»å®è®¤è¯ç¶ææ¥è¯¢ è¿åå¼ -->" + result); |
| | | Map resultMap = JSON.parseObject(result); |
| | | String retcode = Convert.toStr(resultMap.get("retcode")); |
| | | if ("success".equalsIgnoreCase(retcode)) { |
| | | return new CommonResult(resultMap); |
| | | } else { |
| | | return new CommonResult(CommonResultEmnu.ERROR, Convert.toStr(resultMap.get("retmsg"))); |
| | | } |
| | | } |
| | | |
| | | /*** |
| | | * ç¨äºå¯¹åæ°ç¾åï¼çæå¯è®¿é®çæ¶é¶å
url |
| | | * åè§æ§å®¡æ ¸è¡¥å½ç»ä¸h5æ¥å£ ã 认è¯ç»ä¸H5 å
±ç¨ |
| | | * @param |
| | | * @return |
| | | */ |
| | | public static String merchantAddUrlSign(String orgid, String cusid, String appid, String key, String urlPrefix, String userid, String notifyurl, String pagetype) { |
| | | Map paramMap = new HashMap<String, String>(); |
| | | paramMap.put("orgid", orgid); |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("signtype", "RSA"); |
| | | |
| | | if (StringUtils.isNotBlank(userid)) { |
| | | paramMap.put("userid", userid); |
| | | } |
| | | if (StringUtils.isNotBlank(notifyurl)) { |
| | | paramMap.put("notifyurl", notifyurl); |
| | | } |
| | | if (StringUtils.isNotBlank(pagetype)) { |
| | | paramMap.put("pagetype", pagetype); |
| | | } |
| | | |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | paramMap.remove("key"); |
| | | System.out.println("urlç¾å æ¥è¯¢åæ° -->" + JSONUtil.toJsonStr(paramMap)); |
| | | String result = urlPrefix + "?" + signStr + "&sign=" + sign; |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /*** |
| | | * æ 纸åè¿ä»¶åè®®ç¾çº¦ç¶ææ¥è¯¢ |
| | | * @param electsigntype 01/03 01表示æ¶é¶å®ä¸å¡åè®® 03表示ç»ç®å§æåè®®ï¼åæ·æ§è´¨æ¯ä¼ä¸ä¸ç»ç®è´¦æ·å¯¹ç§ï¼ |
| | | * @return |
| | | */ |
| | | public static CommonResult<Map<String, String>> merchantElectSignQuery(String orgid, String cusid, String appid, String key, String electsigntype) { |
| | | Map paramMap = new HashMap<String, String>(); |
| | | paramMap.put("orgid", orgid); |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("signtype", "RSA"); |
| | | paramMap.put("electsigntype", electsigntype); |
| | | |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | paramMap.remove("key"); |
| | | System.out.println("æ 纸åè¿ä»¶åè®®ç¾çº¦ç¶ææ¥è¯¢ æ¥è¯¢åæ° -->" + JSONUtil.toJsonStr(paramMap)); |
| | | String result = ""; |
| | | result = HttpUtil.post(SybPayUrl.SYB_MERCHANT_ADD_QUERYELECTSIGN_URL, paramMap); |
| | | System.out.println("æ 纸åè¿ä»¶åè®®ç¾çº¦ç¶ææ¥è¯¢ è¿åå¼ -->" + result); |
| | | Map resultMap = JSON.parseObject(result); |
| | | String retcode = Convert.toStr(resultMap.get("retcode")); |
| | | if ("success".equalsIgnoreCase(retcode)) { |
| | | return new CommonResult(resultMap); |
| | | } else { |
| | | return new CommonResult(CommonResultEmnu.ERROR, Convert.toStr(resultMap.get("retmsg"))); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åè§æ§ç¶ææ¥è¯¢æ¥å£ |
| | | * åæ·åè§æ§ç¶ææ¥è¯¢ï¼æ ¹æ®éèåæ·å·æ¥è¯¢åæ·å¯¹åºåè§æ§ç¶æ |
| | | * |
| | | * @param orgid |
| | | * @param cusid |
| | | * @param appid |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public static CommonResult<Map<String, String>> merchantAddQueryCusrGc(String orgid, String cusid, String appid, String key) { |
| | | Map paramMap = new HashMap<String, String>(); |
| | | paramMap.put("orgid", orgid); |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("signtype", "RSA"); |
| | | |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | paramMap.remove("key"); |
| | | System.out.println("åè§æ§ç¶ææ¥è¯¢æ¥å£ æ¥è¯¢åæ° -->" + JSONUtil.toJsonStr(paramMap)); |
| | | String result = ""; |
| | | result = HttpUtil.post(SybPayUrl.SYB_MERCHANT_ADD_QUERYCUSRGC_URL, paramMap); |
| | | System.out.println("åè§æ§ç¶ææ¥è¯¢æ¥å£ è¿åå¼ -->" + result); |
| | | Map resultMap = JSON.parseObject(result); |
| | | String retcode = Convert.toStr(resultMap.get("retcode")); |
| | | if ("success".equalsIgnoreCase(retcode)) { |
| | | return new CommonResult(resultMap); |
| | | } else { |
| | | return new CommonResult(CommonResultEmnu.ERROR, Convert.toStr(resultMap.get("retmsg"))); |
| | | } |
| | | } |
| | | |
| | | /*** |
| | | * æ 纸åè¿ä»¶åè®®éåæ¥å£ |
| | | * @return |
| | | */ |
| | | public static CommonResult<Map<String, String>> merchantElectSign(String orgid, String cusid, String appid, String key) { |
| | | Map paramMap = new HashMap<String, String>(); |
| | | paramMap.put("orgid", orgid); |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("signtype", "RSA"); |
| | | |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | paramMap.remove("key"); |
| | | System.out.println("æ 纸åè¿ä»¶åè®®éåæ¥å£ æ¥è¯¢åæ° -->" + JSONUtil.toJsonStr(paramMap)); |
| | | String result = ""; |
| | | result = HttpUtil.post(SybPayUrl.SYB_MERCHANT_ADD_ELECTSIGN_URL, paramMap); |
| | | System.out.println("æ 纸åè¿ä»¶åè®®éåæ¥å£ è¿åå¼ -->" + result); |
| | | Map resultMap = JSON.parseObject(result); |
| | | String retcode = Convert.toStr(resultMap.get("retcode")); |
| | | if ("success".equalsIgnoreCase(retcode)) { |
| | | return new CommonResult(resultMap); |
| | | } else { |
| | | return new CommonResult(CommonResultEmnu.ERROR, Convert.toStr(resultMap.get("retmsg"))); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * æ 纸åè¿ä»¶çµååè®®URLæ¥å£æ¥è¯¢ |
| | | * |
| | | * @param orgid |
| | | * @param cusid |
| | | * @param appid |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public static CommonResult merchantQueryElecturl(String orgid, String cusid, String appid, String key, String redirecturl) { |
| | | Map paramMap = new HashMap<String, String>(); |
| | | paramMap.put("orgid", orgid); |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("signtype", "RSA"); |
| | | paramMap.put("redirecturl", redirecturl); |
| | | |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(signStr, key, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | paramMap.remove("key"); |
| | | System.out.println("æ 纸åè¿ä»¶çµååè®®URLæ¥å£æ¥è¯¢ æ¥è¯¢åæ° -->" + JSONUtil.toJsonStr(paramMap)); |
| | | String result = ""; |
| | | result = HttpUtil.post(SybPayUrl.SYB_MERCHANT_ADD_QUERYELECTURL_URL, paramMap); |
| | | System.out.println("æ 纸åè¿ä»¶çµååè®®URLæ¥å£æ¥è¯¢ è¿åå¼ -->" + result); |
| | | Map resultMap = JSON.parseObject(result); |
| | | String retcode = Convert.toStr(resultMap.get("retcode")); |
| | | if ("success".equalsIgnoreCase(retcode)) { |
| | | return new CommonResult(result); |
| | | } else { |
| | | return new CommonResult(CommonResultEmnu.ERROR, Convert.toStr(resultMap.get("retmsg"))); |
| | | } |
| | | } |
| | | |
| | | |
| | | private static CommonResult validMerchantAddParam(MerchantAddParam merchantAddParam) { |
| | | if (merchantAddParam == null) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS); |
| | | } |
| | | if (StringUtils.isBlank(merchantAddParam.getRandomstr())) { |
| | | merchantAddParam.setRandomstr(IdGenerator.getUUID()); |
| | | } |
| | | if (StringUtils.isBlank(merchantAddParam.getSigntype())) { |
| | | merchantAddParam.setSigntype("RSA"); |
| | | } |
| | | // *åæ·æ§è´¨ |
| | | //1.ä¼ä¸ 3.ä¸ªä½æ· 4.个人 6.äºä¸åä½ |
| | | String comproperty = merchantAddParam.getComproperty(); |
| | | if (StringUtils.isBlank(comproperty)) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "åæ·æ§è´¨éè¦å¡«å"); |
| | | } |
| | | //åæ·æ§è´¨ä¸ºä¼ä¸ |
| | | // if ("1".equals(comproperty)) { |
| | | // if (StringUtils.isBlank(merchantAddParam.getPubacctinfo())) { |
| | | // return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "åæ·æ§è´¨ä¸ºä¼ä¸æ¶éè¦å¡«å对å
¬è´¦æ·ä¿¡æ¯"); |
| | | // } |
| | | // } |
| | | //åæ·æ§è´¨ä¸ºä¸ªäººæ¶å¿
å¡« |
| | | if ("4".equals(comproperty)) { |
| | | if (StringUtils.isBlank(merchantAddParam.getLegalpic())) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "åæ·æ§è´¨é个人æ¶éè¦ä¸ä¼ ç»è¥è
ææèº«ä»½è¯ç
§ç"); |
| | | } |
| | | } |
| | | if (!"4".equals(comproperty)) { |
| | | if (StringUtils.isBlank(merchantAddParam.getCorpbusname())) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "åæ·æ§è´¨é个人æ¶éè¦å¡«åè¥ä¸æ§ç
§åç§°"); |
| | | } |
| | | if (StringUtils.isBlank(merchantAddParam.getCreditcode())) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "åæ·æ§è´¨é个人æ¶éè¦å¡«åç»ä¸ç¤¾ä¼ä¿¡ç¨ä»£ç è¯"); |
| | | } |
| | | if (StringUtils.isBlank(merchantAddParam.getCreditcodeexpire())) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "åæ·æ§è´¨é个人æ¶éè¦å¡«å社ä¼ä¿¡ç¨ä»£ç è¯æææ"); |
| | | } |
| | | if (StringUtils.isBlank(merchantAddParam.getCorpbuspic())) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "åæ·æ§è´¨é个人æ¶éè¦å¡«åè¥ä¸æ§ç
§ç
§ç"); |
| | | } |
| | | |
| | | if (StringUtils.isBlank(merchantAddParam.getBusconactperson())) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "åæ·æ§è´¨é个人æ¶éè¦å¡«åä¸å¡è系人å§å"); |
| | | } |
| | | if (StringUtils.isBlank(merchantAddParam.getBusconacttel())) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "åæ·æ§è´¨é个人æ¶éè¦å¡«åä¸å¡è系人çµè¯"); |
| | | } |
| | | } |
| | | |
| | | //åæ·æ§è´¨ä¸ºä¼ä¸ãä¸ªä½æ·æ¶å¿
å¡« |
| | | if ("1".equals(comproperty) || "3".equals(comproperty)) { |
| | | if (StringUtils.isBlank(merchantAddParam.getHoldername())) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "åæ·æ§è´¨ä¸ºä¼ä¸ãä¸ªä½æ·æ¶éè¦å¡«åæ§è¡è¡ä¸å§å"); |
| | | } |
| | | if (StringUtils.isBlank(merchantAddParam.getHolderidno())) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "åæ·æ§è´¨ä¸ºä¼ä¸ãä¸ªä½æ·æ¶éè¦å¡«åæ§è¡è¡ä¸èº«ä»½è¯"); |
| | | } |
| | | if (StringUtils.isBlank(merchantAddParam.getHolderexpire())) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "åæ·æ§è´¨ä¸ºä¼ä¸ãä¸ªä½æ·æ¶éè¦å¡«åæ§è¡è¡ä¸æææ"); |
| | | } |
| | | if (StringUtils.isBlank(merchantAddParam.getRegisterfund())) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "åæ·æ§è´¨ä¸ºä¼ä¸ãä¸ªä½æ·æ¶éè¦å¡«å注åèµæ¬"); |
| | | } |
| | | if (StringUtils.isBlank(merchantAddParam.getStafftotal())) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "åæ·æ§è´¨ä¸ºä¼ä¸ãä¸ªä½æ·æ¶éè¦å¡«åå工人æ°"); |
| | | } |
| | | if (StringUtils.isBlank(merchantAddParam.getOperatelimit())) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "åæ·æ§è´¨ä¸ºä¼ä¸ãä¸ªä½æ·æ¶éè¦å¡«åç»è¥åºå"); |
| | | } |
| | | if (StringUtils.isBlank(merchantAddParam.getInspect())) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "åæ·æ§è´¨ä¸ºä¼ä¸ãä¸ªä½æ·æ¶éè¦å¡«åç»è¥å°æ®µ"); |
| | | } |
| | | |
| | | } |
| | | // if (StringUtils.isBlank(merchantAddParam.getAddfacusid())) { |
| | | // return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "æå¨æºæèµéå½éæ¶ï¼è¯¥å段ä¸è½ä¸ºç©º"); |
| | | // } |
| | | |
| | | // ç»ç®è´¦æ· 0-å¯¹ç§ 1-对å
¬ |
| | | String accttype = merchantAddParam.getAccttype(); |
| | | if (StringUtils.isBlank(accttype)) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "ç»ç®è´¦æ·ç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | if ("0".equals(accttype)) { |
| | | if (StringUtils.isBlank(merchantAddParam.getSettidno())) { |
| | | return new CommonResult(CommonResultEmnu.INVALID_PARAMS, "ç»ç®è´¦æ·å¯¹ç§æ¶ï¼ç»ç®äººèº«ä»½è¯å·ä¸è½ä¸ºç©º"); |
| | | } |
| | | } |
| | | return new CommonResult(); |
| | | } |
| | | |
| | | public static CommonResult<Map> uploadfile(String orgid, String cusid, String appid, String key, String ftpFilePath) throws Exception { |
| | | Map paramMap = new HashMap(); |
| | | paramMap.put("orgid", orgid); |
| | | paramMap.put("cusid", cusid); |
| | | paramMap.put("appid", appid); |
| | | paramMap.put("version", version); |
| | | |
| | | paramMap.put("randomstr", IdGenerator.getUUID()); |
| | | paramMap.put("signtype", "RSA"); |
| | | paramMap.put("filetype", "jpg"); |
| | | |
| | | String signStr = coverMap2String(paramMap); |
| | | String sign = null; |
| | | try { |
| | | sign = SybPayUtil.rsaSign(key, signStr, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | paramMap.put("sign", sign); |
| | | |
| | | System.out.println("ä¸ä¼ æä»¶åæ° -->" + JSONUtil.toJsonStr(paramMap)); |
| | | String result = dorequest(SybPayUrl.SYB_FILE_UPLOAD_URL, paramMap, ftpFilePath); |
| | | System.out.println("ä¸ä¼ æä»¶ è¿åå¼ -->" + result); |
| | | CommonResult<Map> mapCommonResult = handleResult(result); |
| | | return mapCommonResult; |
| | | } |
| | | |
| | | /** |
| | | * åªåretcode 夿 ä¸åä¸å¡ç¶æå¤æ |
| | | * |
| | | * @param result |
| | | * @return |
| | | */ |
| | | private static CommonResult<Map> handleResult(String result) { |
| | | Map resultMap = JSONObject.parseObject(result, Map.class); |
| | | String retcode = Convert.toStr(resultMap.get("retcode")); |
| | | if ("success".equalsIgnoreCase(retcode)) { |
| | | return new CommonResult(resultMap); |
| | | } else { |
| | | return new CommonResult(CommonResultEmnu.ERROR, Convert.toStr(resultMap.get("retmsg"))); |
| | | } |
| | | } |
| | | |
| | | private static String dorequest(String url, Map<String, String> params, String path) { |
| | | CloseableHttpClient httpClient = null; |
| | | CloseableHttpResponse response = null; |
| | | try { |
| | | httpClient = HttpClients.createDefault(); |
| | | // æä¸ä¸ªæ®éåæ°åæä»¶ä¸ä¼ ç»ä¸é¢è¿ä¸ªå°å æ¯ä¸ä¸ªservlet |
| | | HttpPost httpPost = new HttpPost(url); |
| | | // ææä»¶è½¬æ¢ææµå¯¹è±¡FileBody |
| | | FileBody bin = new FileBody(new File(path)); |
| | | MultipartEntityBuilder builder = MultipartEntityBuilder.create(); |
| | | builder.addPart("filecontent", bin); |
| | | for (Map.Entry<String, String> entry : params.entrySet()) { |
| | | builder.addTextBody(entry.getKey(), entry.getValue()); |
| | | } |
| | | httpPost.setEntity(builder.build()); |
| | | // åèµ·è¯·æ± å¹¶è¿å请æ±çååº |
| | | response = httpClient.execute(httpPost); |
| | | // è·åååºå¯¹è±¡ |
| | | HttpEntity resEntity = response.getEntity(); |
| | | if (resEntity != null) { |
| | | String result = EntityUtils.toString(resEntity, Charset.forName("UTF-8")); |
| | | return result; |
| | | } |
| | | // 鿝 |
| | | EntityUtils.consume(resEntity); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | if (response != null) { |
| | | response.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | try { |
| | | if (httpClient != null) { |
| | | httpClient.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * éªç¾ |
| | | * @param param åæ° |
| | | * @param appKey appKey |
| | | * @param signType å å¯ç±»å |
| | | * @return ç»æ |
| | | */ |
| | | public static boolean validSign(TreeMap<String, String> param, |
| | | String appKey, String signType) { |
| | | if (param == null || param.isEmpty()) { |
| | | return false; |
| | | } |
| | | if (!param.containsKey("sign")) { |
| | | return false; |
| | | } |
| | | String sign = param.remove("sign"); |
| | | if ("MD5".equals(signType)) {// 妿æ¯md5åéè¦æmd5çkeyå å
¥å°æåº |
| | | param.put("key", appKey); |
| | | } |
| | | String paramStr = content(param); |
| | | byte[] paramByteArr = getByteUtf8(paramStr); |
| | | if ("MD5".equals(signType)) { |
| | | return sign.equalsIgnoreCase( |
| | | md5(paramByteArr)); |
| | | } else if("SM2".equals(signType)){ |
| | | PublicKey publicKey; |
| | | try { |
| | | publicKey = pubKeySM2FromBase64Str(appKey); |
| | | } catch (GeneralSecurityException e) { |
| | | return false; |
| | | } |
| | | return verifySM3SM2(publicKey, decodeBase64(sign), paramByteArr); |
| | | }else { |
| | | return rsaVerifyPublicKey(paramStr, sign, appKey); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å
¬é¥éªç¾ |
| | | * @param content å
容 |
| | | * @param sign ç¾å |
| | | * @param publicKey å
¬é¥key |
| | | * @return ç»æ |
| | | */ |
| | | private static boolean rsaVerifyPublicKey(String content, String sign, |
| | | String publicKey) { |
| | | |
| | | PublicKey pubKey; |
| | | try { |
| | | pubKey = getPublicKeyFromX509("RSA", |
| | | Base64.decodeBase64(publicKey.getBytes())); |
| | | } catch (GeneralSecurityException e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | return rsaVerifyPublicKey(content, sign, pubKey); |
| | | } |
| | | |
| | | /** |
| | | * å
¬é¥éªç¾ |
| | | * @param content å
容 |
| | | * @param sign ç¾å |
| | | * @param pubKey å
¬é¥ |
| | | * @return ç»æ |
| | | */ |
| | | public static boolean rsaVerifyPublicKey(String content, String sign, |
| | | PublicKey pubKey) { |
| | | Signature signature; |
| | | try { |
| | | signature = Signature |
| | | .getInstance("SHA1WithRSA"); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | return false; |
| | | } |
| | | try { |
| | | signature.initVerify(pubKey); |
| | | } catch (InvalidKeyException e) { |
| | | return false; |
| | | } |
| | | try { |
| | | signature.update(getByteUtf8(content)); |
| | | } catch (SignatureException e) { |
| | | return false; |
| | | } |
| | | try { |
| | | return signature.verify(decodeBase64(sign)); |
| | | } catch (SignatureException e) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¼æ¥éªç¾/å ç¾å
容 |
| | | * @param param åæ° |
| | | * @return éªç¾/å ç¾å符串 |
| | | */ |
| | | private static String content(TreeMap<String, String> param) { |
| | | //noinspection DuplicatedCode |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (Map.Entry<String, String> entry : param.entrySet()) { |
| | | if (entry.getValue() != null && entry.getValue().length() > 0) { |
| | | sb.append(entry.getKey()).append("=") |
| | | .append(entry.getValue()).append("&"); |
| | | } |
| | | } |
| | | if (sb.length() > 0) { |
| | | sb.deleteCharAt(sb.length() - 1); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * md5 |
| | | * |
| | | * @param b å å¯å符é |
| | | * @return å å¯å符串 |
| | | */ |
| | | public static String md5(byte[] b) { |
| | | try { |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | md.reset(); |
| | | md.update(b); |
| | | byte[] hash = md.digest(); |
| | | StringBuilder outStrBuf = new StringBuilder(32); |
| | | for (byte value : hash) { |
| | | int v = value & 0xFF; |
| | | if (v < 16) { |
| | | outStrBuf.append('0'); |
| | | } |
| | | outStrBuf.append(Integer.toString(v, 16).toLowerCase()); |
| | | } |
| | | return outStrBuf.toString(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | return new String(b); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åå§åå
¬é¥ |
| | | * @param algorithm æå®å
¬é¥ç®æ³ |
| | | * @return å
¬é¥ |
| | | * @throws GeneralSecurityException åå§åå¼å¸¸ |
| | | */ |
| | | public static PublicKey getPublicKeyFromX509(String algorithm, |
| | | byte[] encodedKey) throws GeneralSecurityException { |
| | | KeyFactory keyFactory = KeyFactory.getInstance(algorithm); |
| | | |
| | | return keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); |
| | | } |
| | | |
| | | /** |
| | | * åå§åå
¬é¥ |
| | | * @param keyStr å
¬é¥å符串 |
| | | * @return å
¬é¥ |
| | | * @throws GeneralSecurityException åå§åå¼å¸¸ |
| | | */ |
| | | public static PublicKey pubKeySM2FromBase64Str(String keyStr) throws GeneralSecurityException { |
| | | // KeyFactory keyFactory = KeyFactory.getInstance("EC"); |
| | | // return keyFactory.generatePublic(new X509EncodedKeySpec(decodeBase64(keyStr))); |
| | | return getPublicKeyFromX509("EC", decodeBase64(keyStr)); |
| | | } |
| | | |
| | | /** |
| | | * base64åèæ°ç» |
| | | * @param str å符串 |
| | | * @return åèæ°ç» |
| | | */ |
| | | private static byte[] decodeBase64(String str) { |
| | | return Base64.decodeBase64(str.getBytes(StandardCharsets.UTF_8)); |
| | | } |
| | | |
| | | /** |
| | | * 转byte |
| | | * @param str å符串 |
| | | * @return åèæ°ç» |
| | | */ |
| | | private static byte[] getByteUtf8(String str) { |
| | | if (str == null) { |
| | | return new byte[0]; |
| | | } |
| | | return str.getBytes(StandardCharsets.UTF_8); |
| | | } |
| | | |
| | | /** éªè¯ç¾å-SM3WithSM2*/ |
| | | private static boolean verifySM3SM2(final PublicKey publicKey,final byte[] signData, final byte[] srcData) { |
| | | SM2ParameterSpec parameterSpec = new SM2ParameterSpec(getByteUtf8("Allinpay")); |
| | | Signature verifier; |
| | | try { |
| | | verifier = Signature.getInstance(ALGORITHM_SM3SM2_BCPROV, "BC"); |
| | | } catch (NoSuchAlgorithmException | NoSuchProviderException e) { |
| | | return false; |
| | | } |
| | | try { |
| | | verifier.setParameter(parameterSpec); |
| | | verifier.initVerify(publicKey); |
| | | verifier.update(srcData); |
| | | return verifier.verify(bytePlain2ByteAsn1(signData)); |
| | | } catch (GeneralSecurityException e) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å°æ®éåèæ°ç»è½¬æ¢ä¸ºASN1åèæ°ç» éç¨äºSM3withSM2éªç¾æ¶éªç¾ææè½¬æ¢ |
| | | */ |
| | | private static byte[] bytePlain2ByteAsn1(byte[] data) { |
| | | if (data.length != SM3withSM2_RS_LEN * 2) { |
| | | throw new RuntimeException("err data. "); |
| | | } |
| | | BigInteger r = new BigInteger(1, Arrays.copyOfRange(data, 0, SM3withSM2_RS_LEN)); |
| | | BigInteger s = new BigInteger(1, Arrays.copyOfRange(data, SM3withSM2_RS_LEN, SM3withSM2_RS_LEN * 2)); |
| | | ASN1EncodableVector v = new ASN1EncodableVector(); |
| | | v.add(new ASN1Integer(r)); |
| | | v.add(new ASN1Integer(s)); |
| | | try { |
| | | return new DERSequence(v).getEncoded("DER"); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.syb.param; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @ClassName MerchantAdd |
| | | * @Author cy |
| | | * @Date 2023/6/13 |
| | | * @Description åæ·è¿ä»¶åæ° |
| | | * @Version 1.0 |
| | | **/ |
| | | @Data |
| | | public class MerchantAddParam { |
| | | /** |
| | | *æºæå· |
| | | *éèåé
ç代çåå·* |
| | | * |
| | | */ |
| | | private String orgid; |
| | | /** |
| | | *åæ·å· |
| | | *éèåé
çåæ·å·* |
| | | * çäºorgid |
| | | */ |
| | | private String cusid; |
| | | /** |
| | | *åºç¨ID |
| | | *éèåé
ç代çåAPPID* |
| | | * |
| | | */ |
| | | private String appid; |
| | | /** |
| | | *éæºå符串 |
| | | *åæ·èªè¡çæçéæºå符串* |
| | | * |
| | | */ |
| | | private String randomstr; |
| | | /** |
| | | *代çååæ·å· |
| | | * 代çåå¹³å°åæ·å·* |
| | | * 代çåç³»ç»åæ·å¯ä¸è¯å«å· |
| | | */ |
| | | private String merchantid; |
| | | /** |
| | | *åæ·åç§° |
| | | ** |
| | | * |
| | | */ |
| | | private String merchantname; |
| | | /** |
| | | *åæ·ç®ç§° |
| | | ** |
| | | *æ æ§ç
§åæ·è¯·æç
§å®é
åºæçç»è¥é¨åºåç§°å¡«å |
| | | */ |
| | | private String shortname; |
| | | /** |
| | | *客æçµè¯ |
| | | ** |
| | | * |
| | | */ |
| | | private String servicephone; |
| | | /** |
| | | *æå±è¡ä¸ |
| | | *详è§éå½* |
| | | * |
| | | */ |
| | | private String mccid; |
| | | /** |
| | | *åæ·æ§è´¨ |
| | | *1.ä¼ä¸ 3.ä¸ªä½æ· 4.个人 6.äºä¸åä½ |
| | | */ |
| | | private String comproperty; |
| | | /** |
| | | * è¥ä¸æ§ç
§åç§° |
| | | * åæ·æ§è´¨é个人æ¶éè¦å¡«å |
| | | */ |
| | | private String corpbusname; |
| | | /** |
| | | * ç»ä¸ç¤¾ä¼ä¿¡ç¨ä»£ç è¯ |
| | | * åæ·æ§è´¨é个人æ¶éè¦å¡«å |
| | | */ |
| | | private String creditcode; |
| | | /** |
| | | * 社ä¼ä¿¡ç¨ä»£ç è¯æææ |
| | | * åæ·æ§è´¨é个人æ¶éè¦å¡«å |
| | | */ |
| | | private String creditcodeexpire; |
| | | /** |
| | | * æ³äººå§å |
| | | * * |
| | | */ |
| | | private String legal; |
| | | /** |
| | | * æ³äººä»£è¡¨è¯ä»¶ç±»å |
| | | * 01ã04ã05* |
| | | * 01èº«ä»½è¯ |
| | | */ |
| | | private String legalidtype; |
| | | /** |
| | | * æ³äººä»£è¡¨è¯ä»¶å· |
| | | */ |
| | | private String legalidno; |
| | | /** |
| | | * æ³äººèº«ä»½è¯æææ |
| | | * * |
| | | *  yyyy-mm-ddæé¿æ |
| | | */ |
| | | private String legalidexpire; |
| | | /** |
| | | * 注åå°å |
| | | * * |
| | | *  注åå°åéå
å«çå¸ |
| | | */ |
| | | private String address; |
| | | /** |
| | | * åæ·è´è´£äºº |
| | | * * |
| | | * è´¢å¡èç³»äººï¼æ¶çä¿¡ç¨ï¼ |
| | | */ |
| | | private String contactperson; |
| | | /** |
| | | * åæ·è´è´£äººçµè¯ |
| | | * * |
| | | * è´¢å¡è系人çµè¯ |
| | | */ |
| | | private String contactphone; |
| | | /** |
| | | * ç»ç®æ¹å¼ |
| | | * 1* |
| | | * 0-åæ·èªä¸»æç° |
| | | */ |
| | | private String clearmode; |
| | | /** |
| | | * è´¦æ·å· |
| | | * * |
| | | */ |
| | | private String acctid; |
| | | /** |
| | | * è´¦æ·å |
| | | * * |
| | | */ |
| | | private String acctname; |
| | | /** |
| | | * è´¦æ·ç±»å |
| | | * 0|1* |
| | | * 0-å¯¹ç§ |
| | | */ |
| | | private String accttype; |
| | | /** |
| | | * å¡æç±»å |
| | | * 00|01* |
| | | * 00-åè®°å¡ |
| | | */ |
| | | private String accttp; |
| | | /** |
| | | * æå±é¶è¡ |
| | | * è§éå½* |
| | | */ |
| | | private String bankcode; |
| | | /** |
| | | * æ¯ä»è¡å· |
| | | * è§éå½* |
| | | */ |
| | | private String cnapsno; |
| | | /** |
| | | * åè°url |
| | | * è¿ä»¶æåçåè°éç¥url* |
| | | */ |
| | | private String notifyurl; |
| | | /** |
| | | * è¥ä¸æ§ç
§ç
§ç |
| | | * åæ·æ§è´¨é个人æ¶éè¦å¡«å |
| | | */ |
| | | private String corpbuspic; |
| | | /** |
| | | * æ³äººèº«ä»½è¯èåé¢ |
| | | * ç
§çurl* |
| | | *  人åé¢ |
| | | */ |
| | | private String legalidpicfront; |
| | | /** |
| | | * æ³äººèº«ä»½è¯å½å¾½é¢ |
| | | * ç
§çurl* |
| | | *  å½å¾½é¢ |
| | | */ |
| | | private String legalidpicback; |
| | | /** |
| | | * ç»è¥è
ææèº«ä»½è¯ç
§ç |
| | | * ç
§çurl* |
| | | * Â åæ·æ§è´¨ä¸ºä¸ªäººæ¶å¿
å¡« |
| | | */ |
| | | private String legalpic; |
| | | /** |
| | | * åæ·é¨å¤´ç
§ç |
| | | * ç
§çurl* |
| | | */ |
| | | private String storepic; |
| | | /** |
| | | * ç»è¥å
æ¯ç
§ç |
| | | * ç
§çurl* |
| | | */ |
| | | private String storeinnerpic; |
| | | /** |
| | | * ç»è¥åºæè¯ææä»¶ |
| | | * ä¸éäºè¥ä¸åºæç§èµåè®®æè
产æè¯æãéä¸ç»è¥åºæç®¡çæ¹åºå
·çè¯ææä»¶ç |
| | | * <p> |
| | | * åæ·æ§è´¨ä¸ªäººæ¶éè¦å¡«å |
| | | */ |
| | | private String bizplacepic; |
| | | /** |
| | | * æå±äºº |
| | | * * |
| | | */ |
| | | private String expanduser; |
| | | /** |
| | | * é¨åºä¿¡æ¯ |
| | | * é¨åºå表çjsonæ°ç»* |
| | | */ |
| | | private String subbranchlist; |
| | | /** |
| | | * æ¯ä»äº§åä¿¡æ¯å表 |
| | | * 产åå表çjsonæ°ç»* |
| | | */ |
| | | private String prodlist; |
| | | |
| | | /** |
| | | * æ¯ä»æå±ç¶å®¢æ· |
| | | * æå¨æºæèµéå½éæ¶ï¼è¯¥å段ä¸è½ä¸ºç©º |
| | | */ |
| | | private String addfacusid; |
| | | /** |
| | | * ç»ç®äººèº«ä»½è¯å· |
| | | * ç»ç®è´¦æ·å¯¹ç§æ¶ï¼ç»ç®äººèº«ä»½è¯å·ä¸è½ä¸ºç©º |
| | | */ |
| | | private String settidno; |
| | | /** |
| | | * æ§è¡è¡ä¸å§å |
| | | * åæ·æ§è´¨ä¸ºä¼ä¸ãä¸ªä½æ·æ¶å¿
å¡« |
| | | */ |
| | | private String holdername; |
| | | /** |
| | | * æ§è¡è¡ä¸èº«ä»½è¯ |
| | | * åæ·æ§è´¨ä¸ºä¼ä¸ãä¸ªä½æ·æ¶å¿
å¡« |
| | | */ |
| | | private String holderidno; |
| | | /** |
| | | * æ§è¡è¡ä¸æææ |
| | | * åæ·æ§è´¨ä¸ºä¼ä¸ãä¸ªä½æ·æ¶å¿
å¡« |
| | | */ |
| | | private String holderexpire; |
| | | /** |
| | | * 注åèµæ¬ |
| | | * 1: 注åèµæ¬<10ä¸å
|
| | | * 2: 10ä¸å
<注åèµæ¬<20ä¸å
|
| | | * 3: 20ä¸å
<注åèµæ¬<50ä¸å
|
| | | * 4: 50ä¸å
<注åèµæ¬<100ä¸å
|
| | | * 5: 注åèµæ¬>100ä¸å
|
| | | */ |
| | | private String registerfund; |
| | | /** |
| | | * åå·¥äººæ° |
| | | * *åæ·æ§è´¨ä¸ºä¼ä¸ãä¸ªä½æ·æ¶å¿
å¡« |
| | | * 1: åå·¥æ°é<10 |
| | | * 2: 10<åå·¥æ°é<20 |
| | | * 3: 20<åå·¥æ°é<50 |
| | | * 4: 50<åå·¥æ°é<100 |
| | | * 5: åå·¥æ°é>100 |
| | | */ |
| | | private String stafftotal; |
| | | /** |
| | | * ç»è¥åºå |
| | | * åæ·æ§è´¨ä¸ºä¼ä¸ãä¸ªä½æ·æ¶å¿
å¡« |
| | | * 1ï¼ååº |
| | | * 2: éåº |
| | | * 3ï¼è¾¹è¿å°åº |
| | | */ |
| | | private String operatelimit; |
| | | /** |
| | | * ç»è¥å°æ®µ |
| | | * åæ·æ§è´¨ä¸ºä¼ä¸ãä¸ªä½æ·æ¶å¿
å¡« |
| | | * 1ï¼åä¸åº |
| | | * 2ï¼å·¥ä¸åº |
| | | * 3ï¼ä½å®
åº |
| | | */ |
| | | private String inspect; |
| | | |
| | | /**对å
¬è´¦æ·ä¿¡æ¯ |
| | | *åæ·æ§è´¨ä¸ºä¼ä¸ï¼ç»ç®è´¦æ·å¯¹ç§æ¶å¿
å¡«ï¼ä½ä¸ºåæ·ä¿¡æ¯æ©å±å段ï¼ä¸ç»ç®ä¿¡æ¯æ å
³ |
| | | */ |
| | | private String pubacctinfo; |
| | | /**ä¸å¡è系人å§å |
| | | *éä¸ªäººç±»åæ·å¿
å¡« |
| | | */ |
| | | private String busconactperson; |
| | | /**ä¸å¡è系人çµè¯ |
| | | *éä¸ªäººç±»åæ·å¿
å¡« |
| | | */ |
| | | private String busconacttel; |
| | | |
| | | /**ç½ç«urlæä¸è½½å°åæå¹³å°åç§° |
| | | *å¼éç½å
³ï¼å«B2BãAPPï¼ãå¿«æ·ãäºéªä»APPæçº¿ä¸åºæ¯å¿
å¡« |
| | | */ |
| | | private String cusurl = ""; |
| | | |
| | | /**ç½ç«åç§°/åºç¨åç§° |
| | | *å¼éç½å
³ï¼å«B2BãAPPï¼ãå¿«æ·ãäºéªä»APPæçº¿ä¸åºæ¯å¿
å¡« |
| | | */ |
| | | private String webname = ""; |
| | | |
| | | |
| | | /** |
| | | *线ä¸çº¿ä¸ä¸å¡åºæ¯ |
| | | *0 线ä¸* |
| | | *为空æ¶é»è®¤ä¸ºçº¿ä¸åºæ¯ |
| | | */ |
| | | private String offlag; |
| | | /** |
| | | *æ³äººä¿¡æ¯jsonå符串 |
| | | ** |
| | | *jsonå
详æ
è§ä¸è¯´æ |
| | | */ |
| | | private String legaldetail; |
| | | /** |
| | | *åç人信æ¯jsonå符串 |
| | | ** |
| | | *æ³¨ï¼æä¸ºéå¿
å¡«ï¼5æ18æ¥çæä¸ºå¿
å¡« |
| | | */ |
| | | private String bnfdetail; |
| | | /** |
| | | *ç¨å¡ç»è®°è¯¦æ
jsonå符串 |
| | | * å¨åæ·æ§è´¨ä¸ºä¼ä¸ï¼éæ©éä¸è¯å䏿¶ï¼ç¨å¡ç»è®°è¯ä¿¡æ¯å¿
å¡«* |
| | | *jsonå
详æ
è§ä¸è¯´æ |
| | | */ |
| | | private String taxdetail; |
| | | /** |
| | | *ç»è¥å
容 |
| | | ** |
| | | * |
| | | */ |
| | | private String busdetail; |
| | | /** |
| | | *ç¾åç±»å |
| | | ** |
| | | *RSA/SM2 |
| | | */ |
| | | private String signtype; |
| | | /** |
| | | *ç»è¥å°å |
| | | ** |
| | | *åæ·ç»è¥å°å |
| | | */ |
| | | private String busaddress; |
| | | /** |
| | | *æå¨åº |
| | | ** |
| | | *è§éå½ |
| | | */ |
| | | private String districtcode; |
| | | |
| | | /** |
| | | * çµååè®®ç¾çº¦åè°å°å æ¤å段为空æ¶éç¥å°è¿ä»¶åè°url |
| | | */ |
| | | private String electnotify; |
| | | |
| | | /** |
| | | * å¾çjsonå符串 |
| | | */ |
| | | private String picurljson; |
| | | /** |
| | | * åºç¨åºæ¯ 01-PCç½ç« 02-APP/å
¬ä¼å·/å°ç¨åºï¼å¯å¤éï¼ |
| | | */ |
| | | private String appscenario; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunst; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | /** |
| | | * æ¶è´¹ç³è¯·å
¬ç¨åæ° |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 17:03 |
| | | */ |
| | | @Data |
| | | @Builder |
| | | @ApiModel(value = "æ¶è´¹ç³è¯·å
¬ç¨åæ°") |
| | | public class ConsumeApply { |
| | | |
| | | @ApiModelProperty("æ¶è´¹ç¨æ·çbizUserIdï¼ä»æ¬¾æ¹ï¼") |
| | | private String payerId; |
| | | |
| | | @ApiModelProperty("æ¶è´¹åæ·çbizUserIdï¼æ¶æ¬¾æ¹ï¼å¹³å°èªèº«ï¼åæ°å¼ä¸ºï¼#yunBizUserId_B2C#ã") |
| | | private String recieverId; |
| | | |
| | | @ApiModelProperty("订åå·ï¼æ¯ä»è®¢åï¼") |
| | | private String bizOrderNo; |
| | | |
| | | @ApiModelProperty("订åéé¢ï¼åï¼") |
| | | private Long amount; |
| | | |
| | | @ApiModelProperty("æç»è´¹ï¼åï¼") |
| | | private Long fee; |
| | | |
| | | @ApiModelProperty("交æéªç¾æ¹å¼ã0.æ éªè¯ï¼æ¸ ééªè¯ï¼ 1.çä¿¡éªè¯ç 2.æ¯ä»å¯ç ã") |
| | | private Long validateType; |
| | | |
| | | @ApiModelProperty("åå°éç¥å°åï¼åå°äº¤æå¿
ä¼ ï¼") |
| | | private String frontUrl; |
| | | |
| | | @ApiModelProperty("åå°éç¥å°åï¼å¿
ä¼ ï¼") |
| | | private String backUrl; |
| | | |
| | | @ApiModelProperty("订åè¿ææ¶é´ï¼å¯ä¸ä¼ ï¼") |
| | | private String orderExpireDatetime; |
| | | |
| | | @ApiModelProperty("æ©å±åæ° æ¥å£å°åæ ·è¿åï¼æå¤ 50 个å符ï¼å¯ä¸ä¼ ï¼") |
| | | private String extendInfo; |
| | | |
| | | @ApiModelProperty("交æå
容æè¦æå¤ 20 个å符ï¼å¯ä¸ä¼ ï¼") |
| | | private String summary; |
| | | |
| | | @ApiModelProperty("åè´¦è§åï¼åè´¦å±çº§æ°<=3ï¼åè´¦æ»ä¼åæ°<=10 " + |
| | | "[{bizUserId:å¯ä¸ç¼å·ï¼å¦ææ¯å¹³å°å¡«#yunBizUserId_B2C#ï¼ accountSetNoï¼å¸æ·éç¼å·" + |
| | | "amountï¼éé¢ï¼åï¼feeï¼æç»è´¹ï¼åï¼remarkï¼å¤æ³¨ splitRuleListï¼åè´¦å表}]") |
| | | private ArrayList splitRule; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunst; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 设置ä¼ä¸ä¼ååæ° |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 17:03 |
| | | */ |
| | | @Data |
| | | @Builder |
| | | @ApiModel(value = "设置ä¼ä¸ä¼ååæ°ï¼yï¼å¿
ä¼ nï¼éå¿
ä¼ ï¼") |
| | | public class MerchantApply { |
| | | |
| | | @ApiModelProperty("ä¼ä¸åç§°ï¼yï¼") |
| | | private String companyName; |
| | | |
| | | @ApiModelProperty("认è¯ç±»å[1 ä¸è¯ 2 ä¸è¯] é»è®¤1") |
| | | private Long authType; |
| | | |
| | | @ApiModelProperty("ç»ä¸ç¤¾ä¼ä¿¡ç¨(ä¸è¯)认è¯ç±»å2æ¶å¿
ä¼ ") |
| | | private String uniCredit; |
| | | |
| | | @ApiModelProperty("è¥ä¸æ§ç
§å·(ä¸è¯)认è¯ç±»å为 1 æ¶å¿
ä¼ ") |
| | | private String businessLicense; |
| | | |
| | | @ApiModelProperty("ç»ç»æºæ(ä¸è¯)认è¯ç±»å为 1 æ¶å¿
ä¼ ") |
| | | private String organizationCode; |
| | | |
| | | @ApiModelProperty("ç¨å¡ç»è®°è¯(ä¸è¯)认è¯ç±»å为 1 æ¶å¿
ä¼ ") |
| | | private String taxRegister; |
| | | |
| | | @ApiModelProperty("æ³äººå§åï¼yï¼") |
| | | private String legalName; |
| | | |
| | | @ApiModelProperty("æ³äººè¯ä»¶ç±»å[1.èº«ä»½è¯ 2.æ¤ç
§ 3.åå®è¯ 4.åä¹¡è¯ 5.å°èè¯ 6.è¦å®è¯ 7.士å
µè¯ 99.å
¶ä»è¯ä»¶]ï¼yï¼") |
| | | private Long identityType; |
| | | |
| | | @ApiModelProperty("æ³äººè¯ä»¶å·ç ï¼yï¼") |
| | | private String legalIds; |
| | | |
| | | @ApiModelProperty("æ³äººææºå·ç ï¼yï¼") |
| | | private String legalPhone; |
| | | |
| | | @ApiModelProperty("ä¼ä¸å¯¹å
¬è´¦æ·ï¼yï¼") |
| | | private String accountNo; |
| | | |
| | | @ApiModelProperty("弿·é¶è¡åç§°ï¼yï¼") |
| | | private String parentBankName; |
| | | |
| | | @ApiModelProperty("弿·è¡æ¯è¡åç§°ï¼yï¼") |
| | | private String bankName; |
| | | |
| | | @ApiModelProperty("æ¯ä»è¡å·ï¼yï¼") |
| | | private String unionBank; |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunst; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | /** |
| | | * @Description: |
| | | * @Company: TOO (psï¼å
¬å¸åç§°) |
| | | * @author: å |
| | | * @date: 2020/4/15 ä¸å10:39 |
| | | * @version: V1.0.0 |
| | | */ |
| | | |
| | | @Data |
| | | @ApiModel("çµåç¾çº¦è¯·æ±åæ°") |
| | | @Builder |
| | | public class SignContractApply { |
| | | |
| | | @ApiModelProperty(value = "åæ·ç³»ç»ç¨æ·æ è¯") |
| | | private String bizUserId; |
| | | |
| | | @ApiModelProperty(value = "ç¾è®¢å跳转è¿åç页 é¢å°å") |
| | | private String jumpUrl; |
| | | |
| | | @ApiModelProperty(value = "åå°éç¥å°å") |
| | | private String backUrl; |
| | | |
| | | @ApiModelProperty(value = "ç»ç«¯è®¿é®ç±»å1ï¼ææº 2ï¼pc") |
| | | private Long source; |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunst; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * äºåéå
Œ
±åæ° |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/10/15 14:13 |
| | | */ |
| | | @NoArgsConstructor |
| | | @ApiModel(value = "å
Œ
±åæ°ï¼éèäºåéï¼") |
| | | public class YunStParam { |
| | | |
| | | @ApiModelProperty("è¡ä¸ä»£ç ") |
| | | public static String industryCode = "1910"; |
| | | |
| | | @ApiModelProperty("è¡ä¸åç§°") |
| | | public static String industryName = "å
¶ä»"; |
| | | |
| | | @ApiModelProperty("访é®ç»ç«¯ç±»åã 1ï¼mobile 2ï¼PC ã") |
| | | public static Long source = 2L; |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunst; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * æ¥å£è¿åå¼ï¼éèäºåéï¼ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 16:37 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "æ¥å£è¿åå¼ï¼éèäºåéï¼") |
| | | public class YunStResult { |
| | | |
| | | @ApiModelProperty("æå¡è°ç¨æ¯å¦æåï¼âOKâ表示æåï¼âerrorâ表示失败ã") |
| | | private String status; |
| | | |
| | | @ApiModelProperty("è¿åå
å®¹ï¼ JSON 对象ï¼") |
| | | private String signedValue; |
| | | |
| | | @ApiModelProperty("ç¾å") |
| | | private String sign; |
| | | |
| | | @ApiModelProperty("é误代ç ") |
| | | private String errorCode; |
| | | |
| | | @ApiModelProperty("é误信æ¯") |
| | | private String message; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunst; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.allinpay.yunst.sdk.YunClient; |
| | | import com.allinpay.yunst.sdk.bean.YunConfig; |
| | | import com.allinpay.yunst.sdk.bean.YunRequest; |
| | | import com.allinpay.yunst.sdk.util.RSAUtil; |
| | | import com.nuvole.common.domain.dto.AppDTO; |
| | | import com.nuvole.util.IPUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.Before; |
| | | import org.junit.Test; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * æ¯ä»å·¥å
·ç±»ï¼éèäºåéï¼ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/10/12 11:49 |
| | | */ |
| | | @Slf4j |
| | | public class YunStUtil { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(YunStUtil.class); |
| | | |
| | | //æµè¯ |
| | | /*@Before |
| | | public void initConfig() { |
| | | final String serverUrl = "http://116.228.64.55:6900/service/soa"; |
| | | final String sysId = "1906061744156467038"; |
| | | final String pwd = "123456"; |
| | | final String alias = "1906061744156467038"; |
| | | final String path = "C:/Users/Administrator/Desktop/yunst/1906061744156467038/1906061744156467038.pfx"; |
| | | final String tlCertPath = "C:/Users/Administrator/Desktop/yunst/1906061744156467038/TLCert-test.cer"; |
| | | final String version = "2.0"; |
| | | final YunConfig config = new YunConfig(serverUrl, sysId, pwd, alias, version, path, tlCertPath); |
| | | YunClient.configure(config); |
| | | } |
| | | |
| | | @Test |
| | | public void test() { |
| | | |
| | | String bizUserId = "lc201910171030"; //ç¨æ·å¯ä¸æ è¯ 4806722d-3c3a-4137-bc6f-5982e2759dd5 |
| | | String acct = "oZN135B20y8KIUFMl4GaeRyuFyQ3"; //微信å°ç¨åºopenid |
| | | String bizOrderNo = "123456789987654322"; //订åç¼å· |
| | | |
| | | YunStResult yunStResult = new YunStResult(); |
| | | |
| | | System.out.println("is Enter the test.............................å建ä¼å"); |
| | | Long memberType = 3L; |
| | | Long source = 2L; |
| | | //å建ä¼å |
| | | yunStResult = createMember(bizUserId, memberType, source); |
| | | if ("OK".equals(yunStResult.getStatus())) { |
| | | log.info("is ok:-------------->"); |
| | | log.info(yunStResult.getSignedValue()); |
| | | } else { |
| | | log.info("is error:-------------->"); |
| | | log.info(yunStResult.getErrorCode()); |
| | | log.info(yunStResult.getMessage()); |
| | | } |
| | | |
| | | System.out.println("is The end of the test.......................å建ä¼å"); |
| | | |
| | | |
| | | System.out.println("is Enter the test.............................åééªè¯ç "); |
| | | String phone = "17803846500"; |
| | | Long verificationCodeType = 9L; |
| | | //å建ä¼å |
| | | yunStResult = sendVerificationCode(bizUserId, phone, verificationCodeType); |
| | | if ("OK".equals(yunStResult.getStatus())) { |
| | | log.info("is ok:-------------->"); |
| | | log.info(yunStResult.getSignedValue()); |
| | | } else { |
| | | log.info("is error:-------------->"); |
| | | log.info(yunStResult.getErrorCode()); |
| | | log.info(yunStResult.getMessage()); |
| | | } |
| | | |
| | | System.out.println("is The end of the test.......................åééªè¯ç "); |
| | | |
| | | |
| | | System.out.println("is Enter the test.............................ç»å®ææº"); |
| | | String verificationCode = "544343"; |
| | | //å建ä¼å |
| | | yunStResult = bindPhone(bizUserId, phone, verificationCode); |
| | | if ("OK".equals(yunStResult.getStatus())) { |
| | | log.info("is ok:-------------->"); |
| | | log.info(yunStResult.getSignedValue()); |
| | | } else { |
| | | log.info("is error:-------------->"); |
| | | log.info(yunStResult.getErrorCode()); |
| | | log.info(yunStResult.getMessage()); |
| | | } |
| | | |
| | | System.out.println("is The end of the test.......................ç»å®ææº"); |
| | | |
| | | System.out.println("is Enter the test.............................个人å®å认è¯"); |
| | | //å建ä¼å |
| | | yunStResult = setRealName(bizUserId, "çè", 1L, "410521199209010565"); |
| | | if ("OK".equals(yunStResult.getStatus())) { |
| | | log.info("is ok:-------------->"); |
| | | log.info(yunStResult.getSignedValue()); |
| | | } else { |
| | | log.info("is error:-------------->"); |
| | | log.info(yunStResult.getErrorCode()); |
| | | log.info(yunStResult.getMessage()); |
| | | } |
| | | |
| | | System.out.println("is The end of the test.......................个人å®å认è¯"); |
| | | |
| | | System.out.println("is Enter the test.............................ç»å®ä¼åæ¯ä»è´¦æ·"); |
| | | |
| | | //ç»å®ä¼åæ¯ä»è´¦æ· |
| | | String acctType = "weChatMiniProgram"; |
| | | YunStResult yunStResult1 = applyBindAcct(bizUserId, acctType, acct); |
| | | if ("OK".equals(yunStResult1.getStatus())) { |
| | | log.info("is ok:-------------->"); |
| | | log.info(yunStResult1.getSignedValue()); |
| | | } else { |
| | | log.info("is error:-------------->"); |
| | | log.info(yunStResult1.getErrorCode()); |
| | | log.info(yunStResult1.getMessage()); |
| | | } |
| | | System.out.println("is The end of the test.......................ç»å®ä¼åæ¯ä»è´¦æ·"); |
| | | |
| | | |
| | | System.out.println("is Enter the test.............................个人å®å认è¯"); |
| | | |
| | | //ç»å®ä¼åæ¯ä»è´¦æ· |
| | | String name = "å¼ ä¸"; |
| | | Long identityType = 1L; |
| | | String identityNo = "41000000000000000000"; |
| | | |
| | | yunStResult = setRealName(bizUserId, name, identityType, identityNo); |
| | | if ("OK".equals(yunStResult.getStatus())) { |
| | | log.info("is ok:-------------->"); |
| | | log.info(yunStResult.getSignedValue()); |
| | | } else { |
| | | log.info("is error:-------------->"); |
| | | log.info(yunStResult.getErrorCode()); |
| | | log.info(yunStResult.getMessage()); |
| | | } |
| | | System.out.println("is The end of the test.......................个人å®å认è¯"); |
| | | |
| | | |
| | | System.out.println("is Enter the test.............................请æ±ç»å®é¶è¡å¡"); |
| | | |
| | | //ç»å®ä¼åæ¯ä»è´¦æ· |
| | | String cardNo = "6228481111111111111"; |
| | | String phone = "17803846500"; |
| | | |
| | | yunStResult = applyBindBankCard(bizUserId, cardNo, phone, name, identityType, identityNo); |
| | | if ("OK".equals(yunStResult.getStatus())) { |
| | | log.info("is ok:-------------->"); |
| | | log.info(yunStResult.getSignedValue()); |
| | | } else { |
| | | log.info("is error:-------------->"); |
| | | log.info(yunStResult.getErrorCode()); |
| | | log.info(yunStResult.getMessage()); |
| | | } |
| | | System.out.println("is The end of the test.......................请æ±ç»å®é¶è¡å¡"); |
| | | |
| | | |
| | | System.out.println("is Enter the test.............................æ¶è´¹ç³è¯·"); |
| | | |
| | | |
| | | //ç»å®ä¼åæ¯ä»è´¦æ· |
| | | String recieverId = "123456"; |
| | | Long validateType = 0L; //交æéªç¾æ¹å¼ã0.æ éªè¯ 1.çä¿¡éªè¯ç 2.æ¯ä»å¯ç ã |
| | | String backUrl = "https://www.baudi.com"; //åå°åè°å°å |
| | | ConsumeApply consumeApply = new ConsumeApply() {{ |
| | | setPayerId(bizUserId); |
| | | setRecieverId(recieverId); |
| | | setBizOrderNo(bizOrderNo); |
| | | setAmount(1L); |
| | | setFee(0L); |
| | | setValidateType(validateType); |
| | | setBackUrl(backUrl); |
| | | setSummary("åå交æ"); |
| | | }}; |
| | | String vspCusid = "552651058145DRF"; |
| | | String subAppid = "00143623"; |
| | | Long amount = 1L; |
| | | yunStResult = wechatMiniprogramPay(consumeApply, vspCusid, subAppid, amount, acct); |
| | | if ("OK".equals(yunStResult.getStatus())) { |
| | | log.info("is ok:-------------->"); |
| | | log.info(yunStResult.getSignedValue()); |
| | | } else { |
| | | log.info("is error:-------------->"); |
| | | log.info(yunStResult.getErrorCode()); |
| | | log.info(yunStResult.getMessage()); |
| | | } |
| | | |
| | | System.out.println("is The end of the test.......................æ¶è´¹ç³è¯·"); |
| | | |
| | | }*/ |
| | | |
| | | /** |
| | | * å°ç¨åºæ¯ä» |
| | | */ |
| | | /* @Test |
| | | public void wechatPay() { |
| | | log.info("<-------------------------this is createMember operation å建ä¼å ------------------------->"); |
| | | //å建ä¼å |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | //String shBizUserId = "shanghu001"; //æ®éä¼åä¼åï¼æ¶æ¬¾æ¹ï¼å·²å®åï¼ |
| | | Long memberType = 3L; |
| | | Long source = 1L; |
| | | YunStResult result; |
| | | result = createMember(bizUserId, memberType, source); |
| | | logger.info("createMember result: status={},message={},signedValue={}", new Object[]{result.getStatus(), result.getMessage(), result.getSignedValue()}); |
| | | |
| | | log.info("<-------------------------this is applyBindAcct operation ä¼åç»å®æ¯ä»è´¦æ·ç¨æ·æ è¯------------------------->"); |
| | | //ä¼åç»å®æ¯ä»è´¦æ·ç¨æ·æ è¯ï¼æ¯ä»è´¦æ·ç»å®å°ç¨åºopenIdï¼ |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String acctType = "weChatMiniProgram"; |
| | | String acct = "tm001001"; |
| | | result = applyBindAcct(bizUserId, acctType, acct); |
| | | logger.info("applyBindAcct result: status={}", new Object[]{result.getStatus()}); |
| | | |
| | | log.info("<-------------------------this is wechatMiniprogramPay operation æ¶è´¹ç³è¯·------------------------->"); |
| | | //æ¶è´¹ç³è¯· |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String recieverId = "shanghu001"; |
| | | Long validateType = 0L; //交æéªç¾æ¹å¼ã0.æ éªè¯ 1.çä¿¡éªè¯ç 2.æ¯ä»å¯ |
| | | String bizOrderNo = "201200401111212"; |
| | | String backUrl = "https:localhost:8080"; //åå°åè°å°å |
| | | String acct = "tm001001"; |
| | | ConsumeApply consumeApply = ConsumeApply.builder() |
| | | .payerId(bizUserId) |
| | | .recieverId(recieverId) |
| | | .bizOrderNo(bizOrderNo) |
| | | .amount(1L) |
| | | .fee(0L) |
| | | .validateType(validateType) |
| | | .backUrl(backUrl) |
| | | .summary("åå交æ").build(); |
| | | String vspCusid = "552651058145DRF"; |
| | | String subAppid = "00143623"; |
| | | Long amount = 1L; |
| | | result = wechatMiniprogramPay(consumeApply, vspCusid, subAppid, amount, acct); |
| | | //todo æµè¯ååæ·å·æªæä¾ éèæªåé¦ |
| | | logger.info("consumeApply result: status={}, signedValue={}", new Object[]{result.getStatus(), result.getSignedValue()}); |
| | | |
| | | log.info("<-------------------------this is callBack operation 订åç»æéç¥------------------------->"); |
| | | //订åç»æéç¥ |
| | | }*/ |
| | | |
| | | |
| | | /** |
| | | * æ¶é¶å®å¿«æ·æ¯ä» |
| | | * |
| | | */ |
| | | /*@Test |
| | | public void quickPay() throws Exception { |
| | | log.info("<-------------------------this is createMember operation å建ä¼å------------------------->"); |
| | | //å建ä¼å |
| | | String bizUserId = "tz20200401113"; //æ®éä¼å |
| | | String shBizUserId = "shanghu001"; //æ®éä¼åä¼åï¼æ¶æ¬¾æ¹ï¼å·²å®åï¼ |
| | | Long memberType = 3L; |
| | | Long source = 1L; |
| | | YunStResult result; |
| | | result = createMember(bizUserId, memberType, source); |
| | | logger.info("createMember result: status={},message={},signedValue={}", new Object[]{result.getStatus(), result.getMessage(), result.getSignedValue()}); |
| | | |
| | | log.info("<-------------------------this is sendVerificationCode operation åééªè¯ç ------------------------->"); |
| | | //åééªè¯ç |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String phone = "17803846500"; |
| | | Long verificationCodeType = 9L; |
| | | result = sendVerificationCode(bizUserId, phone, verificationCodeType); |
| | | logger.info("sendVerificationCode result: status={},message={},signedValue={}",new Object[]{result.getStatus(),result.getMessage(),result.getSignedValue()}); |
| | | |
| | | log.info("<-------------------------this is bindPhone operation ç»å®ææº------------------------->"); |
| | | //ç»å®ææº |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String verificationCode = "544343"; |
| | | result = bindPhone(bizUserId, phone, verificationCode); |
| | | logger.info("bindPhone result: status={}",new Object[]{result.getStatus()}); |
| | | |
| | | log.info("<-------------------------this is certification operation å®å认è¯------------------------->"); |
| | | //å®åè®¤è¯ |
| | | String bizUserId = "tz20200401113"; //æ®éä¼å |
| | | String name = "å宿"; |
| | | Long identityType = 1L; |
| | | String identityNo = "511521199408143656"; |
| | | result = setRealName(bizUserId, name, identityType, identityNo); |
| | | logger.info("certification result: status={}",new Object[]{result.getStatus()}); |
| | | |
| | | log.info("<-------------------------this is applyBindBankCard operation ç³è¯·ç»å®çé¶è¡å¡------------------------->"); |
| | | //ç³è¯·ç»å®çé¶è¡å¡ï¼éç¨çå®å§åï¼ææºï¼èº«ä»½è¯ï¼é¶è¡å¡ï¼ |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String cardNo = "6217853100025227554"; //4ç»å°¾å¡å·è¿åå§åä¸å¹é
|
| | | String phone = "17723341354"; |
| | | String name = "å宿"; |
| | | Long identityType = 1L; |
| | | String identityNo = "511521199408143656"; |
| | | result = applyBindBankCard(bizUserId, cardNo, phone, name, identityType, identityNo); |
| | | logger.info("applyBindBankCard result: status={} , signedValue= {}", new Object[]{result.getStatus()}); |
| | | |
| | | log.info("<-------------------------this is bindBankCard operation 确认ç»å®é¶è¡å¡------------------------->"); |
| | | //确认ç»å®é¶è¡å¡ |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String phone = "17803846500"; |
| | | String tranceNum = "123"; //æµæ°´å·(请æ±ç»å®é¶è¡å¡æ¥å£è¿å) |
| | | String transDate = "2019-10-12"; //ç³è¯·æ¶é´(请æ±ç»å®é¶è¡å¡æ¥å£è¿å) |
| | | String verificationCode = "123"; |
| | | //todo "errorCode":"9000","message":"确认è¶
æ¶æè¯·æ±å·é误ï¼è¯·éæ°è°ç¨ç»å¡ç³è¯·æ¥å£" éèæªåé¦ |
| | | result = bindBankCard(bizUserId,tranceNum,transDate,phone,verificationCode); |
| | | logger.info("bindBankCard result: status={}", new Object[]{result.getStatus()}); |
| | | |
| | | log.info("<-------------------------this is unbindBankCard operation è§£é¤é¶è¡å¡ç»å®------------------------->"); |
| | | //è§£é¤é¶è¡å¡ç»å®(éè¦æ¶è°ç¨) |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String cardNo = "6230943800000203604"; |
| | | result = unbindBankCard(bizUserId,cardNo); |
| | | logger.info("unbindBankCard result: status={},message={}",new Object[]{result.getStatus(),result.getMessage()}); |
| | | |
| | | log.info("<-------------------------this is quickPayVsp operation æ¶è´¹ç³è¯·(çä¿¡éªè¯)------------------------->"); |
| | | String recieverId = "shanghu001"; |
| | | Long validateType = 1L; //交æéªç¾æ¹å¼ã0.æ éªè¯ 1.çä¿¡éªè¯ç 2.æ¯ä»å¯ |
| | | String bizOrderNo = "201200401111212"; |
| | | Long amount = 1L; |
| | | Long fee = 1L; |
| | | String backUrl = "http://localhost:8080"; |
| | | ConsumeApply consumeApply = ConsumeApply.builder() |
| | | .payerId("tz20200401111") |
| | | .recieverId("shanghu001") |
| | | .validateType(1L) |
| | | .bizOrderNo("201200401111212") |
| | | .amount(1L) |
| | | .fee(1L) |
| | | .backUrl("http://localhost:8080").build(); |
| | | result = quickPayVsp(consumeApply,cardNo); |
| | | log.info("consumeApply result: status = {},message = {}",new Object[]{result.getStatus(),result.getMessage()}); |
| | | |
| | | log.info("<-------------------------this is pay operation 确认æ¯ä»(çä¿¡+åå°éªè¯)------------------------->"); |
| | | |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String bizOrderNo = "201200401111212"; |
| | | String tradeNo = "123"; |
| | | String verificationCode = "123"; |
| | | result = pay(bizUserId,bizOrderNo,tradeNo,verificationCode); |
| | | log.info("pay result: status={},signedValue={}",new Object[]{result.getStatus(),result.getSignedValue()}); |
| | | |
| | | log.info("<-------------------------this is getOrderDetail æ¥è¯¢è®¢åç¶æ(确认æ¯ä»è¿åå¤ç䏿¶è°ç¨)------------------------->"); |
| | | String bizOrderNo = "201200401111212"; |
| | | result = getOrderDetail(bizOrderNo); |
| | | log.info("getOrderDetail result: status={},signedValue={}",new Object[]{result.getStatus(),result.getSignedValue()}); |
| | | |
| | | }*/ |
| | | |
| | | /** |
| | | * 颿«é¢æ¯ä»(Bæ«c) |
| | | * |
| | | */ |
| | | /*@Test |
| | | public void bussToCustPay(){ |
| | | log.info("<-------------------------this is createMember operation å建ä¼å------------------------->"); |
| | | //å建ä¼å |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String shBizUserId = "shanghu001"; //æ®éä¼åä¼åï¼æ¶æ¬¾æ¹ï¼å·²å®åï¼ |
| | | Long memberType = 3L; |
| | | Long source = 1L; |
| | | YunStResult result; |
| | | result = createMember(bizUserId, memberType, source); |
| | | logger.info("createMember result: status={},message={},signedValue={}", new Object[]{result.getStatus(), result.getMessage(), result.getSignedValue()}); |
| | | |
| | | log.info("<-------------------------this is applyBindAcct operation ä¼åç»å®æ¯ä»è´¦æ·ç¨æ·æ è¯(微信/æ¯ä»å®/äºéªä»openId)------------------------->"); |
| | | //ä¼åç»å®æ¯ä»è´¦æ·ç¨æ·æ è¯(微信/æ¯ä»å®/äºéªä»openId) |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String acctType = "weChatMiniProgram"; |
| | | String acct = "tm001001"; |
| | | result = applyBindAcct(bizUserId, acctType, acct); |
| | | logger.info("applyBindAcct result: status={}", new Object[]{result.getStatus(),result.getSignedValue()}); |
| | | |
| | | log.info("<-------------------------this is quickPayVsp operation æ¶è´¹ç³è¯·(æ¯ä»æ¹å¼:æ¶é¶å®å·å¡æ¯ä»(被æ«)_éå¢ââæ¯æå¾®ä¿¡ãæ¯ä»å®ãé¶èãææºQQ)------------------------->"); |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String shBizUserId = "shanghu001"; //æ®éä¼åä¼åï¼æ¶æ¬¾æ¹ï¼å·²å®åï¼ |
| | | ConsumeApply consumeApply = ConsumeApply.builder() |
| | | .payerId(bizUserId) |
| | | .recieverId(shBizUserId) |
| | | .bizOrderNo("123231231") |
| | | .amount(1L) |
| | | .fee(1L) |
| | | .validateType(0L) |
| | | .backUrl("localhost") |
| | | .build(); |
| | | Long amount = 1L; |
| | | String authcode = "124316162322111111"; //æ¤å¤éç¨çå®ä»æ¬¾ç |
| | | String vspCusid = "zsh111111"; |
| | | result = doCodePay(consumeApply,vspCusid,amount,authcode); |
| | | |
| | | log.info("<-------------------------this is getOrderDetail æ¥è¯¢è®¢åç¶æ(确认æ¯ä»è¿åå¤ç䏿¶è°ç¨)------------------------->"); |
| | | result = getOrderDetail("12312323"); |
| | | log.info("getOrderDetail result: status={},signedValue={}",new Object[]{result.getStatus(),result.getSignedValue()}); |
| | | |
| | | }*/ |
| | | |
| | | /** |
| | | * é¢å¯¹é¢ä»æ¬¾cæ«b |
| | | */ |
| | | /* @Test |
| | | public void custToBussPay(){ |
| | | log.info("<-------------------------this is createMember operation å建ä¼å------------------------->"); |
| | | //å建ä¼å |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String shBizUserId = "shanghu001"; //æ®éä¼åä¼åï¼æ¶æ¬¾æ¹ï¼å·²å®åï¼ |
| | | Long memberType = 3L; |
| | | Long source = 1L; |
| | | YunStResult result; |
| | | result = createMember(bizUserId, memberType, source); |
| | | logger.info("createMember result: status={},message={},signedValue={}", new Object[]{result.getStatus(), result.getMessage(), result.getSignedValue()}); |
| | | |
| | | log.info("<-------------------------this is applyBindAcct operation ä¼åç»å®æ¯ä»è´¦æ·ç¨æ·æ è¯(微信/æ¯ä»å®/äºéªä»openId)------------------------->"); |
| | | //ä¼åç»å®æ¯ä»è´¦æ·ç¨æ·æ è¯(微信/æ¯ä»å®/äºéªä»openId) |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String acctType = "weChatMiniProgram"; |
| | | String acct = "tm001001"; |
| | | result = applyBindAcct(bizUserId, acctType, acct); |
| | | logger.info("applyBindAcct result: status={}", new Object[]{result.getStatus(),result.getSignedValue()}); |
| | | |
| | | log.info("<-------------------------this is quickPayVsp operation æ¶è´¹ç³è¯·(æ¯ä»æ¹å¼:æ¶é¶å®å·å¡æ¯ä»(æ£æ«)_)------------------------->"); |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | ConsumeApply consumeApply = ConsumeApply.builder() |
| | | .payerId(bizUserId) |
| | | .recieverId(shBizUserId) |
| | | .bizOrderNo("1232312311") |
| | | .amount(1L) |
| | | .fee(1L) |
| | | .validateType(0L) |
| | | .backUrl("localhost") |
| | | .build(); |
| | | Long amount = 1L; |
| | | String vspCusid = "zsh111111"; |
| | | result = doScanPay(consumeApply,vspCusid,amount,"SCAN_WEIXIN"); //æ£å¼ç¯åå _ORG |
| | | log.info("quickPayVsp result: status={},signedValue={}",new Object[]{result.getStatus(),result.getSignedValue()}); |
| | | |
| | | log.info("<-------------------------this is getOrderDetail æ¥è¯¢è®¢åç¶æ(å
¥é类交æ(使ç¨é¶è¡è´¦æ·èµéè¿è¡æ¯ä»)ï¼åªæè®¢åæ¯ä»æåæ
åµä¸æä¼éç¥)------------------------->"); |
| | | result = getOrderDetail("12312323"); |
| | | log.info("getOrderDetail result: status={},signedValue={}",new Object[]{result.getStatus(),result.getSignedValue()}); |
| | | }*/ |
| | | |
| | | /** |
| | | * ä¼ä¸åå®¶ä¼å |
| | | */ |
| | | /*@Test |
| | | public void createOrgMember(){ |
| | | log.info("<-------------------------this is createOrgMember operation å建ä¼ä¸ä¼å------------------------->"); |
| | | String bizUserId = "sh20200401111"; //ä¼ä¸ä¼å |
| | | Long memberType = 2L; |
| | | Long source = 2L; //pc端 |
| | | YunStResult result; |
| | | result = createMember(bizUserId, memberType, source); |
| | | logger.info("createMember result: status={},message={},signedValue={}", new Object[]{result.getStatus(), result.getMessage(), result.getSignedValue()}); |
| | | |
| | | log.info("<-------------------------this is createOrgMember operation å建ä¼ä¸ä¼å------------------------->"); |
| | | String bizUserId = "sh20200401111"; //ä¼ä¸ä¼å |
| | | String backUrl = "localhost"; //éç¥å°å |
| | | Boolean isAuth = true; |
| | | MerchantApply merchantApply = MerchantApply.builder() |
| | | .companyName("company") |
| | | .authType(2L) |
| | | .uniCredit("112") |
| | | .legalName("å¼ ä¸") |
| | | .identityType(1L) |
| | | .legalIds("122212121") //RSAå å¯ |
| | | .legalPhone("13360881231") |
| | | .accountNo("13360881231") //RSAå å¯ |
| | | .parentBankName("å·¥åé¶è¡") |
| | | .bankName("ä¸å½å·¥åé¶è¡è¡ä»½æéå
¬å¸å京樱æ¡åæ¯è¡") //鿝ç¶çº§ç´è¿é¶è¡ |
| | | .unionBank("111111111111")//12使°å |
| | | .build(); |
| | | result = setCompanyInfo(bizUserId,backUrl,isAuth,merchantApply); |
| | | |
| | | log.info("<-------------------------this is sendVerificationCode operation åééªè¯ç ------------------------->"); |
| | | //åééªè¯ç |
| | | String bizUserId = "tz20200401111"; //ä¼ä¸ä¼å |
| | | String phone = "17803846500"; |
| | | Long verificationCodeType = 9L; |
| | | result = sendVerificationCode(bizUserId, phone, verificationCodeType); |
| | | logger.info("sendVerificationCode result: status={},message={},signedValue={}",new Object[]{result.getStatus(),result.getMessage(),result.getSignedValue()}); |
| | | |
| | | log.info("<-------------------------this is bindPhone operation ç»å®ææº------------------------->"); |
| | | //ç»å®ææº |
| | | String bizUserId = "tz20200401111"; //ä¼ä¸éä¼å |
| | | String verificationCode = "544343"; |
| | | result = bindPhone(bizUserId, phone, verificationCode); |
| | | logger.info("bindPhone result: status={}",new Object[]{result.getStatus()}); |
| | | |
| | | log.info("<-------------------------this is signContract operation ä¼åçµåç¾çº¦------------------------->"); |
| | | |
| | | SignContractApply signContractApply = SignContractApply.builder() |
| | | .bizUserId("tz20200401113") |
| | | .jumpUrl("http://www.baidu.com") |
| | | .backUrl("localhost") |
| | | .source(2L) |
| | | .build(); |
| | | String webParamUrl = "http://116.228.64.55:6900/yungateway/member/signContract.html?"; |
| | | String signUrl = signContract(signContractApply,webParamUrl); //以åå° H5 页é¢å½¢å¼è¿è¡è¯·æ± |
| | | System.out.println("signUrl is " + signUrl); |
| | | }*/ |
| | | |
| | | /** |
| | | * 个人åå®¶ä¼å |
| | | * |
| | | */ |
| | | /*@Test |
| | | public void createSellerMember(){ |
| | | log.info("<-------------------------this is createOrgMember operation å建个人ä¼å------------------------->"); |
| | | String bizUserId = "sh20200401111"; //ä¼ä¸ä¼å |
| | | Long memberType = 3L; |
| | | Long source = 2L; //pc端 |
| | | YunStResult result; |
| | | result = createMember(bizUserId, memberType, source); |
| | | logger.info("createMember result: status={},message={},signedValue={}", new Object[]{result.getStatus(), result.getMessage(), result.getSignedValue()}); |
| | | |
| | | log.info("<-------------------------this is sendVerificationCode operation åééªè¯ç ------------------------->"); |
| | | //åééªè¯ç |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String phone = "17803846500"; |
| | | Long verificationCodeType = 9L; |
| | | result = sendVerificationCode(bizUserId, phone, verificationCodeType); |
| | | logger.info("sendVerificationCode result: status={},message={},signedValue={}",new Object[]{result.getStatus(),result.getMessage(),result.getSignedValue()}); |
| | | |
| | | log.info("<-------------------------this is bindPhone operation ç»å®ææº------------------------->"); |
| | | //ç»å®ææº |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String verificationCode = "544343"; |
| | | result = bindPhone(bizUserId, phone, verificationCode); |
| | | logger.info("bindPhone result: status={}",new Object[]{result.getStatus()}); |
| | | |
| | | log.info("<-------------------------this is certification operation å®å认è¯------------------------->"); |
| | | //å®åè®¤è¯ |
| | | String bizUserId = "tz20200401113"; //æ®éä¼å |
| | | String name = "å宿"; |
| | | Long identityType = 1L; |
| | | String identityNo = "511521199408143656"; |
| | | result = setRealName(bizUserId, name, identityType, identityNo); |
| | | logger.info("certification result: status={}",new Object[]{result.getStatus()}); |
| | | |
| | | log.info("<-------------------------this is applyBindBankCard operation ç³è¯·ç»å®çé¶è¡å¡------------------------->"); |
| | | //ç³è¯·ç»å®çé¶è¡å¡ï¼éç¨çå®å§åï¼ææºï¼èº«ä»½è¯ï¼é¶è¡å¡ï¼ |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String cardNo = "6217853100025227554"; //4ç»å°¾å¡å·è¿åå§åä¸å¹é
|
| | | String phone = "17723341354"; |
| | | String name = "å宿"; |
| | | Long identityType = 1L; |
| | | String identityNo = "511521199408143656"; |
| | | result = applyBindBankCard(bizUserId, cardNo, phone, name, identityType, identityNo); |
| | | logger.info("applyBindBankCard result: status={} , signedValue= {}", new Object[]{result.getStatus()}); |
| | | |
| | | log.info("<-------------------------this is bindBankCard operation 确认ç»å®é¶è¡å¡------------------------->"); |
| | | //确认ç»å®é¶è¡å¡ |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String phone = "17803846500"; |
| | | String tranceNum = "123"; //æµæ°´å·(请æ±ç»å®é¶è¡å¡æ¥å£è¿å) |
| | | String transDate = "2019-10-12"; //ç³è¯·æ¶é´(请æ±ç»å®é¶è¡å¡æ¥å£è¿å) |
| | | String verificationCode = "123"; |
| | | //todo "errorCode":"9000","message":"确认è¶
æ¶æè¯·æ±å·é误ï¼è¯·éæ°è°ç¨ç»å¡ç³è¯·æ¥å£" éèæªåé¦ |
| | | result = bindBankCard(bizUserId,tranceNum,transDate,phone,verificationCode); |
| | | logger.info("bindBankCard result: status={}", new Object[]{result.getStatus()}); |
| | | |
| | | log.info("<-------------------------this is queryBankCard operation æ¥è¯¢ç»å®é¶è¡å¡------------------------->"); |
| | | String bizUserId = "tz20200401111"; |
| | | String cardNo = null; //ä¸ºç©ºåæ¥è¯¢ææé¶è¡å¡ |
| | | result = queryBankCard(bizUserId,cardNo); |
| | | |
| | | |
| | | log.info("<-------------------------this is unbindBankCard operation è§£é¤é¶è¡å¡ç»å®------------------------->"); |
| | | //è§£é¤é¶è¡å¡ç»å®(éè¦æ¶è°ç¨) |
| | | String bizUserId = "tz20200401111"; //æ®éä¼å |
| | | String cardNo = "6230943800000203604"; |
| | | result = unbindBankCard(bizUserId,cardNo); |
| | | logger.info("unbindBankCard result: status={},message={}",new Object[]{result.getStatus(),result.getMessage()}); |
| | | |
| | | log.info("<-------------------------this is signContract operation ä¼åçµåç¾çº¦------------------------->"); |
| | | |
| | | SignContractApply signContractApply = SignContractApply.builder() |
| | | .bizUserId("tz20200401113") |
| | | .jumpUrl("http://www.baidu.com") |
| | | .backUrl("localhost") |
| | | .source(2L) |
| | | .build(); |
| | | String webParamUrl = "http://116.228.64.55:6900/yungateway/member/signContract.html?"; |
| | | String signUrl = signContract(signContractApply,webParamUrl); //以åå° H5 页é¢å½¢å¼è¿è¡è¯·æ± |
| | | System.out.println("signUrl is " + signUrl); |
| | | }*/ |
| | | |
| | | |
| | | /** |
| | | * ä¼åçµåç¾çº¦ |
| | | * |
| | | * @param signContractApply |
| | | * @return |
| | | * |
| | | */ |
| | | public static String signContract(SignContractApply signContractApply, String webParamUrl) { |
| | | final YunRequest request = new YunRequest("MemberService", "signContract"); |
| | | request.put("bizUserId", signContractApply.getBizUserId()); |
| | | request.put("jumpUrl", signContractApply.getJumpUrl()); |
| | | request.put("backUrl", signContractApply.getBackUrl()); |
| | | request.put("source", signContractApply.getSource()); |
| | | try { |
| | | webParamUrl += YunClient.encodeOnce(request); |
| | | return webParamUrl; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å建ä¼å |
| | | * |
| | | * @param bizUserId ç¨æ·æ è¯ï¼ç¨æ·ä¸»é®idï¼ |
| | | * @param memberType ä¼åç±»å [2.ä¼ä¸ä¼å 3.个人ä¼å] |
| | | * @param source 访é®ç»ç«¯ç±»å[1.mobile 2.pc] |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 16:12 |
| | | */ |
| | | public static YunStResult createMember(String bizUserId, Long memberType, Long source) { |
| | | final YunRequest request = new YunRequest("MemberService", "createMember"); |
| | | request.put("bizUserId", bizUserId); |
| | | request.put("memberType", memberType); |
| | | request.put("source", source); |
| | | try { |
| | | return JSONUtil.toBean(YunClient.request(request), YunStResult.class); |
| | | } catch (final Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ä¼åç»å®æ¯ä»è´¦æ·ç¨æ·æ è¯ |
| | | * |
| | | * @param bizUserId ç¨æ·æ è¯ï¼ç¨æ·ä¸»é®idï¼ |
| | | * @param acctType æ¯ä»è´¦æ·ç±»åãweChatPublicï¼å¾®ä¿¡å
¬ä¼å· weChatMiniProgramï¼å¾®ä¿¡å°ç¨åº aliPayServiceï¼æ¯ä»å®çæ´»å·ã |
| | | * @param acct æ¯ä»è´¦æ·ç¨æ·æ è¯ã微信å
¬ä¼å·openid/微信å°ç¨åºopenid/æ¯ä»å®çæ´»å·user_id ã |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 16:12 |
| | | */ |
| | | public static YunStResult applyBindAcct(String bizUserId, String acctType, String acct) { |
| | | final YunRequest request = new YunRequest("MemberService", "applyBindAcct"); |
| | | request.put("bizUserId", bizUserId); |
| | | request.put("operationType", "set"); |
| | | request.put("acctType", acctType); |
| | | request.put("acct", acct); |
| | | try { |
| | | return JSONUtil.toBean(YunClient.request(request), YunStResult.class); |
| | | } catch (final Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * åéçä¿¡éªè¯ç |
| | | * |
| | | * @param bizUserId ç¨æ·æ è¯ï¼ç¨æ·ä¸»é®idï¼ |
| | | * @param phone ææºå·ç |
| | | * @param verificationCodeType éªè¯ç ç±»å[9-ç»å®ææº 6-è§£ç»ææº] |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 16:12 |
| | | */ |
| | | public static YunStResult sendVerificationCode(String bizUserId, String phone, Long verificationCodeType) { |
| | | final YunRequest request = new YunRequest("MemberService", "sendVerificationCode"); |
| | | request.put("bizUserId", bizUserId); |
| | | request.put("phone", phone); |
| | | request.put("verificationCodeType", verificationCodeType); |
| | | try { |
| | | return JSONUtil.toBean(YunClient.request(request), YunStResult.class); |
| | | } catch (final Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ç»å®ææº |
| | | * |
| | | * @param bizUserId ç¨æ·æ è¯ï¼ç¨æ·ä¸»é®idï¼ |
| | | * @param phone ææºå·ç |
| | | * @param verificationCode éªè¯ç |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 16:12 |
| | | */ |
| | | public static YunStResult bindPhone(String bizUserId, String phone, String verificationCode) { |
| | | final YunRequest request = new YunRequest("MemberService", "bindPhone"); |
| | | request.put("bizUserId", bizUserId); |
| | | request.put("phone", phone); |
| | | request.put("verificationCode", verificationCode); |
| | | try { |
| | | return JSONUtil.toBean(YunClient.request(request), YunStResult.class); |
| | | } catch (final Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 个人å®åè®¤è¯ |
| | | * |
| | | * @param bizUserId ç¨æ·æ è¯ï¼ç¨æ·ä¸»é®idï¼ |
| | | * @param name å§å |
| | | * @param identityType è¯ä»¶ç±»åã1.èº«ä»½è¯ 2.æ¤ç
§ 3.åå®è¯ 4.åä¹¡è¯ 5.å°èè¯ 6.è¦å®è¯ 7.士å
µè¯ 99.å
¶ä»è¯ä»¶ã |
| | | * @param identityNo è¯ä»¶å·ç |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 16:12 |
| | | */ |
| | | public static YunStResult setRealName(String bizUserId, String name, Long identityType, String identityNo) { |
| | | final YunRequest request = new YunRequest("MemberService", "setRealName"); |
| | | try { |
| | | request.put("bizUserId", bizUserId); |
| | | request.put("name", name); |
| | | request.put("identityType", identityType); |
| | | request.put("identityNo", RSAUtil.encrypt(identityNo)); |
| | | return JSONUtil.toBean(YunClient.request(request), YunStResult.class); |
| | | } catch (final Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 请æ±ç»å®é¶è¡å¡ |
| | | * |
| | | * @param bizUserId ç¨æ·æ è¯ï¼ç¨æ·ä¸»é®idï¼ |
| | | * @param cardNo é¶è¡å¡å· |
| | | * @param phone é¶è¡é¢çææº |
| | | * @param name å§å |
| | | * @param identityType è¯ä»¶ç±»åã1.èº«ä»½è¯ 2.æ¤ç
§ 3.åå®è¯ 4.åä¹¡è¯ 5.å°èè¯ 6.è¦å®è¯ 7.士å
µè¯ 99.å
¶ä»è¯ä»¶ã |
| | | * @param identityNo è¯ä»¶å·ç |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 16:12 |
| | | */ |
| | | public static YunStResult applyBindBankCard(String bizUserId, String cardNo, String phone, String name, Long identityType, String identityNo) { |
| | | final YunRequest request = new YunRequest("MemberService", "applyBindBankCard"); |
| | | try { |
| | | request.put("bizUserId", bizUserId); |
| | | request.put("cardNo", RSAUtil.encrypt(cardNo)); |
| | | request.put("cardNo", YunClient.encrypt(cardNo)); |
| | | request.put("phone", phone); |
| | | request.put("name", name); |
| | | request.put("cardCheck", 7L); //é»è®¤7Lå¿«æ·æ¯ä» |
| | | request.put("identityType", identityType); |
| | | request.put("identityNo", RSAUtil.encrypt(identityNo)); |
| | | return JSONUtil.toBean(YunClient.request(request), YunStResult.class); |
| | | } catch (final Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 确认ç»å®é¶è¡å¡ |
| | | * |
| | | * @param bizUserId ç¨æ·æ è¯ï¼ç¨æ·ä¸»é®idï¼ |
| | | * @param tranceNum æµæ°´å· |
| | | * @param transDate ç³è¯·æ¶é´ |
| | | * @param phone é¶è¡é¢çææº |
| | | * @param verificationCode ææºéªè¯ç |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 16:12 |
| | | */ |
| | | public static YunStResult bindBankCard(String bizUserId, String tranceNum, String transDate, String phone, String verificationCode) { |
| | | final YunRequest request = new YunRequest("MemberService", "bindBankCard"); |
| | | try { |
| | | request.put("bizUserId", bizUserId); |
| | | request.put("tranceNum", tranceNum); |
| | | request.put("transDate", transDate); |
| | | request.put("phone", phone); |
| | | request.put("verificationCode", verificationCode); |
| | | return JSONUtil.toBean(YunClient.request(request), YunStResult.class); |
| | | } catch (final Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static YunStResult queryBankCard(String bizUserId, String cardNo){ |
| | | final YunRequest request = new YunRequest("MemberService","queryBankCard"); |
| | | try { |
| | | if (StrUtil.isNotEmpty(cardNo)){ |
| | | RSAUtil.encrypt(cardNo); |
| | | }; |
| | | request.put("bizUserId",bizUserId); |
| | | request.put("cardNo",cardNo); |
| | | return JSONUtil.toBean(YunClient.request(request),YunStResult.class); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * è§£é¤ç»å®é¶è¡å¡ |
| | | * |
| | | * @param bizUserId ç¨æ·æ è¯ï¼ç¨æ·ä¸»é®idï¼ |
| | | * @param cardNo é¶è¡å¡å· |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 16:12 |
| | | */ |
| | | public static YunStResult unbindBankCard(String bizUserId, String cardNo) { |
| | | final YunRequest request = new YunRequest("MemberService", "unbindBankCard"); |
| | | try { |
| | | request.put("bizUserId", bizUserId); |
| | | request.put("cardNo", RSAUtil.encrypt(cardNo)); |
| | | return JSONUtil.toBean(YunClient.request(request), YunStResult.class); |
| | | } catch (final Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置ä¼ä¸ä¼åä¿¡æ¯ï¼ææ¶ä¸ç¨ï¼ |
| | | * |
| | | * @param bizUserId:ç¨æ·æ è¯ï¼ç¨æ·ä¸»é®idï¼ |
| | | * @param backUrl:ä¼ä¸ä¼åå®¡æ ¸ç»æéç¥url |
| | | * @param isAuth:æ¯å¦è¿è¡çº¿ä¸è®¤è¯ |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 16:12 |
| | | */ |
| | | public static YunStResult setCompanyInfo(String bizUserId, String backUrl, Boolean isAuth, MerchantApply merchantApply) { |
| | | final YunRequest request = new YunRequest("MemberService", "setCompanyInfo"); |
| | | try { |
| | | merchantApply.setLegalIds(RSAUtil.encrypt(merchantApply.getLegalIds())); |
| | | merchantApply.setAccountNo(RSAUtil.encrypt(merchantApply.getAccountNo())); |
| | | request.put("companyBasicInfo", merchantApply); |
| | | request.put("bizUserId", bizUserId); |
| | | request.put("backUrl", backUrl); |
| | | request.put("isAuth", isAuth); |
| | | return JSONUtil.toBean(YunClient.request(request), YunStResult.class); |
| | | } catch (final Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¶è´¹ç³è¯·ï¼æ¶é¶å®å¿«æ·æ¯ä»ï¼ |
| | | * |
| | | * @param consumeApply:æ¶è´¹å
Œ
±å®ä½ |
| | | * @param bankCardNo:é¶è¡å¡å· |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 16:12 |
| | | */ |
| | | public static YunStResult quickPayVsp(ConsumeApply consumeApply, String bankCardNo) throws Exception { |
| | | final YunRequest request = new YunRequest("OrderService", "consumeApply"); |
| | | |
| | | HashMap<String, Object> params = new HashMap<>(); |
| | | params.put("limitPay", "no_credit"); |
| | | params.put("bankCardNo", RSAUtil.encrypt(bankCardNo)); |
| | | |
| | | // ç»è£
æ¯ä»æ¹å¼ |
| | | HashMap<String, Object> payMethod = new HashMap<>(); |
| | | payMethod.put("QUICKPAY_VSP", params); |
| | | |
| | | request.put("payerId", consumeApply.getPayerId()); |
| | | request.put("recieverId", consumeApply.getRecieverId()); |
| | | request.put("bizOrderNo", consumeApply.getBizOrderNo()); |
| | | request.put("amount", consumeApply.getAmount()); |
| | | request.put("fee", consumeApply.getFee()); |
| | | request.put("validateType", consumeApply.getValidateType()); |
| | | request.put("backUrl", consumeApply.getBackUrl()); |
| | | request.put("orderExpireDatetime", consumeApply.getOrderExpireDatetime()); |
| | | request.put("payMethod", payMethod); |
| | | request.put("industryCode", YunStParam.industryCode); |
| | | request.put("industryName", YunStParam.industryName); |
| | | request.put("source", YunStParam.source); |
| | | request.put("summary", consumeApply.getSummary()); |
| | | request.put("extendInfo", consumeApply.getExtendInfo()); |
| | | request.put("splitRule", consumeApply.getSplitRule()); |
| | | try { |
| | | return JSONUtil.toBean(YunClient.request(request), YunStResult.class); |
| | | } catch (final Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 确认æ¯ä»ï¼åå°+çä¿¡éªè¯ç ç¡®è®¤ï¼ |
| | | * |
| | | * @param bizUserId ç¨æ·æ è¯ï¼ç¨æ·ä¸»é®idï¼ |
| | | * @param bizOrderNo 订åç¼å·ï¼æ¯ä»è®¢åï¼ |
| | | * @param tradeNo 交æç¼å· |
| | | * @param verificationCode çä¿¡éªè¯ç |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 16:12 |
| | | */ |
| | | public static YunStResult pay(String bizUserId, String bizOrderNo, String tradeNo, String verificationCode) { |
| | | ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
| | | // HttpServletRequest req = requestAttributes.getRequest(); |
| | | // String ipAddress = IPUtil.getIpAddr(req); //æ£å¼ç¯å¢ä¼ ç¨æ·ip |
| | | final YunRequest request = new YunRequest("OrderService", "pay"); |
| | | try { |
| | | request.put("bizUserId", bizUserId); |
| | | request.put("bizOrderNo", bizOrderNo); |
| | | request.put("tradeNo", tradeNo); |
| | | request.put("verificationCode", verificationCode); |
| | | request.put("bizOrderNo", bizOrderNo); |
| | | request.put("consumerIp", IPUtil.getLocalHostIp()); //ipå°å |
| | | return JSONUtil.toBean(YunClient.request(request), YunStResult.class); |
| | | } catch (final Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢è®¢åç¶æ |
| | | * |
| | | * @param bizOrderNo 订åç¼å·ï¼æ¯ä»è®¢åï¼ |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 16:12 |
| | | */ |
| | | public static YunStResult getOrderDetail(String bizOrderNo) { |
| | | final YunRequest request = new YunRequest("OrderService", "getOrderDetail"); |
| | | try { |
| | | request.put("bizOrderNo", bizOrderNo); |
| | | return JSONUtil.toBean(YunClient.request(request), YunStResult.class); |
| | | } catch (final Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¶è´¹ç³è¯·ï¼å¾®ä¿¡å°ç¨åºï¼ |
| | | * |
| | | * @param consumeApply:æ¶è´¹å
Œ
±å®ä½ |
| | | * @param vspCusid:æ¶é¶å®ååæ·å· |
| | | * @param subAppid:微信å°ç¨åºæ¯ä»appidåæ° |
| | | * @param amount:æ¯ä»éé¢ï¼åä½ï¼å |
| | | * @param acct:微信JSæ¯ä»openidââ微信åé
|
| | | * @Author: lc |
| | | * @Date: 2019/10/14 16:12 |
| | | */ |
| | | public static YunStResult wechatMiniprogramPay(ConsumeApply consumeApply, String vspCusid, String subAppid, Long amount, String acct) { |
| | | final YunRequest request = new YunRequest("OrderService", "consumeApply"); |
| | | |
| | | HashMap<String, Object> params = new HashMap<>(); |
| | | params.put("vspCusid", vspCusid); |
| | | params.put("subAppid", subAppid); //æ£å¼ç¯å¢è¯·å¿
ä¼ |
| | | params.put("limitPay", "no_credit"); |
| | | params.put("amount", amount); |
| | | params.put("acct", acct); |
| | | |
| | | // ç»è£
æ¯ä»æ¹å¼ |
| | | HashMap<String, Object> payMethod = new HashMap<>(); |
| | | //payMethod.put("WECHATPAY_MINIPROGRAM", params); //æµè¯ |
| | | payMethod.put("WECHATPAY_MINIPROGRAM_ORG", params); //æ£å¼éå¢ç |
| | | |
| | | request.put("payerId", consumeApply.getPayerId()); |
| | | request.put("recieverId", consumeApply.getRecieverId()); |
| | | request.put("bizOrderNo", consumeApply.getBizOrderNo()); |
| | | request.put("amount", consumeApply.getAmount()); |
| | | request.put("fee", consumeApply.getFee()); |
| | | request.put("validateType", consumeApply.getValidateType()); |
| | | request.put("backUrl", consumeApply.getBackUrl()); |
| | | request.put("orderExpireDatetime", consumeApply.getOrderExpireDatetime()); |
| | | request.put("payMethod", payMethod); |
| | | request.put("industryCode", YunStParam.industryCode); |
| | | request.put("industryName", YunStParam.industryName); |
| | | request.put("source", YunStParam.source); |
| | | request.put("summary", consumeApply.getSummary()); |
| | | request.put("extendInfo", consumeApply.getExtendInfo()); |
| | | request.put("splitRule", consumeApply.getSplitRule()); |
| | | try { |
| | | return JSONUtil.toBean(YunClient.request(request), YunStResult.class); |
| | | } catch (final Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¶è´¹ç³è¯·ï¼Bæ«C ç¨æ·è¢«æ«ï¼ |
| | | * |
| | | * @param consumeApply:æ¶è´¹å
Œ
±å®ä½ |
| | | * @param vspCusid:æ¶é¶å®ååæ·å· |
| | | * @param amount:æ¯ä»éé¢ï¼åä½ï¼å |
| | | * @param authcode:æ¯ä»ææç ï¼ç¨æ·åºç¤ºçäºç»´ç ï¼ |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 16:12 |
| | | */ |
| | | public static YunStResult doCodePay(ConsumeApply consumeApply, String vspCusid, Long amount, String authcode) { |
| | | final YunRequest request = new YunRequest("OrderService", "consumeApply"); |
| | | |
| | | HashMap<String, Object> params = new HashMap<>(); |
| | | params.put("amount", amount); |
| | | params.put("vspCusid", vspCusid); |
| | | params.put("authcode", authcode); |
| | | params.put("limitPay", "no_credit"); |
| | | |
| | | // ç»è£
æ¯ä»æ¹å¼ |
| | | HashMap<String, Object> payMethod = new HashMap<>(); |
| | | payMethod.put("CODEPAY_VSP", params); |
| | | //payMethod.put("CODEPAY_VSP_ORG", params); //æ£å¼éå¢ç |
| | | |
| | | request.put("payerId", consumeApply.getPayerId()); |
| | | request.put("recieverId", consumeApply.getRecieverId()); |
| | | request.put("bizOrderNo", consumeApply.getBizOrderNo()); |
| | | request.put("amount", consumeApply.getAmount()); |
| | | request.put("fee", consumeApply.getFee()); |
| | | request.put("validateType", consumeApply.getValidateType()); |
| | | request.put("backUrl", consumeApply.getBackUrl()); |
| | | request.put("orderExpireDatetime", consumeApply.getOrderExpireDatetime()); |
| | | request.put("payMethod", payMethod); |
| | | request.put("industryCode", YunStParam.industryCode); |
| | | request.put("industryName", YunStParam.industryName); |
| | | request.put("source", YunStParam.source); |
| | | request.put("summary", consumeApply.getSummary()); |
| | | request.put("extendInfo", consumeApply.getExtendInfo()); |
| | | request.put("splitRule", consumeApply.getSplitRule()); |
| | | try { |
| | | return JSONUtil.toBean(YunClient.request(request), YunStResult.class); |
| | | } catch (final Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¶è´¹ç³è¯·ï¼Cæ«B ç¨æ·ä¸»æ«ï¼ |
| | | * |
| | | * @param consumeApply:æ¶è´¹å
Œ
±å®ä½ |
| | | * @param vspCusid:æ¶é¶å®ååæ·å· |
| | | * @param amount:æ¯ä»éé¢ï¼åä½ï¼å |
| | | * @param acctType:æ¯ä»è´¦æ·ç±»åãSCAN_WEIXIN_ORGï¼å¾®ä¿¡ SCAN_ALIPAY_ORGï¼æ¯ä»å® SCAN_UNIONPAY_ORGï¼é¶èäºéªä»ã æµè¯ç¯å¢ä¸å¸¦_ORG |
| | | * @Author: lc |
| | | * @Date: 2019/10/14 16:12 |
| | | */ |
| | | public static YunStResult doScanPay(ConsumeApply consumeApply, String vspCusid, Long amount, String acctType) { |
| | | final YunRequest request = new YunRequest("OrderService", "consumeApply"); |
| | | |
| | | HashMap<String, Object> params = new HashMap<>(); |
| | | params.put("vspCusid", vspCusid); |
| | | params.put("amount", amount); |
| | | params.put("limitPay", "no_credit"); |
| | | |
| | | // ç»è£
æ¯ä»æ¹å¼ |
| | | HashMap<String, Object> payMethod = new HashMap<>(); |
| | | payMethod.put(acctType, params); |
| | | |
| | | request.put("payerId", consumeApply.getPayerId()); |
| | | request.put("recieverId", consumeApply.getRecieverId()); |
| | | request.put("bizOrderNo", consumeApply.getBizOrderNo()); |
| | | request.put("amount", consumeApply.getAmount()); |
| | | request.put("fee", consumeApply.getFee()); |
| | | request.put("validateType", consumeApply.getValidateType()); |
| | | request.put("backUrl", consumeApply.getBackUrl()); |
| | | request.put("orderExpireDatetime", consumeApply.getOrderExpireDatetime()); |
| | | request.put("payMethod", payMethod); |
| | | request.put("industryCode", YunStParam.industryCode); |
| | | request.put("industryName", YunStParam.industryName); |
| | | request.put("source", YunStParam.source); |
| | | request.put("summary", consumeApply.getSummary()); |
| | | request.put("extendInfo", consumeApply.getExtendInfo()); |
| | | request.put("splitRule", consumeApply.getSplitRule()); |
| | | try { |
| | | return JSONUtil.toBean(YunClient.request(request), YunStResult.class); |
| | | } catch (final Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | lc(20191015) |
| | | |
| | | ä¸.个人ä¼åä¹°å®¶çº¿ä¸æ¯ä»ï¼ |
| | | |
| | | 1.使ç¨å¾®ä¿¡å°ç¨åºï¼ å建ä¼å --ãä¼åç»å®æ¯ä»è´¦æ·ç¨æ·æ è¯ï¼æ¯ä»è´¦æ·ç»å®å°ç¨åºopenIdï¼--ãæ¶è´¹ç³è¯· --ã订åç»æéç¥ --ã宿ã |
| | | |
| | | 2.ä½¿ç¨æ¶é¶å®å¿«æ·æ¯ä»ï¼å建ä¼å --ãåééªè¯ç --ãç»å®ææº --ã个人å®åè®¤è¯ --ã请æ±ç»å®é¶è¡å¡ --ã确认ç»å®é¶è¡å¡ --ãè§£ç»é¶è¡å¡ï¼éè¦æ¶è°ç¨ï¼ --ã |
| | | æ¶è´¹ç³è¯·ï¼çä¿¡éªè¯ç æ¹å¼ï¼ --ã确认æ¯ä»ï¼åå°+çä¿¡éªè¯ç 确认ï¼--ãæ¥è¯¢è®¢åç¶æï¼æ ¹æ®ç¡®è®¤æ¯ä»æ¥å£è¿åå¤çä¸åè°ç¨ï¼æå/失败ä¸è°ç¨ï¼--ã宿ã |
| | | |
| | | äº.个人ä¼åä¹°å®¶çº¿ä¸æ¯ä» |
| | | 3.线ä¸é¢å¯¹é¢ä»ï¼Bæ«cï¼ï¼å建ä¼å --ãä¼åç»å®æ¯ä»è´¦æ·ç¨æ·æ è¯ï¼æ¯ä»è´¦æ·ç»å®å¾®ä¿¡/æ¯ä»å®/äºéªä»openIdï¼ --ãæ¶è´¹ç³è¯·ï¼æ¯ä»æ¹å¼ï¼æ¶é¶å®å·å¡æ¯ä»ï¼è¢«æ«ï¼_éå¢ââæ¯æå¾®ä¿¡ãæ¯ä»å®ãé¶èãææºQQï¼ |
| | | --ã订åç»æéç¥ï¼æ¯ä»æ¥å£è¿åå¤çä¸åè°ç¨ï¼æå/失败ä¸è°ç¨ï¼ --ã宿ã |
| | | |
| | | 4.线ä¸é¢å¯¹é¢ä»ï¼cæ«bï¼ï¼å建ä¼å --ãä¼åç»å®æ¯ä»è´¦æ·ç¨æ·æ è¯ï¼æ¯ä»è´¦æ·ç»å®å¾®ä¿¡/æ¯ä»å®/äºéªä»openIdï¼ --ãæ¶è´¹ç³è¯·ï¼å¾®ä¿¡/æ¯ä»å
/é¶èæ«ç æ¯ä»(æ£æ«) _éå¢ï¼ |
| | | --ã订åç»æéç¥ï¼æ¯ä»æ¥å£è¿åå¤çä¸åè°ç¨ï¼æå/失败ä¸è°ç¨ï¼ --ã宿 |
| | | |
| | | ä¸.ä¼ä¸åå®¶ä¼åï¼é®æ¿æºæï¼ |
| | | 1.æ¶æ¬¾æ¹ï¼å建ä¼å --ã 设置ä¼ä¸ä¼åä¿¡æ¯ --ãä¼ä¸ä¼åå®¡æ ¸ç»æéç¥ --ãåéçä¿¡éªè¯ç ï¼ç±»åç»å®ææºï¼ --ãç»å®ææº --ãè§£ç»ææºï¼éè¦æ¶è°ç¨ï¼ --ãä¼åçµååè®®ç¾çº¦ --ã宿ã |
| | | |
| | | |
| | | å.个人åå®¶ä¼åï¼é®æ¿åæ·ï¼ |
| | | 1.æ¶æ¬¾æ¹ å建ä¼å -> åéçä¿¡éªè¯ç -> ç»å®ææº -> è§£ç»ææº ->个人å®åè®¤è¯ -> 请æ±ç»å®é¶è¡å¡ -> 确认ç»å®é¶è¡å¡ -> æ¥è¯¢ç»å®é¶è¡å¡ -> |
| | | è§£ç»ç»å®é¶è¡å¡ -> ä¼åçµååè®®ç¾çº¦ |
| | | |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunstNew; |
| | | |
| | | import cn.hutool.crypto.SecureUtil; |
| | | |
| | | import cn.hutool.http.HttpUtil; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.nuvole.util.pay.allinPay.yunstNew.po.ResultVo; |
| | | import com.nuvole.util.pay.allinPay.yunstNew.po.YstPayUrl; |
| | | |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * Created by chenZhimin |
| | | * Dateï¼2020/8/24 |
| | | * timeï¼10:09 |
| | | */ |
| | | public class ApiPost { |
| | | |
| | | public static ResultVo apiPost(String url, Object obj) { |
| | | System.out.println(url); |
| | | System.out.println(getSignBody(obj)); |
| | | ResultVo result=new ResultVo(); |
| | | try { |
| | | JSONObject data= JSONUtil.xmlToJson(HttpUtil.post(url,getSignBody(obj))); |
| | | result=JSON.parseObject(JSON.toJSONString(data.get("ResultVo")),ResultVo.class); |
| | | System.out.println("wwwwwwwwwwwwww"+result); |
| | | } catch (Exception e) { |
| | | System.out.println("wwwwwwwwwwwwww"+e); |
| | | result.setCode("0"); |
| | | result.setMsg("æ¥å£è¯·æ±å¤±è´¥"); |
| | | result.setData(""); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * ç»è£
带ç¾åæ°æ® |
| | | * @param body |
| | | * @return |
| | | */ |
| | | |
| | | public static String getSignBody(Object body) { |
| | | Map map= JSON.parseObject(JSON.toJSONString(body)); |
| | | String version=YstPayUrl.version; |
| | | String terMerchantId= YstPayUrl.terMerchantId; |
| | | map.put("version",version); |
| | | map.put("terMerchantId",terMerchantId); |
| | | String orgSign=createLinkStringByGet(map)+"&key="+YstPayUrl.ked; |
| | | System.out.println("orgSign--------"+orgSign); |
| | | String sign=SecureUtil.md5(orgSign); |
| | | map.put("sign",sign.toUpperCase()); |
| | | return JSON.toJSONString(map); |
| | | } |
| | | |
| | | /** |
| | | ãã* ææ°ç»ææå
ç´ æåºï¼å¹¶æç
§âåæ°=åæ°å¼âçæ¨¡å¼ç¨â&âåç¬¦æ¼æ¥æå符串 |
| | | ãã* @param params éè¦æåºå¹¶åä¸åç¬¦æ¼æ¥çåæ°ç» |
| | | ãã* @return æ¼æ¥åå符串 |
| | | ãã* @throws UnsupportedEncodingExceptio |
| | | ãã*/ |
| | | |
| | | public static String createLinkStringByGet(Map<String, String> params) { |
| | | List<String> keys = new ArrayList<String>(params.keySet()); |
| | | Collections.sort(keys); |
| | | String prestr = ""; |
| | | for (int i = 0; i < keys.size(); i++) { |
| | | String key = keys.get(i); |
| | | Object value = params.get(key); |
| | | if (i == keys.size() - 1) {//æ¼æ¥æ¶ï¼ä¸å
æ¬æåä¸ä¸ª&å符 |
| | | prestr = prestr + key + "=" + value; |
| | | } else { |
| | | prestr = prestr + key + "=" + value + "&"; |
| | | } |
| | | } |
| | | return prestr; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunstNew; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.nuvole.util.pay.allinPay.yunst.YunStUtil; |
| | | import com.nuvole.util.pay.allinPay.yunstNew.po.*; |
| | | |
| | | import com.nuvole.util.pay.allinPay.yunstNew.po.payment.PaymentOrder; |
| | | import com.nuvole.util.pay.allinPay.yunstNew.po.payment.PaymentSubOrder; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.Test; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * Created by chenZhimin |
| | | * Dateï¼2020/8/24 |
| | | * timeï¼10:45 |
| | | */ |
| | | @Slf4j |
| | | public class YunStUtilNew { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(YunStUtil.class); |
| | | |
| | | //v1/shop/web/payBackYst åè°æ¥å£ |
| | | |
| | | |
| | | /** |
| | | * æµè¯ä¼åå建 |
| | | */ |
| | | |
| | | public void createSellerMember(){ |
| | | CreateMember merber=new CreateMember(); |
| | | merber.setExternalUserid("wl01"); |
| | | merber.setMerchantName("è®°å¿ä¸æ¾å"); |
| | | // merber.setPhone("17839927203"); Acctä¼ å°ç¨åº opeinidå°±è¡ ï¼ä¸ç¨ä¼ ææºå· |
| | | merber.setAcctType("weChatMiniProgram"); |
| | | merber.setAcct("oZN135DrmaB3iCAvbZq_ShTM7FFQ"); |
| | | String bizUserId= createSellerMember(merber); |
| | | System.out.println(bizUserId); |
| | | //1341541084 |
| | | |
| | | //{"ResultVo":{"msg":"å建æå","code":1,"data":{"freezeAmount":"","allAmount":"","externalUserid":"czm01","terUuid":"","companyName":"","memUuid":"","memberType":"","bizUserId":1336179677,"status":"","fileId":""}}} |
| | | } |
| | | /** |
| | | * è°ç¨æç®¡ä»£æ¶æ¥å£ |
| | | */ |
| | | |
| | | public void orderPayer(){ |
| | | OrderPay pay=new OrderPay(); |
| | | pay.setAmount("0.01"); |
| | | pay.setMerOrderNo("11ab_02");//订åå· |
| | | pay.setOrderType("5"); |
| | | pay.setPayerExId("czm02");//ä¹°å®¶è´¦å· |
| | | pay.setSource("1"); |
| | | pay.setType("2"); |
| | | pay.setAcct("oZN135DrmaB3iCAvbZq_ShTM7FFQ"); //微信openId 买家 |
| | | List list=new ArrayList(); |
| | | SubOrder order=new SubOrder(); |
| | | order.setAmount("0.01"); |
| | | order.setRecieverExId("yjp01"); |
| | | order.setSubMerOrderNo("11ab_02"); |
| | | list.add(order); |
| | | /* SubOrder order2=new SubOrder(); |
| | | order2.setAmount("0.01"); |
| | | order2.setRecieverExId("1348216174"); |
| | | order2.setSubMerOrderNo("dd02"); |
| | | order2.setBody("å账订å02"); |
| | | list.add(order2);*/ |
| | | pay.setSubOrder(JSON.toJSONString(list)); |
| | | ResultVo result=orderPayer(pay); |
| | | System.out.println("22222222222222222---"+JSON.toJSONString(result)); |
| | | //wwwwwwwwwwwwwwResultVo(msg=è°ç¨æå, code=1, data={"validateType":"","orderStatus":"","payWhereabouts":"","payInterfaceOutTradeNo":"","couponAmount":"","subBizOrderNo":{"subBizOrderNo":159834506278770},"termno":"","oriOrderNo":"","bizOrderNo":15983450627877,"refundWhereabouts":"","weChatAPPInfo":"","amount":"","orderNo":1298179292374536192,"tradeNo":"","merOrderNo":"11ab","traceno":"","errorMessage":"","freezenAmount":"","extendInfo":"","oriBizOrderNo":"","accttype":"","subMerOrderNo":{"subMerOrderNo":"11ab_01"},"url":"","bizUserId":1329222217,"feeAmount":"","buyerBizUserId":"","payFailMessage":"","allAmount":"","totalNum":"","cusid":"","bizBatchNo":"","payInterfacetrxcode":"","payCode":"","payStatus":"","payInfo":"{\"appId\":\"wx044ba657d536fa6a\",\"timeStamp\":\"1598345063\",\"nonceStr\":\"2f86b439742f4918b26093d76c599e51\",\"package\":\"prepay_id=wx251644234244923f718ac7e4abcb810000\",\"signType\":\"RSA\",\"paySign\":\"t0qNpWWHVx+sjNYNtiH/sYrULcXV/l88Ke2tKDH0XKHy8bAOW01EaM5Xye04+SrpJJkW/5IyVaAMXOt9mp0Bp1k+sWNYRkSozq+gKLWGTm8/zk1Pu/+exruEgnvK08o4UihXIkPD44zdR/AuYEe9YHwfV+3qrm0n+z5mch9JEdzeETuH6GVyFxBoJXL60GziVha3TSDrmsP02gdrBeyUTWjE0kYkLFoZztlxv7cAbqCKMiWQaIJ+dN/l4Nmx6k3zZgupErVLFjY9Rdas90SnOtB2HEAmBs62T82sVV7CaeMEBAxL9bkrGxMWtFYriPuPKqAsZAMmFrc+3Bs3QmQ0LQ==\"}","payDatetime":"","acct":""}) |
| | | } |
| | | |
| | | /** |
| | | * è°ç¨æç®¡ä»£ä»æ¥å£ |
| | | */ |
| | | @Test |
| | | public void paymentPayerOrder(){ |
| | | PaymentOrder pay=new PaymentOrder(); |
| | | pay.setExternalUserid("czm02");//忷代æ¶è®¢å请æ±ä¼åid |
| | | pay.setMerOrderNo("11ab_02_df"); //忷代仿¯ä»è®¢åå· |
| | | pay.setOldMerOrderNo("11ab_02"); //åæ·åå§ä»£æ¶ä¸»è®¢åå· |
| | | pay.setOrderType("6"); |
| | | pay.setSource("1"); //1 pc端 2 微信端 |
| | | pay.setExtendInfo("代ä»å¤æ³¨"); |
| | | List list=new ArrayList(); |
| | | PaymentSubOrder order=new PaymentSubOrder(); |
| | | order.setSubMerOrderNo("df_dd01"); //忷代仿¯ä»å订åå· |
| | | order.setSubOldMerOrderNo("11ab_02"); |
| | | list.add(order); |
| | | /* SubOrder order2=new SubOrder(); |
| | | order2.setAmount("0.01"); |
| | | order2.setRecieverExId("1348216174"); |
| | | order2.setSubMerOrderNo("dd02"); |
| | | order2.setBody("å账订å02"); |
| | | list.add(order2);*/ |
| | | pay.setSubOrder(JSON.toJSONString(list)); |
| | | ResultVo result=orderPayer(pay); |
| | | System.out.println("22222222222222222---"+JSON.toJSONString(result)); |
| | | //wwwwwwwwwwwwwwResultVo(msg=è°ç¨æå, code=1, data={"validateType":"","orderStatus":"","payWhereabouts":"","payInterfaceOutTradeNo":"","couponAmount":"","subBizOrderNo":{"subBizOrderNo":159834506278770},"termno":"","oriOrderNo":"","bizOrderNo":15983450627877,"refundWhereabouts":"","weChatAPPInfo":"","amount":"","orderNo":1298179292374536192,"tradeNo":"","merOrderNo":"11ab","traceno":"","errorMessage":"","freezenAmount":"","extendInfo":"","oriBizOrderNo":"","accttype":"","subMerOrderNo":{"subMerOrderNo":"11ab_01"},"url":"","bizUserId":1329222217,"feeAmount":"","buyerBizUserId":"","payFailMessage":"","allAmount":"","totalNum":"","cusid":"","bizBatchNo":"","payInterfacetrxcode":"","payCode":"","payStatus":"","payInfo":"{\"appId\":\"wx044ba657d536fa6a\",\"timeStamp\":\"1598345063\",\"nonceStr\":\"2f86b439742f4918b26093d76c599e51\",\"package\":\"prepay_id=wx251644234244923f718ac7e4abcb810000\",\"signType\":\"RSA\",\"paySign\":\"t0qNpWWHVx+sjNYNtiH/sYrULcXV/l88Ke2tKDH0XKHy8bAOW01EaM5Xye04+SrpJJkW/5IyVaAMXOt9mp0Bp1k+sWNYRkSozq+gKLWGTm8/zk1Pu/+exruEgnvK08o4UihXIkPD44zdR/AuYEe9YHwfV+3qrm0n+z5mch9JEdzeETuH6GVyFxBoJXL60GziVha3TSDrmsP02gdrBeyUTWjE0kYkLFoZztlxv7cAbqCKMiWQaIJ+dN/l4Nmx6k3zZgupErVLFjY9Rdas90SnOtB2HEAmBs62T82sVV7CaeMEBAxL9bkrGxMWtFYriPuPKqAsZAMmFrc+3Bs3QmQ0LQ==\"}","payDatetime":"","acct":""}) |
| | | } |
| | | /** |
| | | * åå»ºä¸ªäººåæ· |
| | | */ |
| | | public void orderPayerSh(){ |
| | | Map map=new HashMap(); |
| | | map.put("externalUserid","yjp01"); |
| | | map.put("merchantName","ä¸ªäººåæ·å¶"); |
| | | map.put("legalName","å¶å»ºé¹"); |
| | | map.put("phone","17321156857"); |
| | | map.put("identityType","1"); |
| | | map.put("legalIds","410221199004193031"); |
| | | map.put("acctType","aliPayService"); |
| | | map.put("acct","yjp"); |
| | | ResultVo result=ApiPost.apiPost(YstPayUrl.CREATE_SHOP_MEMBER,map); |
| | | System.out.println("22222222222222222---"+result); |
| | | // {"ResultVo":{"msg":"å建æå","code":1,"data":{"freezeAmount":"","allAmount":"","externalUserid":"yjp01","terUuid":"","companyName":"","memUuid":"","memberType":"","bizUserId":1325044892,"status":"","fileId":""}}} |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * ä¼ååå»ºï¼æ¸¸å®¢æ¨¡å¼ |
| | | * |
| | | * //ä¹°å®¶ä¹°å®¶æ³¨åæµç¨ï¼ä¼ååå»ºï¼æ¸¸å®¢æ¨¡å¼ |
| | | * if (storeMemberInfo != null && StrUtil.isEmpty(storeMemberInfo.getYunstuserid())) { |
| | | * CreateMember merber=new CreateMember(); |
| | | * merber.setExternalUserid(Convert.toStr(storeMemberInfo.getId())); |
| | | * merber.setMerchantName(storeMemberInfo.getMemberName()); |
| | | * merber.setAcct(storeMemberInfo.getWechatOpenid()); |
| | | * String yunStUserId=YunStUtilNew.createSellerMember(merber); |
| | | * if(!StrUtil.isEmpty(yunStUserId)){ |
| | | * storeMemberInfo.setYunstuserid(yunStUserId); |
| | | * } |
| | | * } |
| | | */ |
| | | |
| | | public static String createSellerMember(CreateMember merber){ |
| | | String bizUserId=""; |
| | | merber.setAcctType("weChatMiniProgram"); |
| | | |
| | | ResultVo result=ApiPost.apiPost(YstPayUrl.CREATE_SELLER_MEMBER,merber); |
| | | |
| | | if(("1").equals(result.getCode())){ |
| | | Map map= (Map) JSONUtil.parse(result.getData()); |
| | | bizUserId=map.get("bizUserId").toString(); |
| | | } |
| | | return bizUserId; |
| | | } |
| | | /** |
| | | * æç®¡ä»£æ¶/æç®¡ä»£ä» |
| | | */ |
| | | |
| | | public static ResultVo orderPayer(Object pay){ |
| | | |
| | | ResultVo result=ApiPost.apiPost(YstPayUrl.ORDER_PAYER,pay); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunstNew.po; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * Created by chenlong |
| | | * Dateï¼2020/8/24 |
| | | * timeï¼10:57 |
| | | */ |
| | | @Data |
| | | public class CreateMember { |
| | | String externalUserid; |
| | | String merchantName; |
| | | String phone; |
| | | String acctType; |
| | | String acct; |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunstNew.po; |
| | | |
| | | |
| | | |
| | | import lombok.Data; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | |
| | | /** |
| | | * Created by chenlong |
| | | * Dateï¼2020/8/24 |
| | | * timeï¼14:30 |
| | | */ |
| | | @Data |
| | | public class OrderPay { |
| | | /** |
| | | * æ¯ä»å¹³å°ç¨æ·æ è¯ï¼type=2ï¼11ä¼ è¾å¾®ä¿¡openid |
| | | */ |
| | | String acct; |
| | | /** |
| | | * åä½å
|
| | | */ |
| | | String amount; |
| | | /** |
| | | * type=3æ¶ä¼ å
¥ï¼ç¨æ·ä»æ¬¾äºç»´ç |
| | | */ |
| | | String authCode; |
| | | /** |
| | | * åæ·appidï¼å¦ææ²¡æä¼ è¾çæ¶å就使ç¨å¹³å°ç«¯é
ç½®çåæ° |
| | | */ |
| | | String exAppId; |
| | | /** |
| | | * 主订å夿³¨ |
| | | */ |
| | | String extendInfo; |
| | | |
| | | /** |
| | | * åæ·ä»£æ¶æ¯ä»ä¸»è®¢åå· |
| | | */ |
| | | String merOrderNo; |
| | | /** |
| | | * 主订åè¿ææ¶é´ï¼type=14å¿
ä¼ |
| | | */ |
| | | String orderExpireDatetime; |
| | | /** |
| | | * 订å交æç±»åï¼é»è®¤å¡«å5ï¼æç®¡ä»£æ¶ï¼ |
| | | */ |
| | | String orderType="5"; |
| | | |
| | | /** |
| | | * 䏿¹å¹³å°ä»æ¬¾äººä¼åå· |
| | | */ |
| | | String payerExId; |
| | | /** |
| | | * ç»ç«¯è®¿é®ç±»åï¼1 ç§»å¨ç«¯ 2 PC端 |
| | | */ |
| | | String source; |
| | | /** |
| | | *å订åä¿¡æ¯ï¼è¯¦æ
请è§å订åä¿¡æ¯ |
| | | */ |
| | | String subOrder; |
| | | /** |
| | | * 主订åæè¦ |
| | | */ |
| | | String summary; |
| | | /** |
| | | * æ¯ä»æ¸ éï¼ |
| | | */ |
| | | |
| | | String type; |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunstNew.po; |
| | | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * Created by chenlong |
| | | * Dateï¼2020/8/25 |
| | | * timeï¼14:34 |
| | | */ |
| | | @Data |
| | | public class PayBack { |
| | | /** |
| | | * åæ·ä¸»è®¢åå· |
| | | */ |
| | | public String merOrderNo; |
| | | /** |
| | | * ç³»ç»ä¸»è®¢åå· |
| | | */ |
| | | public String bizOrderNo; |
| | | /** |
| | | * åæ·åå§ä¸»è®¢åå·ï¼éæ¬¾çæ¶åå¿
ä¼ |
| | | */ |
| | | public String oriMerOrderNo; |
| | | |
| | | /** |
| | | * ç³»ç»åå§ä¸»è®¢åå·ï¼éæ¬¾çæ¶åå¿
ä¼ |
| | | */ |
| | | public String oriBizOrderNo; |
| | | /** |
| | | * 订åç±»å 1ï¼æ¶è´¹ 2ï¼å
å¼ 3ï¼æç° 4ï¼éè´§ 5ï¼ä»£æ¶ 6ï¼ä»£ä» |
| | | */ |
| | | public String orderType; |
| | | |
| | | /** |
| | | *主订åäº¤ææ¯ä»ç¶æï¼éå¯¹äºæ²¡æå订åç交æï¼success:æåï¼pending:è¿è¡ä¸ï¼fail:失败ï¼success_collectionï¼ä»£ä»æåï¼collection_pendingï¼ä»£ä»è¿è¡ä¸ |
| | | */ |
| | | public String transStatus; |
| | | /** |
| | | 交æè¯·æ±æ¶é´ yyyyMMddhhssmm |
| | | */ |
| | | public String payReqDataTime; |
| | | /** |
| | | * 交æå®ææ¶é´ yyyyMMddhhssmm |
| | | * |
| | | */ |
| | | public String payDataTime; |
| | | /** |
| | | *代æ¶å订åéè´§æ¶ä»£æ¶å订ååå· |
| | | * |
| | | */ |
| | | public String subOriMerOrderNo; |
| | | /** |
| | | * æ¯ä»æ¹å¼ |
| | | */ |
| | | public String paymethod; |
| | | /** |
| | | * å订åï¼è¯¦æ
æ¥çå订åä¿¡æ¯ |
| | | */ |
| | | public String subOrder; |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunstNew.po; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * Created by chenlong |
| | | * Dateï¼2020/8/25 |
| | | * timeï¼14:41 |
| | | */ |
| | | @Data |
| | | public class PayBackChild { |
| | | /** |
| | | * äº¤ææ¯ä»ç¶æï¼successï¼æ¶è´¹æå/åè´¦æåã代仿åãï¼ï¼pendingï¼è¿è¡ä¸ï¼ï¼failï¼äº¤æå¤±è´¥ï¼ï¼success_collectionï¼æ¶æ¬¾æå/ä»£æ¶æå)ï¼collection_pendingï¼æ¶æ¬¾è¿è¡ä¸/代æ¶è¿è¡ä¸ï¼ |
| | | */ |
| | | public String transStatus; |
| | | /** |
| | | * åæ·å订åå· |
| | | */ |
| | | public String subMerOrderNo; |
| | | /** |
| | | * ç³»ç»å订åå· |
| | | */ |
| | | public String subBizOrderNo; |
| | | /** |
| | | *åæ·åå§å订åå·ï¼éæ¬¾çæ¶åå¿
ä¼ |
| | | */ |
| | | public String subOldMerOrderNo; |
| | | /** |
| | | *ç³»ç»åå§åªè®¢åå·ï¼éæ¬¾çæ¶åå¿
ä¼ |
| | | */ |
| | | public String subOriBizOrderNo; |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunstNew.po; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * Created by chenlong |
| | | * Dateï¼2020/8/25 |
| | | * timeï¼13:32 |
| | | */ |
| | | @Data |
| | | public class ResultVo { |
| | | public String msg; |
| | | public String code; |
| | | public String data; |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunstNew.po; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * Created by chenzhimin |
| | | * Dateï¼2020/9/8 |
| | | * timeï¼20:27 |
| | | * åè´¦è§å |
| | | */ |
| | | @Data |
| | | public class SplitRule { |
| | | |
| | | /** |
| | | * 平尿¹å¨éåäºç³»ç»çid æ¯ |
| | | */ |
| | | public String terMerchantId; |
| | | /** |
| | | * åè´¦æ¶æ¬¾äººï¼å¡«ååæ·å¹³å°çä¼åid æ¯ |
| | | */ |
| | | public String externalUserid; |
| | | /** |
| | | * åä½å
æ¯ |
| | | */ |
| | | public String amount; |
| | | |
| | | /** |
| | | * åè´¦è§å å¦ |
| | | */ |
| | | public String splitRule; |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunstNew.po; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import lombok.Data; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Created by chenlong |
| | | * Dateï¼2020/8/24 |
| | | * timeï¼16:23 |
| | | */ |
| | | @Data |
| | | public class SubOrder { |
| | | /** |
| | | * å订å交æéé¢ï¼åä½ä¸ºå
æ¯ |
| | | */ |
| | | String amount; |
| | | /** |
| | | * 订å详æ
å¦ |
| | | */ |
| | | String body; |
| | | /** |
| | | * åæ·æ¶æ¬¾æ¹id æ¯ |
| | | */ |
| | | String recieverExId; |
| | | /** |
| | | * åè´¦è§åï¼è§ä¸æ¹åè´¦è§å,æå¤ä¸å±ï¼æå¤10人åè´¦ï¼ä¸ä¼ è¾è®¤ä¸ºä¸åè´¦ï¼å
¨é¨ä»£ä» å¦ |
| | | */ |
| | | JSONArray splitRule; |
| | | /** |
| | | * å订åèªå¨åè´¦æ¶é´ï¼ä¸ä¼ å°±ä¸ç´æèµ·ï¼ç´å°ä¸»å¨è°ä»£ä»å®æåè´¦ï¼æ´æ°ï¼åä½ï¼å¤© å¦ |
| | | */ |
| | | String spTime; |
| | | /** |
| | | * 忷忝ä»è®¢åå· æ¯ |
| | | */ |
| | | String subMerOrderNo; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunstNew.po; |
| | | |
| | | /** |
| | | * Created by chenlong |
| | | * Dateï¼2020/8/25 |
| | | * timeï¼14:01 |
| | | */ |
| | | public class YstPayUrl { |
| | | //平尿¹å¨è¡ä¸çéåäºç³»ç»ä¸çid |
| | | public static final String terMerchantId="1212908434073104385"; |
| | | //çæ¬å· |
| | | public static final String version="1.0"; |
| | | //MD5å ç¾key |
| | | public static final String ked="test"; |
| | | |
| | | |
| | | |
| | | public static final String url="https://tsytest.allinpaysc.com/api"; |
| | | |
| | | /** |
| | | * ä¼ååå»ºï¼æ¸¸å®¢æ¨¡å¼ |
| | | */ |
| | | public static final String CREATE_SELLER_MEMBER =url+ "/terrace-service/terrace/creat/tourists/member"; |
| | | |
| | | /** |
| | | * è°ç¨æç®¡ä»£æ¶æ¥å£ï¼å¾®ä¿¡å°ç¨åºæ¯ä»é墿¨¡å¼ï¼type:2ï¼ï¼ /æç®¡ä»£ä» |
| | | */ |
| | | public static final String ORDER_PAYER =url+ "/order-service/trans/order"; |
| | | /** |
| | | *ä¼åå建ï¼åæ·ï¼ä¸ªäººä¼åï¼ |
| | | */ |
| | | public static final String CREATE_SHOP_MEMBER =url+"/terrace-service/terrace/creat/personal/member"; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunstNew.po.payment; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * Created by chenzhimin |
| | | * Dateï¼2020/9/8 |
| | | * timeï¼20:15 |
| | | */ |
| | | @Data |
| | | public class PaymentOrder { |
| | | /** |
| | | 代ä»ä¸»è®¢å夿³¨ |
| | | */ |
| | | public String extendInfo; |
| | | /** |
| | | * 忷代æ¶è®¢å请æ±ä¼åid |
| | | */ |
| | | public String externalUserid; |
| | | |
| | | /** |
| | | * 忷代仿¯ä»è®¢åå· |
| | | */ |
| | | public String merOrderNo; |
| | | |
| | | /** |
| | | * åæ·åå§ä»£æ¶ä¸»è®¢åå·ï¼OldMerOrderNoåOriBizOrderNoå¿
ä¼ ä¸ä¸ªï¼ |
| | | */ |
| | | public String oldMerOrderNo; |
| | | |
| | | /** |
| | | * 订åç±»åç±»åï¼é»è®¤å¡«å6ï¼æç®¡ä»£ä»ï¼ |
| | | * |
| | | */ |
| | | public String orderType; |
| | | /** |
| | | *ç³»ç»åå§ä»£æ¶ä¸»è®¢åå·ï¼OldMerOrderNoåOriBizOrderNoå¿
ä¼ ä¸ä¸ªï¼ |
| | | */ |
| | | public String oriBizOrderNo; |
| | | |
| | | /** |
| | | * 1 ç§»å¨ 2 pc端 |
| | | */ |
| | | public String source; |
| | | |
| | | |
| | | /** |
| | | * å订åä¿¡æ¯ï¼è¯¦æ
请è§å订åä¿¡æ¯ï¼ä¸ä¼ è¾çè¯å
¨é¨ä»£ä»ï¼å
¨é¨ä»£ä»çæ¶ååªä¼ è¾ç³»ç»è®¢åå·çæ¶ååæ·å订åå·æèéç³»ç»ä¸èªå·±çæ |
| | | */ |
| | | public String subOrder; |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunstNew.po.payment; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * Created by chenzhimin |
| | | * Dateï¼2020/9/8 |
| | | * timeï¼20:27 |
| | | * åè´¦è§å |
| | | */ |
| | | @Data |
| | | public class PaymentSplitRule { |
| | | |
| | | /** |
| | | * 平尿¹å¨éåäºç³»ç»çid |
| | | */ |
| | | public String terMerchantId; |
| | | /** |
| | | * åè´¦æ¶æ¬¾äººï¼å¡«ååæ·å¹³å°çä¼åid |
| | | */ |
| | | public String externalUserid; |
| | | /** |
| | | * åä½å
æ¯ |
| | | */ |
| | | public String amount; |
| | | |
| | | /** |
| | | * åè´¦è§å å¦ |
| | | */ |
| | | public String splitRule; |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.pay.allinPay.yunstNew.po.payment; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * Created by chenzhimin |
| | | * Dateï¼2020/9/8 |
| | | * timeï¼20:21 |
| | | */ |
| | | @Data |
| | | public class PaymentSubOrder { |
| | | /** |
| | | * æ´æ°åè´¦è§åï¼è§ä¸æ¹åè´¦è§å,æå¤ä¸å±ï¼æå¤10人åè´¦ï¼ä¸ä¼ è¾çè¯æç
§åæ¥è®¾ç½®çä¿¡æ¯åè´¦ å¦ |
| | | */ |
| | | String splitRule; |
| | | /** |
| | | * 忷代仿¯ä»å订åå· æ¯ |
| | | */ |
| | | String subMerOrderNo; |
| | | /** |
| | | * åæ·åå§ä»£æ¶æ¯ä»å订åå·ï¼subOldMerOrderNoåsubOriBizOrderNoå¿
ä¼ ä¸ä¸ªï¼ å¦ |
| | | */ |
| | | String subOldMerOrderNo; |
| | | /** |
| | | * ç³»ç»åå§ä»£æ¶æ¯ä»å订åå·ï¼subOldMerOrderNoåsubOriBizOrderNoå¿
ä¼ ä¸ä¸ªï¼ å¦ |
| | | */ |
| | | String subOriBizOrderNo; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.sc.client.domain; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * ä¼åä¿¡æ¯è¿åç±»ï¼å®¢ç®¡ç³»ç»ï¼ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/7/11 17:50 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "ä¼åä¿¡æ¯è¿åç±»ï¼å®¢ç®¡ç³»ç»ï¼") |
| | | public class ScClient { |
| | | |
| | | @ApiModelProperty(value = "客æ·ç级") |
| | | private String cust_lev; |
| | | |
| | | @ApiModelProperty(value = "æ ç¾å®¢ç¾¤ï¼éå·åéå½¢å¼ï¼") |
| | | private String labelsstr; |
| | | |
| | | @ApiModelProperty(value = "客æ·ç»çç¼å·") |
| | | private String tlrno; |
| | | |
| | | @ApiModelProperty(value = "æºæç¼å·ï¼å¯¹åºä¼å表éçuser_org_codeï¼") |
| | | private String inst_no; |
| | | |
| | | @ApiModelProperty(value = "客æ·å§å") |
| | | private String cust_name; |
| | | |
| | | @ApiModelProperty(value = "ææºå·") |
| | | private String tel; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.sc.client.domain; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 客群è¿åå¼ï¼å®¢ç®¡ç³»ç»ï¼ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/11/2 12:41 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "客群è¿åå¼ï¼å®¢ç®¡ç³»ç»ï¼") |
| | | public class ScGroup { |
| | | |
| | | @ApiModelProperty(value = "客群åç§°") |
| | | private String label_name; |
| | | |
| | | @ApiModelProperty(value = "客群ç¼å·") |
| | | private String label_no; |
| | | |
| | | @ApiModelProperty(value = "ä¸çº§æ ç¾") |
| | | private String parent_label; |
| | | } |
New file |
| | |
| | | package com.nuvole.util.sc.sms; |
| | | |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.nuvole.common.domain.emnu.SMSResultEmnu; |
| | | import com.nuvole.common.domain.result.SMSResult; |
| | | import com.wisentsoft.service.sms.gsmp.GsmpCPSrv; |
| | | |
| | | /** |
| | | * çä¿¡ï¼åå·çï¼ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/6/1 11:09 |
| | | */ |
| | | public class ScSMSUtil { |
| | | private static String ip = "10.1.210.7"; |
| | | private static int port = 13013; |
| | | private static String cpUser = "950013"; |
| | | private static String cpPass = "950013"; |
| | | private static int timeout = 30; |
| | | private static String cpSrvId = "SCYYPDX950013"; |
| | | private static GsmpCPSrv gsmpCPSrv; |
| | | |
| | | static { |
| | | try { |
| | | if (gsmpCPSrv == null) { |
| | | gsmpCPSrv = new GsmpCPSrv(ScSMSUtil.ip, ScSMSUtil.port, ScSMSUtil.cpUser, ScSMSUtil.cpPass, ScSMSUtil.timeout, "/yypdx.log", false); |
| | | gsmpCPSrv.start(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åéçä¿¡ |
| | | * |
| | | * @param mobile ææºå·ç |
| | | * @param message åéæ¶æ¯ææ¬ |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static SMSResult sendSMS(String mobile, String message) { |
| | | |
| | | try { |
| | | String result = gsmpCPSrv.submitMTSMS(mobile, message, cpSrvId); |
| | | if (StrUtil.isEmpty(result)) { |
| | | return new SMSResult(SMSResultEmnu.ERROR, "åé失败ï¼"); |
| | | } |
| | | |
| | | return new SMSResult(SMSResultEmnu.OK); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return new SMSResult(SMSResultEmnu.ERROR, "åéå¼å¸¸ï¼"); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.nuvole.util.sms; |
| | | |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.nuvole.common.domain.emnu.SMSResultEmnu; |
| | | import com.nuvole.common.domain.result.SMSResult; |
| | | import com.nuvole.constants.ServiceConstants; |
| | | import com.nuvole.util.sc.sms.ScSMSUtil; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * åéçä¿¡ï¼ç»ä¸è°åº¦ç±»ï¼ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/6/1 11:09 |
| | | */ |
| | | public class SMSCallUtil { |
| | | |
| | | /** |
| | | * çä¿¡æ¥å£ç±»åï¼1.äºç 2.åå·çå
鍿¥å£ï¼ |
| | | */ |
| | | private final static int SMS_TYPE = 1; |
| | | |
| | | /** |
| | | * åéçä¿¡ |
| | | * |
| | | * @param mobile ææºå·ç å符串 å¤ä¸ªå·ç 以éå·åå² |
| | | * @param message çä¿¡å
容 |
| | | * @Author: lc |
| | | * @Date: 2019/6/1 11:27 |
| | | */ |
| | | public static SMSResult sendSMS(String mobile, String message) { |
| | | |
| | | //èµ°å¤ç½æå¡è°ç¨ |
| | | if (ServiceConstants.SERVICE_TYPE) { |
| | | Map map = new HashMap() {{ |
| | | put("mobile", mobile); |
| | | put("message", message); |
| | | put("smsType", SMS_TYPE); |
| | | }}; |
| | | String result = HttpUtil.get(ServiceConstants.SERVICE_SMS_URL, map); |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | if (!"0".equals(jsonObject.getString("code"))) { |
| | | return new SMSResult(SMSResultEmnu.ERROR, jsonObject.getString("msg")); |
| | | } |
| | | return new SMSResult(SMSResultEmnu.OK); |
| | | } else { |
| | | switch (SMS_TYPE) { |
| | | case 1: |
| | | return YpSMSUtil.sendSMS(mobile, message); |
| | | case 2: |
| | | return ScSMSUtil.sendSMS(mobile, message); |
| | | default: |
| | | break; |
| | | } |
| | | return new SMSResult(SMSResultEmnu.ERROR); |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(sendSMS("17803846500", SMSTemplate.getVaildCodeMsg(RandomUtil.randomNumbers(6)))); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.sms; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * çä¿¡åéè®°å½ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/6/1 14:20 |
| | | */ |
| | | @Data |
| | | public class SMSHistory { |
| | | |
| | | @ApiModelProperty(value = "ææºå·") |
| | | private String mobile; |
| | | |
| | | @ApiModelProperty(value = "æååéæ¶é´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date lastTime; |
| | | |
| | | @ApiModelProperty(value = "次æ°") |
| | | private Integer num; |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.sms; |
| | | |
| | | |
| | | /** |
| | | * çä¿¡æ¨¡æ¿ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/6/1 14:20 |
| | | */ |
| | | public class SMSTemplate { |
| | | |
| | | /** |
| | | * çä¿¡éªè¯ç è®°å½æ è¯ |
| | | */ |
| | | public static final String SMS_MOILE_HISTORY_K = "SMS_MOILE_HISTORY_K:"; |
| | | |
| | | /** |
| | | * éªè¯ç è®°å½æææï¼1å¤©ï¼ |
| | | */ |
| | | public static final Long SMS_MOILE_HISTORY_TIME = Long.valueOf(1); |
| | | |
| | | /** |
| | | * éªè¯ç ä¸å°æ¶å¯å鿬¡æ°ï¼æ¬¡ï¼ |
| | | */ |
| | | public static final int SMS_SEND_NUM_HOUR = 5; |
| | | |
| | | /** |
| | | * éªè¯ç ä¸å¤©å¯å鿬¡æ°ï¼æ¬¡ï¼ |
| | | */ |
| | | public static final int SMS_SEND_NUM_DAY = 10; |
| | | |
| | | |
| | | /** |
| | | * éªè¯ç æææï¼åéï¼ |
| | | */ |
| | | public static final int CODE_VALIDITY_TIME = 5; |
| | | |
| | | /** |
| | | * çä¿¡éªè¯ç -åæ·éç½®å¯ç -æ è¯ |
| | | */ |
| | | public static final String SHOP_RESET_MIX_PD_CODE = "SHOP_RESET_MIX_PD_CODE"; |
| | | |
| | | /** |
| | | * çä¿¡éªè¯ç -å¾®ä¿¡ç«¯ä¿®æ¹ææºå·-æ è¯ |
| | | */ |
| | | public static final String WECHAT_SET_MOBILE = "WECHAT_SET_MOBILE"; |
| | | /** |
| | | * çä¿¡éªè¯ç -H5å
¬ä¼å·ç«¯æ¯ä»æ¶ï¼æ³¨åå¹¶ç»é æ è¯ |
| | | */ |
| | | public static final String WECHAT_H5PAY_MOBILE = "WECHAT_H5PAY_MOBILE"; |
| | | /** |
| | | * çä¿¡éªè¯ç -H5çå°ç¨åºç»å½ï¼æ³¨åå¹¶ç»é æ è¯ |
| | | */ |
| | | public static final String H5_MIN_MOBILE = "H5_MIN_MOBILE"; |
| | | |
| | | /** |
| | | * çä¿¡éªè¯ç -客æ·ç»çappéç½®å¯ç -æ è¯ |
| | | */ |
| | | public static final String MANAGER_RESET_MIX_PD_CODE = "MANAGER_RESET_MIX_PD_CODE"; |
| | | |
| | | /** |
| | | * ç信模æ¿1 |
| | | */ |
| | | // private static String SEND_MSG = "ãæé®éºãæ¨çéªè¯ç æ¯#code#ãå¦éæ¬äººæä½ï¼è¯·å¿½ç¥æ¬çä¿¡"; |
| | | private static String SEND_MSG = "ãéææºãéªè¯ç ï¼#code#(30åéå
ææ)ãè¯·å°½å¿«å®æéªè¯ã"; |
| | | |
| | | //é¢åä¿é©çä¿¡éªè¯äºåéæææ è¯ |
| | | public static final String INSURANCE_SMS_MOBILE = "INSURANCE_SMS_MOBILE"; |
| | | |
| | | //é¢ä¿çä¿¡ä¸åéæææ è¯ |
| | | public static final String INSURANCE_SMS_MOBILE_REPLACE = "INSURANCE_SMS_MOBILE_REPLACE"; |
| | | |
| | | /** |
| | | * è·åçä¿¡å
容1 |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/6/1 14:23 |
| | | */ |
| | | public static String getVaildCodeMsg(String code) { |
| | | String msg = SEND_MSG; |
| | | return msg.replaceAll("#code#", code); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util.sms; |
| | | |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.nuvole.common.domain.emnu.SMSResultEmnu; |
| | | import com.nuvole.common.domain.result.SMSResult; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * çä¿¡ï¼äºçï¼ |
| | | * |
| | | * @Author: lc |
| | | * @Date: 2019/6/1 11:09 |
| | | */ |
| | | public class YpSMSUtil { |
| | | |
| | | |
| | | private static String YP_SMS_K = "faf531146ca1e38abacd3862fb3fc32b"; |
| | | private static String YP_SMS_URL = "https://sms.yunpian.com/v2/sms/single_send.json"; |
| | | |
| | | |
| | | /** |
| | | * åéçä¿¡ |
| | | * |
| | | * @param mobile ææºå·ç å符串 å¤ä¸ªå·ç 以éå·åå² |
| | | * @param message çä¿¡å
容 |
| | | * @Author: lc |
| | | * @Date: 2019/6/1 11:27 |
| | | */ |
| | | public static SMSResult sendSMS(String mobile, String message) { |
| | | |
| | | if (StrUtil.isEmpty(mobile)) { |
| | | return new SMSResult(SMSResultEmnu.ERROR, "ææºå·ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | if (StrUtil.isEmpty(message)) { |
| | | return new SMSResult(SMSResultEmnu.ERROR, "çä¿¡å
容ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | try { |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("apikey", YP_SMS_K); |
| | | param.put("mobile", mobile); |
| | | param.put("text", message); |
| | | String msg = HttpUtil.post(YP_SMS_URL, param); |
| | | JSONObject jsonObject = JSONObject.parseObject(msg); |
| | | if (!"0".equals(jsonObject.getString("code"))) { |
| | | return new SMSResult(SMSResultEmnu.ERROR, jsonObject.getString("msg")); |
| | | } |
| | | return new SMSResult(SMSResultEmnu.OK); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return new SMSResult(SMSResultEmnu.ERROR, "åéå¼å¸¸ï¼"); |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(sendSMS("17803846500", SMSTemplate.getVaildCodeMsg(RandomUtil.randomNumbers(6)))); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="ISO-8859-1" ?> |
| | | |
| | | |
| | | <!-- |
| | | W3C rules retrieved from: |
| | | http://www.w3.org/TR/html401/struct/global.html |
| | | --> |
| | | |
| | | |
| | | <anti-samy-rules xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:noNamespaceSchemaLocation="antisamy.xsd"> |
| | | |
| | | <directives> |
| | | <directive name="omitXmlDeclaration" value="true"/> |
| | | <directive name="omitDoctypeDeclaration" value="true"/> |
| | | <directive name="maxInputSize" value="200000"/> |
| | | <directive name="useXHTML" value="true"/> |
| | | <directive name="formatOutput" value="true"/> |
| | | <directive name="nofollowAnchors" value="true" /> |
| | | <directive name="validateParamAsEmbed" value="true" /> |
| | | |
| | | <!-- |
| | | remember, this won't work for relative URIs - AntiSamy doesn't |
| | | know anything about the URL or your web structure |
| | | --> |
| | | <directive name="embedStyleSheets" value="false"/> |
| | | <directive name="connectionTimeout" value="5000"/> |
| | | <directive name="maxStyleSheetImports" value="3"/> |
| | | |
| | | <!-- Allows the use of dynamic attributes (i.e. HTML5 "data-") --> |
| | | <directive name="allowDynamicAttributes" value="true" /> |
| | | </directives> |
| | | |
| | | <common-regexps> |
| | | |
| | | <!-- |
| | | From W3C: |
| | | This attribute assigns a class name or set of class names to an |
| | | element. Any number of elements may be assigned the same class |
| | | name or names. Multiple class names must be separated by white |
| | | space characters. |
| | | --> |
| | | |
| | | <!-- The 16 colors defined by the HTML Spec (also used by the CSS Spec) --> |
| | | <regexp name="colorName" value="(aqua|black|blue|fuchsia|gray|grey|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow)"/> |
| | | |
| | | <!-- HTML/CSS Spec allows 3 or 6 digit hex to specify color --> |
| | | <regexp name="colorCode" value="(#([0-9a-fA-F]{6}|[0-9a-fA-F]{3}))"/> |
| | | |
| | | <regexp name="anything" value=".*"/> |
| | | <regexp name="numberOrPercent" value="(\d)+(%{0,1})"/> |
| | | <regexp name="paragraph" value="([\p{L}\p{N},'\.\s\-_\(\)\?]|&[0-9]{2};)*"/> |
| | | <regexp name="htmlId" value="[a-zA-Z0-9\:\-_\.]+"/> |
| | | <regexp name="htmlTitle" value="[\p{L}\p{N}\s\-_',:\[\]!\./\\\(\)&]*"/> <!-- force non-empty with a '+' at the end instead of '*' --> |
| | | <regexp name="htmlClass" value="[a-zA-Z0-9\s,\-_]+"/> |
| | | |
| | | <regexp name="onsiteURL" value="^(?![\p{L}\p{N}\\\.\#@\$%\+&;\-_~,\?=/!]*(&colon))[\p{L}\p{N}\\\.\#@\$%\+&;\-_~,\?=/!]*"/> |
| | | <regexp name="anchoredURL" value="#(\w)+"/> |
| | | <regexp name="offsiteURL" value="(\s)*((ht|f)tp(s?)://|mailto:)[\p{L}\p{N}]+[\p{L}\p{N}\p{Zs}\.\#@\$%\+&;:\-_~,\?=/!\(\)]*(\s)*"/> |
| | | |
| | | <regexp name="boolean" value="(true|false)"/> |
| | | <regexp name="singlePrintable" value="[a-zA-Z0-9]{1}"/> <!-- \w allows the '_' character --> |
| | | |
| | | <!-- This is for elements (ex: elemName { ... }) --> |
| | | <regexp name="cssElementSelector" value="[a-zA-Z0-9\-_]+|\*"/> |
| | | |
| | | <!-- This is to list out any element names that are *not* valid --> |
| | | <regexp name="cssElementExclusion" value=""/> |
| | | |
| | | <!-- This if for classes (ex: .className { ... }) --> |
| | | <regexp name="cssClassSelector" value="\.[a-zA-Z0-9\-_]+"/> |
| | | |
| | | <!-- This is to list out any class names that are *not* valid --> |
| | | <regexp name="cssClassExclusion" value=""/> |
| | | |
| | | <!-- This is for ID selectors (ex: #myId { ... } --> |
| | | <regexp name="cssIDSelector" value="#[a-zA-Z0-9\-_]+"/> |
| | | |
| | | <!-- This is to list out any IDs that are *not* valid - FIXME: What should the default be to avoid div hijacking? *? --> |
| | | <regexp name="cssIDExclusion" value=""/> |
| | | |
| | | <!-- This is for pseudo-element selector (ex. foo:pseudo-element { ... } --> |
| | | <regexp name="cssPseudoElementSelector" value=":[a-zA-Z0-9\-_]+"/> |
| | | |
| | | <!-- This is to list out any psuedo-element names that are *not* valid --> |
| | | <regexp name="cssPsuedoElementExclusion" value=""/> |
| | | |
| | | <!-- This is for attribute selectors (ex. foo[attr=value] { ... } --> |
| | | <regexp name="cssAttributeSelector" value="\[[a-zA-Z0-9\-_]+((=|~=|\|=){1}[a-zA-Z0-9\-_]+){1}\]"/> |
| | | |
| | | <!-- This is to list out any attribute names that are *not* valid --> |
| | | <regexp name="cssAttributeExclusion" value=""/> |
| | | |
| | | <!-- This is for resources referenced from CSS (such as background images and other imported stylesheets) --> |
| | | <regexp name="cssOnsiteUri" value="url\(([\p{L}\p{N}\\/\.\?=\#&;\-_~]+|\#(\w)+)\)"/> |
| | | <regexp name="cssOffsiteUri" value="url\((\s)*((ht|f)tp(s?)://)[\p{L}\p{N}]+[~\p{L}\p{N}\p{Zs}\-_\.@#$%&;:,\?=/\+!]*(\s)*\)"/> |
| | | |
| | | <!-- This if for CSS Identifiers --> |
| | | <regexp name="cssIdentifier" value="[a-zA-Z0-9\-_]+"/> |
| | | |
| | | <!-- This is for comments within CSS (ex. /* comment */) --> |
| | | <regexp name="cssCommentText" value="[\p{L}\p{N}\-_,\/\\\.\s\(\)!\?\=\$#%\^&:"']+"/> |
| | | |
| | | <regexp name="integer" value="(-|\+)?[0-9]+"/> |
| | | <regexp name="positiveInteger" value="(\+)?[0-9]+"/> |
| | | <regexp name="number" value="(-|\+)?([0-9]+(\.[0-9]+)?)"/> |
| | | <regexp name="angle" value="(-|\+)?([0-9]+(\.[0-9]+)?)(deg|grads|rad)"/> |
| | | <regexp name="time" value="([0-9]+(\.[0-9]+)?)(ms|s)"/> |
| | | <regexp name="frequency" value="([0-9]+(\.[0-9]+)?)(hz|khz)"/> |
| | | <regexp name="length" value="((-|\+)?0|(-|\+)?([0-9]+(\.[0-9]+)?)(em|ex|px|in|cm|mm|pt|pc))"/> |
| | | <regexp name="positiveLength" value="((\+)?0|(\+)?([0-9]+(\.[0-9]+)?)(em|ex|px|in|cm|mm|pt|pc))"/> |
| | | <regexp name="percentage" value="(-|\+)?([0-9]+(\.[0-9]+)?)%"/> |
| | | <regexp name="positivePercentage" value="(\+)?([0-9]+(\.[0-9]+)?)%"/> |
| | | |
| | | <regexp name="absolute-size" value="(xx-small|x-small|small|medium|large|x-large|xx-large)"/> |
| | | <regexp name="relative-size" value="(larger|smaller)"/> |
| | | |
| | | <!-- Used for CSS Color specifications (complex regexp expresses integer values of 0-255) --> |
| | | <regexp name="rgbCode" value="rgb\(([1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]),([1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]),([1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\)"/> |
| | | |
| | | <!-- CSS2 Allowed System Color Values --> |
| | | <regexp name="systemColor" value="(activeborder|activecaption|appworkspace|background|buttonface|buttonhighlight|buttonshadow|buttontext|captiontext|graytext|highlight|highlighttext|inactiveborder|inactivecaption|inactivecaptiontext|infobackground|infotext|menu|menutext|scrollbar|threeddarkshadow|threedface|threedhighlight|threedlightshadow|threedshadow|window|windowframe|windowtext)"/> |
| | | |
| | | <!-- This is where we specify what Flash src to allow --> |
| | | <regexp name="flashSites" value="http://(download\.macromedia\.com/pub|www\.macromedia\.com/(go|shockwave)|c\.brightcove\.com/services|gamevideos\.1up\.com/swf|www\.youtube\.com/v|vimeo\.com|www\.gametrailers\.com|videomedia\.ign\.com/ev|image\.com\.com/gamespot|www\.hulu\.com/embed|embed\.break\.com|player\.ordienetworks\.com/flash|www\.adultswim\.com/video/vplayer|www\.dailymotion\.com/swf|www\.ustream\.tv/flash/video|cdn-i\.dmdentertainment\.com|media\.mtvnservices\.com|www\.justin\.tv/widgets|www\.viddler\.com/(player|simple_on_site)|static\.twitter\.com/flash|www\.gamepro\.com/bin|www\.divshare\.com/flash|www\.facebook\.com/v)/.*"/> |
| | | </common-regexps> |
| | | |
| | | <!-- |
| | | |
| | | Tag.name = a, b, div, body, etc. |
| | | Tag.action = filter: remove tags, but keep content, validate: keep content as long as it passes rules, remove: remove tag and contents |
| | | Attribute.name = id, class, href, align, width, etc. |
| | | Attribute.onInvalid = what to do when the attribute is invalid, e.g., remove the tag (removeTag), remove the attribute (removeAttribute), filter the tag (filterTag) |
| | | Attribute.description = What rules in English you want to tell the users they can have for this attribute. Include helpful things so they'll be able to tune their HTML |
| | | |
| | | --> |
| | | |
| | | <!-- |
| | | Some attributes are common to all (or most) HTML tags. There aren't many that qualify for this. You have to make sure there's no |
| | | collisions between any of these attribute names with attribute names of other tags that are for different purposes. |
| | | --> |
| | | |
| | | <common-attributes> |
| | | |
| | | |
| | | <!-- Common to all HTML tags --> |
| | | |
| | | <attribute name="id" description="The 'id' of any HTML attribute should not contain anything besides letters and numbers"> |
| | | <regexp-list> |
| | | <regexp name="htmlId"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="classid"> |
| | | <regexp-list> |
| | | <regexp name="anything" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="codebase"> |
| | | <regexp-list> |
| | | <regexp name="flashSites" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="class" description="The 'class' of any HTML attribute is usually a single word, but it can also be a list of class names separated by spaces"> |
| | | <regexp-list> |
| | | <regexp name="htmlClass"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="lang" description="The 'lang' attribute tells the browser what language the element's attribute values and content are written in"> |
| | | <regexp-list> |
| | | <regexp value="[a-zA-Z]{2,20}"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="title" description="The 'title' attribute provides text that shows up in a 'tooltip' when a user hovers their mouse over the element"> |
| | | <regexp-list> |
| | | <regexp name="htmlTitle"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="alt" description="The 'alt' attribute provides alternative text to users when its visual representation is not available"> |
| | | <regexp-list> |
| | | <regexp name="paragraph"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="data-" description="Allows the HTML5 'data-' attribute to be added to elements"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <!-- the "style" attribute will be validated by an inline stylesheet scanner, so no need to define anything here - i hate having to special case this but no other choice --> |
| | | <attribute name="style" description="The 'style' attribute provides the ability for users to change many attributes of the tag's contents using a strict syntax"/> |
| | | |
| | | <attribute name="media"> |
| | | <regexp-list> |
| | | <regexp value="[a-zA-Z0-9,\-\s]+"/> |
| | | </regexp-list> |
| | | |
| | | <literal-list> |
| | | <literal value="screen"/> |
| | | <literal value="tty"/> |
| | | <literal value="tv"/> |
| | | <literal value="projection"/> |
| | | <literal value="handheld"/> |
| | | <literal value="print"/> |
| | | <literal value="braille"/> |
| | | <literal value="aural"/> |
| | | <literal value="all"/> |
| | | </literal-list> |
| | | |
| | | </attribute> |
| | | |
| | | |
| | | <!-- Anchor related --> |
| | | |
| | | <!-- onInvalid="filterTag" has been removed as per suggestion at OWASP SJ 2007 - just "name" is valid --> |
| | | <attribute name="href"> |
| | | <regexp-list> |
| | | <regexp name="onsiteURL"/> |
| | | <regexp name="anchoredURL"/> |
| | | <regexp name="offsiteURL"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="name"> |
| | | <regexp-list> |
| | | |
| | | <regexp value="[a-zA-Z0-9-\_\$]+"/> |
| | | |
| | | <!-- |
| | | have to allow the $ for .NET controls - although, |
| | | will users be supplying input that has server-generated |
| | | .NET control names? methinks not, but i want to pass my |
| | | test cases |
| | | --> |
| | | |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | |
| | | <attribute name="shape" description="The 'shape' attribute defines the shape of the selectable area"> |
| | | <literal-list> |
| | | <literal value="default"/> |
| | | <literal value="rect"/> |
| | | <literal value="circle"/> |
| | | <literal value="poly"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | |
| | | |
| | | <!-- Table attributes --> |
| | | |
| | | <attribute name="border"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="cellpadding"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="cellspacing"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="colspan"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="rowspan"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="background"> |
| | | <regexp-list> |
| | | <regexp name="onsiteURL"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="bgcolor"> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="abbr"> |
| | | <regexp-list> |
| | | <regexp name="paragraph"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="headers" description="The 'headers' attribute is a space-separated list of cell IDs"> |
| | | <regexp-list> |
| | | <regexp value="[a-zA-Z0-9\s*]*"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="charoff"> |
| | | <regexp-list> |
| | | <regexp value="numberOrPercent"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="char"> |
| | | <regexp-list> |
| | | <regexp value=".{0,1}"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | |
| | | <attribute name="axis" description="The 'headers' attribute is a comma-separated list of related header cells"> |
| | | <regexp-list> |
| | | <regexp value="[a-zA-Z0-9\s*,]*"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="nowrap" description="The 'nowrap' attribute tells the browser not to wrap text that goes over one line"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | <!-- <regexp value="(nowrap){0,1}"/> --> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | |
| | | <!-- Common positioning attributes --> |
| | | |
| | | <attribute name="width"> |
| | | <regexp-list> |
| | | <regexp name="numberOrPercent"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="height"> |
| | | <regexp-list> |
| | | <regexp name="numberOrPercent"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="align" description="The 'align' attribute of an HTML element is a direction word, like 'left', 'right' or 'center'"> |
| | | <literal-list> |
| | | <literal value="center"/> |
| | | <literal value="middle"/> |
| | | <literal value="left"/> |
| | | <literal value="right"/> |
| | | <literal value="justify"/> |
| | | <literal value="char"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="valign" description="The 'valign' attribute of an HTML attribute is a direction word, like 'baseline','bottom','middle' or 'top'"> |
| | | <literal-list> |
| | | <literal value="baseline"/> |
| | | <literal value="bottom"/> |
| | | <literal value="middle"/> |
| | | <literal value="top"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | |
| | | |
| | | <!-- Intrinsic JavaScript Events --> |
| | | |
| | | <attribute name="onFocus" description="The 'onFocus' event is executed when the control associated with the tag gains focus"> |
| | | <literal-list> |
| | | <literal value="javascript:void(0)"/> |
| | | <literal value="javascript:history.go(-1)"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="onBlur" description="The 'onBlur' event is executed when the control associated with the tag loses focus"> |
| | | <literal-list> |
| | | <literal value="javascript:void(0)"/> |
| | | <literal value="javascript:history.go(-1)"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="onClick" description="The 'onClick' event is executed when the control associated with the tag is clicked"> |
| | | <literal-list> |
| | | <literal value="javascript:void(0)"/> |
| | | <literal value="javascript:history.go(-1)"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="onDblClick" description="The 'onDblClick' event is executed when the control associated with the tag is clicked twice immediately"> |
| | | <literal-list> |
| | | <literal value="javascript:void(0)"/> |
| | | <literal value="javascript:history.go(-1)"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="onMouseDown" description="The 'onMouseDown' event is executed when the control associated with the tag is clicked but not yet released"> |
| | | <literal-list> |
| | | <literal value="javascript:void(0)"/> |
| | | <literal value="javascript:history.go(-1)"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="onMouseUp" description="The 'onMouseUp' event is executed when the control associated with the tag is clicked after the button is released"> |
| | | <literal-list> |
| | | <literal value="javascript:void(0)"/> |
| | | <literal value="javascript:history.go(-1)"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="onMouseOver" description="The 'onMouseOver' event is executed when the user's mouse hovers over the control associated with the tag"> |
| | | <literal-list> |
| | | <literal value="javascript:void(0)"/> |
| | | <literal value="javascript:history.go(-1)"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="scope" description="The 'scope' attribute defines what's covered by the header cells"> |
| | | <literal-list> |
| | | <literal value="row"/> |
| | | <literal value="col"/> |
| | | <literal value="rowgroup"/> |
| | | <literal value="colgroup"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | |
| | | |
| | | <!-- If you want users to be able to mess with tabindex, uncomment this --> |
| | | <!-- |
| | | <attribute name="tabindex" description="..."> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | --> |
| | | |
| | | |
| | | <!-- Input/form related common attributes --> |
| | | |
| | | <attribute name="disabled"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="readonly"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="accesskey"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="size"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | |
| | | <attribute name="autocomplete"> |
| | | <literal-list> |
| | | <literal value="on"/> |
| | | <literal value="off"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="rows"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="cols"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | </common-attributes> |
| | | |
| | | |
| | | <!-- |
| | | This requires normal updates as browsers continue to diverge from the W3C and each other. As long as the browser wars continue |
| | | this is going to continue. I'm not sure war is the right word for what's going on. Doesn't somebody have to win a war after |
| | | a while? Even wars of attrition, surely? |
| | | --> |
| | | |
| | | <global-tag-attributes> |
| | | <!-- Not valid in base, head, html, meta, param, script, style, and title elements. --> |
| | | <attribute name="id"/> |
| | | <attribute name="style"/> |
| | | <attribute name="title"/> |
| | | <attribute name="class"/> |
| | | <!-- Not valid in base, br, frame, frameset, hr, iframe, param, and script elements. --> |
| | | <attribute name="lang"/> |
| | | </global-tag-attributes> |
| | | |
| | | <!-- Declare "dynamic" tag attributes here. The directive "allowDynamicAttributes" must be set to true --> |
| | | <dynamic-tag-attributes> |
| | | <attribute name="data-"/> <!-- HTML5 "data-" tag --> |
| | | </dynamic-tag-attributes> |
| | | |
| | | <tags-to-encode> |
| | | <tag>g</tag> |
| | | <tag>grin</tag> |
| | | </tags-to-encode> |
| | | |
| | | <tag-rules> |
| | | |
| | | <!-- You can mess with this stuff if you know what you're doing --> |
| | | |
| | | <tag name="html" action="validate"/> |
| | | |
| | | <tag name="body" action="validate"> |
| | | <attribute name="bgcolor"/> |
| | | </tag> |
| | | |
| | | <tag name="meta" action="filter"/> |
| | | |
| | | <tag name="head" action="validate"/> |
| | | |
| | | <!-- since we're validating the style sheets this is safe to have - switch to "truncate" if the user's html will appear in the html body --> |
| | | <tag name="title" action="truncate"/> |
| | | |
| | | |
| | | <!-- Tags related to JavaScript --> |
| | | |
| | | <tag name="script" action="remove"/> |
| | | <tag name="noscript" action="validate"/> <!-- although no javascript can fire inside a noscript tag, css is still a viable attack vector --> |
| | | |
| | | |
| | | |
| | | <!-- Frame & related tags --> |
| | | |
| | | <tag name="iframe" action="remove"/> |
| | | <tag name="frameset" action="remove"/> |
| | | <tag name="frame" action="remove"/> |
| | | |
| | | |
| | | |
| | | <!-- Form related tags --> |
| | | |
| | | <tag name="label" action="validate"> |
| | | <attribute name="for"> |
| | | <regexp-list> |
| | | <regexp name="htmlId"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | |
| | | <!-- |
| | | If you wish to enable any of the form related tags, change the tag's action below from "filter" or "remove" to "validate". The attributes have been |
| | | hardened so this is safe to do, if it's something you want to allow. Beware the <><ing possibilities! |
| | | --> |
| | | |
| | | <tag name="form" action="validate"> |
| | | |
| | | <attribute name="action"> |
| | | <regexp-list> |
| | | <regexp name="onsiteURL"/> |
| | | <regexp name="offsiteURL"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="name"/> |
| | | |
| | | <attribute name="autocomplete"/> |
| | | |
| | | <attribute name="method"> |
| | | <literal-list> |
| | | <literal value="post"/> |
| | | <literal value="get"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | </tag> |
| | | |
| | | <tag name="button" action="validate"> |
| | | <attribute name="name"/> |
| | | <attribute name="value"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="disabled"/> |
| | | <attribute name="accesskey"/> |
| | | <attribute name="type"> |
| | | <literal-list> |
| | | <literal value="submit"/> |
| | | <literal value="reset"/> |
| | | <literal value="button"/> |
| | | </literal-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | <tag name="input" action="validate"> |
| | | |
| | | <attribute name="name"/> |
| | | |
| | | <attribute name="size"/> |
| | | |
| | | <attribute name="maxlength"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="autocomplete"/> |
| | | |
| | | <attribute name="checked"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="alt"/> |
| | | |
| | | <attribute name="src"> |
| | | <regexp-list> |
| | | <regexp name="onsiteURL"/> |
| | | <regexp name="offsiteURL"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="usemap"> |
| | | <regexp-list> |
| | | <regexp name="onsiteURL"/> |
| | | <regexp name="anchoredURL"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="type"> |
| | | <literal-list> |
| | | <literal value="hidden"/> |
| | | <literal value="text"/> |
| | | <literal value="password"/> |
| | | <literal value="radio"/> |
| | | <literal value="checkbox"/> |
| | | <literal value="submit"/> |
| | | <literal value="button"/> |
| | | <literal value="image"/> |
| | | <literal value="file"/> |
| | | <literal value="reset"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="value"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="disabled"/> |
| | | <attribute name="readonly"/> |
| | | <attribute name="accesskey"/> |
| | | |
| | | <attribute name="border"/> |
| | | |
| | | </tag> |
| | | |
| | | <tag name="select" action="validate"> |
| | | |
| | | <attribute name="name"/> |
| | | <attribute name="disabled"/> |
| | | |
| | | <attribute name="multiple"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="size"/> |
| | | |
| | | </tag> |
| | | |
| | | <tag name="option" action="validate"> |
| | | |
| | | <attribute name="disabled"/> |
| | | |
| | | <attribute name="value"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="label"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="selected"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | <tag name="textarea" action="validate"> |
| | | <attribute name="rows"/> |
| | | <attribute name="cols"/> |
| | | <attribute name="name"/> |
| | | <attribute name="disabled"/> |
| | | <attribute name="readonly"/> |
| | | <attribute name="accesskey"/> |
| | | </tag> |
| | | |
| | | |
| | | |
| | | |
| | | <!-- All formatting tags --> |
| | | |
| | | <tag name="h1" action="validate"/> |
| | | <tag name="h2" action="validate"/> |
| | | <tag name="h3" action="validate"/> |
| | | <tag name="h4" action="validate"/> |
| | | <tag name="h5" action="validate"/> |
| | | <tag name="h6" action="validate"/> |
| | | |
| | | <tag name="p" action="validate"> |
| | | <attribute name="align"/> |
| | | </tag> |
| | | |
| | | <tag name="i" action="validate"/> |
| | | <tag name="b" action="validate"/> |
| | | <tag name="u" action="validate"/> |
| | | <tag name="strong" action="validate"/> |
| | | |
| | | <tag name="em" action="validate"/> |
| | | <tag name="small" action="validate"/> |
| | | <tag name="big" action="validate"/> |
| | | <tag name="pre" action="validate"/> |
| | | <tag name="code" action="validate"/> |
| | | <tag name="cite" action="validate"/> |
| | | <tag name="samp" action="validate"/> |
| | | <tag name="sub" action="validate"/> |
| | | <tag name="sup" action="validate"/> |
| | | <tag name="strike" action="validate"/> |
| | | <tag name="center" action="validate"/> |
| | | <tag name="blockquote" action="validate"/> |
| | | |
| | | <tag name="hr" action="validate"/> |
| | | <tag name="br" action="validate"/> |
| | | |
| | | <tag name="col" action="validate"/> |
| | | |
| | | <tag name="font" action="validate"> |
| | | <attribute name="color"> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="face"> |
| | | <regexp-list> |
| | | <regexp value="[\w;, \-]+"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="size"> |
| | | <regexp-list> |
| | | <regexp value="(\+|-){0,1}(\d)+"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | |
| | | <!-- Anchor and anchor related tags --> |
| | | |
| | | <tag name="a" action="validate"> |
| | | |
| | | <!-- onInvalid="filterTag" has been removed as per suggestion at OWASP SJ 2007 - just "name" is valid --> |
| | | <attribute name="href"/> |
| | | <attribute name="onFocus"/> |
| | | <attribute name="onBlur"/> |
| | | <attribute name="nohref"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="rel"> |
| | | <literal-list> |
| | | <literal value="nofollow"/> |
| | | </literal-list> |
| | | </attribute> |
| | | <attribute name="name"/> |
| | | |
| | | </tag> |
| | | |
| | | <tag name="map" action="validate"/> |
| | | |
| | | <!-- base tag removed per demo - this could be enabled with literal-list values you allow --> |
| | | <!-- |
| | | <tag name="base" action="validate"> |
| | | <attribute name="href"/> |
| | | </tag> |
| | | --> |
| | | |
| | | |
| | | |
| | | <!-- Stylesheet Tags --> |
| | | |
| | | <tag name="style" action="validate"> |
| | | <attribute name="type"> |
| | | <literal-list> |
| | | <literal value="text/css"/> |
| | | </literal-list> |
| | | </attribute> |
| | | <attribute name="media"/> |
| | | </tag> |
| | | |
| | | <tag name="span" action="validate"/> |
| | | |
| | | <tag name="div" action="validate"> |
| | | <attribute name="align"/> |
| | | </tag> |
| | | |
| | | |
| | | <!-- Image & image related tags --> |
| | | |
| | | <tag name="img" action="validate"> |
| | | <attribute name="src" onInvalid="removeTag"> |
| | | <regexp-list> |
| | | <regexp name="onsiteURL"/> |
| | | <regexp name="offsiteURL"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="name"/> |
| | | <attribute name="alt"/> |
| | | <attribute name="height"/> |
| | | <attribute name="width"/> |
| | | <attribute name="border"/> |
| | | <attribute name="align"/> |
| | | |
| | | <attribute name="hspace"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="vspace"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | <!-- no way to do this safely without hooking up the same code to @import to embed the remote stylesheet (malicious user could change offsite resource to be malicious after validation --> |
| | | <!-- <attribute name="href" onInvalid="removeTag"/> --> |
| | | |
| | | <tag name="link" action="validate"> |
| | | |
| | | <!-- <attribute name="href" onInvalid="removeTag"/> --> |
| | | |
| | | <attribute name="media"/> |
| | | |
| | | <attribute name="type" onInvalid="removeTag"> |
| | | <literal-list> |
| | | <literal value="text/css"/> |
| | | <literal value="application/rss+xml"/> |
| | | <literal value="image/x-icon"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="rel"> |
| | | <literal-list> |
| | | <literal value="stylesheet"/> |
| | | <literal value="shortcut icon"/> |
| | | <literal value="search"/> |
| | | <literal value="copyright"/> |
| | | <literal value="top"/> |
| | | <literal value="alternate"/> |
| | | </literal-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <!-- List tags --> |
| | | |
| | | <tag name="ul" action="validate"/> |
| | | <tag name="ol" action="validate"/> |
| | | <tag name="li" action="validate"/> |
| | | |
| | | |
| | | |
| | | |
| | | <!-- Dictionary tags --> |
| | | |
| | | <tag name="dd" action="truncate"/> |
| | | <tag name="dl" action="truncate"/> |
| | | <tag name="dt" action="truncate"/> |
| | | |
| | | |
| | | |
| | | |
| | | <!-- Table tags (tbody, thead, tfoot)--> |
| | | |
| | | <tag name="thead" action="validate"> |
| | | <attribute name="align"/> |
| | | <attribute name="char"/> |
| | | <attribute name="charoff"/> |
| | | <attribute name="valign"/> |
| | | </tag> |
| | | |
| | | <tag name="tbody" action="validate"> |
| | | <attribute name="align"/> |
| | | <attribute name="char"/> |
| | | <attribute name="charoff"/> |
| | | <attribute name="valign"/> |
| | | </tag> |
| | | |
| | | <tag name="tfoot" action="validate"> |
| | | <attribute name="align"/> |
| | | <attribute name="char"/> |
| | | <attribute name="charoff"/> |
| | | <attribute name="valign"/> |
| | | </tag> |
| | | |
| | | <tag name="table" action="validate"> |
| | | <attribute name="height"/> |
| | | <attribute name="width"/> |
| | | <attribute name="border"/> |
| | | <attribute name="bgcolor"/> |
| | | <attribute name="cellpadding"/> |
| | | <attribute name="cellspacing"/> |
| | | <attribute name="background"/> |
| | | <attribute name="align"/> |
| | | <attribute name="noresize"> |
| | | <literal-list> |
| | | <literal value="noresize"/> |
| | | <literal value=""/> |
| | | </literal-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | <tag name="td" action="validate"> |
| | | <attribute name="background"/> |
| | | <attribute name="bgcolor"/> |
| | | <attribute name="abbr"/> |
| | | <attribute name="axis"/> |
| | | <attribute name="headers"/> |
| | | <attribute name="scope"/> |
| | | <attribute name="nowrap"/> |
| | | <attribute name="height"/> |
| | | <attribute name="width"/> |
| | | <attribute name="align"/> |
| | | <attribute name="char"/> |
| | | <attribute name="charoff"/> |
| | | <attribute name="valign"/> |
| | | <attribute name="colspan"/> |
| | | <attribute name="rowspan"/> |
| | | </tag> |
| | | |
| | | <tag name="th" action="validate"> |
| | | <attribute name="abbr"/> |
| | | <attribute name="axis"/> |
| | | <attribute name="headers"/> |
| | | <attribute name="scope"/> |
| | | <attribute name="nowrap"/> |
| | | <attribute name="bgcolor"/> |
| | | <attribute name="height"/> |
| | | <attribute name="width"/> |
| | | <attribute name="align"/> |
| | | <attribute name="char"/> |
| | | <attribute name="charoff"/> |
| | | <attribute name="valign"/> |
| | | <attribute name="colspan"/> |
| | | <attribute name="rowspan"/> |
| | | </tag> |
| | | |
| | | <tag name="tr" action="validate"> |
| | | <attribute name="height"/> |
| | | <attribute name="width"/> |
| | | <attribute name="align"/> |
| | | <attribute name="valign"/> |
| | | <attribute name="char"/> |
| | | <attribute name="charoff"/> |
| | | <attribute name="background"/> |
| | | </tag> |
| | | |
| | | <tag name="colgroup" action="validate"> |
| | | |
| | | <attribute name="span"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="width"/> |
| | | <attribute name="align"/> |
| | | <attribute name="char"/> |
| | | <attribute name="charoff"/> |
| | | <attribute name="valign"/> |
| | | </tag> |
| | | |
| | | <tag name="col" action="validate"> |
| | | <attribute name="align"/> |
| | | <attribute name="char"/> |
| | | <attribute name="charoff"/> |
| | | <attribute name="valign"/> |
| | | <attribute name="span"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="width"/> |
| | | </tag> |
| | | |
| | | <tag name="fieldset" action="validate"/> |
| | | <tag name="legend" action="validate"/> |
| | | |
| | | |
| | | <!-- tags for popular Flash embeds --> |
| | | |
| | | <tag name="object" action="validate"> |
| | | <attribute name="id" /> |
| | | <attribute name="classid" /> |
| | | <attribute name="codebase" /> |
| | | <attribute name="type" onInvalid="removeTag"> |
| | | <literal-list> |
| | | <literal value="application/x-shockwave-flash" /> |
| | | </literal-list> |
| | | </attribute> |
| | | <attribute name="data" onInvalid="removeTag"> |
| | | <regexp-list> |
| | | <regexp name="flashSites" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="align" /> |
| | | <attribute name="height" /> |
| | | <attribute name="width" /> |
| | | <attribute name="alt" /> |
| | | <attribute name="bgcolor"> |
| | | <regexp-list> |
| | | <regexp name="colorCode" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | <!-- with validateParamAsEmbed=true, this tag rule also covers <param> name/value pairs --> |
| | | <tag name="embed" action="validate"> |
| | | <attribute name="src" onInvalid="removeTag"> |
| | | <regexp-list> |
| | | <regexp name="flashSites" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="movie" onInvalid="removeTag"> |
| | | <regexp-list> |
| | | <regexp name="flashSites" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="pluginspage"> |
| | | <regexp-list> |
| | | <regexp name="flashSites" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="bgcolor"> |
| | | <regexp-list> |
| | | <regexp name="colorCode" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="base"> |
| | | <literal-list> |
| | | <literal value="http://admin.brightcove.com" /> |
| | | </literal-list> |
| | | </attribute> |
| | | <attribute name="type"> |
| | | <literal-list> |
| | | <literal value="application/x-shockwave-flash" /> |
| | | </literal-list> |
| | | </attribute> |
| | | <attribute name="name"> |
| | | <regexp-list> |
| | | <regexp name="anything" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="flashvars"> |
| | | <regexp-list> |
| | | <regexp name="anything" /><!-- we could put something complex in here, but this is prolly fine for now--> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="align" /> |
| | | <attribute name="height" /> |
| | | <attribute name="width" /> |
| | | <attribute name="allowfullscreen"> |
| | | <regexp-list> |
| | | <regexp name="boolean" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="quality"> |
| | | <literal-list> |
| | | <literal value="high" /> |
| | | </literal-list> |
| | | </attribute> |
| | | <attribute name="allowscriptaccess"> |
| | | <literal-list> |
| | | <literal value="always" /> |
| | | <literal value="samedomain" /> |
| | | </literal-list> |
| | | </attribute> |
| | | <attribute name="seamlesstabbing"> |
| | | <regexp-list> |
| | | <regexp name="boolean" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="swliveconnect"> |
| | | <regexp-list> |
| | | <regexp name="boolean" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="wmode"> |
| | | <literal-list> |
| | | <literal value="transparent" /> |
| | | <literal value="window" /> |
| | | </literal-list> |
| | | </attribute> |
| | | <attribute name="allownetworking"> |
| | | <literal-list> |
| | | <literal value="all" /> |
| | | </literal-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | </tag-rules> |
| | | |
| | | |
| | | <!-- CSS validation processing rules --> |
| | | |
| | | <css-rules> |
| | | |
| | | <property name="azimuth" description="This property is most likely to be implemented by mixing the same signal into different channels at differing volumes."> |
| | | <literal-list> |
| | | <literal value="left-side"/> |
| | | <literal value="far-left"/> |
| | | <literal value="left"/> |
| | | <literal value="center-left"/> |
| | | <literal value="center"/> |
| | | <literal value="center-right"/> |
| | | <literal value="right"/> |
| | | <literal value="far-right"/> |
| | | <literal value="right-side"/> |
| | | <literal value="behind"/> |
| | | <literal value="leftwards"/> |
| | | <literal value="rightwards"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="angle"/> |
| | | </regexp-list> |
| | | </property> |
| | | |
| | | <property name="background" description="The 'background' property is a shorthand property for setting the individual background properties (i.e., 'background-color', 'background-image', 'background-repeat', 'background-attachment' and 'background-position') at the same place in the style sheet."> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="background-color"/> |
| | | <shorthand name="background-image"/> |
| | | <shorthand name="background-repeat"/> |
| | | <shorthand name="background-attachment"/> |
| | | <shorthand name="background-position"/> |
| | | </shorthand-list> |
| | | </property> |
| | | |
| | | <property name="background-attachment" description="If a background image is specified, this property specifies whether it is fixed with regard to the viewport ('fixed') or scrolls along with the document ('scroll')."> |
| | | <literal-list> |
| | | <literal value="scroll"/> |
| | | <literal value="fixed"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | |
| | | <property name="background-color" description="This property sets the background color of an element, either a <color> value or the keyword 'transparent', to make the underlying colors shine through."> |
| | | <literal-list> |
| | | <literal value="transparent"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | </property> |
| | | |
| | | <property name="background-image" description="This property sets the background image of an element."> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="cssOffsiteUri"/> |
| | | <regexp name="cssOnsiteUri"/> |
| | | </regexp-list> |
| | | </property> |
| | | |
| | | <property name="background-position" description="If a background image has been specified, this property specifies its initial position."> |
| | | <literal-list> |
| | | <literal value="top"/> |
| | | <literal value="center"/> |
| | | <literal value="bottom"/> |
| | | <literal value="left"/> |
| | | <literal value="center"/> |
| | | <literal value="right"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="percentage"/> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | |
| | | <property name="background-repeat" description="If a background image is specified, this property specifies whether the image is repeated (tiled), and how."> |
| | | <literal-list> |
| | | <literal value="repeat"/> |
| | | <literal value="repeat-x"/> |
| | | <literal value="repeat-y"/> |
| | | <literal value="no-repeat"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | |
| | | <!-- Begin simple properties --> |
| | | <property name="border-collapse" default="collapse" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="collapse"/> |
| | | <literal value="separate"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="border-color" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="transparent"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="border-top-color" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="border-right-color" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="border-bottom-color" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="border-left-color" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="bottom" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="caption-side" default="top" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="top"/> |
| | | <literal value="bottom"/> |
| | | <literal value="left"/> |
| | | <literal value="right"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="clear" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="left"/> |
| | | <literal value="right"/> |
| | | <literal value="both"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="color" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="cue-after" default="none" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="cssOffsiteUri"/> |
| | | <regexp name="cssOnsiteUri"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="cue-before" default="none" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="cssOffsiteUri"/> |
| | | <regexp name="cssOnsiteUri"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="direction" default="ltr" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="ltr"/> |
| | | <literal value="rtl"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="display" default="inline" description=""> |
| | | <category-list> |
| | | <category value="all"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inline"/> |
| | | <literal value="block"/> |
| | | <literal value="list-item"/> |
| | | <literal value="run-in"/> |
| | | <literal value="compact"/> |
| | | <literal value="marker"/> |
| | | <literal value="table"/> |
| | | <literal value="inline-table"/> |
| | | <literal value="table-row-group"/> |
| | | <literal value="table-header-group"/> |
| | | <literal value="table-footer-group"/> |
| | | <literal value="table-row"/> |
| | | <literal value="table-column-group"/> |
| | | <literal value="table-column"/> |
| | | <literal value="table-cell"/> |
| | | <literal value="table-caption"/> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="elevation" default="level" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="below"/> |
| | | <literal value="level"/> |
| | | <literal value="above"/> |
| | | <literal value="higher"/> |
| | | <literal value="lower"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="angle"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="empty-cells" default="show" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="show"/> |
| | | <literal value="hide"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="float" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="left"/> |
| | | <literal value="right"/> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="font-size" default="medium" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="absolute-size"/> |
| | | <regexp name="relative-size"/> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="font-size-adjust" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="font-stretch" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="wider"/> |
| | | <literal value="narrower"/> |
| | | <literal value="ultra-condensed"/> |
| | | <literal value="extra-condensed"/> |
| | | <literal value="condensed"/> |
| | | <literal value="semi-condensed"/> |
| | | <literal value="semi-expanded"/> |
| | | <literal value="expanded"/> |
| | | <literal value="extra-expanded"/> |
| | | <literal value="ultra-expanded"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="font-style" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="italic"/> |
| | | <literal value="oblique"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="font-variant" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="small-caps"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="font-weight" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="bold"/> |
| | | <literal value="bolder"/> |
| | | <literal value="lighter"/> |
| | | <literal value="100"/> |
| | | <literal value="200"/> |
| | | <literal value="300"/> |
| | | <literal value="400"/> |
| | | <literal value="500"/> |
| | | <literal value="600"/> |
| | | <literal value="700"/> |
| | | <literal value="800"/> |
| | | <literal value="900"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="height" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="left" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="letter-spacing" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="line-height" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="list-style-image" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="cssOffsiteUri"/> |
| | | <regexp name="cssOnsiteUri"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="list-style-position" default="outside" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inside"/> |
| | | <literal value="outside"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="list-style-type" default="disc" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="disc"/> |
| | | <literal value="circle"/> |
| | | <literal value="square"/> |
| | | <literal value="decimal"/> |
| | | <literal value="decimal-leading-zero"/> |
| | | <literal value="lower-roman"/> |
| | | <literal value="upper-roman"/> |
| | | <literal value="lower-greek"/> |
| | | <literal value="lower-alpha"/> |
| | | <literal value="lower-latin"/> |
| | | <literal value="upper-alpha"/> |
| | | <literal value="upper-latin"/> |
| | | <literal value="hebrew"/> |
| | | <literal value="armenian"/> |
| | | <literal value="georgian"/> |
| | | <literal value="cjk-ideographic"/> |
| | | <literal value="hiragana"/> |
| | | <literal value="katakana"/> |
| | | <literal value="hiragana-iroha"/> |
| | | <literal value="katakana-iroha"/> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="marker-offset" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="max-height" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="max-width" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="min-height" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="min-width" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="orphans" default="2" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="paged"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="integer"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="outline-color" default="invert" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="interactive"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="invert"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="overflow" default="visible" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="visible"/> |
| | | <literal value="hidden"/> |
| | | <literal value="scroll"/> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="page-break-after" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="paged"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="always"/> |
| | | <literal value="avoid"/> |
| | | <literal value="left"/> |
| | | <literal value="right"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="page-break-before" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="paged"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="always"/> |
| | | <literal value="avoid"/> |
| | | <literal value="left"/> |
| | | <literal value="right"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="page-break-inside" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="paged"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="avoid"/> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="pause-after" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="time"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="pause-before" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="time"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="pitch" default="medium" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="x-low"/> |
| | | <literal value="low"/> |
| | | <literal value="medium"/> |
| | | <literal value="high"/> |
| | | <literal value="x-high"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="frequency"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="pitch-range" default="50" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="position" default="static" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="static"/> |
| | | <!-- possible to perform phishing attacks with the following --> |
| | | <!-- |
| | | <literal value="relative"/> |
| | | <literal value="absolute"/> |
| | | <literal value="fixed"/> |
| | | --> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="richness" default="50" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="right" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="size" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="paged"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="portrait"/> |
| | | <literal value="landscape"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="speak" default="normal" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="none"/> |
| | | <literal value="spell-out"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="speak-header" default="once" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="once"/> |
| | | <literal value="always"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="speak-numeral" default="continuous" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="digits"/> |
| | | <literal value="continuous"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="speak-punctuation" default="none" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="code"/> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="speech-rate" default="medium" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="x-slow"/> |
| | | <literal value="slow"/> |
| | | <literal value="medium"/> |
| | | <literal value="fast"/> |
| | | <literal value="x-fast"/> |
| | | <literal value="faster"/> |
| | | <literal value="slower"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="stress" default="50" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="table-layout" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="fixed"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="text-indent" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="text-transform" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="capitalize"/> |
| | | <literal value="uppercase"/> |
| | | <literal value="lowercase"/> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="top" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="unicode-bidi" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="embed"/> |
| | | <literal value="bidi-override"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="vertical-align" default="baseline" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="baseline"/> |
| | | <literal value="sub"/> |
| | | <literal value="super"/> |
| | | <literal value="top"/> |
| | | <literal value="text-top"/> |
| | | <literal value="middle"/> |
| | | <literal value="bottom"/> |
| | | <literal value="text-bottom"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="percentage"/> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="visibility" default="inherit" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="visible"/> |
| | | <literal value="hidden"/> |
| | | <literal value="collapse"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="volume" default="medium" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="silent"/> |
| | | <literal value="x-soft"/> |
| | | <literal value="soft"/> |
| | | <literal value="medium"/> |
| | | <literal value="loud"/> |
| | | <literal value="x-loud"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="white-space" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="pre"/> |
| | | <literal value="nowrap"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="widows" default="2" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="paged"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="integer"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="width" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="word-spacing" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | |
| | | <!-- end simple properties --> |
| | | |
| | | <!-- begin medium properties --> |
| | | <property name="border-style" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | <literal value="none"/> |
| | | <literal value="hidden"/> |
| | | <literal value="dotted"/> |
| | | <literal value="dashed"/> |
| | | <literal value="solid"/> |
| | | <literal value="double"/> |
| | | <literal value="groove"/> |
| | | <literal value="ridge"/> |
| | | <literal value="inset"/> |
| | | <literal value="outset"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="border-top-style" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="border-right-style" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-bottom-style" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-left-style" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-top-width" default="medium" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-width"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-right-width" default="medium" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-width"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-bottom-width" default="medium" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-width"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-left-width" default="medium" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-width"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-width" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | <literal value="thin"/> |
| | | <literal value="medium"/> |
| | | <literal value="thick"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="margin" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | <literal value="auto"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="positiveLength"/> |
| | | <regexp name="positivePercentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="margin-top" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="margin"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="margin-right" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="margin"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="margin-bottom" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="margin"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="margin-left" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="margin"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="outline-style" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="interactive"/> |
| | | </category-list> |
| | | |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="outline-width" default="medium" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="interactive"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-width"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="padding" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="padding-top" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="padding"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="padding-right" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="padding"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="padding-bottom" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="padding"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="padding-left" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="padding"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <!-- end medium properties --> |
| | | |
| | | <!-- begin hard properties --> |
| | | <property name="border" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-width"/> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-top" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-top-width"/> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-right" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-top-width"/> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-bottom" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-top-width"/> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-left" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-top-width"/> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="cue" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="cue-before"/> |
| | | <shorthand name="cue-after"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="list-style" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="list-style-type"/> |
| | | <shorthand name="list-style-position"/> |
| | | <shorthand name="list-style-image"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="marks" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="paged"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="crop"/> |
| | | <literal value="cross"/> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="outline" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="interactive"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="outline-color"/> |
| | | <shorthand name="outline-style"/> |
| | | <shorthand name="outline-width"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="pause" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="time"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="text-decoration" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="underline"/> |
| | | <literal value="overline"/> |
| | | <literal value="line-through"/> |
| | | <literal value="blink"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <!-- end hard properties --> |
| | | <!-- begin manual properties --> |
| | | <property name="border-spacing" default="0" description="The lengths specify the distance that separates adjacent cell borders. If one length is specified, it gives both the horizontal and vertical spacing. If two are specified, the first gives the horizontal spacing and the second the vertical spacing. Lengths may not be negative."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="clip" default="auto" description="The 'clip' property applies to elements that have a 'overflow' property with a value other than 'visible'."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="counter-increment" default="none" description="The 'counter-increment' property accepts one or more names of counters (identifiers), each one optionally followed by an integer."> |
| | | <category-list> |
| | | <category value="all"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="cssIdentifier"/> |
| | | <regexp name="integer"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="clip" default="auto" description="The 'clip' property applies to elements that have a 'overflow' property with a value other than 'visible'."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="cursor" default="auto" description="This property specifies the type of cursor to be displayed for the pointing device."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="interactive"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | <literal value="crosshair"/> |
| | | <literal value="default"/> |
| | | <literal value="pointer"/> |
| | | <literal value="move"/> |
| | | <literal value="e-resize"/> |
| | | <literal value="ne-resize"/> |
| | | <literal value="nw-resize"/> |
| | | <literal value="n-resize"/> |
| | | <literal value="se-resize"/> |
| | | <literal value="sw-resize"/> |
| | | <literal value="s-resize"/> |
| | | <literal value="w-resize| text"/> |
| | | <literal value="wait"/> |
| | | <literal value="help"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="cssOffsiteUri"/> |
| | | <regexp name="cssOnsiteUri"/> |
| | | </regexp-list> |
| | | </property> |
| | | |
| | | <property name="text-shadow" default="none" description="This property accepts a comma-separated list of shadow effects to be applied to the text of the element."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | |
| | | <property name="font" description="The 'font' property is, except as described below, a shorthand property for setting 'font-style', 'font-variant', 'font-weight', 'font-size', 'line-height', and 'font-family', at the same place in the style sheet."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="/"/> |
| | | <literal value="caption"/> |
| | | <literal value="icon"/> |
| | | <literal value="menu"/> |
| | | <literal value="message-box"/> |
| | | <literal value="small-caption"/> |
| | | <literal value="status-bar"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="font-style"/> |
| | | <shorthand name="font-variant"/> |
| | | <shorthand name="font-weight"/> |
| | | <shorthand name="font-size"/> |
| | | <shorthand name="line-height"/> |
| | | <shorthand name="font-family"/> |
| | | </shorthand-list> |
| | | </property> |
| | | |
| | | <property name="font-family" description="This property specifies a prioritized list of font family names and/or generic family names."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <!-- allowing only generic font families --> |
| | | <literal-list> |
| | | <literal value="serif"/> |
| | | <literal value="arial"/> |
| | | <literal value="lucida console"/> |
| | | <literal value="sans-serif"/> |
| | | <literal value="cursive"/> |
| | | <literal value="verdana"/> |
| | | <literal value="fantasy"/> |
| | | <literal value="monospace"/> |
| | | </literal-list> |
| | | |
| | | |
| | | <regexp-list> |
| | | <regexp value="[\w,\-'" ]+"/> |
| | | </regexp-list> |
| | | |
| | | </property> |
| | | <property name="page" description="The 'page' property can be used to specify a particular type of page where an element should be displayed."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="paged"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="cssIdentifier"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="play-during" default="auto" description="Similar to the 'cue-before' and 'cue-after' properties, this property specifies a sound to be played as a background while an element's content is spoken."> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="mix"/> |
| | | <literal value="repeat"/> |
| | | <literal value="none"/> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="cssOffsiteUri"/> |
| | | <regexp name="cssOnsiteUri"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="text-align" description="This property describes how inline content of a block is aligned."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <!-- For safety, ignoring string alignment which can be used to line table cells on characters --> |
| | | <literal-list> |
| | | <literal value="left"/> |
| | | <literal value="right"/> |
| | | <literal value="center"/> |
| | | <literal value="justify"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="voice-family" description="The value is a comma-separated, prioritized list of voice family names (compare with 'font-family')."> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <!-- Allowing only generic voice family --> |
| | | <literal-list> |
| | | <literal value="male"/> |
| | | <literal value="female"/> |
| | | <literal value="child"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <!-- end manual properties --> |
| | | </css-rules> |
| | | |
| | | |
| | | <allowed-empty-tags> |
| | | <literal-list> |
| | | <literal value="br"/> |
| | | <literal value="hr"/> |
| | | <literal value="a"/> |
| | | <literal value="img"/> |
| | | <literal value="link"/> |
| | | <literal value="iframe"/> |
| | | <literal value="script"/> |
| | | <literal value="object"/> |
| | | <literal value="applet"/> |
| | | <literal value="frame"/> |
| | | <literal value="base"/> |
| | | <literal value="param"/> |
| | | <literal value="meta"/> |
| | | <literal value="input"/> |
| | | <literal value="textarea"/> |
| | | <literal value="embed"/> |
| | | <literal value="basefont"/> |
| | | <literal value="col"/> |
| | | <literal value="div"/> |
| | | </literal-list> |
| | | </allowed-empty-tags> |
| | | |
| | | </anti-samy-rules> |
New file |
| | |
| | | ##åæ·ç¼ç |
| | | memberCode=6A6229EEB35D992DD541598313373233 |
| | | ##请æ±APIKEY |
| | | apiKey=4SC9154KRE0K7PA8X29FHUHVK0ZP6KNS |
| | | ##模æ¿ç¼å· |
| | | templetId=2c0071f98c9a4bc2b11ff7fdeae9e649 |
New file |
| | |
| | | #éèéåäºç³»ç»é
ç½®åæ° |
| | | #ç产ç¯å¢ |
| | | #serverUrl=https://fintech.allinpay.com/service/soa |
| | | #æµè¯ç¯å¢ |
| | | serverUrl=http://116.228.64.55:6900/service/soa |
| | | sysId=1906061744156467038 |
| | | alias=1906061744156467038 |
| | | pwd=123456 |
| | | version=2.0 |
| | | path=C:/Users/Administrator/Desktop/yunst/1906061744156467038/1906061744156467038.pfx |
| | | tlCertPath=C:/Users/Administrator/Desktop/yunst/1906061744156467038/TLCert-test.cer |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import org.junit.Test; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName FileUtilTest |
| | | * @date 2019/8/2 17:40 |
| | | */ |
| | | public class FileUtilTest { |
| | | |
| | | @Test |
| | | public void testTouch() { |
| | | FileUtil.touch("d://test1/test.txt"); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import org.junit.Test; |
| | | |
| | | import java.util.*; |
| | | |
| | | public class IdTest { |
| | | |
| | | @Test |
| | | public void test() { |
| | | List<Long> list = new ArrayList<>(); |
| | | for (int i = 0; i < 1000; i++) { |
| | | Long id = IdGenerator.getId(); |
| | | System.out.println(i + ":======ã" + id); |
| | | list.add(id); |
| | | } |
| | | for (int i = 0; i < 100000; i++) { |
| | | Long id = IdGenerator.getId(); |
| | | System.out.println(i + ":======ã" + id); |
| | | list.add(id); |
| | | } |
| | | System.out.println(cheakIsRepeat(list)); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void test1() { |
| | | List<Long> list = new ArrayList<>(); |
| | | Thread thread=new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | for (int i = 0; i < 10000; i++) { |
| | | Long id = IdGenerator.getId(); |
| | | System.out.println(i + ":======ã" + id); |
| | | list.add(id); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | Thread thread2=new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | for (int i = 0; i < 10000; i++) { |
| | | Long id = IdGenerator.getId(); |
| | | System.out.println(i + ":======ã" + id); |
| | | list.add(id); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | thread.start(); |
| | | thread2.start(); |
| | | |
| | | |
| | | Map<Long,Integer> map = findRepetition(list); |
| | | if(map!=null){ |
| | | for (Map.Entry<Long,Integer> entry : map.entrySet()){ |
| | | if(entry.getValue()>1){ |
| | | System.out.println("å
ç´ "+entry.getKey()+" éå¤åºç°"+entry.getValue()+"次"); |
| | | }else{ |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | private Map<Long, Integer> findRepetition(List<Long> arr){ |
| | | try{ |
| | | Thread.sleep(1000L); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | Map<Long, Integer> map = new HashMap<>(); |
| | | if(arr == null || arr.size() <= 0){ |
| | | return null; |
| | | } |
| | | for(int i = 0; i < arr.size(); i ++){ |
| | | if(map.containsKey(arr.get(i))){ |
| | | map.put(arr.get(i), map.get(arr.get(i))+1); |
| | | }else{ |
| | | map.put(arr.get(i), 1); |
| | | } |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | public static boolean cheakIsRepeat(List<Long> list) { |
| | | try{ |
| | | Thread.sleep(1000L); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | HashSet<Long> hashSet = new HashSet<Long>(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | hashSet.add(list.get(i)); |
| | | } |
| | | if (hashSet.size() == list.size()) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import org.junit.Test; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * @ClassName JWTUtilTest |
| | | * @Description TODO |
| | | * @Author Chen Long |
| | | * @Date 2019/8/21 |
| | | * @Version 1.0 |
| | | */ |
| | | public class JWTUtilTest { |
| | | |
| | | @Test |
| | | public void generateJwt() { |
| | | HashMap<String, Object> claims = new HashMap<>(); |
| | | claims.put("sub", "zhangsan"); |
| | | System.out.println(JWTUtil.generateJwt(JWTUtil.JWT_TYPE_PC, claims)); |
| | | } |
| | | |
| | | @Test |
| | | public void checkJWT() { |
| | | System.out.println(JWTUtil.checkJWT("o6t48fVSqCUCueyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyMWU2OTU4NWE5OGQ3MjRlMTE4YWZmMTYzZDM4NWQyOSIsImlhdCI6MTU2NjQzOTQ4NywiZXhwIjoxNTY2NDM5NDg4fQ.2PqL9bDqdtmIEvIOTN3ME5pATxST5aHWwirRhrMi4jews4YqlDkKGsc0Xj-UFxEa1pIW2sSws2KqmzeJpDPI6w")); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.nuvole.common.domain.dataFile.DataFile; |
| | | import org.junit.Test; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class JsonTest { |
| | | |
| | | @Test |
| | | public void TestParse(){ |
| | | String image = "[{\"uid\":1562829586751,\"path\":\"/ecosphereBase/2019/7/11/8cc0253719484a768668c35175d57694.jpg\",\"name\":\"90346996.jpg\",\"url\":\"https://echftp.yqzhfw.com/ecosphereBase/2019/7/11/8cc0253719484a768668c35175d57694.jpg\"}]"; |
| | | List<DataFile> dataFiles = JSON.parseArray(image, DataFile.class); |
| | | System.out.println(dataFiles.get(0).getPath()); |
| | | System.out.println(dataFiles.size()); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import org.junit.Test; |
| | | |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName MapText |
| | | * @date 2019/5/8 18:31 |
| | | */ |
| | | public class MapTest { |
| | | |
| | | @Test |
| | | public void testMap() { |
| | | Map<String, String> h = new LinkedHashMap<>(); |
| | | h.put("name", "test"); |
| | | System.out.println(h.get("NAME")); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import org.junit.Test; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName MixPdTest |
| | | * @date 2019/5/7 14:37 |
| | | */ |
| | | public class MixPdTest { |
| | | |
| | | @Test |
| | | public void generateMixPd() throws Exception { |
| | | String a = "zhangsan1122671457474842950"; |
| | | System.out.println(SecureUtil.md5(a)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.Test; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName TreeUtilTest |
| | | * @date 2019/4/23 19:04 |
| | | */ |
| | | @Slf4j |
| | | public class TreeUtilTest { |
| | | @Test |
| | | public void convert2Tree() throws Exception { |
| | | |
| | | ArrayList list = new ArrayList(); |
| | | //list.add(new Node(1L, 0L, "1", "")); |
| | | list.add(new Node(2L, 1L, "1.1", "")); |
| | | list.add(new Node(3L, 1L, "1.2", "")); |
| | | list.add(new Node(4L, 3L, "1.2.1", "")); |
| | | |
| | | HashMap<String, String> mapping = new HashMap<>(); |
| | | mapping.put("byReplace", "label"); |
| | | |
| | | log.info(JSON.toJSONString(TreeUtil.convert2Tree(list ,""))); |
| | | log.info(JSON.toJSONString(TreeUtil.convert2Tree(list ,mapping))); |
| | | |
| | | } |
| | | |
| | | class Node{ |
| | | |
| | | public Node(Long id,Long pid,String name,String byReplace) { |
| | | this.id = id; |
| | | this.pid = pid; |
| | | this.name = name; |
| | | this.byReplace = byReplace; |
| | | } |
| | | |
| | | private Long id; |
| | | private Long pid; |
| | | private String name; |
| | | private String byReplace; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getPid() { |
| | | return pid; |
| | | } |
| | | |
| | | public void setPid(Long pid) { |
| | | this.pid = pid; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getByReplace() { |
| | | return byReplace; |
| | | } |
| | | |
| | | public void setByReplace(String byReplace) { |
| | | this.byReplace = byReplace; |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.nuvole.util; |
| | | |
| | | import org.apache.commons.lang.CharEncoding; |
| | | import org.junit.Test; |
| | | |
| | | /** |
| | | * @author ChenLong |
| | | * @version 1.0 |
| | | * @ClassName XssUtilTest |
| | | * @date 2019/7/16 18:42 |
| | | */ |
| | | public class XssUtilTest { |
| | | |
| | | @Test |
| | | public void clearXss() throws Exception { |
| | | String val = "<p style=\"text-align: center;\"><strong>qqq<em>qxxxx<span style=\"text-decoration: underline;\">ffffff<span style=\"text-decoration: line-through;\">fffff</span></span></em></strong></p>\n" + |
| | | "<p style=\"text-align: center;\"><strong><em><span style=\"text-decoration: underline;\"><span style=\"text-decoration: line-through;\"><img src=\"https://echftp.yqzhfw.com/ecosphereBaseDev/2019/7/16/0262f69df57f4f68acf763cacd362879.jpg\" alt=\"lalalal\" width=\"1920\" height=\"1080\" /></span></span></em></strong></p>"; |
| | | System.out.println(XssUtil.clearXss(val)); |
| | | } |
| | | |
| | | @Test |
| | | public void test() throws Exception { |
| | | String b = "aaaa"; |
| | | byte[] a = b.getBytes(CharEncoding.ISO_8859_1); |
| | | System.out.println("is a:" + a); |
| | | String s2 = XssUtil.clearXss(new String(a, CharEncoding.ISO_8859_1)); |
| | | System.out.println("s2:" + s2); |
| | | System.out.println("s2 byte:" + s2.getBytes(CharEncoding.ISO_8859_1)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="ISO-8859-1" ?> |
| | | |
| | | |
| | | <!-- |
| | | W3C rules retrieved from: |
| | | http://www.w3.org/TR/html401/struct/global.html |
| | | --> |
| | | |
| | | |
| | | <anti-samy-rules xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:noNamespaceSchemaLocation="antisamy.xsd"> |
| | | |
| | | <directives> |
| | | <directive name="omitXmlDeclaration" value="true"/> |
| | | <directive name="omitDoctypeDeclaration" value="true"/> |
| | | <directive name="maxInputSize" value="200000"/> |
| | | <directive name="useXHTML" value="true"/> |
| | | <directive name="formatOutput" value="true"/> |
| | | <directive name="nofollowAnchors" value="true" /> |
| | | <directive name="validateParamAsEmbed" value="true" /> |
| | | |
| | | <!-- |
| | | remember, this won't work for relative URIs - AntiSamy doesn't |
| | | know anything about the URL or your web structure |
| | | --> |
| | | <directive name="embedStyleSheets" value="false"/> |
| | | <directive name="connectionTimeout" value="5000"/> |
| | | <directive name="maxStyleSheetImports" value="3"/> |
| | | |
| | | <!-- Allows the use of dynamic attributes (i.e. HTML5 "data-") --> |
| | | <directive name="allowDynamicAttributes" value="true" /> |
| | | </directives> |
| | | |
| | | <common-regexps> |
| | | |
| | | <!-- |
| | | From W3C: |
| | | This attribute assigns a class name or set of class names to an |
| | | element. Any number of elements may be assigned the same class |
| | | name or names. Multiple class names must be separated by white |
| | | space characters. |
| | | --> |
| | | |
| | | <!-- The 16 colors defined by the HTML Spec (also used by the CSS Spec) --> |
| | | <regexp name="colorName" value="(aqua|black|blue|fuchsia|gray|grey|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow)"/> |
| | | |
| | | <!-- HTML/CSS Spec allows 3 or 6 digit hex to specify color --> |
| | | <regexp name="colorCode" value="(#([0-9a-fA-F]{6}|[0-9a-fA-F]{3}))"/> |
| | | |
| | | <regexp name="anything" value=".*"/> |
| | | <regexp name="numberOrPercent" value="(\d)+(%{0,1})"/> |
| | | <regexp name="paragraph" value="([\p{L}\p{N},'\.\s\-_\(\)\?]|&[0-9]{2};)*"/> |
| | | <regexp name="htmlId" value="[a-zA-Z0-9\:\-_\.]+"/> |
| | | <regexp name="htmlTitle" value="[\p{L}\p{N}\s\-_',:\[\]!\./\\\(\)&]*"/> <!-- force non-empty with a '+' at the end instead of '*' --> |
| | | <regexp name="htmlClass" value="[a-zA-Z0-9\s,\-_]+"/> |
| | | |
| | | <regexp name="onsiteURL" value="^(?![\p{L}\p{N}\\\.\#@\$%\+&;\-_~,\?=/!]*(&colon))[\p{L}\p{N}\\\.\#@\$%\+&;\-_~,\?=/!]*"/> |
| | | <regexp name="anchoredURL" value="#(\w)+"/> |
| | | <regexp name="offsiteURL" value="(\s)*((ht|f)tp(s?)://|mailto:)[\p{L}\p{N}]+[\p{L}\p{N}\p{Zs}\.\#@\$%\+&;:\-_~,\?=/!\(\)]*(\s)*"/> |
| | | |
| | | <regexp name="boolean" value="(true|false)"/> |
| | | <regexp name="singlePrintable" value="[a-zA-Z0-9]{1}"/> <!-- \w allows the '_' character --> |
| | | |
| | | <!-- This is for elements (ex: elemName { ... }) --> |
| | | <regexp name="cssElementSelector" value="[a-zA-Z0-9\-_]+|\*"/> |
| | | |
| | | <!-- This is to list out any element names that are *not* valid --> |
| | | <regexp name="cssElementExclusion" value=""/> |
| | | |
| | | <!-- This if for classes (ex: .className { ... }) --> |
| | | <regexp name="cssClassSelector" value="\.[a-zA-Z0-9\-_]+"/> |
| | | |
| | | <!-- This is to list out any class names that are *not* valid --> |
| | | <regexp name="cssClassExclusion" value=""/> |
| | | |
| | | <!-- This is for ID selectors (ex: #myId { ... } --> |
| | | <regexp name="cssIDSelector" value="#[a-zA-Z0-9\-_]+"/> |
| | | |
| | | <!-- This is to list out any IDs that are *not* valid - FIXME: What should the default be to avoid div hijacking? *? --> |
| | | <regexp name="cssIDExclusion" value=""/> |
| | | |
| | | <!-- This is for pseudo-element selector (ex. foo:pseudo-element { ... } --> |
| | | <regexp name="cssPseudoElementSelector" value=":[a-zA-Z0-9\-_]+"/> |
| | | |
| | | <!-- This is to list out any psuedo-element names that are *not* valid --> |
| | | <regexp name="cssPsuedoElementExclusion" value=""/> |
| | | |
| | | <!-- This is for attribute selectors (ex. foo[attr=value] { ... } --> |
| | | <regexp name="cssAttributeSelector" value="\[[a-zA-Z0-9\-_]+((=|~=|\|=){1}[a-zA-Z0-9\-_]+){1}\]"/> |
| | | |
| | | <!-- This is to list out any attribute names that are *not* valid --> |
| | | <regexp name="cssAttributeExclusion" value=""/> |
| | | |
| | | <!-- This is for resources referenced from CSS (such as background images and other imported stylesheets) --> |
| | | <regexp name="cssOnsiteUri" value="url\(([\p{L}\p{N}\\/\.\?=\#&;\-_~]+|\#(\w)+)\)"/> |
| | | <regexp name="cssOffsiteUri" value="url\((\s)*((ht|f)tp(s?)://)[\p{L}\p{N}]+[~\p{L}\p{N}\p{Zs}\-_\.@#$%&;:,\?=/\+!]*(\s)*\)"/> |
| | | |
| | | <!-- This if for CSS Identifiers --> |
| | | <regexp name="cssIdentifier" value="[a-zA-Z0-9\-_]+"/> |
| | | |
| | | <!-- This is for comments within CSS (ex. /* comment */) --> |
| | | <regexp name="cssCommentText" value="[\p{L}\p{N}\-_,\/\\\.\s\(\)!\?\=\$#%\^&:"']+"/> |
| | | |
| | | <regexp name="integer" value="(-|\+)?[0-9]+"/> |
| | | <regexp name="positiveInteger" value="(\+)?[0-9]+"/> |
| | | <regexp name="number" value="(-|\+)?([0-9]+(\.[0-9]+)?)"/> |
| | | <regexp name="angle" value="(-|\+)?([0-9]+(\.[0-9]+)?)(deg|grads|rad)"/> |
| | | <regexp name="time" value="([0-9]+(\.[0-9]+)?)(ms|s)"/> |
| | | <regexp name="frequency" value="([0-9]+(\.[0-9]+)?)(hz|khz)"/> |
| | | <regexp name="length" value="((-|\+)?0|(-|\+)?([0-9]+(\.[0-9]+)?)(em|ex|px|in|cm|mm|pt|pc))"/> |
| | | <regexp name="positiveLength" value="((\+)?0|(\+)?([0-9]+(\.[0-9]+)?)(em|ex|px|in|cm|mm|pt|pc))"/> |
| | | <regexp name="percentage" value="(-|\+)?([0-9]+(\.[0-9]+)?)%"/> |
| | | <regexp name="positivePercentage" value="(\+)?([0-9]+(\.[0-9]+)?)%"/> |
| | | |
| | | <regexp name="absolute-size" value="(xx-small|x-small|small|medium|large|x-large|xx-large)"/> |
| | | <regexp name="relative-size" value="(larger|smaller)"/> |
| | | |
| | | <!-- Used for CSS Color specifications (complex regexp expresses integer values of 0-255) --> |
| | | <regexp name="rgbCode" value="rgb\(([1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]),([1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]),([1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\)"/> |
| | | |
| | | <!-- CSS2 Allowed System Color Values --> |
| | | <regexp name="systemColor" value="(activeborder|activecaption|appworkspace|background|buttonface|buttonhighlight|buttonshadow|buttontext|captiontext|graytext|highlight|highlighttext|inactiveborder|inactivecaption|inactivecaptiontext|infobackground|infotext|menu|menutext|scrollbar|threeddarkshadow|threedface|threedhighlight|threedlightshadow|threedshadow|window|windowframe|windowtext)"/> |
| | | |
| | | <!-- This is where we specify what Flash src to allow --> |
| | | <regexp name="flashSites" value="http://(download\.macromedia\.com/pub|www\.macromedia\.com/(go|shockwave)|c\.brightcove\.com/services|gamevideos\.1up\.com/swf|www\.youtube\.com/v|vimeo\.com|www\.gametrailers\.com|videomedia\.ign\.com/ev|image\.com\.com/gamespot|www\.hulu\.com/embed|embed\.break\.com|player\.ordienetworks\.com/flash|www\.adultswim\.com/video/vplayer|www\.dailymotion\.com/swf|www\.ustream\.tv/flash/video|cdn-i\.dmdentertainment\.com|media\.mtvnservices\.com|www\.justin\.tv/widgets|www\.viddler\.com/(player|simple_on_site)|static\.twitter\.com/flash|www\.gamepro\.com/bin|www\.divshare\.com/flash|www\.facebook\.com/v)/.*"/> |
| | | </common-regexps> |
| | | |
| | | <!-- |
| | | |
| | | Tag.name = a, b, div, body, etc. |
| | | Tag.action = filter: remove tags, but keep content, validate: keep content as long as it passes rules, remove: remove tag and contents |
| | | Attribute.name = id, class, href, align, width, etc. |
| | | Attribute.onInvalid = what to do when the attribute is invalid, e.g., remove the tag (removeTag), remove the attribute (removeAttribute), filter the tag (filterTag) |
| | | Attribute.description = What rules in English you want to tell the users they can have for this attribute. Include helpful things so they'll be able to tune their HTML |
| | | |
| | | --> |
| | | |
| | | <!-- |
| | | Some attributes are common to all (or most) HTML tags. There aren't many that qualify for this. You have to make sure there's no |
| | | collisions between any of these attribute names with attribute names of other tags that are for different purposes. |
| | | --> |
| | | |
| | | <common-attributes> |
| | | |
| | | |
| | | <!-- Common to all HTML tags --> |
| | | |
| | | <attribute name="id" description="The 'id' of any HTML attribute should not contain anything besides letters and numbers"> |
| | | <regexp-list> |
| | | <regexp name="htmlId"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="classid"> |
| | | <regexp-list> |
| | | <regexp name="anything" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="codebase"> |
| | | <regexp-list> |
| | | <regexp name="flashSites" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="class" description="The 'class' of any HTML attribute is usually a single word, but it can also be a list of class names separated by spaces"> |
| | | <regexp-list> |
| | | <regexp name="htmlClass"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="lang" description="The 'lang' attribute tells the browser what language the element's attribute values and content are written in"> |
| | | <regexp-list> |
| | | <regexp value="[a-zA-Z]{2,20}"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="title" description="The 'title' attribute provides text that shows up in a 'tooltip' when a user hovers their mouse over the element"> |
| | | <regexp-list> |
| | | <regexp name="htmlTitle"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="alt" description="The 'alt' attribute provides alternative text to users when its visual representation is not available"> |
| | | <regexp-list> |
| | | <regexp name="paragraph"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="data-" description="Allows the HTML5 'data-' attribute to be added to elements"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <!-- the "style" attribute will be validated by an inline stylesheet scanner, so no need to define anything here - i hate having to special case this but no other choice --> |
| | | <attribute name="style" description="The 'style' attribute provides the ability for users to change many attributes of the tag's contents using a strict syntax"/> |
| | | |
| | | <attribute name="media"> |
| | | <regexp-list> |
| | | <regexp value="[a-zA-Z0-9,\-\s]+"/> |
| | | </regexp-list> |
| | | |
| | | <literal-list> |
| | | <literal value="screen"/> |
| | | <literal value="tty"/> |
| | | <literal value="tv"/> |
| | | <literal value="projection"/> |
| | | <literal value="handheld"/> |
| | | <literal value="print"/> |
| | | <literal value="braille"/> |
| | | <literal value="aural"/> |
| | | <literal value="all"/> |
| | | </literal-list> |
| | | |
| | | </attribute> |
| | | |
| | | |
| | | <!-- Anchor related --> |
| | | |
| | | <!-- onInvalid="filterTag" has been removed as per suggestion at OWASP SJ 2007 - just "name" is valid --> |
| | | <attribute name="href"> |
| | | <regexp-list> |
| | | <regexp name="onsiteURL"/> |
| | | <regexp name="anchoredURL"/> |
| | | <regexp name="offsiteURL"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="name"> |
| | | <regexp-list> |
| | | |
| | | <regexp value="[a-zA-Z0-9-\_\$]+"/> |
| | | |
| | | <!-- |
| | | have to allow the $ for .NET controls - although, |
| | | will users be supplying input that has server-generated |
| | | .NET control names? methinks not, but i want to pass my |
| | | test cases |
| | | --> |
| | | |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | |
| | | <attribute name="shape" description="The 'shape' attribute defines the shape of the selectable area"> |
| | | <literal-list> |
| | | <literal value="default"/> |
| | | <literal value="rect"/> |
| | | <literal value="circle"/> |
| | | <literal value="poly"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | |
| | | |
| | | <!-- Table attributes --> |
| | | |
| | | <attribute name="border"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="cellpadding"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="cellspacing"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="colspan"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="rowspan"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="background"> |
| | | <regexp-list> |
| | | <regexp name="onsiteURL"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="bgcolor"> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="abbr"> |
| | | <regexp-list> |
| | | <regexp name="paragraph"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="headers" description="The 'headers' attribute is a space-separated list of cell IDs"> |
| | | <regexp-list> |
| | | <regexp value="[a-zA-Z0-9\s*]*"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="charoff"> |
| | | <regexp-list> |
| | | <regexp value="numberOrPercent"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="char"> |
| | | <regexp-list> |
| | | <regexp value=".{0,1}"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | |
| | | <attribute name="axis" description="The 'headers' attribute is a comma-separated list of related header cells"> |
| | | <regexp-list> |
| | | <regexp value="[a-zA-Z0-9\s*,]*"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="nowrap" description="The 'nowrap' attribute tells the browser not to wrap text that goes over one line"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | <!-- <regexp value="(nowrap){0,1}"/> --> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | |
| | | <!-- Common positioning attributes --> |
| | | |
| | | <attribute name="width"> |
| | | <regexp-list> |
| | | <regexp name="numberOrPercent"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="height"> |
| | | <regexp-list> |
| | | <regexp name="numberOrPercent"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="align" description="The 'align' attribute of an HTML element is a direction word, like 'left', 'right' or 'center'"> |
| | | <literal-list> |
| | | <literal value="center"/> |
| | | <literal value="middle"/> |
| | | <literal value="left"/> |
| | | <literal value="right"/> |
| | | <literal value="justify"/> |
| | | <literal value="char"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="valign" description="The 'valign' attribute of an HTML attribute is a direction word, like 'baseline','bottom','middle' or 'top'"> |
| | | <literal-list> |
| | | <literal value="baseline"/> |
| | | <literal value="bottom"/> |
| | | <literal value="middle"/> |
| | | <literal value="top"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | |
| | | |
| | | <!-- Intrinsic JavaScript Events --> |
| | | |
| | | <attribute name="onFocus" description="The 'onFocus' event is executed when the control associated with the tag gains focus"> |
| | | <literal-list> |
| | | <literal value="javascript:void(0)"/> |
| | | <literal value="javascript:history.go(-1)"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="onBlur" description="The 'onBlur' event is executed when the control associated with the tag loses focus"> |
| | | <literal-list> |
| | | <literal value="javascript:void(0)"/> |
| | | <literal value="javascript:history.go(-1)"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="onClick" description="The 'onClick' event is executed when the control associated with the tag is clicked"> |
| | | <literal-list> |
| | | <literal value="javascript:void(0)"/> |
| | | <literal value="javascript:history.go(-1)"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="onDblClick" description="The 'onDblClick' event is executed when the control associated with the tag is clicked twice immediately"> |
| | | <literal-list> |
| | | <literal value="javascript:void(0)"/> |
| | | <literal value="javascript:history.go(-1)"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="onMouseDown" description="The 'onMouseDown' event is executed when the control associated with the tag is clicked but not yet released"> |
| | | <literal-list> |
| | | <literal value="javascript:void(0)"/> |
| | | <literal value="javascript:history.go(-1)"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="onMouseUp" description="The 'onMouseUp' event is executed when the control associated with the tag is clicked after the button is released"> |
| | | <literal-list> |
| | | <literal value="javascript:void(0)"/> |
| | | <literal value="javascript:history.go(-1)"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="onMouseOver" description="The 'onMouseOver' event is executed when the user's mouse hovers over the control associated with the tag"> |
| | | <literal-list> |
| | | <literal value="javascript:void(0)"/> |
| | | <literal value="javascript:history.go(-1)"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="scope" description="The 'scope' attribute defines what's covered by the header cells"> |
| | | <literal-list> |
| | | <literal value="row"/> |
| | | <literal value="col"/> |
| | | <literal value="rowgroup"/> |
| | | <literal value="colgroup"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | |
| | | |
| | | <!-- If you want users to be able to mess with tabindex, uncomment this --> |
| | | <!-- |
| | | <attribute name="tabindex" description="..."> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | --> |
| | | |
| | | |
| | | <!-- Input/form related common attributes --> |
| | | |
| | | <attribute name="disabled"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="readonly"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="accesskey"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="size"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | |
| | | <attribute name="autocomplete"> |
| | | <literal-list> |
| | | <literal value="on"/> |
| | | <literal value="off"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="rows"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="cols"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | </common-attributes> |
| | | |
| | | |
| | | <!-- |
| | | This requires normal updates as browsers continue to diverge from the W3C and each other. As long as the browser wars continue |
| | | this is going to continue. I'm not sure war is the right word for what's going on. Doesn't somebody have to win a war after |
| | | a while? Even wars of attrition, surely? |
| | | --> |
| | | |
| | | <global-tag-attributes> |
| | | <!-- Not valid in base, head, html, meta, param, script, style, and title elements. --> |
| | | <attribute name="id"/> |
| | | <attribute name="style"/> |
| | | <attribute name="title"/> |
| | | <attribute name="class"/> |
| | | <!-- Not valid in base, br, frame, frameset, hr, iframe, param, and script elements. --> |
| | | <attribute name="lang"/> |
| | | </global-tag-attributes> |
| | | |
| | | <!-- Declare "dynamic" tag attributes here. The directive "allowDynamicAttributes" must be set to true --> |
| | | <dynamic-tag-attributes> |
| | | <attribute name="data-"/> <!-- HTML5 "data-" tag --> |
| | | </dynamic-tag-attributes> |
| | | |
| | | <tags-to-encode> |
| | | <tag>g</tag> |
| | | <tag>grin</tag> |
| | | </tags-to-encode> |
| | | |
| | | <tag-rules> |
| | | |
| | | <!-- You can mess with this stuff if you know what you're doing --> |
| | | |
| | | <tag name="html" action="validate"/> |
| | | |
| | | <tag name="body" action="validate"> |
| | | <attribute name="bgcolor"/> |
| | | </tag> |
| | | |
| | | <tag name="meta" action="filter"/> |
| | | |
| | | <tag name="head" action="validate"/> |
| | | |
| | | <!-- since we're validating the style sheets this is safe to have - switch to "truncate" if the user's html will appear in the html body --> |
| | | <tag name="title" action="truncate"/> |
| | | |
| | | |
| | | <!-- Tags related to JavaScript --> |
| | | |
| | | <tag name="script" action="remove"/> |
| | | <tag name="noscript" action="validate"/> <!-- although no javascript can fire inside a noscript tag, css is still a viable attack vector --> |
| | | |
| | | |
| | | |
| | | <!-- Frame & related tags --> |
| | | |
| | | <tag name="iframe" action="remove"/> |
| | | <tag name="frameset" action="remove"/> |
| | | <tag name="frame" action="remove"/> |
| | | |
| | | |
| | | |
| | | <!-- Form related tags --> |
| | | |
| | | <tag name="label" action="validate"> |
| | | <attribute name="for"> |
| | | <regexp-list> |
| | | <regexp name="htmlId"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | |
| | | <!-- |
| | | If you wish to enable any of the form related tags, change the tag's action below from "filter" or "remove" to "validate". The attributes have been |
| | | hardened so this is safe to do, if it's something you want to allow. Beware the <><ing possibilities! |
| | | --> |
| | | |
| | | <tag name="form" action="validate"> |
| | | |
| | | <attribute name="action"> |
| | | <regexp-list> |
| | | <regexp name="onsiteURL"/> |
| | | <regexp name="offsiteURL"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="name"/> |
| | | |
| | | <attribute name="autocomplete"/> |
| | | |
| | | <attribute name="method"> |
| | | <literal-list> |
| | | <literal value="post"/> |
| | | <literal value="get"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | </tag> |
| | | |
| | | <tag name="button" action="validate"> |
| | | <attribute name="name"/> |
| | | <attribute name="value"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="disabled"/> |
| | | <attribute name="accesskey"/> |
| | | <attribute name="type"> |
| | | <literal-list> |
| | | <literal value="submit"/> |
| | | <literal value="reset"/> |
| | | <literal value="button"/> |
| | | </literal-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | <tag name="input" action="validate"> |
| | | |
| | | <attribute name="name"/> |
| | | |
| | | <attribute name="size"/> |
| | | |
| | | <attribute name="maxlength"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="autocomplete"/> |
| | | |
| | | <attribute name="checked"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="alt"/> |
| | | |
| | | <attribute name="src"> |
| | | <regexp-list> |
| | | <regexp name="onsiteURL"/> |
| | | <regexp name="offsiteURL"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="usemap"> |
| | | <regexp-list> |
| | | <regexp name="onsiteURL"/> |
| | | <regexp name="anchoredURL"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="type"> |
| | | <literal-list> |
| | | <literal value="hidden"/> |
| | | <literal value="text"/> |
| | | <literal value="password"/> |
| | | <literal value="radio"/> |
| | | <literal value="checkbox"/> |
| | | <literal value="submit"/> |
| | | <literal value="button"/> |
| | | <literal value="image"/> |
| | | <literal value="file"/> |
| | | <literal value="reset"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="value"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="disabled"/> |
| | | <attribute name="readonly"/> |
| | | <attribute name="accesskey"/> |
| | | |
| | | <attribute name="border"/> |
| | | |
| | | </tag> |
| | | |
| | | <tag name="select" action="validate"> |
| | | |
| | | <attribute name="name"/> |
| | | <attribute name="disabled"/> |
| | | |
| | | <attribute name="multiple"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="size"/> |
| | | |
| | | </tag> |
| | | |
| | | <tag name="option" action="validate"> |
| | | |
| | | <attribute name="disabled"/> |
| | | |
| | | <attribute name="value"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="label"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="selected"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | <tag name="textarea" action="validate"> |
| | | <attribute name="rows"/> |
| | | <attribute name="cols"/> |
| | | <attribute name="name"/> |
| | | <attribute name="disabled"/> |
| | | <attribute name="readonly"/> |
| | | <attribute name="accesskey"/> |
| | | </tag> |
| | | |
| | | |
| | | |
| | | |
| | | <!-- All formatting tags --> |
| | | |
| | | <tag name="h1" action="validate"/> |
| | | <tag name="h2" action="validate"/> |
| | | <tag name="h3" action="validate"/> |
| | | <tag name="h4" action="validate"/> |
| | | <tag name="h5" action="validate"/> |
| | | <tag name="h6" action="validate"/> |
| | | |
| | | <tag name="p" action="validate"> |
| | | <attribute name="align"/> |
| | | </tag> |
| | | |
| | | <tag name="i" action="validate"/> |
| | | <tag name="b" action="validate"/> |
| | | <tag name="u" action="validate"/> |
| | | <tag name="strong" action="validate"/> |
| | | |
| | | <tag name="em" action="validate"/> |
| | | <tag name="small" action="validate"/> |
| | | <tag name="big" action="validate"/> |
| | | <tag name="pre" action="validate"/> |
| | | <tag name="code" action="validate"/> |
| | | <tag name="cite" action="validate"/> |
| | | <tag name="samp" action="validate"/> |
| | | <tag name="sub" action="validate"/> |
| | | <tag name="sup" action="validate"/> |
| | | <tag name="strike" action="validate"/> |
| | | <tag name="center" action="validate"/> |
| | | <tag name="blockquote" action="validate"/> |
| | | |
| | | <tag name="hr" action="validate"/> |
| | | <tag name="br" action="validate"/> |
| | | |
| | | <tag name="col" action="validate"/> |
| | | |
| | | <tag name="font" action="validate"> |
| | | <attribute name="color"> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="face"> |
| | | <regexp-list> |
| | | <regexp value="[\w;, \-]+"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="size"> |
| | | <regexp-list> |
| | | <regexp value="(\+|-){0,1}(\d)+"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | |
| | | <!-- Anchor and anchor related tags --> |
| | | |
| | | <tag name="a" action="validate"> |
| | | |
| | | <!-- onInvalid="filterTag" has been removed as per suggestion at OWASP SJ 2007 - just "name" is valid --> |
| | | <attribute name="href"/> |
| | | <attribute name="onFocus"/> |
| | | <attribute name="onBlur"/> |
| | | <attribute name="nohref"> |
| | | <regexp-list> |
| | | <regexp name="anything"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="rel"> |
| | | <literal-list> |
| | | <literal value="nofollow"/> |
| | | </literal-list> |
| | | </attribute> |
| | | <attribute name="name"/> |
| | | |
| | | </tag> |
| | | |
| | | <tag name="map" action="validate"/> |
| | | |
| | | <!-- base tag removed per demo - this could be enabled with literal-list values you allow --> |
| | | <!-- |
| | | <tag name="base" action="validate"> |
| | | <attribute name="href"/> |
| | | </tag> |
| | | --> |
| | | |
| | | |
| | | |
| | | <!-- Stylesheet Tags --> |
| | | |
| | | <tag name="style" action="validate"> |
| | | <attribute name="type"> |
| | | <literal-list> |
| | | <literal value="text/css"/> |
| | | </literal-list> |
| | | </attribute> |
| | | <attribute name="media"/> |
| | | </tag> |
| | | |
| | | <tag name="span" action="validate"/> |
| | | |
| | | <tag name="div" action="validate"> |
| | | <attribute name="align"/> |
| | | </tag> |
| | | |
| | | |
| | | <!-- Image & image related tags --> |
| | | |
| | | <tag name="img" action="validate"> |
| | | <attribute name="src" onInvalid="removeTag"> |
| | | <regexp-list> |
| | | <regexp name="onsiteURL"/> |
| | | <regexp name="offsiteURL"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="name"/> |
| | | <attribute name="alt"/> |
| | | <attribute name="height"/> |
| | | <attribute name="width"/> |
| | | <attribute name="border"/> |
| | | <attribute name="align"/> |
| | | |
| | | <attribute name="hspace"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | |
| | | <attribute name="vspace"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | <!-- no way to do this safely without hooking up the same code to @import to embed the remote stylesheet (malicious user could change offsite resource to be malicious after validation --> |
| | | <!-- <attribute name="href" onInvalid="removeTag"/> --> |
| | | |
| | | <tag name="link" action="validate"> |
| | | |
| | | <!-- <attribute name="href" onInvalid="removeTag"/> --> |
| | | |
| | | <attribute name="media"/> |
| | | |
| | | <attribute name="type" onInvalid="removeTag"> |
| | | <literal-list> |
| | | <literal value="text/css"/> |
| | | <literal value="application/rss+xml"/> |
| | | <literal value="image/x-icon"/> |
| | | </literal-list> |
| | | </attribute> |
| | | |
| | | <attribute name="rel"> |
| | | <literal-list> |
| | | <literal value="stylesheet"/> |
| | | <literal value="shortcut icon"/> |
| | | <literal value="search"/> |
| | | <literal value="copyright"/> |
| | | <literal value="top"/> |
| | | <literal value="alternate"/> |
| | | </literal-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <!-- List tags --> |
| | | |
| | | <tag name="ul" action="validate"/> |
| | | <tag name="ol" action="validate"/> |
| | | <tag name="li" action="validate"/> |
| | | |
| | | |
| | | |
| | | |
| | | <!-- Dictionary tags --> |
| | | |
| | | <tag name="dd" action="truncate"/> |
| | | <tag name="dl" action="truncate"/> |
| | | <tag name="dt" action="truncate"/> |
| | | |
| | | |
| | | |
| | | |
| | | <!-- Table tags (tbody, thead, tfoot)--> |
| | | |
| | | <tag name="thead" action="validate"> |
| | | <attribute name="align"/> |
| | | <attribute name="char"/> |
| | | <attribute name="charoff"/> |
| | | <attribute name="valign"/> |
| | | </tag> |
| | | |
| | | <tag name="tbody" action="validate"> |
| | | <attribute name="align"/> |
| | | <attribute name="char"/> |
| | | <attribute name="charoff"/> |
| | | <attribute name="valign"/> |
| | | </tag> |
| | | |
| | | <tag name="tfoot" action="validate"> |
| | | <attribute name="align"/> |
| | | <attribute name="char"/> |
| | | <attribute name="charoff"/> |
| | | <attribute name="valign"/> |
| | | </tag> |
| | | |
| | | <tag name="table" action="validate"> |
| | | <attribute name="height"/> |
| | | <attribute name="width"/> |
| | | <attribute name="border"/> |
| | | <attribute name="bgcolor"/> |
| | | <attribute name="cellpadding"/> |
| | | <attribute name="cellspacing"/> |
| | | <attribute name="background"/> |
| | | <attribute name="align"/> |
| | | <attribute name="noresize"> |
| | | <literal-list> |
| | | <literal value="noresize"/> |
| | | <literal value=""/> |
| | | </literal-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | <tag name="td" action="validate"> |
| | | <attribute name="background"/> |
| | | <attribute name="bgcolor"/> |
| | | <attribute name="abbr"/> |
| | | <attribute name="axis"/> |
| | | <attribute name="headers"/> |
| | | <attribute name="scope"/> |
| | | <attribute name="nowrap"/> |
| | | <attribute name="height"/> |
| | | <attribute name="width"/> |
| | | <attribute name="align"/> |
| | | <attribute name="char"/> |
| | | <attribute name="charoff"/> |
| | | <attribute name="valign"/> |
| | | <attribute name="colspan"/> |
| | | <attribute name="rowspan"/> |
| | | </tag> |
| | | |
| | | <tag name="th" action="validate"> |
| | | <attribute name="abbr"/> |
| | | <attribute name="axis"/> |
| | | <attribute name="headers"/> |
| | | <attribute name="scope"/> |
| | | <attribute name="nowrap"/> |
| | | <attribute name="bgcolor"/> |
| | | <attribute name="height"/> |
| | | <attribute name="width"/> |
| | | <attribute name="align"/> |
| | | <attribute name="char"/> |
| | | <attribute name="charoff"/> |
| | | <attribute name="valign"/> |
| | | <attribute name="colspan"/> |
| | | <attribute name="rowspan"/> |
| | | </tag> |
| | | |
| | | <tag name="tr" action="validate"> |
| | | <attribute name="height"/> |
| | | <attribute name="width"/> |
| | | <attribute name="align"/> |
| | | <attribute name="valign"/> |
| | | <attribute name="char"/> |
| | | <attribute name="charoff"/> |
| | | <attribute name="background"/> |
| | | </tag> |
| | | |
| | | <tag name="colgroup" action="validate"> |
| | | |
| | | <attribute name="span"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="width"/> |
| | | <attribute name="align"/> |
| | | <attribute name="char"/> |
| | | <attribute name="charoff"/> |
| | | <attribute name="valign"/> |
| | | </tag> |
| | | |
| | | <tag name="col" action="validate"> |
| | | <attribute name="align"/> |
| | | <attribute name="char"/> |
| | | <attribute name="charoff"/> |
| | | <attribute name="valign"/> |
| | | <attribute name="span"> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="width"/> |
| | | </tag> |
| | | |
| | | <tag name="fieldset" action="validate"/> |
| | | <tag name="legend" action="validate"/> |
| | | |
| | | |
| | | <!-- tags for popular Flash embeds --> |
| | | |
| | | <tag name="object" action="validate"> |
| | | <attribute name="id" /> |
| | | <attribute name="classid" /> |
| | | <attribute name="codebase" /> |
| | | <attribute name="type" onInvalid="removeTag"> |
| | | <literal-list> |
| | | <literal value="application/x-shockwave-flash" /> |
| | | </literal-list> |
| | | </attribute> |
| | | <attribute name="data" onInvalid="removeTag"> |
| | | <regexp-list> |
| | | <regexp name="flashSites" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="align" /> |
| | | <attribute name="height" /> |
| | | <attribute name="width" /> |
| | | <attribute name="alt" /> |
| | | <attribute name="bgcolor"> |
| | | <regexp-list> |
| | | <regexp name="colorCode" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | <!-- with validateParamAsEmbed=true, this tag rule also covers <param> name/value pairs --> |
| | | <tag name="embed" action="validate"> |
| | | <attribute name="src" onInvalid="removeTag"> |
| | | <regexp-list> |
| | | <regexp name="flashSites" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="movie" onInvalid="removeTag"> |
| | | <regexp-list> |
| | | <regexp name="flashSites" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="pluginspage"> |
| | | <regexp-list> |
| | | <regexp name="flashSites" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="bgcolor"> |
| | | <regexp-list> |
| | | <regexp name="colorCode" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="base"> |
| | | <literal-list> |
| | | <literal value="http://admin.brightcove.com" /> |
| | | </literal-list> |
| | | </attribute> |
| | | <attribute name="type"> |
| | | <literal-list> |
| | | <literal value="application/x-shockwave-flash" /> |
| | | </literal-list> |
| | | </attribute> |
| | | <attribute name="name"> |
| | | <regexp-list> |
| | | <regexp name="anything" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="flashvars"> |
| | | <regexp-list> |
| | | <regexp name="anything" /><!-- we could put something complex in here, but this is prolly fine for now--> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="align" /> |
| | | <attribute name="height" /> |
| | | <attribute name="width" /> |
| | | <attribute name="allowfullscreen"> |
| | | <regexp-list> |
| | | <regexp name="boolean" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="quality"> |
| | | <literal-list> |
| | | <literal value="high" /> |
| | | </literal-list> |
| | | </attribute> |
| | | <attribute name="allowscriptaccess"> |
| | | <literal-list> |
| | | <literal value="always" /> |
| | | <literal value="samedomain" /> |
| | | </literal-list> |
| | | </attribute> |
| | | <attribute name="seamlesstabbing"> |
| | | <regexp-list> |
| | | <regexp name="boolean" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="swliveconnect"> |
| | | <regexp-list> |
| | | <regexp name="boolean" /> |
| | | </regexp-list> |
| | | </attribute> |
| | | <attribute name="wmode"> |
| | | <literal-list> |
| | | <literal value="transparent" /> |
| | | <literal value="window" /> |
| | | </literal-list> |
| | | </attribute> |
| | | <attribute name="allownetworking"> |
| | | <literal-list> |
| | | <literal value="all" /> |
| | | </literal-list> |
| | | </attribute> |
| | | </tag> |
| | | |
| | | </tag-rules> |
| | | |
| | | |
| | | <!-- CSS validation processing rules --> |
| | | |
| | | <css-rules> |
| | | |
| | | <property name="azimuth" description="This property is most likely to be implemented by mixing the same signal into different channels at differing volumes."> |
| | | <literal-list> |
| | | <literal value="left-side"/> |
| | | <literal value="far-left"/> |
| | | <literal value="left"/> |
| | | <literal value="center-left"/> |
| | | <literal value="center"/> |
| | | <literal value="center-right"/> |
| | | <literal value="right"/> |
| | | <literal value="far-right"/> |
| | | <literal value="right-side"/> |
| | | <literal value="behind"/> |
| | | <literal value="leftwards"/> |
| | | <literal value="rightwards"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="angle"/> |
| | | </regexp-list> |
| | | </property> |
| | | |
| | | <property name="background" description="The 'background' property is a shorthand property for setting the individual background properties (i.e., 'background-color', 'background-image', 'background-repeat', 'background-attachment' and 'background-position') at the same place in the style sheet."> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="background-color"/> |
| | | <shorthand name="background-image"/> |
| | | <shorthand name="background-repeat"/> |
| | | <shorthand name="background-attachment"/> |
| | | <shorthand name="background-position"/> |
| | | </shorthand-list> |
| | | </property> |
| | | |
| | | <property name="background-attachment" description="If a background image is specified, this property specifies whether it is fixed with regard to the viewport ('fixed') or scrolls along with the document ('scroll')."> |
| | | <literal-list> |
| | | <literal value="scroll"/> |
| | | <literal value="fixed"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | |
| | | <property name="background-color" description="This property sets the background color of an element, either a <color> value or the keyword 'transparent', to make the underlying colors shine through."> |
| | | <literal-list> |
| | | <literal value="transparent"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | </property> |
| | | |
| | | <property name="background-image" description="This property sets the background image of an element."> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="cssOffsiteUri"/> |
| | | <regexp name="cssOnsiteUri"/> |
| | | </regexp-list> |
| | | </property> |
| | | |
| | | <property name="background-position" description="If a background image has been specified, this property specifies its initial position."> |
| | | <literal-list> |
| | | <literal value="top"/> |
| | | <literal value="center"/> |
| | | <literal value="bottom"/> |
| | | <literal value="left"/> |
| | | <literal value="center"/> |
| | | <literal value="right"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="percentage"/> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | |
| | | <property name="background-repeat" description="If a background image is specified, this property specifies whether the image is repeated (tiled), and how."> |
| | | <literal-list> |
| | | <literal value="repeat"/> |
| | | <literal value="repeat-x"/> |
| | | <literal value="repeat-y"/> |
| | | <literal value="no-repeat"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | |
| | | <!-- Begin simple properties --> |
| | | <property name="border-collapse" default="collapse" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="collapse"/> |
| | | <literal value="separate"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="border-color" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="transparent"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="border-top-color" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="border-right-color" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="border-bottom-color" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="border-left-color" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="bottom" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="caption-side" default="top" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="top"/> |
| | | <literal value="bottom"/> |
| | | <literal value="left"/> |
| | | <literal value="right"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="clear" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="left"/> |
| | | <literal value="right"/> |
| | | <literal value="both"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="color" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="cue-after" default="none" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="cssOffsiteUri"/> |
| | | <regexp name="cssOnsiteUri"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="cue-before" default="none" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="cssOffsiteUri"/> |
| | | <regexp name="cssOnsiteUri"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="direction" default="ltr" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="ltr"/> |
| | | <literal value="rtl"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="display" default="inline" description=""> |
| | | <category-list> |
| | | <category value="all"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inline"/> |
| | | <literal value="block"/> |
| | | <literal value="list-item"/> |
| | | <literal value="run-in"/> |
| | | <literal value="compact"/> |
| | | <literal value="marker"/> |
| | | <literal value="table"/> |
| | | <literal value="inline-table"/> |
| | | <literal value="table-row-group"/> |
| | | <literal value="table-header-group"/> |
| | | <literal value="table-footer-group"/> |
| | | <literal value="table-row"/> |
| | | <literal value="table-column-group"/> |
| | | <literal value="table-column"/> |
| | | <literal value="table-cell"/> |
| | | <literal value="table-caption"/> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="elevation" default="level" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="below"/> |
| | | <literal value="level"/> |
| | | <literal value="above"/> |
| | | <literal value="higher"/> |
| | | <literal value="lower"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="angle"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="empty-cells" default="show" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="show"/> |
| | | <literal value="hide"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="float" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="left"/> |
| | | <literal value="right"/> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="font-size" default="medium" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="absolute-size"/> |
| | | <regexp name="relative-size"/> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="font-size-adjust" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="font-stretch" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="wider"/> |
| | | <literal value="narrower"/> |
| | | <literal value="ultra-condensed"/> |
| | | <literal value="extra-condensed"/> |
| | | <literal value="condensed"/> |
| | | <literal value="semi-condensed"/> |
| | | <literal value="semi-expanded"/> |
| | | <literal value="expanded"/> |
| | | <literal value="extra-expanded"/> |
| | | <literal value="ultra-expanded"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="font-style" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="italic"/> |
| | | <literal value="oblique"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="font-variant" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="small-caps"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="font-weight" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="bold"/> |
| | | <literal value="bolder"/> |
| | | <literal value="lighter"/> |
| | | <literal value="100"/> |
| | | <literal value="200"/> |
| | | <literal value="300"/> |
| | | <literal value="400"/> |
| | | <literal value="500"/> |
| | | <literal value="600"/> |
| | | <literal value="700"/> |
| | | <literal value="800"/> |
| | | <literal value="900"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="height" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="left" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="letter-spacing" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="line-height" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="list-style-image" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="cssOffsiteUri"/> |
| | | <regexp name="cssOnsiteUri"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="list-style-position" default="outside" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inside"/> |
| | | <literal value="outside"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="list-style-type" default="disc" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="disc"/> |
| | | <literal value="circle"/> |
| | | <literal value="square"/> |
| | | <literal value="decimal"/> |
| | | <literal value="decimal-leading-zero"/> |
| | | <literal value="lower-roman"/> |
| | | <literal value="upper-roman"/> |
| | | <literal value="lower-greek"/> |
| | | <literal value="lower-alpha"/> |
| | | <literal value="lower-latin"/> |
| | | <literal value="upper-alpha"/> |
| | | <literal value="upper-latin"/> |
| | | <literal value="hebrew"/> |
| | | <literal value="armenian"/> |
| | | <literal value="georgian"/> |
| | | <literal value="cjk-ideographic"/> |
| | | <literal value="hiragana"/> |
| | | <literal value="katakana"/> |
| | | <literal value="hiragana-iroha"/> |
| | | <literal value="katakana-iroha"/> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="marker-offset" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="max-height" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="max-width" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="min-height" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="min-width" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="orphans" default="2" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="paged"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="integer"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="outline-color" default="invert" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="interactive"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="invert"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="overflow" default="visible" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="visible"/> |
| | | <literal value="hidden"/> |
| | | <literal value="scroll"/> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="page-break-after" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="paged"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="always"/> |
| | | <literal value="avoid"/> |
| | | <literal value="left"/> |
| | | <literal value="right"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="page-break-before" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="paged"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="always"/> |
| | | <literal value="avoid"/> |
| | | <literal value="left"/> |
| | | <literal value="right"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="page-break-inside" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="paged"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="avoid"/> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="pause-after" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="time"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="pause-before" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="time"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="pitch" default="medium" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="x-low"/> |
| | | <literal value="low"/> |
| | | <literal value="medium"/> |
| | | <literal value="high"/> |
| | | <literal value="x-high"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="frequency"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="pitch-range" default="50" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="position" default="static" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="static"/> |
| | | <!-- possible to perform phishing attacks with the following --> |
| | | <!-- |
| | | <literal value="relative"/> |
| | | <literal value="absolute"/> |
| | | <literal value="fixed"/> |
| | | --> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="richness" default="50" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="right" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="size" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="paged"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="portrait"/> |
| | | <literal value="landscape"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="speak" default="normal" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="none"/> |
| | | <literal value="spell-out"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="speak-header" default="once" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="once"/> |
| | | <literal value="always"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="speak-numeral" default="continuous" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="digits"/> |
| | | <literal value="continuous"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="speak-punctuation" default="none" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="code"/> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="speech-rate" default="medium" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="x-slow"/> |
| | | <literal value="slow"/> |
| | | <literal value="medium"/> |
| | | <literal value="fast"/> |
| | | <literal value="x-fast"/> |
| | | <literal value="faster"/> |
| | | <literal value="slower"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="stress" default="50" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="table-layout" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="fixed"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="text-indent" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="text-transform" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="capitalize"/> |
| | | <literal value="uppercase"/> |
| | | <literal value="lowercase"/> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="top" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="unicode-bidi" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="embed"/> |
| | | <literal value="bidi-override"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="vertical-align" default="baseline" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="baseline"/> |
| | | <literal value="sub"/> |
| | | <literal value="super"/> |
| | | <literal value="top"/> |
| | | <literal value="text-top"/> |
| | | <literal value="middle"/> |
| | | <literal value="bottom"/> |
| | | <literal value="text-bottom"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="percentage"/> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="visibility" default="inherit" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="visible"/> |
| | | <literal value="hidden"/> |
| | | <literal value="collapse"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="volume" default="medium" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="silent"/> |
| | | <literal value="x-soft"/> |
| | | <literal value="soft"/> |
| | | <literal value="medium"/> |
| | | <literal value="loud"/> |
| | | <literal value="x-loud"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="number"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="white-space" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="pre"/> |
| | | <literal value="nowrap"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="widows" default="2" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="paged"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="integer"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="width" default="auto" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="word-spacing" default="normal" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="normal"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | |
| | | <!-- end simple properties --> |
| | | |
| | | <!-- begin medium properties --> |
| | | <property name="border-style" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | <literal value="none"/> |
| | | <literal value="hidden"/> |
| | | <literal value="dotted"/> |
| | | <literal value="dashed"/> |
| | | <literal value="solid"/> |
| | | <literal value="double"/> |
| | | <literal value="groove"/> |
| | | <literal value="ridge"/> |
| | | <literal value="inset"/> |
| | | <literal value="outset"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="border-top-style" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="border-right-style" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-bottom-style" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-left-style" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-top-width" default="medium" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-width"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-right-width" default="medium" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-width"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-bottom-width" default="medium" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-width"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-left-width" default="medium" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-width"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-width" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | <literal value="thin"/> |
| | | <literal value="medium"/> |
| | | <literal value="thick"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="margin" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | <literal value="auto"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="positiveLength"/> |
| | | <regexp name="positivePercentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="margin-top" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="margin"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="margin-right" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="margin"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="margin-bottom" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="margin"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="margin-left" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="margin"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="outline-style" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="interactive"/> |
| | | </category-list> |
| | | |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="outline-width" default="medium" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="interactive"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-width"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="padding" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="padding-top" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="padding"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="padding-right" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="padding"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="padding-bottom" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="padding"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="padding-left" default="0" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="padding"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <!-- end medium properties --> |
| | | |
| | | <!-- begin hard properties --> |
| | | <property name="border" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-width"/> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-top" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-top-width"/> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-right" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-top-width"/> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-bottom" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-top-width"/> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="border-left" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | </regexp-list> |
| | | <shorthand-list> |
| | | <shorthand name="border-top-width"/> |
| | | <shorthand name="border-style"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="cue" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="cue-before"/> |
| | | <shorthand name="cue-after"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="list-style" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="list-style-type"/> |
| | | <shorthand name="list-style-position"/> |
| | | <shorthand name="list-style-image"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="marks" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="paged"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="crop"/> |
| | | <literal value="cross"/> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="outline" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="interactive"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="outline-color"/> |
| | | <shorthand name="outline-style"/> |
| | | <shorthand name="outline-width"/> |
| | | </shorthand-list> |
| | | </property> |
| | | <property name="pause" description=""> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="time"/> |
| | | <regexp name="percentage"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="text-decoration" default="none" description=""> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="underline"/> |
| | | <literal value="overline"/> |
| | | <literal value="line-through"/> |
| | | <literal value="blink"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <!-- end hard properties --> |
| | | <!-- begin manual properties --> |
| | | <property name="border-spacing" default="0" description="The lengths specify the distance that separates adjacent cell borders. If one length is specified, it gives both the horizontal and vertical spacing. If two are specified, the first gives the horizontal spacing and the second the vertical spacing. Lengths may not be negative."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="clip" default="auto" description="The 'clip' property applies to elements that have a 'overflow' property with a value other than 'visible'."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="counter-increment" default="none" description="The 'counter-increment' property accepts one or more names of counters (identifiers), each one optionally followed by an integer."> |
| | | <category-list> |
| | | <category value="all"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="cssIdentifier"/> |
| | | <regexp name="integer"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="clip" default="auto" description="The 'clip' property applies to elements that have a 'overflow' property with a value other than 'visible'."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="cursor" default="auto" description="This property specifies the type of cursor to be displayed for the pointing device."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="interactive"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | <literal value="crosshair"/> |
| | | <literal value="default"/> |
| | | <literal value="pointer"/> |
| | | <literal value="move"/> |
| | | <literal value="e-resize"/> |
| | | <literal value="ne-resize"/> |
| | | <literal value="nw-resize"/> |
| | | <literal value="n-resize"/> |
| | | <literal value="se-resize"/> |
| | | <literal value="sw-resize"/> |
| | | <literal value="s-resize"/> |
| | | <literal value="w-resize| text"/> |
| | | <literal value="wait"/> |
| | | <literal value="help"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="cssOffsiteUri"/> |
| | | <regexp name="cssOnsiteUri"/> |
| | | </regexp-list> |
| | | </property> |
| | | |
| | | <property name="text-shadow" default="none" description="This property accepts a comma-separated list of shadow effects to be applied to the text of the element."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="none"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="colorName"/> |
| | | <regexp name="colorCode"/> |
| | | <regexp name="rgbCode"/> |
| | | <regexp name="systemColor"/> |
| | | <regexp name="length"/> |
| | | </regexp-list> |
| | | </property> |
| | | |
| | | <property name="font" description="The 'font' property is, except as described below, a shorthand property for setting 'font-style', 'font-variant', 'font-weight', 'font-size', 'line-height', and 'font-family', at the same place in the style sheet."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="/"/> |
| | | <literal value="caption"/> |
| | | <literal value="icon"/> |
| | | <literal value="menu"/> |
| | | <literal value="message-box"/> |
| | | <literal value="small-caption"/> |
| | | <literal value="status-bar"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <shorthand-list> |
| | | <shorthand name="font-style"/> |
| | | <shorthand name="font-variant"/> |
| | | <shorthand name="font-weight"/> |
| | | <shorthand name="font-size"/> |
| | | <shorthand name="line-height"/> |
| | | <shorthand name="font-family"/> |
| | | </shorthand-list> |
| | | </property> |
| | | |
| | | <property name="font-family" description="This property specifies a prioritized list of font family names and/or generic family names."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <!-- allowing only generic font families --> |
| | | <literal-list> |
| | | <literal value="serif"/> |
| | | <literal value="arial"/> |
| | | <literal value="lucida console"/> |
| | | <literal value="sans-serif"/> |
| | | <literal value="cursive"/> |
| | | <literal value="verdana"/> |
| | | <literal value="fantasy"/> |
| | | <literal value="monospace"/> |
| | | </literal-list> |
| | | |
| | | |
| | | <regexp-list> |
| | | <regexp value="[\w,\-'" ]+"/> |
| | | </regexp-list> |
| | | |
| | | </property> |
| | | <property name="page" description="The 'page' property can be used to specify a particular type of page where an element should be displayed."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | <category value="paged"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="auto"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="cssIdentifier"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="play-during" default="auto" description="Similar to the 'cue-before' and 'cue-after' properties, this property specifies a sound to be played as a background while an element's content is spoken."> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <literal-list> |
| | | <literal value="mix"/> |
| | | <literal value="repeat"/> |
| | | <literal value="none"/> |
| | | <literal value="auto"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | <regexp-list> |
| | | <regexp name="cssOffsiteUri"/> |
| | | <regexp name="cssOnsiteUri"/> |
| | | </regexp-list> |
| | | </property> |
| | | <property name="text-align" description="This property describes how inline content of a block is aligned."> |
| | | <category-list> |
| | | <category value="visual"/> |
| | | </category-list> |
| | | <!-- For safety, ignoring string alignment which can be used to line table cells on characters --> |
| | | <literal-list> |
| | | <literal value="left"/> |
| | | <literal value="right"/> |
| | | <literal value="center"/> |
| | | <literal value="justify"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <property name="voice-family" description="The value is a comma-separated, prioritized list of voice family names (compare with 'font-family')."> |
| | | <category-list> |
| | | <category value="aural"/> |
| | | </category-list> |
| | | <!-- Allowing only generic voice family --> |
| | | <literal-list> |
| | | <literal value="male"/> |
| | | <literal value="female"/> |
| | | <literal value="child"/> |
| | | <literal value="inherit"/> |
| | | </literal-list> |
| | | </property> |
| | | <!-- end manual properties --> |
| | | </css-rules> |
| | | |
| | | |
| | | <allowed-empty-tags> |
| | | <literal-list> |
| | | <literal value="br"/> |
| | | <literal value="hr"/> |
| | | <literal value="a"/> |
| | | <literal value="img"/> |
| | | <literal value="link"/> |
| | | <literal value="iframe"/> |
| | | <literal value="script"/> |
| | | <literal value="object"/> |
| | | <literal value="applet"/> |
| | | <literal value="frame"/> |
| | | <literal value="base"/> |
| | | <literal value="param"/> |
| | | <literal value="meta"/> |
| | | <literal value="input"/> |
| | | <literal value="textarea"/> |
| | | <literal value="embed"/> |
| | | <literal value="basefont"/> |
| | | <literal value="col"/> |
| | | <literal value="div"/> |
| | | </literal-list> |
| | | </allowed-empty-tags> |
| | | |
| | | </anti-samy-rules> |