bug修改

This commit is contained in:
guoshengxiong 2024-04-22 13:45:14 +08:00
parent 8298300974
commit 297ce85ce1
6 changed files with 49 additions and 9 deletions

View File

@ -144,11 +144,12 @@ public class DownloadController {
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "query", required = false, dataType = "String"), @ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "query", required = false, dataType = "String"),
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"), @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "inserviceType", value = "在职状态 1在职 2离职", paramType = "query", required = false, dataType = "String"), @ApiImplicitParam(name = "inserviceType", value = "在职状态 1在职 2离职", paramType = "query", required = false, dataType = "String"),
@ApiImplicitParam(name = "userId", value = "用户id", paramType = "query", required = false, dataType = "String"),
}) })
@GetMapping(value = "/exportExcelWorkerInfo") @GetMapping(value = "/exportExcelWorkerInfo")
public void exportExcelWorkerInfo(HttpServletResponse response, Integer personType, String projectSn, String userEnterpriseId, public void exportExcelWorkerInfo(HttpServletResponse response, Integer personType, String projectSn, String userEnterpriseId,
String teamId, Integer inserviceType, String departmentId, String enterDate, Integer codeState, String teamId, Integer inserviceType, String departmentId, String enterDate, Integer codeState,
String enterpriseId, String idCard, String workerName, Integer selectType) { String enterpriseId, String idCard, String workerName, Integer selectType, Long userId) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("personType", personType); map.put("personType", personType);
map.put("teamId", teamId); map.put("teamId", teamId);
@ -162,6 +163,7 @@ public class DownloadController {
map.put("workerName", workerName); map.put("workerName", workerName);
map.put("codeState", codeState); map.put("codeState", codeState);
map.put("selectType", selectType); map.put("selectType", selectType);
map.put("userId", userId);
workerInfoService.exportExcelWorkerInfo(response, map); workerInfoService.exportExcelWorkerInfo(response, map);
} }

View File

@ -1518,12 +1518,18 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
@Override @Override
public boolean isSupplier() { public boolean isSupplier() {
UserInfo user = SecurityUtils.getUser(); UserInfo user = SecurityUtils.getUser();
if (user == null) {
return false;
}
return Objects.equals(user.getAccountType(), 11); return Objects.equals(user.getAccountType(), 11);
} }
@Override @Override
public boolean isTenant() { public boolean isTenant() {
UserInfo user = SecurityUtils.getUser(); UserInfo user = SecurityUtils.getUser();
if (user == null) {
return false;
}
return Objects.equals(user.getAccountType(), 10); return Objects.equals(user.getAccountType(), 10);
} }

View File

