初始化艾志OA仓库
commit
dfcb8f95f7
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="GB2312"?>
|
||||
|
||||
<config name="CBS字段映射配置">
|
||||
|
||||
<table name="境内账户明细" key="uf_jnzhmx" modeId="10">
|
||||
<field name="交易流水号" key="jylsh" ebsKey="transactionSerialNumber" unique="true"/>
|
||||
<field name="收款日期" key="skrq" ebsKey="bankTransactionDate"/>
|
||||
<field name="汇款人" key="hkr" ebsKey="unitName"/>
|
||||
<field name="对应客户" key="dykh" ebsKey="unitName"/>
|
||||
<field name="金额" key="je" ebsKey="incurredAmount"/>
|
||||
</table>
|
||||
|
||||
<table name="票据收款明细" key="uf_pjskmx" modeId="11">
|
||||
<field name="收款日期" key="skrq" ebsKey="acceptorDate"/>
|
||||
<field name="汇款人" key="hkr" ebsKey="drawerName"/>
|
||||
<field name="对应客户" key="dykh" ebsKey="drawerName"/>
|
||||
<field name="金额" key="je" ebsKey="billAmount"/>
|
||||
<field name="票据编号" key="pjbh" ebsKey="billNbr" unique="true"/>
|
||||
<field name="出票日期" key="cprq" ebsKey="issueDate"/>
|
||||
<field name="到期日期" key="dqrq" ebsKey="dueDate"/>
|
||||
<field name="承兑银行" key="cdyx" ebsKey="acceptorName"/>
|
||||
</table>
|
||||
|
||||
|
||||
<table name="票据池" key="uf_pjc" modeId="13">
|
||||
<field name="收到日期/开具日期" key="sdrqkjrq" ebsKey="acceptorDate"/>
|
||||
<field name="回款人/收款人" key="hkrskr" ebsKey="drawerName"/>
|
||||
<field name="票面金额" key="pmje" ebsKey="billAmount"/>
|
||||
<field name="票据编号" key="pjbh" ebsKey="billNbr" unique="true"/>
|
||||
<field name="出票日期" key="cprq" ebsKey="issueDate"/>
|
||||
<field name="到期日期" key="dqrq" ebsKey="dueDate"/>
|
||||
<field name="承兑银行/付款银行" key="cdyhfkyh" ebsKey="acceptorName/"/>
|
||||
</table>
|
||||
|
||||
|
||||
</config>
|
@ -0,0 +1,12 @@
|
||||
# ??ID
|
||||
app_id=Yg8fWSvs
|
||||
# ????
|
||||
app_secret=1f23768c02219d7864b0009c30a1b6a59fe84606
|
||||
# ????
|
||||
bodyEncryptionKey=0467E11F7CA86D884C990D4F3F5C2A1EFEEBB02B9878F4FDDCB7899DFABADCC8F38FC23F007A8AF9B2EB8A1D313959647CD8A1542F0414116AE6CFCA792346A802
|
||||
# ????????
|
||||
signEncryptionPrivateKey=135d6d61d5e820a979e58f4939abbd528c82528c8c276852445854377e1df247
|
||||
# ????????
|
||||
bodyDecryptionKey=135d6d61d5e820a979e58f4939abbd528c82528c8c276852445854377e1df247
|
||||
# ????
|
||||
host=https://cbs8-openapi-reprd.csuat.cmburl.cn
|
@ -0,0 +1,15 @@
|
||||
package com.engine.salary.exception;
|
||||
|
||||
public class CBS8RunTimeException extends RuntimeException {
|
||||
public CBS8RunTimeException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public CBS8RunTimeException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public CBS8RunTimeException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.engine.salary.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* SQLMapper
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public interface SQLMapper {
|
||||
List<Map> runSQL(@Param("sql") String sql);
|
||||
|
||||
List<Long> listLong(@Param("sql") String sql);
|
||||
|
||||
List<String> listString(@Param("sql") String sql);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?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.engine.salary.mapper.SQLMapper">
|
||||
<select id="runSQL" resultType="java.util.Map">
|
||||
${sql}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="listLong" resultType="long">
|
||||
${sql}
|
||||
</select>
|
||||
|
||||
<select id="listString" resultType="string">
|
||||
${sql}
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,322 @@
|
||||
<?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.engine.salary.mapper.cbs.UfHkrdzbMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.salary.remote.cbs8.po.UfHkrdzbPO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="requestId" property="requestId"/>
|
||||
<result column="formmodeid" property="formmodeid"/>
|
||||
<result column="modedatacreater" property="modedatacreater"/>
|
||||
<result column="modedatacreatertype" property="modedatacreatertype"/>
|
||||
<result column="modedatacreatedate" property="modedatacreatedate"/>
|
||||
<result column="modedatacreatetime" property="modedatacreatetime"/>
|
||||
<result column="MODEUUID" property="modeuuid"/>
|
||||
<result column="form_biz_id" property="formBizId"/>
|
||||
<result column="gsbm" property="gsbm"/>
|
||||
<result column="khbm" property="khbm"/>
|
||||
<result column="khmc" property="khmc"/>
|
||||
<result column="bmbm" property="bmbm"/>
|
||||
<result column="bmd" property="bmd"/>
|
||||
<result column="bm" property="bm"/>
|
||||
<result column="modedatamodifier" property="modedatamodifier"/>
|
||||
<result column="modedatamodifydatetime" property="modedatamodifydatetime"/>
|
||||
<result column="departmentId" property="departmentId"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t
|
||||
.
|
||||
id
|
||||
, t.requestId
|
||||
, t.formmodeid
|
||||
, t.modedatacreater
|
||||
, t.modedatacreatertype
|
||||
, t.modedatacreatedate
|
||||
, t.modedatacreatetime
|
||||
, t.MODEUUID
|
||||
, t.form_biz_id
|
||||
, t.gsbm
|
||||
, t.khbm
|
||||
, t.khmc
|
||||
, t.bmbm
|
||||
, t.bmd
|
||||
, t.bm
|
||||
, t.modedatamodifier
|
||||
, t.modedatamodifydatetime
|
||||
</sql>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="listAll" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
,d.id as departmentId
|
||||
FROM uf_hkrdzb t
|
||||
left join hrmdepartment d on t.bmbm = d.departmentcode
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 根据主键获取单条记录 -->
|
||||
<select id="getById" resultMap="BaseResultMap" parameterType="Integer">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM uf_hkrdzb t
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 条件查询 -->
|
||||
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.remote.cbs8.po.UfHkrdzbPO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM uf_hkrdzb t
|
||||
WHERE 1=1
|
||||
<if test="requestId != null">
|
||||
AND requestId = #{requestId}
|
||||
</if>
|
||||
<if test="formmodeid != null">
|
||||
AND formmodeid = #{formmodeid}
|
||||
</if>
|
||||
<if test="modedatacreater != null">
|
||||
AND modedatacreater = #{modedatacreater}
|
||||
</if>
|
||||
<if test="modedatacreatertype != null">
|
||||
AND modedatacreatertype = #{modedatacreatertype}
|
||||
</if>
|
||||
<if test="modedatacreatedate != null">
|
||||
AND modedatacreatedate = #{modedatacreatedate}
|
||||
</if>
|
||||
<if test="modedatacreatetime != null">
|
||||
AND modedatacreatetime = #{modedatacreatetime}
|
||||
</if>
|
||||
<if test="modeuuid != null">
|
||||
AND MODEUUID = #{modeuuid}
|
||||
</if>
|
||||
<if test="formBizId != null">
|
||||
AND form_biz_id = #{formBizId}
|
||||
</if>
|
||||
<if test="gsbm != null">
|
||||
AND gsbm = #{gsbm}
|
||||
</if>
|
||||
<if test="khbm != null">
|
||||
AND khbm = #{khbm}
|
||||
</if>
|
||||
<if test="khmc != null">
|
||||
AND khmc = #{khmc}
|
||||
</if>
|
||||
<if test="bmbm != null">
|
||||
AND bmbm = #{bmbm}
|
||||
</if>
|
||||
<if test="bmd != null">
|
||||
AND bmd = #{bmd}
|
||||
</if>
|
||||
<if test="bm != null">
|
||||
AND bm = #{bm}
|
||||
</if>
|
||||
<if test="modedatamodifier != null">
|
||||
AND modedatamodifier = #{modedatamodifier}
|
||||
</if>
|
||||
<if test="modedatamodifydatetime != null">
|
||||
AND modedatamodifydatetime = #{modedatamodifydatetime}
|
||||
</if>
|
||||
<if test="ids != null and ids.size()>0">
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 插入不为NULL的字段 -->
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.salary.remote.cbs8.po.UfHkrdzbPO">
|
||||
INSERT INTO uf_hkrdzb
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
<if test="requestId != null">
|
||||
requestId,
|
||||
</if>
|
||||
<if test="formmodeid != null">
|
||||
formmodeid,
|
||||
</if>
|
||||
<if test="modedatacreater != null">
|
||||
modedatacreater,
|
||||
</if>
|
||||
<if test="modedatacreatertype != null">
|
||||
modedatacreatertype,
|
||||
</if>
|
||||
<if test="modedatacreatedate != null">
|
||||
modedatacreatedate,
|
||||
</if>
|
||||
<if test="modedatacreatetime != null">
|
||||
modedatacreatetime,
|
||||
</if>
|
||||
<if test="modeuuid != null">
|
||||
MODEUUID,
|
||||
</if>
|
||||
<if test="formBizId != null">
|
||||
form_biz_id,
|
||||
</if>
|
||||
<if test="gsbm != null">
|
||||
gsbm,
|
||||
</if>
|
||||
<if test="khbm != null">
|
||||
khbm,
|
||||
</if>
|
||||
<if test="khmc != null">
|
||||
khmc,
|
||||
</if>
|
||||
<if test="bmbm != null">
|
||||
bmbm,
|
||||
</if>
|
||||
<if test="bmd != null">
|
||||
bmd,
|
||||
</if>
|
||||
<if test="bm != null">
|
||||
bm,
|
||||
</if>
|
||||
<if test="modedatamodifier != null">
|
||||
modedatamodifier,
|
||||
</if>
|
||||
<if test="modedatamodifydatetime != null">
|
||||
modedatamodifydatetime,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="requestId != null">
|
||||
#{requestId},
|
||||
</if>
|
||||
<if test="formmodeid != null">
|
||||
#{formmodeid},
|
||||
</if>
|
||||
<if test="modedatacreater != null">
|
||||
#{modedatacreater},
|
||||
</if>
|
||||
<if test="modedatacreatertype != null">
|
||||
#{modedatacreatertype},
|
||||
</if>
|
||||
<if test="modedatacreatedate != null">
|
||||
#{modedatacreatedate},
|
||||
</if>
|
||||
<if test="modedatacreatetime != null">
|
||||
#{modedatacreatetime},
|
||||
</if>
|
||||
<if test="modeuuid != null">
|
||||
#{modeuuid},
|
||||
</if>
|
||||
<if test="formBizId != null">
|
||||
#{formBizId},
|
||||
</if>
|
||||
<if test="gsbm != null">
|
||||
#{gsbm},
|
||||
</if>
|
||||
<if test="khbm != null">
|
||||
#{khbm},
|
||||
</if>
|
||||
<if test="khmc != null">
|
||||
#{khmc},
|
||||
</if>
|
||||
<if test="bmbm != null">
|
||||
#{bmbm},
|
||||
</if>
|
||||
<if test="bmd != null">
|
||||
#{bmd},
|
||||
</if>
|
||||
<if test="bm != null">
|
||||
#{bm},
|
||||
</if>
|
||||
<if test="modedatamodifier != null">
|
||||
#{modedatamodifier},
|
||||
</if>
|
||||
<if test="modedatamodifydatetime != null">
|
||||
#{modedatamodifydatetime},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
<!-- 更新,更新全部字段 -->
|
||||
<update id="update" parameterType="com.engine.salary.remote.cbs8.po.UfHkrdzbPO">
|
||||
UPDATE uf_hkrdzb
|
||||
<set>
|
||||
requestId=#{requestId},
|
||||
formmodeid=#{formmodeid},
|
||||
modedatacreater=#{modedatacreater},
|
||||
modedatacreatertype=#{modedatacreatertype},
|
||||
modedatacreatedate=#{modedatacreatedate},
|
||||
modedatacreatetime=#{modedatacreatetime},
|
||||
MODEUUID=#{modeuuid},
|
||||
form_biz_id=#{formBizId},
|
||||
gsbm=#{gsbm},
|
||||
khbm=#{khbm},
|
||||
khmc=#{khmc},
|
||||
bmbm=#{bmbm},
|
||||
bmd=#{bmd},
|
||||
bm=#{bm},
|
||||
modedatamodifier=#{modedatamodifier},
|
||||
modedatamodifydatetime=#{modedatamodifydatetime},
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 更新不为NULL的字段 -->
|
||||
<update id="updateIgnoreNull" parameterType="com.engine.salary.remote.cbs8.po.UfHkrdzbPO">
|
||||
UPDATE uf_hkrdzb
|
||||
<set>
|
||||
<if test="requestId != null">
|
||||
requestId=#{requestId},
|
||||
</if>
|
||||
<if test="formmodeid != null">
|
||||
formmodeid=#{formmodeid},
|
||||
</if>
|
||||
<if test="modedatacreater != null">
|
||||
modedatacreater=#{modedatacreater},
|
||||
</if>
|
||||
<if test="modedatacreatertype != null">
|
||||
modedatacreatertype=#{modedatacreatertype},
|
||||
</if>
|
||||
<if test="modedatacreatedate != null">
|
||||
modedatacreatedate=#{modedatacreatedate},
|
||||
</if>
|
||||
<if test="modedatacreatetime != null">
|
||||
modedatacreatetime=#{modedatacreatetime},
|
||||
</if>
|
||||
<if test="modeuuid != null">
|
||||
MODEUUID=#{modeuuid},
|
||||
</if>
|
||||
<if test="formBizId != null">
|
||||
form_biz_id=#{formBizId},
|
||||
</if>
|
||||
<if test="gsbm != null">
|
||||
gsbm=#{gsbm},
|
||||
</if>
|
||||
<if test="khbm != null">
|
||||
khbm=#{khbm},
|
||||
</if>
|
||||
<if test="khmc != null">
|
||||
khmc=#{khmc},
|
||||
</if>
|
||||
<if test="bmbm != null">
|
||||
bmbm=#{bmbm},
|
||||
</if>
|
||||
<if test="bmd != null">
|
||||
bmd=#{bmd},
|
||||
</if>
|
||||
<if test="bm != null">
|
||||
bm=#{bm},
|
||||
</if>
|
||||
<if test="modedatamodifier != null">
|
||||
modedatamodifier=#{modedatamodifier},
|
||||
</if>
|
||||
<if test="modedatamodifydatetime != null">
|
||||
modedatamodifydatetime=#{modedatamodifydatetime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
@ -0,0 +1,97 @@
|
||||
package com.engine.salary.remote.cbs8;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.parser.Feature;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.alibaba.fastjson.util.TypeUtils;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class JsonUtil {
|
||||
private static final SerializerFeature[] DEFAULT_S_FEATURES;
|
||||
private static final SerializerFeature[] PRETTY_S_FEATURES;
|
||||
private static final Feature[] DEFAULT_P_FEATURES;
|
||||
|
||||
public JsonUtil() {
|
||||
}
|
||||
|
||||
public static String toJsonString(Object obj) {
|
||||
return JSON.toJSONString(obj, DEFAULT_S_FEATURES);
|
||||
}
|
||||
|
||||
public static String toJsonString(Object obj, SerializerFeature... features) {
|
||||
return JSON.toJSONString(obj, features);
|
||||
}
|
||||
|
||||
public static String toPrettyJson(Object object) {
|
||||
return JSON.toJSONString(object, PRETTY_S_FEATURES);
|
||||
}
|
||||
|
||||
public static JSONObject parseJsonObject(String jsonStr) {
|
||||
return JSON.parseObject(jsonStr, DEFAULT_P_FEATURES);
|
||||
}
|
||||
|
||||
public static <T> T parseValue(JSONObject jsonObject, String key, Class<T> clazz) {
|
||||
if (jsonObject != null) {
|
||||
T value = jsonObject.getObject(key, (Type) clazz);
|
||||
return value;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T parseObject(String jsonStr, Class<T> clazz) {
|
||||
return JSON.parseObject(jsonStr, (Type) clazz, DEFAULT_P_FEATURES);
|
||||
}
|
||||
|
||||
public static <T> List<T> parseList(String jsonStr, Class<T> clazz) {
|
||||
return JSON.parseArray(jsonStr, clazz);
|
||||
}
|
||||
|
||||
public static <T> List<T> parseList(Object jsonObject, Class<T> clazz) {
|
||||
String jsonStr = toJsonString(jsonObject);
|
||||
return parseList(jsonStr, clazz);
|
||||
}
|
||||
|
||||
public static <V> Map<String, V> parseMap(String jsonStr, Class<V> valueCls) {
|
||||
Map<String, V> result = new LinkedHashMap();
|
||||
Map<String, Object> map = JSON.parseObject(jsonStr, DEFAULT_P_FEATURES);
|
||||
if (map != null && map.size() > 0) {
|
||||
Iterator var4 = map.entrySet().iterator();
|
||||
|
||||
while (var4.hasNext()) {
|
||||
Entry<String, Object> entry = (Entry) var4.next();
|
||||
Object obj = entry.getValue();
|
||||
V value = JSON.parseObject(JSON.toJSONString(obj), valueCls);
|
||||
result.put(entry.getKey(), value);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static <V> Map<String, V> parseMap(Object jsonObject, Class<V> valueCls) {
|
||||
String jsonStr = toJsonString(jsonObject);
|
||||
return parseMap(jsonStr, valueCls);
|
||||
}
|
||||
|
||||
public static <T> T parseBean(String jsonString, Class<T> beanClazz) {
|
||||
return parseBean(parseJsonObject(jsonString), beanClazz);
|
||||
}
|
||||
|
||||
public static <T> T parseBean(JSONObject jsonObject, Class<T> beanClazz) {
|
||||
return TypeUtils.castToJavaBean(jsonObject, beanClazz);
|
||||
}
|
||||
|
||||
static {
|
||||
DEFAULT_S_FEATURES = new SerializerFeature[]{SerializerFeature.WriteDateUseDateFormat, SerializerFeature.SortField};
|
||||
PRETTY_S_FEATURES = new SerializerFeature[]{SerializerFeature.WriteDateUseDateFormat, SerializerFeature.SortField, SerializerFeature.PrettyFormat};
|
||||
DEFAULT_P_FEATURES = new Feature[]{Feature.OrderedField};
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.engine.salary.remote.cbs8.common;
|
||||
|
||||
/**
|
||||
* @author: KeXue
|
||||
* @time: 2022/8/25
|
||||
* @description: 常量类
|
||||
*/
|
||||
public interface Constants {
|
||||
|
||||
String TARGET_CONTENT_TYPE = "application/json";
|
||||
|
||||
String SIGN_HEADER_NAME = "X-MBCLOUD-API-SIGN";
|
||||
|
||||
String TIMESTAMP_HEADER = "X-MBCLOUD-TIMESTAMP";
|
||||
|
||||
String ENCRYPTION_ENABLED_HEADER_NAME = "X-MBCLOUD-ENCRYPTION-ENABLED";
|
||||
|
||||
String X_MBCLOUD_COMPRESS = "X-Mbcloud-Compress";
|
||||
|
||||
String AUTHORIZATION = "Authorization";
|
||||
|
||||
String BEARER = "Bearer ";
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.engine.salary.remote.cbs8.config;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
import com.thoughtworks.xstream.annotations.XStreamImplicit;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@XStreamAlias("config")
|
||||
public class EBS2ECConfig {
|
||||
@XStreamAlias("name")
|
||||
@XStreamAsAttribute
|
||||
private String name;
|
||||
|
||||
@XStreamImplicit(itemFieldName = "table")
|
||||
private List<Table> tables;
|
||||
|
||||
@Data
|
||||
public static class Table {
|
||||
@XStreamAlias("name")
|
||||
@XStreamAsAttribute
|
||||
private String name;
|
||||
|
||||
@XStreamAlias("key")
|
||||
@XStreamAsAttribute
|
||||
private String key;
|
||||
|
||||
@XStreamAlias("modeId")
|
||||
@XStreamAsAttribute
|
||||
private Integer modeId;
|
||||
|
||||
@XStreamImplicit(itemFieldName = "field")
|
||||
private List<Field> fields;
|
||||
|
||||
@Data
|
||||
public static class Field {
|
||||
@XStreamAlias("name")
|
||||
@XStreamAsAttribute
|
||||
private String name;
|
||||
|
||||
@XStreamAlias("key")
|
||||
@XStreamAsAttribute
|
||||
private String key;
|
||||
|
||||
@XStreamAlias("ebsKey")
|
||||
@XStreamAsAttribute
|
||||
private String ebsKey;
|
||||
|
||||
@XStreamAlias("unique")
|
||||
@XStreamAsAttribute
|
||||
private boolean unique;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.engine.salary.remote.cbs8.po;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UfHkrdzbPO {
|
||||
private Integer id;
|
||||
|
||||
private Integer requestId;
|
||||
|
||||
private Integer formmodeid;
|
||||
|
||||
private Integer modedatacreater;
|
||||
|
||||
private Integer modedatacreatertype;
|
||||
|
||||
private String modedatacreatedate;
|
||||
|
||||
private String modedatacreatetime;
|
||||
|
||||
private String modeuuid;
|
||||
|
||||
private String formBizId;
|
||||
|
||||
private String gsbm;
|
||||
|
||||
private String khbm;
|
||||
|
||||
private String khmc;
|
||||
|
||||
private String bmbm;
|
||||
|
||||
private Integer bmd;
|
||||
|
||||
private Integer bm;
|
||||
|
||||
private Integer modedatamodifier;
|
||||
|
||||
private String modedatamodifydatetime;
|
||||
|
||||
|
||||
private Collection<Long> ids;
|
||||
|
||||
private Integer departmentId;
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.engine.salary.remote.cbs8.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class CBS8BaseRequest {
|
||||
private int currentPage;
|
||||
private int pageSize;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.engine.salary.remote.cbs8.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class CBS8BaseResponse {
|
||||
private String code;
|
||||
private String msg;
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package com.engine.salary.remote.cbs8.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class CBS8PageInfo {
|
||||
/**
|
||||
* 当前页
|
||||
*/
|
||||
private int pageNum;
|
||||
/**
|
||||
* 每页的数量
|
||||
*/
|
||||
private int pageSize;
|
||||
/**
|
||||
* 当前页的数量
|
||||
*/
|
||||
private int size;
|
||||
/**
|
||||
* 总页数
|
||||
*/
|
||||
private int pages;
|
||||
/**
|
||||
* 上一页
|
||||
*/
|
||||
private int prePage;
|
||||
/**
|
||||
* 下一页
|
||||
*/
|
||||
private int nextPage;
|
||||
/**
|
||||
* 总记录数
|
||||
*/
|
||||
private long total;
|
||||
/**
|
||||
* 当前页面第一个元素在数据库中的行号
|
||||
*/
|
||||
private int startRow;
|
||||
/**
|
||||
* 当前页面最后一个元素在数据库中的行号
|
||||
*/
|
||||
private int endRow;
|
||||
/**
|
||||
* 是否为第一页
|
||||
*/
|
||||
private boolean isFirstPage;
|
||||
/**
|
||||
* 是否为最后一页
|
||||
*/
|
||||
private boolean isLastPage;
|
||||
/**
|
||||
* 是否有前一页
|
||||
*/
|
||||
private boolean hasPreviousPage;
|
||||
/**
|
||||
* 是否有下一页
|
||||
*/
|
||||
private boolean hasNextPage;
|
||||
/**
|
||||
* 导航页码数
|
||||
*/
|
||||
private int navigatePages;
|
||||
/**
|
||||
* 所有导航页号
|
||||
*/
|
||||
private int[] navigatepageNums;
|
||||
/**
|
||||
* 导航条上的第一页
|
||||
*/
|
||||
private int navigateFirstPage;
|
||||
/**
|
||||
* 导航条上的最后一页
|
||||
*/
|
||||
private int navigateLastPage;
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.engine.salary.remote.cbs8.response;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GetTokenResponse extends CBS8BaseResponse {
|
||||
/**
|
||||
* 返回数据
|
||||
*/
|
||||
private Body data;
|
||||
|
||||
@Data
|
||||
public static class Body {
|
||||
private Integer expires;
|
||||
private String token;
|
||||
private String token_type;
|
||||
}
|
||||
}
|
@ -0,0 +1,215 @@
|
||||
package com.engine.salary.remote.cbs8.util;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.bouncycastle.asn1.*;
|
||||
import org.bouncycastle.crypto.engines.SM2Engine;
|
||||
import org.bouncycastle.crypto.params.*;
|
||||
import org.bouncycastle.crypto.signers.SM2Signer;
|
||||
import org.bouncycastle.jce.ECNamedCurveTable;
|
||||
import org.bouncycastle.jce.spec.ECParameterSpec;
|
||||
import org.bouncycastle.math.ec.ECCurve;
|
||||
import org.bouncycastle.math.ec.ECPoint;
|
||||
import org.bouncycastle.util.encoders.Hex;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
* @author: KeXue
|
||||
* @time: 2022/8/25
|
||||
* @description: SM2加解密工具类
|
||||
*/
|
||||
@Slf4j
|
||||
public class SM2Util {
|
||||
|
||||
private SM2Util() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
private static final String STD_NAME = "sm2p256v1";
|
||||
|
||||
/**
|
||||
* SM2加密算法
|
||||
*
|
||||
* @param publicKey 公钥
|
||||
* @param data 明文数据
|
||||
* @return
|
||||
*/
|
||||
public static byte[] encrypt(String publicKey, byte[] data) {
|
||||
ECPublicKeyParameters ecPublicKeyParameters = encodePublicKey(Hex.decode(publicKey));
|
||||
SM2Engine engine = new SM2Engine();
|
||||
engine.init(true, new ParametersWithRandom(ecPublicKeyParameters, new SecureRandom()));
|
||||
|
||||
byte[] bytes = null;
|
||||
try {
|
||||
byte[] cipherText = engine.processBlock(data, 0, data.length);
|
||||
bytes = C1C2C3ToC1C3C2(cipherText);
|
||||
} catch (Exception e) {
|
||||
log.warn("SM2加密时出现异常:" + e.getMessage());
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* SM2解密算法
|
||||
*
|
||||
* @param privateKey 私钥
|
||||
* @param cipherData 密文数据
|
||||
* @return
|
||||
*/
|
||||
public static byte[] decrypt(String privateKey, byte[] cipherData) {
|
||||
ECPrivateKeyParameters ecPrivateKeyParameters = encodePrivateKey(Hex.decode(privateKey));
|
||||
SM2Engine engine = new SM2Engine();
|
||||
engine.init(false, ecPrivateKeyParameters);
|
||||
|
||||
byte[] bytes = null;
|
||||
try {
|
||||
cipherData = C1C3C2ToC1C2C3(cipherData);
|
||||
bytes = engine.processBlock(cipherData, 0, cipherData.length);
|
||||
} catch (Exception e) {
|
||||
log.warn("SM2解密时出现异常:" + e.getMessage());
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 签名算法
|
||||
*
|
||||
* @param privateKey 私钥
|
||||
* @param data 明文数据
|
||||
* @return
|
||||
*/
|
||||
public static byte[] sign(String privateKey, byte[] data) {
|
||||
ECPrivateKeyParameters ecPrivateKeyParameters = encodePrivateKey(hexToByte(privateKey));
|
||||
SM2Signer signer = new SM2Signer();
|
||||
ParametersWithID parameters = new ParametersWithID(ecPrivateKeyParameters, "1234567812345678".getBytes());
|
||||
signer.init(true, parameters);
|
||||
signer.update(data, 0, data.length);
|
||||
|
||||
byte[] signature = null;
|
||||
try {
|
||||
signature = decodeDERSignature(signer.generateSignature());
|
||||
} catch (Exception e) {
|
||||
log.warn("SM2签名时出现异常:" + e.getMessage());
|
||||
}
|
||||
return signature;
|
||||
}
|
||||
|
||||
private static byte[] hexToByte(String hex)
|
||||
throws IllegalArgumentException {
|
||||
if (hex.length() % 2 != 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
char[] arr = hex.toCharArray();
|
||||
byte[] b = new byte[hex.length() / 2];
|
||||
for (int i = 0, j = 0, l = hex.length(); i < l; i++, j++) {
|
||||
String swap = "" + arr[i++] + arr[i];
|
||||
int byteInt = Integer.parseInt(swap, 16) & 0xFF;
|
||||
b[j] = BigInteger.valueOf(byteInt).byteValue();
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
private static byte[] C1C2C3ToC1C3C2(byte[] cipherText) throws Exception {
|
||||
if (cipherText != null && cipherText.length >= 97) {
|
||||
byte[] bytes = new byte[cipherText.length];
|
||||
System.arraycopy(cipherText, 0, bytes, 0, 65);
|
||||
System.arraycopy(cipherText, cipherText.length - 32, bytes, 65, 32);
|
||||
System.arraycopy(cipherText, 65, bytes, 97, cipherText.length - 97);
|
||||
return bytes;
|
||||
} else {
|
||||
throw new Exception("SM2 cipher text error, must be more than 96 bytes and in the format C1||C3||C2.");
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] C1C3C2ToC1C2C3(byte[] cipherText) throws Exception {
|
||||
if (cipherText != null && cipherText.length >= 97) {
|
||||
byte[] bytes = new byte[cipherText.length];
|
||||
System.arraycopy(cipherText, 0, bytes, 0, 65);
|
||||
System.arraycopy(cipherText, 97, bytes, 65, cipherText.length - 97);
|
||||
System.arraycopy(cipherText, 65, bytes, cipherText.length - 32, 32);
|
||||
return bytes;
|
||||
} else {
|
||||
throw new Exception("SM2 cipher text error, must be more than 96 bytes and in the format C1||C3||C2.");
|
||||
}
|
||||
}
|
||||
|
||||
private static ECPublicKeyParameters encodePublicKey(byte[] value) {
|
||||
byte[] x = new byte[32];
|
||||
byte[] y = new byte[32];
|
||||
System.arraycopy(value, 1, x, 0, 32);
|
||||
System.arraycopy(value, 33, y, 0, 32);
|
||||
BigInteger X = new BigInteger(1, x);
|
||||
BigInteger Y = new BigInteger(1, y);
|
||||
ECPoint Q = getSM2Curve().createPoint(X, Y);
|
||||
return new ECPublicKeyParameters(Q, getECDomainParameters());
|
||||
}
|
||||
|
||||
private static ECCurve getSM2Curve() {
|
||||
ECParameterSpec spec = ECNamedCurveTable.getParameterSpec(STD_NAME);
|
||||
return spec.getCurve();
|
||||
}
|
||||
|
||||
private static ECPrivateKeyParameters encodePrivateKey(byte[] value) {
|
||||
BigInteger d = new BigInteger(1, value);
|
||||
return new ECPrivateKeyParameters(d, getECDomainParameters());
|
||||
}
|
||||
|
||||
private static ECDomainParameters getECDomainParameters() {
|
||||
ECParameterSpec spec = ECNamedCurveTable.getParameterSpec(STD_NAME);
|
||||
return new ECDomainParameters(spec.getCurve(), spec.getG(), spec.getN(), spec.getH(), spec.getSeed());
|
||||
}
|
||||
|
||||
private static byte[] decodeDERSignature(byte[] signature) {
|
||||
ASN1InputStream stream = new ASN1InputStream(new ByteArrayInputStream(signature));
|
||||
|
||||
byte[] bytes = new byte[64];
|
||||
try {
|
||||
ASN1Sequence primitive = (ASN1Sequence) stream.readObject();
|
||||
Enumeration enumeration = primitive.getObjects();
|
||||
BigInteger R = ((ASN1Integer) enumeration.nextElement()).getValue();
|
||||
BigInteger S = ((ASN1Integer) enumeration.nextElement()).getValue();
|
||||
byte[] r = format(R.toByteArray());
|
||||
byte[] s = format(S.toByteArray());
|
||||
System.arraycopy(r, 0, bytes, 0, 32);
|
||||
System.arraycopy(s, 0, bytes, 32, 32);
|
||||
} catch (Exception e) {
|
||||
log.warn("decodeDERSignature时出现异常:" + e.getMessage());
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static byte[] encodeDERSignature(byte[] signature) {
|
||||
byte[] r = new byte[32];
|
||||
byte[] s = new byte[32];
|
||||
System.arraycopy(signature, 0, r, 0, 32);
|
||||
System.arraycopy(signature, 32, s, 0, 32);
|
||||
ASN1EncodableVector vector = new ASN1EncodableVector();
|
||||
vector.add(new ASN1Integer(new BigInteger(1, r)));
|
||||
vector.add(new ASN1Integer(new BigInteger(1, s)));
|
||||
|
||||
byte[] encoded = null;
|
||||
try {
|
||||
encoded = (new DERSequence(vector)).getEncoded();
|
||||
} catch (Exception e) {
|
||||
log.warn("encodeDERSignature时出现异常:" + e.getMessage());
|
||||
}
|
||||
return encoded;
|
||||
}
|
||||
|
||||
private static byte[] format(byte[] value) {
|
||||
if (value.length == 32) {
|
||||
return value;
|
||||
} else {
|
||||
byte[] bytes = new byte[32];
|
||||
if (value.length > 32) {
|
||||
System.arraycopy(value, value.length - 32, bytes, 0, 32);
|
||||
} else {
|
||||
System.arraycopy(value, 0, bytes, 32 - value.length, value.length);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.engine.salary.remote.cbs8.util.db;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
public class IdGenerator {
|
||||
private static AtomicLong next = new AtomicLong(1L);
|
||||
public static final int ID_LENGTH_36 = 36;
|
||||
|
||||
public IdGenerator() {
|
||||
}
|
||||
|
||||
public static long generate() {
|
||||
return System.currentTimeMillis() + next.getAndIncrement();
|
||||
}
|
||||
|
||||
public static String generateId() {
|
||||
return System.currentTimeMillis() + String.valueOf(next.getAndIncrement());
|
||||
}
|
||||
|
||||
public static String generateStrId() {
|
||||
return System.currentTimeMillis() + generateStrId(36);
|
||||
}
|
||||
|
||||
public static String generateStrId(int idLength) {
|
||||
if (idLength >= 1 && idLength <= 36) {
|
||||
char[] srcChars = new char[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'g', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
|
||||
char[] chars = new char[idLength];
|
||||
|
||||
for(int i = 0; i < idLength; ++i) {
|
||||
if (i != 8 && i != 13 && i != 18 && i != 23) {
|
||||
if (i == 0) {
|
||||
chars[i] = srcChars[(int)(Math.random() * 26.0D) % 26];
|
||||
} else {
|
||||
chars[i] = srcChars[(int)(Math.random() * 36.0D) % 36];
|
||||
}
|
||||
} else {
|
||||
chars[i] = '_';
|
||||
}
|
||||
}
|
||||
|
||||
return new String(chars);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static String getUUID() {
|
||||
return UUID.randomUUID().toString().replaceAll("-", "");
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.engine.salary.remote.cbs8.util.db;
|
||||
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import weaver.conn.mybatis.MyBatisFactory;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
/**
|
||||
* mapper代理工厂
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public class MapperProxyFactory implements InvocationHandler {
|
||||
private Class clazz;
|
||||
private boolean enableTransactions = false;
|
||||
private SqlSession session;
|
||||
|
||||
public MapperProxyFactory(Class clazz) {
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Exception {
|
||||
this.session = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
Object target = session.getMapper(clazz);
|
||||
return method.invoke(target, args);
|
||||
} finally {
|
||||
if (!enableTransactions) {
|
||||
session.commit();
|
||||
session.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Object getProxy() {
|
||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
Class<?>[] interfaces = new Class<?>[1];
|
||||
interfaces[0] = this.clazz;
|
||||
return Proxy.newProxyInstance(loader, interfaces, this);
|
||||
}
|
||||
|
||||
public Object getProxy(boolean enableTransactions) {
|
||||
this.enableTransactions = enableTransactions;
|
||||
return this.getProxy();
|
||||
}
|
||||
|
||||
public void commit() {
|
||||
if (this.session != null) {
|
||||
this.session.commit();
|
||||
this.session.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void rollback() {
|
||||
if (this.session != null) {
|
||||
this.session.rollback();
|
||||
this.session.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T getProxy(Class<T> clazz) {
|
||||
MapperProxyFactory handle = new MapperProxyFactory(clazz);
|
||||
return (T) handle.getProxy();
|
||||
}
|
||||
|
||||
public static <T> T getProxy(Class<T> clazz, boolean enableTransactions) {
|
||||
MapperProxyFactory handle = new MapperProxyFactory(clazz);
|
||||
return (T) handle.getProxy(enableTransactions);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue