压缩和派发全部公司

dongdingding
杜函宇 6 months ago
parent fef7a377ba
commit 6468cb0a88

@ -1,5 +1,8 @@
package com.ruoyi.jjh.declaration.controller; package com.ruoyi.jjh.declaration.controller;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ZipUtil;
import cn.hutool.http.HttpUtil;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
@ -14,14 +17,25 @@ import com.ruoyi.jjh.declaration.entity.dto.BmsDeclarationRecordsDto;
import com.ruoyi.jjh.declaration.entity.vo.ApprovalDeclarationRecordsQueryVo; import com.ruoyi.jjh.declaration.entity.vo.ApprovalDeclarationRecordsQueryVo;
import com.ruoyi.jjh.declaration.entity.vo.BmsDeclarationRecordsQueryVo; import com.ruoyi.jjh.declaration.entity.vo.BmsDeclarationRecordsQueryVo;
import com.ruoyi.jjh.declaration.entity.vo.BmsMunicipalBureauReviewQueryVo; import com.ruoyi.jjh.declaration.entity.vo.BmsMunicipalBureauReviewQueryVo;
import com.ruoyi.jjh.declaration.mapper.BmsDeclarationRecordsMapper;
import com.ruoyi.jjh.declaration.service.IBmsDeclarationRecordsService; import com.ruoyi.jjh.declaration.service.IBmsDeclarationRecordsService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import java.io.File;
import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List; import java.util.List;
/** /**
@ -34,10 +48,14 @@ import java.util.List;
@RequestMapping("/system/declarationRecords") @RequestMapping("/system/declarationRecords")
@Api(tags = "在线申报记录") @Api(tags = "在线申报记录")
public class BmsDeclarationRecordsController extends BaseController { public class BmsDeclarationRecordsController extends BaseController {
@Autowired @Resource
private IBmsDeclarationRecordsService bmsDeclarationRecordsService; private IBmsDeclarationRecordsService bmsDeclarationRecordsService;
@Value("${ruoyi.profile}")
private String fileAddress;
@Resource
private BmsDeclarationRecordsMapper bmsDeclarationRecordsMapper;
/** /**
* *
* *
@ -76,8 +94,43 @@ public class BmsDeclarationRecordsController extends BaseController {
// @RequiresPermissions("system:declarationRecords:list") // @RequiresPermissions("system:declarationRecords:list")
@GetMapping("/fileList") @GetMapping("/fileList")
@ApiOperation("根据列表id集合压缩所有文件") @ApiOperation("根据列表id集合压缩所有文件")
public AjaxResult fileList(@RequestParam(name = "list") List<Long> list) { public ResponseEntity<byte[]> fileList(@RequestParam(name = "list") List<Long> list) throws FileNotFoundException, UnsupportedEncodingException {
return AjaxResult.success(bmsDeclarationRecordsService.fileList(list)); List<BmsDeclarationRecordsQueryVo> rd = bmsDeclarationRecordsMapper.selectDeclarationRecordsToIdList(list);
// 创建父文件目录
String fatherFile = fileAddress + "/" + "项目压缩文件";
FileUtil.mkdir(fatherFile);
for (BmsDeclarationRecordsQueryVo item : rd) {
String itemsFileName = fatherFile + "/" +item.getProjectName()+item.getEnterpriseName();
FileUtil.mkdir(itemsFileName);
String[] splitList = bmsDeclarationRecordsService.getAllFile(item.getTemplateId(), item.getDetailId()).split(",");
for (String s : splitList) {
// 下载文件
try {
HttpUtil.downloadFile(s, itemsFileName);
} catch (Exception e) {
throw new RuntimeException(itemsFileName+"某文件下载失败");
}
}
}
// 压缩后的文件路径
String zipFilePath = fatherFile + ".zip";
// 使用Hutool压缩文件夹
ZipUtil.zip(fatherFile, zipFilePath);
// 从本地读取压缩文件
File zipFile = FileUtil.file(zipFilePath);
// FileSystemResource resource = new FileSystemResource(zipFile);
// 读取本地压缩文件并转为字节数组
byte[] bytes = FileUtil.readBytes(zipFile);
// 设置响应头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", URLEncoder.encode("项目压缩文件.zip","UTF-8"));
// 删除压缩之前的文件夹
FileUtil.del(zipFilePath);
// 删除压缩包
FileUtil.del(fatherFile);
// 创建响应实体
return new ResponseEntity<>(bytes, headers, HttpStatus.OK);
} }
/** /**

@ -82,4 +82,6 @@ public interface BmsDeclarationRecordsMapper extends BaseMapper<BmsDeclarationRe
* @create 2023/9/6 15:13 * @create 2023/9/6 15:13
*/ */
public int updateProjectNameById(@Param("id") Long id, @Param("projectName")String projectName,@Param("projectId")Long projectId); public int updateProjectNameById(@Param("id") Long id, @Param("projectName")String projectName,@Param("projectId")Long projectId);
List<BmsDeclarationRecordsQueryVo> selectDeclarationRecordsToIdList(@Param("list") List<Long> list);
} }

@ -2,11 +2,7 @@ package com.ruoyi.jjh.declaration.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords; import com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords;
import com.ruoyi.jjh.declaration.entity.dto.ApprovalDeclarationRecordsQueryDto; import com.ruoyi.jjh.declaration.entity.dto.*;
import com.ruoyi.jjh.declaration.entity.dto.BmsApprovalInfoUpdateDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsDeclarationRecordsAddDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsDeclarationRecordsDto;
import com.ruoyi.jjh.declaration.entity.dto.MunicipalReviewDto;
import com.ruoyi.jjh.declaration.entity.vo.ApprovalDeclarationRecordsQueryVo; import com.ruoyi.jjh.declaration.entity.vo.ApprovalDeclarationRecordsQueryVo;
import com.ruoyi.jjh.declaration.entity.vo.BmsDeclarationRecordsQueryVo; import com.ruoyi.jjh.declaration.entity.vo.BmsDeclarationRecordsQueryVo;
import com.ruoyi.jjh.declaration.entity.vo.BmsMunicipalBureauReviewQueryVo; import com.ruoyi.jjh.declaration.entity.vo.BmsMunicipalBureauReviewQueryVo;
@ -105,5 +101,8 @@ public interface IBmsDeclarationRecordsService extends IService<BmsDeclarationRe
public int updateDeclarationRecords(Long declarationId, Long projectId, String projectName, Long status); public int updateDeclarationRecords(Long declarationId, Long projectId, String projectName, Long status);
String fileList(List<Long> list); /**
* id使
*/
String getAllFile(Long args,Long id);
} }

@ -2,8 +2,6 @@ package com.ruoyi.jjh.declaration.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.context.SecurityContextHolder; import com.ruoyi.common.context.SecurityContextHolder;
@ -19,8 +17,8 @@ import com.ruoyi.jjh.declaration.mapper.BmsDeclarationRecordsMapper;
import com.ruoyi.jjh.declaration.service.*; import com.ruoyi.jjh.declaration.service.*;
import com.ruoyi.jjh.ent.entity.JProject; import com.ruoyi.jjh.ent.entity.JProject;
import com.ruoyi.jjh.ent.service.JProjectService; import com.ruoyi.jjh.ent.service.JProjectService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -60,9 +58,67 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl<BmsDeclaration
@Autowired @Autowired
private IBmsEnterpriseBasicInfoService iBmsEnterpriseBasicInfoService; private IBmsEnterpriseBasicInfoService iBmsEnterpriseBasicInfoService;
/**
*
*/
@Resource
private IBmsProjectSettlementAwardService bmsProjectSettlementAwardService;
/**
*
*/
@Autowired
private IBmsBigStrongAwardService bmsBigStrongAwardService;
/**
*
*/
@Autowired
private IBmsCarrierConstructionAwardService bmsCarrierConstructionAwardService;
/**
*
*/
@Autowired
private IBmsPlatformConstructionAwardService bmsPlatformConstructionAwardService;
/**
*
*/
@Autowired
private IBmsBrandingAwardService bmsBrandingAwardService;
/**
*
*/
@Autowired
private IBmsSceneOpeningAwardService bmsSceneOpeningAwardService;
/**
*
*/
@Autowired
private IBmsCreditManagementService bmsCreditManagementService;
/**
* 5G+
*/
@Autowired
private IBmsIndustrialInternetAwardService bmsIndustrialInternetAwardService;
/**
*
*/
@Autowired
private IBmsManufacturingServicesAwardService bmsManufacturingServicesAwardService;
/**
*
*/
@Autowired
private IBmsLogisticsDevelopmentAwardService bmsLogisticsDevelopmentAwardService;
/**
*
*/
@Autowired
private IBmsIntegrationIndustriesService bmsIntegrationIndustriesService;
@Resource @Resource
private JProjectService jProjectService; private JProjectService jProjectService;
@Value("${ruoyi.profile}")
private String fileAddress;
/** /**
* 线 * 线
* *
@ -583,10 +639,59 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl<BmsDeclaration
return baseMapper.updateById(bmsDeclarationRecords); return baseMapper.updateById(bmsDeclarationRecords);
} }
@Override
public String fileList(List<Long> list) { /**
List<BmsDeclarationRecords> rd = baseMapper.selectBatchIds(list); * id使
System.out.println(rd); */
return null; public String getAllFile(Long args,Long id) {
if (args == 1) {
BmsProjectSettlementAward lh = bmsProjectSettlementAwardService.getById(id);
return lh.getAgreement() + "," +
lh.getReport() + "," +
lh.getBusinessLicense() + "," +
lh.getOtherMaterials();
} else if (args == 2) {
BmsBigStrongAward zdzq = bmsBigStrongAwardService.getById(id);
return zdzq.getDevelopmentPlan();
}else if (args == 3) {
BmsCarrierConstructionAward ztjs = bmsCarrierConstructionAwardService.getById(id);
return ztjs.getSupportingMaterials() + "," +
ztjs.getBusinessLicense() + "," +
ztjs.getFireReport();
}else if (args == 4) {
BmsPlatformConstructionAward ptjs = bmsPlatformConstructionAwardService.getById(id);
return ptjs.getAgreement();
}else if (args == 5) {
BmsBrandingAward ppdz = bmsBrandingAwardService.getById(id);
return ppdz.getEvidence();
}else if (args == 6) {
BmsSceneOpeningAward cjkf = bmsSceneOpeningAwardService.getById(id);
return cjkf.getMaterial();
}else if (args == 7) {
BmsCreditManagement xygl = bmsCreditManagementService.getById(id);
return xygl.getProjectPlan() + "," + xygl.getUsesFunds() + "," + xygl.getAuditReport() ;
}else if (args == 8) {
BmsIndustrialInternetAward g5 = bmsIndustrialInternetAwardService.getById(id);
return g5.getMaterial();
}else if (args == 9) {
BmsManufacturingServicesAward zzfw = bmsManufacturingServicesAwardService.getById(id);
return zzfw.getFilingNotice() + "," + zzfw.getInvoice() + "," + zzfw.getAuditReport() + ","+ zzfw.getFinancialStatements() ;
}else if (args == 10) {
BmsLogisticsDevelopmentAward wl = bmsLogisticsDevelopmentAwardService.getById(id);
return wl.getFilingNotice() + "," + wl.getHonorCertificate() + "," + wl.getAuditReport() + ","+ wl.getPlatformName();
}else if (args == 11) {
BmsIntegrationIndustries ly = bmsIntegrationIndustriesService.getById(id);
return ly.getEvidence() + ","+
ly.getBusinessLicense() + "," +
ly.getTaxPaymentCertificate() + "," +
ly.getAuditReport() + "," +
ly.getEquityStructureChart() + "," +
ly.getDeclarationReport() + "," +
ly.getIndependentAccounting() + "," +
ly.getCapitalVerificationReport() + "," +
ly.getOtherEvidence();
}else {
return null;
}
} }
} }

@ -21,25 +21,29 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 线Service * 线Service
* *
* @author farben * @author farben
* @date 2023-09-07 * @date 2023-09-07
*/ */
@Service @Service
public class BmsTemplateRecordServiceImpl extends ServiceImpl<BmsTemplateRecordMapper,BmsTemplateRecord> implements IBmsTemplateRecordService { public class BmsTemplateRecordServiceImpl extends ServiceImpl<BmsTemplateRecordMapper, BmsTemplateRecord> implements IBmsTemplateRecordService {
@Autowired @Autowired
private IBmsEnterpriseDirectoryService enterpriseDirectoryService; private IBmsEnterpriseDirectoryService enterpriseDirectoryService;
@Autowired @Autowired
private IBmsEnterpriseBasicInfoService iBmsEnterpriseBasicInfoService; private IBmsEnterpriseBasicInfoService iBmsEnterpriseBasicInfoService;
/** /**
* 线 * 线
* *
* @param id 线 * @param id 线
* @return 线 * @return 线
*/ */
@ -54,7 +58,7 @@ public class BmsTemplateRecordServiceImpl extends ServiceImpl<BmsTemplateRecordM
/** /**
* 线 * 线
* *
* @param bmsTemplateRecordQueryDto 线 * @param bmsTemplateRecordQueryDto 线
* @return 线 * @return 线
*/ */
@ -72,7 +76,7 @@ public class BmsTemplateRecordServiceImpl extends ServiceImpl<BmsTemplateRecordM
public List<BmsTemplateRecordQueryVo> selectBmsTemplateNameList(BmsTemplateQueryDto bmsTemplateQueryDto) { public List<BmsTemplateRecordQueryVo> selectBmsTemplateNameList(BmsTemplateQueryDto bmsTemplateQueryDto) {
Long enterpriseId = bmsTemplateQueryDto.getEnterpriseId(); Long enterpriseId = bmsTemplateQueryDto.getEnterpriseId();
BmsEnterpriseBasicInfo bmsEnterpriseBasicInfo = iBmsEnterpriseBasicInfoService.selectBmsEnterpriseBasicInfoById(enterpriseId); BmsEnterpriseBasicInfo bmsEnterpriseBasicInfo = iBmsEnterpriseBasicInfoService.selectBmsEnterpriseBasicInfoById(enterpriseId);
if (BeanUtil.isNotEmpty(bmsEnterpriseBasicInfo)){ if (BeanUtil.isNotEmpty(bmsEnterpriseBasicInfo)) {
bmsTemplateQueryDto.setCreditCode(bmsEnterpriseBasicInfo.getCreditCode()); bmsTemplateQueryDto.setCreditCode(bmsEnterpriseBasicInfo.getCreditCode());
return baseMapper.selectBmsTemplateNameList(bmsTemplateQueryDto); return baseMapper.selectBmsTemplateNameList(bmsTemplateQueryDto);
} }
@ -81,7 +85,7 @@ public class BmsTemplateRecordServiceImpl extends ServiceImpl<BmsTemplateRecordM
/** /**
* 线 * 线
* *
* @param bmsTemplateRecordAddDto 线 * @param bmsTemplateRecordAddDto 线
* @return * @return
*/ */
@ -94,13 +98,24 @@ public class BmsTemplateRecordServiceImpl extends ServiceImpl<BmsTemplateRecordM
num = baseMapper.insertBmsTemplateRecord(bmsTemplateRecordAddDto); num = baseMapper.insertBmsTemplateRecord(bmsTemplateRecordAddDto);
List<BmsEnterpriseDirectory> enterpriseDirectoryList = bmsTemplateRecordAddDto List<BmsEnterpriseDirectory> enterpriseDirectoryList = bmsTemplateRecordAddDto
.getEnterpriseDirectoryList(); .getEnterpriseDirectoryList();
if (null != enterpriseDirectoryList && enterpriseDirectoryList.size()>0){ if (null != enterpriseDirectoryList && enterpriseDirectoryList.size() > 0) {
enterpriseDirectoryList.forEach(x->{ enterpriseDirectoryList.forEach(x -> {
x.setTemplateRecordId(bmsTemplateRecordAddDto.getId()); x.setTemplateRecordId(bmsTemplateRecordAddDto.getId());
}); });
enterpriseDirectoryService.saveOrUpdateBatch(enterpriseDirectoryList); enterpriseDirectoryService.saveOrUpdateBatch(enterpriseDirectoryList);
} else {
List<BmsEnterpriseBasicInfo> list = iBmsEnterpriseBasicInfoService.list();
Collection<BmsEnterpriseDirectory> copyList = new ArrayList<>();
for (BmsEnterpriseBasicInfo items : list) {
BmsEnterpriseDirectory bms = new BmsEnterpriseDirectory();
bms.setTemplateRecordId(bmsTemplateRecordAddDto.getId());
bms.setEnterpriseName(items.getEnterpriseName());
bms.setCreditCode(items.getCreditCode());
copyList.add(bms);
}
enterpriseDirectoryService.saveBatch(copyList);
} }
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return num; return num;
@ -108,7 +123,7 @@ public class BmsTemplateRecordServiceImpl extends ServiceImpl<BmsTemplateRecordM
/** /**
* 线 * 线
* *
* @param bmsTemplateRecordUpdateDto 线 * @param bmsTemplateRecordUpdateDto 线
* @return * @return
*/ */
@ -119,13 +134,13 @@ public class BmsTemplateRecordServiceImpl extends ServiceImpl<BmsTemplateRecordM
int num = baseMapper.updateBmsTemplateRecord(bmsTemplateRecordUpdateDto); int num = baseMapper.updateBmsTemplateRecord(bmsTemplateRecordUpdateDto);
// 删除企业相关列表 // 删除企业相关列表
QueryWrapper<BmsEnterpriseDirectory> queryWrapper = new QueryWrapper<>(); QueryWrapper<BmsEnterpriseDirectory> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("template_record_id",bmsTemplateRecordUpdateDto.getId()); queryWrapper.eq("template_record_id", bmsTemplateRecordUpdateDto.getId());
enterpriseDirectoryService.remove(queryWrapper); enterpriseDirectoryService.remove(queryWrapper);
// 新增企业相关列表 // 新增企业相关列表
List<BmsEnterpriseDirectory> enterpriseDirectoryList = bmsTemplateRecordUpdateDto List<BmsEnterpriseDirectory> enterpriseDirectoryList = bmsTemplateRecordUpdateDto
.getEnterpriseDirectoryList(); .getEnterpriseDirectoryList();
if (null != enterpriseDirectoryList && enterpriseDirectoryList.size()>0){ if (null != enterpriseDirectoryList && enterpriseDirectoryList.size() > 0) {
enterpriseDirectoryList.forEach(x->{ enterpriseDirectoryList.forEach(x -> {
x.setTemplateRecordId(bmsTemplateRecordUpdateDto.getId()); x.setTemplateRecordId(bmsTemplateRecordUpdateDto.getId());
}); });
enterpriseDirectoryService.saveOrUpdateBatch(enterpriseDirectoryList); enterpriseDirectoryService.saveOrUpdateBatch(enterpriseDirectoryList);
@ -135,7 +150,7 @@ public class BmsTemplateRecordServiceImpl extends ServiceImpl<BmsTemplateRecordM
/** /**
* 线 * 线
* *
* @param ids 线 * @param ids 线
* @return * @return
*/ */
@ -146,7 +161,7 @@ public class BmsTemplateRecordServiceImpl extends ServiceImpl<BmsTemplateRecordM
/** /**
* 线 * 线
* *
* @param id 线 * @param id 线
* @return * @return
*/ */

@ -245,6 +245,46 @@
INNER JOIN bms_enterprise_basic_info b ON a.enterprise_id = b.id INNER JOIN bms_enterprise_basic_info b ON a.enterprise_id = b.id
WHERE a.`status` = 4 WHERE a.`status` = 4
</select> </select>
<select id="selectDeclarationRecordsToIdList"
resultType="com.ruoyi.jjh.declaration.entity.vo.BmsDeclarationRecordsQueryVo">
SELECT
a.id,
d.project_name,
a.project_id,
a.enterprise_id,
c.LEVEL,
a.YEAR,
c.type,
a.template_record_id,
c.id as template_id,
c.responsibility_unit,
a.declaration_template_type,
a.detail_id,
a.STATUS,
a.is_deleted,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.remark,
b.enterprise_name,
f.road
FROM
bms_declaration_records AS a
inner join bms_template_record f on a.template_record_id = f.id
LEFT JOIN bms_enterprise_basic_info b ON a.enterprise_id = b.id
LEFT JOIN bms_template_info c on a.declaration_template_type = c.id
LEFT JOIN bms_project_info d on a.project_id = d.id
left join sys_dict_data e on a.status = e.dict_value and e.dict_type='bms_approval_status'
<where>
<if test="list != null and list.size>0">
and a.id in
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
</select>
<insert id="insertBmsDeclarationRecords" parameterType="com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords" <insert id="insertBmsDeclarationRecords" parameterType="com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords"
useGeneratedKeys="true" keyProperty="id"> useGeneratedKeys="true" keyProperty="id">

Loading…
Cancel
Save