|
@@ -39,9 +39,12 @@ import org.springblade.core.secure.annotation.PreAuth;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
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.modules.project.pojo.entity.WorkFocusProgressEntity;
|
|
|
import org.springblade.modules.project.pojo.excel.WorkFocusExcel;
|
|
|
+import org.springblade.modules.project.pojo.excel.WorkFocusExcel2;
|
|
|
import org.springblade.modules.project.pojo.excel.WorkFocusImporter;
|
|
|
import org.springblade.modules.project.pojo.vo.WorkFocusDataInfoVO;
|
|
|
import org.springblade.modules.project.pojo.vo.WorkFocusListVO;
|
|
@@ -189,21 +192,14 @@ public class WorkFocusController extends BladeController {
|
|
|
Integer endYear = workFocusEntity.getEndYear();
|
|
|
for(int i = startYear ; i <= endYear ; i++){
|
|
|
List<WorkFocusProgressEntity> list = new ArrayList<>();
|
|
|
-
|
|
|
- for(int j=1 ; j <=16 ; j++){
|
|
|
+ for(int j=1 ; j <=14 ; j++){
|
|
|
WorkFocusProgressEntity workFocusProgress = new WorkFocusProgressVO();
|
|
|
workFocusProgress.setYear(i);
|
|
|
workFocusProgress.setWorkFocusId(workFocusEntity.getId());
|
|
|
workFocusProgress.setMonth(j);
|
|
|
if(j==13){
|
|
|
- workFocusProgress.setSchedule("problemInfo");
|
|
|
- }
|
|
|
- if(j==14){
|
|
|
- workFocusProgress.setSchedule("workSug");
|
|
|
- }
|
|
|
- if(j==15){
|
|
|
workFocusProgress.setSchedule("unitInfo");
|
|
|
- }if(j==16){
|
|
|
+ }if(j==14){
|
|
|
workFocusProgress.setSchedule("linkInfo");
|
|
|
}
|
|
|
list.add(workFocusProgress);
|
|
@@ -235,8 +231,105 @@ public class WorkFocusController extends BladeController {
|
|
|
@ApiOperationSupport(order = 12)
|
|
|
@Operation(summary = "导入工作要点", description = "导出模板")
|
|
|
public R importUser(MultipartFile file, Integer isCovered) {
|
|
|
- WorkFocusImporter userImporter = new WorkFocusImporter(workfocusService, 1 == 1);
|
|
|
- ExcelUtil.save(file, userImporter, WorkFocusExcel.class);
|
|
|
+ List<WorkFocusExcel2> read = ExcelUtil.read(file, 0, 0, WorkFocusExcel2.class);
|
|
|
+
|
|
|
+ int moth = 0;
|
|
|
+ int year = 0;
|
|
|
+ Integer maxId = 1;
|
|
|
+ List<WorkFocusEntity> workFocus = new ArrayList<>();
|
|
|
+ List<WorkFocusProgressEntity> workFocusProgressEntities = new ArrayList<>();
|
|
|
+ WorkFocusListVO workFocusListVO = new WorkFocusListVO();
|
|
|
+ for (int i = 0; i < read.size(); i++) {
|
|
|
+ WorkFocusExcel2 readInfo = read.get(i);
|
|
|
+ String dataNo = readInfo.getDataNo();
|
|
|
+ if(dataNo.indexOf("、")>=0){
|
|
|
+ String node= dataNo.substring(0,dataNo.indexOf("、"));
|
|
|
+ if(node.equals("一")){
|
|
|
+ maxId=1;
|
|
|
+ }
|
|
|
+ if(node.equals("二")){
|
|
|
+ maxId=2;
|
|
|
+ }
|
|
|
+ if(node.equals("三")){
|
|
|
+ maxId=3;
|
|
|
+ }
|
|
|
+ if(node.equals("四")){
|
|
|
+ maxId=4;
|
|
|
+ }
|
|
|
+ if(node.equals("五")){
|
|
|
+ maxId=5;
|
|
|
+ }
|
|
|
+ if(node.equals("六")){
|
|
|
+ maxId=6;
|
|
|
+ }
|
|
|
+ if(node.equals("七")){
|
|
|
+ maxId=7;
|
|
|
+ }
|
|
|
+ if(node.equals("八")){
|
|
|
+ maxId=8;
|
|
|
+ }
|
|
|
+
|
|
|
+ }else {
|
|
|
+ if (i < 2) {
|
|
|
+ if (dataNo.indexOf("年") >= 0 && dataNo.indexOf("月") >= 0) {
|
|
|
+ String moth2 = dataNo.substring(dataNo.indexOf("年") + 1, dataNo.indexOf("月"));
|
|
|
+ moth = Func.toInt(moth2);
|
|
|
+ }
|
|
|
+ if (dataNo.indexOf("交通强市建设") >= 0 && dataNo.indexOf("月") >= 0) {
|
|
|
+ String year2 = dataNo.substring(dataNo.indexOf("交通强市建设") + 6, dataNo.indexOf("年"));
|
|
|
+ year = Func.toInt(year2);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+
|
|
|
+ WorkFocusEntity region = BeanUtil.copyProperties(readInfo, WorkFocusEntity.class);
|
|
|
+ WorkFocusProgressEntity workFocusProgress = BeanUtil.copyProperties(readInfo, WorkFocusProgressEntity.class);
|
|
|
+
|
|
|
+ workFocusProgress.setYear(year);
|
|
|
+ workFocusProgress.setMonth(moth);
|
|
|
+ region.setWorkFocusStage(maxId);
|
|
|
+ if(Func.isNotEmpty(readInfo.getStartYear())){
|
|
|
+ region.setStartYear(Func.toInt(readInfo.getStartYear()));
|
|
|
+ }
|
|
|
+ if(Func.isNotEmpty(readInfo.getEndYear())){
|
|
|
+ region.setEndYear(Func.toInt(readInfo.getEndYear()));
|
|
|
+ }
|
|
|
+ if(Func.isNotEmpty(readInfo.getEndYear()) && Func.isNotEmpty(readInfo.getEndYear())){
|
|
|
+
|
|
|
+ workfocusService.saveOrUpdate(region);
|
|
|
+ // 添加进度信息
|
|
|
+ Integer startYear = region.getStartYear();
|
|
|
+ Integer endYear = region.getEndYear();
|
|
|
+ for(int k = startYear ; k <= endYear ; k++){
|
|
|
+ List<WorkFocusProgressEntity> list = new ArrayList<>();
|
|
|
+
|
|
|
+ for(int j=1 ; j <=14 ; j++){
|
|
|
+ WorkFocusProgressEntity workFocusProgr = new WorkFocusProgressVO();
|
|
|
+ if(year==k && moth==j){
|
|
|
+ workFocusProgr = workFocusProgress;
|
|
|
+ }else{
|
|
|
+ workFocusProgr.setYear(k);
|
|
|
+ workFocusProgr.setMonth(j);
|
|
|
+ }
|
|
|
+ workFocusProgr.setWorkFocusId(region.getId());
|
|
|
+ if(j==13){
|
|
|
+ workFocusProgr.setSchedule("unitInfo");
|
|
|
+ if(k==year){
|
|
|
+ workFocusProgr.setProgress(workFocusProgress.getUnitInfo());
|
|
|
+ }
|
|
|
+ }if(j==14){
|
|
|
+ workFocusProgr.setSchedule("linkInfo");
|
|
|
+ if(k==year) {
|
|
|
+ workFocusProgr.setProgress(workFocusProgress.getLinkInfo());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list.add(workFocusProgr);
|
|
|
+ }
|
|
|
+ workFocusProgressService.saveOrUpdateBatch(list);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
|
|