Selaa lähdekoodia

Merge branch 'dev' into test

tags/B.1.2.0.0_20230819_base
kira 2 vuotta sitten
vanhempi
commit
7716771017
6 muutettua tiedostoa jossa 101 lisäystä ja 1 poistoa
  1. +18
    -1
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/controller/DmDigitalmanController.java
  2. +7
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/pass/controller/api/DmRecognizedRecordsApiController.java
  3. +34
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/pass/service/impl/DmRecognizedRecordsServiceImpl.java
  4. +4
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/staff/service/IDmEmpAttendanceService.java
  5. +34
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/staff/service/impl/DmEmpAttendanceServiceImpl.java
  6. +4
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/staff/service/impl/DmStaffServiceImpl.java

+ 18
- 1
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/controller/DmDigitalmanController.java Näytä tiedosto

@@ -389,6 +389,8 @@ public class DmDigitalmanController extends BaseController<DmDigitalmanQuery, Dm

@Autowired
DmManDeviceServiceImpl dmManDeviceService;


@GetMapping("/api/mansInfo")
@Master
public R<JSONObject> mansInfo() {
@@ -404,15 +406,30 @@ public class DmDigitalmanController extends BaseController<DmDigitalmanQuery, Dm

Integer meetingServiceCount = (Integer) redisTemplate.opsForValue().get("dashboard:meeting");
Integer serverTimes = (Integer) redisTemplate.opsForValue().get("dashboard:server");
Integer recognition = (Integer) redisTemplate.opsForValue().get("dashboard:recognition");
Integer receptionCount = (Integer) redisTemplate.opsForValue().get("dashboard:create_visitor_info");
Integer visitorCount = (Integer) redisTemplate.opsForValue().get("dashboard:register_visitor");
Integer attendanceCount = (Integer) redisTemplate.opsForValue().get("dashboard:attendance");
Integer openDoorCount = (Integer) redisTemplate.opsForValue().get("dashboard:open_door");
log.info("meetingServiceCount:{}",meetingServiceCount);
log.info("serverTimes:{}",serverTimes);
log.info("recognition:{}",recognition);
log.info("receptionCount:{}",receptionCount);
log.info("visitorCount:{}",visitorCount);
log.info("attendanceCount:{}",attendanceCount);
log.info("openDoorCount:{}",openDoorCount);

JSONObject json = new JSONObject();
json.put("manCount",dtos2.size());
json.put("serviceTimeCount",serviceTimeCount);
json.put("servicePerCount",serverTimes);
json.put("recognizedPersonCount",recognition);
json.put("meetingServiceCount",meetingServiceCount);
System.err.println(json.toJSONString());
json.put("receptionCount",receptionCount);
json.put("visitorCount",visitorCount);
json.put("attendanceCount",attendanceCount);
json.put("openDoorCount",openDoorCount);
log.info(json.toJSONString());
return R.ok(json);
}



+ 7
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/pass/controller/api/DmRecognizedRecordsApiController.java Näytä tiedosto

