|
|
|
@@ -1,5 +1,7 @@ |
|
|
|
package com.xueyi.system.staff.controller.api; |
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
@@ -8,10 +10,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.xueyi.common.cache.utils.DictUtil; |
|
|
|
import com.xueyi.common.core.constant.basic.SqlConstants; |
|
|
|
import com.xueyi.common.core.web.result.AjaxResult; |
|
|
|
import com.xueyi.common.core.web.result.R; |
|
|
|
import com.xueyi.common.security.annotation.InnerAuth; |
|
|
|
import com.xueyi.common.sms.configure.SmsProperties; |
|
|
|
import com.xueyi.common.web.constant.ResponseCode; |
|
|
|
import com.xueyi.common.web.utils.DateUtils; |
|
|
|
import com.xueyi.file.api.domain.SysFile; |
|
|
|
import com.xueyi.file.api.feign.RemoteFileService; |
|
|
|
import com.xueyi.system.api.dict.domain.dto.SysDictDataDto; |
|
|
|
import com.xueyi.system.api.dict.domain.po.SysDictDataPo; |
|
|
|
import com.xueyi.system.api.digitalmans.domain.dto.DmVisitRecordsDto; |
|
|
|
@@ -30,6 +35,9 @@ import com.xueyi.system.meeting.constant.VisitRecordStatus; |
|
|
|
import com.xueyi.system.receiver.domain.po.DmTenantReceiverPo; |
|
|
|
import com.xueyi.system.receiver.mapper.DmTenantReceiverMapper; |
|
|
|
import com.xueyi.system.resource.controller.api.BaseApiController; |
|
|
|
import com.xueyi.system.resource.domain.dto.DmResourcesDto; |
|
|
|
import com.xueyi.system.resource.service.impl.DmResourcesServiceImpl; |
|
|
|
import com.xueyi.system.resource.service.impl.FaceServiceImpl; |
|
|
|
import com.xueyi.system.staff.domain.model.DmVisitRecordsConverter; |
|
|
|
import com.xueyi.system.staff.domain.model.DmVisitorSmsConfigConverter; |
|
|
|
import com.xueyi.system.staff.domain.po.DmVisitorSmsConfigPo; |
|
|
|
@@ -38,6 +46,7 @@ import com.xueyi.system.staff.mapper.DmVisitRecordsMapper; |
|
|
|
import com.xueyi.system.staff.mapper.DmVisitorSmsConfigMapper; |
|
|
|
import com.xueyi.system.staff.mapper.DmVisitorsMapper; |
|
|
|
import com.xueyi.system.staff.service.impl.DmVisitRecordsServiceImpl; |
|
|
|
import com.xueyi.system.utils.common.ImageUtil; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
@@ -93,6 +102,18 @@ public class DmVisitorInnerApiController extends BaseApiController { |
|
|
|
@Autowired |
|
|
|
DmTenantReceiverMapper receiverMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private RemoteFileService fileService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private FaceServiceImpl faceService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private DmResourcesServiceImpl iDmResourcesService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ImageUtil imageUtil; |
|
|
|
|
|
|
|
@InnerAuth |
|
|
|
@PostMapping(value = "confirm-visitor") |
|
|
|
public com.alibaba.fastjson2.JSONObject queryVisit(String visitorName/*, Long empId*/){ |
|
|
|
@@ -143,7 +164,6 @@ public class DmVisitorInnerApiController extends BaseApiController { |
|
|
|
Wrappers.<DmVisitorsPo>query().lambda() |
|
|
|
.eq(DmVisitorsPo::getPhone, commonDto.getVisitorTel()).last(SqlConstants.LIMIT_ONE)); |
|
|
|
} |
|
|
|
System.err.println("exec===1"); |
|
|
|
if (v == null) { |
|
|
|
v = new DmVisitorsPo(); |
|
|
|
v.setName(commonDto.getVisitorName()); |
|
|
|
@@ -151,6 +171,32 @@ public class DmVisitorInnerApiController extends BaseApiController { |
|
|
|
v.setVisitorCompany(commonDto.getVisitCompany()); |
|
|
|
v.setPhone(commonDto.getVisitorTel()); |
|
|
|
v.setType(DmVisitorsDto.TYPE_NORMAL_VISITOR); |
|
|
|
|
|
|
|
//兼容熟人介绍生人,传递访客照片 |
|
|
|
if (StringUtils.isNotEmpty(commonDto.getVisitorBase64Img())) { |
|
|
|
String imgBase64 = commonDto.getVisitorBase64Img(); |
|
|
|
R<SysFile> fileResult = fileService.upload(imageUtil.base64ToMultipartFile(imgBase64)); |
|
|
|
if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData())) |
|
|
|
return output(ResponseCode.FILE_SERVICE_ERROR).toJSON(); |
|
|
|
String url = fileResult.getData().getUrl(); |
|
|
|
DmResourcesDto dmResourcesDto = new DmResourcesDto(); |
|
|
|
dmResourcesDto.setType(DmResourcesDto.TYPE_PIC); |
|
|
|
dmResourcesDto.setUrl(url); |
|
|
|
dmResourcesDto.setName("stranger"); |
|
|
|
|
|
|
|
com.alibaba.fastjson.JSONObject json = faceService.getFaceExtraction("", "", imgBase64); |
|
|
|
|
|
|
|
if (0!=json.getInteger("status")) { |
|
|
|
return output(-1, json.getString("errMsg")).toJSON(); |
|
|
|
} else { |
|
|
|
JSONArray obj = json.getJSONArray("result").getJSONObject(0).getJSONArray("faces").getJSONObject(0).getJSONArray("feature"); |
|
|
|
dmResourcesDto.setFeature(obj.toJSONString()); |
|
|
|
} |
|
|
|
|
|
|
|
iDmResourcesService.addOne(dmResourcesDto); |
|
|
|
|
|
|
|
v.setResourceId(dmResourcesDto.getId()); |
|
|
|
} |
|
|
|
dmVisitorsMapper.addOne(v); |
|
|
|
} else { |
|
|
|
v.setName(commonDto.getVisitorName()); |
|
|
|
@@ -159,34 +205,23 @@ public class DmVisitorInnerApiController extends BaseApiController { |
|
|
|
dmVisitorsMapper.updateById(v); |
|
|
|
} |
|
|
|
DmVisitRecordsPo visitRecords = new DmVisitRecordsPo(); |
|
|
|
System.err.println("exec===2"); |
|
|
|
try { |
|
|
|
DmStaffPo emp = dmStaffMapper.selectOne( |
|
|
|
Wrappers.<DmStaffPo>query().lambda() |
|
|
|
.eq(DmStaffPo::getId, commonDto.getEmpId()).last(SqlConstants.LIMIT_ONE)); |
|
|
|
System.err.println("exec===2111-"); |
|
|
|
System.err.println(emp); |
|
|
|
System.err.println("emp===end"); |
|
|
|
System.err.println(commonDto); |
|
|
|
if (ObjectUtils.isNotEmpty(emp)) { |
|
|
|
visitRecords.setDeptId(emp.getDeptId()); |
|
|
|
visitRecords.setVisitorId(v.getId()); |
|
|
|
System.err.println("emp===111"); |
|
|
|
if (StringUtils.isNotEmpty(commonDto.getVisitDate())) { |
|
|
|
visitRecords.setVisitDate(DateUtils.parseStrToDate(commonDto.getVisitDate(), "yyyy-MM-dd")); |
|
|
|
} |
|
|
|
System.err.println("emp===2222"); |
|
|
|
visitRecords.setUserId(commonDto.getEmpId()); |
|
|
|
visitRecords.setRecordStatus(VisitRecordStatus.getRecordStatusStart()); |
|
|
|
System.err.println("emp===333"); |
|
|
|
String code = visitRecordsService.genVisitorCode(); |
|
|
|
System.err.println("emp===444"); |
|
|
|
visitRecords.setVisitorCode(code); |
|
|
|
visitRecords.setReceiverName(commonDto.getEmpName()); |
|
|
|
visitRecords.setReceiverPhone(commonDto.getEmpTel()); |
|
|
|
System.err.println("emp===555"); |
|
|
|
dmVisitRecordsMapper.insert(visitRecords); |
|
|
|
System.err.println("exec===3--"+commonDto.getVisitorTel()); |
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
if (null != commonDto.getVisitorTel()){ |
|
|
|
|
|
|
|
@@ -205,13 +240,11 @@ public class DmVisitorInnerApiController extends BaseApiController { |
|
|
|
json.put("parkInfo", dmVisitorSmsConfigPo!=null?dmVisitorSmsConfigPo.getParkPrompt():""); |
|
|
|
//给访客发送短信 |
|
|
|
SmsReqEntity send = new SmsReqEntity(); |
|
|
|
System.err.println(json.toJSONString()); |
|
|
|
System.err.println("exec===4"); |
|
|
|
|
|
|
|
send.setPhone(commonDto.getVisitorTel()); |
|
|
|
send.setTemplate(smsProperties.getVisitorTemplate()); |
|
|
|
send.setDataMap(json.toJSONString()); |
|
|
|
remoteSmsService.sendSms(send); |
|
|
|
send.setPhone(commonDto.getVisitorTel()); |
|
|
|
send.setTemplate(smsProperties.getVisitorTemplate()); |
|
|
|
send.setDataMap(json.toJSONString()); |
|
|
|
remoteSmsService.sendSms(send); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|