| @@ -1,15 +1,16 @@ | |||
| package com.xueyi.system.api.staff.feign; | |||
| import com.alibaba.fastjson2.JSONObject; | |||
| import com.xueyi.common.core.constant.basic.SecurityConstants; | |||
| import com.xueyi.common.core.constant.basic.ServiceConstants; | |||
| import com.xueyi.common.core.web.result.AjaxResult; | |||
| import com.xueyi.common.core.web.result.R; | |||
| import com.xueyi.system.api.organize.domain.dto.SysEnterpriseDto; | |||
| import com.xueyi.system.api.organize.feign.factory.RemoteUserFallbackFactory; | |||
| import com.xueyi.system.api.staff.domain.po.DmStaffPo; | |||
| import com.xueyi.system.api.staff.domain.vo.DmStaffFeature; | |||
| import org.springframework.cloud.openfeign.FeignClient; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestHeader; | |||
| import org.springframework.web.bind.annotation.RequestParam; | |||
| import java.util.List; | |||
| @@ -34,6 +35,10 @@ public interface RemoteStaffService { | |||
| R<List<DmStaffFeature>> listInner(@RequestParam(value = "devId") String devId, @RequestParam(value = "timestamp") String timestamp, | |||
| @RequestHeader(SecurityConstants.ENTERPRISE_ID) Long enterpriseId, @RequestHeader(SecurityConstants.SOURCE_NAME) String sourceName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); | |||
| @GetMapping("/staff/inner-api/selectOne/{staffId}") | |||
| JSONObject fetchStaff(@RequestParam(value = "staffId") String staffId, @RequestHeader(SecurityConstants.ENTERPRISE_ID) Long enterpriseId, @RequestHeader(SecurityConstants.SOURCE_NAME) String sourceName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); | |||
| @GetMapping("/staff/inner/tenantId/{enterpriseName}") | |||
| public R<SysEnterpriseDto> tenantIdInner(@RequestParam(value = "enterpriseName") String enterpriseName) ; | |||
| } | |||
| @@ -29,10 +29,16 @@ public interface RemoteVisitorService { | |||
| public JSONObject newVisit(@RequestBody DmVisitCommonDto commonDto, | |||
| @RequestHeader(SecurityConstants.ENTERPRISE_ID) Long enterpriseId, @RequestHeader(SecurityConstants.SOURCE_NAME) String sourceName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); | |||
| @GetMapping(value = "/visit/inner-api/sms-config") | |||
| public JSONObject smsConfig(@RequestHeader(SecurityConstants.ENTERPRISE_ID) Long enterpriseId, @RequestHeader(SecurityConstants.SOURCE_NAME) String sourceName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); | |||
| @GetMapping(value = "/visit/inner-api/list") | |||
| public JSONObject visitList(@RequestParam(value = "empId") Long empId, | |||
| @RequestHeader(SecurityConstants.ENTERPRISE_ID) Long enterpriseId, @RequestHeader(SecurityConstants.SOURCE_NAME) String sourceName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); | |||
| @GetMapping(value = "/visit/inner-api/list-all") | |||
| public JSONObject visitListAll(@RequestHeader(SecurityConstants.ENTERPRISE_ID) Long enterpriseId, @RequestHeader(SecurityConstants.SOURCE_NAME) String sourceName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); | |||
| @PostMapping(value = "/visit/inner-api/send-sms") | |||
| public JSONObject sendSms(@RequestParam(value = "type") Integer type, @RequestHeader(SecurityConstants.ENTERPRISE_ID) Long enterpriseId, @RequestHeader(SecurityConstants.SOURCE_NAME) String sourceName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); | |||
| } | |||
| @@ -33,6 +33,9 @@ public class MqttConfig { | |||
| @Value("${emqx.topics}") | |||
| private String topics; | |||
| @Value("${emqx.prefix}") | |||
| private String prefix; | |||
| @Value("${emqx.fetchLogTopic}") | |||
| private String fetchLogTopic; | |||
| @@ -37,7 +37,7 @@ public class AuthFilter implements GlobalFilter, Ordered { | |||
| @Autowired | |||
| private RedisService redisService; | |||
| private static final String[] whitePrefix = {"/message/api", "/pass/api", "/meeting/api", "/visit/api", "/file/api"}; | |||
| private static final String[] whitePrefix = {"/message/api", "/pass/api", "/meeting/api", "/visit/api", "/file/api","/staff/api"}; | |||
| @Override | |||
| public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { | |||
| @@ -256,7 +256,7 @@ public class DmExceptionLogController extends BaseController<DmExceptionLogQuery | |||
| devId = StringUtils.isEmpty(devId) ? json.getString("id") : devId; | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("devId", devId); | |||
| mqttService.sendMessage(mqttConfig.getFetchLogTopic(), jsonObject.toJSONString()); | |||
| mqttService.sendMessage(mqttConfig.getPrefix()+"/"+devId+mqttConfig.getFetchLogTopic(), jsonObject.toJSONString()); | |||
| return success("操作成功"); | |||
| } | |||
| @@ -255,8 +255,9 @@ public class DmMeetingInnerApiController extends BaseApiController { | |||
| @InnerAuth | |||
| @PostMapping(value = "/lists-all") | |||
| public JSONObject listAllInner(@RequestParam("dateStr") String dateStr, @RequestParam("spaceId") Long spaceId) { | |||
| String date = dateStr.substring(0, 10); | |||
| String time = dateStr.substring(11); | |||
| String date = dateStr.substring(0, 10); | |||
| String time = dateStr.substring(11); | |||
| System.err.println("date:"+date+"; time:"+time+";spaceId:"+spaceId); | |||
| List<DmMeetingOrdersPo> list = dmMeetingOrdersMapper.findAllListByDate(date,time, spaceId); | |||
| List<DmMeetingOrdersDto> res = new ArrayList<>(); | |||
| list.forEach(item -> { | |||
| @@ -0,0 +1,34 @@ | |||
| package com.xueyi.system.staff.controller.api; | |||
| import com.alibaba.fastjson2.JSONObject; | |||
| import com.xueyi.common.core.constant.basic.SecurityConstants; | |||
| import com.xueyi.system.api.device.domain.vo.DeviceTenantSourceMergeVo; | |||
| import com.xueyi.system.api.staff.feign.RemoteStaffService; | |||
| import com.xueyi.system.resource.controller.api.BaseApiController; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.PathVariable; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| /** | |||
| * 员工管理 API业务处理 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @RestController | |||
| @RequestMapping("/staff/api") | |||
| public class DmStaffApiController extends BaseApiController { | |||
| @Autowired | |||
| private RemoteStaffService staffService; | |||
| @GetMapping(value = "fetchOne/{devId}/{staffId}") | |||
| @ResponseBody | |||
| public JSONObject fetchStaff(@PathVariable("devId") String devId, @PathVariable("staffId") String staffId){ | |||
| DeviceTenantSourceMergeVo vo = super.getDeviceTenantSourceMergeVo(devId); | |||
| return staffService.fetchStaff(staffId, vo.getTenantId(), vo.getSourceSlave(), SecurityConstants.INNER); | |||
| } | |||
| } | |||
| @@ -0,0 +1,41 @@ | |||
| package com.xueyi.system.staff.controller.api; | |||
| import com.alibaba.fastjson2.JSONObject; | |||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
| import com.xueyi.common.core.constant.basic.SqlConstants; | |||
| import com.xueyi.common.security.annotation.InnerAuth; | |||
| import com.xueyi.common.web.constant.ResponseCode; | |||
| import com.xueyi.system.api.staff.domain.po.DmStaffPo; | |||
| import com.xueyi.system.resource.controller.api.BaseApiController; | |||
| import com.xueyi.system.staff.mapper.DmStaffMapper; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.PathVariable; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| /** | |||
| * 员工管理 API业务处理 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @RestController | |||
| @RequestMapping("/staff/inner-api") | |||
| public class DmStaffInnerApiController extends BaseApiController { | |||
| @Autowired | |||
| private DmStaffMapper dmStaffMapper; | |||
| @InnerAuth | |||
| @GetMapping(value = "selectOne/{staffId}") | |||
| @ResponseBody | |||
| public JSONObject fetchStaff(@PathVariable("staffId") String staffId){ | |||
| DmStaffPo dmStaff = dmStaffMapper.selectOne(Wrappers.<DmStaffPo>lambdaQuery().eq(DmStaffPo::getId, staffId).last(SqlConstants.LIMIT_ONE)); | |||
| if (dmStaff!= null) { | |||
| return outputSuccess(dmStaff).toJSON(); | |||
| } | |||
| return output(ResponseCode.DATA_NOT_EXISTS,"员工").toJSON(); | |||
| } | |||
| } | |||
| @@ -1,58 +0,0 @@ | |||
| package com.xueyi.system.staff.controller.api; | |||
| import com.alibaba.fastjson2.JSONObject; | |||
| import com.xueyi.common.core.constant.basic.SecurityConstants; | |||
| import com.xueyi.system.api.device.domain.vo.DeviceTenantSourceMergeVo; | |||
| import com.xueyi.system.api.staff.domain.dto.DmVisitCommonDto; | |||
| import com.xueyi.system.api.staff.feign.RemoteVisitorService; | |||
| import com.xueyi.system.resource.controller.api.BaseApiController; | |||
| import com.xueyi.system.staff.mapper.DmStaffMapper; | |||
| import com.xueyi.system.staff.mapper.DmVisitRecordsMapper; | |||
| import com.xueyi.system.staff.mapper.DmVisitorsMapper; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| /** | |||
| * 访客管理 API业务处理 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @RestController | |||
| @RequestMapping("/visit2/api") | |||
| public class DmVisitorApi2Controller extends BaseApiController { | |||
| @Autowired | |||
| private DmVisitRecordsMapper dmVisitRecordsMapper; | |||
| @Autowired | |||
| private DmStaffMapper dmStaffMapper; | |||
| @Autowired | |||
| private DmVisitorsMapper dmVisitorsMapper; | |||
| @Autowired | |||
| private RemoteVisitorService visitorService; | |||
| @PostMapping(value = "confirm-visitor") | |||
| @ResponseBody | |||
| public JSONObject queryVisit(String visitorName, Long empId, String devId){ | |||
| DeviceTenantSourceMergeVo vo = super.getDeviceTenantSourceMergeVo(devId); | |||
| return visitorService.queryVisit(visitorName, empId, vo.getTenantId(), vo.getSourceSlave(), SecurityConstants.INNER); | |||
| } | |||
| @PostMapping(value = "new-visitor") | |||
| @ResponseBody | |||
| public JSONObject newVisit(@RequestBody DmVisitCommonDto commonDto){ | |||
| DeviceTenantSourceMergeVo vo = super.getDeviceTenantSourceMergeVo(commonDto.getDevId()); | |||
| return visitorService.newVisit(commonDto, vo.getTenantId(), vo.getSourceSlave(), SecurityConstants.INNER); | |||
| } | |||
| } | |||
| @@ -58,6 +58,15 @@ public class DmVisitorApiController extends BaseApiController { | |||
| } | |||
| @GetMapping(value = "list-all") | |||
| @ResponseBody | |||
| public JSONObject visitList(String devId){ | |||
| DeviceTenantSourceMergeVo vo = super.getDeviceTenantSourceMergeVo(devId); | |||
| return visitorService.visitListAll(vo.getTenantId(), vo.getSourceSlave(), SecurityConstants.INNER); | |||
| } | |||
| @PostMapping(value = "new-visitor") | |||
| @ResponseBody | |||
| public JSONObject newVisit(@RequestBody DmVisitCommonDto commonDto){ | |||
| @@ -65,6 +74,13 @@ public class DmVisitorApiController extends BaseApiController { | |||
| return visitorService.newVisit(commonDto, vo.getTenantId(), vo.getSourceSlave(), SecurityConstants.INNER); | |||
| } | |||
| @GetMapping(value = "sms-config/{devId}") | |||
| @ResponseBody | |||
| public JSONObject smsConfig(@PathVariable("devId") String devId){ | |||
| DeviceTenantSourceMergeVo vo = super.getDeviceTenantSourceMergeVo(devId); | |||
| return visitorService.smsConfig(vo.getTenantId(), vo.getSourceSlave(), SecurityConstants.INNER); | |||
| } | |||
| @GetMapping(value = "send-sms/{type}/{devId}") | |||
| @ResponseBody | |||
| public JSONObject sendSms(@PathVariable("type") Integer type, @PathVariable("devId") String devId){ | |||
| @@ -15,12 +15,16 @@ 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; | |||
| import com.xueyi.system.api.digitalmans.domain.dto.DmVisitorsDto; | |||
| import com.xueyi.system.api.digitalmans.domain.po.DmDigitalmanExtPo; | |||
| import com.xueyi.system.api.digitalmans.domain.po.DmDigitalmanPo; | |||
| import com.xueyi.system.api.digitalmans.domain.po.DmVisitRecordsPo; | |||
| import com.xueyi.system.api.digitalmans.domain.po.DmVisitorsPo; | |||
| import com.xueyi.system.api.sms.domain.vo.SmsReqEntity; | |||
| import com.xueyi.system.api.sms.feign.RemoteSmsService; | |||
| import com.xueyi.system.api.staff.domain.dto.DmVisitCommonDto; | |||
| import com.xueyi.system.api.staff.domain.po.DmStaffPo; | |||
| import com.xueyi.system.digitalmans.mapper.DmDigitalmanExtMapper; | |||
| import com.xueyi.system.digitalmans.mapper.DmDigitalmanMapper; | |||
| import com.xueyi.system.meeting.constant.VisitRecordStatus; | |||
| import com.xueyi.system.receiver.domain.po.DmTenantReceiverPo; | |||
| import com.xueyi.system.receiver.mapper.DmTenantReceiverMapper; | |||
| @@ -64,6 +68,11 @@ public class DmVisitorInnerApiController extends BaseApiController { | |||
| @Autowired | |||
| private DmVisitorsMapper dmVisitorsMapper; | |||
| @Autowired | |||
| private DmDigitalmanMapper digitalmanMapper; | |||
| @Autowired | |||
| private DmDigitalmanExtMapper digitalmanExtMapper; | |||
| @Autowired | |||
| private DmVisitRecordsConverter recordsConverter; | |||
| @@ -160,9 +169,11 @@ public class DmVisitorInnerApiController extends BaseApiController { | |||
| DmVisitorSmsConfigPo dmVisitorSmsConfigPo = visitorSmsConfigMapper.selectOne(Wrappers.<DmVisitorSmsConfigPo>query().lambda().last(SqlConstants.LIMIT_ONE)); | |||
| DmDigitalmanPo dmDigitalmanPo = digitalmanMapper.selectByCode(digitalmanExtMapper.selectOne(Wrappers.<DmDigitalmanExtPo>query().lambda().eq(DmDigitalmanExtPo::getDeviceId, commonDto.getDevId()).last(SqlConstants.LIMIT_ONE)).getManCode()); | |||
| json.put("code", code); | |||
| json.put("nickName", commonDto.getVisitorName()); | |||
| json.put("robotName", smsProperties.getRobotName()); | |||
| json.put("robotName", dmDigitalmanPo.getName()); | |||
| json.put("dateTime", commonDto.getVisitDate()); | |||
| json.put("companyName", dmVisitorSmsConfigPo.getCompanyName()); | |||
| json.put("companyAddr", dmVisitorSmsConfigPo.getCompanyAddress()); | |||
| @@ -189,6 +200,15 @@ public class DmVisitorInnerApiController extends BaseApiController { | |||
| return outputSuccess().toJSON(); | |||
| } | |||
| @InnerAuth | |||
| @GetMapping(value = "sms-config") | |||
| public com.alibaba.fastjson2.JSONObject smsConfig(){ | |||
| DmVisitorSmsConfigPo dmVisitorSmsConfigPo = visitorSmsConfigMapper.selectOne(Wrappers.<DmVisitorSmsConfigPo>query().lambda().last(SqlConstants.LIMIT_ONE)); | |||
| return outputSuccess(dmVisitorSmsConfigPo).toJSON(); | |||
| } | |||
| @InnerAuth | |||
| @GetMapping(value = "list") | |||
| public com.alibaba.fastjson2.JSONObject visitList(@RequestParam(value = "empId") Long empId){ | |||
| @@ -225,6 +245,36 @@ public class DmVisitorInnerApiController extends BaseApiController { | |||
| return outputSuccess(json).toJSON(); | |||
| } | |||
| @InnerAuth | |||
| @GetMapping(value = "list-all") | |||
| public com.alibaba.fastjson2.JSONObject visitListAll(){ | |||
| List<DmVisitRecordsPo> v = dmVisitRecordsMapper.findList(); | |||
| JSONObject json = new JSONObject(); | |||
| List<DmVisitRecordsDto> dtos = new ArrayList<>(); | |||
| v.forEach(item->{ | |||
| DmStaffPo e = dmStaffMapper.selectById(item.getUserId()); | |||
| DmVisitRecordsDto d = recordsConverter.mapperDto(item); | |||
| if (null != e) { | |||
| d.setUserPhone(e.getPhone()); | |||
| d.setUserName(e.getUserName()); | |||
| } | |||
| DmVisitorsPo visitorsPo = dmVisitorsMapper.selectById(item.getVisitorId()); | |||
| if (null != visitorsPo) { | |||
| d.setVisitorName(visitorsPo.getName()); | |||
| } | |||
| if (null != item.getVisitDate()) { | |||
| d.setVisitDateStr(DateUtils.formatDate(item.getVisitDate(), "yyyy-MM-dd")); | |||
| } | |||
| dtos.add(d); | |||
| }); | |||
| json.put("data", dtos); | |||
| return outputSuccess(json).toJSON(); | |||
| } | |||
| @Autowired | |||
| private DmTenantReceiverMapper receiverMapper; | |||
| @@ -20,4 +20,5 @@ public interface DmVisitRecordsMapper extends BaseMapper<DmVisitRecordsQuery, Dm | |||
| DmVisitRecordsPo findByName(@Param("visitorName") String visitorName/*, @Param("userId") Long userId*/); | |||
| List<DmVisitRecordsPo> findByEmp(@Param("userId") Long userId); | |||
| List<DmVisitRecordsPo> findList(); | |||
| } | |||
| @@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
| </select> | |||
| <select id="findAllListByDate" parameterType="Object" resultType="DmMeetingOrdersPo"> | |||
| SELECT * FROM dm_meeting_orders where del_flag = 0 AND (order_date <![CDATA[>]]> #{date} or (order_date = #{date} AND end_time <![CDATA[<]]> #{time})) AND space_id = #{spaceId} | |||
| SELECT * FROM dm_meeting_orders where del_flag = 0 AND (order_date <![CDATA[>]]> #{date} or (order_date = #{date} AND end_time <![CDATA[>]]> #{time})) AND space_id = #{spaceId} | |||
| </select> | |||
| <select id="findListByDateStr" parameterType="Object" resultType="DmMeetingOrdersPo"> | |||
| @@ -11,4 +11,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
| select * from dm_visit_records u where u.user_id = #{userId} and (visit_date >= CURRENT_DATE or create_time >= CURRENT_DATE) | |||
| </select> | |||
| <select id="findList" parameterType="Object" resultType="DmVisitRecordsPo"> | |||
| select * from dm_visit_records u where (visit_date >= CURRENT_DATE or create_time >= CURRENT_DATE) | |||
| </select> | |||
| </mapper> | |||