添加汇付进件通道
This commit is contained in:
parent
a0b4a72d4b
commit
53afd54de8
|
|
@ -0,0 +1,43 @@
|
|||
package com.chaozhanggui.admin.system.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.chaozhanggui.merchant.service.HfMerService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/notifyCallback")
|
||||
public class NotifyController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private HfMerService hfMerService;
|
||||
|
||||
|
||||
|
||||
@PostMapping("feedCallBack")
|
||||
public String feedCallBack(HttpServletRequest request) throws Exception {
|
||||
log.info(JSON.toJSONString(request.getParameterMap()));
|
||||
String type = request.getParameter("type");
|
||||
//验签请参data
|
||||
String data = request.getParameter("data");
|
||||
//验签请参sign
|
||||
String sign = request.getParameter("sign");
|
||||
hfMerService.callBack(type,data,sign);
|
||||
return "SUCCESS";
|
||||
}
|
||||
|
||||
@PostMapping("merchantResident")
|
||||
public String merchantResident(@RequestParam("userId") String userId){
|
||||
hfMerService.merchantResident(userId,null);
|
||||
return "SUCCESS";
|
||||
}
|
||||
}
|
||||
|
|
@ -38,6 +38,11 @@ public class LoginInterceptor implements HandlerInterceptor {
|
|||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
// 获取进过拦截器的路径
|
||||
String requestURI = request.getRequestURI();
|
||||
|
||||
if("/admin/notifyCallback/feedCallBack".equals(requestURI)||"/admin/notifyCallback/merchantResident".equals(requestURI)){
|
||||
return true;
|
||||
}
|
||||
|
||||
String loginName=request.getHeader("loginName");
|
||||
String token=request.getHeader("token");
|
||||
String userId=request.getHeader("userId");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.chaozhanggui.dao.system.dao;
|
||||
|
||||
import com.chaozhanggui.dao.system.entity.TbBlussBankBranchHf;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbBlussBankBranchHfMapper {
|
||||
int deleteByPrimaryKey(String bankCode);
|
||||
|
||||
int insert(TbBlussBankBranchHf record);
|
||||
|
||||
int insertSelective(TbBlussBankBranchHf record);
|
||||
|
||||
TbBlussBankBranchHf selectByPrimaryKey(String bankCode);
|
||||
|
||||
int updateByPrimaryKeySelective(TbBlussBankBranchHf record);
|
||||
|
||||
int updateByPrimaryKey(TbBlussBankBranchHf record);
|
||||
|
||||
|
||||
TbBlussBankBranchHf selectByName(String bankName);
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.chaozhanggui.dao.system.dao;
|
||||
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussCitysHf;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbPlussCitysHfMapper {
|
||||
int deleteByPrimaryKey(String cityCode);
|
||||
|
||||
int insert(TbPlussCitysHf record);
|
||||
|
||||
int insertSelective(TbPlussCitysHf record);
|
||||
|
||||
TbPlussCitysHf selectByPrimaryKey(String cityCode);
|
||||
|
||||
int updateByPrimaryKeySelective(TbPlussCitysHf record);
|
||||
|
||||
int updateByPrimaryKey(TbPlussCitysHf record);
|
||||
|
||||
TbPlussCitysHf selectByCodeAndParentCode(@Param("cityName") String cityName,@Param("parentCode") String parentCode);
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.chaozhanggui.dao.system.dao;
|
||||
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussMccInfoHf;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbPlussMccInfoHfMapper {
|
||||
int insert(TbPlussMccInfoHf record);
|
||||
|
||||
int insertSelective(TbPlussMccInfoHf record);
|
||||
|
||||
TbPlussMccInfoHf selectByMccCode(String mccCode);
|
||||
}
|
||||
|
|
@ -5,6 +5,8 @@ import com.chaozhanggui.dao.system.entity.TbPlussMerchantAuditRecord;
|
|||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbPlussMerchantAuditRecordMapper {
|
||||
|
|
@ -19,4 +21,8 @@ public interface TbPlussMerchantAuditRecordMapper {
|
|||
int updateByPrimaryKeySelective(TbPlussMerchantAuditRecord record);
|
||||
|
||||
int updateByPrimaryKey(TbPlussMerchantAuditRecord record);
|
||||
|
||||
TbPlussMerchantAuditRecord selectByApplicationid(String applicationid);
|
||||
|
||||
List<TbPlussMerchantAuditRecord> selectByStatus();
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.chaozhanggui.dao.system.dao;
|
||||
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussMerchantHfInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbPlussMerchantHfInfoMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(TbPlussMerchantHfInfo record);
|
||||
|
||||
int insertSelective(TbPlussMerchantHfInfo record);
|
||||
|
||||
TbPlussMerchantHfInfo selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbPlussMerchantHfInfo record);
|
||||
|
||||
int updateByPrimaryKey(TbPlussMerchantHfInfo record);
|
||||
|
||||
TbPlussMerchantHfInfo selectByMerchantCodeAndSubApiKey(@Param("merchantCode") String merchantCode,@Param("liveApiKey") String liveApiKey);
|
||||
|
||||
|
||||
TbPlussMerchantHfInfo selectByMerchantCode(String merchantCode);
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.chaozhanggui.dao.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class TbBlussBankBranchHf implements Serializable {
|
||||
private String bankCode;
|
||||
|
||||
private String bankName;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public String getBankCode() {
|
||||
return bankCode;
|
||||
}
|
||||
|
||||
public void setBankCode(String bankCode) {
|
||||
this.bankCode = bankCode == null ? null : bankCode.trim();
|
||||
}
|
||||
|
||||
public String getBankName() {
|
||||
return bankName;
|
||||
}
|
||||
|
||||
public void setBankName(String bankName) {
|
||||
this.bankName = bankName == null ? null : bankName.trim();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.chaozhanggui.dao.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class TbPlussCitysHf implements Serializable {
|
||||
private String cityCode;
|
||||
|
||||
private String cityName;
|
||||
|
||||
private String parentCityCode;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode == null ? null : cityCode.trim();
|
||||
}
|
||||
|
||||
public String getCityName() {
|
||||
return cityName;
|
||||
}
|
||||
|
||||
public void setCityName(String cityName) {
|
||||
this.cityName = cityName == null ? null : cityName.trim();
|
||||
}
|
||||
|
||||
public String getParentCityCode() {
|
||||
return parentCityCode;
|
||||
}
|
||||
|
||||
public void setParentCityCode(String parentCityCode) {
|
||||
this.parentCityCode = parentCityCode == null ? null : parentCityCode.trim();
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
package com.chaozhanggui.dao.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class TbPlussMccInfoHf implements Serializable {
|
||||
private String mccCode;
|
||||
|
||||
private String aliClsId;
|
||||
|
||||
private String aliCategoryId;
|
||||
|
||||
private String wxPersonal;
|
||||
|
||||
private String wxBusiness;
|
||||
|
||||
private String mccTxt;
|
||||
|
||||
private String fatherTxt;
|
||||
|
||||
private String grandpaTxt;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public String getMccCode() {
|
||||
return mccCode;
|
||||
}
|
||||
|
||||
public void setMccCode(String mccCode) {
|
||||
this.mccCode = mccCode == null ? null : mccCode.trim();
|
||||
}
|
||||
|
||||
public String getAliClsId() {
|
||||
return aliClsId;
|
||||
}
|
||||
|
||||
public void setAliClsId(String aliClsId) {
|
||||
this.aliClsId = aliClsId == null ? null : aliClsId.trim();
|
||||
}
|
||||
|
||||
public String getAliCategoryId() {
|
||||
return aliCategoryId;
|
||||
}
|
||||
|
||||
public void setAliCategoryId(String aliCategoryId) {
|
||||
this.aliCategoryId = aliCategoryId == null ? null : aliCategoryId.trim();
|
||||
}
|
||||
|
||||
public String getWxPersonal() {
|
||||
return wxPersonal;
|
||||
}
|
||||
|
||||
public void setWxPersonal(String wxPersonal) {
|
||||
this.wxPersonal = wxPersonal == null ? null : wxPersonal.trim();
|
||||
}
|
||||
|
||||
public String getWxBusiness() {
|
||||
return wxBusiness;
|
||||
}
|
||||
|
||||
public void setWxBusiness(String wxBusiness) {
|
||||
this.wxBusiness = wxBusiness == null ? null : wxBusiness.trim();
|
||||
}
|
||||
|
||||
public String getMccTxt() {
|
||||
return mccTxt;
|
||||
}
|
||||
|
||||
public void setMccTxt(String mccTxt) {
|
||||
this.mccTxt = mccTxt == null ? null : mccTxt.trim();
|
||||
}
|
||||
|
||||
public String getFatherTxt() {
|
||||
return fatherTxt;
|
||||
}
|
||||
|
||||
public void setFatherTxt(String fatherTxt) {
|
||||
this.fatherTxt = fatherTxt == null ? null : fatherTxt.trim();
|
||||
}
|
||||
|
||||
public String getGrandpaTxt() {
|
||||
return grandpaTxt;
|
||||
}
|
||||
|
||||
public void setGrandpaTxt(String grandpaTxt) {
|
||||
this.grandpaTxt = grandpaTxt == null ? null : grandpaTxt.trim();
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package com.chaozhanggui.dao.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class TbPlussMerchantHfInfo implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private String merchantCode;
|
||||
|
||||
private String status;
|
||||
|
||||
private String testApiKey;
|
||||
|
||||
private String liveApiKey;
|
||||
|
||||
private String appIdList;
|
||||
|
||||
private String appId;
|
||||
|
||||
private String appName;
|
||||
|
||||
private String loginPwd;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getMerchantCode() {
|
||||
return merchantCode;
|
||||
}
|
||||
|
||||
public void setMerchantCode(String merchantCode) {
|
||||
this.merchantCode = merchantCode == null ? null : merchantCode.trim();
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status == null ? null : status.trim();
|
||||
}
|
||||
|
||||
public String getTestApiKey() {
|
||||
return testApiKey;
|
||||
}
|
||||
|
||||
public void setTestApiKey(String testApiKey) {
|
||||
this.testApiKey = testApiKey == null ? null : testApiKey.trim();
|
||||
}
|
||||
|
||||
public String getLiveApiKey() {
|
||||
return liveApiKey;
|
||||
}
|
||||
|
||||
public void setLiveApiKey(String liveApiKey) {
|
||||
this.liveApiKey = liveApiKey == null ? null : liveApiKey.trim();
|
||||
}
|
||||
|
||||
public String getAppIdList() {
|
||||
return appIdList;
|
||||
}
|
||||
|
||||
public void setAppIdList(String appIdList) {
|
||||
this.appIdList = appIdList == null ? null : appIdList.trim();
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId == null ? null : appId.trim();
|
||||
}
|
||||
|
||||
public String getAppName() {
|
||||
return appName;
|
||||
}
|
||||
|
||||
public void setAppName(String appName) {
|
||||
this.appName = appName == null ? null : appName.trim();
|
||||
}
|
||||
|
||||
public String getLoginPwd() {
|
||||
return loginPwd;
|
||||
}
|
||||
|
||||
public void setLoginPwd(String loginPwd) {
|
||||
this.loginPwd = loginPwd == null ? null : loginPwd.trim();
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
<!-- 数据库链接URL、用户名、密码 -->
|
||||
|
||||
<jdbcConnection connectionURL="jdbc:mysql://101.37.12.135:3306/ysk_test?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8"
|
||||
driverClass="com.mysql.cj.jdbc.Driver" password="CZGmysqlroot@123" userId="ysk_test">
|
||||
driverClass="com.mysql.cj.jdbc.Driver" password="mysqlroot@123" userId="ysk_test">
|
||||
|
||||
<property name="nullCatalogMeansCurrent" value="true"/>
|
||||
</jdbcConnection>
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
<!-- 要生成的表tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
|
||||
<!-- <table tableName="%" schema="mining" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" ></table>-->
|
||||
<table tableName="tb_pluss_admin_recode" domainObjectName="TbPlussAdminRecode"
|
||||
<table tableName="tb_pluss_citys_hf" domainObjectName="TbPlussCitysHf"
|
||||
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
|
||||
enableSelectByExample="false" selectByExampleQueryId="false" >
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.dao.system.dao.TbBlussBankBranchHfMapper">
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.dao.system.entity.TbBlussBankBranchHf">
|
||||
<id column="bank_code" jdbcType="VARCHAR" property="bankCode" />
|
||||
<result column="bank_name" jdbcType="VARCHAR" property="bankName" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
bank_code, bank_name
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_pluss_bank_branch_hf
|
||||
where bank_code = #{bankCode,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from tb_pluss_bank_branch_hf
|
||||
where bank_code = #{bankCode,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.dao.system.entity.TbBlussBankBranchHf">
|
||||
insert into tb_pluss_bank_branch_hf (bank_code, bank_name)
|
||||
values (#{bankCode,jdbcType=VARCHAR}, #{bankName,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.dao.system.entity.TbBlussBankBranchHf">
|
||||
insert into tb_pluss_bank_branch_hf
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="bankCode != null">
|
||||
bank_code,
|
||||
</if>
|
||||
<if test="bankName != null">
|
||||
bank_name,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="bankCode != null">
|
||||
#{bankCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="bankName != null">
|
||||
#{bankName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.dao.system.entity.TbBlussBankBranchHf">
|
||||
update tb_pluss_bank_branch_hf
|
||||
<set>
|
||||
<if test="bankName != null">
|
||||
bank_name = #{bankName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where bank_code = #{bankCode,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.dao.system.entity.TbBlussBankBranchHf">
|
||||
update tb_pluss_bank_branch_hf
|
||||
set bank_name = #{bankName,jdbcType=VARCHAR}
|
||||
where bank_code = #{bankCode,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<select id="selectByName" resultMap="BaseResultMap">
|
||||
|
||||
select * from tb_pluss_bank_branch_hf where bank_name like concat('%',#{bankName},'%') limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.dao.system.dao.TbPlussCitysHfMapper">
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.dao.system.entity.TbPlussCitysHf">
|
||||
<id column="city_code" jdbcType="VARCHAR" property="cityCode" />
|
||||
<result column="city_name" jdbcType="VARCHAR" property="cityName" />
|
||||
<result column="parent_city_code" jdbcType="VARCHAR" property="parentCityCode" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
city_code, city_name, parent_city_code, create_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_pluss_citys_hf
|
||||
where city_code = #{cityCode,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from tb_pluss_citys_hf
|
||||
where city_code = #{cityCode,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.dao.system.entity.TbPlussCitysHf">
|
||||
insert into tb_pluss_citys_hf (city_code, city_name, parent_city_code,
|
||||
create_time)
|
||||
values (#{cityCode,jdbcType=VARCHAR}, #{cityName,jdbcType=VARCHAR}, #{parentCityCode,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussCitysHf">
|
||||
insert into tb_pluss_citys_hf
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="cityCode != null">
|
||||
city_code,
|
||||
</if>
|
||||
<if test="cityName != null">
|
||||
city_name,
|
||||
</if>
|
||||
<if test="parentCityCode != null">
|
||||
parent_city_code,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="cityCode != null">
|
||||
#{cityCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cityName != null">
|
||||
#{cityName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="parentCityCode != null">
|
||||
#{parentCityCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussCitysHf">
|
||||
update tb_pluss_citys_hf
|
||||
<set>
|
||||
<if test="cityName != null">
|
||||
city_name = #{cityName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="parentCityCode != null">
|
||||
parent_city_code = #{parentCityCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where city_code = #{cityCode,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.dao.system.entity.TbPlussCitysHf">
|
||||
update tb_pluss_citys_hf
|
||||
set city_name = #{cityName,jdbcType=VARCHAR},
|
||||
parent_city_code = #{parentCityCode,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP}
|
||||
where city_code = #{cityCode,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<select id="selectByCodeAndParentCode" resultMap="BaseResultMap">
|
||||
select * from tb_pluss_citys_hf where city_name like concat('%',#{cityName},'%') and parent_city_code=#{parentCode}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.dao.system.dao.TbPlussMccInfoHfMapper">
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.dao.system.entity.TbPlussMccInfoHf">
|
||||
<result column="mcc_code" jdbcType="VARCHAR" property="mccCode" />
|
||||
<result column="ali_cls_id" jdbcType="VARCHAR" property="aliClsId" />
|
||||
<result column="ali_category_id" jdbcType="VARCHAR" property="aliCategoryId" />
|
||||
<result column="wx_personal" jdbcType="VARCHAR" property="wxPersonal" />
|
||||
<result column="wx_business" jdbcType="VARCHAR" property="wxBusiness" />
|
||||
<result column="mcc_txt" jdbcType="VARCHAR" property="mccTxt" />
|
||||
<result column="father_txt" jdbcType="VARCHAR" property="fatherTxt" />
|
||||
<result column="grandpa_txt" jdbcType="VARCHAR" property="grandpaTxt" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
</resultMap>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMccInfoHf">
|
||||
insert into tb_pluss_mcc_info_hf (mcc_code, ali_cls_id, ali_category_id,
|
||||
wx_personal, wx_business, mcc_txt,
|
||||
father_txt, grandpa_txt, create_time
|
||||
)
|
||||
values (#{mccCode,jdbcType=VARCHAR}, #{aliClsId,jdbcType=VARCHAR}, #{aliCategoryId,jdbcType=VARCHAR},
|
||||
#{wxPersonal,jdbcType=VARCHAR}, #{wxBusiness,jdbcType=VARCHAR}, #{mccTxt,jdbcType=VARCHAR},
|
||||
#{fatherTxt,jdbcType=VARCHAR}, #{grandpaTxt,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMccInfoHf">
|
||||
insert into tb_pluss_mcc_info_hf
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="mccCode != null">
|
||||
mcc_code,
|
||||
</if>
|
||||
<if test="aliClsId != null">
|
||||
ali_cls_id,
|
||||
</if>
|
||||
<if test="aliCategoryId != null">
|
||||
ali_category_id,
|
||||
</if>
|
||||
<if test="wxPersonal != null">
|
||||
wx_personal,
|
||||
</if>
|
||||
<if test="wxBusiness != null">
|
||||
wx_business,
|
||||
</if>
|
||||
<if test="mccTxt != null">
|
||||
mcc_txt,
|
||||
</if>
|
||||
<if test="fatherTxt != null">
|
||||
father_txt,
|
||||
</if>
|
||||
<if test="grandpaTxt != null">
|
||||
grandpa_txt,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="mccCode != null">
|
||||
#{mccCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="aliClsId != null">
|
||||
#{aliClsId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="aliCategoryId != null">
|
||||
#{aliCategoryId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="wxPersonal != null">
|
||||
#{wxPersonal,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="wxBusiness != null">
|
||||
#{wxBusiness,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="mccTxt != null">
|
||||
#{mccTxt,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="fatherTxt != null">
|
||||
#{fatherTxt,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="grandpaTxt != null">
|
||||
#{grandpaTxt,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="selectByMccCode" resultMap="BaseResultMap">
|
||||
select * from tb_pluss_mcc_info_hf where mcc_code=#{mccCode}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -150,4 +150,12 @@
|
|||
applicationId = #{applicationid,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<select id="selectByApplicationid" resultMap="BaseResultMap">
|
||||
select * from tb_pluss_merchant_audit_record where applicationId=#{applicationid}
|
||||
</select>
|
||||
|
||||
<select id="selectByStatus" resultMap="BaseResultMap">
|
||||
select * from tb_pluss_merchant_audit_record where channel=7 and thirdStatus=1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -488,7 +488,7 @@
|
|||
resultType="com.chaozhanggui.dao.system.entity.TbPlussMerchantChannelStatus">
|
||||
SELECT * FROM tb_pluss_merchant_channel_status
|
||||
WHERE merchantCode=#{merchantCode}
|
||||
AND channelId=#{channelId}
|
||||
AND channel=#{channelId}
|
||||
</select>
|
||||
<select id="getIncomingInfo" resultType="com.chaozhanggui.dao.system.entity.TbPlussMerchantChannelStatus">
|
||||
SELECT *
|
||||
|
|
|
|||
|
|
@ -0,0 +1,172 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.dao.system.dao.TbPlussMerchantHfInfoMapper">
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.dao.system.entity.TbPlussMerchantHfInfo">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="merchant_code" jdbcType="VARCHAR" property="merchantCode" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="test_api_key" jdbcType="VARCHAR" property="testApiKey" />
|
||||
<result column="live_api_key" jdbcType="VARCHAR" property="liveApiKey" />
|
||||
<result column="app_id_list" jdbcType="VARCHAR" property="appIdList" />
|
||||
<result column="app_id" jdbcType="VARCHAR" property="appId" />
|
||||
<result column="app_name" jdbcType="VARCHAR" property="appName" />
|
||||
<result column="login_pwd" jdbcType="VARCHAR" property="loginPwd" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, merchant_code, status, test_api_key, live_api_key, app_id_list, app_id, app_name,
|
||||
login_pwd, create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_pluss_merchant_hf_info
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from tb_pluss_merchant_hf_info
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantHfInfo">
|
||||
insert into tb_pluss_merchant_hf_info (id, merchant_code, status,
|
||||
test_api_key, live_api_key, app_id_list,
|
||||
app_id, app_name, login_pwd,
|
||||
create_time, update_time)
|
||||
values (#{id,jdbcType=INTEGER}, #{merchantCode,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||
#{testApiKey,jdbcType=VARCHAR}, #{liveApiKey,jdbcType=VARCHAR}, #{appIdList,jdbcType=VARCHAR},
|
||||
#{appId,jdbcType=VARCHAR}, #{appName,jdbcType=VARCHAR}, #{loginPwd,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantHfInfo">
|
||||
insert into tb_pluss_merchant_hf_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="merchantCode != null">
|
||||
merchant_code,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status,
|
||||
</if>
|
||||
<if test="testApiKey != null">
|
||||
test_api_key,
|
||||
</if>
|
||||
<if test="liveApiKey != null">
|
||||
live_api_key,
|
||||
</if>
|
||||
<if test="appIdList != null">
|
||||
app_id_list,
|
||||
</if>
|
||||
<if test="appId != null">
|
||||
app_id,
|
||||
</if>
|
||||
<if test="appName != null">
|
||||
app_name,
|
||||
</if>
|
||||
<if test="loginPwd != null">
|
||||
login_pwd,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="merchantCode != null">
|
||||
#{merchantCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="testApiKey != null">
|
||||
#{testApiKey,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="liveApiKey != null">
|
||||
#{liveApiKey,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="appIdList != null">
|
||||
#{appIdList,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="appId != null">
|
||||
#{appId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="appName != null">
|
||||
#{appName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="loginPwd != null">
|
||||
#{loginPwd,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantHfInfo">
|
||||
update tb_pluss_merchant_hf_info
|
||||
<set>
|
||||
<if test="merchantCode != null">
|
||||
merchant_code = #{merchantCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="testApiKey != null">
|
||||
test_api_key = #{testApiKey,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="liveApiKey != null">
|
||||
live_api_key = #{liveApiKey,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="appIdList != null">
|
||||
app_id_list = #{appIdList,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="appId != null">
|
||||
app_id = #{appId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="appName != null">
|
||||
app_name = #{appName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="loginPwd != null">
|
||||
login_pwd = #{loginPwd,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantHfInfo">
|
||||
update tb_pluss_merchant_hf_info
|
||||
set merchant_code = #{merchantCode,jdbcType=VARCHAR},
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
test_api_key = #{testApiKey,jdbcType=VARCHAR},
|
||||
live_api_key = #{liveApiKey,jdbcType=VARCHAR},
|
||||
app_id_list = #{appIdList,jdbcType=VARCHAR},
|
||||
app_id = #{appId,jdbcType=VARCHAR},
|
||||
app_name = #{appName,jdbcType=VARCHAR},
|
||||
login_pwd = #{loginPwd,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<select id="selectByMerchantCodeAndSubApiKey" resultMap="BaseResultMap">
|
||||
select * from tb_pluss_merchant_hf_info where merchant_code=#{merchantCode} and live_api_key=#{liveApiKey}
|
||||
</select>
|
||||
|
||||
<select id="selectByMerchantCode" resultMap="BaseResultMap">
|
||||
select * from tb_pluss_merchant_hf_info where merchant_code=#{merchantCode} order by id desc limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -17,6 +17,30 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
<version>4.5.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.48</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.chaozhanggui.system</groupId>
|
||||
<artifactId>common-api</artifactId>
|
||||
|
|
@ -52,6 +76,33 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.huifu.adapay</groupId>
|
||||
<artifactId>adapay-sdk-merchant</artifactId>
|
||||
<version>1.2.6</version>
|
||||
<systemPath>${project.basedir}/lib/adapay-sdk-merchant-1.2.6.jar</systemPath>
|
||||
<scope>system</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.huifu.adapay</groupId>
|
||||
<artifactId>adapay-core-sdk</artifactId>
|
||||
<version>1.2.10</version>
|
||||
<systemPath>${project.basedir}/lib/adapay-core-sdk-1.2.10.jar</systemPath>
|
||||
<scope>system</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.huifu.adapay</groupId>
|
||||
<artifactId>adapay-java-sdk</artifactId>
|
||||
<version>1.2.10</version>
|
||||
<systemPath>${project.basedir}/lib/adapay-java-sdk-1.2.10.jar</systemPath>
|
||||
<scope>system</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -40,6 +40,9 @@ public class MerchantService {
|
|||
@Resource
|
||||
private TbPlussNoticeMapper tbPlussNoticeMapper;
|
||||
|
||||
@Autowired
|
||||
HfMerService hfMerService;
|
||||
|
||||
/**
|
||||
* 通用进件方法
|
||||
* @param userId
|
||||
|
|
@ -105,6 +108,9 @@ public class MerchantService {
|
|||
case "6":
|
||||
ysAuditServiceV3.merchantAuditV3(userId,false, Integer.valueOf(channelId));
|
||||
break;
|
||||
case "7":
|
||||
hfMerService.feed(baseInfo,channelStatus);
|
||||
break;
|
||||
default:
|
||||
MsgException.throwException("未知的进件通道");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,115 @@
|
|||
package com.chaozhanggui.merchant.util;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.security.*;
|
||||
import java.security.interfaces.RSAPrivateKey;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Java RSA 加密工具类
|
||||
*
|
||||
*/
|
||||
public class RSAUtils {
|
||||
/**
|
||||
* 密钥长度 于原文长度对应 以及越长速度越慢
|
||||
*/
|
||||
private final static int KEY_SIZE = 1024;
|
||||
/**
|
||||
* 用于封装随机产生的公钥与私钥
|
||||
*/
|
||||
private static Map<Integer, String> keyMap = new HashMap<Integer, String>();
|
||||
|
||||
/**
|
||||
* 随机生成密钥对
|
||||
*/
|
||||
public static Map<Integer, String> genKeyPair() throws NoSuchAlgorithmException {
|
||||
// KeyPairGenerator类用于生成公钥和私钥对,基于RSA算法生成对象
|
||||
KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA");
|
||||
// 初始化密钥对生成器
|
||||
keyPairGen.initialize(KEY_SIZE, new SecureRandom());
|
||||
// 生成一个密钥对,保存在keyPair中
|
||||
KeyPair keyPair = keyPairGen.generateKeyPair();
|
||||
// 得到私钥
|
||||
RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
|
||||
// 得到公钥
|
||||
RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
|
||||
String publicKeyString = Base64.getEncoder().encodeToString(publicKey.getEncoded());
|
||||
// 得到私钥字符串
|
||||
String privateKeyString = Base64.getEncoder().encodeToString(privateKey.getEncoded());
|
||||
// 将公钥和私钥保存到Map
|
||||
//0表示公钥
|
||||
keyMap.put(0, publicKeyString);
|
||||
//1表示私钥
|
||||
keyMap.put(1, privateKeyString);
|
||||
|
||||
return keyMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* RSA公钥加密
|
||||
*
|
||||
* @param str 加密字符串
|
||||
* @param publicKey 公钥
|
||||
* @return 密文
|
||||
* @throws Exception 加密过程中的异常信息
|
||||
*/
|
||||
public static String encrypt(String str, String publicKey) throws Exception {
|
||||
//base64编码的公钥
|
||||
byte[] decoded = Base64.getDecoder().decode(publicKey);
|
||||
RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
|
||||
//RSA加密
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, pubKey);
|
||||
String outStr = Base64.getEncoder().encodeToString(cipher.doFinal(str.getBytes("UTF-8")));
|
||||
return outStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* RSA私钥解密
|
||||
*
|
||||
* @param str 加密字符串
|
||||
* @param privateKey 私钥
|
||||
* @return 明文
|
||||
* @throws Exception 解密过程中的异常信息
|
||||
*/
|
||||
public static String decrypt(String str, String privateKey) throws Exception {
|
||||
//64位解码加密后的字符串
|
||||
byte[] inputByte = Base64.getDecoder().decode(str);
|
||||
//base64编码的私钥
|
||||
byte[] decoded = Base64.getDecoder().decode(privateKey);
|
||||
RSAPrivateKey priKey = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(decoded));
|
||||
//RSA解密
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.DECRYPT_MODE, priKey);
|
||||
String outStr = new String(cipher.doFinal(inputByte));
|
||||
return outStr;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
long temp = System.currentTimeMillis();
|
||||
//生成公钥和私钥
|
||||
genKeyPair();
|
||||
//加密字符串
|
||||
System.out.println("公钥:" + keyMap.get(0));
|
||||
System.out.println("私钥:" + keyMap.get(1));
|
||||
System.out.println("生成密钥消耗时间:" + (System.currentTimeMillis() - temp) / 1000.0 + "秒");
|
||||
//客户id + 授权时间 + 所用模块
|
||||
String message = "4028138151b3cf300151b419df090007" + "2015-12-17 11:30:22" + "A01,A02";
|
||||
System.out.println("原文:" + message);
|
||||
temp = System.currentTimeMillis();
|
||||
//通过原文,和公钥加密。
|
||||
String messageEn = encrypt(message, keyMap.get(0));
|
||||
System.out.println("密文:" + messageEn);
|
||||
System.out.println("加密消耗时间:" + (System.currentTimeMillis() - temp) / 1000.0 + "秒");
|
||||
temp = System.currentTimeMillis();
|
||||
//通过密文,和私钥解密。
|
||||
String messageDe = decrypt(messageEn, keyMap.get(1));
|
||||
System.out.println("解密:" + messageDe);
|
||||
System.out.println("解密消耗时间:" + (System.currentTimeMillis() - temp) / 1000.0 + "秒");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.chaozhanggui.merchant.util;
|
||||
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author Exrickx
|
||||
*/
|
||||
@Slf4j
|
||||
public class SnowFlakeUtil {
|
||||
|
||||
/**
|
||||
* 派号器workid:0~31
|
||||
* 机房datacenterid:0~31
|
||||
*/
|
||||
private static Snowflake snowflake = IdUtil.createSnowflake(1, 1);
|
||||
|
||||
public static Long nextId() {
|
||||
return snowflake.nextId();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue