|
@@ -0,0 +1,126 @@
|
|
|
+package com.ruoyi.system.service.impl.fgw;
|
|
|
+
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.utils.DateUtils;
|
|
|
+import com.ruoyi.system.domain.fgw.FgwJzqk;
|
|
|
+import com.ruoyi.system.domain.fgw.FgwXmsb;
|
|
|
+import com.ruoyi.system.domain.projectV2.ZsyzSbbzb;
|
|
|
+import com.ruoyi.system.service.fgw.IFgwCommonService;
|
|
|
+import com.ruoyi.system.service.fgw.IFgwJzqkService;
|
|
|
+import com.ruoyi.system.service.fgw.IFgwXmsbService;
|
|
|
+import com.ruoyi.system.service.projectV2.IZsyzSbbzbService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import static com.ruoyi.common.constant.CommonConstants.THR;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Author: tjf
|
|
|
+ * @Date: 2023/3/23 15:34
|
|
|
+ * @Describe:
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class FgwCommonServiceImpl implements IFgwCommonService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFgwXmsbService fgwXmsbService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IZsyzSbbzbService zsyzSbbzbService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFgwJzqkService fgwJzqkService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 首页统计
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public AjaxResult index() {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+
|
|
|
+ FgwXmsb xmsb = new FgwXmsb();
|
|
|
+ List<FgwXmsb> fgwXmsbs = fgwXmsbService.selectFgwXmsbList(xmsb);
|
|
|
+ if (fgwXmsbs != null && fgwXmsbs.size() > 0) {
|
|
|
+ Map<String, List<FgwXmsb>> collect = fgwXmsbs.stream().collect(Collectors.groupingBy(FgwXmsb::getStatus));
|
|
|
+ if (collect != null && collect.size() > 0) {
|
|
|
+ List<FgwXmsb> fgwXmsbsWt = collect.get(THR);
|
|
|
+ if (fgwXmsbsWt != null && fgwXmsbsWt.size() > 0) {
|
|
|
+ map.put("wtxm", fgwXmsbsWt.size());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("zfxm", fgwXmsbs.size());
|
|
|
+ }
|
|
|
+ ZsyzSbbzb zsyzSbbzb = new ZsyzSbbzb();
|
|
|
+
|
|
|
+ List<ZsyzSbbzb> zsyzSbbzbs = zsyzSbbzbService.selectZsyzSbbzbList(zsyzSbbzb);
|
|
|
+ if (zsyzSbbzbs != null && zsyzSbbzbs.size() > 0) {
|
|
|
+ map.put("zsxm", zsyzSbbzbs.size());
|
|
|
+ }
|
|
|
+
|
|
|
+ return AjaxResult.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 本周汇报进度
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public AjaxResult hbjd() {
|
|
|
+ //获取当前周的开始时间
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTimeZone(TimeZone.getTimeZone("GMT+8"));
|
|
|
+ //start of the week
|
|
|
+ if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
|
|
|
+ calendar.add(Calendar.DAY_OF_YEAR, -1);
|
|
|
+ }
|
|
|
+ calendar.add(Calendar.DAY_OF_WEEK, -(calendar.get(Calendar.DAY_OF_WEEK) - 2));
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
|
+ String startTime = conversion(calendar.getTimeInMillis());
|
|
|
+ FgwJzqk fgwJzqk = new FgwJzqk();
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("beginTime", startTime);
|
|
|
+ params.put("endTime", DateUtils.getNowDate());
|
|
|
+ fgwJzqk.setParams(params);
|
|
|
+ List<FgwJzqk> fgwJzqks = fgwJzqkService.selectFgwJzqkTj(fgwJzqk);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("yhb", 0);
|
|
|
+ map.put("whb", 0);
|
|
|
+ if (fgwJzqks != null && fgwJzqks.size() > 0) {
|
|
|
+ map.put("yhb", fgwJzqks.size());
|
|
|
+ }
|
|
|
+ //查询所有项目总数
|
|
|
+ FgwXmsb fgwXmsb = new FgwXmsb();
|
|
|
+ List<FgwXmsb> fgwXmsbs = fgwXmsbService.selectFgwXmsbListTj(fgwXmsb);
|
|
|
+ if (fgwXmsbs != null && fgwXmsbs.size() > 0) {
|
|
|
+ Long yhb = (Long) map.get("yhb");
|
|
|
+ long whb = fgwXmsbs.size() - yhb;
|
|
|
+ map.put("whb", whb);
|
|
|
+ }
|
|
|
+ return AjaxResult.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 传入时间戳获取日期格式时间
|
|
|
+ *
|
|
|
+ * @param time
|
|
|
+ * @return String
|
|
|
+ * @author xyl
|
|
|
+ * @date 2023/1/4 13:24
|
|
|
+ */
|
|
|
+ public static String conversion(Long time) {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ return sdf.format(time);
|
|
|
+ }
|
|
|
+}
|