@@ -6,6 +6,7 @@ import com.xueyi.system.api.device.domain.vo.DeviceTenantSourceMergeVo;
import com.xueyi.system.api.pass.domain.dto.DmRecognizedMultiRecordsDto;
import com.xueyi.system.api.pass.domain.dto.DmRecognizedRecordsDto;
import com.xueyi.system.api.pass.feign.RemoteRecognizedRecordsService;
import com.xueyi.system.pass.service.impl.DmRecognizedRecordsServiceImpl;
import com.xueyi.system.resource.controller.api.BaseApiController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@@ -26,11 +27,15 @@ public class DmRecognizedRecordsApiController extends BaseApiController {
@Autowired
private RemoteRecognizedRecordsService recognizedRecordsFeign;

@Autowired
private DmRecognizedRecordsServiceImpl recognizedRecordsService;

@ResponseBody
@PostMapping(value = "/upload-pass", produces = "application/json;charset=UTF-8")
public JSONObject upload(@RequestBody DmRecognizedRecordsDto recognizedRecordsDto){
DeviceTenantSourceMergeVo vo = super.getDeviceTenantSourceMergeVo(recognizedRecordsDto.getDevId());

recognizedRecordsService.setRedisRecognizedCount(1);
return recognizedRecordsFeign.uploadPass(recognizedRecordsDto, vo.getTenantId(), vo.getSourceSlave(), SecurityConstants.INNER);
}

@@ -38,6 +43,8 @@ public class DmRecognizedRecordsApiController extends BaseApiController {
@PostMapping(value = "/upload-multi-pass", produces = "application/json;charset=UTF-8")
public JSONObject uploads(@RequestBody DmRecognizedMultiRecordsDto recognizedMultiRecordsDto){
DeviceTenantSourceMergeVo vo = super.getDeviceTenantSourceMergeVo(recognizedMultiRecordsDto.getDevId());
if (recognizedMultiRecordsDto.getRecords().size() > 0)
recognizedRecordsService.setRedisRecognizedCount(recognizedMultiRecordsDto.getRecords().size());

return recognizedRecordsFeign.uploadMultiPass(recognizedMultiRecordsDto, vo.getTenantId(), vo.getSourceSlave(), SecurityConstants.INNER);
}


+ 34
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/pass/service/impl/DmRecognizedRecordsServiceImpl.java Näytä tiedosto

@@ -1,12 +1,20 @@
package com.xueyi.system.pass.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xueyi.common.web.annotation.TenantIgnore;
import com.xueyi.common.web.entity.service.impl.BaseServiceImpl;
import com.xueyi.system.api.pass.domain.dto.DmRecognizedRecordsDto;
import com.xueyi.system.pass.domain.query.DmRecognizedRecordsQuery;
import com.xueyi.system.pass.manager.IDmRecognizedRecordsManager;
import com.xueyi.system.pass.mapper.DmRecognizedRecordsMapper;
import com.xueyi.system.pass.service.IDmRecognizedRecordsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;

/**
@@ -17,6 +25,14 @@ import java.util.List;
@Service
public class DmRecognizedRecordsServiceImpl extends BaseServiceImpl<DmRecognizedRecordsQuery, DmRecognizedRecordsDto, IDmRecognizedRecordsManager> implements IDmRecognizedRecordsService {


@Autowired
private RedisTemplate<String, Serializable> redisTemplate;

@Autowired
private DmRecognizedRecordsMapper recognizedRecordsMapper;

private static final Logger log = LoggerFactory.getLogger(DmRecognizedRecordsServiceImpl.class);
/**
* 查询人员识别对象列表 | 数据权限
*
@@ -29,4 +45,22 @@ public class DmRecognizedRecordsServiceImpl extends BaseServiceImpl<DmRecognized
return baseManager.selectList(dmRecognizedRecords);
}


@TenantIgnore(tenantLine = true)
public void syncToRedis(){
Long count = recognizedRecordsMapper.selectCount(new QueryWrapper<>());
log.info("同步redis mysql识别人数:"+count);
redisTemplate.opsForValue().set("dashboard:recognizedPersonCount",count);
}

public void setRedisRecognizedCount(Integer num){
if (!redisTemplate.hasKey("dashboard:recognizedRecordsCount")){
syncToRedis();
}
log.info("同步redis 新增识别人数:"+num);
Long count = (Long)redisTemplate.opsForValue().get("dashboard:recognizedRecordsCount");
redisTemplate.opsForValue().set("dashboard:recognizedRecordsCount",count+num);
}


}

+ 4
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/staff/service/IDmEmpAttendanceService.java Näytä tiedosto

@@ -1,5 +1,6 @@
package com.xueyi.system.staff.service;

import com.xueyi.common.web.annotation.TenantIgnore;
import com.xueyi.system.staff.domain.query.DmEmpAttendanceQuery;
import com.xueyi.system.staff.domain.dto.DmEmpAttendanceDto;
import com.xueyi.common.web.entity.service.IBaseService;
@@ -10,4 +11,7 @@ import com.xueyi.common.web.entity.service.IBaseService;
* @author xueyi
*/
public interface IDmEmpAttendanceService extends IBaseService<DmEmpAttendanceQuery, DmEmpAttendanceDto> {

@TenantIgnore(tenantLine = true)
public Integer selectCountIgnoreTenant();
}

+ 34
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/staff/service/impl/DmEmpAttendanceServiceImpl.java Näytä tiedosto

@@ -1,12 +1,18 @@
package com.xueyi.system.staff.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xueyi.common.web.annotation.TenantIgnore;
import com.xueyi.system.staff.domain.dto.DmEmpAttendanceDto;
import com.xueyi.system.staff.domain.query.DmEmpAttendanceQuery;
import com.xueyi.system.staff.mapper.DmEmpAttendanceMapper;
import com.xueyi.system.staff.service.IDmEmpAttendanceService;
import com.xueyi.system.staff.manager.IDmEmpAttendanceManager;
import com.xueyi.common.web.entity.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;

/**
@@ -29,4 +35,32 @@ public class DmEmpAttendanceServiceImpl extends BaseServiceImpl<DmEmpAttendanceQ
return baseManager.selectList(dmEmpAttendance);
}


@Autowired
private DmEmpAttendanceMapper attendanceMapper;

@Autowired
private RedisTemplate<String, Serializable> redisTemplate;
@Override
@TenantIgnore(tenantLine = true)
public Integer selectCountIgnoreTenant() {
if (redisTemplate.hasKey("broadcast:attendance")) {
Integer attendance = (Integer) redisTemplate.opsForValue().get("broadcast:attendance");
return attendance;
} else {
Long attendance = attendanceMapper.selectCount(new QueryWrapper<>());
redisTemplate.opsForValue().set("dashboard:attendance", attendance);
return Math.toIntExact(attendance);
}
}

public void updRedisCount(){
if (redisTemplate.hasKey("dashboard:attendance")) {
Integer attendance = (Integer) redisTemplate.opsForValue().get("dashboard:attendance");
redisTemplate.opsForValue().set("dashboard:attendance", attendance+1);
} else {
Long attendance = attendanceMapper.selectCount(new QueryWrapper<>());
redisTemplate.opsForValue().set("dashboard:attendance", attendance);
}
}
}

+ 4
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/staff/service/impl/DmStaffServiceImpl.java Näytä tiedosto

@@ -35,6 +35,8 @@ public class DmStaffServiceImpl extends BaseServiceImpl<DmStaffQuery, DmStaffDto
@Autowired
DmEmpAttendanceMapper dmEmpAttendanceMapper;

@Autowired
private DmEmpAttendanceServiceImpl dmEmpAttendanceService;
/**
* 查询人员对象列表 | 数据权限
*
@@ -110,6 +112,7 @@ public class DmStaffServiceImpl extends BaseServiceImpl<DmStaffQuery, DmStaffDto
QueryWrapper<DmEmpAttendancePo> wrapper = new QueryWrapper<>();
wrapper.eq("id",empAttendance.getId());
dmEmpAttendanceMapper.update(empAttendance, wrapper);

} else {
DmEmpAttendancePo ea = new DmEmpAttendancePo();
Date checkDate = DateUtils.parseStrToDate(DateUtils.formatDate(checkTime, "yyyy-MM-dd HH:mm:ss"), "yyyy-MM-dd HH:mm:ss");
@@ -123,6 +126,7 @@ public class DmStaffServiceImpl extends BaseServiceImpl<DmStaffQuery, DmStaffDto
ea.setWorkDuration(0);
ea.setCreateTime(DateUtils.currentDateToLocalDateTime());
ea.setUpdateTime(DateUtils.currentDateToLocalDateTime());
dmEmpAttendanceService.updRedisCount();

dmEmpAttendanceMapper.insert(ea);
}


Ladataan…
Peruuta
Tallenna