Commit 18ca8bac by jx-art

邮箱发送 删除无用类 --- 测试发送邮箱接口。。。

parent 8503b981
//package com.netease.mail.yanxuan.change.integration.email.conig;
//
//
//import java.util.List;
//import java.util.Optional;
//import java.util.stream.Collectors;
//
//
//import com.netease.mail.yanxuan.change.integration.email.email.JumpLinkModel;
//import com.netease.mail.yanxuan.change.integration.email.email.ProblemConfigureModel;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Component;
//
//import com.ctrip.framework.apollo.spring.annotation.EnableAutoUpdateApolloConfig;
//import com.ctrip.framework.apollo.spring.annotation.ValueMapping;
//
//import lombok.Data;
//import org.springframework.util.CollectionUtils;
///**
// * 第三方平台通用apollo配置
// */
//@Data
//@Component
//@EnableAutoUpdateApolloConfig("3rd.base")
//public class ThirdCommonApolloConfig {
//
// private static final String DEFAULT = "default";
//
// /**
// * 异常超级管理员(各个接入的服务业务架构统一角色id)
// */
// @Value("${abnormalAdminRoleId:7956010101}")
// private Long abnormalAdminRoleId;
//
// /**
// * 各工作台待办跳转链接
// */
// @ValueMapping("${jumpLink:[]}")
// private List<JumpLinkModel> jumpLinkMap;
//
// /**
// * 各工作台邮件
// */
// @ValueMapping("${emailFlowUrl:[]}")
// private List<JumpLinkModel> emailFlowUrl;
//
//
// /**
// * 根据产品号获取跳转链接
// *
// * @param productCode
// * @return
// */
// public Optional<JumpLinkModel> getJumpLinkByProductCode(String productCode) {
// List<JumpLinkModel> list = jumpLinkMap.stream().filter(x -> productCode.equals(x.getProductCode()))
// .collect(Collectors.toList());
// if (!CollectionUtils.isEmpty(list)) {
// return Optional.of(list.get(0));
// } else {
// list = jumpLinkMap.stream().filter(x -> DEFAULT.equals(x.getProductCode())).collect(Collectors.toList());
// if (!CollectionUtils.isEmpty(list)) {
// return Optional.of(list.get(0));
// }
// }
// return Optional.of(jumpLinkMap.get(0));
// }
//
// @ValueMapping("${warehouseConfigureModel:{}}")
// private ProblemConfigureModel warehouseConfigureModel;
//
// @ValueMapping("${carrierConfigureModel:{}}")
// private ProblemConfigureModel carrierConfigureModel;
//
//}
package com.netease.mail.yanxuan.change.integration.email.dto;
import lombok.Data;
@Data
public class DeptIdLevelLeaderDTO {
private Integer level;
private Boolean locked;
private Integer orgPosId;
private String orgPosName;
private Integer parentOrgPosId;
private Integer postType;
private Integer rootOrgPosId;
private Integer staffStatus;
private String uid;
private Long userId;
private String userName;
private Integer userType;
}
package com.netease.mail.yanxuan.change.integration.email.dto;
import java.io.Serializable;
public class OrgPosDTO implements Serializable {
private static final long serialVersionUID = 4406420123437327405L;
private int level;
private long orgPosId;
private String orgPosName;
private long parentOrgPosId;
private Integer posStructType;
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public long getOrgPosId() {
return orgPosId;
}
public void setOrgPosId(long orgPosId) {
this.orgPosId = orgPosId;
}
public String getOrgPosName() {
return orgPosName;
}
public void setOrgPosName(String orgPosName) {
this.orgPosName = orgPosName;
}
public long getParentOrgPosId() {
return parentOrgPosId;
}
public void setParentOrgPosId(long parentOrgPosId) {
this.parentOrgPosId = parentOrgPosId;
}
public int getPosStructType() {
return posStructType;
}
public void setPosStructType(int posStructType) {
this.posStructType = posStructType;
}
}
package com.netease.mail.yanxuan.change.integration.email.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class RoleBaseDTO {
/**
* 角色唯一id
*/
private Long roleId;
/**
* 角色名称
*/
private String name;
private String remark;
private Long updateTime;
/**
* 是否被锁定
*/
private Boolean locked;
/**
* 创建id
*/
private Long creatorId;
private Integer type;
private Long expireTime;
}
package com.netease.mail.yanxuan.change.integration.email.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ThirdOrgPosDTO {
private String deptId;
private Integer level;
private Integer orgPosId;
private String orgPosName;
private Integer parentOrgPosId;
private Integer posStructType;
private Integer rootOrgPosId;
}
package com.netease.mail.yanxuan.change.integration.email.dto;
import lombok.Data;
@Data
public class UserInfoDTO {
private Long createTime;
private Integer deptIdLevel1;
private Integer deptIdLevel2;
private Integer deptIdLevel3;
private Integer deptIdLevel4;
/**
* 一级部门
*/
private String deptLevel1;
/**
* 二级部门
*/
private String deptLevel2;
/**
* 三级部门
*/
private String deptLevel3;
/**
* 四级部门
*/
private String deptLevel4;
private String extEmail;
private Long firstLoginTime;
private Long lastLoginTime;
private Boolean locked;
private String name;
private Integer orgPosId;
private String srcCode;
/**
* 用户的身份信息,0 正式,1 试用,2 外包,3 派遣,4 实习-签三方,5 实习-未签三方,6 离职
*/
private Integer staffStatus;
private String uid;
private Long userId;
private Integer userType;
}
package com.netease.mail.yanxuan.change.integration.email.dto;
import java.io.Serializable;
/**
* @author hzfujieqi
*/
public class UserOrgMetaDTO implements Serializable {
private static final long serialVersionUID = -2381352783777881742L;
//用户职位ID
private long orgPosId;
//用户id
private long userId;
//用户的上一级职位id
private long parentOrgPosId;
//用户的邮箱
private String uid;
//用户的真名
private String userName;
//用户的职位级别
private int level;
//职位名称
private String orgPosName;
//锁定状态
private Boolean locked;
//职位类型
private int posType;
//业务方附加信息
private String extInfo;
public long getOrgPosId() {
return orgPosId;
}
public void setOrgPosId(long orgPosId) {
this.orgPosId = orgPosId;
}
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
public long getParentOrgPosId() {
return parentOrgPosId;
}
public void setParentOrgPosId(long parentOrgPosId) {
this.parentOrgPosId = parentOrgPosId;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public String getOrgPosName() {
return orgPosName;
}
public void setOrgPosName(String orgPosName) {
this.orgPosName = orgPosName;
}
public Boolean getLocked() {
return locked;
}
public void setLocked(Boolean locked) {
this.locked = locked;
}
public int getPosType() {
return posType;
}
public void setPosType(int posType) {
this.posType = posType;
}
public String getExtInfo() {
return extInfo;
}
public void setExtInfo(String extInfo) {
this.extInfo = extInfo;
}
@Override
public String toString() {
return "UserOrgMetaDTO{" + "orgPosId=" + orgPosId + ", userId=" + userId + ", parentOrgPosId=" + parentOrgPosId
+ ", uid='" + uid + '\'' + ", userName='" + userName + '\'' + ", level=" + level + ", orgPosName='"
+ orgPosName + '\'' + ", locked=" + locked + ", posType=" + posType + ", extInfo='" + extInfo + '\'' + '}';
}
}
package com.netease.mail.yanxuan.change.integration.email.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class UserProductRoleStaticsInfosDTO {
private String uid;
private String name;
private Boolean locked;
private Boolean isVirtual;
/**
* 组织身份权限
*/
private List<RoleBaseDTO> groupIdentityProductRoleInfos;
/**
* 特殊权限
*/
private List<RoleBaseDTO> userProductRoleInfoVos;
}
package com.netease.mail.yanxuan.change.integration.email.dto;
import java.util.List;
public class UserUniteOrgMetaDTO extends UserOrgMetaDTO {
private static final long serialVersionUID = -1682465589038072525L;
/**
* 关联类型 type NORMAL(0, "普通职员"), DERECT(1, "指导员"), MANAGER(2, "负责人");
*/
private int type;
/**
* 员工职责
*/
private String duty;
/**
* 员工状态
*/
private int staffStatus;
/**
* 员工工号
*/
private String employeeNum;
/**
* 员工在职信息类型,OAWorkInfoEnum(0-不在OA,1-在严选事业部,2-在外部门)
*/
private int workInfoType;
/**
* 在职状态,EmployeeStateEnum(0-试用,1-正式,5-离职)
*/
private int workState;
/**
* 0-未收藏,1-已收藏
*/
private int focusStatus;
/**
* 所在的其他职位列表,不包含当前职位
*/
private List<OrgPosDTO> multiOrgPoss;
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getDuty() {
return duty;
}
public void setDuty(String duty) {
this.duty = duty;
}
public int getStaffStatus() {
return staffStatus;
}
public void setStaffStatus(int staffStatus) {
this.staffStatus = staffStatus;
}
public String getEmployeeNum() {
return employeeNum;
}
public void setEmployeeNum(String employeeNum) {
this.employeeNum = employeeNum;
}
public int getWorkInfoType() {
return workInfoType;
}
public void setWorkInfoType(int workInfoType) {
this.workInfoType = workInfoType;
}
public int getWorkState() {
return workState;
}
public void setWorkState(int workState) {
this.workState = workState;
}
public int getFocusStatus() {
return focusStatus;
}
public void setFocusStatus(int focusStatus) {
this.focusStatus = focusStatus;
}
public List<OrgPosDTO> getMultiOrgPoss() {
return multiOrgPoss;
}
public void setMultiOrgPoss(List<OrgPosDTO> multiOrgPoss) {
this.multiOrgPoss = multiOrgPoss;
}
}
package com.netease.mail.yanxuan.change.integration.email.email;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class AbnormalBathEventEhcEmailModel {
private String creator;
private String abnormalName;
private String taskFlowId;
private String deliverUserEmail;
private String deliverUserName;
private String cancelUserEmail;
private String cancelUserName;
private String url;
private String discoverDescription;
private String discoverTime;
}
package com.netease.mail.yanxuan.change.integration.email.email;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class AbnormalEhcEmailModel {
/**
* 异常创建人
*/
private String createUid;
/**
* 异常问题名称
*/
private String abnormalName;
/**
* 工单id
*/
private String flowId;
/**
* 异常问题负责人
*/
private String abnormalPrincipalUid;
/**
* 异常问题负责人
*/
private String abnormalPrincipalUserName;
/**
* 操作人邮箱
*/
private String operatorUid;
/**
* 操作人姓名
*/
private String operatorUserName;
/**
* 审批人邮箱
*/
private String approverUid;
/**
* 审批人姓名
*/
private String approverUserName;
/**
* 工单链接
*/
private String flowUrl;
/**
* 发现描述
*/
private String discoverDescription;
/**
* 发现时间
*/
private String discoverTime;
}
package com.netease.mail.yanxuan.change.integration.email.email;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class AbnormalPunishFlowEhcEmailModel {
private String creator;
private String abnormalName;
private String taskFlowId;
private String execUserEmail;
private String execUserName;
private String cancelUserEmail;
private String cancelUserName;
private String deliverUserEmail;
private String deliverUserName;
private String approveUserEmail;
private String approveUserName;
private String url;
private String discoverDescription;
private String discoverTime;
}
package com.netease.mail.yanxuan.change.integration.email.email;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class AbnormalTaskFlowEhcEmailModel {
private String creator;
private String abnormalName;
private String taskFlowId;
private String taskTypeName;
private String execUserEmail;
private String execUserName;
private String cancelUserEmail;
private String cancelUserName;
private String execUser;
private String execName;
private String approveUserEmail;
private String approveUserName;
private String url;
private Integer execUserType;
private String discoverDescription;
private String discoverTime;
private String taskDescription;
}
package com.netease.mail.yanxuan.change.integration.email.email;
import com.netease.mail.yanxuan.change.integration.email.dto.UserProductRoleStaticsInfosDTO;
import lombok.Data;
@Data
public class AllUserProductRoleInfosResponseResult {
private Integer code;
private String errorCode;
private String errorMsg;
private SearchResult<UserProductRoleStaticsInfosDTO> data;
}
\ No newline at end of file
//package com.netease.mail.yanxuan.change.integration.email.email;
//
//import org.assertj.core.util.Lists;
//import lombok.SneakyThrows;
//import org.springframework.beans.BeanUtils;
//
//import java.util.ArrayList;
//import java.util.List;
//
//public class BaseConvertor {
// @SneakyThrows
// public static <T> T convert(Object object, final Class<T> clazz) {
// if (object == null) {
// return null;
// }
// T t = clazz.newInstance();
// BeanUtils.copyProperties(object, t);
// return t;
// }
//
// @SneakyThrows
// public static void copyProperties(Object source, Object target) {
// BeanUtils.copyProperties(source, target);
// }
//
// @SneakyThrows
// public static <T> List<T> convert(List<?> objects, final Class<T> clazz) {
// if (org.apache.commons.collections.CollectionUtils.isEmpty(objects)) {
// return new ArrayList<>();
// }
// List<T> retList = Lists.newArrayList();
// objects.forEach(object -> {
// try {
// T t = clazz.newInstance();
// BeanUtils.copyProperties(object, t);
// retList.add(t);
// } catch (Exception ex) {
// try {
// throw ex;
// } catch (InstantiationException e) {
// e.printStackTrace();
// } catch (IllegalAccessException e) {
// e.printStackTrace();
// }
// }
// });
// return retList;
// }
//}
package com.netease.mail.yanxuan.change.integration.email.email;
/**
* 常量定义
*
* @author lwtang
* @date 2018-10-16
*/
public class Constants {
public static final String EHC_PRODUCT_CODE = "ehc";
public static final Integer ONE_HUNDRED = 100;
public static final Integer ONE_THOUSAND = 1000;
public static final String SQE_NAME = "sqe_name:%s";
public static final Integer MAX_QUERY_SIZE = 200;
public static final String REQUEST_HEADER_PRODUCT_CODE = "product-code";
/**
* GlobalId 自增redis值
*/
public static final String ABNORMAL_FLOW_GLOBAL_ID = "abnormalFlowGlobalId";
public static final String TASK_FLOW_GLOBAL_ID = "taskFlowGlobalId";
/**
* GlobalId前缀
*/
public static final String ABNORMAL_FLOW_GLOBAL_NAME = "QC-ABNORMAL-FLOW-";
/**
* 所有异常工单缓存key
*/
public static final String ALL_ABNORMAL_FLOW_KEY = "all_abnormal_flow";
/**
* 新增工单key
*/
public static final String ADD_NEW_FLOW_KEY = "add_new_flow_%s";
/**
*
*/
public static final String TITLE_1 = "您好,系统内临期、延期的异常、任务处理工单汇总如下,请及时处理!";
/**
*
*/
public static final String TITLE_2 = "您好,您的小组成员临期或过期的异常问题处理工单如下,请及时处理!";
/**
*
*/
public static final String TITLE_3 = "您好,系统内临期、延期的异常、任务处理工单汇总如下,无需您处理,请知悉!";
/**
* 舆情配置附加信息 前N个周期的数据均超过阈值
*/
public static final String ABNORMAL_RULE_EXCEEDING_CYCLE_NUM = "前%s个周期的数据均超过阈值";
/**
* 舆情配置附加信息 前N个周期的数据对比呈现持续上升趋势
*/
public static final String ABNORMAL_RULE_RISING_CYCLE_NUM = "前%s个周期的数据对比呈现持续上升趋势";
/**
* 舆情配置附加信息 且
*/
public static final String ABNORMAL_RULE_AND = "且";
/**
* 舆情配置附加信息 或
*/
public static final String ABNORMAL_RULE_OR = "或";
/**
* 通用配置入口id 谛听标签入库
*/
public static final String COMMON_MAX_ID = "maxId";
/**
* 通用配置入口id 普通标签入库
*/
public static final String COMMON_ID = "maxId";
/**
* 正常工单缓存key
*/
public static final String FLOW_CACHE_KEY = "flow_cache_key";
/**
* 过期工单缓存key
*/
public static final String OVERDUE_FLOW_CACHE_KEY = "overdue_flow_cache_key";
/**
* helios cacheName
*/
public static final String EHC_CACHE_LIST = "EHC_CACHE_LIST";
public static final String EHC_CACHE_STRING = "EHC_CACHE_STRING";
/**
* 正常工单缓存key
*/
public static final String EHC_FLOW_CACHE_KEY = "ehc_flow_cache_key";
/**
* 过期工单缓存key
*/
public static final String EHC_OVERDUE_FLOW_CACHE_KEY = "ehc_overdue_flow_cache_key";
public static final String FLOW_ASSIGNED_PROCESSOR_UID = "flow_assigned_processor_uid_";
public static final String FLOW_APPROVE_USER = "flow_approve_user_";
public static final String AUTO_SUBMIT_FLOW = "auto_submit_flow_";
public static final String APPROVER_USER = "approver_user_";
/**
* 舆情异常创建 退货
*/
public static final String RETURN = "退货";
/**
* 舆情异常创建 差评
*/
public static final String BAD_REVIEW = "差评";
/**
* redis 商品前缀 itemId 退/换货 时间类型 二级问题
*/
public static final String RECEIVE_GOODS = "goods_%s_%s_%s_%s";
/**
* redis 供应商前缀 supplierId 退/换货 时间类型 二级问题
*/
public static final String RECEIVE_SUPPLIER = "goods_%s_%s_%s_%s";
/**
* 异常创建信息 商品
*/
public static final String ABNORMAL_CREATE_FIRST_GOOD = "%s-%s在质量%s排行榜发现商品:%s+%s存在质量问题。";
public static final String ABNORMAL_CREATE_SECOND_GOOD = "该商品总计%s次数%s pcs,销量%s pcs,质量%s率为%s%%。";
public static final String ABNORMAL_CREATE_THIRD_GOOD = "其中当前质量问题:%s,有质量%s%s pcs,该问题质量%s率为%s%%。";
public static final String ABNORMAL_CREATE_FOURTH_GOOD = "该商品历史累计%s率为%s%%。";
/**
* 异常创建信息 userName
*/
public static final String ABNORMAL_CREATE_USER_NAME = "品控工作台";
public static final String ABNORMAL_CREATE_USER_EMAIL = "yanxuan@service.netease.com";
public static final String ABNORMAL_CREATE_PRODUCT_CODE = "ecr";
public static final String ABNORMAL_CREATE_PROBLEM_GOODS = "%s%s,质量问题:%s";
public static final String ABNORMAL_CREATE_PROBLEM_SUPPLIER = "%s%s,质量问题:%s";
/**
* 异常创建信息 供应商
*/
public static final String ABNORMAL_CREATE_FIRST_SUPPLIER = "%s-%s在质量%s排行榜发现商品:%s+%s存在质量问题。";
public static final String ABNORMAL_CREATE_SECOND_SUPPLIER = "该供应商总计%s次数%s pcs,销量%s pcs,质量%s率为%s%%。";
public static final String ABNORMAL_CREATE_THIRD_SUPPLIER = "其中当前质量问题:%s,有质量%s%s pcs,该问题质量%s率为%s%%。";
public static final String ABNORMAL_CREATE_FOURTH_SUPPLIER = "该供应商历史累计%s率为%s%%。";
/**
* 异常创建信息 数据更新异常
*/
public static final String ABNORMAL_CREATE_DATA_UPDATE_NOT = "数仓数据%s未更新。";
public static final String ABNORMAL_CREATE_DATA = "品控ECR舆情监控异常创建,";
/**
* 周
*/
public static final String ABNORMAL_CREATE_WEEKS = "周";
/**
* 月
*/
public static final String ABNORMAL_CREATE_MONTH = "月";
/**
* 节点错误
*/
public static final String FLOWX_NODE_ERROR = "%s节点无法保存或提交";
public static final String SUBMIT_OPERATION = "提交工单";
public static final String AUTO_SUBMIT_OPERATION = "系统自动提交工单";
public static final String SYSTEM_AUTO_SUBMIT_OPERATION = "系统自动提交工单";
public static final String SYSTEM_USERNAME = "系统自动提交";
/**
* 批量事件任务工单TopoID
*/
public static final String BATHTOPOID = "ehc_batch_event_task_flow";
/**
* 批量任务人员类型
*/
public static final String EXECUTORTYPE= "严选人员";
/**
* hash map 初始化大小
*/
public static final Integer INIT_HASH_MAP_SIZE = 10;
public static final String SUPPLIER_PREFIX = "YX";
/**
* 解决措施工单过期缓存key
*/
public static final String EHC_TASK_FLOW_OVERDUE_CACHE_KEY = "ehc_task_flow_overdue_cache_key";
/**
* 解决措施工单正常缓存key
*/
public static final String EHC_TASK_FLOW_CACHE_KEY = "ehc_task_flow_cache_key";
/**
* 供应商惩罚工单过期key
*/
public static final String EHC_PUNISH_FLOW_OVERDUE_CACHE_KEY = "ehc_punish_flow_overdue_cache_key";
/**
* 供应商惩罚工单正常key
*/
public static final String EHC_PUNISH_FLOW_CACHE_KEY = "ehc_punish_flow_cache_key";
/**
* 批量事件工单过期key
*/
public static final String EHC_EVENT_FLOW_OVERDUE_CACHE_KEY = "ehc_event_flow_overdue_cache_key";
/**
* 批量事件工单正常key
*/
public static final String EHC_EVENT_FLOW_CACHE_KEY = "ehc_event_flow_cache_key";
/**
* 对比参数默认值
*/
public static final Integer ALL_VALUE = -1;
// 工单业务数据操作key
public static final String FLOW_OPERATION_KEY = "operation";
public static final String YANXUAN_NOS_PREFIX_URL = "yanxuan.nosdn.127.net";
/**
* 默认一页数据量
*/
public static final Integer DEFAULT_PAGE_SIZE = 10;
/**
* 默认页码
*/
public static final Integer DEFAULT_PAGE_NUM = 1;
/**
* 异常问题名称最大长度
*/
public static final int ABNORMAL_NAME_MAX_LENGTH = 500;
/**
* 异常问题描述最大长度
*/
public static final int ABNORMAL_DISCOVER_DESC_MAX_LENGTH = 800;
/**
* 审核依据最大长度
*/
public static final int ABNORMAL_AUDIT_BASIS_MAX_LENGTH = 50;
/**
* 审核内容最大长度
*/
public static final int ABNORMAL_AUDIT_CONTENT_MAX_LENGTH = 500;
/**
* 标签最大长度
*/
public static final int LABEL_MAX_LENGTH = 2000;
public static final String ABNORMAL_PROBLEM_NAME_WAREHOUSE = "%s仓库涉及%s单延迟未发货";
public static final String ABNORMAL_PROBLEM_DESCRIPTION_WAREHOUSE = "%s仓库涉及%s单延迟未发货";
public static final String ABNORMAL_PROBLEM_NAME_CARRIER = "%sB端运输%s件异常商品";
public static final String ABNORMAL_PROBLEM_DESCRIPTION_CARRIER = "%s从%s到%s的B端干线运输环节,产生%s件异常商品,仓库以物流原因操作转次";
public static final String ABNORMAL_CREATE_NAME = "异常中心";
public static final String ABNORMAL_CREATE_EMAIL = "yanxuan@corp.netease.com";
}
package com.netease.mail.yanxuan.change.integration.email.email;
import com.netease.mail.yanxuan.change.integration.email.dto.DeptIdLevelLeaderDTO;
import lombok.Data;
import java.util.List;
@Data
public class DeptIdLevelResponseResult {
private Integer code;
private String errorMsg;
private String errorCode;
private List<DeptIdLevelLeaderDTO> data;
}
......@@ -32,7 +32,7 @@ public class EmailEhcFactor {
/**
* 邮件类型
*
* @see EmailTypeEnum
* @see
*/
private String type;
}
//package com.netease.mail.yanxuan.change.integration.email.email;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.netease.mail.yanxuan.change.integration.email.conig.RpcTemplate;
//import com.netease.mail.yanxuan.change.common.bean.ResponseCode;
//import com.netease.mail.yanxuan.change.integration.email.exception.RpcException;
//
//import java.io.IOException;
//
//public class EmailTemplateRpcResult<T> implements RpcTemplate.CallHandler<T> {
//
// private static final String CODE = "code";
//
// private static final String RESULT = "data";
//
// private static final String MESSAGE = "errorMessage";
//
// private Class<T> tClass;
//
// public EmailTemplateRpcResult(Class<T> tClass){
// this.tClass = tClass;
// }
//
// @Override
// public T handle(String resp) throws IOException {
// JSONObject rpcResult = JSON.parseObject(resp);
// EmailTemplateResponResult responResult = new EmailTemplateResponResult();
// int code = rpcResult.getIntValue(CODE);
// if(code == ResponseCode.SUCCESS.getCode()){
// String data = rpcResult.getString(RESULT);
// responResult.setData(data);
// return (T) responResult;
// }
// String errorMessage = rpcResult.getString(MESSAGE);
// throw new RpcException("email template response error, code : " + code + " , errorMessage : " + errorMessage);
// }
//}
package com.netease.mail.yanxuan.change.integration.email.email;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.netease.mail.yanxuan.change.integration.email.conig.RpcTemplate;
import com.netease.mail.yanxuan.change.common.bean.ResponseCode;
import com.netease.mail.yanxuan.change.integration.email.exception.RpcException;
import java.io.IOException;
public class EmailTemplateRpcResult<T> implements RpcTemplate.CallHandler<T> {
private static final String CODE = "code";
private static final String RESULT = "data";
private static final String MESSAGE = "errorMessage";
private Class<T> tClass;
public EmailTemplateRpcResult(Class<T> tClass){
this.tClass = tClass;
}
@Override
public T handle(String resp) throws IOException {
JSONObject rpcResult = JSON.parseObject(resp);
EmailTemplateResponResult responResult = new EmailTemplateResponResult();
int code = rpcResult.getIntValue(CODE);
if(code == ResponseCode.SUCCESS.getCode()){
String data = rpcResult.getString(RESULT);
responResult.setData(data);
return (T) responResult;
}
String errorMessage = rpcResult.getString(MESSAGE);
throw new RpcException("email template response error, code : " + code + " , errorMessage : " + errorMessage);
}
}
package com.netease.mail.yanxuan.change.integration.email.email;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class FlowEhcOverTimeEmailModel {
/**
* 主工单
*/
private List<OverTimeUserVo> abnormalEhcEmailModels;
/**
* 子工单
*/
private List<TaskEhcFlowOverTimeEmailModel> taskEhcFlowOverTimeEmailModels;
}
\ No newline at end of file
//package com.netease.mail.yanxuan.change.integration.email.email;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.netease.mail.yanxuan.change.integration.email.conig.RpcTemplate;
//import com.netease.mail.yanxuan.change.common.bean.ResponseCode;
//import com.netease.mail.yanxuan.change.integration.email.exception.RpcException;
//import com.netease.mail.yanxuan.change.integration.email.dto.UserInfoDTO;
//import java.io.IOException;
//
//public class IusRpcResult<T> implements RpcTemplate.CallHandler<T> {
//
// private static final String CODE = "code";
//
// private static final String RESULT = "data";
//
// private static final String ERROR_CODE = "errorCode";
//
// private static final String ERROR_MESSAGE = "errorMsg";
//
// private Class<T> tClass;
//
// public IusRpcResult(Class<T> tClass) {
// this.tClass = tClass;
// }
//
// @Override
// public T handle(String resp) throws IOException {
// JSONObject rpcResult = JSON.parseObject(resp);
// ResponseResult responResult = new ResponseResult();
// int code = rpcResult.getIntValue(CODE);
// if (code == ResponseCode.SUCCESS.getCode()) {
// String data = rpcResult.getString(RESULT);
// UserInfoDTO jsonObject = JSON.parseObject(data, UserInfoDTO.class);
// responResult.setData(jsonObject);
// return (T) responResult;
// }
// String errorMessage = rpcResult.getString(ERROR_MESSAGE);
// Integer errorCode = rpcResult.getInteger(ERROR_CODE);
// throw new RpcException("ius response error, resp=" + JSON.toJSONString(resp) + " , errorCode : " + errorCode
// + " , errorMessage : " + errorMessage);
// }
//}
package com.netease.mail.yanxuan.change.integration.email.email;
import lombok.Data;
@Data
public class JumpLinkModel {
/**
* 产品号
*/
private String productCode;
/**
* 跳转链接
*/
private String url;
}
//package com.netease.mail.yanxuan.change.integration.email.email;
//
//import lombok.Builder;
//import lombok.Data;
//import java.util.List;
//
//@Data
//@Builder
//public class OverTimeFlowVo {
//
// /**
// * 用户邮箱
// */
// private String uid;
//
// /**
// * 工单列表
// */
// private List<OverTimeUserVo> flowIdList;
//
// @Override
// protected Object clone() throws CloneNotSupportedException {
// OverTimeFlowVo vo = (OverTimeFlowVo) super.clone();
// vo.setUid(vo.getUid());
// vo.setFlowIdList(BaseConvertor.convert(vo.getFlowIdList(), OverTimeUserVo.class));
// return vo;
// }
//}
package com.netease.mail.yanxuan.change.integration.email.email;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class OverTimeUserVo {
/**
* 接收人邮箱
*/
private String uid;
/**
* 接收人名字
*/
private String uname;
/**
* 工单id
*/
private String flowId;
/**
* 异常问题名称
*/
private String abnormalName;
/**
* 1:主工单,2:临时措施,3:供应商惩罚,4:批量事件
*
* @see com.netease.mail.yanxuan.ehc.core.meta.enums.FlowCheckTypeEnum
*/
private Integer type;
/**
* 当前节点
*/
private String currentNode;
/**
* 当前节点名称
*/
private String currentNodeName;
/**
* 异常负责人
*/
private String abnormalPrincipalUserName;
/**
* 执行人
*/
private String processUserName;
/**
* 异常问题类型
*/
private Long problemTypeId;
/**
* 异常问题类型名称
*/
private String problemTypeName;
/**
* 对应的监控规则(异常问题工单)
*
* @see com.netease.mail.yanxuan.ehc.core.meta.enums.MonitoringRulesEnum
*/
private String monitoringRule;
/**
* 剩余/延期天数(如果延期展示负数)
*/
private Long surplusDays;
/**
* 时间状态
*
* @see com.netease.mail.yanxuan.ehc.core.meta.enums.EmailTimeStatusEnum
*/
private Integer timeStatus;
/**
* 时间状态
*/
private String timeStatusName;
/**
* 创建时间
*/
private String createTime;
/**
* 截止时间
*/
private String deadLineTime;
/**
* 工单跳转链接
*/
private String flowUrl;
/**
* 部门名称
*/
private String execUserOrgPosName;
}
package com.netease.mail.yanxuan.change.integration.email.email;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Pagination implements Serializable {
/**
* 当前⻚,从1开始
*/
private Integer page;
/**
* ⻚⼤⼩
*/
private Integer size;
/**
* 总⻚数
*/
private Integer totalPage;
/**
* 结果总数
*/
private Integer total;
public Pagination(Integer page, Integer size) {
this.page = page;
this.size = size;
this.total = 0;
this.totalPage = 0;
}
}
//package com.netease.mail.yanxuan.change.integration.email.email;
//
//import com.netease.mail.yanxuan.qc.service.client.meta.abnormal.LabelModel;
//import lombok.Data;
//
//import java.util.List;
//
//@Data
//public class ProblemConfigureModel {
// /**
// * 问题类型配置表id
// */
// private Long problemTypeId;
// /**
// * 异常环节
// */
// private List<LabelModel> abnormalLinks;
// /**
// * 问题分类
// */
// private List<LabelModel> flowProblems;
//}
package com.netease.mail.yanxuan.change.integration.email.email;
import com.netease.mail.yanxuan.change.integration.email.dto.UserInfoDTO;
import lombok.Data;
import java.util.List;
@Data
public class QueryUserInfoResponseResult {
private Integer code;
private String errorMsg;
private String errorCode;
private List<UserInfoDTO> data;
}
package com.netease.mail.yanxuan.change.integration.email.email;
import lombok.Data;
import java.util.List;
@Data
public class QueryUserInfoVO {
/**
* uid
*/
private List<String> uids;
/**
* 物流单号
*/
private Boolean locked;
/**
* 创建时间区间
*/
private Long startCreateTime;
}
package com.netease.mail.yanxuan.change.integration.email.email;
import lombok.Data;
@Data
public class ResponseResult {
private Integer code;
private Integer errorCode;
private Object data;
private String errorMsg;
}
package com.netease.mail.yanxuan.change.integration.email.email;
import com.netease.yanxuan.flowx.sdk.meta.dto.base.UserBaseDTO;
import lombok.Data;
import java.util.List;
@Data
public class RoleResponseResult {
private Integer code;
private Integer errorCode;
private List<UserBaseDTO> data;
private String errorMsg;
}
//package com.netease.mail.yanxuan.change.integration.email.email;
//
//import com.alibaba.fastjson.JSON;
//import com.netease.mail.yanxuan.change.integration.email.conig.RpcTemplate;
//
//import java.io.IOException;
//
///**
// * 直接序列化返回对象
// *
// * @author lwtang
// * @date 2019-02-20
// */
//public class RpcObjectHandler<T> implements RpcTemplate.CallHandler<T> {
//
// private Class<T> tClass;
//
//
// public RpcObjectHandler(Class<T> tClass) {this.tClass = tClass;}
//
// @Override
// public T handle(String resp) throws IOException {
// return JSON.parseObject(resp, tClass);
// }
//}
package com.netease.mail.yanxuan.change.integration.email.email;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SearchResult<T> {
private Pagination pagination;
private List<T> result;
}
\ No newline at end of file
package com.netease.mail.yanxuan.change.integration.email.email;
import lombok.Data;
@Data
public class SupplierEmailResponseResult {
private Integer code;
private String desc;
private Object data;
}
package com.netease.mail.yanxuan.change.integration.email.email;
import lombok.Data;
@Data
public class SupplierEmailSendReq {
/**
* 供应商id
*/
private String supplierId;
/**
* 标题
*/
private String mailSubject;
/**
* 内容
*/
private String mailContent;
private Integer isAllAccountResolved = 1;
}
package com.netease.mail.yanxuan.change.integration.email.email;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class TaskEhcFlowOverTimeEmailModel {
private String taskFlowId;
private String url;
private String abnormalName;
/**
* @see com.netease.mail.yanxuan.ehc.core.meta.enums.AllTaskFlowTypeEnum
*/
private String taskFlowType;
private String uid;
private String uname;
/**
* 待处理人
*/
private String processUserName;
/**
* @see com.netease.mail.yanxuan.ehc.core.meta.enums.EmailTimeStatusEnum
*/
private String timeStatusName;
private String createTime;
private String expectedFinishTime;
private Long delayDay;
/**
* 部门
*/
private String execUserOrgPosName;
}
package com.netease.mail.yanxuan.change.integration.email.email;
import com.netease.mail.yanxuan.change.integration.email.dto.UserUniteOrgMetaDTO;
import lombok.Data;
import java.util.List;
@Data
public class UserUniteOrgMetaResponseResult {
private Integer code;
private String errorMsg;
private String errorCode;
private List<UserUniteOrgMetaDTO> data;
}
package com.netease.mail.yanxuan.change.integration.email.email;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserVO {
/**
* 用户名
*/
private String userName;
/**
* 用户邮箱
*/
private String userEmail;
/**
* 用户部门
*/
private Long orgId;
/**
用户部门名称
*/
private String orgName;
}
package com.netease.mail.yanxuan.change.integration.email.enums;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.util.CollectionUtils;
public enum AllTaskFlowTypeEnum {
/**
* 临时措施
*/
TEMPORARY_MEASURE(1,"临时措施"),
/**
* 纠正措施
*/
CORRECT_MEASURE(2,"纠正措施"),
/**
* 验证结果
*/
VERIFY_RESULT(3,"验证结果"),
/**
* 供应商惩罚措施工单
*/
SUPPLIER_PUNISHMENT(4, "供应商惩罚措施"),
/**
* 批量事件工单
*/
BATCH_EVENT(5, "批量事件");
private Integer type;
private String name;
AllTaskFlowTypeEnum(Integer type, String name) {
this.type = type;
this.name = name;
}
public static String getName(Integer type) {
List<AllTaskFlowTypeEnum> list = Arrays.stream(AllTaskFlowTypeEnum.values())
.filter(e -> e.getType().equals(type)).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(list)) {
return list.get(0).getName();
}
return "";
}
public Integer getType() {
return type;
}
public String getName() {
return name;
}
}
package com.netease.mail.yanxuan.change.integration.email.enums;
import lombok.AllArgsConstructor;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.util.CollectionUtils;
@AllArgsConstructor
public enum ExecUserTypeEnum {
YANXUAN_MEMBER(1,"严选人员"),
SUPPLIER(2,"供应商"),
LOGISTICS_SERVICE_PROVIDER(3,"物流服务商"),
WAREHOUSE_SERVICE_PROVIDER(4,"仓库服务商"),
RETURN_WAREHOUSE_SERVICE_PROVIDER(5,"退货仓服务商");
private int value;
private String name;
public static String getName(Integer type) {
List<ExecUserTypeEnum> collect = Arrays.stream(ExecUserTypeEnum.values())
.filter(e -> e.getValue().equals(type)).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
return collect.get(0).getName();
}
return "";
}
public String getName() {
return name;
}
public Integer getValue() {
return value;
}
}
package com.netease.mail.yanxuan.change.integration.email.enums;
public enum OrgUserTypeEnum {
STAFF(0, "普通员工"),
INSTRUCTOR(1, "指导员"),
PRINCIPAL(2, "负责人");
/**
* 属性值
*/
private int value;
/**
* 属性名称
*/
private String name;
public static OrgUserTypeEnum getByValue(int result) {
for (OrgUserTypeEnum w: OrgUserTypeEnum.values()) {
if (w.getValue() == result) {
return w;
}
}
return null;
}
OrgUserTypeEnum(int value, String name) {
this.value = value;
this.name = name;
}
public int getValue() {
return value;
}
public String getName() {
return name;
}
}
package com.netease.mail.yanxuan.change.integration.email.enums;
import lombok.AllArgsConstructor;
@AllArgsConstructor
public enum ProductCodeEnum {
/**
* 异常管理中心
*/
EHC("ehc", "异常管理中心"),
/**
* 品控
*/
QC("qc", "品控"),
/**
* 承运商平台
*/
CARRIER("carrier", "承运商"),
/**
* 仓配
*/
ARK("ark", "仓配"),
/**
* 商品中心
*/
ITEM_CENTER("ic", "商品中心"),
/**
* 同舟系统
*/
SUPPLIER_API("supplier_api", "同舟"),
/**
* 大黄蜂
*/
HORNET("hornet", "大黄蜂"),
/**
* 供应商协同
*/
YXSUPPLIER("yxsupplier", "供应商协同"),
/**
* 采购
*/
PMC("pmc", "采购"),
/**
* 逆向管理系统
*/
SUPPLIER_RL("yanxuan-supplier-rl", "逆向管理系统"),
/**
* 销退系统
*/
SALES_RETURN("yanxuan-sales-return", "销退系统");
public static ProductCodeEnum getByValue(String code) {
for (ProductCodeEnum c: ProductCodeEnum.values()) {
if (c.getCode().equals(code)) {
return c;
}
}
return null;
}
private String code;
private String name;
public String getCode() {
return code;
}
public String getName() {
return name;
}
}
package com.netease.mail.yanxuan.change.integration.email.enums;
import lombok.AllArgsConstructor;
@AllArgsConstructor
public enum StaffStatusEnum {
/**
* 正式
*/
OFFICIAL(0, "正式"),
/**
* 试用
*/
TRIAL(1, "试用"),
/**
* 外包
*/
WB(2, "外包"),
/**
* 离职
*/
DIMISSION(6, "离职"),
;
public static StaffStatusEnum getByValue(Integer code) {
for (StaffStatusEnum c: StaffStatusEnum.values()) {
if (c.getType().equals(code)) {
return c;
}
}
return null;
}
private Integer type;
private String name;
public Integer getType() {
return type;
}
public String getName() {
return name;
}
}
package com.netease.mail.yanxuan.change.integration.email.exception;
import com.netease.mail.yanxuan.change.integration.email.exception.RpcException;
/**
* http status code 非 200
*
......
//package com.netease.mail.yanxuan.change.integration.email.service;
//
//import com.netease.mail.yanxuan.change.integration.email.email.*;
//import com.netease.mail.yanxuan.change.integration.email.enums.EmailEhcFlowEnum;
//import java.io.File;
//import java.util.Collection;
//import java.util.List;
//
//public interface IEmailEhcService {
// /**
// * 任务工单发送邮件
// *
// * @param toList
// * 收件人列表
// * @param ccList
// * 抄送人列表
// * @param model
// * 要素
// * @param emailEhcFlowEnum
// */
// void sendTaskEmail(Collection<String> toList, Collection<String> ccList, AbnormalTaskFlowEhcEmailModel model,
// EmailEhcFlowEnum emailEhcFlowEnum);
//
// /**
// * 供应商专属邮件发送
// *
// * @param supplierId
// * @param model
// * @param emailEhcFlowEnum
// */
// void sendSupplierEmail(String supplierId, AbnormalTaskFlowEhcEmailModel model, EmailEhcFlowEnum emailEhcFlowEnum);
//
// /**
// * 供应商惩罚工单发送邮件
// *
// * @param toList
// * @param ccList
// * @param model
// * @param emailEhcFlowEnum
// */
// void sendPunishEmail(Collection<String> toList, Collection<String> ccList, AbnormalPunishFlowEhcEmailModel model,
// EmailEhcFlowEnum emailEhcFlowEnum);
//
// /**
// * 异常问题工单发送邮件
// *
// * @param toList
// * 收件人列表
// * @param ccList
// * 抄送人列表.
// * @param emailEhcFlowEnum
// * 邮件模板
// * @param abnormalEhcEmailModel
// * 数据
// */
// void sendAbnormalEmail(Collection<String> toList, Collection<String> ccList, EmailEhcFlowEnum emailEhcFlowEnum,
// AbnormalEhcEmailModel abnormalEhcEmailModel);
//
// /**
// * 批量事件工单发送邮件
// *
// * @param toList
// * @param ccList
// * @param model
// * @param
// */
// void sendBathEventEmail(Collection<String> toList, Collection<String> ccList, AbnormalBathEventEhcEmailModel model,
// EmailEhcFlowEnum emailEhcFlowEnum);
//
// /**
// * 临期/过期工单发送邮件
// *
// * @param toList
// * @param ccList
// * @param model
// * @param emailEhcFlowEnum
// */
// void sendOverTimeEmail(Collection<String> toList, Collection<String> ccList, FlowEhcOverTimeEmailModel model,
// EmailEhcFlowEnum emailEhcFlowEnum);
//
// /**
// * 邮件发送
// *
// * @param toList
// * 收件人列表
// * @param ccList
// * 抄送人列表
// * @param factor
// * 要素
// * @param fileList
// * 附件
// */
// void sendEmail(Collection<String> toList, Collection<String> ccList, EmailEhcFactor factor, List<File> fileList);
//
// /**
// * 获取邮件发送工单地址
// *
// * @param uid
// * @return
// */
// String getEmailContentUrl(String uid);
//
// /**
// * 获取异常任务工单邮件发送地址
// *
// * @param uid
// * @param execUserType
// * @return
// */
// String getTaskFlowEmailUrl(String uid, Integer execUserType);
//}
//package com.netease.mail.yanxuan.change.integration.email.service;
//
//import com.netease.mail.yanxuan.change.integration.email.email.EmailFactor;
//import java.io.File;
//import java.util.Collection;
//import java.util.List;
//
///**
// * 发送邮件
// */
//public interface IEmailService {
//
// /**
// * @param to 收件人
// * @param emailFactor 邮件要素
// */
// void sendEmail(String to, EmailFactor emailFactor);
//
// /**
// * @param toList 收件人列表
// * @param factor 要素
// */
// void sendEmail(Collection<String> toList, EmailFactor factor);
//
// /**
// * @param toList 收件人
// * @param ccList 抄送人
// * @param factor 要素
// * @param fileList 附件
// */
// void sendEmail(String toList, String ccList, EmailFactor factor,List<File> fileList);
//
// /**
// *
// * @param toList 收件人列表
// * @param ccList 抄送人列表
// * @param factor 要素
// */
// void sendEmail(Collection<String> toList, Collection<String> ccList, EmailFactor factor);
//
// /**
// * @param toList 收件人列表
// * @param ccList 抄送人列表
// * @param factor 要素
// * @param fileList 附件
// */
// void sendEmail(Collection<String> toList, Collection<String> ccList, EmailFactor factor, List<File> fileList);
//
//
//}
package com.netease.mail.yanxuan.change.integration.email.service;
import com.netease.mail.yanxuan.change.integration.email.email.EmailFactor;
import java.io.File;
import java.util.Collection;
import java.util.List;
/**
* 发送邮件
*/
public interface IEmailService {
/**
* @param to 收件人
* @param emailFactor 邮件要素
*/
void sendEmail(String to, EmailFactor emailFactor);
/**
* @param toList 收件人列表
* @param factor 要素
*/
void sendEmail(Collection<String> toList, EmailFactor factor);
/**
* @param toList 收件人
* @param ccList 抄送人
* @param factor 要素
* @param fileList 附件
*/
void sendEmail(String toList, String ccList, EmailFactor factor,List<File> fileList);
/**
*
* @param toList 收件人列表
* @param ccList 抄送人列表
* @param factor 要素
*/
void sendEmail(Collection<String> toList, Collection<String> ccList, EmailFactor factor);
/**
* @param toList 收件人列表
* @param ccList 抄送人列表
* @param factor 要素
* @param fileList 附件
*/
void sendEmail(Collection<String> toList, Collection<String> ccList, EmailFactor factor, List<File> fileList);
}
//package com.netease.mail.yanxuan.change.integration.email.service;
//
//import java.util.List;
//
//import com.netease.mail.yanxuan.change.integration.email.dto.DeptIdLevelLeaderDTO;
//import com.netease.mail.yanxuan.change.integration.email.dto.ThirdOrgPosDTO;
//import com.netease.mail.yanxuan.change.integration.email.dto.UserInfoDTO;
//import com.netease.mail.yanxuan.change.integration.email.dto.UserUniteOrgMetaDTO;
//import com.netease.mail.yanxuan.change.integration.email.email.SearchResult;
//import com.netease.mail.yanxuan.change.integration.email.dto.UserProductRoleStaticsInfosDTO;
//import com.netease.mail.yanxuan.change.integration.email.email.UserVO;
//import com.netease.yanxuan.flowx.sdk.meta.dto.base.UserBaseDTO;
//
///**
// * @author jiyuwang 商品是否有模块化受控标准
// */
//public interface IIusService {
//
// /**
// * 获取用户的部门信息和在职情况
// *
// * @param uid
// * @return
// */
// UserInfoDTO getUserInfo(String uid);
//
// /**
// * 查询用户集合,不传时查全部
// * http://yx.mail.netease.com/bee#/interface/list;serviceCode=yanxuan-ius;branchName=master;selectedInterface=1010712
// * @param productCode
// * @param uid
// * @return
// */
// List<UserInfoDTO> queryUserInfo(String productCode, String uid);
//
// /**
// * 根据uid获取部门
// *
// * @param uid
// * @return
// */
// String getOrgByUid(String uid);
//
// /**
// * 判断用户是否离职
// *
// * @param uid
// * @return true: 离职;false: 未离职
// */
// boolean checkUserIsLeave(String uid);
//
// /**
// * 获取部门负责人
// *
// * @param uid
// * @param orgPosId
// * @return
// */
// List<DeptIdLevelLeaderDTO> getDeptIdLevelLeader(String uid, Integer orgPosId);
//
// /**
// * 根据用户获取三级部门负责人
// *
// * @param uid
// * @return
// */
// List<DeptIdLevelLeaderDTO> getThreeLevelDeptLeader(String uid);
//
// /**
// * 获取四级部门负责人
// * @param uid
// * @return
// */
// List<DeptIdLevelLeaderDTO> getForthLevelDeptLeader(String uid);
//
// /**
// * 模糊查询用户信息
// */
// List<UserUniteOrgMetaDTO> fuzzyQueryUserInformation(int queryType, String keyword);
//
// /**
// * 模糊查询用户信息(权限中心)
// */
// List<UserUniteOrgMetaDTO> fuzzyQueryUserInfo(Long orgPosId, int level, int type, int queryType, String keyword);
//
// /**
// * 获得该系统下的该用户组织身份权限或者特殊权限
// *
// * @param staff
// * @param roleId
// * @param orgPosId
// * @param stationId
// * @param locked
// * @param keyword
// * @param curPage
// * @param pageSize
// * @return
// */
// SearchResult<UserProductRoleStaticsInfosDTO> getAllUserProductRoleInfos(Integer staff, Long roleId, Long orgPosId,
// Integer stationId, Integer locked, String keyword, Integer curPage, Integer pageSize);
//
// /**
// * 根据产品号和 roleId 获取用户列表
// *
// * @param productCode
// * @param roleId
// * @return
// */
// List<UserBaseDTO> listUserByRoleId(String productCode, Long roleId);
//
// /**
// * 根据uid获取三级部门人员相关信息
// * @param uid
// * @return
// */
// UserVO lv3UserInfo(String uid);
//
// /**
// * 获取用户所在系统编码(弃用)
// *
// * @param uid
// * @return
// */
// @Deprecated
// List<String> listProductHasUid(String uid);
//
// /**
// * 三级部门查询列表
// * @param name
// * @return
// */
// List<ThirdOrgPosDTO> getThirdOrgPosName(String name);
//
//
//
//
//}
//package com.netease.mail.yanxuan.change.integration.email.service;
//
//
//import com.netease.mail.yanxuan.change.integration.email.email.SupplierEmailResponseResult;
//import com.netease.mail.yanxuan.change.integration.email.email.SupplierEmailSendReq;
//
//public interface ISupplierEmailService {
//
// SupplierEmailResponseResult sendSupplierEmail(SupplierEmailSendReq req);
//}
\ No newline at end of file
//package com.netease.mail.yanxuan.change.integration.email.service;
//
//import java.io.File;
//import java.util.Collection;
//import java.util.List;
//
//public interface IUasEhcClient {
//
// /**
// * 邮件发送
// *
// * @param subject
// * @param content
// * @param toList
// * @param ccList
// * @param fileList
// */
// void sendEmail(String subject, String content, Collection<String> toList, Collection<String> ccList,
// List<File> fileList);
//}
\ No newline at end of file
package com.netease.mail.yanxuan.change.integration.email.service;
import java.io.File;
import java.util.Collection;
import java.util.List;
public interface IUasEhcClient {
/**
* 邮件发送
*
* @param subject
* @param content
* @param toList
* @param ccList
* @param fileList
*/
void sendEmail(String subject, String content, Collection<String> toList, Collection<String> ccList,
List<File> fileList);
}
\ No newline at end of file
package com.netease.mail.yanxuan.change.integration.email.service;
import java.io.File;
import java.util.Collection;
import java.util.List;
/**
* @author WangJiaXiang
* @date 2022/11/28/028$
*/
public interface UasClientService {
void sendEmail(String subject, String content, Collection<String> toList, Collection<String> ccList, List<File> fileList);
}
/*
package com.netease.mail.yanxuan.change.integration.email.service.impl;
import com.netease.mail.yanxuan.change.integration.email.email.EmailFactor;
import com.netease.mail.yanxuan.change.integration.email.enums.EmailTemplateEnum;
import com.netease.mail.yanxuan.change.integration.email.service.IEmailService;
import com.netease.mail.yanxuan.change.integration.email.enums.EmailParamEnum;
import com.netease.mail.yanxuan.change.integration.email.enums.EmailTemplateEnum;
import com.netease.mail.yanxuan.change.common.util.RequestUtil;
import com.netease.mail.yanxuan.qc.service.client.remote.UasClient;
import com.netease.mail.yanxuan.qc.service.client.utils.http.HttpClientTemplate;
import com.netease.mail.yanxuan.change.integration.email.service.UasClientService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.PostConstruct;
import java.io.File;
import java.util.Arrays;
import java.util.Collection;
......@@ -26,20 +20,11 @@ import java.util.stream.Collectors;
public class EmailServiceImpl implements IEmailService {
@Autowired
private UasClient uasClient;
private UasClientService uasClient;
@Autowired
private EmailTemplateServiceImpl emailTemplateService;
@Autowired
private HttpClientTemplate httpClientTemplate;
@PostConstruct
private void init() {
httpClientTemplate.init();
httpClientTemplate.setDefaultCharset(RequestUtil.CHAR_SET);
}
@Override
@Async("asyncEmail")
public void sendEmail(String to, EmailFactor emailFactor) {
......@@ -79,7 +64,7 @@ public class EmailServiceImpl implements IEmailService {
if (!CollectionUtils.isEmpty(ccList)) {
ccList = ccList.stream().filter(e -> e != null).collect(Collectors.toList());
}
this.uasClient.sendEmail(factor.getSubject(), content, toList, ccList, null);
uasClient.sendEmail(factor.getSubject(), content, toList, ccList, null);
}
}
......@@ -104,17 +89,17 @@ public class EmailServiceImpl implements IEmailService {
if (!CollectionUtils.isEmpty(ccList)) {
ccList = ccList.stream().filter(e -> e != null).collect(Collectors.toList());
}
this.uasClient.sendEmail(subject, content, toList, ccList, fileList);
uasClient.sendEmail(subject, content, toList, ccList, fileList);
}
}
*/
/**
/**
* 根据邮件模版获取邮件内容
*
* @param emailFactor
* @return
*//*
*/
public String content(EmailFactor emailFactor) {
EmailTemplateEnum emailTemplateEnum = emailFactor.getEmailTemplateEnum();
......@@ -123,4 +108,4 @@ public class EmailServiceImpl implements IEmailService {
}
}
*/
/*
package com.netease.mail.yanxuan.change.integration.email.service.impl;
import com.alibaba.fastjson.JSONObject;
......@@ -34,4 +33,3 @@ public class EmailTemplateServiceImpl {
return emailTemplateResponResult.getData();
}
}
*/
/*
package com.netease.mail.yanxuan.change.integration.email.service.impl;
import java.io.File;
......@@ -6,42 +5,34 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.netease.mail.yanxuan.change.common.bean.ResponseCode;
import com.netease.mail.yanxuan.change.integration.email.service.IUasEhcClient;
import com.netease.mail.yanxuan.change.integration.flow.email.EmailRpcService;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.netease.mail.yanxuan.qc.service.client.utils.http.HttpClientExecutor;
import com.netease.yanxuan.sc.guard.lib.meta.enums.guard.Type;
@Service
public class IUasClientEhcImpl implements IUasEhcClient {
private static final String PUSH_EMAIL = "/push/email/yanxuan-sc-ehc";
//请求地址 http://127.0.0.1:8550/proxy/online.logistics-uas.service.mailsaas/push/email/yanxuan-sc-ehc
public static final String CODE = "code";
private Logger logger = LoggerFactory.getLogger(EmailEhcServiceImpl.class);
private Logger logger = LoggerFactory.getLogger(IUasClientEhcImpl.class);
@Autowired
private HttpClientExecutor httpClientExecutor;
@Value("${rpc.url.uas.basic}")
private String uasUrl;
private EmailRpcService rpcService;
@Override
public void sendEmail(String subject, String content, Collection<String> toList, Collection<String> ccList,
List<File> fileList) {
if (!CollectionUtils.isEmpty(toList)) {
String url = uasUrl + PUSH_EMAIL;
Map<String, String> params = new HashMap();
params.put("subject", subject);
params.put("content", content);
......@@ -54,7 +45,7 @@ public class IUasClientEhcImpl implements IUasEhcClient {
}
String res = null;
try {
res = this.httpClientExecutor.doPost(url, params);
res = this.rpcService.sendEmailInfo(params);
} catch (Exception e) {
logger.error("[sendEmail] params={}, e={}", JSON.toJSONString(params), e);
}
......@@ -62,11 +53,11 @@ public class IUasClientEhcImpl implements IUasEhcClient {
JSON.toJSONString(ccList), JSON.toJSONString(params), JSON.toJSONString(res));
JSONObject jsonObject = JSON.parseObject(res);
if (jsonObject.getInteger(CODE) != ResponseCode.SUCCESS.getCode()) {
this.logger.error(Type.RPC.toString(), "SendEmail", null,
this.logger.error("SendEmail", null,
"send email failed, subject={},toList={},ccList={}",
new Object[] { subject, JSON.toJSONString(toList), JSON.toJSONString(ccList) });
}
}
}
}
*/
/*
package com.netease.mail.yanxuan.change.integration.email.service.impl;
import com.alibaba.fastjson.JSON;
import com.netease.mail.yanxuan.change.integration.email.conig.RpcTemplate;
import com.netease.mail.yanxuan.change.integration.email.email.RpcObjectHandler;
import com.netease.mail.yanxuan.change.integration.email.email.SupplierEmailResponseResult;
import com.netease.mail.yanxuan.change.integration.email.email.SupplierEmailSendReq;
import com.netease.mail.yanxuan.change.integration.email.service.ISupplierEmailService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Value;
@Service
public class SupplierEmailServiceImpl implements ISupplierEmailService {
private Logger logger = LoggerFactory.getLogger(SupplierEmailServiceImpl.class);
@Autowired
private RpcTemplate rpcTemplate;
@Value("${rpc.url.supplier.purchase}")
private String emailUrl;
*/
/**
* 接口
*//*
private static final String SUPPLIER_EMAIL_SEND = "/api/supplier/msg/sendMail.json";
@Override
public SupplierEmailResponseResult sendSupplierEmail(SupplierEmailSendReq req) {
logger.info("[sendSupplierEmail] req:{}", JSON.toJSONString(req));
SupplierEmailResponseResult responseResult = null;
try {
responseResult = rpcTemplate.postJson(emailUrl+SUPPLIER_EMAIL_SEND,
JSON.toJSONString(req),500, new RpcObjectHandler<>(SupplierEmailResponseResult.class));
}catch (Exception e) {
logger.error("[sendSupplierEmail] 供应商邮件发送失败 e:{}",e.getMessage());
}
if (responseResult == null) {
return null;
}
return responseResult;
}
}
*/
package com.netease.mail.yanxuan.change.integration.email.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.netease.mail.yanxuan.change.integration.email.service.UasClientService;
import com.netease.mail.yanxuan.change.integration.flow.email.EmailRpcService;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.io.File;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author WangJiaXiang
* @date 2022/11/28/028$
*/
@Service
public class UasClientServiceImpl implements UasClientService {
Logger logger = LoggerFactory.getLogger(UasClientServiceImpl.class);
@Autowired
private EmailRpcService service;
/*
*
* emailPath=/push/email/
* rpcConfig.getUasApi()=http://127.0.0.1:8550/proxy/online.logistics-uas.service.mailsaas
* UPLOAD_FILE /push/email/attach/{0}/upload.json
*/
public void sendEmail(String subject, String content, Collection<String> toList, Collection<String> ccList, List<File> fileList) {
if (!CollectionUtils.isEmpty(toList)) {
//String url = MessageFormat.format("http://{0}{1}/{2}", this.thirdPartyDrmConfig.getUasHostInner(), "/push/email/", this.thirdPartyDrmConfig.getUasProduct());
Map<String, String> params = new HashMap();
params.put("subject", subject);
params.put("content", content);
params.put("to", StringUtils.join(toList, ","));
params.put("topic", "qc");
if (!CollectionUtils.isEmpty(ccList)) {
params.put("cc", StringUtils.join(ccList, ","));
}
String res = service.sendEmail(params);
this.logger.info("[op:sendEmail] res={} ", new Object[]{res});
JSONObject jsonObject = JSON.parseObject(res);
if (jsonObject.getInteger("code") != 200) {
this.logger.error("SendEmail", (String)null, "send email failed, subject={},toList={},ccList={}", new Object[]{subject, JSON.toJSONString(toList), JSON.toJSONString(ccList)});
}
}
}
}
//package com.netease.mail.yanxuan.change.integration.email.util;
//
//import java.net.URLDecoder;
//import java.net.URLEncoder;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Map;
//import org.apache.commons.lang3.StringUtils;
//
///**
// * @author lwtang
// * @date 2019-02-19
// */
//public class EncodeUtil {
//
// private static final char[] CHARS = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8',
// '9', 'a', 'b', 'c', 'd', 'e', 'f' };
//
// public static String encode(String text) {
// try {
// return URLEncoder.encode(text, "UTF-8");
// } catch (Exception e) {
// return text;
// }
// }
//
// public static String encodeMap(Map<?, ?> map) {
// List<String> lines = new ArrayList<>();
// for (Map.Entry<?, ?> entry: map.entrySet()) {
// lines.add(String.valueOf(entry.getKey()) + "=" + String.valueOf(entry.getValue()));
// }
// return StringUtils.join(lines, "&");
// }
//
// public static String decode(String text) {
// try {
// return URLDecoder.decode(text, "UTF-8");
// } catch (Exception e) {
// return text;
// }
// }
//
// public static String ASCIIHex(String text) {
// byte[] bytes = text.getBytes();
// char[] chars = new char[bytes.length * 2];
// for (int i = 0; i < bytes.length; i++) {
// chars[2 * i] = CHARS[bytes[i] >> 4];
// chars[2 * i + 1] = CHARS[bytes[i] % 16];
// }
// return new String(chars).toUpperCase();
// }
//
//}
package com.netease.mail.yanxuan.change.integration.email.util;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
/**
* @author lwtang
* @date 2019-02-19
*/
public class EncodeUtil {
private static final char[] CHARS = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8',
'9', 'a', 'b', 'c', 'd', 'e', 'f' };
public static String encode(String text) {
try {
return URLEncoder.encode(text, "UTF-8");
} catch (Exception e) {
return text;
}
}
public static String encodeMap(Map<?, ?> map) {
List<String> lines = new ArrayList<>();
for (Map.Entry<?, ?> entry: map.entrySet()) {
lines.add(String.valueOf(entry.getKey()) + "=" + String.valueOf(entry.getValue()));
}
return StringUtils.join(lines, "&");
}
public static String decode(String text) {
try {
return URLDecoder.decode(text, "UTF-8");
} catch (Exception e) {
return text;
}
}
public static String ASCIIHex(String text) {
byte[] bytes = text.getBytes();
char[] chars = new char[bytes.length * 2];
for (int i = 0; i < bytes.length; i++) {
chars[2 * i] = CHARS[bytes[i] >> 4];
chars[2 * i + 1] = CHARS[bytes[i] % 16];
}
return new String(chars).toUpperCase();
}
}
package com.netease.mail.yanxuan.change.integration.flow.email;
import com.netease.yanxuan.missa.client.annotation.MissaClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.Map;
/**
* @author WangJiaXiang
* @date 2022/11/28/028$
*/
@Service
@MissaClient(serviceCode = "logistics-uas")
public interface EmailRpcService {
//yanxuan-qc-change-system
@PostMapping("/push/email/attach/yanxuan-qc-change-system/upload.json")
String sendEmail(Map<String, String> params);
//
//yanxuan-sc-ehc
@PostMapping("/push/email/bpm_risk_evaluation_11")
String sendEmailInfo(Map<String, String> params);
}
......@@ -17,7 +17,7 @@ import java.util.List;
*/
@Service
@MissaClient(serviceCode = "yanxuan-ius")
public interface FlowIusRpcService {
public interface IusRpcService {
@GetMapping("/v1/qc/user/get")
AjaxResponse<IusUserInfoRsp> queryUserInfo(@RequestParam(name = "uid")String uid);
......
package com.netease.mail.yanxuan.change.web.controller;
import com.alibaba.fastjson.JSONObject;
import com.netease.mail.yanxuan.change.biz.service.InteriorChangeConfigService;
import com.netease.mail.yanxuan.change.common.bean.AjaxResult;
import com.netease.mail.yanxuan.change.biz.service.change.AdminChangeConfigService;
import com.netease.mail.yanxuan.change.dal.meta.model.po.ChangeCommanderPO;
import com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeConfigQueryReq;
import com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeConfigReq;
import com.netease.mail.yanxuan.change.dal.meta.model.rpc.GoodsResponseRpc;
import com.netease.mail.yanxuan.change.integration.email.service.UasClientService;
import com.netease.mail.yanxuan.change.integration.flow.ius.*;
import com.netease.yanxuan.flowx.sdk.meta.controller.communal.AjaxResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
......@@ -114,35 +105,22 @@ public class ChangeConfigController {
}
@Autowired
private FlowIusRpcService iusRpcService;
@GetMapping("/test")
public AjaxResponse<IusUserInfoRsp> queryGoods(){
return iusRpcService.queryUserInfo("grp.gyhtest1001@corp.netease.com");
}
private IusRpcService iusRpcService;
private static Logger logger = LoggerFactory.getLogger(ChangeConfigController.class);
@GetMapping("/test1")
public AjaxResponse<HashMap<String, List<SecondaryDepartments>>> queryGoods1(){
ArrayList<String> strings = new ArrayList<>();
strings.add("grp.gyhtest1001@corp.netease.com");
return iusRpcService.queryDepartment(new IusDepartmentReq(strings));
}
@GetMapping("/test2")
public AjaxResponse<List<OrgPosLeaderChainRsp>> queryGoods2(){
AjaxResponse<List<OrgPosLeaderChainRsp>> objectAjaxResponse = iusRpcService.queryLeaderChain("grp.gyhtest1001@corp.netease.com");
return objectAjaxResponse;
}
//private static Logger logger = LoggerFactory.getLogger(ChangeConfigController.class);
@Autowired
private InteriorChangeConfigService changeConfigService;
private UasClientService iEmailService;
@PostMapping("/test3")
public GoodsResponseRpc queryCommanderInfo(@RequestBody ChangeCommanderPO changeCommander){
return changeConfigService.queryCommanderInfo(changeCommander);
@GetMapping("/test")
public void queryCommanderInfo(){
ArrayList<String> strings = new ArrayList<>();
strings.add("wb.tanglongwei@mesg.corp.netease.com");
iEmailService.sendEmail("测试标题","{\n" +
" \"headline\" : \"测试标题\",\n" +
" \"text\" : \"测试文本内容\"\n" +
"}", strings,null,null);
}
}
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