Преглед на файлове

首页统计,定时任务

LIVE_YE преди 2 години
родител
ревизия
3b31001770

+ 13 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/fgw/FgwCommonController.java

@@ -114,7 +114,7 @@ public class FgwCommonController {
     }
 
     /**
-     * 首页统计
+     * 首页统计--项目和节点统计
      *
      * @return
      */
@@ -125,7 +125,18 @@ public class FgwCommonController {
     }
 
     /**
-     * 本周汇报进度
+     * 首页统计--责任单位超期
+     *
+     * @return
+     */
+    @PostMapping("/zrdwCqNum")
+    @PreAuthorize("@ss.hasPermi('fgw:common:zrdwCqNum')")
+    public AjaxResult zrdwCqNum() {
+        return fgwCommonService.zrdwCqNum();
+    }
+
+    /**
+     * 本月汇报进度
      *
      * @return
      */

+ 12 - 8
ruoyi-admin/src/main/java/com/ruoyi/web/controller/fgw/FgwJdapController.java

@@ -6,14 +6,7 @@ import javax.servlet.http.HttpServletResponse;
 import com.ruoyi.system.domain.vo.JdapVo;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -129,6 +122,17 @@ public class FgwJdapController extends BaseController
     }
 
 
+    /**
+     * 发改委_首页_催报
+     * idList 项目idlist
+     */
+    @PreAuthorize("@ss.hasPermi('fgw:sytj:sycb')")
+    @GetMapping("/sycb")
+    public AjaxResult sycb(@RequestParam("idList") List<Long> idList)
+    {
+        return fgwJdapService.sycb(idList);
+    }
+
     /**
      * 删除发改委_节点安排
      */

+ 45 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/FgwJdapServiceImpl.java

@@ -160,6 +160,8 @@ public class FgwJdapServiceImpl implements IFgwJdapService {
                 return AjaxResult.error("存在相同的月份数据,请检查后重新保存");
             }
         }
+        //获取当前年月
+        String time = DateUtils.getYearMonth()+"-01";
 
         for (FgwJdap fgwJdap : fgwJdapList) {
             //截取时间字符串
@@ -172,10 +174,13 @@ public class FgwJdapServiceImpl implements IFgwJdapService {
                 fgwJdaps.setMonth(t[1]);
                 fgwJdaps.setXmId(fgwJdap.getXmId());
                 List<FgwJdap> fgwJdapss = fgwJdapMapper.selectFgwJdapList(fgwJdaps);
-                if(fgwJdapss!=null && fgwJdapss              .size()>0){
+                if(fgwJdapss!=null && fgwJdapss.size()>0){
                     return AjaxResult.error("存在相同的月份数据,请检查后重新保存");
                 }
 
+                if(DateUtils.daysBetween(fgwJdap.getJdsj(),time)>0){
+                    fgwJdap.setSfwc("3");
+                }
                 fgwJdap.setYear(t[0]);
                 fgwJdap.setMonth(t[1]);
                 fgwJdap.setCreateTime(DateUtils.getNowDate());
@@ -428,4 +433,43 @@ public class FgwJdapServiceImpl implements IFgwJdapService {
 
         return AjaxResult.success("成功");
     }
+
+    @Override
+    public AjaxResult sycb(List<Long> idList) {
+        if(idList!=null && idList.size()>0){
+            //将消息推送给相关人员
+            List<SendSmsConfig> sendSmsConfigs = new ArrayList<>();
+            //查询所有项目
+            List<FgwXmsb> fgwXmsbList = fgwXmsbMapper.selectFgwXmsbByIdList(idList);
+            List<Long> userIdList = fgwXmsbList.stream().map(FgwXmsb::getUserId).collect(Collectors.toList());
+            List<SysUser> sysUsers = userMapper.selectUserByUserIdList(userIdList);
+            if (sysUsers != null) {
+                //发极光推送
+                String notificationTitle = "消息通知";
+                String msgTitle = "节点催办";
+                String msgContent = "您有一条节点催办信息,请及时处理!";
+                String jPushVO = "";
+                List<String> listS = sysUsers.stream().map(SysUser::getJgId).collect(Collectors.toList());
+                listS.removeAll(Collections.singleton(null));
+                if(listS!=null && listS.size()>0){
+                    String[]  registrationId = listS.toArray(new String[listS.size()]);
+                    JPushToolUtil.sendToRegistrationId(notificationTitle,msgTitle,msgContent,jPushVO,registrationId);
+                }
+
+                for (SysUser sysUser : sysUsers) {
+                    if (StringUtils.isNotEmpty(sysUser.getPhonenumber())) {
+                        SendSmsConfig sendSmsConfig = new SendSmsConfig();
+                        sendSmsConfig.setPhone(sysUser.getPhonenumber());
+                        sendSmsConfigs.add(sendSmsConfig);
+                    }
+                }
+                if (sendSmsConfigs.size() > 0) {
+                    //TOdo 模板
+                    //AsyncManager.me().execute(AsyncFactory.sendSms(sendSmsConfigs, "SMS_272470945"));
+                }
+            }
+        }
+
+        return AjaxResult.success("成功");
+    }
 }

+ 3 - 1
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java

@@ -126,5 +126,7 @@ public interface SysUserMapper
     public SysUser checkEmailUnique(String email);
     public List<SysUser> selectUserByDeptId(Long deptId);
 
-    List<SysUser> selectUserByDeptIdList(List<Long> deptIdList);
+    List<SysUser> selectUserByDeptIdList(@Param("deptIdList") List<Long> deptIdList);
+
+    List<SysUser> selectUserByUserIdList(@Param("userIdList")List<Long> userIdList);
 }

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/fgw/FgwJdapMapper.java

@@ -65,4 +65,6 @@ public interface FgwJdapMapper
     List<FgwJdap> selectFgwJdapNum(Long yjts);
 
     List<FgwJdap> selectFgwJdapCqxmNum();
+
+    List<FgwJdap> selectFgwJdapListByIdList(@Param("jdapIdList")List<Long> jdapIdList);
 }

