|
@@ -1,10 +1,16 @@
|
|
|
package com.fdkankan.ucenter.service.impl;
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
import com.fdkankan.ucenter.entity.CameraIncrementLog;
|
|
|
+import com.fdkankan.ucenter.entity.User;
|
|
|
+import com.fdkankan.ucenter.entity.UserIncrement;
|
|
|
import com.fdkankan.ucenter.mapper.ICameraIncrementLogMapper;
|
|
|
import com.fdkankan.ucenter.service.ICameraIncrementLogService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fdkankan.ucenter.service.IUserIncrementService;
|
|
|
+import com.fdkankan.ucenter.service.IUserService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
/**
|
|
@@ -18,6 +24,10 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
public class CameraIncrementLogServiceImpl extends ServiceImpl<ICameraIncrementLogMapper, CameraIncrementLog> implements ICameraIncrementLogService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ IUserService userService;
|
|
|
+ @Autowired
|
|
|
+ IUserIncrementService userIncrementService;
|
|
|
|
|
|
@Override
|
|
|
public void saveLog(Long cameraId, Long incrementId, Long userId, Integer operationType) {
|
|
@@ -29,4 +39,18 @@ public class CameraIncrementLogServiceImpl extends ServiceImpl<ICameraIncrementL
|
|
|
this.save(cameraIncrementLog);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void saveLog(List<Long> cameraIds,String userName) {
|
|
|
+ User user = userService.getByUserName(userName);
|
|
|
+ if(user == null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (Long cameraId : cameraIds) {
|
|
|
+ UserIncrement byCameraId = userIncrementService.getByCameraId(cameraId);
|
|
|
+ if(byCameraId != null ){
|
|
|
+ this.saveLog(cameraId,byCameraId.getId(),user.getId(),1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|