0614bc3c 张雷

Merge remote-tracking branch 'origin/master' into master

2 个父辈 5ce6cd83 6a6c9f3e
package com.skua.modules.ajh.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.skua.core.aspect.annotation.Dict;
import com.skua.modules.guest.util.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* 领导带班检查记录
*/
@Data
@TableName("ajh_leader_inspection_record")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="ajh_leader_inspection_record对象", description="领导带班检查记录")
public class LeaderInspectionRecord {
/**id*/
@TableId(type = IdType.ID_WORKER_STR)
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "检查地点:机构树")
@Dict(dictTable = "sys_depart", dicCode="id", dicText = "depart_name")
private String departId;
/**检查类型:1 水务公司;1 项目经理部*/
@Excel(name = "检查类型:1 水务公司;1 项目经理部", width = 15)
@ApiModelProperty(value = "检查类型:1 水务公司;2项目经理部")
@Dict(dicCode ="ajh_inspection_type" )
private String inspectionType;
/**检查时间*/
@Excel(name = "检查时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "检查时间")
private Date inspectionTime;
/**项目地点*/
@Excel(name = "项目地点", width = 15)
@ApiModelProperty(value = "项目地点")
private String projectArea;
/**项目负责人*/
@Excel(name = "项目负责人", width = 15)
@ApiModelProperty(value = "项目负责人")
@Dict(dicCode = "id",dictTable="sys_user",dicText="realname")
private String projectLeaderId;
/**带班领导*/
@Excel(name = "带班领导", width = 15)
@ApiModelProperty(value = "带班领导")
@Dict(dicCode = "id",dictTable="sys_user",dicText="realname")
private String leaderId;
/**附件*/
@Excel(name = "附件", width = 15)
@ApiModelProperty(value = "附件")
private String filePath;
/**创建人id*/
@Excel(name = "创建人id", width = 15)
@ApiModelProperty(value = "创建人id")
private String createBy;
/**创建时间*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**修改人id*/
@Excel(name = "修改人id", width = 15)
@ApiModelProperty(value = "修改人id")
private String updateBy;
/**修改时间*/
@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date updateTime;
/**删除标识,0:有效,1:删除*/
@Excel(name = "删除标识,0:有效,1:删除", width = 15)
@ApiModelProperty(value = "删除标识,0:有效,1:删除")
private Integer delFlag;
/**备注*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
@TableField(exist=false)
@ApiModelProperty(value = "开始时间:yyyy-MM-dd")
private String startDate;
@TableField(exist=false)
@ApiModelProperty(value = "结束时间:yyyy-MM-dd")
private String endDate;
@ApiModelProperty(value = "部门集合")
private String departIds;
public String getStartDate() {
if(StringUtils.isEmpty(startDate)){
startDate = DateUtil.getCurrentYear()+"-01-01";
}
return startDate;
}
public String getEndDate() {
if(StringUtils.isEmpty(endDate)){
endDate = DateUtil.getCurrentYear()+"-12-31";
}
return endDate;
}
}
package com.skua.modules.ajh.mapper;
import com.skua.modules.ajh.entity.LeaderInspectionRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.skua.modules.ajh.vo.LeaderInspectionRecordStatisticsVO;
import com.skua.modules.ajh.vo.LeaderInspectionRecordVO;
import java.util.List;
/**
* 领导带班检查记录
*/
public interface LeaderInspectionRecordMapper extends BaseMapper<LeaderInspectionRecord> {
/**
* 统计数量
* @param leaderInspectionRecord
* @return
*/
List<LeaderInspectionRecordVO> statisticsNum(LeaderInspectionRecord leaderInspectionRecord);
/**
* 根据时间统计
* @param leaderInspectionRecord
* @return
*/
List<LeaderInspectionRecordStatisticsVO> statisticsByTime(LeaderInspectionRecord leaderInspectionRecord);
/***
* 根据带班领导统计
* @param leaderInspectionRecord
* @return
*/
List<LeaderInspectionRecordStatisticsVO> statisticsByLeader(LeaderInspectionRecord leaderInspectionRecord);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.skua.modules.ajh.mapper.LeaderInspectionRecordMapper">
<!--统计数量 -->
<select id="statisticsNum" resultType="com.skua.modules.ajh.vo.LeaderInspectionRecordVO">
SELECT
SUM(IF(`inspection_type`='1',inspection_type,0)) as 'swgsjcNum',
SUM(IF(`inspection_type`='2',inspection_type,0))/2 as 'xmbjcNum'
FROM ajh_leader_inspection_record
<where>
<if test="departIds != null and departIds != ''">
and depart_id in (${departIds})
</if>
<if test="inspectionType != null and inspectionType != ''">
and inspection_type #{inspectionType}
</if>
<if test="projectLeaderId != null and projectLeaderId != ''">
and project_leader_id = #{projectLeaderId}
</if>
<if test="leaderId != null and leaderId != ''">
and leader_id = #{leaderId}
</if>
<if test="startDate != null and startDate != ''">
and DATE_FORMAT( inspection_time, '%Y-%m-%d' ) &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and DATE_FORMAT( inspection_time, '%Y-%m-%d' ) &lt;= #{endDate}
</if>
</where>
</select>
<!--根据时间统计 -->
<select id="statisticsByTime" resultType="com.skua.modules.ajh.vo.LeaderInspectionRecordStatisticsVO">
SELECT
DATE_FORMAT( inspection_time, '%Y%m' ) time,
SUM(IF(`inspection_type`='1',inspection_type,0)) as 'swgsjcNum',
SUM(IF(`inspection_type`='2',inspection_type,0))/2 as 'xmbjcNum'
FROM ajh_leader_inspection_record
<where>
<if test="departIds != null and departIds != ''">
and depart_id in (${departIds})
</if>
<if test="inspectionType != null and inspectionType != ''">
and inspection_type #{inspectionType}
</if>
<if test="projectLeaderId != null and projectLeaderId != ''">
and project_leader_id = #{projectLeaderId}
</if>
<if test="leaderId != null and leaderId != ''">
and leader_id = #{leaderId}
</if>
<if test="startDate != null and startDate != ''">
and DATE_FORMAT( inspection_time, '%Y-%m-%d' ) &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and DATE_FORMAT( inspection_time, '%Y-%m-%d' ) &lt;= #{endDate}
</if>
</where>
group by
DATE_FORMAT( inspection_time, '%Y%m' )
</select>
<!--根据带班领导统计 -->
<select id="statisticsByLeader" resultType="com.skua.modules.ajh.vo.LeaderInspectionRecordStatisticsVO">
select u.realname leaderName , aaa.* from (
SELECT leader_id,
SUM(IF(`inspection_type`='1',inspection_type,0)) as 'swgsjcNum',
SUM(IF(`inspection_type`='2',inspection_type,0))/2 as 'xmbjcNum'
FROM ajh_leader_inspection_record
<where>
<if test="departIds != null and departIds != ''">
and depart_id in (${departIds})
</if>
<if test="inspectionType != null and inspectionType != ''">
and inspection_type #{inspectionType}
</if>
<if test="projectLeaderId != null and projectLeaderId != ''">
and project_leader_id = #{projectLeaderId}
</if>
<if test="leaderId != null and leaderId != ''">
and leader_id = #{leaderId}
</if>
<if test="startDate != null and startDate != ''">
and DATE_FORMAT( inspection_time, '%Y-%m-%d' ) &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and DATE_FORMAT( inspection_time, '%Y-%m-%d' ) &lt;= #{endDate}
</if>
</where>
GROUP BY leader_id
)aaa
left join sys_user u on u.id = aaa.leader_id
</select>
</mapper>
package com.skua.modules.ajh.service;
import com.skua.modules.ajh.entity.LeaderInspectionRecord;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.ajh.vo.LeaderInspectionRecordStatisticsVO;
import com.skua.modules.ajh.vo.LeaderInspectionRecordVO;
import java.util.List;
/**
* 领导带班检查记录
*/
public interface ILeaderInspectionRecordService extends IService<LeaderInspectionRecord> {
/**
* 统计数量
* @param leaderInspectionRecord
* @return
*/
LeaderInspectionRecordVO statisticsNum(LeaderInspectionRecord leaderInspectionRecord);
/**
* 根据时间统计
* @param leaderInspectionRecord
* @return
*/
List<LeaderInspectionRecordStatisticsVO> statisticsByTime(LeaderInspectionRecord leaderInspectionRecord);
/***
* 根据带班领导统计
* @param leaderInspectionRecord
* @return
*/
List<LeaderInspectionRecordStatisticsVO> statisticsByLeader(LeaderInspectionRecord leaderInspectionRecord);
}
package com.skua.modules.ajh.service.impl;
import com.skua.modules.ajh.entity.LeaderInspectionRecord;
import com.skua.modules.ajh.mapper.LeaderInspectionRecordMapper;
import com.skua.modules.ajh.service.ILeaderInspectionRecordService;
import com.skua.modules.ajh.vo.LeaderInspectionRecordStatisticsVO;
import com.skua.modules.ajh.vo.LeaderInspectionRecordVO;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.ArrayList;
import java.util.List;
/**
* 领导带班检查记录
*/
@Service
public class LeaderInspectionRecordServiceImpl extends ServiceImpl<LeaderInspectionRecordMapper, LeaderInspectionRecord> implements ILeaderInspectionRecordService {
/**
* 统计数量
* @param leaderInspectionRecord
* @return
*/
public LeaderInspectionRecordVO statisticsNum(LeaderInspectionRecord leaderInspectionRecord){
List<LeaderInspectionRecordVO> dataList = this.baseMapper.statisticsNum( leaderInspectionRecord) ;
if(dataList != null ){
return dataList.get(0);
}
return new LeaderInspectionRecordVO("0","0",new ArrayList<>(),new ArrayList<>());
}
/**
* 根据时间统计
* @param leaderInspectionRecord
* @return
*/
public List<LeaderInspectionRecordStatisticsVO> statisticsByTime(LeaderInspectionRecord leaderInspectionRecord){
return this.baseMapper.statisticsByTime( leaderInspectionRecord) ;
}
/***
* 根据带班领导统计
* @param leaderInspectionRecord
* @return
*/
public List<LeaderInspectionRecordStatisticsVO> statisticsByLeader(LeaderInspectionRecord leaderInspectionRecord){
return this.baseMapper.statisticsByLeader( leaderInspectionRecord) ;
}
}
package com.skua.modules.ajh.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 文件类型统计对象
*/
@Data
@ApiModel(value="带班领导检查对象", description="带班领导检查对象")
public class LeaderInspectionRecordStatisticsVO {
@ApiModelProperty(value = "时间")
private String time;
@ApiModelProperty(value = "领导编号")
private String leaderId;
@ApiModelProperty(value = "领导名称")
private String leaderName;
@ApiModelProperty(value = "水务公司检查数量")
private String swgsjcNum;
@ApiModelProperty(value = "项目部检查数量")
private String xmbjcNum;
public LeaderInspectionRecordStatisticsVO(){
}
public LeaderInspectionRecordStatisticsVO(String time, String swgsjcNum, String xmbjcNum) {
this.time = time;
this.swgsjcNum = swgsjcNum;
this.xmbjcNum = xmbjcNum;
}
}
package com.skua.modules.ajh.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 文件类型统计对象
*/
@Data
@ApiModel(value="带班领导检查返回对象", description="带班领导检查返回对象")
public class LeaderInspectionRecordVO {
@ApiModelProperty(value = "水务公司检查数量")
private String swgsjcNum;
@ApiModelProperty(value = "项目部检查数量")
private String xmbjcNum;
@ApiModelProperty(value = "时间统计集合")
private List<LeaderInspectionRecordStatisticsVO> timeDataList ;
@ApiModelProperty(value = "人员统计集合")
private List<LeaderInspectionRecordStatisticsVO> leaderDataList ;
public LeaderInspectionRecordVO(){
}
public LeaderInspectionRecordVO(String swgsjcNum, String xmbjcNum, List<LeaderInspectionRecordStatisticsVO> timeDataList, List<LeaderInspectionRecordStatisticsVO> leaderDataList) {
this.swgsjcNum = swgsjcNum;
this.xmbjcNum = xmbjcNum;
this.timeDataList = timeDataList;
this.leaderDataList = leaderDataList;
}
}
......@@ -343,6 +343,10 @@ public class DateUtil {
return formatDate(new Date(),null);
}
public static String getCurrentYear(){
return formatDate(new Date(),"YYYY");
}
/***
* 字符串日期格式化
* @param date
......@@ -380,7 +384,6 @@ public class DateUtil {
return date;
}
/**
* 格式化
* @param date
......@@ -398,6 +401,7 @@ public class DateUtil {
return sformat.format(_date);
}
/***
* 两个时间差
* @param date1
......
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.query.QueryGenerator;
import com.skua.core.util.DateUtils;
import com.skua.modules.erp.entity.ErpSettlement;
......@@ -16,6 +17,7 @@ import com.skua.modules.material.entity.MaterialInfoHandleRecord;
import com.skua.modules.material.entity.MaterialInformation;
import com.skua.modules.material.service.IMaterialInfoHandleRecordService;
import com.skua.modules.material.service.IMaterialInfoService;
import com.skua.modules.material.vo.MaterialInfoStatisticsVO;
import com.skua.modules.system.service.ISysDepartService;
import com.skua.tool.util.JSUtils;
import io.swagger.annotations.Api;
......@@ -29,6 +31,8 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
......@@ -424,6 +428,40 @@ public class MaterialInfoController {
return Result.ok("文件导入失败!");
}
@AutoLog(value = "安全态势总览-安全生成知识库")
@ApiOperation(value = "安全态势总览-安全生成知识库", notes = "安全态势总览-安全生成知识库")
@GetMapping(value = "/statistics")
public Result<List<MaterialInfoStatisticsVO>> statistics() {
Result<List<MaterialInfoStatisticsVO>> result = new Result<>();
/* if (StringUtils.isBlank(materialInfo.getDepartId())&&StringUtils.isNotBlank(BaseContextHandler.getDeparts())) {
materialInfo.setDepartId(departService.getChildDepartId(BaseContextHandler.getDeparts()));
}else{
materialInfo.setDepartId(departService.getChildDepartId(materialInfo.getDepartId()));
}*/
List<MaterialInfoStatisticsVO> resultList = new ArrayList<>();
List<MaterialInfoStatisticsVO> flfgDataList = getMaterialInfoStatisticsSql("法律法规","flfg","laws_type");
List<MaterialInfoStatisticsVO> bzgfDataList = getMaterialInfoStatisticsSql("标准规范","bzgf","standards_type");
List<MaterialInfoStatisticsVO> gzzdDataList = getMaterialInfoStatisticsSql("企业安环制度","gzzd","rules_type");
if(flfgDataList != null ) resultList.addAll(flfgDataList);
if(bzgfDataList != null ) resultList.addAll(bzgfDataList);
if(gzzdDataList != null ) resultList.addAll(gzzdDataList);
result.setSuccess(true);
result.setResult(resultList);
return result;
}
private List<MaterialInfoStatisticsVO> getMaterialInfoStatisticsSql(String fileTypeName,String fileType,String dictCode){
String sql = "select '"+fileTypeName+"' sonFileTypeName, bbb.item_text file_type_name, aaa.* from ( ";
sql += " SELECT SUBSTRING_INDEX("+dictCode+", ',', 1) AS file_type, COUNT(*) AS count FROM material_info where fac_informationtype = '"+fileType+"' GROUP BY file_type ";
sql += ")aaa";
sql+=" left join ( ";
sql += "SELECT item_text, item_value FROM sys_dict_item WHERE dict_id = ( SELECT id FROM sys_dict WHERE dict_code = '"+dictCode+"')";
sql += ")bbb on bbb.item_value = aaa.file_type ";
JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
List<MaterialInfoStatisticsVO> dataList = masterDB.query(sql,new BeanPropertyRowMapper<MaterialInfoStatisticsVO>(MaterialInfoStatisticsVO.class));
return dataList;
}
/**
* 类型统计查询
......
......@@ -59,7 +59,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
map.put("count",count);
tList.add(map);
}
}else if("flfg".equals(facInfo.getFacInformationtype())){
}else if("flfg".equals(facInfo.getFacInformationtype())){ //法律法规
dictCode = "laws_type";
List<Map<String, Object>> typeList = baseMapper.getAnalysis(dictCode);
for (Map<String, Object> map : typeList) {
......
package com.skua.modules.material.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 文件类型统计对象
*/
@Data
@ApiModel(value="文件类型统计对象", description="文件类型统计对象")
public class MaterialInfoStatisticsVO {
@ApiModelProperty(value = "文件名类型名称")
private String fileTypeName;
@ApiModelProperty(value = "二级子类名称")
private String sonFileTypeName;
@ApiModelProperty(value = "二级子类")
private String fileType;
@ApiModelProperty(value = "文件数量")
private Integer count;
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!