bug修改

This commit is contained in:
guoshengxiong 2024-04-21 10:47:50 +08:00
parent 1592c7b134
commit d0058f6c48
6 changed files with 174 additions and 17 deletions

View File

@ -119,7 +119,7 @@ public class AsyncHikvision {
} else if (e instanceof OpenPromptException) {
msg = "同步失败,车牌号:" + carInfo.getCarNumber() + "。失败原因:" + e.getMessage();
} else {
msg = "同步失败,车牌号:" + carInfo.getCarNumber() + "。失败原因:" + "。失败原因:下发异常";
msg = "同步失败,车牌号:" + carInfo.getCarNumber() + "。失败原因:下发异常";
}
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type);
}
@ -306,7 +306,7 @@ public class AsyncHikvision {
}
} catch (Exception e) {
if (HttpUtils.isTimeOut(e)) {
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), "网络异常", "人员下发设备提醒", "1");
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), "失败原因平台连接isc网络异常", "人员下发设备提醒", "1");
} else {
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), e.getMessage(), "人员下发设备提醒", "1");
}
@ -320,12 +320,12 @@ public class AsyncHikvision {
String sucSbStr = sucSb.toString();
if (StringUtils.isNotBlank(sucSbStr)) {
sucSbStr = "下发权限成功:" + sucSbStr;
msg += sucSbStr + " ";
msg += sucSbStr;
}
String failSbStr = failSb.toString();
if (StringUtils.isNotBlank(failSbStr)) {
failSbStr = "下发权限失败:" + failSbStr;
msg += failSbStr + " ";
msg += failSbStr;
}
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), StringUtils.substring(msg, 0, msg.length() - 1), title, type);
}

View File

