Commit 9774734e authored by wangqiang's avatar wangqiang

修改批量下载接口和修改季报的状态接口

parent 8ed6283b
...@@ -5,7 +5,11 @@ import com.yonde.dcs.plan.core.controller.shadow.ExtActionItemControllerShadow; ...@@ -5,7 +5,11 @@ import com.yonde.dcs.plan.core.controller.shadow.ExtActionItemControllerShadow;
import com.yonde.dcs.plan.core.service.ExtActionItemService; import com.yonde.dcs.plan.core.service.ExtActionItemService;
import com.yonde.dex.basedata.auth.annos.BasePermission; import com.yonde.dex.basedata.auth.annos.BasePermission;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
...@@ -23,6 +27,15 @@ import org.springframework.web.bind.annotation.ResponseBody; ...@@ -23,6 +27,15 @@ import org.springframework.web.bind.annotation.ResponseBody;
public class ExtActionItemController<V extends ExtActionItemVO, S extends ExtActionItemService<V>> extends ExtActionItemControllerShadow<V, S> { public class ExtActionItemController<V extends ExtActionItemVO, S extends ExtActionItemService<V>> extends ExtActionItemControllerShadow<V, S> {
@Autowired
private ExtActionItemService extActionItemService;
@ApiOperation(value = "根据行动项id修改季报的状态", notes = "根据行动项id修改季报的状态")
@PostMapping(value = "/updateQRStateByAItemId")
public String changeQRStateWhenAllActionItemIsDone(@RequestBody ExtActionItemVO extActionItemVO){
return extActionItemService.changeQRStateWhenAllActionItemIsDone(extActionItemVO);
}
} }
...@@ -16,11 +16,11 @@ public interface ExtActionItemService<V extends ExtActionItemVO> extends ExtActi ...@@ -16,11 +16,11 @@ public interface ExtActionItemService<V extends ExtActionItemVO> extends ExtActi
/** /**
* 季报下的所有行动项如果已完成,将季报状态置为待审阅 * 季报下的所有行动项如果已完成,将季报状态置为待审阅
* @param id 行动项的id * @param extActionItemVO 行动项的id
* @return * @return
*/ */
String changeQRStateWhenAllActionItemIsDone(Long id); String changeQRStateWhenAllActionItemIsDone(ExtActionItemVO extActionItemVO);
} }
...@@ -43,14 +43,12 @@ public class ExtActionItemServiceImpl<V extends ExtActionItemVO> implements ExtA ...@@ -43,14 +43,12 @@ public class ExtActionItemServiceImpl<V extends ExtActionItemVO> implements ExtA
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public String changeQRStateWhenAllActionItemIsDone(Long id) { public String changeQRStateWhenAllActionItemIsDone(ExtActionItemVO extActionItemVO) {
Boolean allActionItemIsCompleteFlag = false; Boolean allActionItemIsCompleteFlag = false;
ExtActionItemVO extActionItemVO = this.findLatest(id);
if (ObjectUtils.isEmpty(extActionItemVO)) { //根据行动项id查询季报id
throw new DxBusinessException("-1", "根据行动项id:" + id + "未查到数据");
}
SearchQueryCondition searchQRById = SearchUtil.buildQueryWithOpenAttr("id", SearchQueryCondition searchQRById = SearchUtil.buildQueryWithOpenAttr("id",
SearchItem.Operator.EQ, SearchItem.Operator.EQ,
extActionItemVO.getExtQuarterlyReport().getId(), extActionItemVO.getExtQuarterlyReport().getId(),
......
...@@ -17,6 +17,7 @@ import com.yonde.dex.basedata.data.search.SearchQueryCondition; ...@@ -17,6 +17,7 @@ import com.yonde.dex.basedata.data.search.SearchQueryCondition;
import com.yonde.dex.basedata.entity.api.ApiResult; import com.yonde.dex.basedata.entity.api.ApiResult;
import com.yonde.dex.basedata.entity.data.DxPageImpl; import com.yonde.dex.basedata.entity.data.DxPageImpl;
import com.yonde.dex.basedata.exception.DxBusinessException; import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.basedata.users.UserHelper;
import com.yonde.dex.dfs.feign.FileManagerFeignService; import com.yonde.dex.dfs.feign.FileManagerFeignService;
import com.yonde.dex.dfs.vo.ObjFileLinkVO; import com.yonde.dex.dfs.vo.ObjFileLinkVO;
import com.yonde.dex.dfs.vo.view.FileDownLoadInfoVO; import com.yonde.dex.dfs.vo.view.FileDownLoadInfoVO;
...@@ -32,6 +33,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -32,6 +33,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -57,6 +59,8 @@ public class ExtQuarterlyReportServiceImpl<V extends ExtQuarterlyReportVO> imple ...@@ -57,6 +59,8 @@ public class ExtQuarterlyReportServiceImpl<V extends ExtQuarterlyReportVO> imple
@Autowired @Autowired
private WfcProcessFeign wfcProcessFeign; private WfcProcessFeign wfcProcessFeign;
@Autowired
private UserHelper userHelper;
@Override @Override
public void batchDownloadDoc(HttpServletResponse response, Long id) throws IOException { public void batchDownloadDoc(HttpServletResponse response, Long id) throws IOException {
...@@ -65,14 +69,15 @@ public class ExtQuarterlyReportServiceImpl<V extends ExtQuarterlyReportVO> imple ...@@ -65,14 +69,15 @@ public class ExtQuarterlyReportServiceImpl<V extends ExtQuarterlyReportVO> imple
List<Long> fileIds = new ArrayList<>(); List<Long> fileIds = new ArrayList<>();
//临时文件目录 //临时文件目录
String tempDir = ResourceHelper.createTempDir().getPath(); String tempDir = ResourceHelper.createTempDir().getPath();
SearchQueryCondition query = SearchQueryCondition.builder() SearchQueryCondition query = SearchQueryCondition.builder()
.openProp(SearchQueryCondition.builder().name("extActionItems") .openProp(SearchQueryCondition.builder().name("extActionItems")
.openProp(SearchQueryCondition.builder().name("objFileLinks").build()) .openProp(SearchQueryCondition.builder().name("objFileLinks")
.openProp(SearchQueryCondition.builder().name("target").build()).build()) .openProp(SearchQueryCondition.builder().name("target").build()).build()).build())
.searchItems(SearchItems.builder() .searchItems(SearchItems.builder()
.item(new SearchItem("id", SearchItem.Operator.EQ, id, null)) .item(new SearchItem("id", SearchItem.Operator.EQ, id, null))
.item(new SearchItem("latest", SearchItem.Operator.EQ, true, null)) .build()).build();
.operator(SearchItems.BooleanOperator.AND).build()).build();
List<V> quarterlyReportVOList = this.findRecursion(query).getContent(); List<V> quarterlyReportVOList = this.findRecursion(query).getContent();
if (!ObjectUtils.isEmpty(quarterlyReportVOList)) { if (!ObjectUtils.isEmpty(quarterlyReportVOList)) {
ExtQuarterlyReportVO extQuarterlyReportVO = quarterlyReportVOList.get(0); ExtQuarterlyReportVO extQuarterlyReportVO = quarterlyReportVOList.get(0);
...@@ -89,10 +94,13 @@ public class ExtQuarterlyReportServiceImpl<V extends ExtQuarterlyReportVO> imple ...@@ -89,10 +94,13 @@ public class ExtQuarterlyReportServiceImpl<V extends ExtQuarterlyReportVO> imple
}); });
//压缩文件 //压缩文件
downloadDataZip(response, tempDir); downloadDataZip(response, tempDir);
// todo 删除临时文件夹
} else { } else {
throw new DxBusinessException("-1", "根据季报id:" + id + "未查到数据"); throw new DxBusinessException("-1", "根据季报id:" + id + "未查到报表数据");
} }
}else {
throw new DxBusinessException("-1", "根据季报id:" + id + "未查到季报对象");
} }
...@@ -110,6 +118,10 @@ public class ExtQuarterlyReportServiceImpl<V extends ExtQuarterlyReportVO> imple ...@@ -110,6 +118,10 @@ public class ExtQuarterlyReportServiceImpl<V extends ExtQuarterlyReportVO> imple
} }
//批量启动行动项工作流 //批量启动行动项工作流
for (ExtActionItemVO extActionItemVO : extQuarterlyReportVO.getExtActionItems()) { for (ExtActionItemVO extActionItemVO : extQuarterlyReportVO.getExtActionItems()) {
//任务启动时间
extActionItemVO.setTaskReleaseDate(LocalDateTime.now());
//任务发布人
extActionItemVO.setTaskReleasePersonId(userHelper.getCurrentUser().getUserId());
wfcProcessFeign.startProcessByKey("ExtActionItemWF", extActionItemVO); wfcProcessFeign.startProcessByKey("ExtActionItemWF", extActionItemVO);
} }
//修改季报的状态未信息收集中 //修改季报的状态未信息收集中
......
...@@ -6,6 +6,8 @@ import io.swagger.annotations.Api; ...@@ -6,6 +6,8 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
/** /**
...@@ -20,6 +22,6 @@ public interface ExtActionItemServiceFeign<V extends ExtActionItemVO> extends Ex ...@@ -20,6 +22,6 @@ public interface ExtActionItemServiceFeign<V extends ExtActionItemVO> extends Ex
@ApiOperation(value = "根据行动项id修改季报的状态", notes = "根据行动项id修改季报的状态") @ApiOperation(value = "根据行动项id修改季报的状态", notes = "根据行动项id修改季报的状态")
@GetMapping(value = "/updateQRStateByAItemId") @PostMapping(value = "/updateQRStateByAItemId")
String changeQRStateWhenAllActionItemIsDone(@RequestParam("id") Long id); String changeQRStateWhenAllActionItemIsDone(@RequestBody ExtActionItemVO extActionItemVO);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment