src/main/java/com/product/administration/controller/ConferenceManagerController.java
@@ -19,7 +19,9 @@ import com.product.module.sys.config.SystemErrorCode; import com.product.module.sys.version.ApiVersion; import com.product.util.BaseUtil; import org.omg.CORBA.DATA_CONVERSION; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -28,6 +30,9 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.OutputStream; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -513,19 +518,19 @@ * @throws IOException * @throws WriterException */ @PostMapping("/get_QrCode/{version}") @GetMapping("/get_QrCode/{version}") @ApiVersion(1) public void getQrCode(HttpServletRequest request, HttpServletResponse response) throws IOException, WriterException { public void getQrCode(String uuid,HttpServletRequest request, HttpServletResponse response) throws IOException, WriterException { //获取参数 FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); /* Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); if (bean != null) { RequestParameterEntity reqp = (RequestParameterEntity) bean; fse = reqp.getFormData(); if(fse!=null && !StringUtils.isEmpty(fse.getString("uuid"))){ String uuid = fse.getString("uuid"); if(fse!=null && !StringUtils.isEmpty(fse.getString("uuid"))){*/ // String uuid = fse.getString("uuid"); // 设置响应流信息 response.setContentType("image/jpg"); response.setHeader("Pragma", "no-cache"); @@ -533,19 +538,20 @@ response.setDateHeader("Expires", 0); OutputStream stream = response.getOutputStream(); //后端跳转地址 // String content = ("http://www.baidu.com"); JSONObject jsonData = new JSONObject(); jsonData.put("uuid",uuid); jsonData.put("date",new Date()); //jsonData.put("url",content); Date date = new Date(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String formatDate = dateFormat.format(date); jsonData.put("date",formatDate); //获取一个二维码图片 BitMatrix bitMatrix = conferenceManagerService.getQrCode(jsonData.toString()); //以流的形式输出到前端 MatrixToImageWriter.writeToStream(bitMatrix , "jpg" , stream); } } // } //} } @@ -574,6 +580,24 @@ } @PostMapping("/conference_sign/{version}") @ApiVersion(1) public String ConferenceSign(HttpServletRequest request) throws ParseException { //获取参数 FieldSetEntity fse = null; /*Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); if (bean != null) { RequestParameterEntity reqp = (RequestParameterEntity) bean; fse = reqp.getFormData(); } //判断参数是否为空 if (bean == null || fse == null) { return this.error(com.product.admin.config.SystemCode.SYSTEM_FORM_NODATA.getValue(), com.product.admin.config.SystemCode.SYSTEM_FORM_NODATA.getText()); }*/ String s = conferenceManagerService.ConferenceSign(fse); return OK(s); } } src/main/java/com/product/administration/service/ConferenceManagerService.java
@@ -1,7 +1,10 @@ package com.product.administration.service; import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSONObject; import com.google.errorprone.annotations.Var; import com.google.zxing.BarcodeFormat; import com.google.zxing.EncodeHintType; import com.google.zxing.MultiFormatWriter; @@ -38,6 +41,7 @@ import java.io.IOException; import java.text.DecimalFormat; import java.text.Format; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; @@ -458,6 +462,48 @@ } @Override public String ConferenceSign(FieldSetEntity fse) throws BaseException, ParseException { JSONObject jsonObject = new JSONObject(); /* if(!StringUtils.isEmpty(fse.getString("uuid"))&&!StringUtils.isEmpty(fse.getString("date"))){*/ /*String uuid = fse.getString("uuid"); String date = fse.getString("date"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date parseDate = dateFormat.parse(date); long between = DateUtil.between(parseDate, new Date(), DateUnit.SECOND);*/ String uuid="5591f2ea-b7bd-49c4-999a-9a1045edc717"; /* if(between>20){ jsonObject.put("code","200"); jsonObject.put("msg","二维码已失效"); jsonObject.put("status","fail"); }else {*/ SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); FieldSetEntity fieldSetEntity = new FieldSetEntity(); fieldSetEntity.setTableName("product_oa_conference_sign"); fieldSetEntity.setValue("sign_user",currentUser.getUser_name()); fieldSetEntity.setValue("user_id",currentUser.getUser_id()); fieldSetEntity.setValue("org_level_uuid","00000000-0000-0000-0000-000000000000"); fieldSetEntity.setValue("organization",currentUser.getDept_uuid()); fieldSetEntity.setValue("organization_name",currentUser.getCurrentDept().getString("org_level_name")); fieldSetEntity.setValue("sign_date",new Date()); fieldSetEntity.setValue("sign_status","已签到"); fieldSetEntity.setValue("meeting_uuid",uuid); // BaseUtil.createCreatorAndCreationTime(SpringMVCContextHolder.getCurrentUser(), fse); baseDao.add(fieldSetEntity); jsonObject.put("code","200"); jsonObject.put("msg","签到成功"); jsonObject.put("status","sucess"); /* }*/ /* }*/ return jsonObject.toString(); } /** * 会议室使用情况 src/main/java/com/product/administration/service/ide/IConferenceManagerService.java
@@ -7,6 +7,7 @@ import com.product.core.exception.BaseException; import java.io.IOException; import java.text.ParseException; import java.util.HashMap; import java.util.List; @@ -46,6 +47,10 @@ void CancelAndStart(FieldSetEntity fse)throws BaseException; String ConferenceSign(FieldSetEntity fse) throws BaseException, ParseException;