| @@ -13,6 +13,7 @@ import com.xueyi.common.web.response.MyResponse; | |||
| import com.xueyi.common.web.utils.MyDateUtils; | |||
| import com.xueyi.file.api.domain.SysFile; | |||
| import com.xueyi.file.api.feign.RemoteFileService; | |||
| import com.xueyi.system.api.digitalmans.domain.po.DmVisitorsPo; | |||
| import com.xueyi.system.api.pass.domain.dto.DmRecognizedMultiRecordsDto; | |||
| import com.xueyi.system.api.pass.domain.dto.DmRecognizedRecordsDto; | |||
| import com.xueyi.system.api.pass.domain.po.DmRecognizedRecordsPo; | |||
| @@ -25,6 +26,7 @@ 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.mapper.DmStaffMapper; | |||
| import com.xueyi.system.staff.mapper.DmVisitorsMapper; | |||
| import com.xueyi.system.staff.service.impl.DmStaffServiceImpl; | |||
| import com.xueyi.system.utils.common.ImageUtil; | |||
| import org.apache.commons.lang3.ObjectUtils; | |||
| @@ -77,6 +79,9 @@ public class DmRecognizedRecordsInnerApiController extends MyBaseApiController { | |||
| @Autowired | |||
| private ElasticsearchClient esClient; | |||
| @Autowired | |||
| private DmVisitorsMapper visitorsMapper; | |||
| @InnerAuth | |||
| @PostMapping(value = "/upload-pass") | |||
| public JSONObject upload(@RequestBody DmRecognizedRecordsDto recognizedRecordsDto) { | |||
| @@ -108,6 +113,11 @@ public class DmRecognizedRecordsInnerApiController extends MyBaseApiController { | |||
| dmStaffService.updateOrInsertAttendance(cr); | |||
| } | |||
| } else { | |||
| DmVisitorsPo visitorsPo = visitorsMapper.selectById(userId); | |||
| if (ObjectUtils.anyNotNull(visitorsPo)) { | |||
| cr.setUserName(visitorsPo.getName()); | |||
| } | |||
| } | |||
| if (StringUtils.isNotEmpty(imgBase64)) { | |||
| @@ -172,22 +182,11 @@ public class DmRecognizedRecordsInnerApiController extends MyBaseApiController { | |||
| 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); | |||
| cr.setFaceUrl(url); | |||
| cr.setId(IdUtil.getSnowflakeNextId()); | |||
| cr.setResourceId(dmResourcesDto.getId()); | |||
| } | |||
| // recognizedRecordsService.saveToEs(recordsConverter.mapperDto(cr)); | |||
| crs.add(cr); | |||
| } | |||
| @@ -35,6 +35,8 @@ import com.xueyi.system.api.staff.domain.vo.DmStaffFeature; | |||
| import com.xueyi.system.staff.service.IDmStaffService; | |||
| import com.xueyi.tenant.api.tenant.domain.po.SysEnterpriseStaff; | |||
| import com.xueyi.tenant.api.tenant.feign.RemoteTenantService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.validation.annotation.Validated; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -53,6 +55,7 @@ import java.util.List; | |||
| @RestController | |||
| @RequestMapping("/staff") | |||
| public class DmStaffController extends BaseController<DmStaffQuery, DmStaffDto, IDmStaffService> { | |||
| private static final Logger logger = LoggerFactory.getLogger(DmStaffController.class); | |||
| @Autowired | |||
| IDmStaffService dmStaffService; | |||
| @@ -140,12 +143,14 @@ public class DmStaffController extends BaseController<DmStaffQuery, DmStaffDto, | |||
| if (dto != null) { | |||
| dmStaff.setAvatar(dto.getUrl()); | |||
| } | |||
| SysEnterpriseStaff enterpriseStaff = new SysEnterpriseStaff(); | |||
| enterpriseStaff.setPhone(dmStaff.getPhone()); | |||
| enterpriseStaff.setStaffId(dmStaff.getId()); | |||
| enterpriseStaff.setTId(SecurityContextHolder.getEnterpriseId()); | |||
| tenantService.saveEnterpriseStaff(enterpriseStaff, SecurityConstants.INNER); | |||
| } | |||
| //以下代码添加主库企业和员工的关系映射表,用于手机号登录以及小程序登录 | |||
| SysEnterpriseStaff enterpriseStaff = new SysEnterpriseStaff(); | |||
| enterpriseStaff.setPhone(dmStaff.getPhone()); | |||
| enterpriseStaff.setStaffId(dmStaff.getId()); | |||
| enterpriseStaff.setId(dmStaff.getId()); | |||
| enterpriseStaff.setTId(SecurityContextHolder.getEnterpriseId()); | |||
| tenantService.saveEnterpriseStaff(enterpriseStaff, SecurityConstants.INNER); | |||
| AjaxResult result = super.add(dmStaff); | |||
| if (dmStaff.getBirthDate() != null) { | |||
| DmWebSocketMessageVo vo = new DmWebSocketMessageVo(); | |||
| @@ -36,10 +36,14 @@ class VisitRecordGraphQLMutationResolver implements GraphQLMutationResolver { | |||
| private DmVisitRecordsConverter converter; | |||
| public boolean saveVisitRecord(DmVisitRecordsPo input){ | |||
| public boolean storeVisitRecord(DmVisitRecordsPo input){ | |||
| return mapper.insert(input) > 0; | |||
| } | |||
| public boolean updateVisitRecord(DmVisitRecordsPo input){ | |||
| return mapper.updateById(input) > 0; | |||
| } | |||
| public Boolean deleteVisitRecord(Long id){ | |||
| return mapper.deleteById(id) > 0; | |||
| } | |||
| @@ -28,28 +28,27 @@ class VisitorGraphQLMutationResolver implements GraphQLMutationResolver { | |||
| @Autowired | |||
| private DmResourcesMapper resourcesMapper; | |||
| public boolean saveVisitor(String name, String nickname, String phone, Boolean isVip, Boolean flexVisit, Boolean isBlock, Long resourceId){ | |||
| DmVisitorsPo dto =new DmVisitorsPo(); | |||
| dto.setPhone(phone); | |||
| dto.setNickname(nickname); | |||
| dto.setName(name); | |||
| dto.setIsVip(isVip); | |||
| if (BooleanUtils.isTrue(isVip)) { | |||
| dto.setType(9L); | |||
| private DmVisitorsPo initPo(DmVisitorsPo po){ | |||
| if (BooleanUtils.isTrue(po.getIsVip())) { | |||
| po.setType(9L); | |||
| } else { | |||
| dto.setType(8L); | |||
| po.setType(8L); | |||
| } | |||
| dto.setFlexVisit(flexVisit); | |||
| dto.setIsBlock(isBlock); | |||
| dto.setResourceId(resourceId); | |||
| if (null != resourceId) { | |||
| DmResourcesPo resourcesPo = resourcesMapper.selectById(resourceId); | |||
| if (null != po.getResourceId() && null == po.getAvatar()) { | |||
| DmResourcesPo resourcesPo = resourcesMapper.selectById(po.getResourceId()); | |||
| if (null != resourcesPo) { | |||
| dto.setAvatar(resourcesPo.getUrl()); | |||
| po.setAvatar(resourcesPo.getUrl()); | |||
| } | |||
| } | |||
| return mapper.updateById(dto) > 0; | |||
| return po; | |||
| } | |||
| public boolean updateVisitor(DmVisitorsPo po){ | |||
| return mapper.updateById(initPo(po)) > 0; | |||
| } | |||
| public boolean storeVisitor(DmVisitorsPo po){ | |||
| return mapper.insert(initPo(po)) > 0; | |||
| } | |||
| public Boolean deleteVisitor(Long id){ | |||
| @@ -10,6 +10,7 @@ extend type Query { | |||
| input VisitRecordInput { | |||
| id: Long | |||
| visitorId: Long! | |||
| visitDate: Date! | |||
| userId: Long | |||
| @@ -18,7 +19,11 @@ input VisitRecordInput { | |||
| } | |||
| extend type Mutation { | |||
| saveVisitRecord( | |||
| storeVisitRecord( | |||
| input:VisitRecordInput! | |||
| ): Boolean | |||
| updateVisitRecord( | |||
| input:VisitRecordInput! | |||
| ): Boolean | |||
| deleteVisitRecord(id:Long): Boolean | |||
| @@ -9,15 +9,25 @@ extend type Query { | |||
| visitor(id: Long): Visitor | |||
| } | |||
| input VisitorInput { | |||
| id: Long | |||
| name: String | |||
| nickname: String | |||
| phone: String | |||
| visitorCompany: String | |||
| isVip:Boolean | |||
| flexVisit:Boolean | |||
| isBlock:Boolean | |||
| resourceId: Long | |||
| } | |||
| extend type Mutation { | |||
| saveVisitor( | |||
| name: String! | |||
| nickname: String | |||
| phone: String | |||
| isVip:Boolean | |||
| flexVisit:Boolean | |||
| isBlock:Boolean | |||
| resourceId: Long | |||
| storeVisitor( | |||
| input: VisitorInput! | |||
| ): Boolean | |||
| updateVisitor( | |||
| input: VisitorInput! | |||
| ): Boolean | |||
| deleteVisitor(id: Long!): Boolean | |||
| @@ -17,15 +17,12 @@ import com.xueyi.common.security.annotation.RequiresPermissions; | |||
| import com.xueyi.common.security.auth.Auth; | |||
| import com.xueyi.common.web.annotation.TenantIgnore; | |||
| import com.xueyi.common.web.entity.controller.BaseController; | |||
| import com.xueyi.system.api.organize.domain.dto.SysEnterpriseDto; | |||
| import com.xueyi.system.api.organize.domain.po.SysEnterprisePo; | |||
| import com.xueyi.tenant.api.tenant.domain.dto.TeTenantDto; | |||
| import com.xueyi.tenant.api.tenant.domain.po.SysEnterpriseStaff; | |||
| import com.xueyi.tenant.api.tenant.domain.po.TeTenantPo; | |||
| import com.xueyi.tenant.api.tenant.domain.query.TeTenantQuery; | |||
| import com.xueyi.tenant.tenant.domain.model.TeTenantRegister; | |||
| import com.xueyi.tenant.tenant.mapper.SysEnterpriseStaffMapper; | |||
| import com.xueyi.tenant.tenant.mapper.TeTenantMapper; | |||
| import com.xueyi.tenant.tenant.service.ITeTenantService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -110,10 +107,12 @@ public class TeTenantController extends BaseController<TeTenantQuery, TeTenantDt | |||
| @TenantIgnore(tenantLine = true) | |||
| R<SysEnterpriseStaff> staff(@RequestBody SysEnterpriseStaff staff) { | |||
| if (staff.getId() != null) { | |||
| staffMapper.updateById(staff); | |||
| } else { | |||
| staffMapper.insert(staff); | |||
| SysEnterpriseStaff staffPo = staffMapper.selectById(staff.getId()); | |||
| if (null != staffPo) { | |||
| staffMapper.updateById(staff); | |||
| } | |||
| } | |||
| staffMapper.insert(staff); | |||
| return R.ok(staff); | |||
| } | |||
| /** | |||