+ 3 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/fgw/FgwXmsbMapper.java

@@ -1,6 +1,7 @@
 package com.ruoyi.system.mapper.fgw;
 
 import com.ruoyi.system.domain.fgw.FgwXmsb;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -71,4 +72,6 @@ public interface FgwXmsbMapper
     List<FgwXmsb> ldpsList(FgwXmsb fgwXmsb);
 
     List<FgwXmsb> selectFgwXmsbListAll(FgwXmsb fgwXmsb);
+
+    List<FgwXmsb> selectFgwXmsbByIdList(@Param("idList") List<Long> idList);
 }

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/fgw/IFgwCommonService.java

@@ -18,4 +18,6 @@ public interface IFgwCommonService {
     AjaxResult hbjd();
 
     AjaxResult sbAndJdNum();
+
+    AjaxResult zrdwCqNum();
 }

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/fgw/IFgwJdapService.java

@@ -67,4 +67,6 @@ public interface IFgwJdapService
     AjaxResult cb(Long id);
 
     AjaxResult fjcb(Long id, String time, String name);
+
+    AjaxResult sycb(List<Long> idList);
 }

+ 87 - 35
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/fgw/FgwCommonServiceImpl.java

@@ -7,10 +7,7 @@ import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.fgw.*;
 import com.ruoyi.system.domain.projectV2.ZsyzSbbzb;
-import com.ruoyi.system.mapper.fgw.FgwDbdMapper;
-import com.ruoyi.system.mapper.fgw.FgwJdapMapper;
-import com.ruoyi.system.mapper.fgw.FgwXmsbMapper;
-import com.ruoyi.system.mapper.fgw.FgwYjpzMapper;
+import com.ruoyi.system.mapper.fgw.*;
 import com.ruoyi.system.service.fgw.IFgwCommonService;
 import com.ruoyi.system.service.fgw.IFgwJzqkService;
 import com.ruoyi.system.service.fgw.IFgwXmsbService;
