包头bug修改

This commit is contained in:
guoshengxiong 2025-03-08 18:20:05 +08:00
parent a98b9c897c
commit 781b711ffc
11 changed files with 169 additions and 14 deletions

View File

@ -1,6 +1,5 @@
package com.zhgd.xmgl.async;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@ -513,7 +512,7 @@ public class AsyncHikvision {
@Async("carInfoExecutor")
public void editDepartmentInfoForHikvision(DepartmentInfo teamInfo) {
try {
hikvisionCall.editDepartmentInfoForHikvision(teamInfo);
hikvisionCall.saveDepartmentInfoForHikvision(teamInfo);
} catch (Exception e) {
log.error("海康:", e);
sendNoticeForOrg(teamInfo.getDepartmentName(), e, "编辑");

View File

@ -84,6 +84,8 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
@ -98,6 +100,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Slf4j
@ -242,6 +245,9 @@ public class HikvisionCall {
@Lazy
@Autowired
private ITeamInfoService teamInfoService;
@Lazy
@Resource
private RedissonClient redissonClient;
/**
* 获取图片
@ -1150,6 +1156,8 @@ public class HikvisionCall {
//劳务就要判断班组不存在就要添加组织
if (workerInfo.getPersonType() == 1) {
saveIfNotExistTeam(workerInfo, project);
} else if (workerInfo.getPersonType() == 2) {
saveIfNotExistDepartment(workerInfo, project);
}
//idcard
// 存在
@ -1179,6 +1187,30 @@ public class HikvisionCall {
}
}
private void saveIfNotExistDepartment(WorkerInfo workerInfo, Project project) {
// boolean existOrg = hikvisionCall.existOrg(project, workerInfo.getTeamId() + "", StringsUtils.getUniqueEnterpriseId(workerInfo.getEnterpriseId(), workerInfo.getProjectSn()));
// if (!existOrg) {
// RLock lock = null;
// try {
// String lockKey = "isc_org_team_add:" + workerInfo.getTeamId();
// lock = redissonClient.getLock(lockKey);
// lock.tryLock( 100L, TimeUnit.SECONDS);
// existOrg = hikvisionCall.existOrg(project, workerInfo.getTeamId() + "", StringsUtils.getUniqueEnterpriseId(workerInfo.getEnterpriseId(), workerInfo.getProjectSn()));
// if (!existOrg) {
// TeamInfo teamInfo = teamInfoService.getById(workerInfo.getTeamId());
// HikvisionOrganization hikvisionOrganization = getHikvisionOrganization(teamInfo, project);
// addOrgNoticeFromHttp(project, hikvisionOrganization);
// }
// } catch (Exception e) {
// log.error("", e);
// } finally {
// if (lock != null) {
// lock.unlock();
// }
// }
// }
}
/**
* 劳务就要判断班组不存在就要添加组织
*
@ -1189,9 +1221,24 @@ public class HikvisionCall {
private void saveIfNotExistTeam(WorkerInfo workerInfo, Project project) throws Exception {
boolean existOrg = hikvisionCall.existOrg(project, workerInfo.getTeamId() + "", StringsUtils.getUniqueEnterpriseId(workerInfo.getEnterpriseId(), workerInfo.getProjectSn()));
if (!existOrg) {
TeamInfo teamInfo = teamInfoService.getById(workerInfo.getTeamId());
HikvisionOrganization hikvisionOrganization = getHikvisionOrganization(teamInfo, project);
addOrgNoticeFromHttp(project, hikvisionOrganization);
RLock lock = null;
try {
String lockKey = "isc_org_team_add:" + workerInfo.getTeamId();
lock = redissonClient.getLock(lockKey);
lock.tryLock(100L, TimeUnit.SECONDS);
existOrg = hikvisionCall.existOrg(project, workerInfo.getTeamId() + "", StringsUtils.getUniqueEnterpriseId(workerInfo.getEnterpriseId(), workerInfo.getProjectSn()));
if (!existOrg) {
TeamInfo teamInfo = teamInfoService.getById(workerInfo.getTeamId());
HikvisionOrganization hikvisionOrganization = getHikvisionOrganization(teamInfo, project);
addOrgNoticeFromHttp(project, hikvisionOrganization);
}
} catch (Exception e) {
log.error("", e);
} finally {
if (lock != null) {
lock.unlock();
}
}
}
}
@ -2269,7 +2316,6 @@ public class HikvisionCall {
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
return;
}
Pair<Boolean, String> existAndIndexCode = existAndGetEnterpriseOrgIndexCodeByEnterpriseId(project, String.valueOf(enterpriseInfo.getId()), null);
String orgIndexCode = StringsUtils.getUniqueEnterpriseId(enterpriseInfo.getId(), enterpriseInfo.getProjectSn());
HikvisionOrganization hikvisionOrganization = getHikvisionOrganization(enterpriseInfo, orgIndexCode);
JSONArray orgList = getOrgList(project, orgIndexCode, project.getProjectSn());
@ -2480,11 +2526,11 @@ public class HikvisionCall {
}
/**
* 编辑组织
* 保存组织
*
* @param departmentInfo
*/
public void editDepartmentInfoForHikvision(DepartmentInfo departmentInfo) throws Exception {
public void saveDepartmentInfoForHikvision(DepartmentInfo departmentInfo) throws Exception {
Project project = projectMapper.selectOne(new LambdaQueryWrapper<Project>().eq(Project::getProjectSn, departmentInfo.getProjectSn()));
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
return;

View File

@ -61,4 +61,6 @@ public class PostWorkType implements Serializable {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss")
private java.util.Date updateTime;
@ApiModelProperty(value = "是否特殊工种0否1是")
private java.lang.Integer specialTeam;
}

View File

@ -57,7 +57,25 @@ public class TestUnitDeclarationData implements Serializable {
*/
@ApiModelProperty(value = "更新时间")
private java.util.Date updateDate;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "资质有效期开始 yyyy-MM-dd")
private java.util.Date validDateBegin;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "资质有效期结束 yyyy-MM-dd")
private java.util.Date validDateEnd;
@ApiModelProperty(value = "1检测单位2勘察单位")
private Integer type;
/**
* 勘察单位
*/
@ApiModelProperty(value = "勘察单位")
private java.lang.Long explorationUnit;
@TableField(exist = false)
@ApiModelProperty(value = "检测单位名称")
private java.lang.String detectUnitName;
@TableField(exist = false)
@ApiModelProperty(value = "勘察单位名称")
private java.lang.String explorationUnitName;
}

View File

@ -82,6 +82,19 @@ public class UnitApplyData implements Serializable {
*/
@ApiModelProperty(value = "1监理2epc3施工")
private java.lang.Integer type;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "资质有效期开始 yyyy-MM-dd")
private java.util.Date validDateBegin;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "资质有效期结束 yyyy-MM-dd")
private java.util.Date validDateEnd;
/**
* 设计单位
*/
@ApiModelProperty(value = "设计单位")
private java.lang.Long designUnit;
@TableField(exist = false)
@ApiModelProperty(value = "装置名称")
@ -98,4 +111,10 @@ public class UnitApplyData implements Serializable {
@TableField(exist = false)
@ApiModelProperty(value = "施工承包商名称")
private java.lang.String constructionUnitName;
@TableField(exist = false)
@ApiModelProperty(value = "设计单位名称")
private java.lang.String designUnitName;
@TableField(exist = false)
@ApiModelProperty(value = "勘察单位名称")
private java.lang.String explorationUnitName;
}

View File

@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.constant.Cts;
import com.zhgd.xmgl.modules.baotou.entity.PartyConstructionMember;
import com.zhgd.xmgl.modules.baotou.entity.vo.PartyConstructionMemberStats;
import com.zhgd.xmgl.modules.baotou.mapper.PartyConstructionMemberMapper;
@ -143,10 +144,10 @@ public class PartyConstructionMemberServiceImpl extends ServiceImpl<PartyConstru
return;
}
List<WorkerInfo> workerInfos = workerInfoService.list(new LambdaQueryWrapper<WorkerInfo>()
.eq(WorkerInfo::getId, StrUtil.split(workerIds, ",")));
.in(WorkerInfo::getId, StrUtil.split(workerIds, ",")).last(Cts.IGNORE_DATA_SCOPE_CONDITION));
List<String> idCards = workerInfos.stream().map(WorkerInfo::getIdCard).collect(Collectors.toList());
Map<String, PartyConstructionMember> idCardMap = this.list(new LambdaQueryWrapper<PartyConstructionMember>()
.eq(PartyConstructionMember::getIdCard, idCards)).stream().collect(Collectors.toMap(PartyConstructionMember::getIdCard, Function.identity(), (o1, o2) -> o1));
.in(PartyConstructionMember::getIdCard, idCards)).stream().collect(Collectors.toMap(PartyConstructionMember::getIdCard, Function.identity(), (o1, o2) -> o1));
for (WorkerInfo info : workerInfos) {
PartyConstructionMember member = idCardMap.get(info.getIdCard());
if (member == null) {

View File

@ -94,9 +94,13 @@ public class TestUnitDeclarationDataServiceImpl extends ServiceImpl<TestUnitDecl
@Override
public void addFromFlow(HashMap<String, Object> map) {
TestUnitDeclarationData e = new TestUnitDeclarationData();
e.setDetectUnitName(FlowUtil.getString(map, "detectUnitName"));
e.setDetectUnit(FlowUtil.getPullDownLong(map, "detectUnit"));
e.setProjectSn(FlowUtil.getString(map, "projectSn"));
e.setDetail(FlowUtil.getJSONString(map, "detail"));
e.setValidDateBegin(FlowUtil.getStartDate(map, "validDatePeriod"));
e.setValidDateEnd(FlowUtil.getEndDate(map, "validDatePeriod"));
e.setType(FlowUtil.getInteger(map, "type"));
e.setExplorationUnit(FlowUtil.getPullDownLong(map, "explorationUnit"));
baseMapper.insert(e);
}

View File

@ -102,6 +102,9 @@ public class UnitApplyDataServiceImpl extends ServiceImpl<UnitApplyDataMapper, U
e.setProjectSn(FlowUtil.getString(map, "projectSn"));
e.setDetail(FlowUtil.getJSONString(map, "detail"));
e.setType(FlowUtil.getInteger(map, "type"));
e.setValidDateBegin(FlowUtil.getStartDate(map, "validDatePeriod"));
e.setValidDateEnd(FlowUtil.getEndDate(map, "validDatePeriod"));
e.setDesignUnit(FlowUtil.getPullDownLong(map, "designUnit"));
baseMapper.insert(e);
}

View File

@ -373,7 +373,7 @@ public class WorkerAdmissionDetailServiceImpl extends ServiceImpl<WorkerAdmissio
Map<String, PartyConstructionMember> existIdCardMap = new HashMap<>();
if (CollUtil.isNotEmpty(partyIdCards)) {
existIdCardMap = partyConstructionMemberService.list(new LambdaQueryWrapper<PartyConstructionMember>()
.eq(PartyConstructionMember::getIdCard, partyIdCards)).stream().collect(Collectors.toMap(PartyConstructionMember::getIdCard, Function.identity(), (o1, o2) -> o1));
.in(PartyConstructionMember::getIdCard, partyIdCards)).stream().collect(Collectors.toMap(PartyConstructionMember::getIdCard, Function.identity(), (o1, o2) -> o1));
}
for (WorkerInfo addWorker : addWorkers) {
try {

View File

@ -2,23 +2,34 @@ package com.zhgd.xmgl.modules.basicdata.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gexin.fastjson.TypeReference;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.baotou.entity.PlanMilestone2Left;
import com.zhgd.xmgl.modules.baotou.entity.UserDevGroup;
import com.zhgd.xmgl.modules.baotou.service.IProjectGroupService;
import com.zhgd.xmgl.modules.baotou.service.IUserDevGroupService;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
import com.zhgd.xmgl.modules.worker.entity.UserDevAuthority;
import com.zhgd.xmgl.modules.worker.entity.UserEnterprise;
import com.zhgd.xmgl.modules.worker.service.impl.UserDevAuthorityServiceImpl;
import com.zhgd.xmgl.modules.worker.service.impl.UserEnterpriseServiceImpl;
import com.zhgd.xmgl.security.util.SecurityUtils;
import com.zhgd.xmgl.util.ListUtils;
import com.zhgd.xmgl.util.MapBuilder;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;
@ -27,6 +38,7 @@ import springfox.documentation.annotations.ApiIgnore;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -46,6 +58,15 @@ public class SystemUserController {
@Lazy
@Autowired
private IProjectGroupService projectGroupService;
@Lazy
@Autowired
private IUserDevGroupService userDevGroupService;
@Lazy
@Autowired
private UserEnterpriseServiceImpl userEnterpriseService;
@Lazy
@Autowired
private UserDevAuthorityServiceImpl userDevAuthorityService;
/**
* 添加
@ -390,4 +411,42 @@ public class SystemUserController {
return Result.success(p);
}
@OperLog(operModul = "账号管理", operType = "", operDesc = "给项目子账号分配相同权限")
@ApiOperation(value = "给项目子账号分配相同权限", notes = "给项目子账号分配相同权限", httpMethod = "POST")
@PostMapping(value = "/authAllAuthority")
public Result authAllAuthority(@ApiIgnore @RequestBody HashMap<String, Object> param) {
Long fromUserId = MapUtils.getLong(param, "fromUserId");
List<Long> toUserIdList = com.gexin.fastjson.JSON.parseObject(com.gexin.fastjson.JSON.toJSONString(param.get("toUserIdList")), new TypeReference<List<Long>>() {
});
List<UserDevGroup> userDevGroups = userDevGroupService.list(new LambdaQueryWrapper<UserDevGroup>()
.eq(UserDevGroup::getUserId, fromUserId));
List<String> nodeIdList = userDevGroups.stream().map(UserDevGroup::getNodeId).collect(Collectors.toList());
UserEnterprise userEnterprise = userEnterpriseService.selectUserEnterpriseByUserId(fromUserId);
UserDevAuthority old1 = userDevAuthorityService.getOne(new QueryWrapper<UserDevAuthority>()
.lambda().eq(UserDevAuthority::getUserId, fromUserId)
.eq(UserDevAuthority::getDevType, 1));
UserDevAuthority old2 = userDevAuthorityService.getOne(new QueryWrapper<UserDevAuthority>()
.lambda().eq(UserDevAuthority::getUserId, fromUserId)
.eq(UserDevAuthority::getDevType, 2));
for (Long userId : toUserIdList) {
systemUserService.bindDeviceGroup(new MapBuilder<String, Object>()
.put("userId", userId)
.put("nodeIdList", nodeIdList)
.build());
UserEnterprise ue = ObjectUtil.cloneByStream(userEnterprise);
ue.setId(null);
ue.setUserId(userId);
userEnterpriseService.addOrEditUserEnterprise(ue);
UserDevAuthority uea1 = ObjectUtil.cloneByStream(old1);
uea1.setId(null);
uea1.setUserId(userId);
userDevAuthorityService.addOrEditUserEnterprise(uea1);
UserDevAuthority uea2 = ObjectUtil.cloneByStream(old2);
uea2.setId(null);
uea2.setUserId(userId);
userDevAuthorityService.addOrEditUserEnterprise(uea2);
}
return Result.ok();
}
}

View File

@ -1927,6 +1927,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
userDevGroupService.remove(new LambdaQueryWrapper<UserDevGroup>()
.eq(UserDevGroup::getUserId, userId));
if (CollUtil.isNotEmpty(param)) {
List<UserDevGroup> userDevGroups = new ArrayList<>();
for (String nodeId : nodeIds) {
UserDevGroup group = new UserDevGroup();
group.setUserId(userId);
@ -1938,7 +1939,10 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
group.setDevGroupId(Long.valueOf(nodeId.substring(0, 19)));
}
group.setNodeId(nodeId);
userDevGroupService.save(group);
userDevGroups.add(group);
}
if (CollUtil.isNotEmpty(nodeIds)) {
userDevGroupService.saveBatch(userDevGroups);
}
}
}