24 changed files with 5725 additions and 94 deletions
@ -0,0 +1,337 @@ |
|||||
|
package com.ccsens.health.bean.po; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
public class HealthAuth implements Serializable { |
||||
|
private Long id; |
||||
|
|
||||
|
private String accessToken; |
||||
|
|
||||
|
private Integer expiresIn; |
||||
|
|
||||
|
private String permanentCode; |
||||
|
|
||||
|
private String corpid; |
||||
|
|
||||
|
private String corpName; |
||||
|
|
||||
|
private String corpType; |
||||
|
|
||||
|
private String corpSquareLogoUrl; |
||||
|
|
||||
|
private Integer corpUserMax; |
||||
|
|
||||
|
private Long corpAgentMax; |
||||
|
|
||||
|
private String corpFullName; |
||||
|
|
||||
|
private Byte subjectType; |
||||
|
|
||||
|
private Long verifiedEndTime; |
||||
|
|
||||
|
private String corpWxqrcode; |
||||
|
|
||||
|
private String corpScale; |
||||
|
|
||||
|
private String corpIndustry; |
||||
|
|
||||
|
private String corpSubIndustry; |
||||
|
|
||||
|
private String location; |
||||
|
|
||||
|
private String authUserid; |
||||
|
|
||||
|
private String authName; |
||||
|
|
||||
|
private String authAvatar; |
||||
|
|
||||
|
private String dealerCorpInfoCorpid; |
||||
|
|
||||
|
private String dealerCorpInfoCorpName; |
||||
|
|
||||
|
private String registerCode; |
||||
|
|
||||
|
private String templateId; |
||||
|
|
||||
|
private String state; |
||||
|
|
||||
|
private Date createdAt; |
||||
|
|
||||
|
private Date updatedAt; |
||||
|
|
||||
|
private Byte recStatus; |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
public Long getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setId(Long id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public String getAccessToken() { |
||||
|
return accessToken; |
||||
|
} |
||||
|
|
||||
|
public void setAccessToken(String accessToken) { |
||||
|
this.accessToken = accessToken == null ? null : accessToken.trim(); |
||||
|
} |
||||
|
|
||||
|
public Integer getExpiresIn() { |
||||
|
return expiresIn; |
||||
|
} |
||||
|
|
||||
|
public void setExpiresIn(Integer expiresIn) { |
||||
|
this.expiresIn = expiresIn; |
||||
|
} |
||||
|
|
||||
|
public String getPermanentCode() { |
||||
|
return permanentCode; |
||||
|
} |
||||
|
|
||||
|
public void setPermanentCode(String permanentCode) { |
||||
|
this.permanentCode = permanentCode == null ? null : permanentCode.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getCorpid() { |
||||
|
return corpid; |
||||
|
} |
||||
|
|
||||
|
public void setCorpid(String corpid) { |
||||
|
this.corpid = corpid == null ? null : corpid.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getCorpName() { |
||||
|
return corpName; |
||||
|
} |
||||
|
|
||||
|
public void setCorpName(String corpName) { |
||||
|
this.corpName = corpName == null ? null : corpName.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getCorpType() { |
||||
|
return corpType; |
||||
|
} |
||||
|
|
||||
|
public void setCorpType(String corpType) { |
||||
|
this.corpType = corpType == null ? null : corpType.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getCorpSquareLogoUrl() { |
||||
|
return corpSquareLogoUrl; |
||||
|
} |
||||
|
|
||||
|
public void setCorpSquareLogoUrl(String corpSquareLogoUrl) { |
||||
|
this.corpSquareLogoUrl = corpSquareLogoUrl == null ? null : corpSquareLogoUrl.trim(); |
||||
|
} |
||||
|
|
||||
|
public Integer getCorpUserMax() { |
||||
|
return corpUserMax; |
||||
|
} |
||||
|
|
||||
|
public void setCorpUserMax(Integer corpUserMax) { |
||||
|
this.corpUserMax = corpUserMax; |
||||
|
} |
||||
|
|
||||
|
public Long getCorpAgentMax() { |
||||
|
return corpAgentMax; |
||||
|
} |
||||
|
|
||||
|
public void setCorpAgentMax(Long corpAgentMax) { |
||||
|
this.corpAgentMax = corpAgentMax; |
||||
|
} |
||||
|
|
||||
|
public String getCorpFullName() { |
||||
|
return corpFullName; |
||||
|
} |
||||
|
|
||||
|
public void setCorpFullName(String corpFullName) { |
||||
|
this.corpFullName = corpFullName == null ? null : corpFullName.trim(); |
||||
|
} |
||||
|
|
||||
|
public Byte getSubjectType() { |
||||
|
return subjectType; |
||||
|
} |
||||
|
|
||||
|
public void setSubjectType(Byte subjectType) { |
||||
|
this.subjectType = subjectType; |
||||
|
} |
||||
|
|
||||
|
public Long getVerifiedEndTime() { |
||||
|
return verifiedEndTime; |
||||
|
} |
||||
|
|
||||
|
public void setVerifiedEndTime(Long verifiedEndTime) { |
||||
|
this.verifiedEndTime = verifiedEndTime; |
||||
|
} |
||||
|
|
||||
|
public String getCorpWxqrcode() { |
||||
|
return corpWxqrcode; |
||||
|
} |
||||
|
|
||||
|
public void setCorpWxqrcode(String corpWxqrcode) { |
||||
|
this.corpWxqrcode = corpWxqrcode == null ? null : corpWxqrcode.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getCorpScale() { |
||||
|
return corpScale; |
||||
|
} |
||||
|
|
||||
|
public void setCorpScale(String corpScale) { |
||||
|
this.corpScale = corpScale == null ? null : corpScale.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getCorpIndustry() { |
||||
|
return corpIndustry; |
||||
|
} |
||||
|
|
||||
|
public void setCorpIndustry(String corpIndustry) { |
||||
|
this.corpIndustry = corpIndustry == null ? null : corpIndustry.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getCorpSubIndustry() { |
||||
|
return corpSubIndustry; |
||||
|
} |
||||
|
|
||||
|
public void setCorpSubIndustry(String corpSubIndustry) { |
||||
|
this.corpSubIndustry = corpSubIndustry == null ? null : corpSubIndustry.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getLocation() { |
||||
|
return location; |
||||
|
} |
||||
|
|
||||
|
public void setLocation(String location) { |
||||
|
this.location = location == null ? null : location.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getAuthUserid() { |
||||
|
return authUserid; |
||||
|
} |
||||
|
|
||||
|
public void setAuthUserid(String authUserid) { |
||||
|
this.authUserid = authUserid == null ? null : authUserid.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getAuthName() { |
||||
|
return authName; |
||||
|
} |
||||
|
|
||||
|
public void setAuthName(String authName) { |
||||
|
this.authName = authName == null ? null : authName.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getAuthAvatar() { |
||||
|
return authAvatar; |
||||
|
} |
||||
|
|
||||
|
public void setAuthAvatar(String authAvatar) { |
||||
|
this.authAvatar = authAvatar == null ? null : authAvatar.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getDealerCorpInfoCorpid() { |
||||
|
return dealerCorpInfoCorpid; |
||||
|
} |
||||
|
|
||||
|
public void setDealerCorpInfoCorpid(String dealerCorpInfoCorpid) { |
||||
|
this.dealerCorpInfoCorpid = dealerCorpInfoCorpid == null ? null : dealerCorpInfoCorpid.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getDealerCorpInfoCorpName() { |
||||
|
return dealerCorpInfoCorpName; |
||||
|
} |
||||
|
|
||||
|
public void setDealerCorpInfoCorpName(String dealerCorpInfoCorpName) { |
||||
|
this.dealerCorpInfoCorpName = dealerCorpInfoCorpName == null ? null : dealerCorpInfoCorpName.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getRegisterCode() { |
||||
|
return registerCode; |
||||
|
} |
||||
|
|
||||
|
public void setRegisterCode(String registerCode) { |
||||
|
this.registerCode = registerCode == null ? null : registerCode.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getTemplateId() { |
||||
|
return templateId; |
||||
|
} |
||||
|
|
||||
|
public void setTemplateId(String templateId) { |
||||
|
this.templateId = templateId == null ? null : templateId.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getState() { |
||||
|
return state; |
||||
|
} |
||||
|
|
||||
|
public void setState(String state) { |
||||
|
this.state = state == null ? null : state.trim(); |
||||
|
} |
||||
|
|
||||
|
public Date getCreatedAt() { |
||||
|
return createdAt; |
||||
|
} |
||||
|
|
||||
|
public void setCreatedAt(Date createdAt) { |
||||
|
this.createdAt = createdAt; |
||||
|
} |
||||
|
|
||||
|
public Date getUpdatedAt() { |
||||
|
return updatedAt; |
||||
|
} |
||||
|
|
||||
|
public void setUpdatedAt(Date updatedAt) { |
||||
|
this.updatedAt = updatedAt; |
||||
|
} |
||||
|
|
||||
|
public Byte getRecStatus() { |
||||
|
return recStatus; |
||||
|
} |
||||
|
|
||||
|
public void setRecStatus(Byte recStatus) { |
||||
|
this.recStatus = recStatus; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
StringBuilder sb = new StringBuilder(); |
||||
|
sb.append(getClass().getSimpleName()); |
||||
|
sb.append(" ["); |
||||
|
sb.append("Hash = ").append(hashCode()); |
||||
|
sb.append(", id=").append(id); |
||||
|
sb.append(", accessToken=").append(accessToken); |
||||
|
sb.append(", expiresIn=").append(expiresIn); |
||||
|
sb.append(", permanentCode=").append(permanentCode); |
||||
|
sb.append(", corpid=").append(corpid); |
||||
|
sb.append(", corpName=").append(corpName); |
||||
|
sb.append(", corpType=").append(corpType); |
||||
|
sb.append(", corpSquareLogoUrl=").append(corpSquareLogoUrl); |
||||
|
sb.append(", corpUserMax=").append(corpUserMax); |
||||
|
sb.append(", corpAgentMax=").append(corpAgentMax); |
||||
|
sb.append(", corpFullName=").append(corpFullName); |
||||
|
sb.append(", subjectType=").append(subjectType); |
||||
|
sb.append(", verifiedEndTime=").append(verifiedEndTime); |
||||
|
sb.append(", corpWxqrcode=").append(corpWxqrcode); |
||||
|
sb.append(", corpScale=").append(corpScale); |
||||
|
sb.append(", corpIndustry=").append(corpIndustry); |
||||
|
sb.append(", corpSubIndustry=").append(corpSubIndustry); |
||||
|
sb.append(", location=").append(location); |
||||
|
sb.append(", authUserid=").append(authUserid); |
||||
|
sb.append(", authName=").append(authName); |
||||
|
sb.append(", authAvatar=").append(authAvatar); |
||||
|
sb.append(", dealerCorpInfoCorpid=").append(dealerCorpInfoCorpid); |
||||
|
sb.append(", dealerCorpInfoCorpName=").append(dealerCorpInfoCorpName); |
||||
|
sb.append(", registerCode=").append(registerCode); |
||||
|
sb.append(", templateId=").append(templateId); |
||||
|
sb.append(", state=").append(state); |
||||
|
sb.append(", createdAt=").append(createdAt); |
||||
|
sb.append(", updatedAt=").append(updatedAt); |
||||
|
sb.append(", recStatus=").append(recStatus); |
||||
|
sb.append("]"); |
||||
|
return sb.toString(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,205 @@ |
|||||
|
package com.ccsens.health.bean.po; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
public class HealthAuthAgent implements Serializable { |
||||
|
private Long id; |
||||
|
|
||||
|
private Long authId; |
||||
|
|
||||
|
private Long agentid; |
||||
|
|
||||
|
private String name; |
||||
|
|
||||
|
private String squareLogoUrl; |
||||
|
|
||||
|
private String roundLogoUrl; |
||||
|
|
||||
|
private String privilege; |
||||
|
|
||||
|
private String allowParty; |
||||
|
|
||||
|
private String allowTag; |
||||
|
|
||||
|
private String allowUser; |
||||
|
|
||||
|
private String extraParty; |
||||
|
|
||||
|
private String extraUser; |
||||
|
|
||||
|
private String extraTag; |
||||
|
|
||||
|
private String level; |
||||
|
|
||||
|
private Date createdAt; |
||||
|
|
||||
|
private Date updatedAt; |
||||
|
|
||||
|
private Byte recStatus; |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
public Long getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setId(Long id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public Long getAuthId() { |
||||
|
return authId; |
||||
|
} |
||||
|
|
||||
|
public void setAuthId(Long authId) { |
||||
|
this.authId = authId; |
||||
|
} |
||||
|
|
||||
|
public Long getAgentid() { |
||||
|
return agentid; |
||||
|
} |
||||
|
|
||||
|
public void setAgentid(Long agentid) { |
||||
|
this.agentid = agentid; |
||||
|
} |
||||
|
|
||||
|
public String getName() { |
||||
|
return name; |
||||
|
} |
||||
|
|
||||
|
public void setName(String name) { |
||||
|
this.name = name == null ? null : name.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getSquareLogoUrl() { |
||||
|
return squareLogoUrl; |
||||
|
} |
||||
|
|
||||
|
public void setSquareLogoUrl(String squareLogoUrl) { |
||||
|
this.squareLogoUrl = squareLogoUrl == null ? null : squareLogoUrl.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getRoundLogoUrl() { |
||||
|
return roundLogoUrl; |
||||
|
} |
||||
|
|
||||
|
public void setRoundLogoUrl(String roundLogoUrl) { |
||||
|
this.roundLogoUrl = roundLogoUrl == null ? null : roundLogoUrl.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getPrivilege() { |
||||
|
return privilege; |
||||
|
} |
||||
|
|
||||
|
public void setPrivilege(String privilege) { |
||||
|
this.privilege = privilege == null ? null : privilege.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getAllowParty() { |
||||
|
return allowParty; |
||||
|
} |
||||
|
|
||||
|
public void setAllowParty(String allowParty) { |
||||
|
this.allowParty = allowParty == null ? null : allowParty.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getAllowTag() { |
||||
|
return allowTag; |
||||
|
} |
||||
|
|
||||
|
public void setAllowTag(String allowTag) { |
||||
|
this.allowTag = allowTag == null ? null : allowTag.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getAllowUser() { |
||||
|
return allowUser; |
||||
|
} |
||||
|
|
||||
|
public void setAllowUser(String allowUser) { |
||||
|
this.allowUser = allowUser == null ? null : allowUser.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getExtraParty() { |
||||
|
return extraParty; |
||||
|
} |
||||
|
|
||||
|
public void setExtraParty(String extraParty) { |
||||
|
this.extraParty = extraParty == null ? null : extraParty.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getExtraUser() { |
||||
|
return extraUser; |
||||
|
} |
||||
|
|
||||
|
public void setExtraUser(String extraUser) { |
||||
|
this.extraUser = extraUser == null ? null : extraUser.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getExtraTag() { |
||||
|
return extraTag; |
||||
|
} |
||||
|
|
||||
|
public void setExtraTag(String extraTag) { |
||||
|
this.extraTag = extraTag == null ? null : extraTag.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getLevel() { |
||||
|
return level; |
||||
|
} |
||||
|
|
||||
|
public void setLevel(String level) { |
||||
|
this.level = level == null ? null : level.trim(); |
||||
|
} |
||||
|
|
||||
|
public Date getCreatedAt() { |
||||
|
return createdAt; |
||||
|
} |
||||
|
|
||||
|
public void setCreatedAt(Date createdAt) { |
||||
|
this.createdAt = createdAt; |
||||
|
} |
||||
|
|
||||
|
public Date getUpdatedAt() { |
||||
|
return updatedAt; |
||||
|
} |
||||
|
|
||||
|
public void setUpdatedAt(Date updatedAt) { |
||||
|
this.updatedAt = updatedAt; |
||||
|
} |
||||
|
|
||||
|
public Byte getRecStatus() { |
||||
|
return recStatus; |
||||
|
} |
||||
|
|
||||
|
public void setRecStatus(Byte recStatus) { |
||||
|
this.recStatus = recStatus; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
StringBuilder sb = new StringBuilder(); |
||||
|
sb.append(getClass().getSimpleName()); |
||||
|
sb.append(" ["); |
||||
|
sb.append("Hash = ").append(hashCode()); |
||||
|
sb.append(", id=").append(id); |
||||
|
sb.append(", authId=").append(authId); |
||||
|
sb.append(", agentid=").append(agentid); |
||||
|
sb.append(", name=").append(name); |
||||
|
sb.append(", squareLogoUrl=").append(squareLogoUrl); |
||||
|
sb.append(", roundLogoUrl=").append(roundLogoUrl); |
||||
|
sb.append(", privilege=").append(privilege); |
||||
|
sb.append(", allowParty=").append(allowParty); |
||||
|
sb.append(", allowTag=").append(allowTag); |
||||
|
sb.append(", allowUser=").append(allowUser); |
||||
|
sb.append(", extraParty=").append(extraParty); |
||||
|
sb.append(", extraUser=").append(extraUser); |
||||
|
sb.append(", extraTag=").append(extraTag); |
||||
|
sb.append(", level=").append(level); |
||||
|
sb.append(", createdAt=").append(createdAt); |
||||
|
sb.append(", updatedAt=").append(updatedAt); |
||||
|
sb.append(", recStatus=").append(recStatus); |
||||
|
sb.append("]"); |
||||
|
return sb.toString(); |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,30 @@ |
|||||
|
package com.ccsens.health.persist.mapper; |
||||
|
|
||||
|
import com.ccsens.health.bean.po.HealthAuthAgent; |
||||
|
import com.ccsens.health.bean.po.HealthAuthAgentExample; |
||||
|
import java.util.List; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
public interface HealthAuthAgentMapper { |
||||
|
long countByExample(HealthAuthAgentExample example); |
||||
|
|
||||
|
int deleteByExample(HealthAuthAgentExample example); |
||||
|
|
||||
|
int deleteByPrimaryKey(Long id); |
||||
|
|
||||
|
int insert(HealthAuthAgent record); |
||||
|
|
||||
|
int insertSelective(HealthAuthAgent record); |
||||
|
|
||||
|
List<HealthAuthAgent> selectByExample(HealthAuthAgentExample example); |
||||
|
|
||||
|
HealthAuthAgent selectByPrimaryKey(Long id); |
||||
|
|
||||
|
int updateByExampleSelective(@Param("record") HealthAuthAgent record, @Param("example") HealthAuthAgentExample example); |
||||
|
|
||||
|
int updateByExample(@Param("record") HealthAuthAgent record, @Param("example") HealthAuthAgentExample example); |
||||
|
|
||||
|
int updateByPrimaryKeySelective(HealthAuthAgent record); |
||||
|
|
||||
|
int updateByPrimaryKey(HealthAuthAgent record); |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package com.ccsens.health.persist.mapper; |
||||
|
|
||||
|
import com.ccsens.health.bean.po.HealthAuth; |
||||
|
import com.ccsens.health.bean.po.HealthAuthExample; |
||||
|
import java.util.List; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
public interface HealthAuthMapper { |
||||
|
long countByExample(HealthAuthExample example); |
||||
|
|
||||
|
int deleteByExample(HealthAuthExample example); |
||||
|
|
||||
|
int deleteByPrimaryKey(Long id); |
||||
|
|
||||
|
int insert(HealthAuth record); |
||||
|
|
||||
|
int insertSelective(HealthAuth record); |
||||
|
|
||||
|
List<HealthAuth> selectByExample(HealthAuthExample example); |
||||
|
|
||||
|
HealthAuth selectByPrimaryKey(Long id); |
||||
|
|
||||
|
int updateByExampleSelective(@Param("record") HealthAuth record, @Param("example") HealthAuthExample example); |
||||
|
|
||||
|
int updateByExample(@Param("record") HealthAuth record, @Param("example") HealthAuthExample example); |
||||
|
|
||||
|
int updateByPrimaryKeySelective(HealthAuth record); |
||||
|
|
||||
|
int updateByPrimaryKey(HealthAuth record); |
||||
|
} |
@ -0,0 +1,60 @@ |
|||||
|
package com.ccsens.health.service; |
||||
|
|
||||
|
import cn.hutool.core.collection.CollectionUtil; |
||||
|
import cn.hutool.core.lang.Snowflake; |
||||
|
import cn.hutool.core.util.StrUtil; |
||||
|
import com.ccsens.health.bean.po.Constant; |
||||
|
import com.ccsens.health.bean.po.ConstantExample; |
||||
|
import com.ccsens.health.persist.mapper.ConstantMapper; |
||||
|
import com.ccsens.util.RedisUtil; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public class ConstantService implements IConstantService { |
||||
|
@Autowired |
||||
|
private Snowflake snowflake; |
||||
|
@Autowired |
||||
|
private ConstantMapper constantMapper; |
||||
|
@Autowired |
||||
|
private RedisUtil redisUtil; |
||||
|
private final String KEY_START = "constant_"; |
||||
|
|
||||
|
@Override |
||||
|
public void saveConstant(String key, String value) { |
||||
|
ConstantExample example = new ConstantExample(); |
||||
|
example.createCriteria().andTKeyEqualTo(key); |
||||
|
List<Constant> constants = constantMapper.selectByExample(example); |
||||
|
Constant constant = null; |
||||
|
if (CollectionUtil.isEmpty(constants)) { |
||||
|
constant = new Constant(); |
||||
|
constant.setId(snowflake.nextId()); |
||||
|
constant.settKey(key); |
||||
|
constant.settValue(value); |
||||
|
constantMapper.insertSelective(constant); |
||||
|
} else { |
||||
|
constant = constants.get(0); |
||||
|
constant.settValue(value); |
||||
|
constantMapper.updateByPrimaryKeySelective(constant); |
||||
|
} |
||||
|
redisUtil.set(KEY_START + key, value); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getByKey(String key) { |
||||
|
String value = (String)redisUtil.get(KEY_START + key); |
||||
|
if (StrUtil.isNotBlank(value)) { |
||||
|
return value; |
||||
|
} |
||||
|
ConstantExample example = new ConstantExample(); |
||||
|
example.createCriteria().andTKeyEqualTo(key); |
||||
|
List<Constant> constants = constantMapper.selectByExample(example); |
||||
|
if (CollectionUtil.isEmpty(constants)) { |
||||
|
return null; |
||||
|
} |
||||
|
value = constants.get(0).gettValue(); |
||||
|
redisUtil.set(KEY_START+key, value); |
||||
|
return value; |
||||
|
} |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package com.ccsens.health.service; |
||||
|
|
||||
|
public interface IConstantService { |
||||
|
|
||||
|
/** |
||||
|
* 保存常量 |
||||
|
* @param key |
||||
|
* @param value |
||||
|
*/ |
||||
|
void saveConstant(String key, String value); |
||||
|
|
||||
|
/** |
||||
|
* 获取常量 |
||||
|
* @param key |
||||
|
* @return |
||||
|
*/ |
||||
|
String getByKey(String key); |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package com.ccsens.health.service; |
||||
|
|
||||
|
/** |
||||
|
* 企业微信相关业务 |
||||
|
*/ |
||||
|
public interface IWeiXinService { |
||||
|
|
||||
|
/** |
||||
|
* 保存永久授权 |
||||
|
* @param authCode 微信返回永久授权字符串 |
||||
|
*/ |
||||
|
void savePermanentCode(String authCode); |
||||
|
|
||||
|
/** |
||||
|
* 获取第三方应用凭证 |
||||
|
* @param suiteId |
||||
|
* @param suiteTicket |
||||
|
*/ |
||||
|
void getSuiteToken(String suiteId, String suiteTicket); |
||||
|
|
||||
|
/** |
||||
|
* 获取第三方授权 |
||||
|
* @param suiteId |
||||
|
* @param corpId |
||||
|
* @param permanent_code |
||||
|
* @return |
||||
|
*/ |
||||
|
String getAccessToken(String suiteId, String corpId, String permanent_code); |
||||
|
|
||||
|
} |
@ -0,0 +1,204 @@ |
|||||
|
package com.ccsens.health.service; |
||||
|
|
||||
|
import cn.hutool.core.collection.CollectionUtil; |
||||
|
import cn.hutool.core.lang.Snowflake; |
||||
|
import cn.hutool.core.util.StrUtil; |
||||
|
import com.alibaba.fastjson.JSONArray; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.ccsens.health.bean.po.HealthAuth; |
||||
|
import com.ccsens.health.bean.po.HealthAuthAgent; |
||||
|
import com.ccsens.health.persist.mapper.HealthAuthAgentMapper; |
||||
|
import com.ccsens.health.persist.mapper.HealthAuthMapper; |
||||
|
import com.ccsens.util.RedisUtil; |
||||
|
import com.ccsens.util.RestTemplateUtil; |
||||
|
import com.ccsens.util.enterprisewx.WeiXinConstant; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.scheduling.annotation.Async; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Propagation; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
||||
|
public class WeiXinService implements IWeiXinService { |
||||
|
|
||||
|
@Autowired |
||||
|
private Snowflake snowflake; |
||||
|
@Resource |
||||
|
private HealthAuthMapper healthAuthMapper; |
||||
|
@Resource |
||||
|
private HealthAuthAgentMapper healthAuthAgentMapper; |
||||
|
@Autowired |
||||
|
private RedisUtil redisUtil; |
||||
|
|
||||
|
@Override |
||||
|
public String getAccessToken(String suiteId, String corpId, String permanent_code ) { |
||||
|
String key = WeiXinConstant.getAccessToken(suiteId, corpId); |
||||
|
String value = (String) redisUtil.get(key); |
||||
|
if (StrUtil.isNotBlank(value)) { |
||||
|
return value; |
||||
|
} |
||||
|
Map<String, String> param = new HashMap<>(); |
||||
|
param.put("auth_corpid",corpId); |
||||
|
param.put("permanent_code", permanent_code); |
||||
|
String resultStr = RestTemplateUtil.postBody(WeiXinConstant.GET_CORP_TOKEN, param); |
||||
|
log.info("获取企业凭证结果:{}", resultStr); |
||||
|
JSONObject result = JSONObject.parseObject(resultStr); |
||||
|
if (WeiXinConstant.pageResult(result)) { |
||||
|
//TODO 异常处理
|
||||
|
return null; |
||||
|
} |
||||
|
String accessToken = result.getString("access_token"); |
||||
|
redisUtil.set(key, accessToken, result.getInteger("expires_in")); |
||||
|
return accessToken; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void getSuiteToken(String suiteId, String suiteTicket) { |
||||
|
log.info("获取suiteToken, suiteId:{}, suiteTicket:{}", suiteId, suiteTicket); |
||||
|
String key = WeiXinConstant.getSuiteAccessToken(suiteId); |
||||
|
String suiteAccessToken = (String)redisUtil.get(key); |
||||
|
if (StrUtil.isNotBlank(suiteAccessToken)) { |
||||
|
long expire = redisUtil.getExpire(key); |
||||
|
log.info("suiteTicket有效时长:{}",expire); |
||||
|
//有效期大于20分钟
|
||||
|
int expireTime = 1200; |
||||
|
if (expire > expireTime) { |
||||
|
log.info("有效时长大于1200,无需更新"); |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
Map<String, String> param = new HashMap<>(); |
||||
|
param.put("suite_id", suiteId); |
||||
|
param.put("suite_secret", WeiXinConstant.suiteSecret); |
||||
|
param.put("suite_ticket", suiteTicket); |
||||
|
String resultStr = RestTemplateUtil.postBody(WeiXinConstant.GET_SUITE_TOKEN, param); |
||||
|
log.info("获取suite_ticket返回:{}", resultStr); |
||||
|
JSONObject result = JSONObject.parseObject(resultStr); |
||||
|
if (!WeiXinConstant.pageResult(result)) { |
||||
|
log.info("获取suite_ticket异常"); |
||||
|
// TODO
|
||||
|
return; |
||||
|
} |
||||
|
redisUtil.set(key, result.getString("suite_access_token"), result.getInteger("expires_in")); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void savePermanentCode(String authCode) { |
||||
|
//授权成功通知
|
||||
|
Map<String, String> params = new HashMap<>(); |
||||
|
params.put("auth_code", authCode); |
||||
|
String result = RestTemplateUtil.postBody(WeiXinConstant.GET_PERMANENT_CODE, params); |
||||
|
log.info("获取永久授权返回:{}", result); |
||||
|
JSONObject json = JSONObject.parseObject(result); |
||||
|
if (json.getInteger(WeiXinConstant.ERR_CODE).intValue() != 0) { |
||||
|
log.error("获取永久授权码异常:{}", result); |
||||
|
//TODO 异常如何处理
|
||||
|
return; |
||||
|
} |
||||
|
HealthAuth auth = initAuth(json); |
||||
|
HealthAuthAgent agent = initAuthAgent(json); |
||||
|
log.info("agent:{}", agent); |
||||
|
healthAuthMapper.insertSelective(auth); |
||||
|
if (agent != null) { |
||||
|
healthAuthAgentMapper.insertSelective(agent); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 初始化永久授权信息 |
||||
|
* @param json |
||||
|
* @return HealthAuth |
||||
|
*/ |
||||
|
private HealthAuth initAuth(JSONObject json) { |
||||
|
HealthAuth auth = new HealthAuth(); |
||||
|
auth.setId(snowflake.nextId()); |
||||
|
auth.setAccessToken(json.getString("access_token")); |
||||
|
auth.setExpiresIn(json.getInteger("expires_in")); |
||||
|
auth.setPermanentCode(json.getString("permanent_code")); |
||||
|
JSONObject dealerCorpInfo = json.getJSONObject("dealer_corp_info"); |
||||
|
if (dealerCorpInfo != null) { |
||||
|
auth.setDealerCorpInfoCorpid(dealerCorpInfo.getString("corpid")); |
||||
|
auth.setDealerCorpInfoCorpName(dealerCorpInfo.getString("corp_name")); |
||||
|
} |
||||
|
JSONObject authCorpInfo = json.getJSONObject("auth_corp_info"); |
||||
|
if (authCorpInfo != null) { |
||||
|
auth.setCorpid(authCorpInfo.getString("corpid")); |
||||
|
auth.setCorpName(authCorpInfo.getString("corp_name")); |
||||
|
auth.setCorpType(authCorpInfo.getString("corp_type")); |
||||
|
auth.setCorpSquareLogoUrl(authCorpInfo.getString("corp_square_logo_url")); |
||||
|
auth.setCorpUserMax(authCorpInfo.getInteger("corp_user_max")); |
||||
|
auth.setCorpAgentMax(authCorpInfo.getLong("corp_agent_max")); |
||||
|
auth.setCorpFullName(authCorpInfo.getString("corp_full_name")); |
||||
|
auth.setVerifiedEndTime(authCorpInfo.getLong("verified_end_time")); |
||||
|
auth.setSubjectType(authCorpInfo.getByte("subject_type")); |
||||
|
auth.setCorpWxqrcode(authCorpInfo.getString("corp_wxqrcode")); |
||||
|
auth.setCorpScale(authCorpInfo.getString("corp_scale")); |
||||
|
auth.setCorpIndustry(authCorpInfo.getString("corp_industry")); |
||||
|
auth.setCorpSubIndustry(authCorpInfo.getString("corp_sub_industry")); |
||||
|
auth.setLocation(authCorpInfo.getString("location")); |
||||
|
} |
||||
|
JSONObject authUserInfo = json.getJSONObject("auth_user_info"); |
||||
|
if (authUserInfo != null) { |
||||
|
auth.setAuthUserid(authUserInfo.getString("userid")); |
||||
|
auth.setAuthName(authUserInfo.getString("name")); |
||||
|
auth.setAuthAvatar(authUserInfo.getString("avatar")); |
||||
|
} |
||||
|
JSONObject registerCodeInfo = json.getJSONObject("register_code_info"); |
||||
|
if (registerCodeInfo != null) { |
||||
|
auth.setRegisterCode(registerCodeInfo.getString("register_code")); |
||||
|
auth.setTemplateId(registerCodeInfo.getString("template_id")); |
||||
|
auth.setState(registerCodeInfo.getString("state")); |
||||
|
} |
||||
|
log.info("auth:{}", auth); |
||||
|
return auth; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 初始化授权应用信息 |
||||
|
* @param json |
||||
|
* @return HealthAuthAgent |
||||
|
*/ |
||||
|
private HealthAuthAgent initAuthAgent(JSONObject json) { |
||||
|
|
||||
|
JSONObject authInfo = json.getJSONObject("auth_info"); |
||||
|
if (authInfo == null) { |
||||
|
return null; |
||||
|
} |
||||
|
JSONArray agentArray = authInfo.getJSONArray("agent"); |
||||
|
if (agentArray == null || agentArray.isEmpty()) { |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
JSONObject agentJson = (JSONObject) agentArray.get(0); |
||||
|
|
||||
|
HealthAuthAgent agent = new HealthAuthAgent(); |
||||
|
agent.setId(snowflake.nextId()); |
||||
|
agent.setAgentid(agentJson.getLong("agentid")); |
||||
|
agent.setName(agentJson.getString("name")); |
||||
|
agent.setRoundLogoUrl(agentJson.getString("round_logo_url")); |
||||
|
agent.setSquareLogoUrl(agentJson.getString("square_logo_url")); |
||||
|
JSONObject privilege = agentJson.getJSONObject("privilege"); |
||||
|
if (privilege != null) { |
||||
|
agent.setLevel(privilege.getString("level")); |
||||
|
agent.setAllowParty(privilege.getString("allow_party")); |
||||
|
agent.setAllowUser(privilege.getString("allow_user")); |
||||
|
agent.setAllowTag(privilege.getString("allow_tag")); |
||||
|
agent.setExtraParty(privilege.getString("extra_party")); |
||||
|
agent.setExtraUser(privilege.getString("extra_user")); |
||||
|
agent.setExtraTag(privilege.getString("extra_tag")); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
return agent; |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,401 @@ |
|||||
|
<?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.ccsens.health.persist.mapper.HealthAuthAgentMapper"> |
||||
|
<resultMap id="BaseResultMap" type="com.ccsens.health.bean.po.HealthAuthAgent"> |
||||
|
<id column="id" jdbcType="BIGINT" property="id" /> |
||||
|
<result column="auth_id" jdbcType="BIGINT" property="authId" /> |
||||
|
<result column="agentid" jdbcType="BIGINT" property="agentid" /> |
||||
|
<result column="name" jdbcType="VARCHAR" property="name" /> |
||||
|
<result column="square_logo_url" jdbcType="VARCHAR" property="squareLogoUrl" /> |
||||
|
<result column="round_logo_url" jdbcType="VARCHAR" property="roundLogoUrl" /> |
||||
|
<result column="privilege" jdbcType="VARCHAR" property="privilege" /> |
||||
|
<result column="allow_party" jdbcType="VARCHAR" property="allowParty" /> |
||||
|
<result column="allow_tag" jdbcType="VARCHAR" property="allowTag" /> |
||||
|
<result column="allow_user" jdbcType="VARCHAR" property="allowUser" /> |
||||
|
<result column="extra_party" jdbcType="VARCHAR" property="extraParty" /> |
||||
|
<result column="extra_user" jdbcType="VARCHAR" property="extraUser" /> |
||||
|
<result column="extra_tag" jdbcType="VARCHAR" property="extraTag" /> |
||||
|
<result column="level" jdbcType="VARCHAR" property="level" /> |
||||
|
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" /> |
||||
|
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" /> |
||||
|
<result column="rec_status" jdbcType="TINYINT" property="recStatus" /> |
||||
|
</resultMap> |
||||
|
<sql id="Example_Where_Clause"> |
||||
|
<where> |
||||
|
<foreach collection="oredCriteria" item="criteria" separator="or"> |
||||
|
<if test="criteria.valid"> |
||||
|
<trim prefix="(" prefixOverrides="and" suffix=")"> |
||||
|
<foreach collection="criteria.criteria" item="criterion"> |
||||
|
<choose> |
||||
|
<when test="criterion.noValue"> |
||||
|
and ${criterion.condition} |
||||
|
</when> |
||||
|
<when test="criterion.singleValue"> |
||||
|
and ${criterion.condition} #{criterion.value} |
||||
|
</when> |
||||
|
<when test="criterion.betweenValue"> |
||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
||||
|
</when> |
||||
|
<when test="criterion.listValue"> |
||||
|
and ${criterion.condition} |
||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
||||
|
#{listItem} |
||||
|
</foreach> |
||||
|
</when> |
||||
|
</choose> |
||||
|
</foreach> |
||||
|
</trim> |
||||
|
</if> |
||||
|
</foreach> |
||||
|
</where> |
||||
|
</sql> |
||||
|
<sql id="Update_By_Example_Where_Clause"> |
||||
|
<where> |
||||
|
<foreach collection="example.oredCriteria" item="criteria" separator="or"> |
||||
|
<if test="criteria.valid"> |
||||
|
<trim prefix="(" prefixOverrides="and" suffix=")"> |
||||
|
<foreach collection="criteria.criteria" item="criterion"> |
||||
|
<choose> |
||||
|
<when test="criterion.noValue"> |
||||
|
and ${criterion.condition} |
||||
|
</when> |
||||
|
<when test="criterion.singleValue"> |
||||
|
and ${criterion.condition} #{criterion.value} |
||||
|
</when> |
||||
|
<when test="criterion.betweenValue"> |
||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
||||
|
</when> |
||||
|
<when test="criterion.listValue"> |
||||
|
and ${criterion.condition} |
||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
||||
|
#{listItem} |
||||
|
</foreach> |
||||
|
</when> |
||||
|
</choose> |
||||
|
</foreach> |
||||
|
</trim> |
||||
|
</if> |
||||
|
</foreach> |
||||
|
</where> |
||||
|
</sql> |
||||
|
<sql id="Base_Column_List"> |
||||
|
id, auth_id, agentid, name, square_logo_url, round_logo_url, privilege, allow_party, |
||||
|
allow_tag, allow_user, extra_party, extra_user, extra_tag, level, created_at, updated_at, |
||||
|
rec_status |
||||
|
</sql> |
||||
|
<select id="selectByExample" parameterType="com.ccsens.health.bean.po.HealthAuthAgentExample" resultMap="BaseResultMap"> |
||||
|
select |
||||
|
<if test="distinct"> |
||||
|
distinct |
||||
|
</if> |
||||
|
<include refid="Base_Column_List" /> |
||||
|
from t_health_auth_agent |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
<if test="orderByClause != null"> |
||||
|
order by ${orderByClause} |
||||
|
</if> |
||||
|
</select> |
||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
||||
|
select |
||||
|
<include refid="Base_Column_List" /> |
||||
|
from t_health_auth_agent |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</select> |
||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
||||
|
delete from t_health_auth_agent |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</delete> |
||||
|
<delete id="deleteByExample" parameterType="com.ccsens.health.bean.po.HealthAuthAgentExample"> |
||||
|
delete from t_health_auth_agent |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</delete> |
||||
|
<insert id="insert" parameterType="com.ccsens.health.bean.po.HealthAuthAgent"> |
||||
|
insert into t_health_auth_agent (id, auth_id, agentid, |
||||
|
name, square_logo_url, round_logo_url, |
||||
|
privilege, allow_party, allow_tag, |
||||
|
allow_user, extra_party, extra_user, |
||||
|
extra_tag, level, created_at, |
||||
|
updated_at, rec_status) |
||||
|
values (#{id,jdbcType=BIGINT}, #{authId,jdbcType=BIGINT}, #{agentid,jdbcType=BIGINT}, |
||||
|
#{name,jdbcType=VARCHAR}, #{squareLogoUrl,jdbcType=VARCHAR}, #{roundLogoUrl,jdbcType=VARCHAR}, |
||||
|
#{privilege,jdbcType=VARCHAR}, #{allowParty,jdbcType=VARCHAR}, #{allowTag,jdbcType=VARCHAR}, |
||||
|
#{allowUser,jdbcType=VARCHAR}, #{extraParty,jdbcType=VARCHAR}, #{extraUser,jdbcType=VARCHAR}, |
||||
|
#{extraTag,jdbcType=VARCHAR}, #{level,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, |
||||
|
#{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}) |
||||
|
</insert> |
||||
|
<insert id="insertSelective" parameterType="com.ccsens.health.bean.po.HealthAuthAgent"> |
||||
|
insert into t_health_auth_agent |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="id != null"> |
||||
|
id, |
||||
|
</if> |
||||
|
<if test="authId != null"> |
||||
|
auth_id, |
||||
|
</if> |
||||
|
<if test="agentid != null"> |
||||
|
agentid, |
||||
|
</if> |
||||
|
<if test="name != null"> |
||||
|
name, |
||||
|
</if> |
||||
|
<if test="squareLogoUrl != null"> |
||||
|
square_logo_url, |
||||
|
</if> |
||||
|
<if test="roundLogoUrl != null"> |
||||
|
round_logo_url, |
||||
|
</if> |
||||
|
<if test="privilege != null"> |
||||
|
privilege, |
||||
|
</if> |
||||
|
<if test="allowParty != null"> |
||||
|
allow_party, |
||||
|
</if> |
||||
|
<if test="allowTag != null"> |
||||
|
allow_tag, |
||||
|
</if> |
||||
|
<if test="allowUser != null"> |
||||
|
allow_user, |
||||
|
</if> |
||||
|
<if test="extraParty != null"> |
||||
|
extra_party, |
||||
|
</if> |
||||
|
<if test="extraUser != null"> |
||||
|
extra_user, |
||||
|
</if> |
||||
|
<if test="extraTag != null"> |
||||
|
extra_tag, |
||||
|
</if> |
||||
|
<if test="level != null"> |
||||
|
level, |
||||
|
</if> |
||||
|
<if test="createdAt != null"> |
||||
|
created_at, |
||||
|
</if> |
||||
|
<if test="updatedAt != null"> |
||||
|
updated_at, |
||||
|
</if> |
||||
|
<if test="recStatus != null"> |
||||
|
rec_status, |
||||
|
</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="id != null"> |
||||
|
#{id,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="authId != null"> |
||||
|
#{authId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="agentid != null"> |
||||
|
#{agentid,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="name != null"> |
||||
|
#{name,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="squareLogoUrl != null"> |
||||
|
#{squareLogoUrl,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="roundLogoUrl != null"> |
||||
|
#{roundLogoUrl,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="privilege != null"> |
||||
|
#{privilege,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="allowParty != null"> |
||||
|
#{allowParty,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="allowTag != null"> |
||||
|
#{allowTag,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="allowUser != null"> |
||||
|
#{allowUser,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="extraParty != null"> |
||||
|
#{extraParty,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="extraUser != null"> |
||||
|
#{extraUser,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="extraTag != null"> |
||||
|
#{extraTag,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="level != null"> |
||||
|
#{level,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="createdAt != null"> |
||||
|
#{createdAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="updatedAt != null"> |
||||
|
#{updatedAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="recStatus != null"> |
||||
|
#{recStatus,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
<select id="countByExample" parameterType="com.ccsens.health.bean.po.HealthAuthAgentExample" resultType="java.lang.Long"> |
||||
|
select count(*) from t_health_auth_agent |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</select> |
||||
|
<update id="updateByExampleSelective" parameterType="map"> |
||||
|
update t_health_auth_agent |
||||
|
<set> |
||||
|
<if test="record.id != null"> |
||||
|
id = #{record.id,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.authId != null"> |
||||
|
auth_id = #{record.authId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.agentid != null"> |
||||
|
agentid = #{record.agentid,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.name != null"> |
||||
|
name = #{record.name,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.squareLogoUrl != null"> |
||||
|
square_logo_url = #{record.squareLogoUrl,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.roundLogoUrl != null"> |
||||
|
round_logo_url = #{record.roundLogoUrl,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.privilege != null"> |
||||
|
privilege = #{record.privilege,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.allowParty != null"> |
||||
|
allow_party = #{record.allowParty,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.allowTag != null"> |
||||
|
allow_tag = #{record.allowTag,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.allowUser != null"> |
||||
|
allow_user = #{record.allowUser,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.extraParty != null"> |
||||
|
extra_party = #{record.extraParty,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.extraUser != null"> |
||||
|
extra_user = #{record.extraUser,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.extraTag != null"> |
||||
|
extra_tag = #{record.extraTag,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.level != null"> |
||||
|
level = #{record.level,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.createdAt != null"> |
||||
|
created_at = #{record.createdAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="record.updatedAt != null"> |
||||
|
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="record.recStatus != null"> |
||||
|
rec_status = #{record.recStatus,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
</set> |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Update_By_Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</update> |
||||
|
<update id="updateByExample" parameterType="map"> |
||||
|
update t_health_auth_agent |
||||
|
set id = #{record.id,jdbcType=BIGINT}, |
||||
|
auth_id = #{record.authId,jdbcType=BIGINT}, |
||||
|
agentid = #{record.agentid,jdbcType=BIGINT}, |
||||
|
name = #{record.name,jdbcType=VARCHAR}, |
||||
|
square_logo_url = #{record.squareLogoUrl,jdbcType=VARCHAR}, |
||||
|
round_logo_url = #{record.roundLogoUrl,jdbcType=VARCHAR}, |
||||
|
privilege = #{record.privilege,jdbcType=VARCHAR}, |
||||
|
allow_party = #{record.allowParty,jdbcType=VARCHAR}, |
||||
|
allow_tag = #{record.allowTag,jdbcType=VARCHAR}, |
||||
|
allow_user = #{record.allowUser,jdbcType=VARCHAR}, |
||||
|
extra_party = #{record.extraParty,jdbcType=VARCHAR}, |
||||
|
extra_user = #{record.extraUser,jdbcType=VARCHAR}, |
||||
|
extra_tag = #{record.extraTag,jdbcType=VARCHAR}, |
||||
|
level = #{record.level,jdbcType=VARCHAR}, |
||||
|
created_at = #{record.createdAt,jdbcType=TIMESTAMP}, |
||||
|
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, |
||||
|
rec_status = #{record.recStatus,jdbcType=TINYINT} |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Update_By_Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</update> |
||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.health.bean.po.HealthAuthAgent"> |
||||
|
update t_health_auth_agent |
||||
|
<set> |
||||
|
<if test="authId != null"> |
||||
|
auth_id = #{authId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="agentid != null"> |
||||
|
agentid = #{agentid,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="name != null"> |
||||
|
name = #{name,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="squareLogoUrl != null"> |
||||
|
square_logo_url = #{squareLogoUrl,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="roundLogoUrl != null"> |
||||
|
round_logo_url = #{roundLogoUrl,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="privilege != null"> |
||||
|
privilege = #{privilege,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="allowParty != null"> |
||||
|
allow_party = #{allowParty,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="allowTag != null"> |
||||
|
allow_tag = #{allowTag,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="allowUser != null"> |
||||
|
allow_user = #{allowUser,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="extraParty != null"> |
||||
|
extra_party = #{extraParty,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="extraUser != null"> |
||||
|
extra_user = #{extraUser,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="extraTag != null"> |
||||
|
extra_tag = #{extraTag,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="level != null"> |
||||
|
level = #{level,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="createdAt != null"> |
||||
|
created_at = #{createdAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="updatedAt != null"> |
||||
|
updated_at = #{updatedAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="recStatus != null"> |
||||
|
rec_status = #{recStatus,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
</set> |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</update> |
||||
|
<update id="updateByPrimaryKey" parameterType="com.ccsens.health.bean.po.HealthAuthAgent"> |
||||
|
update t_health_auth_agent |
||||
|
set auth_id = #{authId,jdbcType=BIGINT}, |
||||
|
agentid = #{agentid,jdbcType=BIGINT}, |
||||
|
name = #{name,jdbcType=VARCHAR}, |
||||
|
square_logo_url = #{squareLogoUrl,jdbcType=VARCHAR}, |
||||
|
round_logo_url = #{roundLogoUrl,jdbcType=VARCHAR}, |
||||
|
privilege = #{privilege,jdbcType=VARCHAR}, |
||||
|
allow_party = #{allowParty,jdbcType=VARCHAR}, |
||||
|
allow_tag = #{allowTag,jdbcType=VARCHAR}, |
||||
|
allow_user = #{allowUser,jdbcType=VARCHAR}, |
||||
|
extra_party = #{extraParty,jdbcType=VARCHAR}, |
||||
|
extra_user = #{extraUser,jdbcType=VARCHAR}, |
||||
|
extra_tag = #{extraTag,jdbcType=VARCHAR}, |
||||
|
level = #{level,jdbcType=VARCHAR}, |
||||
|
created_at = #{createdAt,jdbcType=TIMESTAMP}, |
||||
|
updated_at = #{updatedAt,jdbcType=TIMESTAMP}, |
||||
|
rec_status = #{recStatus,jdbcType=TINYINT} |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</update> |
||||
|
</mapper> |
@ -0,0 +1,593 @@ |
|||||
|
<?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.ccsens.health.persist.mapper.HealthAuthMapper"> |
||||
|
<resultMap id="BaseResultMap" type="com.ccsens.health.bean.po.HealthAuth"> |
||||
|
<id column="id" jdbcType="BIGINT" property="id" /> |
||||
|
<result column="access_token" jdbcType="VARCHAR" property="accessToken" /> |
||||
|
<result column="expires_in" jdbcType="INTEGER" property="expiresIn" /> |
||||
|
<result column="permanent_code" jdbcType="VARCHAR" property="permanentCode" /> |
||||
|
<result column="corpid" jdbcType="VARCHAR" property="corpid" /> |
||||
|
<result column="corp_name" jdbcType="VARCHAR" property="corpName" /> |
||||
|
<result column="corp_type" jdbcType="VARCHAR" property="corpType" /> |
||||
|
<result column="corp_square_logo_url" jdbcType="VARCHAR" property="corpSquareLogoUrl" /> |
||||
|
<result column="corp_user_max" jdbcType="INTEGER" property="corpUserMax" /> |
||||
|
<result column="corp_agent_max" jdbcType="BIGINT" property="corpAgentMax" /> |
||||
|
<result column="corp_full_name" jdbcType="VARCHAR" property="corpFullName" /> |
||||
|
<result column="subject_type" jdbcType="TINYINT" property="subjectType" /> |
||||
|
<result column="verified_end_time" jdbcType="BIGINT" property="verifiedEndTime" /> |
||||
|
<result column="corp_wxqrcode" jdbcType="VARCHAR" property="corpWxqrcode" /> |
||||
|
<result column="corp_scale" jdbcType="VARCHAR" property="corpScale" /> |
||||
|
<result column="corp_industry" jdbcType="VARCHAR" property="corpIndustry" /> |
||||
|
<result column="corp_sub_industry" jdbcType="VARCHAR" property="corpSubIndustry" /> |
||||
|
<result column="location" jdbcType="VARCHAR" property="location" /> |
||||
|
<result column="auth_userid" jdbcType="VARCHAR" property="authUserid" /> |
||||
|
<result column="auth_name" jdbcType="VARCHAR" property="authName" /> |
||||
|
<result column="auth_avatar" jdbcType="VARCHAR" property="authAvatar" /> |
||||
|
<result column="dealer_corp_info_corpid" jdbcType="VARCHAR" property="dealerCorpInfoCorpid" /> |
||||
|
<result column="dealer_corp_info_corp_name" jdbcType="VARCHAR" property="dealerCorpInfoCorpName" /> |
||||
|
<result column="register_code" jdbcType="VARCHAR" property="registerCode" /> |
||||
|
<result column="template_id" jdbcType="VARCHAR" property="templateId" /> |
||||
|
<result column="state" jdbcType="VARCHAR" property="state" /> |
||||
|
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" /> |
||||
|
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" /> |
||||
|
<result column="rec_status" jdbcType="TINYINT" property="recStatus" /> |
||||
|
</resultMap> |
||||
|
<sql id="Example_Where_Clause"> |
||||
|
<where> |
||||
|
<foreach collection="oredCriteria" item="criteria" separator="or"> |
||||
|
<if test="criteria.valid"> |
||||
|
<trim prefix="(" prefixOverrides="and" suffix=")"> |
||||
|
<foreach collection="criteria.criteria" item="criterion"> |
||||
|
<choose> |
||||
|
<when test="criterion.noValue"> |
||||
|
and ${criterion.condition} |
||||
|
</when> |
||||
|
<when test="criterion.singleValue"> |
||||
|
and ${criterion.condition} #{criterion.value} |
||||
|
</when> |
||||
|
<when test="criterion.betweenValue"> |
||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
||||
|
</when> |
||||
|
<when test="criterion.listValue"> |
||||
|
and ${criterion.condition} |
||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
||||
|
#{listItem} |
||||
|
</foreach> |
||||
|
</when> |
||||
|
</choose> |
||||
|
</foreach> |
||||
|
</trim> |
||||
|
</if> |
||||
|
</foreach> |
||||
|
</where> |
||||
|
</sql> |
||||
|
<sql id="Update_By_Example_Where_Clause"> |
||||
|
<where> |
||||
|
<foreach collection="example.oredCriteria" item="criteria" separator="or"> |
||||
|
<if test="criteria.valid"> |
||||
|
<trim prefix="(" prefixOverrides="and" suffix=")"> |
||||
|
<foreach collection="criteria.criteria" item="criterion"> |
||||
|
<choose> |
||||
|
<when test="criterion.noValue"> |
||||
|
and ${criterion.condition} |
||||
|
</when> |
||||
|
<when test="criterion.singleValue"> |
||||
|
and ${criterion.condition} #{criterion.value} |
||||
|
</when> |
||||
|
<when test="criterion.betweenValue"> |
||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
||||
|
</when> |
||||
|
<when test="criterion.listValue"> |
||||
|
and ${criterion.condition} |
||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
||||
|
#{listItem} |
||||
|
</foreach> |
||||
|
</when> |
||||
|
</choose> |
||||
|
</foreach> |
||||
|
</trim> |
||||
|
</if> |
||||
|
</foreach> |
||||
|
</where> |
||||
|
</sql> |
||||
|
<sql id="Base_Column_List"> |
||||
|
id, access_token, expires_in, permanent_code, corpid, corp_name, corp_type, corp_square_logo_url, |
||||
|
corp_user_max, corp_agent_max, corp_full_name, subject_type, verified_end_time, corp_wxqrcode, |
||||
|
corp_scale, corp_industry, corp_sub_industry, location, auth_userid, auth_name, auth_avatar, |
||||
|
dealer_corp_info_corpid, dealer_corp_info_corp_name, register_code, template_id, |
||||
|
state, created_at, updated_at, rec_status |
||||
|
</sql> |
||||
|
<select id="selectByExample" parameterType="com.ccsens.health.bean.po.HealthAuthExample" resultMap="BaseResultMap"> |
||||
|
select |
||||
|
<if test="distinct"> |
||||
|
distinct |
||||
|
</if> |
||||
|
<include refid="Base_Column_List" /> |
||||
|
from t_health_auth |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
<if test="orderByClause != null"> |
||||
|
order by ${orderByClause} |
||||
|
</if> |
||||
|
</select> |
||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
||||
|
select |
||||
|
<include refid="Base_Column_List" /> |
||||
|
from t_health_auth |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</select> |
||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
||||
|
delete from t_health_auth |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</delete> |
||||
|
<delete id="deleteByExample" parameterType="com.ccsens.health.bean.po.HealthAuthExample"> |
||||
|
delete from t_health_auth |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</delete> |
||||
|
<insert id="insert" parameterType="com.ccsens.health.bean.po.HealthAuth"> |
||||
|
insert into t_health_auth (id, access_token, expires_in, |
||||
|
permanent_code, corpid, corp_name, |
||||
|
corp_type, corp_square_logo_url, corp_user_max, |
||||
|
corp_agent_max, corp_full_name, subject_type, |
||||
|
verified_end_time, corp_wxqrcode, corp_scale, |
||||
|
corp_industry, corp_sub_industry, location, |
||||
|
auth_userid, auth_name, auth_avatar, |
||||
|
dealer_corp_info_corpid, dealer_corp_info_corp_name, |
||||
|
register_code, template_id, state, |
||||
|
created_at, updated_at, rec_status |
||||
|
) |
||||
|
values (#{id,jdbcType=BIGINT}, #{accessToken,jdbcType=VARCHAR}, #{expiresIn,jdbcType=INTEGER}, |
||||
|
#{permanentCode,jdbcType=VARCHAR}, #{corpid,jdbcType=VARCHAR}, #{corpName,jdbcType=VARCHAR}, |
||||
|
#{corpType,jdbcType=VARCHAR}, #{corpSquareLogoUrl,jdbcType=VARCHAR}, #{corpUserMax,jdbcType=INTEGER}, |
||||
|
#{corpAgentMax,jdbcType=BIGINT}, #{corpFullName,jdbcType=VARCHAR}, #{subjectType,jdbcType=TINYINT}, |
||||
|
#{verifiedEndTime,jdbcType=BIGINT}, #{corpWxqrcode,jdbcType=VARCHAR}, #{corpScale,jdbcType=VARCHAR}, |
||||
|
#{corpIndustry,jdbcType=VARCHAR}, #{corpSubIndustry,jdbcType=VARCHAR}, #{location,jdbcType=VARCHAR}, |
||||
|
#{authUserid,jdbcType=VARCHAR}, #{authName,jdbcType=VARCHAR}, #{authAvatar,jdbcType=VARCHAR}, |
||||
|
#{dealerCorpInfoCorpid,jdbcType=VARCHAR}, #{dealerCorpInfoCorpName,jdbcType=VARCHAR}, |
||||
|
#{registerCode,jdbcType=VARCHAR}, #{templateId,jdbcType=VARCHAR}, #{state,jdbcType=VARCHAR}, |
||||
|
#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT} |
||||
|
) |
||||
|
</insert> |
||||
|
<insert id="insertSelective" parameterType="com.ccsens.health.bean.po.HealthAuth"> |
||||
|
insert into t_health_auth |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="id != null"> |
||||
|
id, |
||||
|
</if> |
||||
|
<if test="accessToken != null"> |
||||
|
access_token, |
||||
|
</if> |
||||
|
<if test="expiresIn != null"> |
||||
|
expires_in, |
||||
|
</if> |
||||
|
<if test="permanentCode != null"> |
||||
|
permanent_code, |
||||
|
</if> |
||||
|
<if test="corpid != null"> |
||||
|
corpid, |
||||
|
</if> |
||||
|
<if test="corpName != null"> |
||||
|
corp_name, |
||||
|
</if> |
||||
|
<if test="corpType != null"> |
||||
|
corp_type, |
||||
|
</if> |
||||
|
<if test="corpSquareLogoUrl != null"> |
||||
|
corp_square_logo_url, |
||||
|
</if> |
||||
|
<if test="corpUserMax != null"> |
||||
|
corp_user_max, |
||||
|
</if> |
||||
|
<if test="corpAgentMax != null"> |
||||
|
corp_agent_max, |
||||
|
</if> |
||||
|
<if test="corpFullName != null"> |
||||
|
corp_full_name, |
||||
|
</if> |
||||
|
<if test="subjectType != null"> |
||||
|
subject_type, |
||||
|
</if> |
||||
|
<if test="verifiedEndTime != null"> |
||||
|
verified_end_time, |
||||
|
</if> |
||||
|
<if test="corpWxqrcode != null"> |
||||
|
corp_wxqrcode, |
||||
|
</if> |
||||
|
<if test="corpScale != null"> |
||||
|
corp_scale, |
||||
|
</if> |
||||
|
<if test="corpIndustry != null"> |
||||
|
corp_industry, |
||||
|
</if> |
||||
|
<if test="corpSubIndustry != null"> |
||||
|
corp_sub_industry, |
||||
|
</if> |
||||
|
<if test="location != null"> |
||||
|
location, |
||||
|
</if> |
||||
|
<if test="authUserid != null"> |
||||
|
auth_userid, |
||||
|
</if> |
||||
|
<if test="authName != null"> |
||||
|
auth_name, |
||||
|
</if> |
||||
|
<if test="authAvatar != null"> |
||||
|
auth_avatar, |
||||
|
</if> |
||||
|
<if test="dealerCorpInfoCorpid != null"> |
||||
|
dealer_corp_info_corpid, |
||||
|
</if> |
||||
|
<if test="dealerCorpInfoCorpName != null"> |
||||
|
dealer_corp_info_corp_name, |
||||
|
</if> |
||||
|
<if test="registerCode != null"> |
||||
|
register_code, |
||||
|
</if> |
||||
|
<if test="templateId != null"> |
||||
|
template_id, |
||||
|
</if> |
||||
|
<if test="state != null"> |
||||
|
state, |
||||
|
</if> |
||||
|
<if test="createdAt != null"> |
||||
|
created_at, |
||||
|
</if> |
||||
|
<if test="updatedAt != null"> |
||||
|
updated_at, |
||||
|
</if> |
||||
|
<if test="recStatus != null"> |
||||
|
rec_status, |
||||
|
</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="id != null"> |
||||
|
#{id,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="accessToken != null"> |
||||
|
#{accessToken,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="expiresIn != null"> |
||||
|
#{expiresIn,jdbcType=INTEGER}, |
||||
|
</if> |
||||
|
<if test="permanentCode != null"> |
||||
|
#{permanentCode,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="corpid != null"> |
||||
|
#{corpid,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="corpName != null"> |
||||
|
#{corpName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="corpType != null"> |
||||
|
#{corpType,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="corpSquareLogoUrl != null"> |
||||
|
#{corpSquareLogoUrl,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="corpUserMax != null"> |
||||
|
#{corpUserMax,jdbcType=INTEGER}, |
||||
|
</if> |
||||
|
<if test="corpAgentMax != null"> |
||||
|
#{corpAgentMax,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="corpFullName != null"> |
||||
|
#{corpFullName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="subjectType != null"> |
||||
|
#{subjectType,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="verifiedEndTime != null"> |
||||
|
#{verifiedEndTime,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="corpWxqrcode != null"> |
||||
|
#{corpWxqrcode,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="corpScale != null"> |
||||
|
#{corpScale,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="corpIndustry != null"> |
||||
|
#{corpIndustry,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="corpSubIndustry != null"> |
||||
|
#{corpSubIndustry,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="location != null"> |
||||
|
#{location,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="authUserid != null"> |
||||
|
#{authUserid,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="authName != null"> |
||||
|
#{authName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="authAvatar != null"> |
||||
|
#{authAvatar,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="dealerCorpInfoCorpid != null"> |
||||
|
#{dealerCorpInfoCorpid,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="dealerCorpInfoCorpName != null"> |
||||
|
#{dealerCorpInfoCorpName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="registerCode != null"> |
||||
|
#{registerCode,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="templateId != null"> |
||||
|
#{templateId,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="state != null"> |
||||
|
#{state,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="createdAt != null"> |
||||
|
#{createdAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="updatedAt != null"> |
||||
|
#{updatedAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="recStatus != null"> |
||||
|
#{recStatus,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
<select id="countByExample" parameterType="com.ccsens.health.bean.po.HealthAuthExample" resultType="java.lang.Long"> |
||||
|
select count(*) from t_health_auth |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</select> |
||||
|
<update id="updateByExampleSelective" parameterType="map"> |
||||
|
update t_health_auth |
||||
|
<set> |
||||
|
<if test="record.id != null"> |
||||
|
id = #{record.id,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.accessToken != null"> |
||||
|
access_token = #{record.accessToken,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.expiresIn != null"> |
||||
|
expires_in = #{record.expiresIn,jdbcType=INTEGER}, |
||||
|
</if> |
||||
|
<if test="record.permanentCode != null"> |
||||
|
permanent_code = #{record.permanentCode,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.corpid != null"> |
||||
|
corpid = #{record.corpid,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.corpName != null"> |
||||
|
corp_name = #{record.corpName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.corpType != null"> |
||||
|
corp_type = #{record.corpType,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.corpSquareLogoUrl != null"> |
||||
|
corp_square_logo_url = #{record.corpSquareLogoUrl,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.corpUserMax != null"> |
||||
|
corp_user_max = #{record.corpUserMax,jdbcType=INTEGER}, |
||||
|
</if> |
||||
|
<if test="record.corpAgentMax != null"> |
||||
|
corp_agent_max = #{record.corpAgentMax,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.corpFullName != null"> |
||||
|
corp_full_name = #{record.corpFullName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.subjectType != null"> |
||||
|
subject_type = #{record.subjectType,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="record.verifiedEndTime != null"> |
||||
|
verified_end_time = #{record.verifiedEndTime,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.corpWxqrcode != null"> |
||||
|
corp_wxqrcode = #{record.corpWxqrcode,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.corpScale != null"> |
||||
|
corp_scale = #{record.corpScale,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.corpIndustry != null"> |
||||
|
corp_industry = #{record.corpIndustry,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.corpSubIndustry != null"> |
||||
|
corp_sub_industry = #{record.corpSubIndustry,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.location != null"> |
||||
|
location = #{record.location,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.authUserid != null"> |
||||
|
auth_userid = #{record.authUserid,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.authName != null"> |
||||
|
auth_name = #{record.authName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.authAvatar != null"> |
||||
|
auth_avatar = #{record.authAvatar,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.dealerCorpInfoCorpid != null"> |
||||
|
dealer_corp_info_corpid = #{record.dealerCorpInfoCorpid,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.dealerCorpInfoCorpName != null"> |
||||
|
dealer_corp_info_corp_name = #{record.dealerCorpInfoCorpName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.registerCode != null"> |
||||
|
register_code = #{record.registerCode,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.templateId != null"> |
||||
|
template_id = #{record.templateId,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.state != null"> |
||||
|
state = #{record.state,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.createdAt != null"> |
||||
|
created_at = #{record.createdAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="record.updatedAt != null"> |
||||
|
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="record.recStatus != null"> |
||||
|
rec_status = #{record.recStatus,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
</set> |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Update_By_Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</update> |
||||
|
<update id="updateByExample" parameterType="map"> |
||||
|
update t_health_auth |
||||
|
set id = #{record.id,jdbcType=BIGINT}, |
||||
|
access_token = #{record.accessToken,jdbcType=VARCHAR}, |
||||
|
expires_in = #{record.expiresIn,jdbcType=INTEGER}, |
||||
|
permanent_code = #{record.permanentCode,jdbcType=VARCHAR}, |
||||
|
corpid = #{record.corpid,jdbcType=VARCHAR}, |
||||
|
corp_name = #{record.corpName,jdbcType=VARCHAR}, |
||||
|
corp_type = #{record.corpType,jdbcType=VARCHAR}, |
||||
|
corp_square_logo_url = #{record.corpSquareLogoUrl,jdbcType=VARCHAR}, |
||||
|
corp_user_max = #{record.corpUserMax,jdbcType=INTEGER}, |
||||
|
corp_agent_max = #{record.corpAgentMax,jdbcType=BIGINT}, |
||||
|
corp_full_name = #{record.corpFullName,jdbcType=VARCHAR}, |
||||
|
subject_type = #{record.subjectType,jdbcType=TINYINT}, |
||||
|
verified_end_time = #{record.verifiedEndTime,jdbcType=BIGINT}, |
||||
|
corp_wxqrcode = #{record.corpWxqrcode,jdbcType=VARCHAR}, |
||||
|
corp_scale = #{record.corpScale,jdbcType=VARCHAR}, |
||||
|
corp_industry = #{record.corpIndustry,jdbcType=VARCHAR}, |
||||
|
corp_sub_industry = #{record.corpSubIndustry,jdbcType=VARCHAR}, |
||||
|
location = #{record.location,jdbcType=VARCHAR}, |
||||
|
auth_userid = #{record.authUserid,jdbcType=VARCHAR}, |
||||
|
auth_name = #{record.authName,jdbcType=VARCHAR}, |
||||
|
auth_avatar = #{record.authAvatar,jdbcType=VARCHAR}, |
||||
|
dealer_corp_info_corpid = #{record.dealerCorpInfoCorpid,jdbcType=VARCHAR}, |
||||
|
dealer_corp_info_corp_name = #{record.dealerCorpInfoCorpName,jdbcType=VARCHAR}, |
||||
|
register_code = #{record.registerCode,jdbcType=VARCHAR}, |
||||
|
template_id = #{record.templateId,jdbcType=VARCHAR}, |
||||
|
state = #{record.state,jdbcType=VARCHAR}, |
||||
|
created_at = #{record.createdAt,jdbcType=TIMESTAMP}, |
||||
|
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, |
||||
|
rec_status = #{record.recStatus,jdbcType=TINYINT} |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Update_By_Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</update> |
||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.health.bean.po.HealthAuth"> |
||||
|
update t_health_auth |
||||
|
<set> |
||||
|
<if test="accessToken != null"> |
||||
|
access_token = #{accessToken,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="expiresIn != null"> |
||||
|
expires_in = #{expiresIn,jdbcType=INTEGER}, |
||||
|
</if> |
||||
|
<if test="permanentCode != null"> |
||||
|
permanent_code = #{permanentCode,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="corpid != null"> |
||||
|
corpid = #{corpid,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="corpName != null"> |
||||
|
corp_name = #{corpName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="corpType != null"> |
||||
|
corp_type = #{corpType,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="corpSquareLogoUrl != null"> |
||||
|
corp_square_logo_url = #{corpSquareLogoUrl,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="corpUserMax != null"> |
||||
|
corp_user_max = #{corpUserMax,jdbcType=INTEGER}, |
||||
|
</if> |
||||
|
<if test="corpAgentMax != null"> |
||||
|
corp_agent_max = #{corpAgentMax,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="corpFullName != null"> |
||||
|
corp_full_name = #{corpFullName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="subjectType != null"> |
||||
|
subject_type = #{subjectType,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="verifiedEndTime != null"> |
||||
|
verified_end_time = #{verifiedEndTime,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="corpWxqrcode != null"> |
||||
|
corp_wxqrcode = #{corpWxqrcode,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="corpScale != null"> |
||||
|
corp_scale = #{corpScale,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="corpIndustry != null"> |
||||
|
corp_industry = #{corpIndustry,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="corpSubIndustry != null"> |
||||
|
corp_sub_industry = #{corpSubIndustry,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="location != null"> |
||||
|
location = #{location,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="authUserid != null"> |
||||
|
auth_userid = #{authUserid,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="authName != null"> |
||||
|
auth_name = #{authName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="authAvatar != null"> |
||||
|
auth_avatar = #{authAvatar,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="dealerCorpInfoCorpid != null"> |
||||
|
dealer_corp_info_corpid = #{dealerCorpInfoCorpid,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="dealerCorpInfoCorpName != null"> |
||||
|
dealer_corp_info_corp_name = #{dealerCorpInfoCorpName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="registerCode != null"> |
||||
|
register_code = #{registerCode,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="templateId != null"> |
||||
|
template_id = #{templateId,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="state != null"> |
||||
|
state = #{state,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="createdAt != null"> |
||||
|
created_at = #{createdAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="updatedAt != null"> |
||||
|
updated_at = #{updatedAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="recStatus != null"> |
||||
|
rec_status = #{recStatus,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
</set> |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</update> |
||||
|
<update id="updateByPrimaryKey" parameterType="com.ccsens.health.bean.po.HealthAuth"> |
||||
|
update t_health_auth |
||||
|
set access_token = #{accessToken,jdbcType=VARCHAR}, |
||||
|
expires_in = #{expiresIn,jdbcType=INTEGER}, |
||||
|
permanent_code = #{permanentCode,jdbcType=VARCHAR}, |
||||
|
corpid = #{corpid,jdbcType=VARCHAR}, |
||||
|
corp_name = #{corpName,jdbcType=VARCHAR}, |
||||
|
corp_type = #{corpType,jdbcType=VARCHAR}, |
||||
|
corp_square_logo_url = #{corpSquareLogoUrl,jdbcType=VARCHAR}, |
||||
|
corp_user_max = #{corpUserMax,jdbcType=INTEGER}, |
||||
|
corp_agent_max = #{corpAgentMax,jdbcType=BIGINT}, |
||||
|
corp_full_name = #{corpFullName,jdbcType=VARCHAR}, |
||||
|
subject_type = #{subjectType,jdbcType=TINYINT}, |
||||
|
verified_end_time = #{verifiedEndTime,jdbcType=BIGINT}, |
||||
|
corp_wxqrcode = #{corpWxqrcode,jdbcType=VARCHAR}, |
||||
|
corp_scale = #{corpScale,jdbcType=VARCHAR}, |
||||
|
corp_industry = #{corpIndustry,jdbcType=VARCHAR}, |
||||
|
corp_sub_industry = #{corpSubIndustry,jdbcType=VARCHAR}, |
||||
|
location = #{location,jdbcType=VARCHAR}, |
||||
|
auth_userid = #{authUserid,jdbcType=VARCHAR}, |
||||
|
auth_name = #{authName,jdbcType=VARCHAR}, |
||||
|
auth_avatar = #{authAvatar,jdbcType=VARCHAR}, |
||||
|
dealer_corp_info_corpid = #{dealerCorpInfoCorpid,jdbcType=VARCHAR}, |
||||
|
dealer_corp_info_corp_name = #{dealerCorpInfoCorpName,jdbcType=VARCHAR}, |
||||
|
register_code = #{registerCode,jdbcType=VARCHAR}, |
||||
|
template_id = #{templateId,jdbcType=VARCHAR}, |
||||
|
state = #{state,jdbcType=VARCHAR}, |
||||
|
created_at = #{createdAt,jdbcType=TIMESTAMP}, |
||||
|
updated_at = #{updatedAt,jdbcType=TIMESTAMP}, |
||||
|
rec_status = #{recStatus,jdbcType=TINYINT} |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</update> |
||||
|
</mapper> |
@ -0,0 +1,123 @@ |
|||||
|
package com.ccsens.util; |
||||
|
|
||||
|
import cn.hutool.core.util.StrUtil; |
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpEntity; |
||||
|
import org.springframework.http.HttpHeaders; |
||||
|
import org.springframework.http.MediaType; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
import org.springframework.util.LinkedMultiValueMap; |
||||
|
import org.springframework.util.MultiValueMap; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
import javax.annotation.PostConstruct; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Slf4j |
||||
|
@Component |
||||
|
public class RestTemplateUtil { |
||||
|
|
||||
|
@Autowired |
||||
|
private RestTemplate restTemplate; |
||||
|
|
||||
|
private static RestTemplateUtil util; |
||||
|
|
||||
|
@PostConstruct |
||||
|
public void init(){ |
||||
|
util = this; |
||||
|
util.restTemplate = this.restTemplate; |
||||
|
} |
||||
|
|
||||
|
public static Object getForEntity(String url, Map<String, Object> params, Class<?> returnClass) { |
||||
|
|
||||
|
if (params != null && !params.isEmpty()) { |
||||
|
if (!url.contains("?")) { |
||||
|
url += "?"; |
||||
|
} |
||||
|
for (String key : params.keySet()) { |
||||
|
if (url.endsWith("?")) { |
||||
|
url += key + "="+params.get(key)+""; |
||||
|
} else { |
||||
|
url += "&" + key + "="+params.get(key)+""; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
log.info("url:{}, params:{}", url, params); |
||||
|
ResponseEntity<String> entity = util.restTemplate.getForEntity(url, String.class); |
||||
|
log.info("entity:{}",entity); |
||||
|
return JSONObject.parseObject(entity.getBody(), returnClass); |
||||
|
} |
||||
|
public static String postBody(String url, Object params) { |
||||
|
log.info("路径:{}, 参数:{}", url, params); |
||||
|
HttpHeaders httpHeaders = new HttpHeaders(); |
||||
|
MediaType type=MediaType.parseMediaType("application/json;charset=UTF-8"); |
||||
|
httpHeaders.setContentType(type); |
||||
|
|
||||
|
// MultiValueMap<String, Object> map=new LinkedMultiValueMap<>();
|
||||
|
|
||||
|
JSONObject json = JSON.parseObject(JSON.toJSONString(params)); |
||||
|
HttpEntity<Map<String, Object>> objectHttpEntity = new HttpEntity<>(json,httpHeaders); |
||||
|
ResponseEntity<String> response = util.restTemplate.postForEntity(url, objectHttpEntity, String.class); |
||||
|
log.info("返回:{}", response); |
||||
|
return response.getBody(); |
||||
|
} |
||||
|
public static String postUrlEncode(String url, Object params) { |
||||
|
log.info("请求路径:{},请求参数:{}", url, params); |
||||
|
JSONObject json = JSON.parseObject(JSON.toJSONString(params)); |
||||
|
MultiValueMap<String, Object> paramMap = transMultiValueMap(json); |
||||
|
HttpHeaders headers = new HttpHeaders(); |
||||
|
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
||||
|
HttpEntity<MultiValueMap> formEntity = new HttpEntity<>(paramMap, headers); |
||||
|
ResponseEntity<String> result = util.restTemplate.postForEntity(url, formEntity, String.class); |
||||
|
log.info("接口返回结果:{}", result); |
||||
|
return result.getBody(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 发送multipart/form-data |
||||
|
* @author whj |
||||
|
* @date 2019/8/20 |
||||
|
* @param url |
||||
|
* @param params |
||||
|
* @return com.alibaba.fastjson.JSONObject |
||||
|
*/ |
||||
|
public static JSONObject postImg(String url, JSONObject params) { |
||||
|
log.info("请求路径:{},请求参数:{}", url, params); |
||||
|
HttpHeaders headers = new HttpHeaders(); |
||||
|
headers.add("Accept", MediaType.APPLICATION_JSON.toString()); |
||||
|
headers.setContentType(MediaType.MULTIPART_FORM_DATA); |
||||
|
MultiValueMap<String, Object> paramMap = transMultiValueMap(params); |
||||
|
HttpEntity<MultiValueMap> formEntity = new HttpEntity<>(paramMap, headers); |
||||
|
JSONObject result = util.restTemplate.postForObject(url, formEntity, JSONObject.class); |
||||
|
log.info("接口返回结果:{}", result); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 将参数封装成MultiValueMap对象 |
||||
|
* @author whj |
||||
|
* @date 2019/8/20 |
||||
|
* @param params |
||||
|
* @return org.springframework.util.MultiValueMap<java.lang.String,java.lang.Object> |
||||
|
*/ |
||||
|
private static MultiValueMap<String, Object> transMultiValueMap(JSONObject params) { |
||||
|
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>(); |
||||
|
for (String key: params.keySet()) { |
||||
|
paramMap.add(key, params.get(key)); |
||||
|
} |
||||
|
return paramMap; |
||||
|
} |
||||
|
|
||||
|
public static boolean pageResult(String result) { |
||||
|
if (StrUtil.isBlank(result) || result.contains("<html")) { |
||||
|
return false; |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -1,9 +1,77 @@ |
|||||
package com.ccsens.util.enterprisewx; |
package com.ccsens.util.enterprisewx; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
|
||||
|
/** |
||||
|
* @author wu |
||||
|
*/ |
||||
public class WeiXinConstant { |
public class WeiXinConstant { |
||||
|
|
||||
|
public static final String token = "4CxIpRDBWHMiePP3x6muNe4hRj"; |
||||
|
public static final String corpID = "ww86f65c2e95cd8b4c"; |
||||
|
public static final String encodingAESKey = "NInifq246LLoF5wyCq4fRJNJOvKI7XIkgdUqOpWoP3G"; |
||||
|
public static final String providerSecret = "fr8OXt4iMqIxe3QMUVkHCK_j9oj0qllZciOgw5CdGldDksv5yMoxFduPbZGmIlfj"; |
||||
|
public static final String suiteSecret = "suite_secret"; |
||||
|
|
||||
|
|
||||
|
public static final String ERR_CODE = "errcode"; |
||||
|
public static final String ERR_MSG = "errmsg"; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 获取永久授权 |
||||
|
*/ |
||||
|
public static final String GET_PERMANENT_CODE = "https://qyapi.weixin.qq.com/cgi-bin/service/get_permanent_code"; |
||||
|
public static final String GET_SUITE_TOKEN = "https://qyapi.weixin.qq.com/cgi-bin/service/get_suite_token"; |
||||
|
public static final String GET_CORP_TOKEN = "https://qyapi.weixin.qq.com/cgi-bin/service/get_corp_token"; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 获取第三方凭证 |
||||
|
* @param suiteId |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String getAccessToken(String suiteId, String corpID) { |
||||
|
return "access_token_" + suiteId + "_" + corpID; |
||||
|
} |
||||
|
/** |
||||
|
* 获取临时授权码key |
||||
|
* @param suiteId |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String getTempAuthCodeKey(String suiteId) { |
||||
|
return "temp_auth_code_" + suiteId; |
||||
|
} |
||||
|
|
||||
|
public static String getSuiteAccessToken(String suiteId){ |
||||
|
return "suite_access_token_" + suiteId; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取SuiteTicket的key |
||||
|
* @param suiteId |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String getSuiteTicket(String suiteId) { |
||||
|
return "suite_ticket_" + suiteId; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取suiteToken的key |
||||
|
* @param suiteId |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String getSuiteToken(String suiteId) { |
||||
|
return "suite_token_" + suiteId; |
||||
|
} |
||||
|
|
||||
private String corpId = "ww86f65c2e95cd8b4c"; |
/** |
||||
private String provider_secret = "fr8OXt4iMqIxe3QMUVkHCK_j9oj0qllZciOgw5CdGldDksv5yMoxFduPbZGmIlfj"; |
* 判断返回是否正确 |
||||
|
* @param result |
||||
|
* @return |
||||
|
*/ |
||||
|
public static boolean pageResult(JSONObject result) { |
||||
|
return result.getIntValue(ERR_CODE) == 0; |
||||
|
} |
||||
|
|
||||
} |
} |
||||
|
Loading…
Reference in new issue