@@ -52,6 +49,9 @@ public class FgwCommonServiceImpl implements IFgwCommonService {
     @Autowired
     private FgwJdapMapper fgwJdapMapper;
 
+    @Autowired
+    private FgwJdapDwMapper fgwJdapDwMapper;
+
     /**
      * 首页统计
      *
@@ -97,7 +97,7 @@ public class FgwCommonServiceImpl implements IFgwCommonService {
             //领导批示
             int psxm = 0;
             for (FgwXmsb fgwXmsb : fgwXmsbs) {
-                if(StringUtils.isNotEmpty(fgwXmsb.getPsnr())){
+                if (StringUtils.isNotEmpty(fgwXmsb.getPsnr())) {
                     psxm++;
                 }
             }
@@ -106,13 +106,13 @@ public class FgwCommonServiceImpl implements IFgwCommonService {
         }
         //预警项目
         List<FgwDbd> fgwDbdList = fgwDbdMapper.selectFgwDbdYjxmNum();
-        if(fgwDbdList != null && fgwDbdList.size() > 0){
+        if (fgwDbdList != null && fgwDbdList.size() > 0) {
             map.put("yjxm", fgwDbdList.size());
         }
 
         //超期项目
         List<FgwDbd> fgwDbdListCq = fgwDbdMapper.selectFgwDbdCqxmNum();
-        if(fgwDbdListCq != null && fgwDbdListCq.size() > 0){
+        if (fgwDbdListCq != null && fgwDbdListCq.size() > 0) {
             map.put("cqxm", fgwDbdListCq.size());
         }
 
@@ -124,13 +124,12 @@ public class FgwCommonServiceImpl implements IFgwCommonService {
         }
 
 
-
-
         return AjaxResult.success(map);
     }
 
     /**
      * 项目整体概况
+     *
      * @return
      */
     @Override
@@ -145,7 +144,7 @@ public class FgwCommonServiceImpl implements IFgwCommonService {
         FgwXmsb xmsb = new FgwXmsb();
         xmsb.setType(TWO);
         List<FgwXmsb> fgwXmsbs = fgwXmsbService.selectFgwXmsbList(xmsb);
-        if (fgwXmsbs != null && fgwXmsbs.size() > 0){
+        if (fgwXmsbs != null && fgwXmsbs.size() > 0) {
             map.put("xmzs", fgwXmsbs.size());
             long xmztz = fgwXmsbs.stream().mapToLong(FgwXmsb::getXmztz).sum();
             long jstz = fgwXmsbs.stream().mapToLong(FgwXmsb::getNdjh).sum();
@@ -164,38 +163,44 @@ public class FgwCommonServiceImpl implements IFgwCommonService {
      */
     @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());
+        //获取当前月的开始时间
+        String startTime = DateUtils.getYearMonth()+"-01";
         FgwJzqk fgwJzqk = new FgwJzqk();
         Map<String, Object> params = new HashMap<>();
         params.put("beginTime", startTime);
-        params.put("endTime", DateUtils.getNowDate());
+        params.put("endTime", DateUtils.getTime());
         fgwJzqk.setParams(params);
         List<FgwJzqk> fgwJzqks = fgwJzqkService.selectFgwJzqkTj(fgwJzqk);
+        List<Long> xmmcList = fgwJzqks.stream().map(FgwJzqk::getXmId).collect(Collectors.toList());
         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());
-        }
+        map.put("whbId", null);
         //查询所有项目总数
         FgwXmsb fgwXmsb = new FgwXmsb();
         List<FgwXmsb> fgwXmsbs = fgwXmsbService.selectFgwXmsbListTj(fgwXmsb);
+        List<Long> xmidList = fgwXmsbs.stream().map(FgwXmsb::getId).collect(Collectors.toList());
+        if (fgwJzqks == null || fgwJzqks.size() <= 0) {
+            if (fgwXmsbs != null && fgwXmsbs.size() > 0) {
+                map.put("whb", fgwXmsbs.size());
+                map.put("whbId", xmidList);
+            }
+            return AjaxResult.success(map);
+        }
+        map.put("yhb", xmmcList.size());
+        List<Long> whbIdList = new ArrayList<>();
         if (fgwXmsbs != null && fgwXmsbs.size() > 0) {
-            Long yhb = (Long) map.get("yhb");
-            long whb = fgwXmsbs.size() - yhb;
+            int whb = 0;
+            for (FgwXmsb xmsb : fgwXmsbs) {
+                if(!xmsb.getProgress().equals("3")){
+                    if(!xmmcList.contains(xmsb.getId())){
+                        whb++;
+                        whbIdList.add(xmsb.getId());
+                    }
+                }
+            }
             map.put("whb", whb);
+            map.put("whbId", whbIdList);
         }
         return AjaxResult.success(map);
     }
@@ -208,7 +213,7 @@ public class FgwCommonServiceImpl implements IFgwCommonService {
 
         //查询配置时间
         FgwYjpz fgwYjpz = fgwYjpzMapper.selectFgwYjpzNew();
-        if(fgwYjpz==null){
+        if (fgwYjpz == null) {
             fgwYjpz = new FgwYjpz();
             fgwYjpz.setYzcqts(15L);
         }
@@ -234,7 +239,7 @@ public class FgwCommonServiceImpl implements IFgwCommonService {
         //查询所有项目
         FgwXmsb fgwXmsb = new FgwXmsb();
         List<FgwXmsb> fgwXmsbList = fgwXmsbMapper.selectFgwXmsbList(fgwXmsb);
-        if(fgwXmsbList!=null && fgwXmsbList.size()>0){
+        if (fgwXmsbList != null && fgwXmsbList.size() > 0) {
             map.put("xmzs", fgwXmsbList.size());
             Map<String, List<FgwXmsb>> fgwXmsbZcMap = fgwXmsbList.stream().collect(Collectors.groupingBy(FgwXmsb::getIsWt));
             map.put("zcxm", fgwXmsbZcMap.get("N").size());
@@ -243,7 +248,7 @@ public class FgwCommonServiceImpl implements IFgwCommonService {
         FgwJdap fgwJdap = new FgwJdap();
         fgwJdap.setShjg("1");
         List<FgwJdap> fgwJdapList = fgwJdapMapper.selectFgwJdapList(fgwJdap);
-        if(fgwJdapList!=null && fgwJdapList.size()>0){
+        if (fgwJdapList != null && fgwJdapList.size() > 0) {
             Set<Long> xmIdCqjdxmList = new HashSet<>();
             Set<Long> xmIdYzzhxmList = new HashSet<>();
             int zcjd = 0;
@@ -251,16 +256,16 @@ public class FgwCommonServiceImpl implements IFgwCommonService {
             int yzzhjd = 0;
             for (FgwJdap jdap : fgwJdapList) {
                 //判断时间相隔的天数
-                if(DateUtils.daysBetween(dataTime,jdap.getJdsj())>0 && !"3".equals(jdap.getSfwc())){
+                if (DateUtils.daysBetween(dataTime, jdap.getJdsj()) > 0 && !"3".equals(jdap.getSfwc())) {
                     xmIdCqjdxmList.add(jdap.getXmId());
                     cqjd++;
                 }
-                if(DateUtils.daysBetween(dataTime,jdap.getJdsj())>fgwYjpz.getYzcqts() && !"3".equals(jdap.getSfwc())){
+                if (DateUtils.daysBetween(dataTime, jdap.getJdsj()) > fgwYjpz.getYzcqts() && !"3".equals(jdap.getSfwc())) {
                     xmIdYzzhxmList.add(jdap.getXmId());
                     yzzhjd++;
                 }
 
-                if(!"2".equals(jdap.getSfwc())){
+                if (!"2".equals(jdap.getSfwc())) {
                     zcjd++;
                 }
             }
@@ -275,6 +280,53 @@ public class FgwCommonServiceImpl implements IFgwCommonService {
         return AjaxResult.success(map);
     }
 
+    @Override
+    public AjaxResult zrdwCqNum() {
+        List<Map<String, Object>> zMap = new ArrayList<>();
+
+        //获取当前时间
+        String time = DateUtils.getDate();
+
+        //获取所有的责任单位
+        FgwJdapDw fgwJdapDw = new FgwJdapDw();
+        fgwJdapDw.setDeptType("0");
+        List<FgwJdapDw> fgwJdapDwList = fgwJdapDwMapper.selectFgwJdapDwList(fgwJdapDw);
+        Map<String, List<FgwJdapDw>> fgwJdapDwMap = fgwJdapDwList.stream().collect(Collectors.groupingBy(FgwJdapDw::getDeptName));
+        List<Long> jdapIdList = fgwJdapDwList.stream().map(FgwJdapDw::getDeptId).collect(Collectors.toList());
+        //查找所有未完成的节点
+        List<FgwJdap> fgwJdapList = fgwJdapMapper.selectFgwJdapListByIdList(jdapIdList);
+
+        for (String key : fgwJdapDwMap.keySet()) {
+            List<FgwJdapDw> fgwJdapDws = fgwJdapDwMap.get(key);
+            List<Long> jdapIds = fgwJdapDws.stream().map(FgwJdapDw::getDeptId).collect(Collectors.toList());
+            boolean bl = false;
+            Map<String, Object> fMap = new HashMap<>();
+            fMap.put("name",key);
+            int cq = 0;
+            int yzzh = 0;
+            for (FgwJdap fgwJdap : fgwJdapList) {
+                if (jdapIds.contains(fgwJdap.getId())) {
+                    if (DateUtils.daysBetween(fgwJdap.getJdsj(), time) > 0) {
+                        cq++;
+                        bl = true;
+                    }
+                    if (DateUtils.daysBetween(fgwJdap.getJdsj(), time) > 15) {
+                        yzzh++;
+                        bl = true;
+                    }
+                }
+            }
+            if(bl){
+                fMap.put("jdzs",fgwJdapDws.size());
+                fMap.put("cqjd",cq);
+                fMap.put("yazhjd",yzzh);
+                zMap.add(fMap);
+            }
+        }
+
+        return AjaxResult.success(zMap);
+    }
+
 
     /**
      * 传入时间戳获取日期格式时间

+ 5 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/fgw/FgwXmsbServiceImpl.java

@@ -153,6 +153,7 @@ public class FgwXmsbServiceImpl implements IFgwXmsbService {
     }
 
     @Override
+    @DataScope(deptAlias = "d")
     public List<FgwXmsb> ldpsList(FgwXmsb fgwXmsb) {
         return fgwXmsbMapper.ldpsList(fgwXmsb);
     }
@@ -183,6 +184,10 @@ public class FgwXmsbServiceImpl implements IFgwXmsbService {
         //List<FgwDbd> fgwDbdList = fgwDbdMapper.selectFgwDbdYjxmNum();
         //查询预警配置时间
         FgwYjpz fgwYjpz = fgwYjpzMapper.selectFgwYjpzNew();
+        if(fgwYjpz==null){
+            fgwYjpz = new FgwYjpz();
+            fgwYjpz.setYzcqts(7L);
+        }
         List<FgwJdap> fgwJdapList = fgwJdapMapper.selectFgwJdapNum(fgwYjpz.getYjts());
 
         List<FgwXmsb> fgwXmsbList = new ArrayList<>();

+ 10 - 2
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -148,13 +148,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	<select id="selectUserByDeptIdList" resultMap="SysUserResult">
 		select user_name, phonenumber from sys_user where dept_id in
-		<foreach collection="array" item="deptId" open="(" separator="," close=")">
+		<foreach collection="deptIdList" item="deptId" open="(" separator="," close=")">
 			#{deptId}
 		</foreach>
 		and del_flag = '0'  and status = '0'
 	</select>
 
-	<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
+    <select id="selectUserByUserIdList" resultMap="SysUserResult">
+		select user_name, phonenumber from sys_user where user_id in
+		<foreach collection="userIdList" item="id" open="(" separator="," close=")">
+			#{id}
+		</foreach>
+		and del_flag = '0'  and status = '0'
+	</select>
+
+    <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
  		insert into sys_user(
  			<if test="userId != null and userId != 0">user_id,</if>
  			<if test="deptId != null and deptId != 0">dept_id,</if>

+ 8 - 0
ruoyi-system/src/main/resources/mapper/system/fgw/FgwJdapMapper.xml

@@ -89,6 +89,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         GROUP BY
             xm_id
     </select>
+    <select id="selectFgwJdapListByIdList" resultMap="FgwJdapResult">
+        <include refid="selectFgwJdapVo"/>
+        where shjg = '1' and sfwc != '3'
+        and id in
+        <foreach item="id" collection="jdapIdList" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
 
     <insert id="insertFgwJdap" parameterType="FgwJdap" useGeneratedKeys="true" keyProperty="id">
         insert into fgw_jdap

+ 7 - 0
ruoyi-system/src/main/resources/mapper/system/fgw/FgwXmsbMapper.xml

@@ -202,6 +202,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         ${params.dataScope}
     </select>
+    <select id="selectFgwXmsbByIdList" resultMap="FgwXmsbResult">
+        <include refid="selectFgwXmsbVo"/>
+        where id in
+        <foreach item="id" collection="idList" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
 
     <insert id="insertFgwXmsb" parameterType="FgwXmsb" useGeneratedKeys="true" keyProperty="id">
         insert into fgw_xmsb