|
|
|
@ -31,6 +31,8 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.time.Period; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
@ -72,11 +74,11 @@ public class EnterpriseController {
|
|
|
|
|
@Resource |
|
|
|
|
private EnterpriseAuditLogMapper enterpriseAuditLogMapper; |
|
|
|
|
@Resource |
|
|
|
|
private TagLibraryMapper tagLibraryMapper; |
|
|
|
|
private AdminUserService adminUserService; |
|
|
|
|
@Resource |
|
|
|
|
private EnterpriseTagMapper enterpriseTagMapper; |
|
|
|
|
private TagLibraryService tagLibraryService; |
|
|
|
|
@Resource |
|
|
|
|
private AdminUserService adminUserService; |
|
|
|
|
private FileInfoService fileInfoService; |
|
|
|
|
|
|
|
|
|
@PostMapping("/create") |
|
|
|
|
@Operation(summary = "创建企业") |
|
|
|
@ -100,6 +102,14 @@ public class EnterpriseController {
|
|
|
|
|
return success(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@PutMapping("/audit") |
|
|
|
|
@Operation(summary = "企业审核") |
|
|
|
|
// @PreAuthorize("@ss.hasPermission('system:enterprise:update')")
|
|
|
|
|
public CommonResult<Boolean> audit(@RequestParam("id") Long id) { |
|
|
|
|
enterpriseService.auditEnterprise(id); |
|
|
|
|
return success(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@DeleteMapping("/delete") |
|
|
|
|
@Operation(summary = "删除企业") |
|
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
@ -127,10 +137,30 @@ public class EnterpriseController {
|
|
|
|
|
enterprise.setFiles(list); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获取标签
|
|
|
|
|
final List<TagLibraryDO> tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId()); |
|
|
|
|
enterprise.setTagList(tagLibraryDOS.stream().map(item->item.getTagName()).collect(Collectors.toList())); |
|
|
|
|
|
|
|
|
|
//获取资质
|
|
|
|
|
LambdaQueryWrapper<EnterpriseQualificationDO> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
queryWrapper.eq(EnterpriseQualificationDO::getEnterpriseId, enterprise.getId()); |
|
|
|
|
final List<EnterpriseQualificationDO> enterpriseQualificationList = enterpriseQualificationMapper.selectList(queryWrapper); |
|
|
|
|
|
|
|
|
|
if (enterpriseQualificationList != null && enterpriseQualificationList.size() > 0) { |
|
|
|
|
enterpriseQualificationList.forEach(item->{ |
|
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
|
LocalDateTime past = item.getExpiryDate().minus(Period.ofDays(30)); |
|
|
|
|
if (item.getExpiryDate().isBefore(now)) { |
|
|
|
|
item.setStatus(3); |
|
|
|
|
} else if (past.isBefore(now)) { |
|
|
|
|
item.setStatus(2); |
|
|
|
|
} else { |
|
|
|
|
item.setStatus(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
enterprise.setQualificationList(enterpriseQualificationList); |
|
|
|
|
} |
|
|
|
|
//获取企业标签
|
|
|
|
@ -156,35 +186,14 @@ public class EnterpriseController {
|
|
|
|
|
public CommonResult<PageResult<EnterpriseRespVO>> getEnterprisePage(EnterprisePageReqVO pageReqVO) { |
|
|
|
|
PageResult<EnterpriseDO> pageResult = enterpriseService.getEnterprisePage(pageReqVO); |
|
|
|
|
pageResult.getList().forEach(item->{ |
|
|
|
|
//企业审核状态
|
|
|
|
|
QueryWrapper<EnterpriseAuditLogDO> auditLogDOQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
auditLogDOQueryWrapper.eq("enterprise_id", item.getId()); |
|
|
|
|
EnterpriseAuditLogDO enterpriseAuditLogDO = enterpriseAuditLogMapper.selectOne(auditLogDOQueryWrapper); |
|
|
|
|
if (enterpriseAuditLogDO != null) { |
|
|
|
|
item.setAudit(enterpriseAuditLogDO.getAudit()); |
|
|
|
|
} |
|
|
|
|
//企业图片
|
|
|
|
|
LambdaQueryWrapper<FileInfoDO> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(FileInfoDO::getDictType, 644l); |
|
|
|
|
wrapper.eq(FileInfoDO::getDictData, 1l); |
|
|
|
|
wrapper.eq(FileInfoDO::getUnitId, item.getId()); |
|
|
|
|
final List<Long> collect = fileInfoMapper.selectList(wrapper).stream().map(res -> res.getInfraFileId()).collect(Collectors.toList()); |
|
|
|
|
final List<Map<String, String>> fileList = fileInfoService.getFileList("664", "1", item.getId().toString()); |
|
|
|
|
item.setFiles(fileList); |
|
|
|
|
|
|
|
|
|
if (!collect.isEmpty()) { |
|
|
|
|
final List<Map<String,String>> list = fileApi.listFile(collect); |
|
|
|
|
item.setFiles(list); |
|
|
|
|
} |
|
|
|
|
// 企业标签
|
|
|
|
|
LambdaQueryWrapper<EnterpriseTagDO> tagDOLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
tagDOLambdaQueryWrapper.eq(EnterpriseTagDO::getEnterpriseId, item.getId()); |
|
|
|
|
List<EnterpriseTagDO> enterpriseTagDOS = enterpriseTagMapper.selectList(tagDOLambdaQueryWrapper); |
|
|
|
|
if (enterpriseTagDOS != null && enterpriseTagDOS.size() > 0) { |
|
|
|
|
List<Long> tagIds = enterpriseTagDOS.stream().map(EnterpriseTagDO::getTagId).collect(Collectors.toList()); |
|
|
|
|
List<TagLibraryDO> tagLibraryDOS = tagLibraryMapper.selectList(new LambdaQueryWrapper<TagLibraryDO>().in(TagLibraryDO::getId, tagIds)); |
|
|
|
|
if (tagLibraryDOS != null && tagLibraryDOS.size() > 0) { |
|
|
|
|
List<String> tagNames = tagLibraryDOS.stream().map(TagLibraryDO::getTagName).collect(Collectors.toList()); |
|
|
|
|
item.setTagList(tagNames); |
|
|
|
|
} |
|
|
|
|
final List<TagLibraryDO> tagLibraryDOS1 = tagLibraryService.listByEnterpriseId(item.getId()); |
|
|
|
|
if (tagLibraryDOS1 != null && tagLibraryDOS1.size() > 0) { |
|
|
|
|
item.setTagList(tagLibraryDOS1.stream().map(item1->item1.getTagName()).collect(Collectors.toList())); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
@ -197,44 +206,16 @@ public class EnterpriseController {
|
|
|
|
|
public CommonResult<PageResult<EnterpriseRespVO>> getEnterpriseByUserId(@Valid EnterprisePageReqVO pageReqVO) { |
|
|
|
|
final PageResult<EnterpriseDO> pageResult = enterpriseService.getEnterpriseByUserId(pageReqVO); |
|
|
|
|
pageResult.getList().forEach(item->{ |
|
|
|
|
//企业审核状态
|
|
|
|
|
QueryWrapper<EnterpriseAuditLogDO> auditLogDOQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
auditLogDOQueryWrapper.eq("enterprise_id", item.getId()); |
|
|
|
|
EnterpriseAuditLogDO enterpriseAuditLogDO = enterpriseAuditLogMapper.selectOne(auditLogDOQueryWrapper); |
|
|
|
|
if (enterpriseAuditLogDO != null) { |
|
|
|
|
item.setAudit(enterpriseAuditLogDO.getAudit()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//企业图片
|
|
|
|
|
LambdaQueryWrapper<FileInfoDO> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(FileInfoDO::getDictType, 644l); |
|
|
|
|
wrapper.eq(FileInfoDO::getDictData, 1l); |
|
|
|
|
wrapper.eq(FileInfoDO::getUnitId, item.getId()); |
|
|
|
|
final List<Long> collect = fileInfoMapper.selectList(wrapper).stream().map(res -> res.getInfraFileId()).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
if (!collect.isEmpty()) { |
|
|
|
|
final List<Map<String,String>> list = fileApi.listFile(collect); |
|
|
|
|
item.setFiles(list); |
|
|
|
|
} |
|
|
|
|
final List<Map<String, String>> fileList = fileInfoService.getFileList("664", "1", item.getId().toString()); |
|
|
|
|
item.setFiles(fileList); |
|
|
|
|
|
|
|
|
|
// 企业标签
|
|
|
|
|
QueryWrapper<EnterpriseTagDO> enterpriseDOQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
enterpriseDOQueryWrapper.eq("enterprise_id", item.getId()); |
|
|
|
|
final List<EnterpriseTagDO> enterpriseTagDOS = enterpriseTagMapper.selectList(enterpriseDOQueryWrapper); |
|
|
|
|
List<String> tagList = new ArrayList<>(); |
|
|
|
|
if (!enterpriseTagDOS.isEmpty() && enterpriseTagDOS.size() > 0) { |
|
|
|
|
|
|
|
|
|
enterpriseTagDOS.forEach(tagItem-> { |
|
|
|
|
QueryWrapper<TagLibraryDO> tagLibraryDOQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
tagLibraryDOQueryWrapper.eq("id", tagItem.getTagId()); |
|
|
|
|
TagLibraryDO tagLibraryDO = tagLibraryMapper.selectOne(tagLibraryDOQueryWrapper); |
|
|
|
|
if (tagLibraryDO != null) { |
|
|
|
|
tagList.add(tagLibraryDO.getTagName()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
final List<TagLibraryDO> tagLibraryDOS1 = tagLibraryService.listByEnterpriseId(item.getId()); |
|
|
|
|
if (tagLibraryDOS1 != null && tagLibraryDOS1.size() > 0) { |
|
|
|
|
item.setTagList(tagLibraryDOS1.stream().map(item1->item1.getTagName()).collect(Collectors.toList())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
item.setTagList(tagList); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return success(BeanUtils.toBean(pageResult, EnterpriseRespVO.class)); |
|
|
|
|