17 changed files with 481 additions and 161 deletions
@ -0,0 +1,145 @@ |
|||
package com.ccsensptos.tallsdk.bean.vo; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class TallWbsVo { |
|||
|
|||
@Data |
|||
@ApiModel("wbs文件下载链接") |
|||
public static class WbsPath{ |
|||
@ApiModelProperty("下载链接") |
|||
private String url; |
|||
} |
|||
|
|||
/** |
|||
* 项目信息 |
|||
*/ |
|||
@Data |
|||
public static class WbsProjectInfo{ |
|||
//项目id
|
|||
private String projectId; |
|||
//项目名称
|
|||
private String projectName; |
|||
//描述
|
|||
private String description; |
|||
//地点
|
|||
private String address; |
|||
//开始时间(yyyy/MM/dd HH:mm)
|
|||
private String startTime; |
|||
//结束时间(yyyy/MM/dd HH:mm)
|
|||
private String endTime; |
|||
//版本号
|
|||
private String version; |
|||
} |
|||
|
|||
/** |
|||
* 任务信息 |
|||
*/ |
|||
@Data |
|||
public static class WbsTaskInfo{ |
|||
//一级任务id
|
|||
private String firstId; |
|||
//一级任务名称
|
|||
private String firstName; |
|||
//二级任务信息
|
|||
private List<WbsSecondTask> secondTaskList; |
|||
} |
|||
|
|||
/** |
|||
* 二级任务信息 |
|||
*/ |
|||
@Data |
|||
public static class WbsSecondTask{ |
|||
//二级任务id
|
|||
private String detailId; |
|||
//分解后的任务id
|
|||
private String subId; |
|||
//二级任务名称
|
|||
private String taskName; |
|||
//任务描述
|
|||
private String description; |
|||
//开始时间(yyyy/MM/dd HH:mm) 如果有实际时间则以实际时间为准
|
|||
private String startTime; |
|||
//结束时间(yyyy/MM/dd HH:mm) 如果有实际时间则以实际时间为准
|
|||
private String endTime; |
|||
//任务时长
|
|||
private String duration; |
|||
//重要性标签
|
|||
private String label; |
|||
//负责人
|
|||
private String executor; |
|||
//检查人
|
|||
private String checker; |
|||
//交付物id
|
|||
private String deliverId; |
|||
//交付物名称
|
|||
private String deliverName; |
|||
//绩效/即使奖惩
|
|||
private String reward; |
|||
//任务插件1关联id
|
|||
private String pluginOneId; |
|||
//插件1名称
|
|||
private String pluginOneName; |
|||
//任务插件2关联id
|
|||
private String pluginTwoId; |
|||
//插件2名称
|
|||
private String pluginTwoName; |
|||
//任务插件3关联id
|
|||
private String pluginThreeId; |
|||
//插件3名称
|
|||
private String pluginThreeName; |
|||
} |
|||
|
|||
/** |
|||
* 角色成员表信息 |
|||
*/ |
|||
@Data |
|||
public static class WbsRoleInfo{ |
|||
//项目经理
|
|||
private List<WbsRole> pmList; |
|||
//项目成员
|
|||
private List<WbsRole> roleList; |
|||
} |
|||
|
|||
/** |
|||
* 角色信息 |
|||
*/ |
|||
@Data |
|||
public static class WbsRole{ |
|||
//角色id
|
|||
private String roleId; |
|||
//角色名
|
|||
private String roleName; |
|||
//对谁不可见
|
|||
private String repulsion; |
|||
//成员信息
|
|||
private List<WbsMember> memberList; |
|||
} |
|||
|
|||
/** |
|||
* 成员信息 |
|||
*/ |
|||
@Data |
|||
public static class WbsMember{ |
|||
//成员id
|
|||
private String memberId; |
|||
//成员名
|
|||
private String memberName; |
|||
//成员手机号
|
|||
private String memberPhone; |
|||
//奖惩干系人id
|
|||
private String stakeholderId; |
|||
//奖惩干系人名
|
|||
private String stakeholderName; |
|||
//奖惩干系人手机号
|
|||
private String stakeholderPhone; |
|||
} |
|||
} |
@ -0,0 +1,94 @@ |
|||
package com.ccsensptos.tallsdk.util; |
|||
|
|||
import cn.hutool.core.collection.CollectionUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import cn.hutool.http.HttpUtil; |
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.ccsens.util.RestTemplateUtil; |
|||
import com.ccsens.util.bean.message.common.InMessage; |
|||
import com.ccsens.util.bean.message.common.MessageConstant; |
|||
import com.ccsens.util.bean.message.common.MessageRule; |
|||
import com.ccsens.util.exception.BaseException; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallTokenDto; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallTokenVo; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.HashSet; |
|||
import java.util.List; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Component |
|||
@Slf4j |
|||
public class MessageUtil { |
|||
|
|||
public static void sendToUser(List<String> phoneList, Set<String> userIdSet,Object data,MessageConstant.DomainType toDomain,MessageRule rule){ |
|||
if(userIdSet == null){ |
|||
userIdSet = new HashSet<>(); |
|||
} |
|||
//通过手机号获取接收者的userId
|
|||
if(CollectionUtil.isNotEmpty(phoneList)) { |
|||
String getUserIdByPhoneUrl = Constant.GATEWAY_URL + Constant.TALL_GET_USER_ID; |
|||
log.info("调用获取userId接口:{}--{}", getUserIdByPhoneUrl, phoneList); |
|||
String strBody = null; |
|||
try { |
|||
strBody = HttpUtil.post(getUserIdByPhoneUrl, JSON.toJSONString(phoneList)); |
|||
log.info("接口返回信息:{}",strBody); |
|||
} catch (Exception e) { |
|||
log.error("消息发送失败--" + e); |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(strBody); |
|||
if(ObjectUtil.isNotNull(jsonObject)){ |
|||
//请求正确返回则,否则无操作
|
|||
Integer code = jsonObject.getInteger("code"); |
|||
if (code == null || code != 200) { |
|||
throw new BaseException("返回参数异常"); |
|||
} |
|||
//userId
|
|||
JSONArray dataArray = jsonObject.getJSONArray("data"); |
|||
if (CollectionUtil.isNotEmpty(dataArray)) { |
|||
for (Object object : dataArray) { |
|||
userIdSet.add(object.toString()); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
//创建InMessage对象
|
|||
InMessage inMessage = new InMessage(); |
|||
if(ObjectUtil.isNull(toDomain)){ |
|||
toDomain = MessageConstant.DomainType.User; |
|||
} |
|||
inMessage.setToDomain(toDomain); |
|||
inMessage.setTos(userIdSet); |
|||
//如果
|
|||
if(ObjectUtil.isNull(rule)){ |
|||
switch (toDomain){ |
|||
case Server: |
|||
rule = new MessageRule((byte) 1, MessageRule.AckRule.ALWAYS, 10, (byte) 1,0L); |
|||
break; |
|||
case User: |
|||
rule = new MessageRule((byte)0, MessageRule.AckRule.ALWAYS,100,(byte)0,0L); |
|||
break; |
|||
default: |
|||
rule = new MessageRule((byte)0, MessageRule.AckRule.ALWAYS,10,(byte)1,0L); |
|||
break; |
|||
} |
|||
} |
|||
inMessage.setRule(rule); |
|||
inMessage.setData(JSONObject.toJSONString(data)); |
|||
|
|||
String url = Constant.MESSAGE_SEND_TO; |
|||
log.info("调用发送消息接口:{}--{}", url, inMessage); |
|||
try{ |
|||
RestTemplateUtil.postBody(url,inMessage); |
|||
}catch (Exception e){ |
|||
log.error("消息发送失败--" + e); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.ccsens.util; |
|||
|
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
public class ExportPoiUtil { |
|||
|
|||
|
|||
|
|||
public static void main(String[] args) { |
|||
|
|||
//生成一个单元格
|
|||
//将单元格加到行内
|
|||
//将行添加至sheet内
|
|||
//将sheet加到表格内
|
|||
//生成文件
|
|||
} |
|||
|
|||
} |
Loading…
Reference in new issue