|
@@ -9,7 +9,9 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.aspose.cells.*;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.rongwei.bscommon.sys.dao.LuckysheetDao;
|
|
|
import com.rongwei.bscommon.sys.feign.LuckySheetService;
|
|
|
import com.rongwei.bscommon.sys.service.*;
|
|
@@ -19,11 +21,10 @@ import com.rongwei.bscommon.sys.utils.XlsSheetUtil;
|
|
|
import com.rongwei.bsentity.domain.*;
|
|
|
import com.rongwei.bscommon.sys.dao.ZhcxProjectManageDao;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.rongwei.bsentity.dto.RectifyDto;
|
|
|
-import com.rongwei.bsentity.dto.RectifyListDto;
|
|
|
-import com.rongwei.bsentity.dto.RectifyMachineDto;
|
|
|
-import com.rongwei.bsentity.dto.RectifyReportDto;
|
|
|
+import com.rongwei.bsentity.dto.*;
|
|
|
import com.rongwei.bsentity.dto.project.*;
|
|
|
+import com.rongwei.bsentity.vo.RectifySnapTotalVo;
|
|
|
+import com.rongwei.bsentity.vo.RectifySnapVo;
|
|
|
import com.rongwei.bsentity.vo.ZhcxProjectRectifyMachineVo;
|
|
|
import com.rongwei.bsentity.vo.ZhcxProjectRectifyVo;
|
|
|
import com.rongwei.rwcommon.base.R;
|
|
@@ -34,12 +35,9 @@ import com.rongwei.rwcommoncomponent.excel.aspose.ExcelUtils;
|
|
|
import com.rongwei.rwcommoncomponent.file.dto.SysFileItemParamDto;
|
|
|
import com.rongwei.rwcommoncomponent.file.service.SysFileItemService;
|
|
|
import com.rongwei.rwcommonentity.commonservers.domain.SysFileItemDo;
|
|
|
-import io.swagger.models.auth.In;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.beanutils.BeanUtils;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.cglib.beans.BeanCopier;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
import org.springframework.core.io.Resource;
|
|
@@ -47,7 +45,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.*;
|
|
|
-import java.lang.reflect.InvocationTargetException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -90,6 +89,8 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
|
|
|
private LuckySheetService luckySheetFeignService;
|
|
|
@Autowired
|
|
|
private ZhcxProjectManageRectifyBatchService projectManageRectifyBatchService;
|
|
|
+ @Autowired
|
|
|
+ private ZhcxProjectRectifySnapService zhcxProjectRectifySnapService;
|
|
|
|
|
|
|
|
|
private static final Color[] COLORS = {Color.fromArgb(255, 255, 204),
|
|
@@ -1839,4 +1840,103 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
|
|
|
rightBorder.setLineStyle(CellBorderType.THIN);
|
|
|
return style1;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R generateRectifyData() {
|
|
|
+ zhcxProjectManageDao.generateRectifyData();
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R searchRectifyData(Map<String, Object> map) {
|
|
|
+ Object projectIdObj = map.get("projectId");
|
|
|
+ Object machineNoObj = map.get("machineNo");
|
|
|
+// Object currentObj = map.get("current");
|
|
|
+// Object sizeObj = map.get("size");
|
|
|
+ if (ObjectUtil.isEmpty(projectIdObj) || ObjectUtil.isEmpty(machineNoObj)) {
|
|
|
+ return R.error();
|
|
|
+ }
|
|
|
+ String projectId = (String) projectIdObj;
|
|
|
+ String machineNo = (String) machineNoObj;
|
|
|
+// int current = (Integer) currentObj;
|
|
|
+// int size = (Integer) sizeObj;
|
|
|
+ //Page<ZhcxProjectRectifySnapDo> page = new Page<>(current, size);
|
|
|
+ LambdaQueryWrapper<ZhcxProjectRectifySnapDo> eq = Wrappers.<ZhcxProjectRectifySnapDo>lambdaQuery()
|
|
|
+ .eq(ZhcxProjectRectifySnapDo::getProjectid, projectId)
|
|
|
+ .eq(ZhcxProjectRectifySnapDo::getMachineno, machineNo)
|
|
|
+ .eq(ZhcxProjectRectifySnapDo::getDeleted, "0")
|
|
|
+ .between(ZhcxProjectRectifySnapDo::getDate, LocalDateTime.now().minusDays(30), LocalDateTime.now());
|
|
|
+ //IPage<ZhcxProjectRectifySnapDo> pageData = zhcxProjectRectifySnapService.page(page, eq);
|
|
|
+// List<ZhcxProjectRectifySnapDo> list = pageData.getRecords();
|
|
|
+// Long total = pageData.getTotal(); // 总记录数
|
|
|
+// Long pages = pageData.getPages(); // 总页数
|
|
|
+ //zhcxProjectManageDao.searchRectifyData();
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
|
|
|
+ List<ZhcxProjectRectifySnapDo> list = zhcxProjectRectifySnapService.list(eq);
|
|
|
+ Map<String, List<ZhcxProjectRectifySnapDo>> collect = list.stream()
|
|
|
+ .filter(e -> Objects.nonNull(e.getFirstorgid()))
|
|
|
+ .collect(Collectors.groupingBy(ZhcxProjectRectifySnapDo:: getFirstorgid));
|
|
|
+ RectifySnapDto rectifySnapDto = new RectifySnapDto();
|
|
|
+ Set<String> dateList = new HashSet<>();
|
|
|
+ List<RectifySnapVo> rectifySnapVos = new ArrayList<>();
|
|
|
+ collect.forEach((k, v) -> {
|
|
|
+ RectifySnapVo rectifySnapVo = new RectifySnapVo();
|
|
|
+ List<ZhcxProjectRectifySnapDo> data = new ArrayList<>();
|
|
|
+ rectifySnapVo.setFirstdeptname(v.get(0).getFirstorgname());
|
|
|
+ Map<String, List<ZhcxProjectRectifySnapDo>> collect2 = v.stream()
|
|
|
+ .filter(e -> Objects.nonNull(e.getDate()))
|
|
|
+ .collect(Collectors.groupingBy(e -> dateFormat.format(e.getDate())));
|
|
|
+ collect2.forEach((k2, v2) -> {
|
|
|
+ dateList.add(k2);
|
|
|
+ data.addAll(v2);
|
|
|
+ });
|
|
|
+ rectifySnapVo.setData(data);
|
|
|
+ rectifySnapVos.add(rectifySnapVo);
|
|
|
+ });
|
|
|
+// Map<String, List<ZhcxProjectRectifySnapDo>> collect = list.stream()
|
|
|
+// .filter(e -> Objects.nonNull(e.getDate()))
|
|
|
+// .collect(Collectors.groupingBy(e -> dateFormat.format(e.getDate())));
|
|
|
+// collect.forEach((k, v) -> {
|
|
|
+//
|
|
|
+// dateList.add(k);
|
|
|
+// Map<String, List<ZhcxProjectRectifySnapDo>> collect2 = v.stream()
|
|
|
+// .filter(e -> Objects.nonNull(e.getFirstorgid()))
|
|
|
+// .collect(Collectors.groupingBy(ZhcxProjectRectifySnapDo:: getFirstorgid));
|
|
|
+// collect2.forEach((k2, v2) -> {
|
|
|
+// RectifySnapVo rectifySnapVo = new RectifySnapVo();
|
|
|
+// rectifySnapVo.setFirstdeptname(v2.get(0).getFirstorgname());
|
|
|
+// rectifySnapVo.setData(v2);
|
|
|
+// rectifySnapVos.add(rectifySnapVo);
|
|
|
+// });
|
|
|
+//
|
|
|
+// });
|
|
|
+ List<String> sortedDateList = dateList.stream()
|
|
|
+ .map(date -> {
|
|
|
+ try {
|
|
|
+ return dateFormat.parse(date);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .sorted(Collections.reverseOrder())
|
|
|
+ .map(dateFormat::format)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ rectifySnapVos.forEach(snapVo -> {
|
|
|
+ List<ZhcxProjectRectifySnapDo> dataList = snapVo.getData();
|
|
|
+ if (dataList != null) {
|
|
|
+ // 按 date 字段倒序排序
|
|
|
+ dataList.sort(Comparator.comparing(ZhcxProjectRectifySnapDo::getDate, Comparator.nullsLast(Comparator.reverseOrder())));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ rectifySnapDto.setDateList(sortedDateList);
|
|
|
+ rectifySnapDto.setData(rectifySnapVos);
|
|
|
+// rectifySnapDto.setTotal(total.intValue());
|
|
|
+// rectifySnapDto.setPage(pages.intValue());
|
|
|
+ return R.ok(rectifySnapDto);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void deleteSnap() {
|
|
|
+ zhcxProjectManageDao.deleteSnap();
|
|
|
+ }
|
|
|
}
|