长庆项目修改

This commit is contained in:
张博 2024-10-19 16:07:03 +08:00
parent fc9eb49a75
commit f81eef47b7
7 changed files with 95 additions and 46 deletions

View File

@ -2081,4 +2081,10 @@ public class HttpApiController {
return R.ok().put("data", page);
}
@GetMapping("/role")
public R roleList() {
return R.ok();
}
}

View File

@ -164,17 +164,17 @@ public class CqMemberController {
}
if (personTypeId != null){
queryWrapper.eq("label_id", idCard);
queryWrapper.eq("label_id", personTypeId);
}
if (phone != null && !phone.isEmpty()){
queryWrapper.eq("mobile", phone);
}
if (isvisitor == 1){
/* if (isvisitor == 1){
Integer i = cqMemberMapper.speciallyForVisitors();
queryWrapper.eq("label_id", i);
}
}*/
if (isWatched != null){
queryWrapper.eq("is_watch_safe_video", isWatched);
}

View File

@ -20,15 +20,12 @@ import net.shapelight.modules.face.service.FaceEngineService;
import net.shapelight.modules.face.util.UserInfo;
import net.shapelight.modules.face.util.UserRamGroup;
import net.shapelight.modules.feignClient.CxFeignClient;
import net.shapelight.modules.nettyapi.service.ServerApiService;
import net.shapelight.modules.sys.controller.AbstractController;
import net.shapelight.modules.ten.entity.TenCellEntity;
import net.shapelight.modules.ten.entity.TenPersonCert;
import net.shapelight.modules.ten.entity.TenPersonEntity;
import net.shapelight.modules.ten.entity.TenPersonTrain;
import net.shapelight.modules.ten.service.TenCellService;
import net.shapelight.modules.ten.service.TenPersonCertService;
import net.shapelight.modules.ten.service.TenPersonService;
import net.shapelight.modules.ten.service.TenPersonTrainService;
import net.shapelight.modules.ten.entity.*;
import net.shapelight.modules.ten.service.*;
import net.shapelight.modules.vo.TenDeviceVo;
import net.shapelight.modules.vo.TenPersonOperationVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -60,11 +57,19 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
private TenPersonTrainService trainService;
@Autowired
private FaceEngineService faceEngineService;
@Autowired
private TenDeviceService tenDeviceService;
@Autowired
private TenPersonSyncService tenPersonSyncService;
@Autowired
private ServerApiService serverApiService;
@Override
public void run(String params) {
getPmInternalPersonnelList("Person");
getPmInternalPersonnelList("Contractor");
getPmInternalPersonnelList("Supplier");
}
private void getPmInternalPersonnelList(String type) {
@ -280,7 +285,34 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
inputStream.close();
tenPerson.setOrgImage(orgImageFileName);
tenPerson.setFaceImage(orgImageFileName);
tenPersonService.saveOrUpdateByField(tenPerson,"openId");
String flag = tenPersonService.saveOrUpdateByField(tenPerson,"openId");
if(flag.equals("save")) {
//发送设备通知
List<TenDeviceVo> devList = tenDeviceService.findByCellId(tenPerson.getCellId());
//状态是0正常发送推送
if (tenPerson.getStatus().intValue() == Constant.PESON_SUATUS_NOMOR) {
for (TenDeviceVo dev : devList) {
//添加到同步表下发设备通知
TenPersonSyncEntity syncEntity = new TenPersonSyncEntity();
syncEntity.setPersonId(tenPerson.getPersonId());
syncEntity.setTenantId(tenPerson.getTenantId());
syncEntity.setDeviceSn(dev.getSn());
syncEntity.setDeviceId(dev.getDeviceId());
syncEntity.setState(1);
syncEntity.setLastUpdateTime(tenPerson.getLastUpdateTime());
tenPersonSyncService.insert(syncEntity);
//下发通知
List<TenPersonOperationVo> list = new ArrayList<>();
TenPersonOperationVo vo = new TenPersonOperationVo();
vo.setUid(syncEntity.getPersonId());
vo.setOperation(1);
vo.setLast_update_stamp(syncEntity.getLastUpdateTime());
list.add(vo);
serverApiService.personOperation(dev.getSn(), list);
}
}
}
UserInfo userInfo = new UserInfo();
UserRamGroup.addUser(userInfo,tenPerson.getOrgId()!=null?UserRamGroup.getOrgCellMap(tenPerson.getOrgId()):null);
}else{

View File

@ -142,10 +142,14 @@ public class TenPersonController extends AbstractController {
List<Integer> personTypeList = new ArrayList<>();
List<TenLabelEntity> tenLabel = tenLabelService.list(new QueryWrapper<TenLabelEntity>()
.eq("tenant_id",getUser().getTenantId()));
personTypeList.add(Constant.PERSON_TYPE_OWNER);
personTypeList.add(Constant.PERSON_TYPE_MEMBER);
personTypeList.add(Constant.PERSON_TYPE_TENANT);
params.put("personTypeList",personTypeList);
if(params.get("personType")!=null&& !Objects.equals(params.get("personType").toString(), "")) {
personTypeList.add(Integer.parseInt(params.get("personType").toString()));
}
//personTypeList.add(Constant.PERSON_TYPE_MEMBER);
//personTypeList.add(Constant.PERSON_TYPE_TENANT);
if(!personTypeList.isEmpty()) {
params.put("personTypeList",personTypeList);
}
PageUtils page = tenPersonService.queryPage(params);
return R.ok().put("data", page);

View File

@ -163,7 +163,7 @@ public interface TenPersonService extends IService<TenPersonEntity> {
List<TenDeptPersonCount> findDeptCount(String tenantId);
void saveOrUpdateByField(TenPersonEntity entity,String fieldName);
String saveOrUpdateByField(TenPersonEntity entity,String fieldName);
}

View File

@ -414,7 +414,7 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
@Transactional(rollbackFor = Exception.class)
public void evictSave(TenDeviceEntity deviceEntity) {
this.save(deviceEntity);
//保存标签关联
/*//保存标签关联
//1.删除标签关联
tenDeviceLabelService.remove(new QueryWrapper<TenDeviceLabelEntity>()
.eq("device_id",deviceEntity.getDeviceId()));
@ -428,34 +428,34 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
addList.add(dl);
}
tenDeviceLabelService.saveBatch(addList);
}
}*/
//在同步表中插入所有信息
// List<TenPersonIdUpdateAllVo> list = tenPersonService.findAllPersonIdUpdateAll(deviceEntity.getCellId(),
// deviceEntity.getBuildId(),
// deviceEntity.getRoomId());
//// List<TenPersonSyncEntity> sList = new ArrayList<>();
// //1.删除设备关联的人
// //2.批量添加
// List<TenPersonSyncEntity> saveList = new ArrayList<>();
// for (TenPersonIdUpdateAllVo vo : list) {
// TenPersonSyncEntity entity = new TenPersonSyncEntity();
// entity.setDeviceId(deviceEntity.getDeviceId());
// entity.setDeviceSn(deviceEntity.getSn());
// entity.setLastUpdateTime(vo.getLast_update_stamp());
// entity.setPersonId(vo.getUid());
// entity.setState(0);
// entity.setTenantId(deviceEntity.getTenantId());
//// sList.add(entity);
// saveList.add(entity);
//// tenPersonSyncService.insert(entity);
// }
// if (saveList.size() > 0) {
// tenPersonSyncService.insertBatch(saveList, deviceEntity.getTenantId());
// }
List<TenPersonIdUpdateAllVo> list = tenPersonService.findAllPersonIdUpdateAll(deviceEntity.getCellId(),
deviceEntity.getBuildId(),
deviceEntity.getRoomId());
// List<TenPersonSyncEntity> sList = new ArrayList<>();
//1.删除设备关联的人
//2.批量添加
List<TenPersonSyncEntity> saveList = new ArrayList<>();
for (TenPersonIdUpdateAllVo vo : list) {
TenPersonSyncEntity entity = new TenPersonSyncEntity();
entity.setDeviceId(deviceEntity.getDeviceId());
entity.setDeviceSn(deviceEntity.getSn());
entity.setLastUpdateTime(vo.getLast_update_stamp());
entity.setPersonId(vo.getUid());
entity.setState(0);
entity.setTenantId(deviceEntity.getTenantId());
// sList.add(entity);
saveList.add(entity);
// tenPersonSyncService.insert(entity);
}
if (saveList.size() > 0) {
tenPersonSyncService.insertBatch(saveList, deviceEntity.getTenantId());
}
// tenPersonSyncService.saveBatch(sList);
//tenPersonSyncService.insertBatch(saveList,);
}
@Override

View File

@ -1080,8 +1080,13 @@ public class TenPersonServiceImpl extends ServiceImpl<TenPersonDao,TenPersonEnti
Long personId = Long.parseLong(param.get("personId"));
cellId = Long.parseLong(param.get("cellId"));
TenPersonEntity entity = tenPersonDao.selectById(personId, cellId);
entity.setLastUpdateTime(new Date());
tenPersonDao.updateById(entity);
if(entity!=null) {
entity.setLastUpdateTime(new Date());
tenPersonDao.updateById(entity);
} else {
return false;
}
//删除人员
tenPersonDao.updateWatchSafeVideo(personId, cellId);
@ -2720,15 +2725,17 @@ public class TenPersonServiceImpl extends ServiceImpl<TenPersonDao,TenPersonEnti
* @param fieldName 字段名称
* @return 操作结果
*/
public void saveOrUpdateByField(TenPersonEntity entity, String fieldName) {
public String saveOrUpdateByField(TenPersonEntity entity, String fieldName) {
QueryWrapper<TenPersonEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(fieldName, MyBeanUtils.getFieldValueByName(entity,fieldName));
TenPersonEntity existEntity = this.getOne(queryWrapper);
if (existEntity == null) {
this.save(entity);
return "save";
} else {
this.updateById(entity);
return "update";
}
}
}