|
@@ -34,14 +34,14 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import jakarta.validation.Valid;
|
|
import jakarta.validation.Valid;
|
|
|
|
|
|
|
|
+import org.apache.commons.codec.Charsets;
|
|
|
|
+import org.springblade.common.utils.CommonUtil;
|
|
import org.springblade.core.secure.BladeUser;
|
|
import org.springblade.core.secure.BladeUser;
|
|
import org.springblade.core.secure.annotation.PreAuth;
|
|
import org.springblade.core.secure.annotation.PreAuth;
|
|
import org.springblade.core.mp.support.Condition;
|
|
import org.springblade.core.mp.support.Condition;
|
|
import org.springblade.core.mp.support.Query;
|
|
import org.springblade.core.mp.support.Query;
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.api.R;
|
|
-import org.springblade.core.tool.utils.BeanUtil;
|
|
|
|
-import org.springblade.core.tool.utils.Func;
|
|
|
|
-import org.springblade.core.tool.utils.StringUtil;
|
|
|
|
|
|
+import org.springblade.core.tool.utils.*;
|
|
import org.springblade.modules.project.pojo.entity.WorkFocusProgressEntity;
|
|
import org.springblade.modules.project.pojo.entity.WorkFocusProgressEntity;
|
|
import org.springblade.modules.project.pojo.excel.WorkFocusExcel;
|
|
import org.springblade.modules.project.pojo.excel.WorkFocusExcel;
|
|
import org.springblade.modules.project.pojo.excel.WorkFocusExcel2;
|
|
import org.springblade.modules.project.pojo.excel.WorkFocusExcel2;
|
|
@@ -59,11 +59,15 @@ import org.springblade.modules.project.pojo.vo.WorkFocusVO;
|
|
import org.springblade.modules.project.wrapper.WorkFocusWrapper;
|
|
import org.springblade.modules.project.wrapper.WorkFocusWrapper;
|
|
import org.springblade.modules.project.service.IWorkFocusService;
|
|
import org.springblade.modules.project.service.IWorkFocusService;
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
-import org.springblade.core.tool.utils.DateUtil;
|
|
|
|
import org.springblade.core.excel.util.ExcelUtil;
|
|
import org.springblade.core.excel.util.ExcelUtil;
|
|
import org.springblade.core.tool.constant.BladeConstant;
|
|
import org.springblade.core.tool.constant.BladeConstant;
|
|
import org.springblade.core.tool.constant.RoleConstant;
|
|
import org.springblade.core.tool.constant.RoleConstant;
|
|
|
|
|
|
|
|
+import java.io.BufferedOutputStream;
|
|
|
|
+import java.io.InputStream;
|
|
|
|
+import java.io.OutputStream;
|
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
|
+import java.net.URLEncoder;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -218,9 +222,22 @@ public class WorkFocusController extends BladeController {
|
|
@GetMapping("export-template")
|
|
@GetMapping("export-template")
|
|
@ApiOperationSupport(order = 11)
|
|
@ApiOperationSupport(order = 11)
|
|
@Operation(summary = "导出模板", description = "导出模板")
|
|
@Operation(summary = "导出模板", description = "导出模板")
|
|
- public void exportUser(HttpServletResponse response) {
|
|
|
|
- List<WorkFocusEntity> list = new ArrayList<>();
|
|
|
|
- ExcelUtil.export(response, "用户数据模板" + DateUtil.time(), "用户数据表", list, WorkFocusEntity.class);
|
|
|
|
|
|
+ public void exportUser(HttpServletResponse response) throws Exception {
|
|
|
|
+ //List<WorkFocusEntity> list = new ArrayList<>();
|
|
|
|
+ //ExcelUtil.export(response, "用户数据模板" + DateUtil.time(), "用户数据表", list, WorkFocusEntity.class);
|
|
|
|
+
|
|
|
|
+ String mame="工作要点导入模版";
|
|
|
|
+ String url = "https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload/20240507/977249de5d6d16e57fe3ed21235b743e.xlsx";
|
|
|
|
+ String fileName = URLEncoder.encode(mame, Charsets.UTF_8.name());
|
|
|
|
+ InputStream redio = CommonUtil.getOSSInputStream(url);
|
|
|
|
+ byte[] buffer = IoUtil.readToByteArray(redio);
|
|
|
|
+ OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
|
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
|
+ response.setCharacterEncoding(org.apache.commons.codec.Charsets.UTF_8.name());
|
|
|
|
+ response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
|
|
|
+ toClient.write(buffer);
|
|
|
|
+ toClient.flush();
|
|
|
|
+ toClient.close();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -284,28 +301,16 @@ public class WorkFocusController extends BladeController {
|
|
WorkFocusEntity region = new WorkFocusEntity();
|
|
WorkFocusEntity region = new WorkFocusEntity();
|
|
List<WorkFocusEntity> workFocusEntities = workfocusService.getBaseMapper().selectList(Wrappers.<WorkFocusEntity>lambdaQuery().eq(WorkFocusEntity::getWorkPlan, readInfo.getWorkPlan()));
|
|
List<WorkFocusEntity> workFocusEntities = workfocusService.getBaseMapper().selectList(Wrappers.<WorkFocusEntity>lambdaQuery().eq(WorkFocusEntity::getWorkPlan, readInfo.getWorkPlan()));
|
|
if(workFocusEntities!=null && workFocusEntities.size()>=1){
|
|
if(workFocusEntities!=null && workFocusEntities.size()>=1){
|
|
- region = workFocusEntities.get(0);
|
|
|
|
|
|
+ WorkFocusEntity region2 = workFocusEntities.get(0);
|
|
|
|
+ region = BeanUtil.copyProperties(readInfo, WorkFocusEntity.class);
|
|
|
|
+ region.setId(region2.getId());
|
|
|
|
+
|
|
}else{
|
|
}else{
|
|
region = BeanUtil.copyProperties(readInfo, WorkFocusEntity.class);
|
|
region = BeanUtil.copyProperties(readInfo, WorkFocusEntity.class);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- WorkFocusProgressEntity workFocusProgress = new WorkFocusProgressEntity();
|
|
|
|
BeanUtil.copyProperties(readInfo, WorkFocusProgressEntity.class);
|
|
BeanUtil.copyProperties(readInfo, WorkFocusProgressEntity.class);
|
|
|
|
|
|
- List<WorkFocusProgressEntity> workF = workFocusProgressService.getBaseMapper().selectList(Wrappers.<WorkFocusProgressEntity>lambdaQuery().
|
|
|
|
- eq(WorkFocusProgressEntity::getWorkFocusId, region.getId()).
|
|
|
|
- eq(WorkFocusProgressEntity::getYear,year).
|
|
|
|
- eq(WorkFocusProgressEntity::getMonth,moth)
|
|
|
|
- );
|
|
|
|
- if(workF!=null && workF.size()>=1 ){
|
|
|
|
- workFocusProgress = workF.get(0);
|
|
|
|
- }else{
|
|
|
|
- workFocusProgress = BeanUtil.copyProperties(readInfo, WorkFocusProgressEntity.class);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- workFocusProgress.setYear(year);
|
|
|
|
- workFocusProgress.setMonth(moth);
|
|
|
|
region.setWorkFocusStage(maxId);
|
|
region.setWorkFocusStage(maxId);
|
|
if(Func.isNotEmpty(readInfo.getStartYear())){
|
|
if(Func.isNotEmpty(readInfo.getStartYear())){
|
|
region.setStartYear(Func.toInt(readInfo.getStartYear()));
|
|
region.setStartYear(Func.toInt(readInfo.getStartYear()));
|
|
@@ -322,27 +327,49 @@ public class WorkFocusController extends BladeController {
|
|
for(int k = startYear ; k <= endYear ; k++){
|
|
for(int k = startYear ; k <= endYear ; k++){
|
|
List<WorkFocusProgressEntity> list = new ArrayList<>();
|
|
List<WorkFocusProgressEntity> list = new ArrayList<>();
|
|
|
|
|
|
- for(int j=1 ; j <=14 ; j++){
|
|
|
|
- WorkFocusProgressEntity workFocusProgr = new WorkFocusProgressVO();
|
|
|
|
- if(year==k && moth==j){
|
|
|
|
- workFocusProgr = workFocusProgress;
|
|
|
|
|
|
+ for(int j=1 ; j <=14 ; j++) {
|
|
|
|
+ WorkFocusProgressEntity workFocusProgress = new WorkFocusProgressEntity();
|
|
|
|
+ // 数据判读是否存在
|
|
|
|
+ List<WorkFocusProgressEntity> workF = workFocusProgressService.getBaseMapper().selectList(Wrappers.<WorkFocusProgressEntity>lambdaQuery().
|
|
|
|
+ eq(WorkFocusProgressEntity::getWorkFocusId, region.getId()).
|
|
|
|
+ eq(WorkFocusProgressEntity::getYear, k).
|
|
|
|
+ eq(WorkFocusProgressEntity::getMonth, j)
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ if(workF!=null && workF.size()>=1 ){
|
|
|
|
+ workFocusProgress = workF.get(0);
|
|
|
|
+ if(year==k && moth==j){
|
|
|
|
+ long p_Key_id =workFocusProgress.getId();
|
|
|
|
+ workFocusProgress = BeanUtil.copyProperties(readInfo, WorkFocusProgressEntity.class);
|
|
|
|
+ workFocusProgress.setId(p_Key_id);
|
|
|
|
+ }
|
|
}else{
|
|
}else{
|
|
- workFocusProgr.setYear(k);
|
|
|
|
- workFocusProgr.setMonth(j);
|
|
|
|
|
|
+ if(year==k && moth==j){
|
|
|
|
+ workFocusProgress = BeanUtil.copyProperties(readInfo, WorkFocusProgressEntity.class);
|
|
|
|
+ workFocusProgress.setYear(k);
|
|
|
|
+ workFocusProgress.setMonth(j);
|
|
|
|
+ }else{
|
|
|
|
+ workFocusProgress.setYear(k);
|
|
|
|
+ workFocusProgress.setMonth(j);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- workFocusProgr.setWorkFocusId(region.getId());
|
|
|
|
|
|
+
|
|
|
|
+ workFocusProgress.setWorkFocusId(region.getId());
|
|
if(j==13){
|
|
if(j==13){
|
|
- workFocusProgr.setSchedule("unitInfo");
|
|
|
|
|
|
+
|
|
|
|
+ workFocusProgress.setSchedule("unitInfo");
|
|
if(k==year){
|
|
if(k==year){
|
|
- workFocusProgr.setProgress(workFocusProgress.getUnitInfo());
|
|
|
|
|
|
+ WorkFocusProgressEntity workFocusPss = BeanUtil.copyProperties(readInfo, WorkFocusProgressEntity.class);
|
|
|
|
+ workFocusProgress.setProgress(workFocusPss.getUnitInfo());
|
|
}
|
|
}
|
|
}if(j==14){
|
|
}if(j==14){
|
|
- workFocusProgr.setSchedule("linkInfo");
|
|
|
|
|
|
+ workFocusProgress.setSchedule("linkInfo");
|
|
if(k==year) {
|
|
if(k==year) {
|
|
- workFocusProgr.setProgress(workFocusProgress.getLinkInfo());
|
|
|
|
|
|
+ WorkFocusProgressEntity workFocusPss = BeanUtil.copyProperties(readInfo, WorkFocusProgressEntity.class);
|
|
|
|
+ workFocusProgress.setProgress(workFocusPss.getLinkInfo());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- list.add(workFocusProgr);
|
|
|
|
|
|
+ list.add(workFocusProgress);
|
|
}
|
|
}
|
|
workFocusProgressService.saveOrUpdateBatch(list);
|
|
workFocusProgressService.saveOrUpdateBatch(list);
|
|
}
|
|
}
|