135 changed files with 4776 additions and 4773 deletions
@ -1,28 +1,28 @@ |
|||
package com.ccsensptos.tallsdk.api; |
|||
|
|||
import com.ccsens.util.JsonResponse; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Api(tags = "heartbeat" , description = "域信息相关接口") |
|||
@RestController |
|||
@RequestMapping("/tall") |
|||
@Slf4j |
|||
public class HeartbeatController { |
|||
|
|||
@ApiOperation(value = "接收私域的心跳", notes = "") |
|||
@RequestMapping(value = "/heart", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse receiveHeartbeat() throws Exception { |
|||
log.info("接受PTOS_TALL心跳后正确返回"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
|
|||
} |
|||
package com.ccsensptos.tallsdk.api; |
|||
|
|||
import com.ccsens.util.JsonResponse; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Api(tags = "heartbeat" , description = "域信息相关接口") |
|||
@RestController |
|||
@RequestMapping("/tall") |
|||
@Slf4j |
|||
public class HeartbeatController { |
|||
|
|||
@ApiOperation(value = "接收私域的心跳", notes = "") |
|||
@RequestMapping(value = "/heart", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse receiveHeartbeat() throws Exception { |
|||
log.info("接受PTOS_TALL心跳后正确返回"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
|
|||
} |
@ -1,94 +1,94 @@ |
|||
package com.ccsensptos.tallsdk.api; |
|||
|
|||
import com.ccsens.util.WebConstant; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallProjectDto; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallWbsVo; |
|||
import com.ccsensptos.tallsdk.service.ITallService; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallProjectVo; |
|||
import com.ccsens.util.JsonResponse; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import javax.annotation.Resource; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Api(tags = "project" , description = "项目相关接口") |
|||
@RestController |
|||
@RequestMapping("/tall/project") |
|||
@Slf4j |
|||
public class ProjectController { |
|||
|
|||
@Resource |
|||
private ITallService tallService; |
|||
|
|||
@ApiOperation(value = "日历页获取项目列表", notes = "") |
|||
@RequestMapping(value = "/query", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<TallProjectVo.ProjectInfo>> queryProjectByUser(HttpServletRequest request, @ApiParam @Validated @RequestBody TallProjectDto.QueryProjectDto params) throws Exception{ |
|||
log.info("查询用户所有域下所有业务内的所有项目:{}",params); |
|||
List<TallProjectVo.ProjectInfo> projectInfoList = tallService.queryProjectByUser(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params); |
|||
log.info("返回用户所有域下所有业务内的所有项目"); |
|||
return JsonResponse.newInstance().ok(projectInfoList); |
|||
} |
|||
|
|||
|
|||
@ApiOperation(value = "导入Wbs", notes = "") |
|||
@RequestMapping(value = "/wbs", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<TallProjectVo.ProjectInfo> importWbs(HttpServletRequest request, QueryDto<MultipartFile> params,Long parentId) throws Exception{ |
|||
log.info("导入Wbs:{}",params); |
|||
TallProjectVo.ProjectInfo projectInfoList = tallService.importWbs(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam(),parentId); |
|||
log.info("导入Wbs"); |
|||
return JsonResponse.newInstance().ok(projectInfoList); |
|||
} |
|||
|
|||
|
|||
@ApiOperation(value = "导出Wbs", notes = "") |
|||
@RequestMapping(value = "/exportWbs", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<TallWbsVo.WbsPath> exportWbs(HttpServletRequest request,@ApiParam @Validated @RequestBody QueryDto<TallProjectDto.ProjectById> params) throws Exception{ |
|||
log.info("导出Wbs:{}",params); |
|||
TallWbsVo.WbsPath wbsPath = tallService.exportWbs(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam()); |
|||
log.info("Wbs的路径:{}",wbsPath); |
|||
return JsonResponse.newInstance().ok(wbsPath); |
|||
} |
|||
|
|||
@ApiOperation(value = "根据id查询项目信息", notes = "根据id查询项目信息") |
|||
@RequestMapping(value = "/findProjectById", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<TallProjectVo.ProjectInfo> findProjectById(HttpServletRequest request,@ApiParam @Validated @RequestBody QueryDto<TallProjectDto.ProjectById> params) throws Exception{ |
|||
TallProjectVo.ProjectInfo projectById = tallService.findProjectById(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam()); |
|||
return JsonResponse.newInstance().ok(projectById); |
|||
} |
|||
|
|||
|
|||
|
|||
@ApiOperation(value = "删除项目", notes = "") |
|||
@RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<TallProjectVo.ProjectInfo>> deleteProject(HttpServletRequest request, @ApiParam @Validated @RequestBody QueryDto<TallProjectDto.ProjectById> params) throws Exception{ |
|||
log.info("删除项目:{}",params); |
|||
tallService.deleteProject(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam()); |
|||
log.info("删除项目成功"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
|
|||
@ApiOperation(value = "拖拽项目", notes = "") |
|||
@RequestMapping(value = "/drag", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse dragProject(HttpServletRequest request, @ApiParam @Validated @RequestBody TallProjectDto.MoveProject params) throws Exception{ |
|||
log.info("删除项目:{}",params); |
|||
tallService.dragProject(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params); |
|||
log.info("删除项目成功"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
} |
|||
package com.ccsensptos.tallsdk.api; |
|||
|
|||
import com.ccsens.util.WebConstant; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallProjectDto; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallWbsVo; |
|||
import com.ccsensptos.tallsdk.service.ITallService; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallProjectVo; |
|||
import com.ccsens.util.JsonResponse; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import javax.annotation.Resource; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Api(tags = "project" , description = "项目相关接口") |
|||
@RestController |
|||
@RequestMapping("/tall/project") |
|||
@Slf4j |
|||
public class ProjectController { |
|||
|
|||
@Resource |
|||
private ITallService tallService; |
|||
|
|||
@ApiOperation(value = "日历页获取项目列表", notes = "") |
|||
@RequestMapping(value = "/query", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<TallProjectVo.ProjectInfo>> queryProjectByUser(HttpServletRequest request, @ApiParam @Validated @RequestBody TallProjectDto.QueryProjectDto params) throws Exception{ |
|||
log.info("查询用户所有域下所有业务内的所有项目:{}",params); |
|||
List<TallProjectVo.ProjectInfo> projectInfoList = tallService.queryProjectByUser(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params); |
|||
log.info("返回用户所有域下所有业务内的所有项目"); |
|||
return JsonResponse.newInstance().ok(projectInfoList); |
|||
} |
|||
|
|||
|
|||
@ApiOperation(value = "导入Wbs", notes = "") |
|||
@RequestMapping(value = "/wbs", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<TallProjectVo.ProjectInfo> importWbs(HttpServletRequest request, QueryDto<MultipartFile> params,Long parentId) throws Exception{ |
|||
log.info("导入Wbs:{}",params); |
|||
TallProjectVo.ProjectInfo projectInfoList = tallService.importWbs(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam(),parentId); |
|||
log.info("导入Wbs"); |
|||
return JsonResponse.newInstance().ok(projectInfoList); |
|||
} |
|||
|
|||
|
|||
@ApiOperation(value = "导出Wbs", notes = "") |
|||
@RequestMapping(value = "/exportWbs", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<TallWbsVo.WbsPath> exportWbs(HttpServletRequest request,@ApiParam @Validated @RequestBody QueryDto<TallProjectDto.ProjectById> params) throws Exception{ |
|||
log.info("导出Wbs:{}",params); |
|||
TallWbsVo.WbsPath wbsPath = tallService.exportWbs(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam()); |
|||
log.info("Wbs的路径:{}",wbsPath); |
|||
return JsonResponse.newInstance().ok(wbsPath); |
|||
} |
|||
|
|||
@ApiOperation(value = "根据id查询项目信息", notes = "根据id查询项目信息") |
|||
@RequestMapping(value = "/findProjectById", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<TallProjectVo.ProjectInfo> findProjectById(HttpServletRequest request,@ApiParam @Validated @RequestBody QueryDto<TallProjectDto.ProjectById> params) throws Exception{ |
|||
TallProjectVo.ProjectInfo projectById = tallService.findProjectById(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam()); |
|||
return JsonResponse.newInstance().ok(projectById); |
|||
} |
|||
|
|||
|
|||
|
|||
@ApiOperation(value = "删除项目", notes = "") |
|||
@RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<TallProjectVo.ProjectInfo>> deleteProject(HttpServletRequest request, @ApiParam @Validated @RequestBody QueryDto<TallProjectDto.ProjectById> params) throws Exception{ |
|||
log.info("删除项目:{}",params); |
|||
tallService.deleteProject(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam()); |
|||
log.info("删除项目成功"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
|
|||
@ApiOperation(value = "拖拽项目", notes = "") |
|||
@RequestMapping(value = "/drag", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse dragProject(HttpServletRequest request, @ApiParam @Validated @RequestBody TallProjectDto.MoveProject params) throws Exception{ |
|||
log.info("删除项目:{}",params); |
|||
tallService.dragProject(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params); |
|||
log.info("删除项目成功"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
} |
@ -1,45 +1,45 @@ |
|||
package com.ccsensptos.tallsdk.api; |
|||
|
|||
import com.ccsens.util.WebConstant; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallRoleDto; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallRoleVo; |
|||
import com.ccsensptos.tallsdk.service.ITallService; |
|||
import com.ccsens.util.JsonResponse; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Api(tags = "角色相关" , description = "DebugController | ") |
|||
@RestController |
|||
@RequestMapping("/tall/role") |
|||
@Slf4j |
|||
public class RoleController { |
|||
|
|||
@Resource |
|||
private ITallService tallService; |
|||
|
|||
|
|||
|
|||
@ApiOperation(value = "根据项目id查找角色", notes = "") |
|||
@RequestMapping(value = "/show", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<TallRoleVo.QueryRole> queryByProjectId(HttpServletRequest request, @ApiParam @Validated @RequestBody QueryDto<TallRoleDto.QueryRoleById> params) { |
|||
log.info("根据项目id查找角色{}",params); |
|||
TallRoleVo.QueryRole queryRole = tallService.queryShowRole(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam()); |
|||
log.info("项目id查找角色列表{}",queryRole); |
|||
return JsonResponse.newInstance().ok(queryRole); |
|||
} |
|||
|
|||
} |
|||
package com.ccsensptos.tallsdk.api; |
|||
|
|||
import com.ccsens.util.WebConstant; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallRoleDto; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallRoleVo; |
|||
import com.ccsensptos.tallsdk.service.ITallService; |
|||
import com.ccsens.util.JsonResponse; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Api(tags = "角色相关" , description = "DebugController | ") |
|||
@RestController |
|||
@RequestMapping("/tall/role") |
|||
@Slf4j |
|||
public class RoleController { |
|||
|
|||
@Resource |
|||
private ITallService tallService; |
|||
|
|||
|
|||
|
|||
@ApiOperation(value = "根据项目id查找角色", notes = "") |
|||
@RequestMapping(value = "/show", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<TallRoleVo.QueryRole> queryByProjectId(HttpServletRequest request, @ApiParam @Validated @RequestBody QueryDto<TallRoleDto.QueryRoleById> params) { |
|||
log.info("根据项目id查找角色{}",params); |
|||
TallRoleVo.QueryRole queryRole = tallService.queryShowRole(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam()); |
|||
log.info("项目id查找角色列表{}",queryRole); |
|||
return JsonResponse.newInstance().ok(queryRole); |
|||
} |
|||
|
|||
} |
@ -1,93 +1,93 @@ |
|||
package com.ccsensptos.tallsdk.api; |
|||
|
|||
import com.ccsens.util.WebConstant; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import com.ccsensptos.tallsdk.service.ITallService; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallTaskDto; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallTaskVo; |
|||
import com.ccsens.util.JsonResponse; |
|||
import com.github.pagehelper.PageHelper; |
|||
import com.github.pagehelper.PageInfo; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Api(tags = "任务相关" , description = "DebugController | ") |
|||
@RestController |
|||
@RequestMapping("/tall/task") |
|||
@Slf4j |
|||
public class TaskController { |
|||
|
|||
@Resource |
|||
private ITallService tallService; |
|||
|
|||
|
|||
@ApiOperation(value = "查找永久日常任务", notes = "") |
|||
@RequestMapping(value = "/permanent", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<TallTaskVo.QueryTask>> queryPermanentGlobalTask(HttpServletRequest request, @ApiParam @Validated @RequestBody QueryDto<TallTaskDto.QueryPermanentGlobalTask> params) { |
|||
log.info("查找永久日常任务:{}",params); |
|||
List<TallTaskVo.QueryTask> queryTasks = tallService.queryPermanentGlobalTask(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam()); |
|||
log.info("返回日常任务"); |
|||
return JsonResponse.newInstance().ok(queryTasks); |
|||
} |
|||
|
|||
|
|||
@ApiOperation(value = "查找带时间的日常任务", notes = "") |
|||
@RequestMapping(value = "/global", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<TallTaskVo.QueryTask>> queryGlobalTask(HttpServletRequest request, @ApiParam @Validated @RequestBody QueryDto<TallTaskDto.QueryGlobalTask> params) { |
|||
log.info("查找带时间的日常任务:{}",params); |
|||
List<TallTaskVo.QueryTask> queryTasks = tallService.queryGlobalTask(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam()); |
|||
log.info("返回带时间的日常任务"); |
|||
return JsonResponse.newInstance().ok(queryTasks); |
|||
} |
|||
|
|||
|
|||
@ApiOperation(value = "查找定期任务", notes = "") |
|||
@RequestMapping(value = "/regular", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<TallTaskVo.QueryTask>> queryRegularTask(HttpServletRequest request, @ApiParam @Validated @RequestBody QueryDto<TallTaskDto.QueryRegularTask> params) { |
|||
log.info("查找定期任务:{}",params); |
|||
List<TallTaskVo.QueryTask> queryTasks = tallService.queryRegularTask(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam()); |
|||
log.info("返回定期任务"); |
|||
return JsonResponse.newInstance().ok(queryTasks); |
|||
} |
|||
|
|||
// @ApiOperation(value = "查找定期任务和相应的插件展示信息", notes = "")
|
|||
// @RequestMapping(value = "/regular/plugin", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse<List<TallTaskVo.QueryTask>> queryRegularTaskAndPlugin(HttpServletRequest request, @ApiParam @Validated @RequestBody QueryDto<TallTaskDto.QueryRegularTask> params) {
|
|||
// log.info("查找定期任务和相应的插件展示信息:{}",params);
|
|||
// List<TallTaskVo.QueryTask> queryTasks = tallService.queryRegularTaskAndPlugin(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam());
|
|||
// log.info("返回定期任务和相应的插件展示信息");
|
|||
// return JsonResponse.newInstance().ok(queryTasks);
|
|||
// }
|
|||
|
|||
@ApiOperation(value = "分页查找定期任务", notes = "") |
|||
@RequestMapping(value = "/regular/page", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<PageInfo<TallTaskVo.QueryTask>> pageQueryRegularTask(HttpServletRequest request, @ApiParam @Validated @RequestBody QueryDto<TallTaskDto.PageQueryRegularTask> params) { |
|||
log.info("分页查找定期任务:{}",params); |
|||
PageInfo<TallTaskVo.QueryTask> queryTasks = tallService.pageQueryRegularTask(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam()); |
|||
log.info("返回分页查找定期任务"); |
|||
return JsonResponse.newInstance().ok(queryTasks); |
|||
} |
|||
|
|||
@ApiOperation(value = "查看用户所有的任务", notes = "") |
|||
@RequestMapping(value = "/allTask", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<TallTaskVo.QueryTask>> queryAllTask(HttpServletRequest request, @ApiParam @Validated @RequestBody TallTaskDto.QueryAllTask params) { |
|||
log.info("查看用户所有的任务:{}",params); |
|||
List<TallTaskVo.QueryTask> queryTasks = tallService.queryAllTask(params); |
|||
log.info("返回用户所有的任务"); |
|||
return JsonResponse.newInstance().ok(queryTasks); |
|||
} |
|||
} |
|||
package com.ccsensptos.tallsdk.api; |
|||
|
|||
import com.ccsens.util.WebConstant; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import com.ccsensptos.tallsdk.service.ITallService; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallTaskDto; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallTaskVo; |
|||
import com.ccsens.util.JsonResponse; |
|||
import com.github.pagehelper.PageHelper; |
|||
import com.github.pagehelper.PageInfo; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Api(tags = "任务相关" , description = "DebugController | ") |
|||
@RestController |
|||
@RequestMapping("/tall/task") |
|||
@Slf4j |
|||
public class TaskController { |
|||
|
|||
@Resource |
|||
private ITallService tallService; |
|||
|
|||
|
|||
@ApiOperation(value = "查找永久日常任务", notes = "") |
|||
@RequestMapping(value = "/permanent", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<TallTaskVo.QueryTask>> queryPermanentGlobalTask(HttpServletRequest request, @ApiParam @Validated @RequestBody QueryDto<TallTaskDto.QueryPermanentGlobalTask> params) { |
|||
log.info("查找永久日常任务:{}",params); |
|||
List<TallTaskVo.QueryTask> queryTasks = tallService.queryPermanentGlobalTask(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam()); |
|||
log.info("返回日常任务"); |
|||
return JsonResponse.newInstance().ok(queryTasks); |
|||
} |
|||
|
|||
|
|||
@ApiOperation(value = "查找带时间的日常任务", notes = "") |
|||
@RequestMapping(value = "/global", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<TallTaskVo.QueryTask>> queryGlobalTask(HttpServletRequest request, @ApiParam @Validated @RequestBody QueryDto<TallTaskDto.QueryGlobalTask> params) { |
|||
log.info("查找带时间的日常任务:{}",params); |
|||
List<TallTaskVo.QueryTask> queryTasks = tallService.queryGlobalTask(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam()); |
|||
log.info("返回带时间的日常任务"); |
|||
return JsonResponse.newInstance().ok(queryTasks); |
|||
} |
|||
|
|||
|
|||
@ApiOperation(value = "查找定期任务", notes = "") |
|||
@RequestMapping(value = "/regular", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<TallTaskVo.QueryTask>> queryRegularTask(HttpServletRequest request, @ApiParam @Validated @RequestBody QueryDto<TallTaskDto.QueryRegularTask> params) { |
|||
log.info("查找定期任务:{}",params); |
|||
List<TallTaskVo.QueryTask> queryTasks = tallService.queryRegularTask(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam()); |
|||
log.info("返回定期任务"); |
|||
return JsonResponse.newInstance().ok(queryTasks); |
|||
} |
|||
|
|||
// @ApiOperation(value = "查找定期任务和相应的插件展示信息", notes = "")
|
|||
// @RequestMapping(value = "/regular/plugin", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse<List<TallTaskVo.QueryTask>> queryRegularTaskAndPlugin(HttpServletRequest request, @ApiParam @Validated @RequestBody QueryDto<TallTaskDto.QueryRegularTask> params) {
|
|||
// log.info("查找定期任务和相应的插件展示信息:{}",params);
|
|||
// List<TallTaskVo.QueryTask> queryTasks = tallService.queryRegularTaskAndPlugin(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam());
|
|||
// log.info("返回定期任务和相应的插件展示信息");
|
|||
// return JsonResponse.newInstance().ok(queryTasks);
|
|||
// }
|
|||
|
|||
@ApiOperation(value = "分页查找定期任务", notes = "") |
|||
@RequestMapping(value = "/regular/page", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<PageInfo<TallTaskVo.QueryTask>> pageQueryRegularTask(HttpServletRequest request, @ApiParam @Validated @RequestBody QueryDto<TallTaskDto.PageQueryRegularTask> params) { |
|||
log.info("分页查找定期任务:{}",params); |
|||
PageInfo<TallTaskVo.QueryTask> queryTasks = tallService.pageQueryRegularTask(request.getHeader(WebConstant.HEADER_KEY_TOKEN),params.getParam()); |
|||
log.info("返回分页查找定期任务"); |
|||
return JsonResponse.newInstance().ok(queryTasks); |
|||
} |
|||
|
|||
@ApiOperation(value = "查看用户所有的任务", notes = "") |
|||
@RequestMapping(value = "/allTask", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<TallTaskVo.QueryTask>> queryAllTask(HttpServletRequest request, @ApiParam @Validated @RequestBody TallTaskDto.QueryAllTask params) { |
|||
log.info("查看用户所有的任务:{}",params); |
|||
List<TallTaskVo.QueryTask> queryTasks = tallService.queryAllTask(params); |
|||
log.info("返回用户所有的任务"); |
|||
return JsonResponse.newInstance().ok(queryTasks); |
|||
} |
|||
} |
@ -1,29 +1,29 @@ |
|||
package com.ccsensptos.tallsdk.bean.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class TallPluginDto { |
|||
@Data |
|||
@ApiModel("通过业务code和插件名查找插件信息") |
|||
public static class BusinessPluginByName { |
|||
@ApiModelProperty("业务插件关联id") |
|||
private String code; |
|||
@ApiModelProperty("业务插件关联id") |
|||
private String pluginName; |
|||
|
|||
public BusinessPluginByName(String code, String pluginName) { |
|||
this.code = code; |
|||
this.pluginName = pluginName; |
|||
} |
|||
|
|||
public BusinessPluginByName() { |
|||
} |
|||
} |
|||
|
|||
} |
|||
package com.ccsensptos.tallsdk.bean.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class TallPluginDto { |
|||
@Data |
|||
@ApiModel("通过业务code和插件名查找插件信息") |
|||
public static class BusinessPluginByName { |
|||
@ApiModelProperty("业务插件关联id") |
|||
private String code; |
|||
@ApiModelProperty("业务插件关联id") |
|||
private String pluginName; |
|||
|
|||
public BusinessPluginByName(String code, String pluginName) { |
|||
this.code = code; |
|||
this.pluginName = pluginName; |
|||
} |
|||
|
|||
public BusinessPluginByName() { |
|||
} |
|||
} |
|||
|
|||
} |
@ -1,55 +1,55 @@ |
|||
package com.ccsensptos.tallsdk.bean.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class TallProjectDto { |
|||
|
|||
@Data |
|||
@ApiModel("根据id查找项目信息") |
|||
public static class ProjectById { |
|||
@NotNull(message = "请选择项目") |
|||
@ApiModelProperty("项目id") |
|||
private Long projectId; |
|||
private Long userId; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("用户查询可见的项目") |
|||
public static class QueryProjectDto{ |
|||
@ApiModelProperty("开始时间") |
|||
private Long startTime; |
|||
@ApiModelProperty("结束时间") |
|||
private Long endTime; |
|||
} |
|||
|
|||
|
|||
@Data |
|||
@ApiModel("查询日历是否有项目") |
|||
public static class QueryHaveProject { |
|||
@NotNull(message = "开始时间不能为空") |
|||
@ApiModelProperty("开始时间") |
|||
private Long startTime; |
|||
@NotNull(message = "结束时间不能为空") |
|||
@ApiModelProperty("结束时间") |
|||
private Long endTime; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("移动项目位置(修改项目层级关系)") |
|||
public static class MoveProject{ |
|||
@ApiModelProperty("需要移动的项目id") |
|||
private Long moveProjectId; |
|||
@ApiModelProperty("目标项目的id") |
|||
private Long targetProjectId; |
|||
@ApiModelProperty("业务code") |
|||
private String businessCode; |
|||
} |
|||
} |
|||
package com.ccsensptos.tallsdk.bean.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class TallProjectDto { |
|||
|
|||
@Data |
|||
@ApiModel("根据id查找项目信息") |
|||
public static class ProjectById { |
|||
@NotNull(message = "请选择项目") |
|||
@ApiModelProperty("项目id") |
|||
private Long projectId; |
|||
private Long userId; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("用户查询可见的项目") |
|||
public static class QueryProjectDto{ |
|||
@ApiModelProperty("开始时间") |
|||
private Long startTime; |
|||
@ApiModelProperty("结束时间") |
|||
private Long endTime; |
|||
} |
|||
|
|||
|
|||
@Data |
|||
@ApiModel("查询日历是否有项目") |
|||
public static class QueryHaveProject { |
|||
@NotNull(message = "开始时间不能为空") |
|||
@ApiModelProperty("开始时间") |
|||
private Long startTime; |
|||
@NotNull(message = "结束时间不能为空") |
|||
@ApiModelProperty("结束时间") |
|||
private Long endTime; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("移动项目位置(修改项目层级关系)") |
|||
public static class MoveProject{ |
|||
@ApiModelProperty("需要移动的项目id") |
|||
private Long moveProjectId; |
|||
@ApiModelProperty("目标项目的id") |
|||
private Long targetProjectId; |
|||
@ApiModelProperty("业务code") |
|||
private String businessCode; |
|||
} |
|||
} |
@ -1,20 +1,20 @@ |
|||
package com.ccsensptos.tallsdk.bean.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
@Data |
|||
public class TallRoleDto { |
|||
@Data |
|||
@ApiModel("查看角色栏展示") |
|||
public static class QueryRoleById{ |
|||
@NotNull(message = "项目id不能为空") |
|||
@ApiModelProperty("项目id") |
|||
private Long projectId; |
|||
@ApiModelProperty("展示的角色数量") |
|||
private int num = 5; |
|||
} |
|||
} |
|||
package com.ccsensptos.tallsdk.bean.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
@Data |
|||
public class TallRoleDto { |
|||
@Data |
|||
@ApiModel("查看角色栏展示") |
|||
public static class QueryRoleById{ |
|||
@NotNull(message = "项目id不能为空") |
|||
@ApiModelProperty("项目id") |
|||
private Long projectId; |
|||
@ApiModelProperty("展示的角色数量") |
|||
private int num = 5; |
|||
} |
|||
} |
@ -1,102 +1,102 @@ |
|||
package com.ccsensptos.tallsdk.bean.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class TallTaskDto { |
|||
@Data |
|||
@ApiModel("查看永久日常任务") |
|||
public static class QueryPermanentGlobalTask{ |
|||
@NotNull(message = "角色id不能为空") |
|||
@ApiModelProperty("角色id") |
|||
private Long roleId; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("查看带时间的日常任务") |
|||
public static class QueryGlobalTask{ |
|||
@NotNull(message = "角色id不能为空") |
|||
@ApiModelProperty("角色id") |
|||
private Long roleId; |
|||
@ApiModelProperty("时间基准点 默认当前") |
|||
private Long timeNode = System.currentTimeMillis(); |
|||
@ApiModelProperty("时间颗粒度单位 默认天") |
|||
private int timeUnit = 4; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("查看定期任务") |
|||
public static class QueryRegularTask{ |
|||
@NotNull(message = "角色id不能为空") |
|||
@ApiModelProperty("角色id") |
|||
private Long roleId; |
|||
@ApiModelProperty("时间基准点 默认当前") |
|||
private Long timeNode = System.currentTimeMillis(); |
|||
@ApiModelProperty("时间颗粒度 默认天") |
|||
private int timeUnit = 4; |
|||
@ApiModelProperty("0向上查找 1向下查找(默认) 下查包含自己,上查不包含") |
|||
private int queryType = 1; |
|||
@ApiModelProperty("查找颗粒度数量 默认3个") |
|||
private int queryNum = 3; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("分期查看定期任务") |
|||
public static class PageQueryRegularTask{ |
|||
// @NotNull(message = "角色id不能为空")
|
|||
@ApiModelProperty("角色id") |
|||
private Long roleId; |
|||
@ApiModelProperty("项目id") |
|||
private Long projectId; |
|||
@ApiModelProperty("任务id") |
|||
private Long taskId; |
|||
@ApiModelProperty("时间基准点 默认当前") |
|||
private Long timeNode = System.currentTimeMillis(); |
|||
@ApiModelProperty("时间颗粒度 默认天") |
|||
private int timeUnit = 4; |
|||
@ApiModelProperty("0向上查找 1向下查找(默认) 下查包含自己,上查不包含") |
|||
private int queryType = 1; |
|||
@ApiModelProperty("第几页") |
|||
private Integer pageNum = 1; |
|||
@ApiModelProperty("每页几条信息") |
|||
private Integer pageSize = 10; |
|||
|
|||
@ApiModelProperty("任务所属的服务code") |
|||
private String businessCode; |
|||
@ApiModelProperty("触发类型 0翻页查找 1双击小红点触发") |
|||
private int triggerType = 0; |
|||
@ApiModelProperty("服务codes") |
|||
private List<String> codes; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("查找用户的所有任务") |
|||
public static class QueryAllTask { |
|||
@ApiModelProperty("userId") |
|||
private Long userId; |
|||
@ApiModelProperty("手机号") |
|||
private String phone; |
|||
@ApiModelProperty("服务codes") |
|||
private List<String> codes; |
|||
@ApiModelProperty("时间基准点 默认当前") |
|||
private Long timeNode = System.currentTimeMillis(); |
|||
@ApiModelProperty("时间颗粒度 默认天") |
|||
private int timeUnit = 4; |
|||
@ApiModelProperty("0向上查找 1向下查找(默认) 下查包含自己,上查不包含") |
|||
private int queryType = 1; |
|||
@ApiModelProperty("第几页") |
|||
private Integer pageNum = 1; |
|||
@ApiModelProperty("每页几条信息") |
|||
private Integer pageSize = 10; |
|||
|
|||
@ApiModelProperty("任务id") |
|||
private String taskId; |
|||
@ApiModelProperty("任务所属的服务code") |
|||
private String businessCode; |
|||
} |
|||
} |
|||
package com.ccsensptos.tallsdk.bean.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class TallTaskDto { |
|||
@Data |
|||
@ApiModel("查看永久日常任务") |
|||
public static class QueryPermanentGlobalTask{ |
|||
@NotNull(message = "角色id不能为空") |
|||
@ApiModelProperty("角色id") |
|||
private Long roleId; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("查看带时间的日常任务") |
|||
public static class QueryGlobalTask{ |
|||
@NotNull(message = "角色id不能为空") |
|||
@ApiModelProperty("角色id") |
|||
private Long roleId; |
|||
@ApiModelProperty("时间基准点 默认当前") |
|||
private Long timeNode = System.currentTimeMillis(); |
|||
@ApiModelProperty("时间颗粒度单位 默认天") |
|||
private int timeUnit = 4; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("查看定期任务") |
|||
public static class QueryRegularTask{ |
|||
@NotNull(message = "角色id不能为空") |
|||
@ApiModelProperty("角色id") |
|||
private Long roleId; |
|||
@ApiModelProperty("时间基准点 默认当前") |
|||
private Long timeNode = System.currentTimeMillis(); |
|||
@ApiModelProperty("时间颗粒度 默认天") |
|||
private int timeUnit = 4; |
|||
@ApiModelProperty("0向上查找 1向下查找(默认) 下查包含自己,上查不包含") |
|||
private int queryType = 1; |
|||
@ApiModelProperty("查找颗粒度数量 默认3个") |
|||
private int queryNum = 3; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("分期查看定期任务") |
|||
public static class PageQueryRegularTask{ |
|||
// @NotNull(message = "角色id不能为空")
|
|||
@ApiModelProperty("角色id") |
|||
private Long roleId; |
|||
@ApiModelProperty("项目id") |
|||
private Long projectId; |
|||
@ApiModelProperty("任务id") |
|||
private Long taskId; |
|||
@ApiModelProperty("时间基准点 默认当前") |
|||
private Long timeNode = System.currentTimeMillis(); |
|||
@ApiModelProperty("时间颗粒度 默认天") |
|||
private int timeUnit = 4; |
|||
@ApiModelProperty("0向上查找 1向下查找(默认) 下查包含自己,上查不包含") |
|||
private int queryType = 1; |
|||
@ApiModelProperty("第几页") |
|||
private Integer pageNum = 1; |
|||
@ApiModelProperty("每页几条信息") |
|||
private Integer pageSize = 10; |
|||
|
|||
@ApiModelProperty("任务所属的服务code") |
|||
private String businessCode; |
|||
@ApiModelProperty("触发类型 0翻页查找 1双击小红点触发") |
|||
private int triggerType = 0; |
|||
@ApiModelProperty("服务codes") |
|||
private List<String> codes; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("查找用户的所有任务") |
|||
public static class QueryAllTask { |
|||
@ApiModelProperty("userId") |
|||
private Long userId; |
|||
@ApiModelProperty("手机号") |
|||
private String phone; |
|||
@ApiModelProperty("服务codes") |
|||
private List<String> codes; |
|||
@ApiModelProperty("时间基准点 默认当前") |
|||
private Long timeNode = System.currentTimeMillis(); |
|||
@ApiModelProperty("时间颗粒度 默认天") |
|||
private int timeUnit = 4; |
|||
@ApiModelProperty("0向上查找 1向下查找(默认) 下查包含自己,上查不包含") |
|||
private int queryType = 1; |
|||
@ApiModelProperty("第几页") |
|||
private Integer pageNum = 1; |
|||
@ApiModelProperty("每页几条信息") |
|||
private Integer pageSize = 10; |
|||
|
|||
@ApiModelProperty("任务id") |
|||
private String taskId; |
|||
@ApiModelProperty("任务所属的服务code") |
|||
private String businessCode; |
|||
} |
|||
} |
@ -1,49 +1,49 @@ |
|||
package com.ccsensptos.tallsdk.bean.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class TallTokenDto { |
|||
|
|||
|
|||
@Data |
|||
public static class GetAccessToken{ |
|||
//"appId"
|
|||
private String appId; |
|||
//"secret"
|
|||
private String secret; |
|||
|
|||
public GetAccessToken(String appId, String secret) { |
|||
this.appId = appId; |
|||
this.secret = secret; |
|||
} |
|||
|
|||
public GetAccessToken() { |
|||
} |
|||
} |
|||
|
|||
@Data |
|||
public static class GetUserByToken{ |
|||
//"token")
|
|||
private String token; |
|||
//"appId")
|
|||
private String appId; |
|||
//"secret")
|
|||
private String secret; |
|||
|
|||
public GetUserByToken() { |
|||
} |
|||
|
|||
public GetUserByToken(String token, String appId, String secret) { |
|||
this.token = token; |
|||
this.appId = appId; |
|||
this.secret = secret; |
|||
} |
|||
} |
|||
|
|||
} |
|||
package com.ccsensptos.tallsdk.bean.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class TallTokenDto { |
|||
|
|||
|
|||
@Data |
|||
public static class GetAccessToken{ |
|||
//"appId"
|
|||
private String appId; |
|||
//"secret"
|
|||
private String secret; |
|||
|
|||
public GetAccessToken(String appId, String secret) { |
|||
this.appId = appId; |
|||
this.secret = secret; |
|||
} |
|||
|
|||
public GetAccessToken() { |
|||
} |
|||
} |
|||
|
|||
@Data |
|||
public static class GetUserByToken{ |
|||
//"token")
|
|||
private String token; |
|||
//"appId")
|
|||
private String appId; |
|||
//"secret")
|
|||
private String secret; |
|||
|
|||
public GetUserByToken() { |
|||
} |
|||
|
|||
public GetUserByToken(String token, String appId, String secret) { |
|||
this.token = token; |
|||
this.appId = appId; |
|||
this.secret = secret; |
|||
} |
|||
} |
|||
|
|||
} |
@ -1,25 +1,25 @@ |
|||
package com.ccsensptos.tallsdk.bean.vo; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class TallPluginVo { |
|||
|
|||
@Data |
|||
@ApiModel("查找插件信息,通过服务code和插件名") |
|||
public static class BusinessPluginInfo{ |
|||
@ApiModelProperty("插件id") |
|||
private Long pluginId; |
|||
@ApiModelProperty("业务插件关联id") |
|||
private Long businessPluginId; |
|||
@ApiModelProperty("插件在业务下的唯一code") |
|||
private String code; |
|||
@ApiModelProperty("是否是内置组件 0否 1是") |
|||
private Byte inner; |
|||
} |
|||
} |
|||
package com.ccsensptos.tallsdk.bean.vo; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class TallPluginVo { |
|||
|
|||
@Data |
|||
@ApiModel("查找插件信息,通过服务code和插件名") |
|||
public static class BusinessPluginInfo{ |
|||
@ApiModelProperty("插件id") |
|||
private Long pluginId; |
|||
@ApiModelProperty("业务插件关联id") |
|||
private Long businessPluginId; |
|||
@ApiModelProperty("插件在业务下的唯一code") |
|||
private String code; |
|||
@ApiModelProperty("是否是内置组件 0否 1是") |
|||
private Byte inner; |
|||
} |
|||
} |
@ -1,103 +1,103 @@ |
|||
package com.ccsensptos.tallsdk.bean.vo; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.ccsens.util.WebConstant; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class TallProjectVo { |
|||
|
|||
@Data |
|||
@ApiModel("域信息") |
|||
public static class DomainInfo{ |
|||
@ApiModelProperty("id") |
|||
private Long id; |
|||
@ApiModelProperty("域名") |
|||
private String name; |
|||
@ApiModelProperty("域code") |
|||
private String code; |
|||
@ApiModelProperty("域访问前缀") |
|||
private String url; |
|||
@ApiModelProperty("是否是自身 0否 1是") |
|||
private byte self; |
|||
@ApiModelProperty("业务列表") |
|||
private List<BusinessInfo> businessList; |
|||
} |
|||
@Data |
|||
@ApiModel("业务信息") |
|||
public static class BusinessInfo{ |
|||
@ApiModelProperty("业务id") |
|||
private Long businessId; |
|||
@ApiModelProperty("业务名") |
|||
private String businessName; |
|||
@ApiModelProperty("业务code") |
|||
private String businessCode; |
|||
@ApiModelProperty("业务访问前缀") |
|||
private String url; |
|||
@ApiModelProperty("项目列表") |
|||
private List<ProjectInfo> projectList; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("日历下项目列表信息") |
|||
public static class ProjectInfo{ |
|||
@ApiModelProperty("id") |
|||
private Long id; |
|||
@ApiModelProperty("项目名") |
|||
private String name; |
|||
@ApiModelProperty("开始时间") |
|||
private Long startTime; |
|||
@ApiModelProperty("结束时间") |
|||
private Long endTime; |
|||
@ApiModelProperty("项目完成状态(0-未开始,1-进行中,2-已完成,3-暂停)") |
|||
private byte status; |
|||
@ApiModelProperty("访问路径)") |
|||
private String url; |
|||
@ApiModelProperty("所属域code") |
|||
private String domainCode; |
|||
@ApiModelProperty("所属业务code") |
|||
private String businessCode; |
|||
@ApiModelProperty("子项目") |
|||
private List<ProjectInfo> sonProjectList; |
|||
@JsonIgnore |
|||
@ApiModelProperty("父级id") |
|||
private Long parentId; |
|||
|
|||
public Byte getStatus() { |
|||
long current = System.currentTimeMillis(); |
|||
if(ObjectUtil.isNull(getStartTime()) || ObjectUtil.isNull(getEndTime())) { |
|||
return null; |
|||
} |
|||
if(getStartTime() > current){ |
|||
this.status = (byte) WebConstant.EVENT_PROCESS.Pending.value; |
|||
}else if(getEndTime() < current){ |
|||
this.status = (byte) WebConstant.EVENT_PROCESS.Expired.value; |
|||
}else{ |
|||
this.status = (byte) WebConstant.EVENT_PROCESS.Processing.value; |
|||
} |
|||
return this.status; |
|||
} |
|||
|
|||
public ProjectInfo() { |
|||
} |
|||
|
|||
public ProjectInfo(Long id, String name, Long startTime, Long endTime, String url, String domainCode, String businessCode) { |
|||
this.id = id; |
|||
this.name = name; |
|||
this.startTime = startTime; |
|||
this.endTime = endTime; |
|||
this.url = url; |
|||
this.domainCode = domainCode; |
|||
this.businessCode = businessCode; |
|||
} |
|||
} |
|||
|
|||
} |
|||
package com.ccsensptos.tallsdk.bean.vo; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.ccsens.util.WebConstant; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class TallProjectVo { |
|||
|
|||
@Data |
|||
@ApiModel("域信息") |
|||
public static class DomainInfo{ |
|||
@ApiModelProperty("id") |
|||
private Long id; |
|||
@ApiModelProperty("域名") |
|||
private String name; |
|||
@ApiModelProperty("域code") |
|||
private String code; |
|||
@ApiModelProperty("域访问前缀") |
|||
private String url; |
|||
@ApiModelProperty("是否是自身 0否 1是") |
|||
private byte self; |
|||
@ApiModelProperty("业务列表") |
|||
private List<BusinessInfo> businessList; |
|||
} |
|||
@Data |
|||
@ApiModel("业务信息") |
|||
public static class BusinessInfo{ |
|||
@ApiModelProperty("业务id") |
|||
private Long businessId; |
|||
@ApiModelProperty("业务名") |
|||
private String businessName; |
|||
@ApiModelProperty("业务code") |
|||
private String businessCode; |
|||
@ApiModelProperty("业务访问前缀") |
|||
private String url; |
|||
@ApiModelProperty("项目列表") |
|||
private List<ProjectInfo> projectList; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("日历下项目列表信息") |
|||
public static class ProjectInfo{ |
|||
@ApiModelProperty("id") |
|||
private Long id; |
|||
@ApiModelProperty("项目名") |
|||
private String name; |
|||
@ApiModelProperty("开始时间") |
|||
private Long startTime; |
|||
@ApiModelProperty("结束时间") |
|||
private Long endTime; |
|||
@ApiModelProperty("项目完成状态(0-未开始,1-进行中,2-已完成,3-暂停)") |
|||
private byte status; |
|||
@ApiModelProperty("访问路径)") |
|||
private String url; |
|||
@ApiModelProperty("所属域code") |
|||
private String domainCode; |
|||
@ApiModelProperty("所属业务code") |
|||
private String businessCode; |
|||
@ApiModelProperty("子项目") |
|||
private List<ProjectInfo> sonProjectList; |
|||
@JsonIgnore |
|||
@ApiModelProperty("父级id") |
|||
private Long parentId; |
|||
|
|||
public Byte getStatus() { |
|||
long current = System.currentTimeMillis(); |
|||
if(ObjectUtil.isNull(getStartTime()) || ObjectUtil.isNull(getEndTime())) { |
|||
return null; |
|||
} |
|||
if(getStartTime() > current){ |
|||
this.status = (byte) WebConstant.EVENT_PROCESS.Pending.value; |
|||
}else if(getEndTime() < current){ |
|||
this.status = (byte) WebConstant.EVENT_PROCESS.Expired.value; |
|||
}else{ |
|||
this.status = (byte) WebConstant.EVENT_PROCESS.Processing.value; |
|||
} |
|||
return this.status; |
|||
} |
|||
|
|||
public ProjectInfo() { |
|||
} |
|||
|
|||
public ProjectInfo(Long id, String name, Long startTime, Long endTime, String url, String domainCode, String businessCode) { |
|||
this.id = id; |
|||
this.name = name; |
|||
this.startTime = startTime; |
|||
this.endTime = endTime; |
|||
this.url = url; |
|||
this.domainCode = domainCode; |
|||
this.businessCode = businessCode; |
|||
} |
|||
} |
|||
|
|||
} |
@ -1,36 +1,36 @@ |
|||
package com.ccsensptos.tallsdk.bean.vo; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class TallRoleVo { |
|||
|
|||
@Data |
|||
@ApiModel("查看角色栏展示的角色信息") |
|||
public static class QueryRole { |
|||
@ApiModelProperty("展示的角色信息") |
|||
private List<RoleInfo> visibleList; |
|||
@ApiModelProperty("不展示的角色信息") |
|||
private List<RoleInfo> invisibleList; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("角色信息") |
|||
public static class RoleInfo { |
|||
@ApiModelProperty("角色id") |
|||
private Long id; |
|||
@ApiModelProperty("是否是项目经理 0否 1是") |
|||
private int pm; |
|||
@ApiModelProperty("是否是自己所属的角色 0否 1是") |
|||
private int mine; |
|||
@ApiModelProperty("角色名") |
|||
private String name; |
|||
@ApiModelProperty("排序") |
|||
private int sequence; |
|||
} |
|||
|
|||
} |
|||
package com.ccsensptos.tallsdk.bean.vo; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class TallRoleVo { |
|||
|
|||
@Data |
|||
@ApiModel("查看角色栏展示的角色信息") |
|||
public static class QueryRole { |
|||
@ApiModelProperty("展示的角色信息") |
|||
private List<RoleInfo> visibleList; |
|||
@ApiModelProperty("不展示的角色信息") |
|||
private List<RoleInfo> invisibleList; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("角色信息") |
|||
public static class RoleInfo { |
|||
@ApiModelProperty("角色id") |
|||
private Long id; |
|||
@ApiModelProperty("是否是项目经理 0否 1是") |
|||
private int pm; |
|||
@ApiModelProperty("是否是自己所属的角色 0否 1是") |
|||
private int mine; |
|||
@ApiModelProperty("角色名") |
|||
private String name; |
|||
@ApiModelProperty("排序") |
|||
private int sequence; |
|||
} |
|||
|
|||
} |
@ -1,117 +1,117 @@ |
|||
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 TallTaskVo { |
|||
|
|||
@Data |
|||
@ApiModel("查看定期任务返回值") |
|||
public static class QueryTask{ |
|||
@ApiModelProperty("任务id(任务分解id)") |
|||
private Long id; |
|||
@ApiModelProperty("详情id") |
|||
private Long detailId; |
|||
@ApiModelProperty("任务名") |
|||
private String name; |
|||
@ApiModelProperty("任务详情") |
|||
private String description; |
|||
@ApiModelProperty("计划开始时间") |
|||
private Long planStart; |
|||
@ApiModelProperty("计划时长") |
|||
private Long planDuration; |
|||
@ApiModelProperty("计划结束时长") |
|||
private Long planEnd; |
|||
@ApiModelProperty("实际开始时间") |
|||
private Long realStart; |
|||
@ApiModelProperty("实际时长") |
|||
private Long realDuration; |
|||
@ApiModelProperty("实际结束时长") |
|||
private Long realEnd; |
|||
@ApiModelProperty("任务状态 0未开始 1进行中 2暂停中 3已完成") |
|||
private int process; |
|||
@ApiModelProperty("任务流转策略 -1不跳转 0直接跳转 如果是其他正整数 就是多少毫秒后跳转 ") |
|||
private Long skip; |
|||
@ApiModelProperty("跳转的任务id") |
|||
private Long skipTaskId; |
|||
@ApiModelProperty("任务面板") |
|||
private PanelInfo panel; |
|||
@ApiModelProperty("检查人列表") |
|||
private List<CheckerOfTask> checkerList; |
|||
@ApiModelProperty("插件") |
|||
private List<List<TaskPluginInfo>> plugins; |
|||
|
|||
@ApiModelProperty("项目id") |
|||
private Long projectId; |
|||
@ApiModelProperty("负责人id") |
|||
private Long executorRoleId; |
|||
@ApiModelProperty("所属服务的code") |
|||
private String businessCode; |
|||
@ApiModelProperty("服务的url") |
|||
private String businessUrl; |
|||
} |
|||
@Data |
|||
@ApiModel("任务下的检查人") |
|||
public static class CheckerOfTask { |
|||
@ApiModelProperty("角色id") |
|||
private Long roleId; |
|||
@ApiModelProperty("名字") |
|||
private String name; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("任务面板信息") |
|||
public static class PanelInfo{ |
|||
@ApiModelProperty("背景色") |
|||
private String backgroundColor; |
|||
@ApiModelProperty("圆角") |
|||
private String borderRadius; |
|||
@ApiModelProperty("边框") |
|||
private String border; |
|||
@ApiModelProperty("阴影") |
|||
private String shadow; |
|||
@ApiModelProperty("宽") |
|||
private String width; |
|||
@ApiModelProperty("高") |
|||
private String height; |
|||
@ApiModelProperty("行") |
|||
private int row; |
|||
@ApiModelProperty("列") |
|||
private int col; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("任务下的插件信息") |
|||
public static class TaskPluginInfo{ |
|||
@ApiModelProperty("插件任务关联id") |
|||
private Long pluginTaskId; |
|||
@ApiModelProperty("插件id") |
|||
private Long pluginId; |
|||
@ApiModelProperty("插件和服务关联的id") |
|||
private Long businessPluginId; |
|||
@ApiModelProperty("插件code") |
|||
private String pluginCode; |
|||
@ApiModelProperty("是否是内置组件 0否 1是") |
|||
private Byte inner; |
|||
@ApiModelProperty("参数") |
|||
private String param; |
|||
@ApiModelProperty("行") |
|||
private int row; |
|||
@ApiModelProperty("列") |
|||
private int col; |
|||
@ApiModelProperty("跨行") |
|||
private int rowspan; |
|||
@ApiModelProperty("跨列") |
|||
private int colspan; |
|||
@ApiModelProperty("插件在时间轴的展示信息") |
|||
private String data; |
|||
} |
|||
|
|||
} |
|||
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 TallTaskVo { |
|||
|
|||
@Data |
|||
@ApiModel("查看定期任务返回值") |
|||
public static class QueryTask{ |
|||
@ApiModelProperty("任务id(任务分解id)") |
|||
private Long id; |
|||
@ApiModelProperty("详情id") |
|||
private Long detailId; |
|||
@ApiModelProperty("任务名") |
|||
private String name; |
|||
@ApiModelProperty("任务详情") |
|||
private String description; |
|||
@ApiModelProperty("计划开始时间") |
|||
private Long planStart; |
|||
@ApiModelProperty("计划时长") |
|||
private Long planDuration; |
|||
@ApiModelProperty("计划结束时长") |
|||
private Long planEnd; |
|||
@ApiModelProperty("实际开始时间") |
|||
private Long realStart; |
|||
@ApiModelProperty("实际时长") |
|||
private Long realDuration; |
|||
@ApiModelProperty("实际结束时长") |
|||
private Long realEnd; |
|||
@ApiModelProperty("任务状态 0未开始 1进行中 2暂停中 3已完成") |
|||
private int process; |
|||
@ApiModelProperty("任务流转策略 -1不跳转 0直接跳转 如果是其他正整数 就是多少毫秒后跳转 ") |
|||
private Long skip; |
|||
@ApiModelProperty("跳转的任务id") |
|||
private Long skipTaskId; |
|||
@ApiModelProperty("任务面板") |
|||
private PanelInfo panel; |
|||
@ApiModelProperty("检查人列表") |
|||
private List<CheckerOfTask> checkerList; |
|||
@ApiModelProperty("插件") |
|||
private List<List<TaskPluginInfo>> plugins; |
|||
|
|||
@ApiModelProperty("项目id") |
|||
private Long projectId; |
|||
@ApiModelProperty("负责人id") |
|||
private Long executorRoleId; |
|||
@ApiModelProperty("所属服务的code") |
|||
private String businessCode; |
|||
@ApiModelProperty("服务的url") |
|||
private String businessUrl; |
|||
} |
|||
@Data |
|||
@ApiModel("任务下的检查人") |
|||
public static class CheckerOfTask { |
|||
@ApiModelProperty("角色id") |
|||
private Long roleId; |
|||
@ApiModelProperty("名字") |
|||
private String name; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("任务面板信息") |
|||
public static class PanelInfo{ |
|||
@ApiModelProperty("背景色") |
|||
private String backgroundColor; |
|||
@ApiModelProperty("圆角") |
|||
private String borderRadius; |
|||
@ApiModelProperty("边框") |
|||
private String border; |
|||
@ApiModelProperty("阴影") |
|||
private String shadow; |
|||
@ApiModelProperty("宽") |
|||
private String width; |
|||
@ApiModelProperty("高") |
|||
private String height; |
|||
@ApiModelProperty("行") |
|||
private int row; |
|||
@ApiModelProperty("列") |
|||
private int col; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("任务下的插件信息") |
|||
public static class TaskPluginInfo{ |
|||
@ApiModelProperty("插件任务关联id") |
|||
private Long pluginTaskId; |
|||
@ApiModelProperty("插件id") |
|||
private Long pluginId; |
|||
@ApiModelProperty("插件和服务关联的id") |
|||
private Long businessPluginId; |
|||
@ApiModelProperty("插件code") |
|||
private String pluginCode; |
|||
@ApiModelProperty("是否是内置组件 0否 1是") |
|||
private Byte inner; |
|||
@ApiModelProperty("参数") |
|||
private String param; |
|||
@ApiModelProperty("行") |
|||
private int row; |
|||
@ApiModelProperty("列") |
|||
private int col; |
|||
@ApiModelProperty("跨行") |
|||
private int rowspan; |
|||
@ApiModelProperty("跨列") |
|||
private int colspan; |
|||
@ApiModelProperty("插件在时间轴的展示信息") |
|||
private String data; |
|||
} |
|||
|
|||
} |
@ -1,40 +1,40 @@ |
|||
package com.ccsensptos.tallsdk.bean.vo; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class TallTokenVo { |
|||
|
|||
@Data |
|||
public static class UserIdByToken { |
|||
//"用户id"
|
|||
private Long id; |
|||
//"用户名"
|
|||
private String userName; |
|||
//"头像"
|
|||
private String avatarUrl; |
|||
//"手机号"
|
|||
private String phone; |
|||
//"用户类型 0未认证 1已认证"
|
|||
private byte authType; |
|||
//"token"
|
|||
private String token; |
|||
//"刷新token"
|
|||
private String refreshToken; |
|||
} |
|||
|
|||
@Data |
|||
public static class AccessToken{ |
|||
//"accessToken"
|
|||
private String accessToken; |
|||
//"存放时间"
|
|||
private Long time; |
|||
} |
|||
|
|||
} |
|||
package com.ccsensptos.tallsdk.bean.vo; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class TallTokenVo { |
|||
|
|||
@Data |
|||
public static class UserIdByToken { |
|||
//"用户id"
|
|||
private Long id; |
|||
//"用户名"
|
|||
private String userName; |
|||
//"头像"
|
|||
private String avatarUrl; |
|||
//"手机号"
|
|||
private String phone; |
|||
//"用户类型 0未认证 1已认证"
|
|||
private byte authType; |
|||
//"token"
|
|||
private String token; |
|||
//"刷新token"
|
|||
private String refreshToken; |
|||
} |
|||
|
|||
@Data |
|||
public static class AccessToken{ |
|||
//"accessToken"
|
|||
private String accessToken; |
|||
//"存放时间"
|
|||
private Long time; |
|||
} |
|||
|
|||
} |
@ -1,145 +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; |
|||
} |
|||
} |
|||
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; |
|||
} |
|||
} |
@ -1,111 +1,111 @@ |
|||
package com.ccsensptos.tallsdk.service; |
|||
|
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallProjectDto; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallRoleDto; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallTaskDto; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallProjectVo; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallRoleVo; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallTaskVo; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallWbsVo; |
|||
import com.github.pagehelper.PageInfo; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
public interface ITallService { |
|||
/** |
|||
* 查询用户可见的项目 |
|||
* @param param 开始结束时间 |
|||
* @return 返回项目列表 |
|||
*/ |
|||
List<TallProjectVo.ProjectInfo> queryProjectByUser(String token, TallProjectDto.QueryProjectDto param); |
|||
|
|||
/** |
|||
* 查询项目下的角色列表 |
|||
* @param param 项目id |
|||
* @return 返回角色列表 |
|||
*/ |
|||
TallRoleVo.QueryRole queryShowRole(String token, TallRoleDto.QueryRoleById param); |
|||
|
|||
/** |
|||
* 查询没有时间的日常任务 |
|||
* @param param 角色id等。。。 |
|||
* @return 返回任务列表 |
|||
*/ |
|||
List<TallTaskVo.QueryTask> queryPermanentGlobalTask(String token, TallTaskDto.QueryPermanentGlobalTask param); |
|||
|
|||
/** |
|||
* 查询有时间的日常任务 |
|||
* @param param 角色id和时间 |
|||
* @return 返回任务列表 |
|||
*/ |
|||
List<TallTaskVo.QueryTask> queryGlobalTask(String token, TallTaskDto.QueryGlobalTask param); |
|||
|
|||
/** |
|||
* 查询定期任务 |
|||
* @param param 角色id和时间 |
|||
* @return 返回任务列表 |
|||
*/ |
|||
List<TallTaskVo.QueryTask> queryRegularTask(String token, TallTaskDto.QueryRegularTask param); |
|||
|
|||
/** |
|||
* 导入wbs |
|||
* @param params wbs文件 |
|||
* @return 返回项目信息 |
|||
*/ |
|||
TallProjectVo.ProjectInfo importWbs(String token, MultipartFile params,Long parentId); |
|||
|
|||
/** |
|||
* 根据id查询项目信息 |
|||
*/ |
|||
TallProjectVo.ProjectInfo findProjectById(String token, TallProjectDto.ProjectById params); |
|||
|
|||
// /**
|
|||
// * 查询定期任务包括插件展示的信息
|
|||
// * @param token token
|
|||
// * @param param 任务id信息
|
|||
// * @return 返回任务洗洗和插件展示的信息
|
|||
// */
|
|||
// List<TallTaskVo.QueryTask> queryRegularTaskAndPlugin(String token, TallTaskDto.QueryRegularTask param);
|
|||
|
|||
/** |
|||
* 分页查找定期任务 |
|||
* @param token token |
|||
* @param param 角色时间分页等信息 |
|||
* @return 任务列表 |
|||
*/ |
|||
PageInfo<TallTaskVo.QueryTask> pageQueryRegularTask(String token, TallTaskDto.PageQueryRegularTask param); |
|||
|
|||
/** |
|||
* 导出wbs |
|||
* @param token token |
|||
* @param param 项目id |
|||
* @return 返回wbs的下载路径 |
|||
*/ |
|||
TallWbsVo.WbsPath exportWbs(String token, TallProjectDto.ProjectById param); |
|||
|
|||
/** |
|||
* 查找用户所有的任务 |
|||
* @param param 用户信息和查询条件 |
|||
* @return 返回任务信息 |
|||
*/ |
|||
List<TallTaskVo.QueryTask> queryAllTask(TallTaskDto.QueryAllTask param); |
|||
|
|||
/** |
|||
* 删除项目 |
|||
* @param token token |
|||
* @param params 项目id |
|||
*/ |
|||
void deleteProject(String token, TallProjectDto.ProjectById params); |
|||
|
|||
/** |
|||
* 移动项目,修改项目层级关系 |
|||
* @param token token |
|||
* @param params 项目id等信息 |
|||
*/ |
|||
void dragProject(String token, TallProjectDto.MoveProject params); |
|||
} |
|||
package com.ccsensptos.tallsdk.service; |
|||
|
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallProjectDto; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallRoleDto; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallTaskDto; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallProjectVo; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallRoleVo; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallTaskVo; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallWbsVo; |
|||
import com.github.pagehelper.PageInfo; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
public interface ITallService { |
|||
/** |
|||
* 查询用户可见的项目 |
|||
* @param param 开始结束时间 |
|||
* @return 返回项目列表 |
|||
*/ |
|||
List<TallProjectVo.ProjectInfo> queryProjectByUser(String token, TallProjectDto.QueryProjectDto param); |
|||
|
|||
/** |
|||
* 查询项目下的角色列表 |
|||
* @param param 项目id |
|||
* @return 返回角色列表 |
|||
*/ |
|||
TallRoleVo.QueryRole queryShowRole(String token, TallRoleDto.QueryRoleById param); |
|||
|
|||
/** |
|||
* 查询没有时间的日常任务 |
|||
* @param param 角色id等。。。 |
|||
* @return 返回任务列表 |
|||
*/ |
|||
List<TallTaskVo.QueryTask> queryPermanentGlobalTask(String token, TallTaskDto.QueryPermanentGlobalTask param); |
|||
|
|||
/** |
|||
* 查询有时间的日常任务 |
|||
* @param param 角色id和时间 |
|||
* @return 返回任务列表 |
|||
*/ |
|||
List<TallTaskVo.QueryTask> queryGlobalTask(String token, TallTaskDto.QueryGlobalTask param); |
|||
|
|||
/** |
|||
* 查询定期任务 |
|||
* @param param 角色id和时间 |
|||
* @return 返回任务列表 |
|||
*/ |
|||
List<TallTaskVo.QueryTask> queryRegularTask(String token, TallTaskDto.QueryRegularTask param); |
|||
|
|||
/** |
|||
* 导入wbs |
|||
* @param params wbs文件 |
|||
* @return 返回项目信息 |
|||
*/ |
|||
TallProjectVo.ProjectInfo importWbs(String token, MultipartFile params,Long parentId); |
|||
|
|||
/** |
|||
* 根据id查询项目信息 |
|||
*/ |
|||
TallProjectVo.ProjectInfo findProjectById(String token, TallProjectDto.ProjectById params); |
|||
|
|||
// /**
|
|||
// * 查询定期任务包括插件展示的信息
|
|||
// * @param token token
|
|||
// * @param param 任务id信息
|
|||
// * @return 返回任务洗洗和插件展示的信息
|
|||
// */
|
|||
// List<TallTaskVo.QueryTask> queryRegularTaskAndPlugin(String token, TallTaskDto.QueryRegularTask param);
|
|||
|
|||
/** |
|||
* 分页查找定期任务 |
|||
* @param token token |
|||
* @param param 角色时间分页等信息 |
|||
* @return 任务列表 |
|||
*/ |
|||
PageInfo<TallTaskVo.QueryTask> pageQueryRegularTask(String token, TallTaskDto.PageQueryRegularTask param); |
|||
|
|||
/** |
|||
* 导出wbs |
|||
* @param token token |
|||
* @param param 项目id |
|||
* @return 返回wbs的下载路径 |
|||
*/ |
|||
TallWbsVo.WbsPath exportWbs(String token, TallProjectDto.ProjectById param); |
|||
|
|||
/** |
|||
* 查找用户所有的任务 |
|||
* @param param 用户信息和查询条件 |
|||
* @return 返回任务信息 |
|||
*/ |
|||
List<TallTaskVo.QueryTask> queryAllTask(TallTaskDto.QueryAllTask param); |
|||
|
|||
/** |
|||
* 删除项目 |
|||
* @param token token |
|||
* @param params 项目id |
|||
*/ |
|||
void deleteProject(String token, TallProjectDto.ProjectById params); |
|||
|
|||
/** |
|||
* 移动项目,修改项目层级关系 |
|||
* @param token token |
|||
* @param params 项目id等信息 |
|||
*/ |
|||
void dragProject(String token, TallProjectDto.MoveProject params); |
|||
} |
@ -1,30 +1,30 @@ |
|||
package com.ccsensptos.tallsdk.util; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
public class Constant { |
|||
|
|||
/**域内gateway请求前缀*/ |
|||
public static final String GATEWAY_URL = "http://101.201.226.163/gateway/"; |
|||
|
|||
/**tall-查询所有任务的接口路径*/ |
|||
public static final String QUERY_ALL_TASK = "ptostall/task/allTask"; |
|||
/**tall-请求的用户信息的接口路径*/ |
|||
public static final String TALL_USER_TOKEN = "ptostall/users/businessToken"; |
|||
/**tall-获取accessToken*/ |
|||
public static final String TALL_GET_ACCESS_TOKEN = "ptostall/business/accessToken"; |
|||
/**tall-通过手机号获取userId*/ |
|||
public static final String TALL_GET_USER_ID = "ptostall/users/userIdByPhone"; |
|||
/**开放平台-获取插件信息*/ |
|||
public static final String OPEN_GET_PLUGIN = "opt/business/businessPluginByName"; |
|||
/**消息系统-发送消息*/ |
|||
public static final String MESSAGE_SEND_TO = "http://101.201.226.163:8194/message/v4.0/message/send"; |
|||
|
|||
/**请求头--accessToken*/ |
|||
public static final String ACCESS_TOKEN = "accessToken"; |
|||
|
|||
/**token过期时间 100分钟*/ |
|||
public static final Long EXPIRATION_TIME = 60 * 1000L * 100; |
|||
|
|||
} |
|||
package com.ccsensptos.tallsdk.util; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
public class Constant { |
|||
|
|||
/**域内gateway请求前缀*/ |
|||
public static final String GATEWAY_URL = "http://101.201.226.163/gateway/"; |
|||
|
|||
/**tall-查询所有任务的接口路径*/ |
|||
public static final String QUERY_ALL_TASK = "ptostall/task/allTask"; |
|||
/**tall-请求的用户信息的接口路径*/ |
|||
public static final String TALL_USER_TOKEN = "ptostall/users/businessToken"; |
|||
/**tall-获取accessToken*/ |
|||
public static final String TALL_GET_ACCESS_TOKEN = "ptostall/business/accessToken"; |
|||
/**tall-通过手机号获取userId*/ |
|||
public static final String TALL_GET_USER_ID = "ptostall/users/userIdByPhone"; |
|||
/**开放平台-获取插件信息*/ |
|||
public static final String OPEN_GET_PLUGIN = "opt/business/businessPluginByName"; |
|||
/**消息系统-发送消息*/ |
|||
public static final String MESSAGE_SEND_TO = "http://101.201.226.163:8194/message/v4.0/message/send"; |
|||
|
|||
/**请求头--accessToken*/ |
|||
public static final String ACCESS_TOKEN = "accessToken"; |
|||
|
|||
/**token过期时间 100分钟*/ |
|||
public static final Long EXPIRATION_TIME = 60 * 1000L * 100; |
|||
|
|||
} |
@ -1,94 +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); |
|||
} |
|||
} |
|||
} |
|||
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); |
|||
} |
|||
} |
|||
} |
@ -1,61 +1,61 @@ |
|||
package com.ccsensptos.tallsdk.util; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.ccsens.util.RestTemplateUtil; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallPluginDto; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallTokenDto; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallPluginVo; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallTokenVo; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
@Component |
|||
@Slf4j |
|||
public class PluginUtil { |
|||
|
|||
/** |
|||
* 通过业务code和插件名获取插件信息 |
|||
* @return 返回accessToken |
|||
*/ |
|||
public static TallPluginVo.BusinessPluginInfo getPluginByCodeAndName(String businessCode,String pluginName){ |
|||
TallPluginVo.BusinessPluginInfo businessPluginInfo; |
|||
TallPluginDto.BusinessPluginByName businessPluginByName = new TallPluginDto.BusinessPluginByName(businessCode,pluginName); |
|||
|
|||
//发送请求
|
|||
String url = Constant.GATEWAY_URL + Constant.OPEN_GET_PLUGIN; |
|||
log.info("调用接口:{}--{}", url, businessPluginByName); |
|||
String postBody = null; |
|||
try{ |
|||
postBody = RestTemplateUtil.postBody(url, businessPluginByName); |
|||
}catch (Exception e){ |
|||
log.error("请求开放品台失败--" + e); |
|||
} |
|||
if(StrUtil.isBlank(postBody)){ |
|||
return null; |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(postBody); |
|||
log.info("接口返回:{}", jsonObject); |
|||
//请求正确返回则,否则无操作
|
|||
Integer code = jsonObject.getInteger("code"); |
|||
if (code == null || code != 200) { |
|||
return null; |
|||
} |
|||
String data = jsonObject.getString("data"); |
|||
if(ObjectUtil.isNull(data)){ |
|||
return null; |
|||
} |
|||
try { |
|||
businessPluginInfo = JSON.parseObject(data, TallPluginVo.BusinessPluginInfo.class); |
|||
}catch (Exception e){ |
|||
log.info("返回值转换失败"); |
|||
return null; |
|||
} |
|||
return businessPluginInfo; |
|||
} |
|||
} |
|||
package com.ccsensptos.tallsdk.util; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.ccsens.util.RestTemplateUtil; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallPluginDto; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallTokenDto; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallPluginVo; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallTokenVo; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
@Component |
|||
@Slf4j |
|||
public class PluginUtil { |
|||
|
|||
/** |
|||
* 通过业务code和插件名获取插件信息 |
|||
* @return 返回accessToken |
|||
*/ |
|||
public static TallPluginVo.BusinessPluginInfo getPluginByCodeAndName(String businessCode,String pluginName){ |
|||
TallPluginVo.BusinessPluginInfo businessPluginInfo; |
|||
TallPluginDto.BusinessPluginByName businessPluginByName = new TallPluginDto.BusinessPluginByName(businessCode,pluginName); |
|||
|
|||
//发送请求
|
|||
String url = Constant.GATEWAY_URL + Constant.OPEN_GET_PLUGIN; |
|||
log.info("调用接口:{}--{}", url, businessPluginByName); |
|||
String postBody = null; |
|||
try{ |
|||
postBody = RestTemplateUtil.postBody(url, businessPluginByName); |
|||
}catch (Exception e){ |
|||
log.error("请求开放品台失败--" + e); |
|||
} |
|||
if(StrUtil.isBlank(postBody)){ |
|||
return null; |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(postBody); |
|||
log.info("接口返回:{}", jsonObject); |
|||
//请求正确返回则,否则无操作
|
|||
Integer code = jsonObject.getInteger("code"); |
|||
if (code == null || code != 200) { |
|||
return null; |
|||
} |
|||
String data = jsonObject.getString("data"); |
|||
if(ObjectUtil.isNull(data)){ |
|||
return null; |
|||
} |
|||
try { |
|||
businessPluginInfo = JSON.parseObject(data, TallPluginVo.BusinessPluginInfo.class); |
|||
}catch (Exception e){ |
|||
log.info("返回值转换失败"); |
|||
return null; |
|||
} |
|||
return businessPluginInfo; |
|||
} |
|||
} |
@ -1,158 +1,158 @@ |
|||
package com.ccsensptos.tallsdk.util; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.ccsens.util.RedisUtil; |
|||
import com.ccsens.util.RestTemplateUtil; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallTokenDto; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallTokenVo; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import javax.annotation.PostConstruct; |
|||
import javax.annotation.Resource; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Component |
|||
@Slf4j |
|||
public class TokenUtil { |
|||
/**缓存token或用户信息*/ |
|||
public static Map<String, Object> accessTokenMap = new HashMap<>(); |
|||
|
|||
public static String openRedis; |
|||
@Value("${spring.application.sdk-cache-redis:}") |
|||
public void setApplication(String redis) { |
|||
openRedis = redis; |
|||
} |
|||
|
|||
@Resource |
|||
private RedisUtil redisUtil; |
|||
private static TokenUtil util; |
|||
|
|||
@PostConstruct |
|||
public void init(){ |
|||
util = this; |
|||
util.redisUtil = this.redisUtil; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 通过AppId获取accessToken |
|||
* @return 返回accessToken |
|||
*/ |
|||
public static String getAccessToken(String appId, String secret){ |
|||
//查看业务是否开启redis缓存
|
|||
// if(REDIS_IS_OPEN.equals(openRedis)){
|
|||
// //redis开启则通过appId去redis内查询
|
|||
// util.redisUtil.get(appId);
|
|||
// }
|
|||
|
|||
//否则查找Map内是否存在
|
|||
//如果map内存在,则判断数据的时间是否到期,到期了就删掉
|
|||
//如果redis内未查到,或map内未查到,或map内时间到期,则调用tall的接口获取accessToken
|
|||
//在redis内缓存,或存在map内
|
|||
|
|||
//调用tall的接口生成accessToken
|
|||
|
|||
//查找map内的数据
|
|||
long now = System.currentTimeMillis(); |
|||
TallTokenVo.AccessToken accessToken = (TallTokenVo.AccessToken) accessTokenMap.get(appId); |
|||
if(ObjectUtil.isNotNull(accessToken)){ |
|||
if(accessToken.getTime() + Constant.EXPIRATION_TIME > now){ |
|||
return accessToken.getAccessToken(); |
|||
}else { |
|||
//如果过期,就删掉数据
|
|||
accessTokenMap.remove(appId); |
|||
} |
|||
} |
|||
//map内查不到,则去请求tall获取新的accessToken
|
|||
// String url = "http://127.0.0.1:7290/" + Constant.TALL_GET_ACCESS_TOKEN;
|
|||
String url = Constant.GATEWAY_URL + Constant.TALL_GET_ACCESS_TOKEN; |
|||
TallTokenDto.GetAccessToken get = new TallTokenDto.GetAccessToken(appId,secret); |
|||
log.info("调用接口:{}--{}", url, get); |
|||
String postBody = null; |
|||
try{ |
|||
postBody = RestTemplateUtil.postBody(url,get); |
|||
}catch (Exception e){ |
|||
log.error("获取accessToken异常--" + e); |
|||
} |
|||
if(StrUtil.isBlank(postBody)){ |
|||
return null; |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(postBody); |
|||
log.info("接口返回:{}", jsonObject); |
|||
//请求正确返回则,否则无操作
|
|||
Integer code = jsonObject.getInteger("code"); |
|||
if (code == null || code != 200) { |
|||
return null; |
|||
} |
|||
String data = jsonObject.getString("data"); |
|||
if(ObjectUtil.isNull(data)){ |
|||
return null; |
|||
} |
|||
TallTokenVo.AccessToken t = new TallTokenVo.AccessToken(); |
|||
t.setAccessToken(data); |
|||
t.setTime(System.currentTimeMillis()); |
|||
accessTokenMap.put(get.getAppId(),t); |
|||
return data; |
|||
} |
|||
|
|||
/** |
|||
* 通过token获取用户信息 |
|||
* @return 返回accessToken |
|||
*/ |
|||
public static TallTokenVo.UserIdByToken getUserByToken(TallTokenDto.GetUserByToken getUserByToken){ |
|||
//查看业务是否开启redis缓存
|
|||
// if(REDIS_IS_OPEN.equals(openRedis)){
|
|||
// //查询token是否存在
|
|||
// util.redisUtil.get(token);
|
|||
// }
|
|||
//没开启redis则去map内查找,如果
|
|||
|
|||
//调用tall的接口生成查询项目信息
|
|||
|
|||
//发送请求
|
|||
String url = Constant.GATEWAY_URL + Constant.TALL_USER_TOKEN; |
|||
// String url = "http://127.0.0.1:7290/" + Constant.TALL_USER_TOKEN;
|
|||
log.info("调用接口:{}--{}", url, getUserByToken); |
|||
String postBody = null; |
|||
try{ |
|||
Map<String,String> map = new HashMap<>(); |
|||
map.put(Constant.ACCESS_TOKEN,getAccessToken(getUserByToken.getAppId(),getUserByToken.getSecret())); |
|||
postBody = RestTemplateUtil.postBodySpecialHeader(url, getUserByToken,map); |
|||
}catch (Exception e){ |
|||
log.error("获取accessToken异常--" + e); |
|||
} |
|||
if(StrUtil.isBlank(postBody)){ |
|||
return null; |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(postBody); |
|||
log.info("接口返回:{}", jsonObject); |
|||
//请求正确返回则,否则无操作
|
|||
Integer code = jsonObject.getInteger("code"); |
|||
if (code == null || code != 200) { |
|||
return null; |
|||
} |
|||
String data = jsonObject.getString("data"); |
|||
if(ObjectUtil.isNull(data)){ |
|||
return null; |
|||
} |
|||
TallTokenVo.UserIdByToken userIdByToken; |
|||
try { |
|||
userIdByToken = JSON.parseObject(data, TallTokenVo.UserIdByToken.class); |
|||
}catch (Exception e){ |
|||
log.info("返回值转换失败"); |
|||
return null; |
|||
} |
|||
|
|||
return userIdByToken; |
|||
} |
|||
|
|||
} |
|||
package com.ccsensptos.tallsdk.util; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.ccsens.util.RedisUtil; |
|||
import com.ccsens.util.RestTemplateUtil; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallTokenDto; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallTokenVo; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import javax.annotation.PostConstruct; |
|||
import javax.annotation.Resource; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Component |
|||
@Slf4j |
|||
public class TokenUtil { |
|||
/**缓存token或用户信息*/ |
|||
public static Map<String, Object> accessTokenMap = new HashMap<>(); |
|||
|
|||
public static String openRedis; |
|||
@Value("${spring.application.sdk-cache-redis:}") |
|||
public void setApplication(String redis) { |
|||
openRedis = redis; |
|||
} |
|||
|
|||
@Resource |
|||
private RedisUtil redisUtil; |
|||
private static TokenUtil util; |
|||
|
|||
@PostConstruct |
|||
public void init(){ |
|||
util = this; |
|||
util.redisUtil = this.redisUtil; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 通过AppId获取accessToken |
|||
* @return 返回accessToken |
|||
*/ |
|||
public static String getAccessToken(String appId, String secret){ |
|||
//查看业务是否开启redis缓存
|
|||
// if(REDIS_IS_OPEN.equals(openRedis)){
|
|||
// //redis开启则通过appId去redis内查询
|
|||
// util.redisUtil.get(appId);
|
|||
// }
|
|||
|
|||
//否则查找Map内是否存在
|
|||
//如果map内存在,则判断数据的时间是否到期,到期了就删掉
|
|||
//如果redis内未查到,或map内未查到,或map内时间到期,则调用tall的接口获取accessToken
|
|||
//在redis内缓存,或存在map内
|
|||
|
|||
//调用tall的接口生成accessToken
|
|||
|
|||
//查找map内的数据
|
|||
long now = System.currentTimeMillis(); |
|||
TallTokenVo.AccessToken accessToken = (TallTokenVo.AccessToken) accessTokenMap.get(appId); |
|||
if(ObjectUtil.isNotNull(accessToken)){ |
|||
if(accessToken.getTime() + Constant.EXPIRATION_TIME > now){ |
|||
return accessToken.getAccessToken(); |
|||
}else { |
|||
//如果过期,就删掉数据
|
|||
accessTokenMap.remove(appId); |
|||
} |
|||
} |
|||
//map内查不到,则去请求tall获取新的accessToken
|
|||
// String url = "http://127.0.0.1:7290/" + Constant.TALL_GET_ACCESS_TOKEN;
|
|||
String url = Constant.GATEWAY_URL + Constant.TALL_GET_ACCESS_TOKEN; |
|||
TallTokenDto.GetAccessToken get = new TallTokenDto.GetAccessToken(appId,secret); |
|||
log.info("调用接口:{}--{}", url, get); |
|||
String postBody = null; |
|||
try{ |
|||
postBody = RestTemplateUtil.postBody(url,get); |
|||
}catch (Exception e){ |
|||
log.error("获取accessToken异常--" + e); |
|||
} |
|||
if(StrUtil.isBlank(postBody)){ |
|||
return null; |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(postBody); |
|||
log.info("接口返回:{}", jsonObject); |
|||
//请求正确返回则,否则无操作
|
|||
Integer code = jsonObject.getInteger("code"); |
|||
if (code == null || code != 200) { |
|||
return null; |
|||
} |
|||
String data = jsonObject.getString("data"); |
|||
if(ObjectUtil.isNull(data)){ |
|||
return null; |
|||
} |
|||
TallTokenVo.AccessToken t = new TallTokenVo.AccessToken(); |
|||
t.setAccessToken(data); |
|||
t.setTime(System.currentTimeMillis()); |
|||
accessTokenMap.put(get.getAppId(),t); |
|||
return data; |
|||
} |
|||
|
|||
/** |
|||
* 通过token获取用户信息 |
|||
* @return 返回accessToken |
|||
*/ |
|||
public static TallTokenVo.UserIdByToken getUserByToken(TallTokenDto.GetUserByToken getUserByToken){ |
|||
//查看业务是否开启redis缓存
|
|||
// if(REDIS_IS_OPEN.equals(openRedis)){
|
|||
// //查询token是否存在
|
|||
// util.redisUtil.get(token);
|
|||
// }
|
|||
//没开启redis则去map内查找,如果
|
|||
|
|||
//调用tall的接口生成查询项目信息
|
|||
|
|||
//发送请求
|
|||
String url = Constant.GATEWAY_URL + Constant.TALL_USER_TOKEN; |
|||
// String url = "http://127.0.0.1:7290/" + Constant.TALL_USER_TOKEN;
|
|||
log.info("调用接口:{}--{}", url, getUserByToken); |
|||
String postBody = null; |
|||
try{ |
|||
Map<String,String> map = new HashMap<>(); |
|||
map.put(Constant.ACCESS_TOKEN,getAccessToken(getUserByToken.getAppId(),getUserByToken.getSecret())); |
|||
postBody = RestTemplateUtil.postBodySpecialHeader(url, getUserByToken,map); |
|||
}catch (Exception e){ |
|||
log.error("获取accessToken异常--" + e); |
|||
} |
|||
if(StrUtil.isBlank(postBody)){ |
|||
return null; |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(postBody); |
|||
log.info("接口返回:{}", jsonObject); |
|||
//请求正确返回则,否则无操作
|
|||
Integer code = jsonObject.getInteger("code"); |
|||
if (code == null || code != 200) { |
|||
return null; |
|||
} |
|||
String data = jsonObject.getString("data"); |
|||
if(ObjectUtil.isNull(data)){ |
|||
return null; |
|||
} |
|||
TallTokenVo.UserIdByToken userIdByToken; |
|||
try { |
|||
userIdByToken = JSON.parseObject(data, TallTokenVo.UserIdByToken.class); |
|||
}catch (Exception e){ |
|||
log.info("返回值转换失败"); |
|||
return null; |
|||
} |
|||
|
|||
return userIdByToken; |
|||
} |
|||
|
|||
} |
@ -1,34 +1,34 @@ |
|||
package com.ccsens.cloudutil.bean.ptos.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class FeignUserDto { |
|||
@Data |
|||
@ApiModel("通过token获取用户信息") |
|||
public static class UserInfoByToken{ |
|||
@ApiModelProperty("token") |
|||
private String token; |
|||
@ApiModelProperty("设备id") |
|||
private String deviceId; |
|||
@ApiModelProperty("ip地址") |
|||
private String clientIp; |
|||
@ApiModelProperty("客户端类型 0-H5 1-App") |
|||
private Byte clientType; |
|||
|
|||
public UserInfoByToken() { |
|||
} |
|||
|
|||
public UserInfoByToken(String token, String deviceId, String clientIp, Byte clientType) { |
|||
this.token = token; |
|||
this.deviceId = deviceId; |
|||
this.clientIp = clientIp; |
|||
this.clientType = clientType; |
|||
} |
|||
} |
|||
} |
|||
package com.ccsens.cloudutil.bean.ptos.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class FeignUserDto { |
|||
@Data |
|||
@ApiModel("通过token获取用户信息") |
|||
public static class UserInfoByToken{ |
|||
@ApiModelProperty("token") |
|||
private String token; |
|||
@ApiModelProperty("设备id") |
|||
private String deviceId; |
|||
@ApiModelProperty("ip地址") |
|||
private String clientIp; |
|||
@ApiModelProperty("客户端类型 0-H5 1-App") |
|||
private Byte clientType; |
|||
|
|||
public UserInfoByToken() { |
|||
} |
|||
|
|||
public UserInfoByToken(String token, String deviceId, String clientIp, Byte clientType) { |
|||
this.token = token; |
|||
this.deviceId = deviceId; |
|||
this.clientIp = clientIp; |
|||
this.clientType = clientType; |
|||
} |
|||
} |
|||
} |
@ -1,45 +1,45 @@ |
|||
package com.ccsens.cloudutil.config; |
|||
|
|||
import cn.hutool.json.JSONObject; |
|||
import cn.hutool.json.JSONUtil; |
|||
import feign.RequestInterceptor; |
|||
import feign.RequestTemplate; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.http.HttpHeaders; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.web.context.request.RequestContextHolder; |
|||
import org.springframework.web.context.request.ServletRequestAttributes; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Configuration |
|||
public class FeignTokenConfig implements RequestInterceptor { |
|||
@Override |
|||
public void apply(RequestTemplate template) { |
|||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
|||
System.out.println("attributes:"+attributes); |
|||
if (attributes != null) { |
|||
HttpServletRequest request = attributes.getRequest(); |
|||
System.out.println("token:" + request.getHeader(HttpHeaders.AUTHORIZATION)); |
|||
//添加token
|
|||
template.header(HttpHeaders.AUTHORIZATION, request.getHeader(HttpHeaders.AUTHORIZATION)); |
|||
return; |
|||
} |
|||
|
|||
byte[] body = template.body(); |
|||
if (body == null) { |
|||
return; |
|||
} |
|||
String json = new String(body); |
|||
JSONObject jsonObject = JSONUtil.parseObj(json); |
|||
|
|||
//添加token
|
|||
template.header("Authorization", jsonObject.getStr("token")); |
|||
|
|||
|
|||
} |
|||
} |
|||
package com.ccsens.cloudutil.config; |
|||
|
|||
import cn.hutool.json.JSONObject; |
|||
import cn.hutool.json.JSONUtil; |
|||
import feign.RequestInterceptor; |
|||
import feign.RequestTemplate; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.http.HttpHeaders; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.web.context.request.RequestContextHolder; |
|||
import org.springframework.web.context.request.ServletRequestAttributes; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Configuration |
|||
public class FeignTokenConfig implements RequestInterceptor { |
|||
@Override |
|||
public void apply(RequestTemplate template) { |
|||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
|||
System.out.println("attributes:"+attributes); |
|||
if (attributes != null) { |
|||
HttpServletRequest request = attributes.getRequest(); |
|||
System.out.println("token:" + request.getHeader(HttpHeaders.AUTHORIZATION)); |
|||
//添加token
|
|||
template.header(HttpHeaders.AUTHORIZATION, request.getHeader(HttpHeaders.AUTHORIZATION)); |
|||
return; |
|||
} |
|||
|
|||
byte[] body = template.body(); |
|||
if (body == null) { |
|||
return; |
|||
} |
|||
String json = new String(body); |
|||
JSONObject jsonObject = JSONUtil.parseObj(json); |
|||
|
|||
//添加token
|
|||
template.header("Authorization", jsonObject.getStr("token")); |
|||
|
|||
|
|||
} |
|||
} |
@ -1,44 +1,44 @@ |
|||
package com.ccsens.cloudutil.feign; |
|||
|
|||
|
|||
import com.ccsens.cloudutil.bean.ptos.dto.FeignProjectDto; |
|||
import com.ccsens.cloudutil.bean.ptos.vo.FeignProjectVo; |
|||
import com.ccsens.cloudutil.config.FeignTokenConfig; |
|||
import com.ccsens.util.JsonResponse; |
|||
import feign.hystrix.FallbackFactory; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@FeignClient(name = "diplomatist", path = "",fallbackFactory = DiplomatistFeignClientFallBack.class,configuration = FeignTokenConfig.class) |
|||
public interface DiplomatistFeignClient { |
|||
/** |
|||
* 查询用户关联的其他域的项目信息 |
|||
*/ |
|||
@GetMapping("domain/ptDomainProject") |
|||
JsonResponse<List<FeignProjectVo.ProjectInfo>> queryDomainProject(FeignProjectDto.QueryProjectByPhone params); |
|||
|
|||
} |
|||
|
|||
@Slf4j |
|||
@Component |
|||
class DiplomatistFeignClientFallBack implements FallbackFactory<DiplomatistFeignClient> { |
|||
|
|||
@Override |
|||
public DiplomatistFeignClient create(Throwable cause) { |
|||
log.error("访问传达室异常", cause); |
|||
return new DiplomatistFeignClient() { |
|||
@Override |
|||
public JsonResponse<List<FeignProjectVo.ProjectInfo>> queryDomainProject(FeignProjectDto.QueryProjectByPhone params) { |
|||
return null; |
|||
} |
|||
|
|||
}; |
|||
} |
|||
package com.ccsens.cloudutil.feign; |
|||
|
|||
|
|||
import com.ccsens.cloudutil.bean.ptos.dto.FeignProjectDto; |
|||
import com.ccsens.cloudutil.bean.ptos.vo.FeignProjectVo; |
|||
import com.ccsens.cloudutil.config.FeignTokenConfig; |
|||
import com.ccsens.util.JsonResponse; |
|||
import feign.hystrix.FallbackFactory; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@FeignClient(name = "diplomatist", path = "",fallbackFactory = DiplomatistFeignClientFallBack.class,configuration = FeignTokenConfig.class) |
|||
public interface DiplomatistFeignClient { |
|||
/** |
|||
* 查询用户关联的其他域的项目信息 |
|||
*/ |
|||
@GetMapping("domain/ptDomainProject") |
|||
JsonResponse<List<FeignProjectVo.ProjectInfo>> queryDomainProject(FeignProjectDto.QueryProjectByPhone params); |
|||
|
|||
} |
|||
|
|||
@Slf4j |
|||
@Component |
|||
class DiplomatistFeignClientFallBack implements FallbackFactory<DiplomatistFeignClient> { |
|||
|
|||
@Override |
|||
public DiplomatistFeignClient create(Throwable cause) { |
|||
log.error("访问传达室异常", cause); |
|||
return new DiplomatistFeignClient() { |
|||
@Override |
|||
public JsonResponse<List<FeignProjectVo.ProjectInfo>> queryDomainProject(FeignProjectDto.QueryProjectByPhone params) { |
|||
return null; |
|||
} |
|||
|
|||
}; |
|||
} |
|||
} |
@ -1,60 +1,60 @@ |
|||
package com.ccsens.cloudutil.feign; |
|||
|
|||
|
|||
import com.ccsens.cloudutil.bean.ptos.dto.FeignProjectDto; |
|||
import com.ccsens.cloudutil.bean.ptos.dto.FeignUserDto; |
|||
import com.ccsens.cloudutil.bean.ptos.vo.FeignProjectVo; |
|||
import com.ccsens.cloudutil.bean.ptos.vo.FeignUserVo; |
|||
import com.ccsens.cloudutil.config.FeignTokenConfig; |
|||
import com.ccsens.util.JsonResponse; |
|||
import feign.hystrix.FallbackFactory; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@FeignClient(name = "ptostall", path = "",fallbackFactory = PtosTallFeignClientFallBack.class,configuration = FeignTokenConfig.class) |
|||
public interface PtosTallFeignClient { |
|||
|
|||
/** |
|||
* 根据token获取userId |
|||
*/ |
|||
@PostMapping("users/token") |
|||
JsonResponse<FeignUserVo.TokenToUserId> getUserIdByToken(FeignUserDto.UserInfoByToken params); |
|||
|
|||
/** |
|||
* 根据手机号获取用户在本域的业务项目列表 |
|||
*/ |
|||
@PostMapping("project/byPhone") |
|||
JsonResponse<List<FeignProjectVo.ProjectInfo>> queryProjectByPhone(FeignProjectDto.QueryProjectByPhone params); |
|||
|
|||
} |
|||
|
|||
@Slf4j |
|||
@Component |
|||
class PtosTallFeignClientFallBack implements FallbackFactory<PtosTallFeignClient> { |
|||
|
|||
@Override |
|||
public PtosTallFeignClient create(Throwable cause) { |
|||
log.error("访问ptosTall异常", cause); |
|||
return new PtosTallFeignClient() { |
|||
@Override |
|||
public JsonResponse<FeignUserVo.TokenToUserId> getUserIdByToken(FeignUserDto.UserInfoByToken params) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public JsonResponse<List<FeignProjectVo.ProjectInfo>> queryProjectByPhone(FeignProjectDto.QueryProjectByPhone params) { |
|||
return null; |
|||
} |
|||
|
|||
}; |
|||
} |
|||
package com.ccsens.cloudutil.feign; |
|||
|
|||
|
|||
import com.ccsens.cloudutil.bean.ptos.dto.FeignProjectDto; |
|||
import com.ccsens.cloudutil.bean.ptos.dto.FeignUserDto; |
|||
import com.ccsens.cloudutil.bean.ptos.vo.FeignProjectVo; |
|||
import com.ccsens.cloudutil.bean.ptos.vo.FeignUserVo; |
|||
import com.ccsens.cloudutil.config.FeignTokenConfig; |
|||
import com.ccsens.util.JsonResponse; |
|||
import feign.hystrix.FallbackFactory; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@FeignClient(name = "ptostall", path = "",fallbackFactory = PtosTallFeignClientFallBack.class,configuration = FeignTokenConfig.class) |
|||
public interface PtosTallFeignClient { |
|||
|
|||
/** |
|||
* 根据token获取userId |
|||
*/ |
|||
@PostMapping("users/token") |
|||
JsonResponse<FeignUserVo.TokenToUserId> getUserIdByToken(FeignUserDto.UserInfoByToken params); |
|||
|
|||
/** |
|||
* 根据手机号获取用户在本域的业务项目列表 |
|||
*/ |
|||
@PostMapping("project/byPhone") |
|||
JsonResponse<List<FeignProjectVo.ProjectInfo>> queryProjectByPhone(FeignProjectDto.QueryProjectByPhone params); |
|||
|
|||
} |
|||
|
|||
@Slf4j |
|||
@Component |
|||
class PtosTallFeignClientFallBack implements FallbackFactory<PtosTallFeignClient> { |
|||
|
|||
@Override |
|||
public PtosTallFeignClient create(Throwable cause) { |
|||
log.error("访问ptosTall异常", cause); |
|||
return new PtosTallFeignClient() { |
|||
@Override |
|||
public JsonResponse<FeignUserVo.TokenToUserId> getUserIdByToken(FeignUserDto.UserInfoByToken params) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public JsonResponse<List<FeignProjectVo.ProjectInfo>> queryProjectByPhone(FeignProjectDto.QueryProjectByPhone params) { |
|||
return null; |
|||
} |
|||
|
|||
}; |
|||
} |
|||
} |
@ -1,28 +1,28 @@ |
|||
//package com.ccsens.cloudutil.ribbon;
|
|||
//
|
|||
//import com.netflix.client.config.IClientConfig;
|
|||
//import com.netflix.loadbalancer.AbstractLoadBalancerRule;
|
|||
//import com.netflix.loadbalancer.ILoadBalancer;
|
|||
//import com.netflix.loadbalancer.Server;
|
|||
//import org.springframework.context.annotation.Primary;
|
|||
//
|
|||
////@Primary
|
|||
//public class WpsBalanceRule extends AbstractLoadBalancerRule {
|
|||
//
|
|||
// @Override
|
|||
// public void initWithNiwsConfig(IClientConfig clientConfig) {
|
|||
//
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public Server choose(Object key) {
|
|||
// return choose(getLoadBalancer(), key);
|
|||
// }
|
|||
//
|
|||
// private Server choose(ILoadBalancer loadBalancer, Object key) {
|
|||
// System.out.println(key);
|
|||
// return null;
|
|||
// }
|
|||
//
|
|||
//
|
|||
//}
|
|||
//package com.ccsens.cloudutil.ribbon;
|
|||
//
|
|||
//import com.netflix.client.config.IClientConfig;
|
|||
//import com.netflix.loadbalancer.AbstractLoadBalancerRule;
|
|||
//import com.netflix.loadbalancer.ILoadBalancer;
|
|||
//import com.netflix.loadbalancer.Server;
|
|||
//import org.springframework.context.annotation.Primary;
|
|||
//
|
|||
////@Primary
|
|||
//public class WpsBalanceRule extends AbstractLoadBalancerRule {
|
|||
//
|
|||
// @Override
|
|||
// public void initWithNiwsConfig(IClientConfig clientConfig) {
|
|||
//
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public Server choose(Object key) {
|
|||
// return choose(getLoadBalancer(), key);
|
|||
// }
|
|||
//
|
|||
// private Server choose(ILoadBalancer loadBalancer, Object key) {
|
|||
// System.out.println(key);
|
|||
// return null;
|
|||
// }
|
|||
//
|
|||
//
|
|||
//}
|
@ -1,68 +1,68 @@ |
|||
//package com.ccsens.wechatutil.api;
|
|||
//
|
|||
//import cn.hutool.core.date.DateUtil;
|
|||
//import com.ccsens.util.JsonResponse;
|
|||
//import com.ccsens.util.PropUtil;
|
|||
//import com.ccsens.util.WebConstant;
|
|||
//import com.ccsens.util.wx.WxXcxUtil;
|
|||
//import com.ccsens.wechatutil.bean.dto.WechatCode;
|
|||
//import com.ccsens.wechatutil.wxmini.MiniCodeUtil;
|
|||
//import com.ccsens.wechatutil.wxofficial.OfficialAccountMessageUtil;
|
|||
//import io.swagger.annotations.Api;
|
|||
//import io.swagger.annotations.ApiImplicitParams;
|
|||
//import io.swagger.annotations.ApiOperation;
|
|||
//import lombok.extern.slf4j.Slf4j;
|
|||
//import org.springframework.web.bind.annotation.RequestMapping;
|
|||
//import org.springframework.web.bind.annotation.RequestMethod;
|
|||
//import org.springframework.web.bind.annotation.RestController;
|
|||
//
|
|||
//import javax.servlet.http.HttpServletRequest;
|
|||
//
|
|||
//@Api(tags = "DEBUG" , description = "DebugController | ")
|
|||
//@RestController
|
|||
//@RequestMapping("/debug")
|
|||
//@Slf4j
|
|||
//public class DebugController {
|
|||
//
|
|||
//
|
|||
//
|
|||
// @ApiOperation(value = "/测试",notes = "")
|
|||
// @ApiImplicitParams({
|
|||
// })
|
|||
// @RequestMapping(value="",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse debug(HttpServletRequest request) throws Exception {
|
|||
//
|
|||
// return JsonResponse.newInstance().ok("测试");
|
|||
// }
|
|||
//
|
|||
// @ApiOperation(value = "/测试",notes = "")
|
|||
// @ApiImplicitParams({
|
|||
// })
|
|||
// @RequestMapping(value="code",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse debugWxCode(HttpServletRequest request) throws Exception {
|
|||
// //生成二维码
|
|||
// String fileName = "/gameQrCode/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".png";
|
|||
// String path = WebConstant.UPLOAD_PATH_BASE + fileName;
|
|||
//
|
|||
// WechatCode.WechatCodeB wechatCodeB = new WechatCode.WechatCodeB();
|
|||
// wechatCodeB.setPage(WebConstant.QRCODE_GAME);
|
|||
// wechatCodeB.setScene("id=1&type=SQ");
|
|||
// MiniCodeUtil.getWxCodeB(wechatCodeB, path);
|
|||
//// WxXcxUtil.getWxCodeC(WebConstant.QRCODE_GAME+"?id=" + gameRecord.getId() + "&type=" + gameType.getCode(), path, gameType.getCode());
|
|||
//
|
|||
//// gameRecord.setQrCodeUrl(PropUtil.qrCode + fileName);
|
|||
// log.info("调用微信生成二维码");
|
|||
// return JsonResponse.newInstance().ok("测试");
|
|||
// }
|
|||
//
|
|||
// @ApiOperation(value = "/测试公众号消息",notes = "")
|
|||
// @ApiImplicitParams({
|
|||
// })
|
|||
// @RequestMapping(value="message",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse debugWxMessage(HttpServletRequest request) throws Exception {
|
|||
//// OfficialAccountMessageUtil.officialMessage();
|
|||
// log.info("发送公众号消息");
|
|||
// return JsonResponse.newInstance().ok("测试");
|
|||
// }
|
|||
//
|
|||
//}
|
|||
//package com.ccsens.wechatutil.api;
|
|||
//
|
|||
//import cn.hutool.core.date.DateUtil;
|
|||
//import com.ccsens.util.JsonResponse;
|
|||
//import com.ccsens.util.PropUtil;
|
|||
//import com.ccsens.util.WebConstant;
|
|||
//import com.ccsens.util.wx.WxXcxUtil;
|
|||
//import com.ccsens.wechatutil.bean.dto.WechatCode;
|
|||
//import com.ccsens.wechatutil.wxmini.MiniCodeUtil;
|
|||
//import com.ccsens.wechatutil.wxofficial.OfficialAccountMessageUtil;
|
|||
//import io.swagger.annotations.Api;
|
|||
//import io.swagger.annotations.ApiImplicitParams;
|
|||
//import io.swagger.annotations.ApiOperation;
|
|||
//import lombok.extern.slf4j.Slf4j;
|
|||
//import org.springframework.web.bind.annotation.RequestMapping;
|
|||
//import org.springframework.web.bind.annotation.RequestMethod;
|
|||
//import org.springframework.web.bind.annotation.RestController;
|
|||
//
|
|||
//import javax.servlet.http.HttpServletRequest;
|
|||
//
|
|||
//@Api(tags = "DEBUG" , description = "DebugController | ")
|
|||
//@RestController
|
|||
//@RequestMapping("/debug")
|
|||
//@Slf4j
|
|||
//public class DebugController {
|
|||
//
|
|||
//
|
|||
//
|
|||
// @ApiOperation(value = "/测试",notes = "")
|
|||
// @ApiImplicitParams({
|
|||
// })
|
|||
// @RequestMapping(value="",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse debug(HttpServletRequest request) throws Exception {
|
|||
//
|
|||
// return JsonResponse.newInstance().ok("测试");
|
|||
// }
|
|||
//
|
|||
// @ApiOperation(value = "/测试",notes = "")
|
|||
// @ApiImplicitParams({
|
|||
// })
|
|||
// @RequestMapping(value="code",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse debugWxCode(HttpServletRequest request) throws Exception {
|
|||
// //生成二维码
|
|||
// String fileName = "/gameQrCode/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".png";
|
|||
// String path = WebConstant.UPLOAD_PATH_BASE + fileName;
|
|||
//
|
|||
// WechatCode.WechatCodeB wechatCodeB = new WechatCode.WechatCodeB();
|
|||
// wechatCodeB.setPage(WebConstant.QRCODE_GAME);
|
|||
// wechatCodeB.setScene("id=1&type=SQ");
|
|||
// MiniCodeUtil.getWxCodeB(wechatCodeB, path);
|
|||
//// WxXcxUtil.getWxCodeC(WebConstant.QRCODE_GAME+"?id=" + gameRecord.getId() + "&type=" + gameType.getCode(), path, gameType.getCode());
|
|||
//
|
|||
//// gameRecord.setQrCodeUrl(PropUtil.qrCode + fileName);
|
|||
// log.info("调用微信生成二维码");
|
|||
// return JsonResponse.newInstance().ok("测试");
|
|||
// }
|
|||
//
|
|||
// @ApiOperation(value = "/测试公众号消息",notes = "")
|
|||
// @ApiImplicitParams({
|
|||
// })
|
|||
// @RequestMapping(value="message",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse debugWxMessage(HttpServletRequest request) throws Exception {
|
|||
//// OfficialAccountMessageUtil.officialMessage();
|
|||
// log.info("发送公众号消息");
|
|||
// return JsonResponse.newInstance().ok("测试");
|
|||
// }
|
|||
//
|
|||
//}
|
@ -1,80 +1,80 @@ |
|||
//package com.ccsens.wechatutil.api;
|
|||
//
|
|||
//import com.ccsens.util.JsonResponse;
|
|||
//import com.ccsens.wechatutil.bean.dto.WxMessageDto;
|
|||
//import com.ccsens.wechatutil.service.IWxMessageService;
|
|||
//import com.ccsens.wechatutil.service.IWxService;
|
|||
//import com.ccsens.wechatutil.bean.po.MiniProgramUser;
|
|||
//import com.ccsens.wechatutil.bean.po.WxOauth2UserInfo;
|
|||
//import com.ccsens.wechatutil.bean.dto.WechatCode;
|
|||
//import io.swagger.annotations.Api;
|
|||
//import io.swagger.annotations.ApiOperation;
|
|||
//import io.swagger.annotations.ApiParam;
|
|||
//import lombok.extern.slf4j.Slf4j;
|
|||
//import org.springframework.validation.annotation.Validated;
|
|||
//import org.springframework.web.bind.annotation.RequestMapping;
|
|||
//import org.springframework.web.bind.annotation.RequestMethod;
|
|||
//import org.springframework.web.bind.annotation.RestController;
|
|||
//
|
|||
//import javax.annotation.Resource;
|
|||
//
|
|||
///**
|
|||
// * @author 逗
|
|||
// */
|
|||
//@Api(tags = "DEBUG" , description = "DebugController | ")
|
|||
//@RestController
|
|||
//@RequestMapping("/wx")
|
|||
//@Slf4j
|
|||
//public class WxController {
|
|||
//
|
|||
// @Resource
|
|||
// private IWxService miniProgramService;
|
|||
// @Resource
|
|||
// private IWxMessageService wxMessageService;
|
|||
//
|
|||
// @ApiOperation(value = "小程序根据code获取appId", notes = "小程序")
|
|||
// @RequestMapping(value = "/signinByMini", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse signinByMini(@ApiParam @Validated String code) throws Exception{
|
|||
// MiniProgramUser wxUser = miniProgramService.signinByMini(code);
|
|||
// return JsonResponse.newInstance().ok();
|
|||
// }
|
|||
//
|
|||
// @ApiOperation(value = "公众号/网页二维码登录", notes = "公众号/网页二维码")
|
|||
// @RequestMapping(value = "/signinByH5", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse signinByH5(@ApiParam @Validated String code) throws Exception{
|
|||
// WxOauth2UserInfo wxUser = miniProgramService.signinByH5(code);
|
|||
// return JsonResponse.newInstance().ok();
|
|||
// }
|
|||
//
|
|||
// @ApiOperation(value = "生成小程序码-方案A", notes = "")
|
|||
// @RequestMapping(value = "/getWxCodeA", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse getWxCodeA(@ApiParam @Validated WechatCode.WechatCodeA wechatCodeA, String path) throws Exception{
|
|||
// miniProgramService.getWxCodeA(wechatCodeA, path);
|
|||
// return JsonResponse.newInstance().ok();
|
|||
// }
|
|||
//
|
|||
//
|
|||
// @ApiOperation(value = "生成小程序码-方案B", notes = "")
|
|||
// @RequestMapping(value = "/getWxCodeB", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse getWxCodeB(@ApiParam @Validated WechatCode.WechatCodeB wechatCodeB,String path) throws Exception{
|
|||
// wechatCodeB = new WechatCode.WechatCodeB();
|
|||
// wechatCodeB.setScene("id=1&type=SQ");
|
|||
// wechatCodeB.setPage("pages/index/index");
|
|||
// miniProgramService.getWxCodeB(wechatCodeB,path);
|
|||
// return JsonResponse.newInstance().ok();
|
|||
// }
|
|||
//
|
|||
// @ApiOperation(value = "生成小程序码-方案B", notes = "")
|
|||
// @RequestMapping(value = "/getWxCodeC", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse getWxCodeC(@ApiParam @Validated WechatCode.WechatCodeC wechatCodeC,String path) throws Exception{
|
|||
// miniProgramService.getWxCodeC(wechatCodeC,path);
|
|||
// return JsonResponse.newInstance().ok();
|
|||
// }
|
|||
//
|
|||
// @ApiOperation(value = "群机器人发送消息", notes = "")
|
|||
// @RequestMapping(value = "/robotMessage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse robotMessage(@ApiParam @Validated WxMessageDto.RobotMessage robotMessage) throws Exception{
|
|||
// wxMessageService.sendRobotInfo(robotMessage);
|
|||
// return JsonResponse.newInstance().ok();
|
|||
// }
|
|||
//}
|
|||
//package com.ccsens.wechatutil.api;
|
|||
//
|
|||
//import com.ccsens.util.JsonResponse;
|
|||
//import com.ccsens.wechatutil.bean.dto.WxMessageDto;
|
|||
//import com.ccsens.wechatutil.service.IWxMessageService;
|
|||
//import com.ccsens.wechatutil.service.IWxService;
|
|||
//import com.ccsens.wechatutil.bean.po.MiniProgramUser;
|
|||
//import com.ccsens.wechatutil.bean.po.WxOauth2UserInfo;
|
|||
//import com.ccsens.wechatutil.bean.dto.WechatCode;
|
|||
//import io.swagger.annotations.Api;
|
|||
//import io.swagger.annotations.ApiOperation;
|
|||
//import io.swagger.annotations.ApiParam;
|
|||
//import lombok.extern.slf4j.Slf4j;
|
|||
//import org.springframework.validation.annotation.Validated;
|
|||
//import org.springframework.web.bind.annotation.RequestMapping;
|
|||
//import org.springframework.web.bind.annotation.RequestMethod;
|
|||
//import org.springframework.web.bind.annotation.RestController;
|
|||
//
|
|||
//import javax.annotation.Resource;
|
|||
//
|
|||
///**
|
|||
// * @author 逗
|
|||
// */
|
|||
//@Api(tags = "DEBUG" , description = "DebugController | ")
|
|||
//@RestController
|
|||
//@RequestMapping("/wx")
|
|||
//@Slf4j
|
|||
//public class WxController {
|
|||
//
|
|||
// @Resource
|
|||
// private IWxService miniProgramService;
|
|||
// @Resource
|
|||
// private IWxMessageService wxMessageService;
|
|||
//
|
|||
// @ApiOperation(value = "小程序根据code获取appId", notes = "小程序")
|
|||
// @RequestMapping(value = "/signinByMini", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse signinByMini(@ApiParam @Validated String code) throws Exception{
|
|||
// MiniProgramUser wxUser = miniProgramService.signinByMini(code);
|
|||
// return JsonResponse.newInstance().ok();
|
|||
// }
|
|||
//
|
|||
// @ApiOperation(value = "公众号/网页二维码登录", notes = "公众号/网页二维码")
|
|||
// @RequestMapping(value = "/signinByH5", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse signinByH5(@ApiParam @Validated String code) throws Exception{
|
|||
// WxOauth2UserInfo wxUser = miniProgramService.signinByH5(code);
|
|||
// return JsonResponse.newInstance().ok();
|
|||
// }
|
|||
//
|
|||
// @ApiOperation(value = "生成小程序码-方案A", notes = "")
|
|||
// @RequestMapping(value = "/getWxCodeA", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse getWxCodeA(@ApiParam @Validated WechatCode.WechatCodeA wechatCodeA, String path) throws Exception{
|
|||
// miniProgramService.getWxCodeA(wechatCodeA, path);
|
|||
// return JsonResponse.newInstance().ok();
|
|||
// }
|
|||
//
|
|||
//
|
|||
// @ApiOperation(value = "生成小程序码-方案B", notes = "")
|
|||
// @RequestMapping(value = "/getWxCodeB", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse getWxCodeB(@ApiParam @Validated WechatCode.WechatCodeB wechatCodeB,String path) throws Exception{
|
|||
// wechatCodeB = new WechatCode.WechatCodeB();
|
|||
// wechatCodeB.setScene("id=1&type=SQ");
|
|||
// wechatCodeB.setPage("pages/index/index");
|
|||
// miniProgramService.getWxCodeB(wechatCodeB,path);
|
|||
// return JsonResponse.newInstance().ok();
|
|||
// }
|
|||
//
|
|||
// @ApiOperation(value = "生成小程序码-方案B", notes = "")
|
|||
// @RequestMapping(value = "/getWxCodeC", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse getWxCodeC(@ApiParam @Validated WechatCode.WechatCodeC wechatCodeC,String path) throws Exception{
|
|||
// miniProgramService.getWxCodeC(wechatCodeC,path);
|
|||
// return JsonResponse.newInstance().ok();
|
|||
// }
|
|||
//
|
|||
// @ApiOperation(value = "群机器人发送消息", notes = "")
|
|||
// @RequestMapping(value = "/robotMessage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse robotMessage(@ApiParam @Validated WxMessageDto.RobotMessage robotMessage) throws Exception{
|
|||
// wxMessageService.sendRobotInfo(robotMessage);
|
|||
// return JsonResponse.newInstance().ok();
|
|||
// }
|
|||
//}
|
@ -1,67 +1,67 @@ |
|||
package com.ccsens.wechatutil.bean.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class WechatCode { |
|||
/** |
|||
* 获取小程序码--方案A |
|||
*/ |
|||
@Data |
|||
public static class WechatCodeA{ |
|||
// 扫码进入的小程序页面路径,最大长度 128 字节,不能为空;
|
|||
public String path; |
|||
//二维码的宽度,单位 px,最小 280px,最大 1280px 默认430
|
|||
public Integer width; |
|||
//默认false 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调,默认 false
|
|||
public Boolean auto_color; |
|||
//auto_color 为 false 时生效,使用 rgb 设置颜色 例如 {"r":"xxx","g":"xxx","b":"xxx"} 十进制表示
|
|||
public LineColor line_color; |
|||
//默认false 是否需要透明底色,为 true 时,生成透明底色的小程序
|
|||
public Boolean is_hyaline; |
|||
} |
|||
|
|||
/** |
|||
* 获取小程序码--方案B |
|||
*/ |
|||
@Data |
|||
public static class WechatCodeB{ |
|||
//参数 --最大32个可见字符
|
|||
public String scene; |
|||
//小程序地址
|
|||
public String page; |
|||
//二维码的宽度,单位 px,最小 280px,最大 1280px 默认430
|
|||
public Integer width; |
|||
//默认false 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调,默认 false
|
|||
public Boolean auto_color; |
|||
//auto_color 为 false 时生效,使用 rgb 设置颜色 例如 {"r":"xxx","g":"xxx","b":"xxx"} 十进制表示
|
|||
public LineColor line_color; |
|||
//默认false 是否需要透明底色,为 true 时,生成透明底色的小程序
|
|||
public Boolean is_hyaline; |
|||
} |
|||
|
|||
/** |
|||
* rgb颜色 |
|||
*/ |
|||
@Data |
|||
public static class LineColor{ |
|||
public String r; |
|||
public String g; |
|||
public String b; |
|||
} |
|||
|
|||
/** |
|||
* 获取小程序码--方案C |
|||
*/ |
|||
@Data |
|||
public static class WechatCodeC{ |
|||
// 扫码进入的小程序页面路径,最大长度 128 字节,不能为空;
|
|||
public String path; |
|||
//二维码的宽度,单位 px,最小 280px,最大 1280px 默认430
|
|||
public Integer width; |
|||
} |
|||
|
|||
} |
|||
package com.ccsens.wechatutil.bean.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class WechatCode { |
|||
/** |
|||
* 获取小程序码--方案A |
|||
*/ |
|||
@Data |
|||
public static class WechatCodeA{ |
|||
// 扫码进入的小程序页面路径,最大长度 128 字节,不能为空;
|
|||
public String path; |
|||
//二维码的宽度,单位 px,最小 280px,最大 1280px 默认430
|
|||
public Integer width; |
|||
//默认false 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调,默认 false
|
|||
public Boolean auto_color; |
|||
//auto_color 为 false 时生效,使用 rgb 设置颜色 例如 {"r":"xxx","g":"xxx","b":"xxx"} 十进制表示
|
|||
public LineColor line_color; |
|||
//默认false 是否需要透明底色,为 true 时,生成透明底色的小程序
|
|||
public Boolean is_hyaline; |
|||
} |
|||
|
|||
/** |
|||
* 获取小程序码--方案B |
|||
*/ |
|||
@Data |
|||
public static class WechatCodeB{ |
|||
//参数 --最大32个可见字符
|
|||
public String scene; |
|||
//小程序地址
|
|||
public String page; |
|||
//二维码的宽度,单位 px,最小 280px,最大 1280px 默认430
|
|||
public Integer width; |
|||
//默认false 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调,默认 false
|
|||
public Boolean auto_color; |
|||
//auto_color 为 false 时生效,使用 rgb 设置颜色 例如 {"r":"xxx","g":"xxx","b":"xxx"} 十进制表示
|
|||
public LineColor line_color; |
|||
//默认false 是否需要透明底色,为 true 时,生成透明底色的小程序
|
|||
public Boolean is_hyaline; |
|||
} |
|||
|
|||
/** |
|||
* rgb颜色 |
|||
*/ |
|||
@Data |
|||
public static class LineColor{ |
|||
public String r; |
|||
public String g; |
|||
public String b; |
|||
} |
|||
|
|||
/** |
|||
* 获取小程序码--方案C |
|||
*/ |
|||
@Data |
|||
public static class WechatCodeC{ |
|||
// 扫码进入的小程序页面路径,最大长度 128 字节,不能为空;
|
|||
public String path; |
|||
//二维码的宽度,单位 px,最小 280px,最大 1280px 默认430
|
|||
public Integer width; |
|||
} |
|||
|
|||
} |
@ -1,115 +1,115 @@ |
|||
package com.ccsens.wechatutil.bean.dto; |
|||
|
|||
import cn.hutool.core.collection.CollectionUtil; |
|||
import com.ccsens.wechatutil.payutil.WxMessageUtil; |
|||
import lombok.Data; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class WxMessageDto { |
|||
/** |
|||
* 微信机器人发送消息 |
|||
*/ |
|||
@Data |
|||
public static class RobotMessage{ |
|||
//机器人地址
|
|||
public String webHook; |
|||
//消息的内容
|
|||
public String content; |
|||
//消息格式
|
|||
public String msgType; |
|||
//通过id@群内人员
|
|||
public List<String> mentionedList; |
|||
//通过手机号@群内人员
|
|||
public List<String> mentionedMobileList; |
|||
} |
|||
|
|||
@Data |
|||
public static class WxRobotVo{ |
|||
private String msgtype; |
|||
private WxRobotText text; |
|||
private WxRobotMarkdown markdown; |
|||
} |
|||
@Data |
|||
public static class WxRobotText{ |
|||
private String content; |
|||
private List<String> mentioned_list; |
|||
private List<String> mentioned_mobile_list; |
|||
} |
|||
@Data |
|||
public static class WxRobotMarkdown{ |
|||
private String content; |
|||
} |
|||
|
|||
/*** -----------------小程序订阅消息相关---------------------- */ |
|||
@Getter |
|||
@Setter |
|||
private static class CommonEntity { |
|||
private String value; |
|||
} |
|||
|
|||
@Getter |
|||
@Setter |
|||
public static class SubscribeEntity<T> { |
|||
private String touser; |
|||
private String template_id; |
|||
private String page; |
|||
private T data; |
|||
} |
|||
|
|||
@Getter |
|||
@Setter |
|||
public static class ReceiveSubscriBuyData { |
|||
public ReceiveSubscriBuyData(List<String> params) { |
|||
if (CollectionUtil.isNotEmpty(params) && params.size() >= 2) { |
|||
character_string1 = new CommonEntity(); |
|||
amount3 = new CommonEntity(); |
|||
thing4 = new CommonEntity(); |
|||
time2 = new CommonEntity(); |
|||
number11 = new CommonEntity(); |
|||
character_string1.setValue(params.get(0)); |
|||
amount3.setValue(params.get(1)); |
|||
thing4.setValue(params.get(2)); |
|||
time2.setValue(params.get(3)); |
|||
number11.setValue(params.get(4)); |
|||
} |
|||
} |
|||
|
|||
private CommonEntity character_string1;//订单编号
|
|||
private CommonEntity amount3;//订单金额
|
|||
private CommonEntity thing4;//商品名称
|
|||
private CommonEntity time2;//支付时间
|
|||
private CommonEntity number11;//购买数量
|
|||
} |
|||
|
|||
@Getter |
|||
@Setter |
|||
public static class ReceiveSubscriOrderSendData { |
|||
public ReceiveSubscriOrderSendData(List<String> params) { |
|||
if (CollectionUtil.isNotEmpty(params) && params.size() >= 2) { |
|||
thing1 = new CommonEntity(); |
|||
character_string2 = new CommonEntity(); |
|||
date3 = new CommonEntity(); |
|||
thing4 = new CommonEntity(); |
|||
character_string5 = new CommonEntity(); |
|||
thing1.setValue(params.get(0)); |
|||
character_string2.setValue(params.get(1)); |
|||
date3.setValue(params.get(2)); |
|||
thing4.setValue(params.get(3)); |
|||
character_string5.setValue(params.get(4)); |
|||
} |
|||
} |
|||
|
|||
private CommonEntity thing1;//商品名称
|
|||
private CommonEntity character_string2;//订单号
|
|||
private CommonEntity date3;//发货时间
|
|||
private CommonEntity thing4;//快递公司
|
|||
private CommonEntity character_string5;//快递单号
|
|||
} |
|||
} |
|||
package com.ccsens.wechatutil.bean.dto; |
|||
|
|||
import cn.hutool.core.collection.CollectionUtil; |
|||
import com.ccsens.wechatutil.payutil.WxMessageUtil; |
|||
import lombok.Data; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class WxMessageDto { |
|||
/** |
|||
* 微信机器人发送消息 |
|||
*/ |
|||
@Data |
|||
public static class RobotMessage{ |
|||
//机器人地址
|
|||
public String webHook; |
|||
//消息的内容
|
|||
public String content; |
|||
//消息格式
|
|||
public String msgType; |
|||
//通过id@群内人员
|
|||
public List<String> mentionedList; |
|||
//通过手机号@群内人员
|
|||
public List<String> mentionedMobileList; |
|||
} |
|||
|
|||
@Data |
|||
public static class WxRobotVo{ |
|||
private String msgtype; |
|||
private WxRobotText text; |
|||
private WxRobotMarkdown markdown; |
|||
} |
|||
@Data |
|||
public static class WxRobotText{ |
|||
private String content; |
|||
private List<String> mentioned_list; |
|||
private List<String> mentioned_mobile_list; |
|||
} |
|||
@Data |
|||
public static class WxRobotMarkdown{ |
|||
private String content; |
|||
} |
|||
|
|||
/*** -----------------小程序订阅消息相关---------------------- */ |
|||
@Getter |
|||
@Setter |
|||
private static class CommonEntity { |
|||
private String value; |
|||
} |
|||
|
|||
@Getter |
|||
@Setter |
|||
public static class SubscribeEntity<T> { |
|||
private String touser; |
|||
private String template_id; |
|||
private String page; |
|||
private T data; |
|||
} |
|||
|
|||
@Getter |
|||
@Setter |
|||
public static class ReceiveSubscriBuyData { |
|||
public ReceiveSubscriBuyData(List<String> params) { |
|||
if (CollectionUtil.isNotEmpty(params) && params.size() >= 2) { |
|||
character_string1 = new CommonEntity(); |
|||
amount3 = new CommonEntity(); |
|||
thing4 = new CommonEntity(); |
|||
time2 = new CommonEntity(); |
|||
number11 = new CommonEntity(); |
|||
character_string1.setValue(params.get(0)); |
|||
amount3.setValue(params.get(1)); |
|||
thing4.setValue(params.get(2)); |
|||
time2.setValue(params.get(3)); |
|||
number11.setValue(params.get(4)); |
|||
} |
|||
} |
|||
|
|||
private CommonEntity character_string1;//订单编号
|
|||
private CommonEntity amount3;//订单金额
|
|||
private CommonEntity thing4;//商品名称
|
|||
private CommonEntity time2;//支付时间
|
|||
private CommonEntity number11;//购买数量
|
|||
} |
|||
|
|||
@Getter |
|||
@Setter |
|||
public static class ReceiveSubscriOrderSendData { |
|||
public ReceiveSubscriOrderSendData(List<String> params) { |
|||
if (CollectionUtil.isNotEmpty(params) && params.size() >= 2) { |
|||
thing1 = new CommonEntity(); |
|||
character_string2 = new CommonEntity(); |
|||
date3 = new CommonEntity(); |
|||
thing4 = new CommonEntity(); |
|||
character_string5 = new CommonEntity(); |
|||
thing1.setValue(params.get(0)); |
|||
character_string2.setValue(params.get(1)); |
|||
date3.setValue(params.get(2)); |
|||
thing4.setValue(params.get(3)); |
|||
character_string5.setValue(params.get(4)); |
|||
} |
|||
} |
|||
|
|||
private CommonEntity thing1;//商品名称
|
|||
private CommonEntity character_string2;//订单号
|
|||
private CommonEntity date3;//发货时间
|
|||
private CommonEntity thing4;//快递公司
|
|||
private CommonEntity character_string5;//快递单号
|
|||
} |
|||
} |
@ -1,14 +1,14 @@ |
|||
package com.ccsens.wechatutil.bean.po; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class MiniProgramUser extends WxBaseEntity { |
|||
|
|||
public String openid; |
|||
public String session_key; |
|||
public String unionid; |
|||
} |
|||
package com.ccsens.wechatutil.bean.po; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class MiniProgramUser extends WxBaseEntity { |
|||
|
|||
public String openid; |
|||
public String session_key; |
|||
public String unionid; |
|||
} |
@ -1,14 +1,14 @@ |
|||
package com.ccsens.wechatutil.exception; |
|||
|
|||
public class PayException extends RuntimeException{ |
|||
private int code; |
|||
public PayException(int code,String message){ |
|||
super(message); |
|||
this.code = code; |
|||
} |
|||
|
|||
public PayException(String message){ |
|||
super(message); |
|||
this.code = -1; |
|||
} |
|||
} |
|||
package com.ccsens.wechatutil.exception; |
|||
|
|||
public class PayException extends RuntimeException{ |
|||
private int code; |
|||
public PayException(int code,String message){ |
|||
super(message); |
|||
this.code = code; |
|||
} |
|||
|
|||
public PayException(String message){ |
|||
super(message); |
|||
this.code = -1; |
|||
} |
|||
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue