Merge branch 'master' of http://47.109.37.87:3000/by2025/SmartParks
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
commit
b3813dfe75
@ -40,7 +40,7 @@ public class CapitalApplicationController extends BaseController {
|
||||
/**
|
||||
* 查询资产申请列表
|
||||
*/
|
||||
@SaCheckPermission("domain:application:list")
|
||||
// @SaCheckPermission("domain:application:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<CapitalApplicationVo> list(CapitalApplicationBo bo, PageQuery pageQuery) {
|
||||
return capitalApplicationService.queryPageList(bo, pageQuery);
|
||||
@ -72,7 +72,7 @@ public class CapitalApplicationController extends BaseController {
|
||||
/**
|
||||
* 新增资产申请
|
||||
*/
|
||||
@SaCheckPermission("domain:application:add")
|
||||
// @SaCheckPermission("domain:application:add")
|
||||
@Log(title = "资产申请", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
|
@ -36,7 +36,7 @@ public class CapitalInfo extends TenantEntity {
|
||||
/**
|
||||
* 资产类型
|
||||
*/
|
||||
private String capitalType;
|
||||
private Long capitalType;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
|
@ -95,7 +95,7 @@ public class CapitalApplicationBo extends BaseEntity {
|
||||
* 申请时间
|
||||
*/
|
||||
private Date applicationTime;
|
||||
@NotEmpty(message = "资产不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
|
||||
private List<CapitalInfoBo> capitalInfoBolist;
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class CapitalInfoBo extends BaseEntity {
|
||||
* 资产类型
|
||||
*/
|
||||
@NotBlank(message = "资产类型不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String capitalType;
|
||||
private Long capitalType;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
|
@ -14,7 +14,7 @@ import lombok.Data;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@ -131,5 +131,9 @@ public class CapitalApplicationVo implements Serializable {
|
||||
@ExcelProperty(value = "搜索值")
|
||||
private String searchValue;
|
||||
|
||||
/**
|
||||
* 资产信息
|
||||
*/
|
||||
private List<CapitalInfoVo> capitalInfoVoList;
|
||||
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class CapitalInfoVo implements Serializable {
|
||||
* 资产类型
|
||||
*/
|
||||
@ExcelProperty(value = "资产类型")
|
||||
private String capitalType;
|
||||
private Long capitalType;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@ -11,7 +12,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.property.domain.*;
|
||||
import org.dromara.property.domain.vo.CostItemsVo;
|
||||
import org.dromara.property.domain.vo.CapitalInfoVo;
|
||||
import org.dromara.property.mapper.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.property.domain.bo.CapitalApplicationBo;
|
||||
@ -19,10 +20,7 @@ import org.dromara.property.domain.vo.CapitalApplicationVo;
|
||||
import org.dromara.property.service.ICapitalApplicationService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 资产申请Service业务层处理
|
||||
@ -86,16 +84,20 @@ public class CapitalApplicationServiceImpl implements ICapitalApplicationService
|
||||
if (CollUtil.isNotEmpty(suppliersList)) {
|
||||
Suppliers suppliers = suppliersList.stream()
|
||||
.filter(vo -> vo.getId() != null && vo.getId().equals(capitalApplicationVo.getSupplier())).findFirst().orElse(null);
|
||||
capitalApplicationVo.setSupplierName(suppliers.getSuppliersName());
|
||||
capitalApplicationVo.setSupplierName(ObjectUtil.isNotEmpty(suppliers)?suppliers.getSuppliersName():null);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(residentPeopleList)) {
|
||||
ResidentPerson residentPerson = residentPeopleList.stream()
|
||||
.filter(vo -> vo.getId() != null && vo.getId().equals(capitalApplicationVo.getApplicat())).findFirst().orElse(null);
|
||||
capitalApplicationVo.setApplicatName(residentPerson.getUserName());
|
||||
capitalApplicationVo.setApplicatName(ObjectUtil.isNotEmpty(residentPerson)?residentPerson.getUserName():null);
|
||||
ResidentPerson residentPersons = residentPeopleList.stream()
|
||||
.filter(vo -> vo.getId() != null && vo.getId().equals(capitalApplicationVo.getAudit())).findFirst().orElse(null);
|
||||
capitalApplicationVo.setAuditName(residentPersons.getUserName());
|
||||
capitalApplicationVo.setAuditName(ObjectUtil.isNotEmpty(residentPersons)?residentPersons.getUserName():null);
|
||||
}
|
||||
LambdaQueryWrapper<CapitalInfo> capitalInfoWrapper = new LambdaQueryWrapper<>();
|
||||
capitalInfoWrapper.eq(CapitalInfo::getCapitalApplicationId,capitalApplicationVo.getId());
|
||||
List<CapitalInfoVo> capitalInfoVoList = capitalMapper.selectVoList(capitalInfoWrapper);
|
||||
capitalApplicationVo.setCapitalInfoVoList(capitalInfoVoList);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -137,6 +139,7 @@ public class CapitalApplicationServiceImpl implements ICapitalApplicationService
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(CapitalApplicationBo bo) {
|
||||
CapitalApplication add = MapstructUtils.convert(bo, CapitalApplication.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
@ -145,7 +148,7 @@ public class CapitalApplicationServiceImpl implements ICapitalApplicationService
|
||||
CapitalInfo capitalInfo = MapstructUtils.convert(s, CapitalInfo.class);
|
||||
capitalMapper.insert(capitalInfo);
|
||||
//validCapitalInfoBefore(add,capitalInfo);
|
||||
validEntityBeforeSave(add);
|
||||
|
||||
});
|
||||
}
|
||||
return flag;
|
||||
@ -162,16 +165,19 @@ public class CapitalApplicationServiceImpl implements ICapitalApplicationService
|
||||
public Boolean updateByBo(CapitalApplicationBo bo) {
|
||||
CapitalApplication update = MapstructUtils.convert(bo, CapitalApplication.class);
|
||||
validEntityBeforeUpdate(update);
|
||||
bo.getCapitalInfoBolist().stream().forEach(s -> {
|
||||
CapitalInfo capitalInfo = MapstructUtils.convert(s, CapitalInfo.class);
|
||||
capitalMapper.deleteById(capitalInfo);
|
||||
capitalMapper.insert(capitalInfo);
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
CapitalApplication capitalApplication = baseMapper.selectById(bo.getId());
|
||||
if (bo.getState().equals("1") && !bo.getState().equals(capitalApplication.getState())) {
|
||||
validCapitalInfoBefore(update, capitalInfo);
|
||||
}
|
||||
});
|
||||
if(CollUtil.isNotEmpty(bo.getCapitalInfoBolist())){
|
||||
bo.getCapitalInfoBolist().stream().forEach(s -> {
|
||||
CapitalInfo capitalInfo = MapstructUtils.convert(s, CapitalInfo.class);
|
||||
capitalMapper.deleteById(capitalInfo);
|
||||
capitalMapper.insert(capitalInfo);
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
CapitalApplication capitalApplication = baseMapper.selectById(bo.getId());
|
||||
if (bo.getState().equals("1") && !bo.getState().equals(capitalApplication.getState())) {
|
||||
validCapitalInfoBefore(update, capitalInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
@ -186,7 +192,7 @@ public class CapitalApplicationServiceImpl implements ICapitalApplicationService
|
||||
List<Asset> assets = assetsMapper.selectList(assetQueryWrapper);
|
||||
if (assets.isEmpty()) {
|
||||
Asset asset = new Asset();
|
||||
asset.setModel(capitalInfo.getCapitalType());
|
||||
asset.setModel(capitalInfo.getCapitalType().toString());
|
||||
asset.setName(capitalInfo.getCapitalName());
|
||||
asset.setSpecs(capitalInfo.getSpec());
|
||||
asset.setSpecs(capitalInfo.getSpec());
|
||||
@ -214,7 +220,7 @@ public class CapitalApplicationServiceImpl implements ICapitalApplicationService
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(CapitalApplication entity) {
|
||||
|
||||
entity.setState("0");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,7 @@
|
||||
package org.dromara.sis.config.timer;
|
||||
|
||||
import cn.dev33.satoken.context.mock.SaTokenContextMockUtil;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
@ -9,12 +11,10 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.constant.CodePrefixConstants;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.property.api.RemoteResidentPersonService;
|
||||
import org.dromara.property.api.domain.vo.RemoteResidentPersonVo;
|
||||
import org.dromara.resource.api.RemoteFileService;
|
||||
import org.dromara.sis.api.domain.RemotePersonAuth;
|
||||
import org.dromara.sis.domain.bo.SisPersonLibImgBo;
|
||||
import org.dromara.sis.domain.vo.*;
|
||||
import org.dromara.sis.sdk.e8.E8PlatformApi;
|
||||
import org.dromara.sis.sdk.e8.domain.accessControl.req.CustomerAuthAddReq;
|
||||
@ -26,15 +26,12 @@ import org.dromara.sis.service.ISisAccessControlService;
|
||||
import org.dromara.sis.service.ISisAuthGroupRefService;
|
||||
import org.dromara.sis.service.ISisAuthRecordService;
|
||||
import org.dromara.sis.service.ISisPersonLibImgService;
|
||||
import org.dromara.sis.service.impl.SisPersonLibImgServiceImpl;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
@ -63,47 +60,55 @@ public class AuthTimer {
|
||||
/**
|
||||
* 每两分钟执行一次
|
||||
*/
|
||||
// @Scheduled(cron = "0 */1 * * * ?")
|
||||
@Scheduled(cron = "0 */2 * * * ?")
|
||||
public void autoAuth() {
|
||||
List<RemoteResidentPersonVo> unAuthPerson = remoteResidentPersonService.queryUnAuthPerson();
|
||||
// if (CollUtil.isNotEmpty(unAuthPerson)) {
|
||||
//
|
||||
// try {
|
||||
// for (RemoteResidentPersonVo person : unAuthPerson) {
|
||||
// log.info("开始定时授权:{}", person.getId());
|
||||
//
|
||||
// // 判断是否已存在授权
|
||||
// SisAuthRecordVo authRecord = sisAuthRecordService.queryByGroupIdAndPersonId(person.getAuthGroupId(), person.getId());
|
||||
// if (ObjectUtil.isEmpty(authRecord)) {
|
||||
// // 无授权记录时,补录
|
||||
// this.syncAuthRecord(person);
|
||||
// }
|
||||
//
|
||||
// // 读取人像
|
||||
// byte[] imgByte = remoteFileService.downloadToByteArray(Long.parseLong(person.getOssId()));
|
||||
// if (imgByte == null) continue;
|
||||
//
|
||||
// // 写入华为盒子
|
||||
// Long huaweiId = syncHuaweiBox(person, imgByte);
|
||||
// if (huaweiId == null) continue;
|
||||
//
|
||||
// // 更新人像信息huaweiBoxId
|
||||
// Boolean update = sisPersonLibImgService.updateByPersonId(person.getId(), huaweiId);
|
||||
// if (!update) continue;
|
||||
//
|
||||
// // 同步E8平台
|
||||
// Long e8Id = syncE8Plat(person, imgByte);
|
||||
// if (e8Id == null) continue;
|
||||
//
|
||||
// // 更新入驻员工E8平台id
|
||||
// remoteResidentPersonService.updateE8Id(person.getId(), e8Id);
|
||||
//
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
AtomicReference<List<RemoteResidentPersonVo>> unAuthPersonRef = new AtomicReference<>(new ArrayList<>());
|
||||
// 需要先设置模拟上下文
|
||||
SaTokenContextMockUtil.setMockContext(() -> {
|
||||
// 模拟登录
|
||||
StpUtil.login(-8); // 模拟登录
|
||||
unAuthPersonRef.set(remoteResidentPersonService.queryUnAuthPerson());
|
||||
});
|
||||
|
||||
List<RemoteResidentPersonVo> unAuthPerson = unAuthPersonRef.get();
|
||||
if (CollUtil.isNotEmpty(unAuthPerson)) {
|
||||
try {
|
||||
for (RemoteResidentPersonVo person : unAuthPerson) {
|
||||
log.info("开始定时授权:{}", person.getId());
|
||||
|
||||
// 判断是否已存在授权
|
||||
SisAuthRecordVo authRecord = sisAuthRecordService.queryByGroupIdAndPersonId(person.getAuthGroupId(), person.getId());
|
||||
if (ObjectUtil.isEmpty(authRecord)) {
|
||||
// 无授权记录时,补录
|
||||
this.syncAuthRecord(person);
|
||||
}
|
||||
|
||||
// 读取人像
|
||||
byte[] imgByte = remoteFileService.downloadToByteArray(Long.parseLong(person.getOssId()));
|
||||
if (imgByte == null) continue;
|
||||
|
||||
// 写入华为盒子
|
||||
Long huaweiId = syncHuaweiBox(person, imgByte);
|
||||
if (huaweiId == null) continue;
|
||||
|
||||
// 更新人像信息huaweiBoxId
|
||||
Boolean update = sisPersonLibImgService.updateByPersonId(person.getId(), huaweiId);
|
||||
if (!update) continue;
|
||||
|
||||
// 同步E8平台
|
||||
Long e8Id = syncE8Plat(person, imgByte);
|
||||
if (e8Id == null) continue;
|
||||
|
||||
// 更新入驻员工E8平台id
|
||||
remoteResidentPersonService.updateE8Id(person.getId(), e8Id);
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
log.info("无待授权人员");
|
||||
}
|
||||
}
|
||||
|
||||
private void syncAuthRecord(RemoteResidentPersonVo person) {
|
||||
@ -140,7 +145,7 @@ public class AuthTimer {
|
||||
return pId;
|
||||
}
|
||||
|
||||
private Long syncE8Plat(RemoteResidentPersonVo vo, byte[] imgByte) throws Exception {
|
||||
private Long syncE8Plat(RemoteResidentPersonVo vo, byte[] imgByte) {
|
||||
|
||||
log.info("e8平台上传照片");
|
||||
String e8ImgUrl = e8PlatformApi.uploadFace(imgByte);
|
||||
|
@ -1,5 +1,7 @@
|
||||
package org.dromara.sis.runner;
|
||||
|
||||
import cn.dev33.satoken.context.mock.SaTokenContextMockUtil;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -20,6 +22,7 @@ import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@ -52,8 +55,17 @@ public class HikDeviceApplicationRunner implements ApplicationRunner {
|
||||
sisElevatorInfoVos.forEach(item -> {
|
||||
// 执行设备登录操作
|
||||
HikApiService.getInstance().login(item.getControlIp(), item.getControlPort().shortValue(), item.getControlAccount(), item.getControlPwd());
|
||||
|
||||
AtomicReference<List<RemoteFloorVo>> floorInfoRef = new AtomicReference<>();
|
||||
// 模拟上下文
|
||||
SaTokenContextMockUtil.setMockContext(() -> {
|
||||
// 模拟登录
|
||||
StpUtil.login(-8);
|
||||
floorInfoRef.set(remoteFloorService.queryByUnitId(item.getUnitId()));
|
||||
});
|
||||
|
||||
// 根据单元ID获取楼层信息
|
||||
List<RemoteFloorVo> floorInfo = remoteFloorService.queryByUnitId(item.getUnitId());
|
||||
List<RemoteFloorVo> floorInfo = floorInfoRef.get();
|
||||
|
||||
// 下发权限
|
||||
for (int i = 0; i < floorInfo.size(); i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user