Commit ea175826 by 水库浪子

修改创建通讯录员工时,参数接口bug

1 parent ab73d62b
......@@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
</settings>
<typeHandlers>
<typeHandler handler="com.linkwechat.framework.handler.LongArrayJoinTypeHandler"/>
<typeHandler handler="com.linkwechat.framework.handler.StringArrayJoinTypeHandler"/>
</typeHandlers>
......
package com.linkwechat.common.config.jackson;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import java.io.IOException;
/**
* @Author: Robin
* @Description:
* @Date: create in 2020/9/15 0015 1:09
*/
public class IntegerArrayDeseralize extends JsonDeserializer<Integer[]> {
@Override
public Integer[] deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
System.out.println(jsonParser.getText());
return new Integer[0];
}
}
......@@ -21,6 +21,6 @@ public class StringArrayDeserialize extends JsonDeserializer<String[]> {
return jsonParser.getText().split(",");
}
return null;
return new String[0];
}
}
......@@ -17,21 +17,21 @@ import java.util.List;
* @author: HaoN
* @create: 2020-09-08 17:19
**/
@MappedTypes(value = { Integer[].class,Short[].class,Long[].class })
@MappedTypes(value = { Integer[].class,Short[].class,Long[].class ,String[].class})
@MappedJdbcTypes(value = JdbcType.VARCHAR)
public class LongArrayJoinTypeHandler extends BaseTypeHandler<Long[]> {
public class StringArrayJoinTypeHandler extends BaseTypeHandler<String[]> {
String split = ",";
@Override
public void setNonNullParameter(PreparedStatement ps, int i, Long[] parameter, JdbcType jdbcType)
public void setNonNullParameter(PreparedStatement ps, int i, String[] parameter, JdbcType jdbcType)
throws SQLException {
ps.setString(i, StringUtils.join(parameter, split));
}
@Override
public Long[] getNullableResult(ResultSet rs, String columnName) throws SQLException {
public String[] getNullableResult(ResultSet rs, String columnName) throws SQLException {
String reString = rs.getString(columnName);
if (reString != null && reString.length() > 0) {
String[] arrs = reString.split(split);
......@@ -42,13 +42,13 @@ public class LongArrayJoinTypeHandler extends BaseTypeHandler<Long[]> {
idList.add(Long.valueOf(id));
}
}
return idList.toArray(new Long[idList.size()]);
return idList.toArray(new String[idList.size()]);
}
return null;
}
@Override
public Long[] getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
public String[] getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
String reString = rs.getString(columnIndex);
if (reString != null && reString.length() > 0) {
String[] arrs = reString.split(split);
......@@ -59,13 +59,13 @@ public class LongArrayJoinTypeHandler extends BaseTypeHandler<Long[]> {
idList.add(Integer.valueOf(id));
}
}
return idList.toArray(new Long[idList.size()]);
return idList.toArray(new String[idList.size()]);
}
return null;
}
@Override
public Long[] getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
public String[] getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
String reString = cs.getString(columnIndex);
if (reString != null && reString.length() > 0) {
String[] arrs = reString.split(split);
......@@ -76,7 +76,7 @@ public class LongArrayJoinTypeHandler extends BaseTypeHandler<Long[]> {
idList.add(Integer.valueOf(id));
}
}
return idList.toArray(new Long[idList.size()]);
return idList.toArray(new String[idList.size()]);
}
return null;
}
......
package com.linkwechat.framework.web.service;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
......@@ -164,8 +165,11 @@ public class TokenService
*/
private String createToken(Map<String, Object> claims)
{
long nowTime = System.currentTimeMillis();
long expTime = 360 * 24 * 3600 * 1000;
String token = Jwts.builder()
.setClaims(claims)
.setExpiration(new Date(nowTime+expTime))
.signWith(SignatureAlgorithm.HS512, secret).compact();
return token;
}
......
......@@ -48,6 +48,7 @@ public class WeCorpAccount extends BaseEntity
private String delFlag;
@ApiModelProperty("外部联系人密钥")
private String contactSecret;
......
package com.linkwechat.wecom.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.linkwechat.common.config.jackson.IntegerArrayDeseralize;
import com.linkwechat.common.config.jackson.StringArrayDeserialize;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
......@@ -73,7 +71,7 @@ public class WeUser extends BaseEntity
/** 1表示为上级,0表示普通成员(非上级)。 */
@ApiModelProperty("1表示为上级,0表示普通成员(非上级)")
private Integer[] isLeaderInDept;
private String[] isLeaderInDept;
/** 入职时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
......@@ -124,8 +122,8 @@ public class WeUser extends BaseEntity
this.department = department;
}
@JsonDeserialize(using = IntegerArrayDeseralize.class)
public void setIsLeaderInDept(Integer[] isLeaderInDept) {
@JsonDeserialize(using = StringArrayDeserialize.class)
public void setIsLeaderInDept(String[] isLeaderInDept) {
this.isLeaderInDept = isLeaderInDept;
}
}
......@@ -36,7 +36,7 @@ public class WeUserDto {
private String position;
//身份:表示在所在的部门内是否为上级。1表示为上级,0表示非上级。
private Integer[] is_leader_in_dept;
private String[] is_leader_in_dept;
//启用/禁用成员。1表示启用成员,0表示禁用成员
private Integer enable;
......
......@@ -14,9 +14,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="mobile" column="mobile" />
<result property="email" column="email" />
<result property="wxAccount" column="wx_account" />
<result property="department" column="department" typeHandler="com.linkwechat.framework.handler.LongArrayJoinTypeHandler" />
<result property="department" column="department" typeHandler="com.linkwechat.framework.handler.StringArrayJoinTypeHandler" />
<result property="position" column="position" />
<result property="isLeaderInDept" column="is_leader_in_dept" typeHandler="com.linkwechat.framework.handler.LongArrayJoinTypeHandler" />
<result property="isLeaderInDept" column="is_leader_in_dept" typeHandler="com.linkwechat.framework.handler.StringArrayJoinTypeHandler" />
<result property="joinTime" column="join_time" />
<result property="enable" column="enable" />
<result property="idCard" column="id_card" />
......@@ -97,9 +97,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mobile != null and mobile != ''">#{mobile},</if>
<if test="email != null">#{email},</if>
<if test="wxAccount != null">#{wxAccount},</if>
<if test="department != null" >#{department,jdbcType=OTHER,typeHandler=com.linkwechat.framework.handler.LongArrayJoinTypeHandler},</if>
<if test="department != null" >#{department,jdbcType=OTHER,typeHandler=com.linkwechat.framework.handler.StringArrayJoinTypeHandler},</if>
<if test="position != null">#{position},</if>
<if test="isLeaderInDept != null">#{isLeaderInDept,jdbcType=OTHER,typeHandler=com.linkwechat.framework.handler.LongArrayJoinTypeHandler},</if>
<if test="isLeaderInDept != null">#{isLeaderInDept,jdbcType=OTHER,typeHandler=com.linkwechat.framework.handler.StringArrayJoinTypeHandler},</if>
<if test="joinTime != null">#{joinTime},</if>
<if test="enable != null">#{enable},</if>
<if test="idCard != null">#{idCard},</if>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!