@ -1940,7 +1940,7 @@ public class HikvisionCall {
JSONObject rs = doorSearchV2ForHttp(project, JSONObject.parseObject(json));
if (HikvisionUtil.isFail(rs)) {
log.error(workerInfo.getWorkerName() + "" + dev.getDevName() + " fail" + rs.toJSONString() + ",");
failSb.append(workerInfo.getWorkerName() + "" + dev.getDevName() + "下发异常;");
failSb.append(workerInfo.getWorkerName() + "" + dev.getDevName() + "失败原因:下发异常;");
return;
}
JSONObject jo = HikvisionUtil.getJSONObjectData(rs);
@ -1964,12 +1964,17 @@ public class HikvisionCall {
"}";
JSONObject sdRs = simpleDownload(project, sdStr);
if (HikvisionUtil.isFail(sdRs)) {
log.error(workerInfo.getWorkerName() + "" + dev.getDevName() + " fail" + sdRs.toJSONString() + ",");
log.error("下发人员权限失败:" + workerInfo.getWorkerName() + "" + dev.getDevName() + " fail" + sdRs.toJSONString() + ",");
String code = sdRs.getString("code");
if (Objects.equals(code, "0x15403007") || Objects.equals(code, "0x02401033")) {
if (Objects.equals(code, "0x15403007")) {
//已存在权限下发成功
sucSb.append(workerInfo.getWorkerName() + "" + dev.getDevName() + "");
return;
}
if (Objects.equals(code, "0x02401033")) {
failSb.append(workerInfo.getWorkerName() + "" + dev.getDevName() + ",失败原因:网络异常;");
} else {
failSb.append(workerInfo.getWorkerName() + "" + dev.getDevName() + ",下发异常;");
failSb.append(workerInfo.getWorkerName() + "" + dev.getDevName() + "失败原因:下发异常;");
}
return;
}
@ -1979,7 +1984,7 @@ public class HikvisionCall {
sucSb.append(workerInfo.getWorkerName() + "" + dev.getDevName() + "");
} else {
log.error(workerInfo.getWorkerName() + "" + dev.getDevName() + ",fail" + sdRsJo.toJSONString());
failSb.append(workerInfo.getWorkerName() + "" + dev.getDevName() + "下发异常;");
failSb.append(workerInfo.getWorkerName() + "" + dev.getDevName() + "失败原因:下发异常;");
}
}

View File

@ -102,5 +102,7 @@ public class Company implements Serializable {
@ApiModelProperty(value = "人员姓名")
@TableField(exist = false)
private java.lang.String realName;
@TableField(exist = false)
private java.lang.String name;
}

View File

@ -410,6 +410,7 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
map.put("sn", company.getCompanySn());
Map<String, Object> data1 = getCompanyTreeByHead(map);
EntityMap entityMap = BeanUtil.toBean(company, EntityMap.class);
entityMap.put("name", company.getCompanyName());
entityMap.put("list", data1.get("companyList"));
comapnyList.add(entityMap);
}
@ -794,7 +795,7 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
if (systemUser == null) {
throw new OpenAlertException("未找到对应实体");
}
if (Objects.equals(systemUser.getAccountType(), 10)) {
if (Objects.equals(systemUser.getAccountType(), 10) || Objects.equals(systemUser.getAccountType(), 11)) {
HashMap<String, Object> qm = new HashMap<>();
String headquartersSn = MapUtils.getString(paramMap, "headquartersSn");
if (StrUtil.isBlank(headquartersSn)) {

View File

@ -9,22 +9,31 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
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.mybatis.EntityMap;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.modules.basicdata.entity.Company;
import com.zhgd.xmgl.modules.basicdata.entity.XzSystemUserToCompanyProject;
import com.zhgd.xmgl.modules.basicdata.mapper.CompanyMapper;
import com.zhgd.xmgl.modules.basicdata.mapper.XzSystemUserToCompanyProjectMapper;
import com.zhgd.xmgl.modules.basicdata.service.impl.CompanyServiceImpl;
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
import com.zhgd.xmgl.modules.xz.entity.*;
import com.zhgd.xmgl.modules.xz.mapper.*;
import com.zhgd.xmgl.modules.xz.entity.XzSupplierQualification;
import com.zhgd.xmgl.modules.xz.entity.XzSupplierQualificationApply;
import com.zhgd.xmgl.modules.xz.entity.XzSupplierQualificationRecord;
import com.zhgd.xmgl.modules.xz.entity.XzSupplierRecord;
import com.zhgd.xmgl.modules.xz.mapper.XzSupplierQualificationApplyMapper;
import com.zhgd.xmgl.modules.xz.mapper.XzSupplierQualificationMapper;
import com.zhgd.xmgl.modules.xz.mapper.XzSupplierQualificationRecordMapper;
import com.zhgd.xmgl.modules.xz.mapper.XzSupplierRecordMapper;
import com.zhgd.xmgl.modules.xz.service.IXzSupplierQualificationApplyService;
import com.zhgd.xmgl.util.PageUtil;
import com.zhgd.xmgl.util.RefUtil;
import org.apache.commons.collections.MapUtils;
import org.apache.zookeeper.Op;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.*;
/**
* @Description: 星纵-供应商-资质申请
@ -35,6 +44,8 @@ import java.util.Objects;
@Service
@Transactional(rollbackFor = Exception.class)
public class XzSupplierQualificationApplyServiceImpl extends ServiceImpl<XzSupplierQualificationApplyMapper, XzSupplierQualificationApply> implements IXzSupplierQualificationApplyService {
@Autowired
private XzSystemUserToCompanyProjectMapper xzSystemUserToCompanyProjectMapper;
@Autowired
private XzSupplierQualificationApplyMapper xzSupplierQualificationApplyMapper;
@Autowired
@ -45,6 +56,10 @@ public class XzSupplierQualificationApplyServiceImpl extends ServiceImpl<XzSuppl
private XzSupplierQualificationMapper xzSupplierQualificationMapper;
@Autowired
private XzSupplierServiceImpl xzSupplierService;
@Autowired
private CompanyServiceImpl companyService;
@Autowired
private CompanyMapper companyMapper;
@Override
public IPage<XzSupplierQualificationApply> queryPageList(HashMap<String, Object> paramMap) {
@ -84,9 +99,47 @@ public class XzSupplierQualificationApplyServiceImpl extends ServiceImpl<XzSuppl
if (apply == null) {
throw new OpenAlertException("未找到对应实体");
}
if (Objects.equals(xzSupplierQualificationApply.getApplyStatus(), 2)) {
if (!Objects.equals(apply.getApplyStatus(), 2) || Objects.equals(xzSupplierQualificationApply.getApplyStatus(), 2)) {
//已审批关联组织权限
HashMap<String, Object> paramMap = new HashMap<>();
Long applyUserId = apply.getApplyUserId();
paramMap.put("userId", applyUserId);
String projectSn = apply.getProjectSn();
EntityMap companyMap = companyMapper.getCompanyInfosByProjectSn(projectSn);
if (companyMap == null) {
throw new OpenAlertException("查询公司为空");
}
HashMap<String, Object> p = new HashMap<>();
p.put("companyType", 4);
p.put("sn", projectSn);
Company headquarterCompany = companyMapper.getHeadquarterCompany(p);
if (headquarterCompany == null) {
throw new OpenAlertException("总公司为空");
}
//添加之前已经分配的权限
Set<String> projectSnList = new HashSet<>();
projectSnList.add(projectSn);
String headquartersSn = headquarterCompany.getHeadquartersSn();
List<XzSystemUserToCompanyProject> toCompanyProjects = xzSystemUserToCompanyProjectMapper.selectList(new LambdaQueryWrapper<XzSystemUserToCompanyProject>()
.eq(XzSystemUserToCompanyProject::getUserId, applyUserId)
.eq(XzSystemUserToCompanyProject::getHeadquartersSn, headquartersSn)
);
Set<String> companySnList = new HashSet<>();
companySnList.add(companyMap.get("companySn4"));
companySnList.add(companyMap.get("companySn3"));
companySnList.add(companyMap.get("companySn2"));
for (XzSystemUserToCompanyProject toCompanyProject : toCompanyProjects) {
if (toCompanyProject.getType() == 1) {
companySnList.add(toCompanyProject.getSn());
} else if (toCompanyProject.getType() == 2) {
projectSnList.add(toCompanyProject.getSn());
}
}
paramMap.put("companySns", StrUtil.join(",", companySnList));
paramMap.put("headquartersSn", headquartersSn);
paramMap.put("projectSns", StrUtil.join(",", projectSnList));
companyService.updateTenantOrg(paramMap);
}
baseMapper.updateById(xzSupplierQualificationApply);
}

View File

@ -1,11 +1,15 @@
package com.zhgd.xmgl.util;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import org.apache.commons.lang3.StringUtils;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -82,4 +86,96 @@ public class TreeUtil {
}
/**
* 递归查询该节点的子节点列表不包含自己
*
* @param root 该节点
* @param allList 所有节点列表
*/
public static <T> List<T> getChildrenAsList(T root, List<T> allList, String idName, String parentIdName, String childrenName, String topParentIdVal) {
List<T> list = new ArrayList<>();
List<T> childrenList = allList.stream()
.filter(m -> Objects.equals(getFieldValue(m, parentIdName), getFieldValue(root, idName)))
.peek(m -> list.addAll(getChildrenAsList(m, allList, idName, parentIdName, childrenName, topParentIdVal)))
.collect(Collectors.toList());
list.addAll(childrenList);
return list;
}
/**
* 递归查询当前节点的子节点列表包含自己
*
* @param curNode
* @param rsList 返回结果
* @param idName
* @param parentIdName
* @param childrenName
* @param topParentIdVal
*/
public static <T> void reversionTreeToList(T curNode, List<T> rsList, String idName, String parentIdName, String childrenName, String topParentIdVal) {
Class<T> aClass = (Class<T>) curNode.getClass();
rsList.add(BeanUtil.toBean(curNode, aClass));
List<T> subCityList = (List<T>) getFieldValue(curNode, childrenName);
if (subCityList != null && !subCityList.isEmpty()) {
for (T city : subCityList) { //递归寻找子节点的子节点们
reversionTreeToList(city, rsList, idName, parentIdName, childrenName, topParentIdVal);
}
}
}
/**
* tree转list
*
* @param treeList
* @param idName
* @param parentIdName
* @param childrenName
* @param topParentIdVal
*/
public static <T> List<T> treeToList(List<T> treeList, String idName, String parentIdName, String childrenName, String topParentIdVal) {
List<T> list = new ArrayList<>();
//这一层for的目的是遍历根节点
for (T t : treeList) {
reversionTreeToList(t, list, idName, parentIdName, childrenName, topParentIdVal);
}
for (T t : list) {
setFieldValue(t, null, childrenName);
}
return list;
}
/**
* 查询当前节点的祖级节点列表不包含自己
*
* @param allList 所有节点列表
* @param id 该节点id的值
* @param idName
* @param parentIdName
* @param childrenName
* @param topParentIdVal
* @param <T>
* @return
*/
public static <T> List<T> getParentList(List<T> allList, Object id, String idName, String parentIdName, String childrenName, String topParentIdVal) {
List<T> rsList = new ArrayList<>();
if (CollUtil.isEmpty(allList)) {
return rsList;
}
Map<Object, T> idMap = allList.stream().collect(Collectors.toMap(o -> getFieldValue(o, idName), Function.identity()));
T t = idMap.get(id);
if (t == null) {
return rsList;
}
T p = idMap.get(getFieldValue(t, parentIdName));
while (p != null) {
rsList.add(p);
p = idMap.get(getFieldValue(p, parentIdName));
}
for (T t1 : rsList) {
setFieldValue(t1, null, childrenName);
}
return rsList;
}
}