package cn.com.goldenwater.dcproj.controller.meeting; import cn.com.goldenwater.dcproj.model.AttMeetingInfo; import cn.com.goldenwater.dcproj.model.GwComFile; import cn.com.goldenwater.dcproj.param.AttMeetingInfoParam; import cn.com.goldenwater.dcproj.service.AttMeetingInfoService; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.service.GwComFileService; import cn.com.goldenwater.dcproj.utils.QRCodeUtil; import cn.com.goldenwater.id.util.UuidUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.commons.lang3.StringUtils; import com.github.pagehelper.PageInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.PathVariable; 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 java.util.List; /** * @author lune * @date 2019-7-9 */ @Api(value = "ATT 培训会议信息管理管理", tags = "ATT 培训会议信息管理管理") @RestController @RequestMapping("/att/meeting/info") public class AttMeetingInfoController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private AttMeetingInfoService attMeetingInfoService; @Value("${web.upload-path}") public String fileDir; @Autowired private GwComFileService gwComFileService; @Value("${work.url}") private String workUrl; @ApiOperation(value = "添加/修改培训会议信息管理可用于提交附件信息") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "attMeetingInfo", value = "AttMeetingInfo", required = true) @RequestBody AttMeetingInfo attMeetingInfo) { if (StringUtils.isBlank(attMeetingInfo.getId())) { String uuid = UuidUtil.uuid(); // 生成uuid attMeetingInfo.setId(uuid); attMeetingInfoService.insertData(attMeetingInfo); } else { attMeetingInfoService.updateData(attMeetingInfo); } return buildSuccessResponse(attMeetingInfo); } @ApiOperation(value = "会议信息二维码", notes = "参数字段说明:{\n\r" + " \"meetingId\":\"会议ID\",\n\r" + " \"hostPath\":\"服务器路径(如:http://192.168.1.107:8101)\",\n\r" + " };\n\r" + "返回结构说明:{\n\r" + " \"success\":\"是否成功(true为成功,false为失败)\",\n\r" + " \"code\":\"错误代码\",\n\r" + " \"message\":\"描述信息\",\n\r" + " \"throwable\":\"异常信息\",\n\r" + " \"data(数据信息)\":\"二维码路径\",\n\r" + " }") @RequestMapping(value = "/getQRCode", method = RequestMethod.POST) public BaseResponse getQRCode(String meetingId, String hostPath) throws Exception { QRCodeUtil.encode(workUrl+"/sldc/work.html?meetingId=" + meetingId, fileDir + "QRCode\\logo\\logo.jpg", fileDir + "QRCode", meetingId, true); return buildSuccessResponse(hostPath + "/upload/QRCode/" + meetingId + ".jpg"); } @ApiOperation(value = "根据ID删除培训会议信息管理") @RequestMapping(value = "/del/{id}", method = RequestMethod.GET) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = attMeetingInfoService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "根据ID获取培训会议信息管理(单表)包含附件信息") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { AttMeetingInfo attMeetingInfo = attMeetingInfoService.get(id); if (attMeetingInfo != null) { List comFileList = gwComFileService.findFileByBiz(id); attMeetingInfo.setComFileList(comFileList); } return buildSuccessResponse(attMeetingInfo); } @ApiOperation(value = "获取培训会议信息管理(列表所有)") @RequestMapping(value = "/list", method = RequestMethod.POST) public BaseResponse> list(@ApiParam(name = "attMeetingInfoParam", value = "attMeetingInfoParam", required = true) @RequestBody AttMeetingInfoParam attMeetingInfoParam) { List attMeetingInfoList = attMeetingInfoService.findList(attMeetingInfoParam); return buildSuccessResponse(attMeetingInfoList); } @ApiOperation(value = "获取培训会议信息管理(列表--分页)") @RequestMapping(value = "/page", method = RequestMethod.POST) public BaseResponse> page(@ApiParam(name = "attMeetingInfoParam", value = "attMeetingInfoParam", required = true) @RequestBody AttMeetingInfoParam attMeetingInfoParam) { PageInfo attMeetingInfoList = attMeetingInfoService.findPageInfo(attMeetingInfoParam); return buildSuccessResponse(attMeetingInfoList); } }