@ -9,9 +9,6 @@
<if test="param.carNumber != null and param.carNumber != ''"> <if test="param.carNumber != null and param.carNumber != ''">
and a.car_number like CONCAT(CONCAT('%',#{param.carNumber}),'%') and a.car_number like CONCAT(CONCAT('%',#{param.carNumber}),'%')
</if> </if>
<if test="param.enterpriseId != null and param.enterpriseId != ''">
and a.enterprise_id = #{param.enterpriseId}
</if>
<if test="param.isBlack != null"> <if test="param.isBlack != null">
and a.is_black=#{param.isBlack} and a.is_black=#{param.isBlack}
</if> </if>

View File

@ -1,5 +1,6 @@
package com.zhgd.xmgl.modules.worker.service.impl; package com.zhgd.xmgl.modules.worker.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -104,8 +105,21 @@ public class EnterpriseInfoServiceImpl extends ServiceImpl<EnterpriseInfoMapper,
public List<EntityMap> getSupplierEnterprises(Map<String, Object> map) { public List<EntityMap> getSupplierEnterprises(Map<String, Object> map) {
List<EntityMap> list = enterpriseInfoMapper.getEnterpriseInfoList(map); List<EntityMap> list = enterpriseInfoMapper.getEnterpriseInfoList(map);
UserInfo user = SecurityUtils.getUser(); UserInfo user = SecurityUtils.getUser();
EnterpriseInfo info = xzSupplierQualificationApplyService.getSupplierInfoByUserId(user.getUserId()); Long userId;
Optional<EntityMap> optional = list.stream().filter(entityMap -> entityMap.get("id").equals(info.getId().toString())).findFirst(); if (user == null) {
userId = MapUtils.getLong(map, "userId");
} else {
userId = user.getUserId();
}
EnterpriseInfo info = null;
try {
info = xzSupplierQualificationApplyService.getSupplierInfoByUserId(userId);
} catch (Exception e) {
log.error("", e);
return new ArrayList<>();
}
EnterpriseInfo finalInfo = info;
Optional<EntityMap> optional = list.stream().filter(entityMap -> entityMap.get("id").equals(finalInfo.getId().toString())).findFirst();
if (!optional.isPresent()) { if (!optional.isPresent()) {
return new ArrayList<>(); return new ArrayList<>();
} }
@ -114,7 +128,22 @@ public class EnterpriseInfoServiceImpl extends ServiceImpl<EnterpriseInfoMapper,
ArrayList<EntityMap> rtList = new ArrayList<>(); ArrayList<EntityMap> rtList = new ArrayList<>();
rtList.add(infoMap); rtList.add(infoMap);
rtList.addAll(childrenAsList); rtList.addAll(childrenAsList);
return rtList; //搜索填了企业
String enterpriseId = MapUtils.getString(map, "enterpriseId");
if (StrUtil.isNotBlank(enterpriseId)) {
Optional<EntityMap> have = rtList.stream().filter(entityMap -> entityMap.get("id").equals(enterpriseId)).findFirst();
if (!have.isPresent()) {
return new ArrayList<>();
}
EntityMap searchCompany = have.get();
rtList = new ArrayList<>();
rtList.add(searchCompany);
List<EntityMap> childrenAsList1 = ListUtils.getChildrenAsList(searchCompany, list, "id", "parentEnterpriseId");
rtList.addAll(childrenAsList1);
return rtList;
} else {
return rtList;
}
} }
@Override @Override

View File

@ -868,8 +868,13 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
@Override @Override
public void exportExcelWorkerInfo(HttpServletResponse response, Map<String, Object> map) { public void exportExcelWorkerInfo(HttpServletResponse response, Map<String, Object> map) {
try { try {
String userId = MapUtils.getString(map, "userId");
List<EntityMap> list = new ArrayList<>(); List<EntityMap> list = new ArrayList<>();
if (systemUserService.isSupplier()) { SystemUser su = null;
if (StringUtils.isNotBlank(userId)) {
su = systemUserMapper.selectById(userId);
}
if (su != null && su.getAccountType() == 11) {
List<EntityMap> enterprises = enterpriseInfoService.getSupplierEnterprises(map); List<EntityMap> enterprises = enterpriseInfoService.getSupplierEnterprises(map);
if (CollUtil.isNotEmpty(enterprises)) { if (CollUtil.isNotEmpty(enterprises)) {
map.put("enterpriseIds", enterprises.stream().map(entityMap -> entityMap.get("id")).collect(Collectors.toList())); map.put("enterpriseIds", enterprises.stream().map(entityMap -> entityMap.get("id")).collect(Collectors.toList()));

View File

@ -35,6 +35,7 @@ import org.apache.commons.collections.MapUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.*;
@ -169,7 +170,7 @@ public class XzSupplierQualificationApplyServiceImpl extends ServiceImpl<XzSuppl
baseMapper.updateById(xzSupplierQualificationApply); baseMapper.updateById(xzSupplierQualificationApply);
} }
@NotNull @Transactional(rollbackFor = Exception.class, propagation = Propagation.NESTED)
public EnterpriseInfo getSupplierInfoByUserId(Long applyUserId) { public EnterpriseInfo getSupplierInfoByUserId(Long applyUserId) {
Map<String, Object> eiMap = new HashMap<>(); Map<String, Object> eiMap = new HashMap<>();
eiMap.put("userId", applyUserId); eiMap.put("userId", applyUserId);