5263a93b1e08a52675a0ed3ac153e80d3c8b4bf9.svn-base 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package cn.com.goldenwater.dcproj.controller.meeting;
  2. import cn.com.goldenwater.dcproj.model.AttMeetingInfo;
  3. import cn.com.goldenwater.dcproj.model.GwComFile;
  4. import cn.com.goldenwater.dcproj.param.AttMeetingInfoParam;
  5. import cn.com.goldenwater.dcproj.service.AttMeetingInfoService;
  6. import cn.com.goldenwater.core.web.BaseController;
  7. import cn.com.goldenwater.core.web.BaseResponse;
  8. import cn.com.goldenwater.dcproj.service.GwComFileService;
  9. import cn.com.goldenwater.dcproj.utils.QRCodeUtil;
  10. import cn.com.goldenwater.id.util.UuidUtil;
  11. import io.swagger.annotations.Api;
  12. import io.swagger.annotations.ApiOperation;
  13. import io.swagger.annotations.ApiParam;
  14. import org.apache.commons.lang3.StringUtils;
  15. import com.github.pagehelper.PageInfo;
  16. import org.slf4j.Logger;
  17. import org.slf4j.LoggerFactory;
  18. import org.springframework.beans.factory.annotation.Autowired;
  19. import org.springframework.beans.factory.annotation.Value;
  20. import org.springframework.web.bind.annotation.PathVariable;
  21. import org.springframework.web.bind.annotation.RequestBody;
  22. import org.springframework.web.bind.annotation.RequestMapping;
  23. import org.springframework.web.bind.annotation.RequestMethod;
  24. import org.springframework.web.bind.annotation.RestController;
  25. import java.util.List;
  26. /**
  27. * @author lune
  28. * @date 2019-7-9
  29. */
  30. @Api(value = "ATT 培训会议信息管理管理", tags = "ATT 培训会议信息管理管理")
  31. @RestController
  32. @RequestMapping("/att/meeting/info")
  33. public class AttMeetingInfoController extends BaseController {
  34. private Logger logger = LoggerFactory.getLogger(getClass());
  35. @Autowired
  36. private AttMeetingInfoService attMeetingInfoService;
  37. @Value("${web.upload-path}")
  38. public String fileDir;
  39. @Autowired
  40. private GwComFileService gwComFileService;
  41. @Value("${work.url}")
  42. private String workUrl;
  43. @ApiOperation(value = "添加/修改培训会议信息管理可用于提交附件信息")
  44. @RequestMapping(value = "", method = RequestMethod.POST)
  45. public BaseResponse<AttMeetingInfo> insert(@ApiParam(name = "attMeetingInfo", value = "AttMeetingInfo", required = true) @RequestBody AttMeetingInfo attMeetingInfo) {
  46. if (StringUtils.isBlank(attMeetingInfo.getId())) {
  47. String uuid = UuidUtil.uuid(); // 生成uuid
  48. attMeetingInfo.setId(uuid);
  49. attMeetingInfoService.insertData(attMeetingInfo);
  50. } else {
  51. attMeetingInfoService.updateData(attMeetingInfo);
  52. }
  53. return buildSuccessResponse(attMeetingInfo);
  54. }
  55. @ApiOperation(value = "会议信息二维码", notes = "参数字段说明:{\n\r" +
  56. " \"meetingId\":\"会议ID\",\n\r" +
  57. " \"hostPath\":\"服务器路径(如:http://192.168.1.107:8101)\",\n\r" +
  58. " };\n\r" +
  59. "返回结构说明:{\n\r" +
  60. " \"success\":\"是否成功(true为成功,false为失败)\",\n\r" +
  61. " \"code\":\"错误代码\",\n\r" +
  62. " \"message\":\"描述信息\",\n\r" +
  63. " \"throwable\":\"异常信息\",\n\r" +
  64. " \"data(数据信息)\":\"二维码路径\",\n\r" +
  65. " }")
  66. @RequestMapping(value = "/getQRCode", method = RequestMethod.POST)
  67. public BaseResponse getQRCode(String meetingId, String hostPath) throws Exception {
  68. QRCodeUtil.encode(workUrl+"/sldc/work.html?meetingId=" + meetingId, fileDir + "QRCode\\logo\\logo.jpg", fileDir + "QRCode", meetingId, true);
  69. return buildSuccessResponse(hostPath + "/upload/QRCode/" + meetingId + ".jpg");
  70. }
  71. @ApiOperation(value = "根据ID删除培训会议信息管理")
  72. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  73. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  74. int ret = attMeetingInfoService.delete(id);
  75. return buildSuccessResponse();
  76. }
  77. @ApiOperation(value = "根据ID获取培训会议信息管理(单表)包含附件信息")
  78. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  79. public BaseResponse<AttMeetingInfo> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  80. AttMeetingInfo attMeetingInfo = attMeetingInfoService.get(id);
  81. if (attMeetingInfo != null) {
  82. List<GwComFile> comFileList = gwComFileService.findFileByBiz(id);
  83. attMeetingInfo.setComFileList(comFileList);
  84. }
  85. return buildSuccessResponse(attMeetingInfo);
  86. }
  87. @ApiOperation(value = "获取培训会议信息管理(列表所有)")
  88. @RequestMapping(value = "/list", method = RequestMethod.POST)
  89. public BaseResponse<List<AttMeetingInfo>> list(@ApiParam(name = "attMeetingInfoParam", value = "attMeetingInfoParam", required = true) @RequestBody AttMeetingInfoParam attMeetingInfoParam) {
  90. List<AttMeetingInfo> attMeetingInfoList = attMeetingInfoService.findList(attMeetingInfoParam);
  91. return buildSuccessResponse(attMeetingInfoList);
  92. }
  93. @ApiOperation(value = "获取培训会议信息管理(列表--分页)")
  94. @RequestMapping(value = "/page", method = RequestMethod.POST)
  95. public BaseResponse<PageInfo<AttMeetingInfo>> page(@ApiParam(name = "attMeetingInfoParam", value = "attMeetingInfoParam", required = true) @RequestBody AttMeetingInfoParam attMeetingInfoParam) {
  96. PageInfo<AttMeetingInfo> attMeetingInfoList = attMeetingInfoService.findPageInfo(attMeetingInfoParam);
  97. return buildSuccessResponse(attMeetingInfoList);
  98. }
  99. }