|
|
@@ -12,16 +12,19 @@ import com.zhongshu.card.client.model.visitor.VisitorMainParam;
|
|
|
import com.zhongshu.card.client.model.visitor.VisitorMainSearch;
|
|
|
import com.zhongshu.card.client.model.visitor.VisitorReViewParam;
|
|
|
import com.zhongshu.card.client.type.visitor.VisitorState;
|
|
|
+import com.zhongshu.card.client.utils.DateUtils;
|
|
|
import com.zhongshu.card.server.core.dao.devices.DeviceInfoDao;
|
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationUserDao;
|
|
|
import com.zhongshu.card.server.core.dao.org.UserCountDao;
|
|
|
import com.zhongshu.card.server.core.dao.scene.SceneComponentDao;
|
|
|
import com.zhongshu.card.server.core.dao.visitor.VisitorMainDao;
|
|
|
+import com.zhongshu.card.server.core.dao.visitor.VisitorSettingDao;
|
|
|
import com.zhongshu.card.server.core.domain.devices.DeviceInfo;
|
|
|
import com.zhongshu.card.server.core.domain.org.OrganizationUser;
|
|
|
import com.zhongshu.card.server.core.domain.org.UserAccount;
|
|
|
import com.zhongshu.card.server.core.domain.scene.SceneComponent;
|
|
|
import com.zhongshu.card.server.core.domain.visitor.VisitorMain;
|
|
|
+import com.zhongshu.card.server.core.domain.visitor.VisitorSetting;
|
|
|
import com.zhongshu.card.server.core.service.base.CommonService;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import com.zhongshu.card.server.core.service.devices.DeviceInfoServiceImpl;
|
|
|
@@ -56,9 +59,6 @@ public class VisitorMainService extends SuperService {
|
|
|
@Autowired
|
|
|
private VisitorMainDao visitorMainDao;
|
|
|
|
|
|
- @Autowired
|
|
|
- private DeviceInfoDao deviceInfoDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private DeviceInfoServiceImpl deviceInfoService;
|
|
|
|
|
|
@@ -71,12 +71,6 @@ public class VisitorMainService extends SuperService {
|
|
|
@Autowired
|
|
|
private UserCountDao userCountDao;
|
|
|
|
|
|
- @Autowired
|
|
|
- private OrganizationUserDao organizationUserDao;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private OrganizationManagerServiceImpl organizationManagerService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private OrganizationUserServiceImpl organizationUserService;
|
|
|
|
|
|
@@ -89,6 +83,9 @@ public class VisitorMainService extends SuperService {
|
|
|
@Autowired
|
|
|
private Device2UseUsableService device2UseUsableService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private VisitorSettingDao visitorSettingDao;
|
|
|
+
|
|
|
public ResultContent saveInfo(VisitorMainParam param) {
|
|
|
if (StringUtils.isEmpty(param.getSceneComponentId())) {
|
|
|
return ResultContent.buildFail("sceneComponentId 不能为空");
|
|
|
@@ -103,9 +100,6 @@ public class VisitorMainService extends SuperService {
|
|
|
if (CommonUtil.longIsEmpty(startTime)) {
|
|
|
return ResultContent.buildFail("到访时间不能为空");
|
|
|
}
|
|
|
- if (startTime <= System.currentTimeMillis()) {
|
|
|
- return ResultContent.buildFail("到访时间不能小于当前时间");
|
|
|
- }
|
|
|
Long minutes = param.getMinutes();
|
|
|
if (CommonUtil.longIsEmpty(minutes)) {
|
|
|
return ResultContent.buildFail("访问时长不能为空");
|
|
|
@@ -119,6 +113,11 @@ public class VisitorMainService extends SuperService {
|
|
|
return ResultContent.buildFail("组件不存在");
|
|
|
}
|
|
|
|
|
|
+ VisitorSetting visitorSetting = visitorSettingDao.findTopBySceneComponentId(sceneComponentId);
|
|
|
+ if (ObjectUtils.isEmpty(visitorSetting)) {
|
|
|
+ return ResultContent.buildFail("访客组件参数未配置");
|
|
|
+ }
|
|
|
+
|
|
|
String projectOid = sceneComponent.getProjectOid();
|
|
|
UserAccount visitorUserAccount = userCountDao.findTopByUserId(param.getVisitorUserId());
|
|
|
if (ObjectUtils.isEmpty(visitorUserAccount)) {
|
|
|
@@ -156,6 +155,15 @@ public class VisitorMainService extends SuperService {
|
|
|
entity.setEndTime(endTime);
|
|
|
entity.setProjectOid(projectOid);
|
|
|
|
|
|
+ Long preMinutes = visitorSetting.getMinutes();
|
|
|
+ if (preMinutes == null) {
|
|
|
+ preMinutes = 0L;
|
|
|
+ }
|
|
|
+ Long perStartTime = startTime - preMinutes * 60 * 60 * 1000l;
|
|
|
+ Long perEndTime = DateUtils.getDayEndTime(endTime);
|
|
|
+ entity.setPerStartTime(perStartTime);
|
|
|
+ entity.setPerEndTime(perEndTime);
|
|
|
+
|
|
|
String tempUserId = applyUserId;
|
|
|
UserFromType userFromType = UserFromType.SystemUser;
|
|
|
if (StringUtils.isEmpty(tempUserId)) {
|