update code
parent
3e85b7e7b3
commit
a0a16fa72d
|
@ -9,7 +9,7 @@ ruoyi:
|
||||||
# 实例演示开关
|
# 实例演示开关
|
||||||
demoEnabled: true
|
demoEnabled: true
|
||||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||||
profile: D:/data/uploadPath
|
profile: /data/uploadPath
|
||||||
# 获取ip地址开关
|
# 获取ip地址开关
|
||||||
addressEnabled: false
|
addressEnabled: false
|
||||||
# 验证码类型 math 数字计算 char 字符验证
|
# 验证码类型 math 数字计算 char 字符验证
|
||||||
|
|
|
@ -8,7 +8,10 @@ import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -188,4 +191,30 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
|
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
|
||||||
return Date.from(zdt.toInstant());
|
return Date.from(zdt.toInstant());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Date[] getCurrentWeekDate() {
|
||||||
|
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());
|
||||||
|
Date dtStart=calendar.getTime();
|
||||||
|
|
||||||
|
//end of the week
|
||||||
|
calendar.add(Calendar.DAY_OF_WEEK, 6);
|
||||||
|
calendar.set(Calendar.HOUR_OF_DAY, 23);
|
||||||
|
calendar.set(Calendar.MINUTE, 59);
|
||||||
|
calendar.set(Calendar.SECOND, 59);
|
||||||
|
calendar.set(Calendar.MILLISECOND, 999);
|
||||||
|
//String endTime = conversion(calendar.getTimeInMillis());
|
||||||
|
Date dtEnd=calendar.getTime();
|
||||||
|
return new Date[]{dtStart,dtEnd};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,21 @@
|
||||||
package com.yanzhu.jh.bigscreen.web.controller;
|
package com.yanzhu.jh.bigscreen.web.controller;
|
||||||
|
|
||||||
|
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.redis.RedisCache;
|
import com.ruoyi.common.core.redis.RedisCache;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.yanzhu.jh.trouble.domain.SmzSspProblemmodify;
|
import com.yanzhu.jh.trouble.domain.SmzSspProblemmodify;
|
||||||
|
import com.yanzhu.jh.trouble.domain.where.SmzSspProblemmodifyWhere;
|
||||||
import com.yanzhu.jh.trouble.service.ISmzSspProblemmodifyService;
|
import com.yanzhu.jh.trouble.service.ISmzSspProblemmodifyService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -106,4 +111,48 @@ public class ProblemmodifyController extends BaseController {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/countByDate")
|
||||||
|
public AjaxResult countByDate(@RequestBody SmzSspProblemmodifyWhere where){
|
||||||
|
List<SmzSspProblemmodify> list=smzSspProblemmodifyService.countByDate(where);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/countByDateRange")
|
||||||
|
public AjaxResult countByDateRange(@RequestBody SmzSspProblemmodifyWhere where){
|
||||||
|
List<SmzSspProblemmodify> list=smzSspProblemmodifyService.countByDateRange(where);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
@GetMapping("/groupByInfotypeCheckState")
|
||||||
|
public AjaxResult groupByInfotypeCheckState(@RequestBody SmzSspProblemmodifyWhere where){
|
||||||
|
List<SmzSspProblemmodify> list=smzSspProblemmodifyService.groupByInfotypeCheckState(where);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目监测预警查询,用于大屏项目概况
|
||||||
|
* @param deptId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getMonitAndWarning")
|
||||||
|
public AjaxResult getMonitAndWarning(long deptId,long projectId){
|
||||||
|
String key="problemmodify_getMonitAndWarning-"+deptId+"_"+projectId;
|
||||||
|
Object obj=redisCache.getCacheObject(key);
|
||||||
|
if(obj!=null){
|
||||||
|
return AjaxResult.success(obj);
|
||||||
|
}
|
||||||
|
SmzSspProblemmodifyWhere where=new SmzSspProblemmodifyWhere();
|
||||||
|
where.setDeptId(deptId);
|
||||||
|
where.setProjectId(projectId);
|
||||||
|
where.setStartDate(new Date());
|
||||||
|
Map<String, List<SmzSspProblemmodify>> map=new HashMap<>();
|
||||||
|
map.put("today",smzSspProblemmodifyService.countByDate(where));
|
||||||
|
Date[] dts=DateUtils.getCurrentWeekDate();
|
||||||
|
where.setStartDate(dts[0]);
|
||||||
|
where.setEndDate(dts[1]);
|
||||||
|
map.put("week",smzSspProblemmodifyService.countByDateRange(where));
|
||||||
|
map.put("group",smzSspProblemmodifyService.groupByInfotypeCheckState(where));
|
||||||
|
redisCache.setCacheObject(key, map, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.MINUTES);
|
||||||
|
return AjaxResult.success(map);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.yanzhu.jh.trouble.domain.where;
|
||||||
|
|
||||||
|
import com.yanzhu.jh.trouble.domain.SmzSspProblemmodify;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class SmzSspProblemmodifyWhere extends SmzSspProblemmodify {
|
||||||
|
public Date getStartDate() {
|
||||||
|
return startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartDate(Date startDate) {
|
||||||
|
this.startDate = startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getEndDate() {
|
||||||
|
return endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndDate(Date endDate) {
|
||||||
|
this.endDate = endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Date startDate;
|
||||||
|
private Date endDate;
|
||||||
|
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
public Long getDeptId() {
|
||||||
|
return deptId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeptId(Long deptId) {
|
||||||
|
this.deptId = deptId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package com.yanzhu.jh.trouble.mapper;
|
package com.yanzhu.jh.trouble.mapper;
|
||||||
|
|
||||||
import com.yanzhu.jh.trouble.domain.SmzSspProblemmodify;
|
import com.yanzhu.jh.trouble.domain.SmzSspProblemmodify;
|
||||||
|
import com.yanzhu.jh.trouble.domain.where.SmzSspProblemmodifyWhere;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -60,7 +61,33 @@ public interface SmzSspProblemmodifyMapper
|
||||||
*/
|
*/
|
||||||
public int deleteSmzSspProblemmodifyByIds(Long[] ids);
|
public int deleteSmzSspProblemmodifyByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按安全类型分组查询
|
||||||
|
* @param smzSspProblemmodify
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public List<SmzSspProblemmodify> selectSummary(SmzSspProblemmodify smzSspProblemmodify);
|
public List<SmzSspProblemmodify> selectSummary(SmzSspProblemmodify smzSspProblemmodify);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按项目分组统计
|
||||||
|
* @param smzSspProblemmodify
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public List<SmzSspProblemmodify> selectSummaryByProject(SmzSspProblemmodify smzSspProblemmodify);
|
public List<SmzSspProblemmodify> selectSummaryByProject(SmzSspProblemmodify smzSspProblemmodify);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询某天预警数
|
||||||
|
* @param where startDate 查询的日期
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<SmzSspProblemmodify> countByDate(SmzSspProblemmodifyWhere where);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询两个日期之间的预警数
|
||||||
|
* @param where startDate 开始日期 endDate 结束日期
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<SmzSspProblemmodify> countByDateRange(SmzSspProblemmodifyWhere where);
|
||||||
|
|
||||||
|
public List<SmzSspProblemmodify> groupByInfotypeCheckState(SmzSspProblemmodifyWhere where);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.yanzhu.jh.trouble.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.yanzhu.jh.trouble.domain.SmzSspProblemmodify;
|
import com.yanzhu.jh.trouble.domain.SmzSspProblemmodify;
|
||||||
|
import com.yanzhu.jh.trouble.domain.where.SmzSspProblemmodifyWhere;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 质量整改Service接口
|
* 质量整改Service接口
|
||||||
|
@ -76,4 +77,10 @@ public interface ISmzSspProblemmodifyService
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<SmzSspProblemmodify> selectSummaryByProject(int deptId, int roleType, int infoType);
|
public List<SmzSspProblemmodify> selectSummaryByProject(int deptId, int roleType, int infoType);
|
||||||
|
|
||||||
|
public List<SmzSspProblemmodify> countByDate(SmzSspProblemmodifyWhere where);
|
||||||
|
|
||||||
|
public List<SmzSspProblemmodify> countByDateRange(SmzSspProblemmodifyWhere where);
|
||||||
|
|
||||||
|
public List<SmzSspProblemmodify> groupByInfotypeCheckState(SmzSspProblemmodifyWhere where);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.yanzhu.jh.trouble.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.yanzhu.jh.trouble.domain.where.SmzSspProblemmodifyWhere;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.yanzhu.jh.trouble.mapper.SmzSspProblemmodifyMapper;
|
import com.yanzhu.jh.trouble.mapper.SmzSspProblemmodifyMapper;
|
||||||
|
@ -111,4 +112,19 @@ public class SmzSspProblemmodifyServiceImpl implements ISmzSspProblemmodifyServi
|
||||||
smzSspProblemmodify.setId((long)deptId);
|
smzSspProblemmodify.setId((long)deptId);
|
||||||
return smzSspProblemmodifyMapper.selectSummaryByProject(smzSspProblemmodify);
|
return smzSspProblemmodifyMapper.selectSummaryByProject(smzSspProblemmodify);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SmzSspProblemmodify> countByDate(SmzSspProblemmodifyWhere where) {
|
||||||
|
return smzSspProblemmodifyMapper.countByDate(where);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SmzSspProblemmodify> countByDateRange(SmzSspProblemmodifyWhere where) {
|
||||||
|
return smzSspProblemmodifyMapper.countByDateRange(where);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SmzSspProblemmodify> groupByInfotypeCheckState(SmzSspProblemmodifyWhere where) {
|
||||||
|
return smzSspProblemmodifyMapper.groupByInfotypeCheckState(where);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,10 +205,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
) a
|
) a
|
||||||
LEFT JOIN ( SELECT danger_type,COUNT(1) cnt FROM smz_ssp_problemmodify WHERE projectId IN(
|
LEFT JOIN ( SELECT danger_type,COUNT(1) cnt FROM smz_ssp_problemmodify WHERE projectId IN(
|
||||||
SELECT id FROM sur_project
|
SELECT id FROM sur_project
|
||||||
<where>
|
where isDel=0
|
||||||
<if test="id >0 ">AND deptid = #{id}</if>
|
<if test="id >0 ">AND deptid = #{id}</if>
|
||||||
</where>
|
|
||||||
) AND infotype=#{infoType}
|
) AND infotype=#{infoType} and isDel=0
|
||||||
<if test="roleType > 0">AND roletype=#{roleType}</if>
|
<if test="roleType > 0">AND roletype=#{roleType}</if>
|
||||||
GROUP BY danger_type) b
|
GROUP BY danger_type) b
|
||||||
ON a.dict_value=b.danger_type ORDER BY cnt DESC,a.dict_value+0
|
ON a.dict_value=b.danger_type ORDER BY cnt DESC,a.dict_value+0
|
||||||
|
@ -217,20 +217,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
SELECT a.*,b.cnt roleType FROM (
|
SELECT a.*,b.cnt roleType FROM (
|
||||||
SELECT id,projectName problemArea FROM sur_project
|
SELECT id,projectName problemArea FROM sur_project
|
||||||
<where>
|
where isDel=0
|
||||||
<if test="id >0 ">AND deptid = #{id}</if>
|
<if test="id >0 ">AND deptid = #{id}</if>
|
||||||
</where>
|
|
||||||
) a LEFT JOIN (
|
) a LEFT JOIN (
|
||||||
|
|
||||||
SELECT projectId,COUNT(1) cnt FROM smz_ssp_problemmodify WHERE projectId IN(SELECT id FROM sur_project
|
SELECT projectId,COUNT(1) cnt FROM smz_ssp_problemmodify WHERE projectId IN(
|
||||||
<where>
|
SELECT id FROM sur_project where isDel=0
|
||||||
<if test="id >0 ">AND deptid = #{id}</if>
|
<if test="id >0 ">AND deptid = #{id}</if>
|
||||||
</where>
|
|
||||||
)
|
)
|
||||||
AND infotype=#{infoType}
|
AND infotype=#{infoType} and isDel=0
|
||||||
<if test="roleType > 0">AND roletype=#{roleType}</if>
|
<if test="roleType > 0">AND roletype=#{roleType}</if>
|
||||||
GROUP BY projectId ) b ON a.id=b.projectId ORDER BY cnt DESC,id LIMIT 0,10
|
GROUP BY projectId ) b ON a.id=b.projectId ORDER BY cnt DESC,id LIMIT 0,10
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="countByDate" parameterType="SmzSspProblemmodifyWhere" resultMap="SmzSspProblemmodifyResult">
|
||||||
|
SELECT infotype,COUNT(1) id FROM smz_ssp_problemmodify WHERE isDel=0
|
||||||
|
<if test="projectId > 0"> and projectId=#{projectId}</if>
|
||||||
|
<if test="projectId <= 0">
|
||||||
|
AND projectId IN (
|
||||||
|
SELECT id FROM sur_project WHERE isdel=0
|
||||||
|
<if test="deptId >0 ">AND deptid = #{id}</if>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
and DATE(createTime)=Date(#{startDate})
|
||||||
|
GROUP BY infotype
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="countByDateRange" parameterType="SmzSspProblemmodifyWhere" resultMap="SmzSspProblemmodifyResult">
|
||||||
|
SELECT infotype,COUNT(1) id FROM smz_ssp_problemmodify WHERE isDel=0
|
||||||
|
<if test="projectId > 0"> and projectId=#{projectId}</if>
|
||||||
|
<if test="projectId <= 0">
|
||||||
|
AND projectId IN (
|
||||||
|
SELECT id FROM sur_project WHERE isdel=0
|
||||||
|
<if test="deptId >0 ">AND deptid = #{id}</if>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<![CDATA[
|
||||||
|
and DATE(createTime)>=Date(#{startDate}) and Date(createTime)<=Date(#{endDate})
|
||||||
|
]]>
|
||||||
|
GROUP BY infotype
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="groupByInfotypeCheckState" parameterType="SmzSspProblemmodifyWhere" resultMap="SmzSspProblemmodifyResult">
|
||||||
|
SELECT infotype,checkState,COUNT(1) id FROM smz_ssp_problemmodify WHERE isDel=0
|
||||||
|
<if test="projectId > 0"> and projectId=#{projectId}</if>
|
||||||
|
<if test="projectId <= 0">
|
||||||
|
AND projectId IN (
|
||||||
|
SELECT id FROM sur_project WHERE isdel=0
|
||||||
|
<if test="deptId >0 ">AND deptid = #{deptId}</if>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
GROUP BY infotype,checkState
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue