Commit 3f4fb2b2 by guojuxing

udesk

parents
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>gic-pom-base</artifactId>
<groupId>com.gic</groupId>
<version>4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>gic-platform-udesk-api</artifactId>
<version>${libraryVersion}</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<libraryVersion>4.0-SNAPSHOT</libraryVersion>
</properties>
<dependencies>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-base-api</artifactId>
<version>${gic-base-api}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-enterprise-base-api</artifactId>
<version>${gic-enterprise-base-api}</version>
</dependency>
<!--参数验证-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.16.Final</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
<version>3.0.1-b09</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.1.0</version>
<configuration>
<flattenMode>defaults</flattenMode>
</configuration>
<executions>
<!-- enable flattening -->
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<!-- ensure proper cleanup -->
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package com.gic.udesk.constant;
/**
* udesk共享常量类
* @ClassName: UdeskSharedConstant

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:43 PM

*/
public class UdeskSharedConstant {
/**
* udesk消息来源
*/
public static final String UDESK_SOURCE = "udesk";
/**
* tapd消息来源
*/
public static final String TAPD_SOURCE = "tapd";
/**
* tapd消息主题
*/
public static final String TAPD_MESSAGE_TOPIC = "bug";
/**
* tapd缺陷更新事件
*/
public static final String TAPD_BUG_UPDATE_EVENT = "bug::update";
/**
* tapd缺陷删除事件
*/
public static final String TAPD_BUG_DELETE_EVENT = "bug::delete";
}
package com.gic.udesk.dto;
import java.io.Serializable;
/**
* 附件
* @ClassName: AttachmentDTO

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:05 PM

*/
public class AttachmentDTO implements Serializable{
private static final long serialVersionUID = 6369929530568254062L;
/**
* 坑,文档示例返回是name,调用是file_name
*/
private String file_name;
/**
*
*/
private String url;
public String getFile_name() {
return file_name;
}
public void setFile_name(String file_name) {
this.file_name = file_name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
package com.gic.udesk.dto;
import java.io.Serializable;
/**
* 关注者
* @ClassName: FollowerDTO

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:06 PM

*/
public class FollowerDTO implements Serializable{
private static final long serialVersionUID = -6806790410409455090L;
/**
*
*/
private Integer id;
/**
*
*/
private String nick_name;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNick_name() {
return nick_name;
}
public void setNick_name(String nick_name) {
this.nick_name = nick_name;
}
}
package com.gic.udesk.dto;
import java.io.Serializable;
import java.util.Map;
/**
* udesk公司信息
* @ClassName: OrganizationDTO

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:07 PM

*/
public class OrganizationDTO implements Serializable{
private static final long serialVersionUID = -3042952127522207394L;
/**
*
*/
private Integer id;
/**
*
*/
private String name;
/**
*
*/
private String domains;
/**
*
*/
private String description;
/**
*
*/
private String token;
/**
*
*/
private Map<String, String> custom_fields;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDomains() {
return domains;
}
public void setDomains(String domains) {
this.domains = domains;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public Map<String, String> getCustom_fields() {
return custom_fields;
}
public void setCustom_fields(Map<String, String> custom_fields) {
this.custom_fields = custom_fields;
}
}
package com.gic.udesk.dto;
import java.io.Serializable;
/**
* 缺陷基类
* @ClassName: TapdBugBaseDTO

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:08 PM

*/
public class TapdBugBaseDTO implements Serializable{
private static final long serialVersionUID = 996019256030454386L;
/**
* BUG id
*/
private String id;
/**
* 标题
*/
private String title;
/**
* 详细描述
*/
private String description;
/**
* 优先级
*/
private String priority;
/**
* 严重程度
*/
private String severity;
/**
* 状态
*/
private String status;
/**
* 创建人
*/
private String reporter;
/**
* 缺陷类型
*/
private String bugtype;
/**
* 当前处理人
*/
private String current_owner;
/**
* 发现阶段
*/
private String originphase;
/**
* 测试类型
*/
private String testtype;
/**
* 重现规律
*/
private String frequency;
/**
* 自定义字段
*/
private String custom_field_one;
private String custom_field_two;
private String custom_field_three;
private String custom_field_four;
private String custom_field_five;
private String custom_field_6;
private String custom_field_7;
private String custom_field_8;
private String custom_field_9;
private String custom_field_10;
/**
* 项目id
*/
private String workspace_id;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getPriority() {
return priority;
}
public void setPriority(String priority) {
this.priority = priority;
}
public String getSeverity() {
return severity;
}
public void setSeverity(String severity) {
this.severity = severity;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getReporter() {
return reporter;
}
public void setReporter(String reporter) {
this.reporter = reporter;
}
public String getBugtype() {
return bugtype;
}
public void setBugtype(String bugtype) {
this.bugtype = bugtype;
}
public String getCurrent_owner() {
return current_owner;
}
public void setCurrent_owner(String current_owner) {
this.current_owner = current_owner;
}
public String getOriginphase() {
return originphase;
}
public void setOriginphase(String originphase) {
this.originphase = originphase;
}
public String getTesttype() {
return testtype;
}
public void setTesttype(String testtype) {
this.testtype = testtype;
}
public String getFrequency() {
return frequency;
}
public void setFrequency(String frequency) {
this.frequency = frequency;
}
public String getCustom_field_one() {
return custom_field_one;
}
public void setCustom_field_one(String custom_field_one) {
this.custom_field_one = custom_field_one;
}
public String getCustom_field_two() {
return custom_field_two;
}
public void setCustom_field_two(String custom_field_two) {
this.custom_field_two = custom_field_two;
}
public String getCustom_field_three() {
return custom_field_three;
}
public void setCustom_field_three(String custom_field_three) {
this.custom_field_three = custom_field_three;
}
public String getCustom_field_four() {
return custom_field_four;
}
public void setCustom_field_four(String custom_field_four) {
this.custom_field_four = custom_field_four;
}
public String getCustom_field_five() {
return custom_field_five;
}
public void setCustom_field_five(String custom_field_five) {
this.custom_field_five = custom_field_five;
}
public String getCustom_field_6() {
return custom_field_6;
}
public void setCustom_field_6(String custom_field_6) {
this.custom_field_6 = custom_field_6;
}
public String getCustom_field_7() {
return custom_field_7;
}
public void setCustom_field_7(String custom_field_7) {
this.custom_field_7 = custom_field_7;
}
public String getCustom_field_8() {
return custom_field_8;
}
public void setCustom_field_8(String custom_field_8) {
this.custom_field_8 = custom_field_8;
}
public String getCustom_field_9() {
return custom_field_9;
}
public void setCustom_field_9(String custom_field_9) {
this.custom_field_9 = custom_field_9;
}
public String getCustom_field_10() {
return custom_field_10;
}
public void setCustom_field_10(String custom_field_10) {
this.custom_field_10 = custom_field_10;
}
public String getWorkspace_id() {
return workspace_id;
}
public void setWorkspace_id(String workspace_id) {
this.workspace_id = workspace_id;
}
}
package com.gic.udesk.dto;
import java.io.Serializable;
/**
* @ClassName: TapdBugUpdateDTO

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:11 PM

*/
public class TapdBugUpdateDTO extends TapdBugBaseDTO implements Serializable{
private static final long serialVersionUID = 2954842604288372658L;
/**
* 项目ID
*/
private Integer project_id;
/**
* 更新人(操作人)
*/
private String current_user;
public Integer getProject_id() {
return project_id;
}
public void setProject_id(Integer project_id) {
this.project_id = project_id;
}
public String getCurrent_user() {
return current_user;
}
public void setCurrent_user(String current_user) {
this.current_user = current_user;
}
}
package com.gic.udesk.dto;
import java.io.Serializable;
/**
* tapd自定义字段
* @ClassName: TapdCustomFieldConfig

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:12 PM

*/
public class TapdCustomFieldConfig implements Serializable{
private static final long serialVersionUID = -6242431131348000720L;
/**
* 自定义字段配置的ID
*/
private Integer id;
/**
* 所属项目ID
*/
private String workspace_id;
/**
* 所属实体对象
*/
private String entry_type;
/**
* 自定义字段标识(英文名)
*/
private String custom_field;
/**
* 输入类型
*/
private String type;
/**
* 自定义字段显示名称
*/
private String name;
/**
* 自定义字段可选值
*/
private String options;
/**
* 是否启用
*/
private String enabled;
/**
* 显示时排序系数
*/
private String sort;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getWorkspace_id() {
return workspace_id;
}
public void setWorkspace_id(String workspace_id) {
this.workspace_id = workspace_id;
}
public String getEntry_type() {
return entry_type;
}
public void setEntry_type(String entry_type) {
this.entry_type = entry_type;
}
public String getCustom_field() {
return custom_field;
}
public void setCustom_field(String custom_field) {
this.custom_field = custom_field;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getOptions() {
return options;
}
public void setOptions(String options) {
this.options = options;
}
public String getEnabled() {
return enabled;
}
public void setEnabled(String enabled) {
this.enabled = enabled;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
}
package com.gic.udesk.dto;
import java.io.Serializable;
/**
* tapd监听发送的消息参数
* @ClassName: TapdMessageDTO

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:13 PM

*/
public class TapdMessageDTO implements Serializable{
private static final long serialVersionUID = 1782405175563991216L;
/**
* udesk工单的id
*/
private String udeskId;
/**
* 新对象ID。需求、缺陷、任务、发布评审的都是19位长度的长ID
*/
private String id;
/**
* 事件名
*/
private String event;
/**
* 事件触发时的时间。格式:Y-m-d H:i:s,如 2019-03-29 10:55:02
*/
private String created;
/**
* 事件触发地方.有web、api
*/
private String event_from;
/**
* 事件id
*/
private String event_id;
/**
* 操作人
*/
private String current_user;
/**
* 项目ID
*/
private String workspace_id;
/**
* 发生变更的字段,以 , 分隔
*/
private String change_fields;
/**
* 标题
*/
private String old_title;
public String getUdeskId() {
return udeskId;
}
public void setUdeskId(String udeskId) {
this.udeskId = udeskId;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getEvent() {
return event;
}
public void setEvent(String event) {
this.event = event;
}
public String getCreated() {
return created;
}
public void setCreated(String created) {
this.created = created;
}
public String getEvent_from() {
return event_from;
}
public void setEvent_from(String event_from) {
this.event_from = event_from;
}
public String getEvent_id() {
return event_id;
}
public void setEvent_id(String event_id) {
this.event_id = event_id;
}
public String getCurrent_user() {
return current_user;
}
public void setCurrent_user(String current_user) {
this.current_user = current_user;
}
public String getWorkspace_id() {
return workspace_id;
}
public void setWorkspace_id(String workspace_id) {
this.workspace_id = workspace_id;
}
public String getChange_fields() {
return change_fields;
}
public void setChange_fields(String change_fields) {
this.change_fields = change_fields;
}
public String getOld_title() {
return old_title;
}
public void setOld_title(String old_title) {
this.old_title = old_title;
}
}
package com.gic.udesk.dto;
import java.io.Serializable;
/**
* 接收新增TAPD的bug返回
* @ClassName: TapdRespBugDTO

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:29 PM

*/
public class TapdRespBugDTO implements Serializable{
private static final long serialVersionUID = 7729863361142012314L;
private Integer status;
private String info;
private TapdRespBugDataDTO data;
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public TapdRespBugDataDTO getData() {
return data;
}
public void setData(TapdRespBugDataDTO data) {
this.data = data;
}
}
package com.gic.udesk.dto;
import java.io.Serializable;
/**
* 接收新增TAPD的bug返回data
* @ClassName: TapdRespBugDataDTO

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:28 PM

*/
public class TapdRespBugDataDTO implements Serializable{
private static final long serialVersionUID = 9113924195626824396L;
private TapdBugDTO Bug;
public TapdBugDTO getBug() {
return Bug;
}
public void setBug(TapdBugDTO bug) {
Bug = bug;
}
}
package com.gic.udesk.dto;
import java.io.Serializable;
import java.util.List;
/**
* 接收新增TAPD自定义字
* @ClassName: TapdRespCustomFieldDTO

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:31 PM

*/
public class TapdRespCustomFieldDTO implements Serializable{
private static final long serialVersionUID = 6841199187523354905L;
private Integer status;
private String info;
private List<TapdRespCustomFieldDataDTO> data;
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public List<TapdRespCustomFieldDataDTO> getData() {
return data;
}
public void setData(List<TapdRespCustomFieldDataDTO> data) {
this.data = data;
}
}
package com.gic.udesk.dto;
import java.io.Serializable;
/**
* TAPD自定义字段返回data
* @ClassName: TapdRespCustomFieldDataDTO

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:29 PM

*/
public class TapdRespCustomFieldDataDTO implements Serializable{
private static final long serialVersionUID = 6070115012514102123L;
private TapdCustomFieldConfig CustomFieldConfig;
public TapdCustomFieldConfig getCustomFieldConfig() {
return CustomFieldConfig;
}
public void setCustomFieldConfig(TapdCustomFieldConfig customFieldConfig) {
CustomFieldConfig = customFieldConfig;
}
}
package com.gic.udesk.dto;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* 工单信息
* @ClassName: TicketDTO

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:32 PM

*/
public class TicketDTO implements Serializable{
private static final long serialVersionUID = 1316075989331518774L;
/**
* 唯一标识,系统自动生成
*/
private Integer id;
/**
* 唯一标识,系统自动生成
*/
private String field_num;
/**
* 标题
*/
private String subject;
/**
* 内容
*/
private String content;
/**
* 内容类型
*/
private String content_type;
/**
* 客户id
*/
private Integer user_id;
/**
* 客户姓名
*/
private String user_name;
/**
* 客户邮箱
*/
private String user_email;
/**
* 客户电话
*/
private String user_cellphone;
/**
* 客户所属公司id
*/
private Integer organization_id;
/**
* 受理客服id
*/
private Integer assignee_id;
/**
* 受理客服姓名
*/
private String assignee_name;
/**
* 受理客服头像
*/
private String assignee_avatar;
/**
* 受理客服组id
*/
private Integer user_group_id;
/**
* 受理客服组名称
*/
private String user_group_name;
/**
* 模板id
*/
private Integer template_id;
/**
* 优先级中文名称
*/
private String priority;
/**
* 状态中文名称
*/
private String status;
/**
* 状态英文名称
*/
private String status_en;
/**
* 渠道中文名称
*/
private String platform;
/**
* 满意度调查结果
*/
private String satisfaction;
/**
* 自定义字段
*/
private Map<String, String> custom_fields;
/**
* 标签
*/
private String tags;
/**
* 关注者
*/
private List<FollowerDTO> followers;
/**
* 创建人
*/
private Integer creator_id;
/**
* 创建时间,系统自动生成
*/
private String created_at;
/**
* 更新时间,系统自动生成
*/
private String updated_at;
/**
* 开始解决时间
*/
private String solving_at;
/**
* 解决时间
*/
private String resolved_at;
/**
* 关闭时间
*/
private String closed_at;
/**
* 到期时间
*/
private String solved_deadline;
/**
* 最后回复时间
*/
private String replied_at;
/**
* 客服最后回复时间
*/
private String agent_replied_at;
/**
* 客户最后回复时间
*/
private String customer_replied_at;
/**
* 最后回复人
*/
private String replied_by;
/**
* 工单关联的附件
*/
private List<AttachmentDTO> attachments;
/**
* 工单的sub_session_id
*/
private Integer im_sub_session_id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getField_num() {
return field_num;
}
public void setField_num(String field_num) {
this.field_num = field_num;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getContent_type() {
return content_type;
}
public void setContent_type(String content_type) {
this.content_type = content_type;
}
public Integer getUser_id() {
return user_id;
}
public void setUser_id(Integer user_id) {
this.user_id = user_id;
}
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getUser_email() {
return user_email;
}
public void setUser_email(String user_email) {
this.user_email = user_email;
}
public String getUser_cellphone() {
return user_cellphone;
}
public void setUser_cellphone(String user_cellphone) {
this.user_cellphone = user_cellphone;
}
public Integer getOrganization_id() {
return organization_id;
}
public void setOrganization_id(Integer organization_id) {
this.organization_id = organization_id;
}
public Integer getAssignee_id() {
return assignee_id;
}
public void setAssignee_id(Integer assignee_id) {
this.assignee_id = assignee_id;
}
public String getAssignee_name() {
return assignee_name;
}
public void setAssignee_name(String assignee_name) {
this.assignee_name = assignee_name;
}
public String getAssignee_avatar() {
return assignee_avatar;
}
public void setAssignee_avatar(String assignee_avatar) {
this.assignee_avatar = assignee_avatar;
}
public Integer getUser_group_id() {
return user_group_id;
}
public void setUser_group_id(Integer user_group_id) {
this.user_group_id = user_group_id;
}
public String getUser_group_name() {
return user_group_name;
}
public void setUser_group_name(String user_group_name) {
this.user_group_name = user_group_name;
}
public Integer getTemplate_id() {
return template_id;
}
public void setTemplate_id(Integer template_id) {
this.template_id = template_id;
}
public String getPriority() {
return priority;
}
public void setPriority(String priority) {
this.priority = priority;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatus_en() {
return status_en;
}
public void setStatus_en(String status_en) {
this.status_en = status_en;
}
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public String getSatisfaction() {
return satisfaction;
}
public void setSatisfaction(String satisfaction) {
this.satisfaction = satisfaction;
}
public Map<String, String> getCustom_fields() {
return custom_fields;
}
public void setCustom_fields(Map<String, String> custom_fields) {
this.custom_fields = custom_fields;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
public List<FollowerDTO> getFollowers() {
return followers;
}
public void setFollowers(List<FollowerDTO> followers) {
this.followers = followers;
}
public Integer getCreator_id() {
return creator_id;
}
public void setCreator_id(Integer creator_id) {
this.creator_id = creator_id;
}
public String getCreated_at() {
return created_at;
}
public void setCreated_at(String created_at) {
this.created_at = created_at;
}
public String getUpdated_at() {
return updated_at;
}
public void setUpdated_at(String updated_at) {
this.updated_at = updated_at;
}
public String getSolving_at() {
return solving_at;
}
public void setSolving_at(String solving_at) {
this.solving_at = solving_at;
}
public String getResolved_at() {
return resolved_at;
}
public void setResolved_at(String resolved_at) {
this.resolved_at = resolved_at;
}
public String getClosed_at() {
return closed_at;
}
public void setClosed_at(String closed_at) {
this.closed_at = closed_at;
}
public String getSolved_deadline() {
return solved_deadline;
}
public void setSolved_deadline(String solved_deadline) {
this.solved_deadline = solved_deadline;
}
public String getReplied_at() {
return replied_at;
}
public void setReplied_at(String replied_at) {
this.replied_at = replied_at;
}
public String getAgent_replied_at() {
return agent_replied_at;
}
public void setAgent_replied_at(String agent_replied_at) {
this.agent_replied_at = agent_replied_at;
}
public String getCustomer_replied_at() {
return customer_replied_at;
}
public void setCustomer_replied_at(String customer_replied_at) {
this.customer_replied_at = customer_replied_at;
}
public String getReplied_by() {
return replied_by;
}
public void setReplied_by(String replied_by) {
this.replied_by = replied_by;
}
public List<AttachmentDTO> getAttachments() {
return attachments;
}
public void setAttachments(List<AttachmentDTO> attachments) {
this.attachments = attachments;
}
public Integer getIm_sub_session_id() {
return im_sub_session_id;
}
public void setIm_sub_session_id(Integer im_sub_session_id) {
this.im_sub_session_id = im_sub_session_id;
}
}
package com.gic.udesk.dto;
import java.io.Serializable;
/**
* udesk客户回复
* @ClassName: UdeskAgentReplyDTO

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:34 PM

*/
public class UdeskAgentReplyDTO implements Serializable{
private static final long serialVersionUID = -4964133303321416857L;
/**
* 工单id
*/
private Integer id;
/**
* 工单编号
*/
private String num;
/**
* 客服id
*/
private Integer agent_id;
/**
* 回复类型,"internal"内部备注/"external"外部评论
*/
private String function_type;
/**
* 回复内容
*/
private String new_reply;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNum() {
return num;
}
public void setNum(String num) {
this.num = num;
}
public Integer getAgent_id() {
return agent_id;
}
public void setAgent_id(Integer agent_id) {
this.agent_id = agent_id;
}
public String getFunction_type() {
return function_type;
}
public void setFunction_type(String function_type) {
this.function_type = function_type;
}
public String getNew_reply() {
return new_reply;
}
public void setNew_reply(String new_reply) {
this.new_reply = new_reply;
}
}
package com.gic.udesk.dto;
import java.io.Serializable;
/**
* udesk公司信息
* @ClassName: UdeskCompanyDTO

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:35 PM

*/
public class UdeskCompanyDTO implements Serializable{
private static final long serialVersionUID = -7766353148345022802L;
/**
* 执行结果码,1000代表成功
*/
private Integer code;
/**
* 客户公司信息
*/
private OrganizationDTO organization;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public OrganizationDTO getOrganization() {
return organization;
}
public void setOrganization(OrganizationDTO organization) {
this.organization = organization;
}
}
package com.gic.udesk.dto;
import java.io.Serializable;
/**
* 消息,udesk/tapd监听
* @ClassName: UdeskMessageDTO

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:00 PM

*/
public class UdeskMessageDTO implements Serializable{
private static final long serialVersionUID = -4024232985956325129L;
/**
* 消息来源,udesk或tapd
*/
private String source;
/**
* 消息主题
*/
private String topic;
/**
* 消息事件
*/
private String event;
/**
* 消息体
*/
private String msgBody;
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public String getEvent() {
return event;
}
public void setEvent(String event) {
this.event = event;
}
public String getMsgBody() {
return msgBody;
}
public void setMsgBody(String msgBody) {
this.msgBody = msgBody;
}
@Override
public String toString() {
return "UdeskMessageDTO [source=" + source + ", topic=" + topic + ", event=" + event + ", msgBody=" + msgBody
+ "]";
}
}
package com.gic.udesk.dto;
import java.io.Serializable;
/**
* UDESK客服回复返回消息
* @ClassName: UdeskRespReplyDTO

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:35 PM

*/
public class UdeskRespReplyDTO implements Serializable{
private static final long serialVersionUID = -7910815396193380366L;
/**
* 1000
*/
private Integer code;
/**
* 返回数据
*/
private Object data;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
package com.gic.udesk.dto;
import java.io.Serializable;
/**
* 查询工单详情返回数据
* @ClassName: UdeskTicketDetailDTO

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:36 PM

*/
public class UdeskTicketDetailDTO implements Serializable{
private static final long serialVersionUID = 8168560910532170329L;
/**
* 执行结果码,1000代表成功
*/
private Integer code;
/**
* 执行结果说明
*/
private String message;
/**
* 工单信息
*/
private TicketDTO ticket;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public TicketDTO getTicket() {
return ticket;
}
public void setTicket(TicketDTO ticket) {
this.ticket = ticket;
}
}
package com.gic.udesk.service;
import com.gic.api.base.commons.ServiceResponse;
/**
* tapd和udesk关联(tapd的项目ID和udesk的自定义字段)
* @ClassName: TapdConfigApiService

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:42 PM

*/
public interface TapdConfigApiService {
/**
* tapd和udesk关联(tapd的项目ID和udesk的自定义字段)
* @Title: setTapdCustomFieldRelUdesk

* @Description:

 * @author guojuxing
* @param workspaceId

* @return com.gic.api.base.commons.ServiceResponse<java.lang.String>


 */
ServiceResponse<String> setTapdCustomFieldRelUdesk(String workspaceId);
}
package com.gic.udesk.service;
import com.gic.api.base.commons.ServiceResponse;
public interface TapdMessageApiService {
/**
* tapd监听消息处理
* @Title: handleTapdMessage

* @Description:

 * @author guojuxing
* @param tapdMessageStr

* @return com.gic.api.base.commons.ServiceResponse<java.lang.String>


 */
ServiceResponse<String> handleTapdMessage(String tapdMessageStr);
}
package com.gic.udesk.service;
import com.gic.api.base.commons.ServiceResponse;
public interface UdeskBaseApiService {
/**
* 保存udesk类型的异常信息
* @Title: saveUdeskException

* @Description:

 * @author guojuxing
* @param exceptionRecord

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


 */
ServiceResponse<Void> saveUdeskException(String exceptionRecord);
/**
* 保存tapd类型的异常信息
* @Title: saveTapdException

* @Description:

 * @author guojuxing
* @param exceptionRecord

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


 */
ServiceResponse<Void> saveTapdException(String exceptionRecord);
}
package com.gic.udesk.service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.udesk.dto.UdeskMessageDTO;
public interface UdeskMessageApiService {
/**
* 监听处理udesk消息
* @Title: saveUdeskMessage

* @Description:

 * @author guojuxing
* @param messageDTO

* @return com.gic.api.base.commons.ServiceResponse<java.lang.String>


 */
ServiceResponse<String> saveUdeskMessage(UdeskMessageDTO messageDTO);
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId>
<version>4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>gic-platform-udesk-service</artifactId>
<version>${libraryVersion}</version>
<name>${project.artifactId}</name>
<url>http://www.demogic.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<libraryVersion>4.0-SNAPSHOT</libraryVersion>
<gic-sharding-sdk>3.1-SNAPSHOT</gic-sharding-sdk>
<!-- api依赖,正式版会在 gic-pom-base 里生成 -->
<gic-store-api>4.0-SNAPSHOT</gic-store-api>
<gic-redis-data>4.0-SNAPSHOT</gic-redis-data>
<gic-bizdict-api>4.0.0-SNAPSHOT</gic-bizdict-api>
<gic-platform-auth-api>4.0-SNAPSHOT</gic-platform-auth-api>
<gic-wechat-business-api>4.0-SNAPSHOT</gic-wechat-business-api>
<gic-member-api>4.0-SNAPSHOT</gic-member-api>
<gic-open-platform-api>4.0-SNAPSHOT</gic-open-platform-api>
</properties>
<dependencies>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-commons</artifactId>
<version>${gic-commons}</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<artifactId>dubbo</artifactId>
<groupId>com.alibaba</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-platform-config</artifactId>
<version>${gic-platform-config}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-platform-udesk-api</artifactId>
<version>${gic-platform-enterprise-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-sharding-sdk</artifactId>
<version>${gic-sharding-sdk}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.9</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.1.7.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.gic </groupId>
<artifactId>gic-redis-data </artifactId>
<version>${gic-redis-data} </version>
</dependency>
<dependency>
<groupId>com.gic.bizdict</groupId>
<artifactId>gic-bizdict-api</artifactId>
<version>${gic-bizdict-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-enterprise-base-api</artifactId>
<version>${gic-enterprise-base-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-platform-enterprise-api</artifactId>
<version>${gic-platform-enterprise-api}</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<classesDirectory>target/classes/</classesDirectory>
<archive>
<manifest>
<mainClass>com.gic.commons.DubboMain</mainClass>
<!-- 打包时 MANIFEST.MF文件不记录的时间戳版本 -->
<useUniqueVersions>false</useUniqueVersions>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
<manifestEntries>
<Class-Path>.</Class-Path>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<type>jar</type>
<includeTypes>jar</includeTypes>
<outputDirectory>
${project.build.directory}/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.gic.udesk.dao.mapper;
import com.gic.udesk.entity.TabUdeskEnterprise;
public interface TabUdeskEnterpriseMapper {
/**
* 根据主键删除
*
* @param id 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer id);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabUdeskEnterprise record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabUdeskEnterprise record);
/**
* 根据主键查询
*
* @param id 主键
* @return 实体对象
*/
TabUdeskEnterprise selectByPrimaryKey(Integer id);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabUdeskEnterprise record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabUdeskEnterprise record);
}
\ No newline at end of file
package com.gic.udesk.dao.mapper;
import com.gic.udesk.entity.TabUdeskException;
public interface TabUdeskExceptionMapper {
/**
* 根据主键删除
*
* @param id 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer id);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabUdeskException record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabUdeskException record);
/**
* 根据主键查询
*
* @param id 主键
* @return 实体对象
*/
TabUdeskException selectByPrimaryKey(Integer id);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabUdeskException record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabUdeskException record);
}
\ No newline at end of file
package com.gic.udesk.dao.mapper;
import com.gic.udesk.entity.TabUdeskMessage;
public interface TabUdeskMessageMapper {
/**
* 根据主键删除
*
* @param id 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer id);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabUdeskMessage record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabUdeskMessage record);
/**
* 根据主键查询
*
* @param id 主键
* @return 实体对象
*/
TabUdeskMessage selectByPrimaryKey(Integer id);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabUdeskMessage record);
/**
* 根据主键更新记录,包括二进制大对象
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeyWithBLOBs(TabUdeskMessage record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabUdeskMessage record);
}
\ No newline at end of file
package com.gic.udesk.dao.mapper;
import com.gic.udesk.entity.TabUdeskTapdRel;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TabUdeskTapdRelMapper {
/**
* 根据主键删除
*
* @param id 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer id);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabUdeskTapdRel record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabUdeskTapdRel record);
/**
* 根据主键查询
*
* @param id 主键
* @return 实体对象
*/
TabUdeskTapdRel selectByPrimaryKey(Integer id);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabUdeskTapdRel record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabUdeskTapdRel record);
/**
* 查询列
* @Title: list

* @Description:

 * @author guojuxing
* @param record

* @return java.util.List<com.gic.udesk.entity.TabUdeskTapdRel>


 */
List<TabUdeskTapdRel> list(TabUdeskTapdRel record);
int deleteByWorkspaceId(@Param("relType") int relType, @Param("workspace_id") String workspace_id);
}
\ No newline at end of file
package com.gic.udesk.dao.mapper;
import com.gic.udesk.entity.TabUdeskTicket;
import java.util.List;
public interface TabUdeskTicketMapper {
/**
* 根据主键删除
*
* @param id 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer id);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabUdeskTicket record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabUdeskTicket record);
/**
* 根据主键查询
*
* @param id 主键
* @return 实体对象
*/
TabUdeskTicket selectByPrimaryKey(Integer id);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabUdeskTicket record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabUdeskTicket record);
List<TabUdeskTicket> list(TabUdeskTicket params);
}
\ No newline at end of file
package com.gic.udesk.entity;
import java.util.Date;
/**
* tab_udesk_enterprise
*/
public class TabUdeskEnterprise {
/**
* id
*/
private Integer id;
/**
* 业务模块ID
*/
private String businessModule;
/**
* 业务模块名称
*/
private String businessModuleName;
/**
* 业务模块类型 1:基础模块 2:应用模块
*/
private Integer businessType;
/**
* 工单ID
*/
private Integer ticketId;
/**
* 工单编号
*/
private String ticketNum;
/**
* 工单标题
*/
private String ticketTitle;
/**
* 工单状态
*/
private String ticketStatus;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getBusinessModule() {
return businessModule;
}
public void setBusinessModule(String businessModule) {
this.businessModule = businessModule;
}
public String getBusinessModuleName() {
return businessModuleName;
}
public void setBusinessModuleName(String businessModuleName) {
this.businessModuleName = businessModuleName;
}
public Integer getBusinessType() {
return businessType;
}
public void setBusinessType(Integer businessType) {
this.businessType = businessType;
}
public Integer getTicketId() {
return ticketId;
}
public void setTicketId(Integer ticketId) {
this.ticketId = ticketId;
}
public String getTicketNum() {
return ticketNum;
}
public void setTicketNum(String ticketNum) {
this.ticketNum = ticketNum;
}
public String getTicketTitle() {
return ticketTitle;
}
public void setTicketTitle(String ticketTitle) {
this.ticketTitle = ticketTitle;
}
public String getTicketStatus() {
return ticketStatus;
}
public void setTicketStatus(String ticketStatus) {
this.ticketStatus = ticketStatus;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.gic.udesk.entity;
import java.util.Date;
/**
* tab_udesk_exception
*/
public class TabUdeskException {
/**
* 主键id
*/
private Integer id;
/**
* 异常来源类型,如udesk,tapd
*/
private String expType;
/**
* 异常记录
*/
private String exceptionRecord;
/**
*
*/
private Date createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getExpType() {
return expType;
}
public void setExpType(String expType) {
this.expType = expType;
}
public String getExceptionRecord() {
return exceptionRecord;
}
public void setExceptionRecord(String exceptionRecord) {
this.exceptionRecord = exceptionRecord;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
\ No newline at end of file
package com.gic.udesk.entity;
import java.util.Date;
/**
* tab_udesk_message
*/
public class TabUdeskMessage {
/**
* 消息id
*/
private Integer id;
/**
* 消息来源
*/
private String source;
/**
* 消息主题
*/
private String topic;
/**
* 事件类型
*/
private String event;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
* 状态(0:删除;1:未删除)
*/
private Integer status;
/**
* TPAD的bug_id
*/
private String bugId;
/**
* 工单id
*/
private String ticketId;
/**
* 消息体
*/
private String msgBody;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public String getEvent() {
return event;
}
public void setEvent(String event) {
this.event = event;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getBugId() {
return bugId;
}
public void setBugId(String bugId) {
this.bugId = bugId;
}
public String getTicketId() {
return ticketId;
}
public void setTicketId(String ticketId) {
this.ticketId = ticketId;
}
public String getMsgBody() {
return msgBody;
}
public void setMsgBody(String msgBody) {
this.msgBody = msgBody;
}
}
\ No newline at end of file
package com.gic.udesk.entity;
import com.gic.udesk.utils.UdeskConstant;
import java.util.Date;
/**
* tab_udesk_tapd_rel
*/
public class TabUdeskTapdRel {
/**
* 关联id
*/
private Integer id;
/**
* 关联类型,1:模块关联,2:处理人关联,3:录入客服关联,4:严重程度关联
*/
private Integer relType;
/**
* tapd项目id
*/
private String workspaceId;
/**
* udesk字段id的key
*/
private String udeskIdKey;
/**
* udesk字段id的value
*/
private String udeskIdValue;
/**
* udesk字段名称
*/
private String udeskName;
/**
* tapd字段id
*/
private String tapdId;
/**
* tapd字段名称
*/
private String tapdName;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
* 状态(0:删除;1:正常)
*/
private Integer status;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getRelType() {
return relType;
}
public void setRelType(Integer relType) {
this.relType = relType;
}
public String getWorkspaceId() {
return workspaceId;
}
public void setWorkspaceId(String workspaceId) {
this.workspaceId = workspaceId;
}
public String getUdeskIdKey() {
return udeskIdKey;
}
public void setUdeskIdKey(String udeskIdKey) {
this.udeskIdKey = udeskIdKey;
}
public String getUdeskIdValue() {
return udeskIdValue;
}
public void setUdeskIdValue(String udeskIdValue) {
this.udeskIdValue = udeskIdValue;
}
public String getUdeskName() {
return udeskName;
}
public void setUdeskName(String udeskName) {
this.udeskName = udeskName;
}
public String getTapdId() {
return tapdId;
}
public void setTapdId(String tapdId) {
this.tapdId = tapdId;
}
public String getTapdName() {
return tapdName;
}
public void setTapdName(String tapdName) {
this.tapdName = tapdName;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public TabUdeskTapdRel() {
}
public TabUdeskTapdRel(Integer relType, String udeskIdKey, String udeskIdValue, String udeskName, String tapdId,
String tapdName) {
this.relType = relType;
this.udeskIdKey = udeskIdKey;
this.udeskIdValue = udeskIdValue;
this.udeskName = udeskName;
this.tapdId = tapdId;
this.tapdName = tapdName;
this.status = UdeskConstant.UNDELETED;
}
public TabUdeskTapdRel(String workspaceId,Integer relType, String udeskIdKey, String udeskName, String tapdId,
String tapdName) {
this.workspaceId = workspaceId;
this.relType = relType;
this.udeskIdKey = udeskIdKey;
this.udeskName = udeskName;
this.tapdId = tapdId;
this.tapdName = tapdName;
this.status = UdeskConstant.UNDELETED;
}
}
\ No newline at end of file
package com.gic.udesk.entity;
import java.util.Date;
/**
* tab_udesk_ticket
*/
public class TabUdeskTicket {
/**
* 工单id
*/
private Integer id;
/**
* 工单编号
*/
private String fieldNum;
/**
* 标题
*/
private String subject;
/**
* 客户id
*/
private Integer userId;
/**
* 客户姓名
*/
private String userName;
/**
* 客户所属公司id
*/
private Integer organizationId;
/**
* 客户所属公司名称
*/
private String organizationName;
/**
* 创建人id
*/
private Integer creatorId;
/**
* 受理客服id
*/
private Integer assigneeId;
/**
* 受理客服姓名
*/
private String assigneeName;
/**
* 优先级中文名称
*/
private String priority;
/**
* 状态英文名称
*/
private String statusEn;
/**
*
*/
private String statusTapd;
/**
* 提报人
*/
private String reporter;
/**
* TPAD的bug_id
*/
private String bugId;
/**
* TPAD项目id
*/
private String workspaceId;
/**
* TPAD当前处理人
*/
private String currentOwner;
/**
* udesk客服名称--tapd创建人
*/
private String serviceStaff;
/**
* 严重程度
*/
private String severity;
/**
* 开始解决时间
*/
private String solvingAt;
/**
* 最后回复时间
*/
private String repliedAt;
/**
* 解决时间
*/
private String resolvedAt;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
* 状态(0:删除;1:未删除)
*/
private Integer status;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getFieldNum() {
return fieldNum;
}
public void setFieldNum(String fieldNum) {
this.fieldNum = fieldNum;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Integer getOrganizationId() {
return organizationId;
}
public void setOrganizationId(Integer organizationId) {
this.organizationId = organizationId;
}
public String getOrganizationName() {
return organizationName;
}
public void setOrganizationName(String organizationName) {
this.organizationName = organizationName;
}
public Integer getCreatorId() {
return creatorId;
}
public void setCreatorId(Integer creatorId) {
this.creatorId = creatorId;
}
public Integer getAssigneeId() {
return assigneeId;
}
public void setAssigneeId(Integer assigneeId) {
this.assigneeId = assigneeId;
}
public String getAssigneeName() {
return assigneeName;
}
public void setAssigneeName(String assigneeName) {
this.assigneeName = assigneeName;
}
public String getPriority() {
return priority;
}
public void setPriority(String priority) {
this.priority = priority;
}
public String getStatusEn() {
return statusEn;
}
public void setStatusEn(String statusEn) {
this.statusEn = statusEn;
}
public String getStatusTapd() {
return statusTapd;
}
public void setStatusTapd(String statusTapd) {
this.statusTapd = statusTapd;
}
public String getReporter() {
return reporter;
}
public void setReporter(String reporter) {
this.reporter = reporter;
}
public String getBugId() {
return bugId;
}
public void setBugId(String bugId) {
this.bugId = bugId;
}
public String getWorkspaceId() {
return workspaceId;
}
public void setWorkspaceId(String workspaceId) {
this.workspaceId = workspaceId;
}
public String getCurrentOwner() {
return currentOwner;
}
public void setCurrentOwner(String currentOwner) {
this.currentOwner = currentOwner;
}
public String getServiceStaff() {
return serviceStaff;
}
public void setServiceStaff(String serviceStaff) {
this.serviceStaff = serviceStaff;
}
public String getSeverity() {
return severity;
}
public void setSeverity(String severity) {
this.severity = severity;
}
public String getSolvingAt() {
return solvingAt;
}
public void setSolvingAt(String solvingAt) {
this.solvingAt = solvingAt;
}
public String getRepliedAt() {
return repliedAt;
}
public void setRepliedAt(String repliedAt) {
this.repliedAt = repliedAt;
}
public String getResolvedAt() {
return resolvedAt;
}
public void setResolvedAt(String resolvedAt) {
this.resolvedAt = resolvedAt;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
\ No newline at end of file
package com.gic.udesk.service;
import com.gic.udesk.entity.TabUdeskException;
public interface UdeskExceptionService {
/**
* 记录接口异常信息
* @Title: save

* @Description:

 * @author guojuxing
* @param record

* @return int


 */
int save(TabUdeskException record);
}
package com.gic.udesk.service;
import com.gic.udesk.entity.TabUdeskMessage;
public interface UdeskMessageService {
/**
* 新增消息
* @Title: save

* @Description:

 * @author guojuxing
* @param record

* @return int
 主键ID

 */
int save(TabUdeskMessage record);
int update(TabUdeskMessage record);
}
package com.gic.udesk.service;
import com.gic.udesk.entity.TabUdeskTapdRel;
import java.util.List;
public interface UdeskTapdRelService {
/**
* 查询所有有效的数据
* @Title: list

* @Description:

 * @author guojuxing 

* @return java.util.List<com.gic.udesk.entity.TabUdeskTapdRel>


 */
List<TabUdeskTapdRel> list(TabUdeskTapdRel record);
/**
* 保存
* @Title: save

* @Description:

 * @author guojuxing
* @param record

* @return int


 */
int save(TabUdeskTapdRel record);
/**
* 删除
* @Title: deleteByWorkspaceId

* @Description:

 * @author guojuxing
* @param relType 关联类型
* @param workspace_id
 tapd项目id
* @return int


 */
int deleteByWorkspaceId(int relType, String workspace_id);
}
package com.gic.udesk.service;
import com.gic.udesk.entity.TabUdeskTicket;
import java.util.List;
public interface UdeskTicketService {
int save(TabUdeskTicket record);
int update(TabUdeskTicket record);
/**
* 主键ID查询记录
* @Title: getById

* @Description:

 * @author guojuxing
* @param id

* @return com.gic.udesk.entity.TabUdeskTicket


 */
TabUdeskTicket getById(Integer id);
List<TabUdeskTicket> list(TabUdeskTicket params);
}
package com.gic.udesk.service.impl;
import com.gic.udesk.dao.mapper.TabUdeskExceptionMapper;
import com.gic.udesk.entity.TabUdeskException;
import com.gic.udesk.service.UdeskExceptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service("udeskExceptionService")
public class UdeskExceptionServiceImpl implements UdeskExceptionService{
@Autowired
private TabUdeskExceptionMapper tabUdeskExceptionMapper;
@Override
public int save(TabUdeskException record) {
record.setCreateTime(new Date());
return tabUdeskExceptionMapper.insert(record);
}
}
package com.gic.udesk.service.impl;
import com.gic.udesk.dao.mapper.TabUdeskMessageMapper;
import com.gic.udesk.entity.TabUdeskMessage;
import com.gic.udesk.service.UdeskMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service("udeskMessageService")
public class UdeskMessageServiceImpl implements UdeskMessageService{
@Autowired
private TabUdeskMessageMapper tabUdeskMessageMapper;
@Override
public int save(TabUdeskMessage record) {
record.setCreateTime(new Date());
record.setUpdateTime(new Date());
record.setStatus(1);
tabUdeskMessageMapper.insertSelective(record);
return record.getId();
}
@Override
public int update(TabUdeskMessage record) {
record.setUpdateTime(new Date());
return tabUdeskMessageMapper.updateByPrimaryKeySelective(record);
}
}
package com.gic.udesk.service.impl;
import com.gic.udesk.dao.mapper.TabUdeskTapdRelMapper;
import com.gic.udesk.entity.TabUdeskTapdRel;
import com.gic.udesk.service.UdeskTapdRelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service("udeskTapdRelService")
public class UdeskTapdRelServiceImpl implements UdeskTapdRelService{
@Autowired
private TabUdeskTapdRelMapper tabUdeskTapdRelMapper;
@Override
public List<TabUdeskTapdRel> list(TabUdeskTapdRel record) {
return tabUdeskTapdRelMapper.list(record);
}
@Override
public int save(TabUdeskTapdRel record) {
record.setCreateTime(new Date());
record.setUpdateTime(new Date());
record.setStatus(1);
return tabUdeskTapdRelMapper.insertSelective(record);
}
@Override
public int deleteByWorkspaceId(int relType, String workspace_id) {
return tabUdeskTapdRelMapper.deleteByWorkspaceId(relType, workspace_id);
}
}
package com.gic.udesk.service.impl;
import com.gic.udesk.dao.mapper.TabUdeskTicketMapper;
import com.gic.udesk.entity.TabUdeskTicket;
import com.gic.udesk.service.UdeskTicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service("udeskTicketService")
public class UdeskTicketServiceImpl implements UdeskTicketService{
@Autowired
private TabUdeskTicketMapper tabUdeskTicketMapper;
@Override
public int save(TabUdeskTicket record) {
record.setCreateTime(new Date());
record.setUpdateTime(new Date());
record.setStatus(1);
return tabUdeskTicketMapper.insertSelective(record);
}
@Override
public int update(TabUdeskTicket record) {
record.setUpdateTime(new Date());
return tabUdeskTicketMapper.updateByPrimaryKeySelective(record);
}
@Override
public TabUdeskTicket getById(Integer id) {
return tabUdeskTicketMapper.selectByPrimaryKey(id);
}
@Override
public List<TabUdeskTicket> list(TabUdeskTicket params) {
return tabUdeskTicketMapper.list(params);
}
}
package com.gic.udesk.service.outer.impl;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.error.ErrorCode;
import com.gic.udesk.dto.TapdCustomFieldConfig;
import com.gic.udesk.dto.TapdRespCustomFieldDTO;
import com.gic.udesk.dto.TapdRespCustomFieldDataDTO;
import com.gic.udesk.entity.TabUdeskTapdRel;
import com.gic.udesk.service.TapdConfigApiService;
import com.gic.udesk.service.UdeskBaseApiService;
import com.gic.udesk.service.UdeskTapdRelService;
import com.gic.udesk.utils.UdeskConstant;
import com.gic.udesk.utils.UdeskHttpClientUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("tapdConfigApiService")
public class TapdConfigApiServiceImpl implements TapdConfigApiService {
private static Logger logger = LogManager.getLogger(TapdConfigApiServiceImpl.class);
@Autowired
private UdeskBaseApiService udeskBaseApiService;
@Autowired
private UdeskTapdRelService udeskTapdRelService;
/**
* tapd获取缺陷自定义字段配置
* 接口路径
*/
private static final String CUSTOM_FIELDS_SETTINGS = "/bugs/custom_fields_settings";
@Override
public ServiceResponse<String> setTapdCustomFieldRelUdesk(String workspaceId) {
Map<String, Object> param = new HashMap<>(4);
param.put("workspace_id", workspaceId);
logger.info("获取TAPD缺陷自定义字段入参为{}", workspaceId);
String customFieldsStr = UdeskHttpClientUtil.getTapdJsonFromParam(CUSTOM_FIELDS_SETTINGS, param);
logger.info("获取TAPD缺陷自定义字段返回为{}", customFieldsStr);
//转为对象
TapdRespCustomFieldDTO tapdCustomField = JSON.parseObject(customFieldsStr, TapdRespCustomFieldDTO.class);
if (tapdCustomField.getStatus() == UdeskConstant.TAPD_RESP_SUCCESS_STATUS) {
//9 : tapd的项目ID和udesk的自定义字段的关联
udeskTapdRelService.deleteByWorkspaceId(9, workspaceId);
List<TapdRespCustomFieldDataDTO> customFieldData = tapdCustomField.getData();
for (TapdRespCustomFieldDataDTO customField : customFieldData) {
TapdCustomFieldConfig customFieldConfig = customField.getCustomFieldConfig();
String name = customFieldConfig.getName();
String custom_field = customFieldConfig.getCustom_field();
TabUdeskTapdRel tabUdeskTapdRel = null;
//tapd返回的自定义字段数据,没有不变化的ID,所以用名称来匹配
//tapd不同项目建立如录入客服这个自定义字段的时候,对应的key是不确定的,所以用名称来匹配,且用反射来获取值
switch (name) {
case "提报人":
tabUdeskTapdRel = new TabUdeskTapdRel(workspaceId, 9, "getUserName", "客户姓名",
"set" + captureName(custom_field), "提报人");
break;
case "录入客服":
tabUdeskTapdRel = new TabUdeskTapdRel(workspaceId, 9, "getServiceStaff", "录入客服",
"set" + captureName(custom_field), "录入客服");
break;
case "UDESK工单编号":
tabUdeskTapdRel = new TabUdeskTapdRel(workspaceId, 9, "getFieldNum", "UDESK工单编号",
"set" + captureName(custom_field), "UDESK工单编号");
break;
case "公司信息":
tabUdeskTapdRel = new TabUdeskTapdRel(workspaceId, 9, "getOrganizationName", "公司",
"set" + captureName(custom_field), "公司信息");
break;
default:
break;
}
if (tabUdeskTapdRel != null) {
udeskTapdRelService.save(tabUdeskTapdRel);
}
}
} else {
String exceptionRecord = "tapd项目id为" + workspaceId + "查询自定义字段失败,返回为" + customFieldsStr;
logger.info(exceptionRecord);
udeskBaseApiService.saveTapdException(exceptionRecord);
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "查询tapd自定义字段失败");
}
return ServiceResponse.success();
}
/**
* 首字母大写
*/
private String captureName(String name) {
char[] cs = name.toCharArray();
cs[0] -= 32;
return String.valueOf(cs);
}
}
package com.gic.udesk.service.outer.impl;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.udesk.entity.TabUdeskException;
import com.gic.udesk.entity.TabUdeskTapdRel;
import com.gic.udesk.service.UdeskBaseApiService;
import com.gic.udesk.service.UdeskExceptionService;
import com.gic.udesk.service.UdeskTapdRelService;
import com.gic.udesk.utils.UdeskConstant;
import org.apache.commons.collections.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service("udeskBaseApiService")
public class UdeskBaseApiServiceImpl implements UdeskBaseApiService {
private static Logger logger = LogManager.getLogger(UdeskBaseApiServiceImpl.class);
@Autowired
private UdeskExceptionService udeskExceptionService;
@Autowired
private UdeskTapdRelService udeskTapdRelService;
@Resource(name = "udeskTapdRelMap")
private Map<String, String> udeskTapdRelMap;
@PostConstruct
public void init() {
logger.info("初始化udeskTapdRelMap启动。。。。。。。。。。。。。。。");
List<TabUdeskTapdRel> list = udeskTapdRelService.list(null);
if (CollectionUtils.isNotEmpty(list)) {
logger.info("共有" + list.size() + "条数据要处理");
for (TabUdeskTapdRel tabUdeskTapdRel : list) {
Integer relType = tabUdeskTapdRel.getRelType();
if (relType == 1) {
// 1 udesk的业务模块与tapd项目的对应
udeskTapdRelMap.put(tabUdeskTapdRel.getUdeskIdKey() + ":" + tabUdeskTapdRel.getUdeskIdValue(),
tabUdeskTapdRel.getTapdId());
continue;
} else if (relType == 8) {
// 8 udesk状态 -> tapd状态
udeskTapdRelMap.put(tabUdeskTapdRel.getUdeskName(), tabUdeskTapdRel.getTapdId());
continue;
} else if (relType == 5 || relType == 4 || relType == 7) {
// 4 tapd严重程度->udsek 5 tapd状态 -> udesk状态 7 优先级
udeskTapdRelMap.put(tabUdeskTapdRel.getTapdId() + UdeskConstant.MAP_UDESK_ID_VALUE_SUFFIX,
tabUdeskTapdRel.getUdeskIdValue());
udeskTapdRelMap.put(tabUdeskTapdRel.getTapdId() + UdeskConstant.MAP_UDESK_NAME_SUFFIX,
tabUdeskTapdRel.getUdeskName());
if (relType == 4) {
// udesk严重程度字段名:idvalue -> udsek严重程度CN
udeskTapdRelMap.put(tabUdeskTapdRel.getUdeskIdKey() + ":" + tabUdeskTapdRel.getUdeskIdValue(),
tabUdeskTapdRel.getUdeskName());
}
continue;
} else if (relType == 6) {
// 6 客服
udeskTapdRelMap.put(UdeskConstant.UDESK_DEFAULT_AGENT, tabUdeskTapdRel.getUdeskIdValue());
continue;
}
udeskTapdRelMap.put(tabUdeskTapdRel.getUdeskIdKey() + ":" + tabUdeskTapdRel.getUdeskIdValue(),
tabUdeskTapdRel.getUdeskName());
}
logger.info("初始化udeskTapdRelMap完成:" + JSON.toJSONString(udeskTapdRelMap));
}
}
@Override
public ServiceResponse<Void> saveUdeskException(String exceptionRecord) {
TabUdeskException exception = new TabUdeskException();
exception.setExpType(UdeskConstant.UDESK_EXP_TYPE);
exception.setExceptionRecord(exceptionRecord);
udeskExceptionService.save(exception);
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> saveTapdException(String exceptionRecord) {
TabUdeskException exception = new TabUdeskException();
exception.setExpType(UdeskConstant.TAPD_EXP_TYPE);
exception.setExceptionRecord(exceptionRecord);
udeskExceptionService.save(exception);
return ServiceResponse.success();
}
}
package com.gic.udesk.utils;
import org.apache.commons.codec.binary.Base64;
/**
* udesk常量类
* @ClassName: UdeskConstant

* @Description: 

* @author guojuxing

* @date 2019/12/23 3:57 PM

*/
public class UdeskConstant {
/**
* udesk邮箱账号
*/
public static final String EMAIL = "jingjiawei@demogic.com";
/**
* udesk密码
*/
public static final String SECRET = "*ys15658036172";
/**
* udesk API TOKEN
*/
public static final String API_TOKEN = "2a83c020-2309-4064-b4eb-af1367425c99";
/**
* udesk API 请求地址
*/
public static final String UDESK_URI = "http://demogic.udesk.cn/open_api_v1";
/**
* TAPD API 请求地址
*/
public static final String TAPD_URI = "https://api.tapd.cn";
/**
* TAPD 请求地址
*/
public static final String TAPD_HOST = "https://www.tapd.cn/";
/**
* TAPD API ACCOUNT
*/
public static final String TAPD_ACCOUNT = "e6PWqG!l";
/**
* TAPD company_id
*/
public static final int TAPD_COMPANY_ID = 20078731;
/**
* TAPD API SECRET
*/
public static final String TAPD_SECRET = "313EFA55-7D83-D8A6-ECE4-E832CC6844B1";
/**
* TAPD Authorization
*/
public static final String TAPD_AUTH = "Basic " + new Base64().encodeToString((TAPD_ACCOUNT + ":" + TAPD_SECRET).getBytes());
/**
* 已删除
*/
public static final int DELETED = 0;
/**
* 未删除
*/
public static final int UNDELETED = 1;
/**
* 新建工单消息
*/
public static final String TICKET_CREATE = "ticketCreate";
/**
* 更新工单消息
*/
public static final String TICKET_UPDATE = "ticketUpdate";
/**
* udesk请求返回正确码
*/
public static final int UDESK_SUCCESS_CODE = 1000;
/**
* udesk字段指定的tapd处理人
*/
public static final String UDESK_FIELD_OWNER = "SelectField_19948";
/**
* udesk字段客服
*/
public static final String UDESK_FIELD_STAFF = "SelectField_19952";
/**
* udesk字段严重程度
*/
public static final String UDESK_FIELD_SEVERITY = "SelectField_19958";
/**
* udesk字段对应项目
*/
public static final String UDESK_FIELD_WORKSPACE = "SelectField_19946";
/**
* udesk字段发现阶段
*/
public static final String UDESK_FIELD_ORIGINPHASE = "SelectField_23551";
/**
* udesk字段测试类型
*/
public static final String UDESK_FIELD_TESTTYPE = "SelectField_23561";
/**
* udesk字段缺陷类型
*/
public static final String UDESK_FIELD_BUGTYPE = "SelectField_23571";
/**
* udesk字段重现规律
*/
public static final String UDESK_FIELD_FREQUENCY = "SelectField_23581";
/**
* udesk字段多选处理人
*/
public static final String UDESK_FIELD_TRANSACTOR = "SelectField_23591";
/**
* udesk来源的类型异常
*/
public static final String UDESK_EXP_TYPE = "udesk";
/**
* tapd来源的类型异常
*/
public static final String TAPD_EXP_TYPE = "tapd";
/**
* udesk优先级为标准
*/
public static final String UDESK_PRIORITY_NORMAL = "标准";
/**
* tapd优先级为中
*/
public static final String TAPD_PRIORITY_NORMAL = "中";
/**
* tapd默认提报人
*/
public static final String TPAD_REPORTER = "udesk";
/**
* tapd请求返回正确码
*/
public static final int TAPD_RESP_SUCCESS_STATUS = 1;
/**
* UDESK内部备注
*/
public static final String INTERNAL = "internal";
/**
* 加在MAP缓存 udeskId_value Key的后面
*/
public static final String MAP_UDESK_ID_VALUE_SUFFIX = "-value";
/**
* 加在MAP缓存 udesk_name Key的后面
*/
public static final String MAP_UDESK_NAME_SUFFIX = "-name";
/**
* 更新触发创建工单
*/
public static final String UDESK_UPDATE_CREATE = "udesk-update-create";
/**
* UDESK工单主题
*/
public static final String UDESK_TICKET_TOPIC = "ticket";
/**
* UDESK默认回复客服对应map的key
*/
public static final String UDESK_DEFAULT_AGENT = "agent";
/**
* 异常返回null
*/
public static final String NULL = "null";
/**
* 关闭状态
*/
public static final String CLOSED = "closed";
}
package com.gic.udesk.utils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.*;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.util.EntityUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.net.ssl.SSLContext;
import java.io.IOException;
import java.net.URISyntaxException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class UdeskHttpClientUtil {
private static final Logger logger = LogManager.getLogger(UdeskHttpClientUtil.class);
private static PoolingHttpClientConnectionManager connectionManager = null;
private static CloseableHttpClient httpClient = null;
static {
LayeredConnectionSocketFactory sslsf = null;
try {
sslsf = new SSLConnectionSocketFactory(SSLContext.getDefault());
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
.register("https", sslsf).register("http", new PlainConnectionSocketFactory()).build();
connectionManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
connectionManager.setMaxTotal(500);
connectionManager.setDefaultMaxPerRoute(100);
httpClient = HttpClients.custom().setConnectionManager(connectionManager).build();
} catch (NoSuchAlgorithmException e) {
logger.info("加载UdeskHttpClientUtil失败", e);
}
}
/**
* udesk的get请求拼接url参数
*/
public static String getUdeskJsonFromParam(String url, Map<String, Object> param) {
if (param == null) {
param = new HashMap<String, Object>();
}
long timeStamp = System.currentTimeMillis() / 1000;
param.put("email", UdeskConstant.EMAIL);
param.put("timestamp", timeStamp);
param.put("sign", UdeskUtils.getSign(timeStamp));
url = UdeskConstant.UDESK_URI + getURL(url, param);
logger.info(url);
CloseableHttpResponse response = null;
try {
HttpGet httpGet = new HttpGet(url);
response = httpClient.execute(httpGet);
return EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
logger.info("GET请求{}失败", url, e);
} finally {
closeResponse(response);
}
return null;
}
/**
* udesk的post请求,Request Body
*/
public static String postUdeskJsonFromJson(String url, String json) {
long timeStamp = System.currentTimeMillis() / 1000;
url = UdeskConstant.UDESK_URI + url + "?email=" + UdeskConstant.EMAIL + "&timestamp=" + timeStamp + "&sign=" + UdeskUtils.getSign(timeStamp);
logger.info(url);
CloseableHttpResponse response = null;
try {
HttpPost httpPost = new HttpPost(url);
response = getResponse(json, httpPost);
return EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
logger.info("POST请求{}失败,参数为{}", url, json, e);
} finally {
closeResponse(response);
}
return null;
}
/**
* udesk的put请求,Request Body
*/
public static String putUdeskJsonFromJson(String url, String json) {
long timeStamp = System.currentTimeMillis() / 1000;
url = UdeskConstant.UDESK_URI + url + "?email=" + UdeskConstant.EMAIL + "&timestamp=" + timeStamp + "&sign=" + UdeskUtils.getSign(timeStamp);
logger.info(url);
CloseableHttpResponse response = null;
try {
HttpPut httpPut = new HttpPut(url);
if (json != null && (!"".equals(json.trim()))) {
StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
httpPut.setEntity(entity);
}
response = httpClient.execute(httpPut);
return EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
logger.info("PUT请求{}失败,参数为{}", url, json, e);
} finally {
closeResponse(response);
}
return null;
}
/**
* udesk的delete请求拼接url参数
*/
public static String deleteUdeskJsonFromParam(String url, Map<String, Object> param) {
if (param == null) {
param = new HashMap<String, Object>();
}
long timeStamp = System.currentTimeMillis() / 1000;
param.put("email", UdeskConstant.EMAIL);
param.put("timestamp", timeStamp);
param.put("sign", UdeskUtils.getSign(timeStamp));
url = UdeskConstant.UDESK_URI + getURL(url, param);
logger.info(url);
CloseableHttpResponse response = null;
try {
HttpDelete httpDelete = new HttpDelete(url);
response = httpClient.execute(httpDelete);
return EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
logger.info("DELETE请求{}失败", url, e);
} finally {
closeResponse(response);
}
return null;
}
/**
* TAPD的get请求拼接url参数
*/
public static String getTapdJsonFromParam(String url, Map<String, Object> param) {
CloseableHttpResponse response = null;
try {
url = UdeskConstant.TAPD_URI +getURIBuilder(url, param);
logger.info(url);
HttpGet httpGet = new HttpGet(url);
httpGet.setHeader("Authorization", UdeskConstant.TAPD_AUTH);
response = httpClient.execute(httpGet);
return EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
logger.info("GET请求{}失败", url, e);
} finally {
closeResponse(response);
}
return null;
}
/**
* TAPD的post请求拼接url参数
*/
public static String postTapdJsonFromJson(String url, String json) {
url = UdeskConstant.TAPD_URI + url;
logger.info(url);
CloseableHttpResponse response = null;
try {
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Authorization", UdeskConstant.TAPD_AUTH);
response = getResponse(json, httpPost);
return EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
logger.info("POST请求{}失败,参数为{}", url, json, e);
} finally {
closeResponse(response);
}
return null;
}
/**
* 铁臂-使用httpclient自带的URIBuilder建立URI
* @param uri
* @param requestParams
* @return String
* @throws URISyntaxException
*/
private static String getURIBuilder(String uri, Map<String, Object> requestParams) throws URISyntaxException {
URIBuilder uriBuilder = new URIBuilder( uri);
if (requestParams != null && requestParams.size() > 0) {
for (Map.Entry<String, Object> entry : requestParams.entrySet()) {
String key = entry.getKey();
if (StringUtils.isNotBlank(key)) {
uriBuilder.setParameter(key, String.valueOf(entry.getValue()));
}
}
}
return uriBuilder.build().toString();
}
/**
* 拼接URL
*/
private static String getURL(String url, Map<String, Object> param) {
if (param != null && param.size() > 0) {
StringBuilder urlSB = new StringBuilder(url);
Set<Map.Entry<String, Object>> paramSet = param.entrySet();
boolean isFirst = true;
for (Map.Entry<String, Object> entry : paramSet) {
if (isFirst) {
urlSB.append("?");
isFirst = false;
} else {
urlSB.append("&");
}
urlSB.append(entry.getKey()).append("=").append(entry.getValue());
}
return urlSB.toString();
}
return url;
}
/**
* 关闭Response
*/
private static void closeResponse(CloseableHttpResponse response) {
if (response != null) {
try {
response.close();
} catch (Exception e) {
logger.info("关闭response失败", e);
}
}
}
/**
* 获取Response
*/
private static CloseableHttpResponse getResponse(String json, HttpPost httpPost)
throws IOException, ClientProtocolException {
CloseableHttpResponse response;
if (json != null && (!"".equals(json.trim()))) {
StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
httpPost.setEntity(entity);
}
response = httpClient.execute(httpPost);
return response;
}
}
package com.gic.udesk.utils;
import org.apache.commons.codec.digest.DigestUtils;
public class UdeskUtils {
public static String getSign(long timeStamp){
return DigestUtils.sha1Hex(UdeskConstant.EMAIL + "&" + UdeskConstant.API_TOKEN + "&" +timeStamp);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="classpath:applicationContext-init.xml"/>
<import resource="classpath:dubbo-gic-platform-udesk-service.xml"/>
<import resource="classpath*:dubbo-setting.xml"/>
<import resource="classpath:jdbc-gic-platform-udesk-service.xml"/>
<import resource="classpath*:redis-init.xml" />
<util:map id="udeskTapdRelMap" map-class="java.util.HashMap"></util:map>
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<context:component-scan base-package="com.gic.udesk.*"/>
<!-- 应用名称 -->
<dubbo:application name="gic-platform-udesk-service"/>
<dubbo:protocol name="dubbo" port="20320"/>
<dubbo:service interface="com.gic.udesk.service.UdeskMessageApiService" ref="udeskMessageApiService" retries="0"/>
<dubbo:service interface="com.gic.udesk.service.TapdConfigApiService" ref="tapdConfigApiService" retries="0"/>
<dubbo:service interface="com.gic.udesk.service.TapdMessageApiService" ref="tapdMessageApiService" retries="0"/>
</beans>
dubbo.registry.file=gic-platform-udesk-service
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:apollo="http://www.ctrip.com/schema/apollo"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.ctrip.com/schema/apollo
http://www.ctrip.com/schema/apollo.xsd">
<context:annotation-config/>
<!--<apollo:config namespaces="COMMON.sharding,COMMON.4.0-jdbc"/>-->
<!--<bean id="dataSource" class="com.gic.sharding.sdk.ShardingDatasource" init-method="init">-->
<!--<property name="shardingId" value="${sharding.shardingId}"/>-->
<!--<property name="maxSize" value="${jdbc.maxsize}"/>-->
<!--<property name="urlType" value="${sharding.urlType:inner}"/>-->
<!--</bean>-->
<import resource="classpath:applicationContext-db-only.xml"/>
<bean class="org.mybatis.spring.SqlSessionFactoryBean" id="sqlSessionFactory">
<property name="dataSource" ref="dataSource"/>
<property name="typeAliasesPackage" value="com.gic.udesk.**.entity"/>
<property name="mapperLocations" value="classpath*:mapper/*.xml"/>
<property name="plugins">
<array>
<!-- 自动生成id -->
<bean class="com.gic.commons.plugin.mybatis.AutoIdInterceptor"/>
<!-- 分页插件 -->
<bean class="com.github.pagehelper.PageInterceptor">
<property name="properties">
<value>
helperDialect=mysql
</value>
</property>
</bean>
</array>
</property>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.gic.udesk.**.dao.mapper"/>
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>
<bean class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- 事务管理器 -->
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<tx:annotation-driven transaction-manager="txManager"/>
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="error" packages="com.gic.commons.log">
<appenders>
<!--这个输出控制台的配置-->
<Console name="Console" target="SYSTEM_OUT">
<!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)-->
<ThresholdFilter level="trace" onMatch="ACCEPT" onMismatch="DENY" />
<!--这个都知道是输出日志的格式-->
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c:%L] [%traceId] %m%n" />
</Console>
</appenders>
<loggers>
<!--建立一个默认的root的logger-->
<Logger name="com.gic" level="DEBUG"/>
<Logger name="org.springframework" level="INFO"/>
<logger name="Sharding-JDBC-SQL" level="INFO"/>
<logger name="org.hibernate.SQL" level="DEBUG"/>
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="DEBUG"/>
<Root level="WARN">
<!--<Root level="DEBUG">-->
<AppenderRef ref="Console" />
</Root>
</loggers>
</configuration>
<?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.gic.udesk.dao.mapper.TabUdeskEnterpriseMapper">
<resultMap id="BaseResultMap" type="com.gic.udesk.entity.TabUdeskEnterprise">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="business_module" jdbcType="VARCHAR" property="businessModule" />
<result column="business_module_name" jdbcType="VARCHAR" property="businessModuleName" />
<result column="business_type" jdbcType="INTEGER" property="businessType" />
<result column="ticket_id" jdbcType="INTEGER" property="ticketId" />
<result column="ticket_num" jdbcType="CHAR" property="ticketNum" />
<result column="ticket_title" jdbcType="CHAR" property="ticketTitle" />
<result column="ticket_status" jdbcType="VARCHAR" property="ticketStatus" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
id, business_module, business_module_name, business_type, ticket_id, ticket_num,
ticket_title, ticket_status, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_udesk_enterprise
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_udesk_enterprise
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.udesk.entity.TabUdeskEnterprise">
insert into tab_udesk_enterprise (id, business_module, business_module_name,
business_type, ticket_id, ticket_num,
ticket_title, ticket_status, create_time,
update_time)
values (#{id,jdbcType=INTEGER}, #{businessModule,jdbcType=VARCHAR}, #{businessModuleName,jdbcType=VARCHAR},
#{businessType,jdbcType=INTEGER}, #{ticketId,jdbcType=INTEGER}, #{ticketNum,jdbcType=CHAR},
#{ticketTitle,jdbcType=CHAR}, #{ticketStatus,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.gic.udesk.entity.TabUdeskEnterprise">
insert into tab_udesk_enterprise
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="businessModule != null">
business_module,
</if>
<if test="businessModuleName != null">
business_module_name,
</if>
<if test="businessType != null">
business_type,
</if>
<if test="ticketId != null">
ticket_id,
</if>
<if test="ticketNum != null">
ticket_num,
</if>
<if test="ticketTitle != null">
ticket_title,
</if>
<if test="ticketStatus != null">
ticket_status,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="businessModule != null">
#{businessModule,jdbcType=VARCHAR},
</if>
<if test="businessModuleName != null">
#{businessModuleName,jdbcType=VARCHAR},
</if>
<if test="businessType != null">
#{businessType,jdbcType=INTEGER},
</if>
<if test="ticketId != null">
#{ticketId,jdbcType=INTEGER},
</if>
<if test="ticketNum != null">
#{ticketNum,jdbcType=CHAR},
</if>
<if test="ticketTitle != null">
#{ticketTitle,jdbcType=CHAR},
</if>
<if test="ticketStatus != null">
#{ticketStatus,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.udesk.entity.TabUdeskEnterprise">
update tab_udesk_enterprise
<set>
<if test="businessModule != null">
business_module = #{businessModule,jdbcType=VARCHAR},
</if>
<if test="businessModuleName != null">
business_module_name = #{businessModuleName,jdbcType=VARCHAR},
</if>
<if test="businessType != null">
business_type = #{businessType,jdbcType=INTEGER},
</if>
<if test="ticketId != null">
ticket_id = #{ticketId,jdbcType=INTEGER},
</if>
<if test="ticketNum != null">
ticket_num = #{ticketNum,jdbcType=CHAR},
</if>
<if test="ticketTitle != null">
ticket_title = #{ticketTitle,jdbcType=CHAR},
</if>
<if test="ticketStatus != null">
ticket_status = #{ticketStatus,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.udesk.entity.TabUdeskEnterprise">
update tab_udesk_enterprise
set business_module = #{businessModule,jdbcType=VARCHAR},
business_module_name = #{businessModuleName,jdbcType=VARCHAR},
business_type = #{businessType,jdbcType=INTEGER},
ticket_id = #{ticketId,jdbcType=INTEGER},
ticket_num = #{ticketNum,jdbcType=CHAR},
ticket_title = #{ticketTitle,jdbcType=CHAR},
ticket_status = #{ticketStatus,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
<?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.gic.udesk.dao.mapper.TabUdeskExceptionMapper">
<resultMap id="BaseResultMap" type="com.gic.udesk.entity.TabUdeskException">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="exp_type" jdbcType="VARCHAR" property="expType" />
<result column="exception_record" jdbcType="VARCHAR" property="exceptionRecord" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Base_Column_List">
id, exp_type, exception_record, create_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_udesk_exception
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_udesk_exception
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.udesk.entity.TabUdeskException">
insert into tab_udesk_exception (id, exp_type, exception_record,
create_time)
values (#{id,jdbcType=INTEGER}, #{expType,jdbcType=VARCHAR}, #{exceptionRecord,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.gic.udesk.entity.TabUdeskException">
insert into tab_udesk_exception
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="expType != null">
exp_type,
</if>
<if test="exceptionRecord != null">
exception_record,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="expType != null">
#{expType,jdbcType=VARCHAR},
</if>
<if test="exceptionRecord != null">
#{exceptionRecord,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.udesk.entity.TabUdeskException">
update tab_udesk_exception
<set>
<if test="expType != null">
exp_type = #{expType,jdbcType=VARCHAR},
</if>
<if test="exceptionRecord != null">
exception_record = #{exceptionRecord,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.udesk.entity.TabUdeskException">
update tab_udesk_exception
set exp_type = #{expType,jdbcType=VARCHAR},
exception_record = #{exceptionRecord,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
<?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.gic.udesk.dao.mapper.TabUdeskMessageMapper">
<resultMap id="BaseResultMap" type="com.gic.udesk.entity.TabUdeskMessage">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="source" jdbcType="VARCHAR" property="source" />
<result column="topic" jdbcType="VARCHAR" property="topic" />
<result column="event" jdbcType="VARCHAR" property="event" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="bug_id" jdbcType="VARCHAR" property="bugId" />
<result column="ticket_id" jdbcType="VARCHAR" property="ticketId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.gic.udesk.entity.TabUdeskMessage">
<result column="msg_body" jdbcType="LONGVARCHAR" property="msgBody" />
</resultMap>
<sql id="Base_Column_List">
id, source, topic, event, create_time, update_time, status, bug_id, ticket_id
</sql>
<sql id="Blob_Column_List">
msg_body
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from tab_udesk_message
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_udesk_message
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.udesk.entity.TabUdeskMessage">
insert into tab_udesk_message (id, source, topic,
event, create_time, update_time,
status, bug_id, ticket_id,
msg_body)
values (#{id,jdbcType=INTEGER}, #{source,jdbcType=VARCHAR}, #{topic,jdbcType=VARCHAR},
#{event,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{status,jdbcType=INTEGER}, #{bugId,jdbcType=VARCHAR}, #{ticketId,jdbcType=VARCHAR},
#{msgBody,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.gic.udesk.entity.TabUdeskMessage" useGeneratedKeys="true" keyProperty="id">
insert into tab_udesk_message
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="source != null">
source,
</if>
<if test="topic != null">
topic,
</if>
<if test="event != null">
event,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="status != null">
status,
</if>
<if test="bugId != null">
bug_id,
</if>
<if test="ticketId != null">
ticket_id,
</if>
<if test="msgBody != null">
msg_body,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="source != null">
#{source,jdbcType=VARCHAR},
</if>
<if test="topic != null">
#{topic,jdbcType=VARCHAR},
</if>
<if test="event != null">
#{event,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="bugId != null">
#{bugId,jdbcType=VARCHAR},
</if>
<if test="ticketId != null">
#{ticketId,jdbcType=VARCHAR},
</if>
<if test="msgBody != null">
#{msgBody,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.udesk.entity.TabUdeskMessage">
update tab_udesk_message
<set>
<if test="source != null">
source = #{source,jdbcType=VARCHAR},
</if>
<if test="topic != null">
topic = #{topic,jdbcType=VARCHAR},
</if>
<if test="event != null">
event = #{event,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="bugId != null">
bug_id = #{bugId,jdbcType=VARCHAR},
</if>
<if test="ticketId != null">
ticket_id = #{ticketId,jdbcType=VARCHAR},
</if>
<if test="msgBody != null">
msg_body = #{msgBody,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.gic.udesk.entity.TabUdeskMessage">
update tab_udesk_message
set source = #{source,jdbcType=VARCHAR},
topic = #{topic,jdbcType=VARCHAR},
event = #{event,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER},
bug_id = #{bugId,jdbcType=VARCHAR},
ticket_id = #{ticketId,jdbcType=VARCHAR},
msg_body = #{msgBody,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.udesk.entity.TabUdeskMessage">
update tab_udesk_message
set source = #{source,jdbcType=VARCHAR},
topic = #{topic,jdbcType=VARCHAR},
event = #{event,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER},
bug_id = #{bugId,jdbcType=VARCHAR},
ticket_id = #{ticketId,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
<?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.gic.udesk.dao.mapper.TabUdeskTapdRelMapper">
<resultMap id="BaseResultMap" type="com.gic.udesk.entity.TabUdeskTapdRel">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="rel_type" jdbcType="INTEGER" property="relType" />
<result column="workspace_id" jdbcType="CHAR" property="workspaceId" />
<result column="udesk_id_key" jdbcType="CHAR" property="udeskIdKey" />
<result column="udesk_id_value" jdbcType="CHAR" property="udeskIdValue" />
<result column="udesk_name" jdbcType="CHAR" property="udeskName" />
<result column="tapd_id" jdbcType="CHAR" property="tapdId" />
<result column="tapd_name" jdbcType="CHAR" property="tapdName" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="status" jdbcType="INTEGER" property="status" />
</resultMap>
<sql id="Base_Column_List">
id, rel_type, workspace_id, udesk_id_key, udesk_id_value, udesk_name, tapd_id, tapd_name,
create_time, update_time, status
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_udesk_tapd_rel
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_udesk_tapd_rel
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.udesk.entity.TabUdeskTapdRel">
insert into tab_udesk_tapd_rel (id, rel_type, workspace_id,
udesk_id_key, udesk_id_value, udesk_name,
tapd_id, tapd_name, create_time,
update_time, status)
values (#{id,jdbcType=INTEGER}, #{relType,jdbcType=INTEGER}, #{workspaceId,jdbcType=CHAR},
#{udeskIdKey,jdbcType=CHAR}, #{udeskIdValue,jdbcType=CHAR}, #{udeskName,jdbcType=CHAR},
#{tapdId,jdbcType=CHAR}, #{tapdName,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.udesk.entity.TabUdeskTapdRel">
insert into tab_udesk_tapd_rel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="relType != null">
rel_type,
</if>
<if test="workspaceId != null">
workspace_id,
</if>
<if test="udeskIdKey != null">
udesk_id_key,
</if>
<if test="udeskIdValue != null">
udesk_id_value,
</if>
<if test="udeskName != null">
udesk_name,
</if>
<if test="tapdId != null">
tapd_id,
</if>
<if test="tapdName != null">
tapd_name,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="status != null">
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="relType != null">
#{relType,jdbcType=INTEGER},
</if>
<if test="workspaceId != null">
#{workspaceId,jdbcType=CHAR},
</if>
<if test="udeskIdKey != null">
#{udeskIdKey,jdbcType=CHAR},
</if>
<if test="udeskIdValue != null">
#{udeskIdValue,jdbcType=CHAR},
</if>
<if test="udeskName != null">
#{udeskName,jdbcType=CHAR},
</if>
<if test="tapdId != null">
#{tapdId,jdbcType=CHAR},
</if>
<if test="tapdName != null">
#{tapdName,jdbcType=CHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.udesk.entity.TabUdeskTapdRel">
update tab_udesk_tapd_rel
<set>
<if test="relType != null">
rel_type = #{relType,jdbcType=INTEGER},
</if>
<if test="workspaceId != null">
workspace_id = #{workspaceId,jdbcType=CHAR},
</if>
<if test="udeskIdKey != null">
udesk_id_key = #{udeskIdKey,jdbcType=CHAR},
</if>
<if test="udeskIdValue != null">
udesk_id_value = #{udeskIdValue,jdbcType=CHAR},
</if>
<if test="udeskName != null">
udesk_name = #{udeskName,jdbcType=CHAR},
</if>
<if test="tapdId != null">
tapd_id = #{tapdId,jdbcType=CHAR},
</if>
<if test="tapdName != null">
tapd_name = #{tapdName,jdbcType=CHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.udesk.entity.TabUdeskTapdRel">
update tab_udesk_tapd_rel
set rel_type = #{relType,jdbcType=INTEGER},
workspace_id = #{workspaceId,jdbcType=CHAR},
udesk_id_key = #{udeskIdKey,jdbcType=CHAR},
udesk_id_value = #{udeskIdValue,jdbcType=CHAR},
udesk_name = #{udeskName,jdbcType=CHAR},
tapd_id = #{tapdId,jdbcType=CHAR},
tapd_name = #{tapdName,jdbcType=CHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="list" resultMap="BaseResultMap" parameterType="com.gic.udesk.entity.TabUdeskTapdRel">
select <include refid="Base_Column_List"></include>
from tab_udesk_tapd_rel
where status = 1
<if test="relType != null">
and rel_type = #{relType,jdbcType=INTEGER},
</if>
<if test="workspaceId != null">
and workspace_id = #{workspaceId,jdbcType=CHAR},
</if>
<if test="tapdName != null">
and tapd_name = #{tapdName,jdbcType=CHAR},
</if>
<if test="udeskName != null">
and udesk_name = #{udeskName,jdbcType=CHAR},
</if>
</select>
<update id="deleteByWorkspaceId">
update tab_udesk_tapd_rel set status = 0
where status = 1
and rel_type = #{relType};
and workspace_id = #{workspace_id}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId>
<version>4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>gic-platform-udesk-web</artifactId>
<version>${libraryVersion}</version>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<url>http://www.demogic.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<libraryVersion>4.0-SNAPSHOT</libraryVersion>
<!-- api依赖,正式版会在 gic-pom-base 里生成 -->
<gic-store-api>4.0-SNAPSHOT</gic-store-api>
<gic-redis-data>4.0-SNAPSHOT</gic-redis-data>
<gic-marketing-api>4.0-SNAPSHOT</gic-marketing-api>
<gic-open-platform-api>4.0-SNAPSHOT</gic-open-platform-api>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-commons</artifactId>
<version>${gic-commons}</version>
<exclusions>
<exclusion>
<artifactId>dubbo</artifactId>
<groupId>com.alibaba</groupId>
</exclusion>
<exclusion>
<artifactId>logback-core</artifactId>
<groupId>ch.qos.logback</groupId>
</exclusion>
<exclusion>
<artifactId>spring-data-redis</artifactId>
<groupId>org.springframework.data</groupId>
</exclusion>
<exclusion>
<artifactId>servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.23.2-GA</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-platform-config</artifactId>
<version>${gic-platform-config}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-platform-udesk-api</artifactId>
<version>${gic-platform-enterprise-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-enterprise-base-api</artifactId>
<version>${gic-enterprise-base-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-enterprise-common</artifactId>
<version>${gic-enterprise-common}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.1.5.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>logback-classic</artifactId>
<groupId>ch.qos.logback</groupId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.9</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.23</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.11</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.11</version>
</dependency>
<dependency>
<groupId>com.gic </groupId>
<artifactId>gic-redis-data </artifactId>
<version>${gic-redis-data} </version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-platform-enterprise-api</artifactId>
<version>${gic-platform-enterprise-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-enterprise-download</artifactId>
<version>${gic-enterprise-download}</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.5.RELEASE</version>
<configuration>
<mainClass>com.gic.auth.web.Main</mainClass>
<excludeGroupIds>ch.qos.logback</excludeGroupIds>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment