|
@@ -1,5 +1,6 @@
|
|
|
package org.jeecg.modules.demo.gcproject.controller;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -20,7 +21,18 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
+import org.jeecg.modules.demo.ggzyannouncementtype.entity.GgzyAnnouncementType;
|
|
|
+import org.jeecg.modules.demo.ggzyannouncementtype.service.IGgzyAnnouncementTypeService;
|
|
|
+import org.jeecg.modules.demo.ggzycontentdistribution.entity.GgzyContentDistribution;
|
|
|
import org.jeecg.modules.demo.ggzycontentdistribution.entity.GgzyContentDistributionVo;
|
|
|
+import org.jeecg.modules.demo.ggzycontentdistribution.service.IGgzyContentDistributionService;
|
|
|
+import org.jeecg.modules.demo.ggzyindustrytype.entity.GgzyIndustryType;
|
|
|
+import org.jeecg.modules.demo.ggzyindustrytype.service.IGgzyIndustryTypeService;
|
|
|
+import org.jeecg.modules.demo.ggzyqxqcodemapping.entity.GgzyQxqCodeMapping;
|
|
|
+import org.jeecg.modules.demo.ggzyqxqcodemapping.service.IGgzyQxqCodeMappingService;
|
|
|
+import org.jeecg.modules.demo.ggzyregionalcodemapping.entity.GgzyRegionalCodeMapping;
|
|
|
+import org.jeecg.modules.demo.ggzyregionalcodemapping.service.IGgzyRegionalCodeMappingService;
|
|
|
+import org.jeecg.modules.elasticsearch.entity.TenderDetailsVo;
|
|
|
import org.jeecg.modules.utils.RandomStrUtil;
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
@@ -53,7 +65,24 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
public class GcProjectController extends JeecgController<GcProject, IGcProjectService> {
|
|
|
@Autowired
|
|
|
private IGcProjectService gcProjectService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private IGgzyContentDistributionService ggzyContentDistributionService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IGgzyContentDistributionService iGgzyContentDistributionService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IGgzyRegionalCodeMappingService iGgzyRegionalCodeMappingService;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IGgzyQxqCodeMappingService iGgzyQxqCodeMappingService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IGgzyAnnouncementTypeService iGgzyAnnouncementTypeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IGgzyIndustryTypeService iGgzyIndustryTypeService;
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
*
|
|
@@ -104,9 +133,137 @@ public class GcProjectController extends JeecgController<GcProject, IGcProjectSe
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
public Result<String> edit(@RequestBody GcProject gcProject) {
|
|
|
gcProjectService.updateById(gcProject);
|
|
|
+
|
|
|
+ String id = gcProject.getId();
|
|
|
+ String projectCode = gcProject.getProjectCode();
|
|
|
+ if(!ObjectUtils.isEmpty(id)){
|
|
|
+ QueryWrapper<GgzyContentDistribution> queryWrapper = new QueryWrapper<GgzyContentDistribution>();
|
|
|
+ queryWrapper.eq("project_code",projectCode);
|
|
|
+ long count = iGgzyContentDistributionService.count(queryWrapper);
|
|
|
+ Integer pageNo = 1;
|
|
|
+ Integer pageSize = 100;
|
|
|
+ Integer pageNum = (int)Math.ceil((double)count/pageSize);
|
|
|
+ for(int i = 1; i <= pageNum;i++){
|
|
|
+ try {
|
|
|
+ Page<GgzyContentDistribution> page = new Page<GgzyContentDistribution>(pageNo, pageSize);
|
|
|
+ IPage<GgzyContentDistribution> pageList = iGgzyContentDistributionService.page(page, queryWrapper);
|
|
|
+ if(!ObjectUtils.isEmpty(pageList)){
|
|
|
+ List<GgzyContentDistribution> records = pageList.getRecords();
|
|
|
+ if(!ObjectUtils.isEmpty(records)){
|
|
|
+ if(records.size() >= 1){
|
|
|
+ for (GgzyContentDistribution ggzyContentDistribution : records) {
|
|
|
+ ggzyContentDistribution.setIsSynchronous("4");
|
|
|
+ editGgzyContentDistribution(ggzyContentDistribution);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return Result.OK("编辑成功!");
|
|
|
}
|
|
|
|
|
|
+ public void editGgzyContentDistribution(GgzyContentDistribution ggzyContentDistribution) {
|
|
|
+ String projectCode = ggzyContentDistribution.getProjectCode();
|
|
|
+ if(!ObjectUtils.isEmpty(projectCode) && projectCode != ""){
|
|
|
+ GcProject gcProject = getGcProject(projectCode);
|
|
|
+ if(!ObjectUtils.isEmpty(gcProject)){
|
|
|
+ String regionCode = gcProject.getRegionCode();
|
|
|
+ if(!ObjectUtils.isEmpty(regionCode) && regionCode != ""){
|
|
|
+ ggzyContentDistribution.setRegionCode(regionCode);
|
|
|
+ GgzyQxqCodeMapping ggzyQxqCodeMapping = getGgzyQxqCodeMapping(regionCode);
|
|
|
+ if(!ObjectUtils.isEmpty(ggzyQxqCodeMapping)){
|
|
|
+ String name = ggzyQxqCodeMapping.getName();
|
|
|
+ if(!ObjectUtils.isEmpty(name)){
|
|
|
+ ggzyContentDistribution.setRegionName(name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String platformCode = gcProject.getPlatformCode();
|
|
|
+ if(!ObjectUtils.isEmpty(platformCode) && platformCode != ""){
|
|
|
+ ggzyContentDistribution.setPlatformCode(platformCode);
|
|
|
+ GgzyRegionalCodeMapping ggzyRegionalCodeMapping = getGgzyRegionalCodeMapping(platformCode);
|
|
|
+ if(!ObjectUtils.isEmpty(ggzyRegionalCodeMapping)){
|
|
|
+ String name = ggzyRegionalCodeMapping.getName();
|
|
|
+ if(!ObjectUtils.isEmpty(name)){
|
|
|
+ ggzyContentDistribution.setPlatformName(name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String projectName = gcProject.getProjectName();
|
|
|
+ if(!ObjectUtils.isEmpty(projectName)){
|
|
|
+ ggzyContentDistribution.setProjectName(projectName);
|
|
|
+ }
|
|
|
+ String industriesTypeCode = gcProject.getIndustriesType();
|
|
|
+ if(!ObjectUtils.isEmpty(industriesTypeCode)){
|
|
|
+ ggzyContentDistribution.setIndustriesTypeCode(industriesTypeCode);
|
|
|
+
|
|
|
+ GgzyIndustryType ggzyIndustryType = getGgzyIndustryType(industriesTypeCode);
|
|
|
+ if(!ObjectUtils.isEmpty(ggzyIndustryType)){
|
|
|
+ String industriesTypeName = ggzyIndustryType.getIndustriesTypeName();
|
|
|
+ ggzyContentDistribution.setIndustriesTypeName(industriesTypeName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String regionCode = ggzyContentDistribution.getRegionCode();
|
|
|
+ if(!ObjectUtils.isEmpty(regionCode) && regionCode != ""){
|
|
|
+ GgzyQxqCodeMapping ggzyQxqCodeMapping = getGgzyQxqCodeMapping(regionCode);
|
|
|
+ if(!ObjectUtils.isEmpty(ggzyQxqCodeMapping)){
|
|
|
+ String name = ggzyQxqCodeMapping.getName();
|
|
|
+ if(!ObjectUtils.isEmpty(name)){
|
|
|
+ ggzyContentDistribution.setRegionName(name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String platformCode = ggzyContentDistribution.getPlatformCode();
|
|
|
+ if(!ObjectUtils.isEmpty(platformCode) && platformCode != ""){
|
|
|
+ GgzyRegionalCodeMapping ggzyRegionalCodeMapping = getGgzyRegionalCodeMapping(platformCode);
|
|
|
+ if(!ObjectUtils.isEmpty(ggzyRegionalCodeMapping)){
|
|
|
+ String name = ggzyRegionalCodeMapping.getName();
|
|
|
+ if(!ObjectUtils.isEmpty(name)){
|
|
|
+ ggzyContentDistribution.setPlatformName(name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String noticeTypeCodeId = ggzyContentDistribution.getNoticeTypeCodeId();
|
|
|
+ if(!ObjectUtils.isEmpty(noticeTypeCodeId) && noticeTypeCodeId != ""){
|
|
|
+ GgzyAnnouncementType ggzyAnnouncementTypeById = getGgzyAnnouncementTypeById(noticeTypeCodeId);
|
|
|
+ if(!ObjectUtils.isEmpty(ggzyAnnouncementTypeById)){
|
|
|
+ String noticeTypeCode = ggzyAnnouncementTypeById.getNoticeTypeCode();
|
|
|
+ if(!ObjectUtils.isEmpty(noticeTypeCode)){
|
|
|
+ ggzyContentDistribution.setNoticeTypeCode(noticeTypeCode);
|
|
|
+ }
|
|
|
+ String noticeTypeName = ggzyAnnouncementTypeById.getNoticeTypeName();
|
|
|
+ if(!ObjectUtils.isEmpty(noticeTypeName)){
|
|
|
+ ggzyContentDistribution.setNoticeTypeName(noticeTypeName);
|
|
|
+ }
|
|
|
+ String transactionTypeCode = ggzyAnnouncementTypeById.getTransactionTypeCode();
|
|
|
+ if(!ObjectUtils.isEmpty(transactionTypeCode)){
|
|
|
+ ggzyContentDistribution.setTransactionTypeCode(transactionTypeCode);
|
|
|
+ }
|
|
|
+ String transactionTypeName = ggzyAnnouncementTypeById.getTransactionTypeName();
|
|
|
+ if(!ObjectUtils.isEmpty(transactionTypeName)){
|
|
|
+ ggzyContentDistribution.setTransactionTypeName(transactionTypeName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String industriesTypeCode = ggzyContentDistribution.getIndustriesTypeCode();
|
|
|
+ if(!ObjectUtils.isEmpty(industriesTypeCode)){
|
|
|
+ GgzyIndustryType ggzyIndustryType = getGgzyIndustryType(industriesTypeCode);
|
|
|
+ if(!ObjectUtils.isEmpty(ggzyIndustryType)){
|
|
|
+ String industriesTypeName = ggzyIndustryType.getIndustriesTypeName();
|
|
|
+ ggzyContentDistribution.setIndustriesTypeName(industriesTypeName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ggzyContentDistributionService.saveOrUpdate(ggzyContentDistribution);
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping(value = "/getSourceDataKey")
|
|
|
public Result<String> getSourceDataKey(){
|
|
|
String randomNumberNew = null;
|
|
@@ -226,4 +383,86 @@ public class GcProjectController extends JeecgController<GcProject, IGcProjectSe
|
|
|
return super.importExcel(request, response, GcProject.class);
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+ private GgzyAnnouncementType getGgzyAnnouncementTypeById(String id){
|
|
|
+ GgzyAnnouncementType byId = iGgzyAnnouncementTypeService.getById(id);
|
|
|
+ return byId;
|
|
|
+ }
|
|
|
+
|
|
|
+ private GgzyQxqCodeMapping getGgzyQxqCodeMapping(String codePram){
|
|
|
+ QueryWrapper<GgzyQxqCodeMapping> queryWrapper = new QueryWrapper<GgzyQxqCodeMapping>();
|
|
|
+ Page<GgzyQxqCodeMapping> page = new Page<GgzyQxqCodeMapping>(1, 1);
|
|
|
+ queryWrapper.eq("code_pram",codePram);
|
|
|
+ IPage<GgzyQxqCodeMapping> pageList = iGgzyQxqCodeMappingService.page(page, queryWrapper);
|
|
|
+ if(!ObjectUtils.isEmpty(pageList)){
|
|
|
+ List<GgzyQxqCodeMapping> records = pageList.getRecords();
|
|
|
+ if(!ObjectUtils.isEmpty(records)){
|
|
|
+ int size = records.size();
|
|
|
+ if(size >= 1){
|
|
|
+ GgzyQxqCodeMapping codeMapping = records.get(0);
|
|
|
+ if(!ObjectUtils.isEmpty(codeMapping)){
|
|
|
+ return codeMapping;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private GgzyRegionalCodeMapping getGgzyRegionalCodeMapping(String platformCode){
|
|
|
+ QueryWrapper<GgzyRegionalCodeMapping> queryWrapper = new QueryWrapper<GgzyRegionalCodeMapping>();
|
|
|
+ Page<GgzyRegionalCodeMapping> page = new Page<GgzyRegionalCodeMapping>(1, 1);
|
|
|
+ queryWrapper.eq("platform_code",platformCode);
|
|
|
+ IPage<GgzyRegionalCodeMapping> pageList = iGgzyRegionalCodeMappingService.page(page, queryWrapper);
|
|
|
+ if(!ObjectUtils.isEmpty(pageList)){
|
|
|
+ List<GgzyRegionalCodeMapping> records = pageList.getRecords();
|
|
|
+ if(!ObjectUtils.isEmpty(records)){
|
|
|
+ int size = records.size();
|
|
|
+ if(size >= 1){
|
|
|
+ GgzyRegionalCodeMapping codeMapping = records.get(0);
|
|
|
+ if(!ObjectUtils.isEmpty(codeMapping)){
|
|
|
+ return codeMapping;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private GcProject getGcProject(String projectCode){
|
|
|
+ QueryWrapper<GcProject> queryWrapper = new QueryWrapper<GcProject>();
|
|
|
+ Page<GcProject> page = new Page<GcProject>(1, 1);
|
|
|
+ queryWrapper.eq("project_code",projectCode);
|
|
|
+ IPage<GcProject> pageList = gcProjectService.page(page, queryWrapper);
|
|
|
+ if(!ObjectUtils.isEmpty(pageList)){
|
|
|
+ List<GcProject> records = pageList.getRecords();
|
|
|
+ if(!ObjectUtils.isEmpty(records)){
|
|
|
+ int size = records.size();
|
|
|
+ if(size >= 1){
|
|
|
+ GcProject gcProject = records.get(0);
|
|
|
+ return gcProject;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private GgzyIndustryType getGgzyIndustryType(String industryTypeCode){
|
|
|
+ QueryWrapper<GgzyIndustryType> queryWrapper = new QueryWrapper<GgzyIndustryType>();
|
|
|
+ Page<GgzyIndustryType> page = new Page<GgzyIndustryType>(1, 1);
|
|
|
+ queryWrapper.eq("industries_type_code",industryTypeCode);
|
|
|
+ IPage<GgzyIndustryType> pageList = iGgzyIndustryTypeService.page(page, queryWrapper);
|
|
|
+ if(!ObjectUtils.isEmpty(pageList)){
|
|
|
+ List<GgzyIndustryType> records = pageList.getRecords();
|
|
|
+ if(!ObjectUtils.isEmpty(records)){
|
|
|
+ int size = records.size();
|
|
|
+ if(size >= 1){
|
|
|
+ GgzyIndustryType ggzyIndustryType = records.get(0);
|
|
|
+ return ggzyIndustryType;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|