Merge remote-tracking branch 'origin/master' into master
正在显示
12 个修改的文件
包含
476 行增加
和
2 行删除
sk-module-biz/src/main/java/com/skua/modules/ajh/controller/LeaderInspectionRecordController.java
0 → 100644
此文件的差异被折叠,
点击展开。
1 | package com.skua.modules.ajh.entity; | ||
2 | |||
3 | import java.io.Serializable; | ||
4 | import java.util.Date; | ||
5 | import com.baomidou.mybatisplus.annotation.IdType; | ||
6 | import com.baomidou.mybatisplus.annotation.TableId; | ||
7 | import com.baomidou.mybatisplus.annotation.TableName; | ||
8 | import com.baomidou.mybatisplus.annotation.TableField; | ||
9 | import com.skua.core.aspect.annotation.Dict; | ||
10 | import com.skua.modules.guest.util.DateUtil; | ||
11 | import io.swagger.annotations.ApiModel; | ||
12 | import io.swagger.annotations.ApiModelProperty; | ||
13 | import lombok.Data; | ||
14 | import lombok.EqualsAndHashCode; | ||
15 | import lombok.experimental.Accessors; | ||
16 | import com.fasterxml.jackson.annotation.JsonFormat; | ||
17 | import org.apache.commons.lang3.StringUtils; | ||
18 | import org.springframework.format.annotation.DateTimeFormat; | ||
19 | import org.jeecgframework.poi.excel.annotation.Excel; | ||
20 | |||
21 | /** | ||
22 | * 领导带班检查记录 | ||
23 | */ | ||
24 | @Data | ||
25 | @TableName("ajh_leader_inspection_record") | ||
26 | @EqualsAndHashCode(callSuper = false) | ||
27 | @Accessors(chain = true) | ||
28 | @ApiModel(value="ajh_leader_inspection_record对象", description="领导带班检查记录") | ||
29 | public class LeaderInspectionRecord { | ||
30 | |||
31 | /**id*/ | ||
32 | @TableId(type = IdType.ID_WORKER_STR) | ||
33 | @ApiModelProperty(value = "id") | ||
34 | private String id; | ||
35 | @ApiModelProperty(value = "检查地点:机构树") | ||
36 | @Dict(dictTable = "sys_depart", dicCode="id", dicText = "depart_name") | ||
37 | private String departId; | ||
38 | /**检查类型:1 水务公司;1 项目经理部*/ | ||
39 | @Excel(name = "检查类型:1 水务公司;1 项目经理部", width = 15) | ||
40 | @ApiModelProperty(value = "检查类型:1 水务公司;2项目经理部") | ||
41 | @Dict(dicCode ="ajh_inspection_type" ) | ||
42 | private String inspectionType; | ||
43 | /**检查时间*/ | ||
44 | @Excel(name = "检查时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") | ||
45 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
46 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
47 | @ApiModelProperty(value = "检查时间") | ||
48 | private Date inspectionTime; | ||
49 | /**项目地点*/ | ||
50 | @Excel(name = "项目地点", width = 15) | ||
51 | @ApiModelProperty(value = "项目地点") | ||
52 | private String projectArea; | ||
53 | /**项目负责人*/ | ||
54 | @Excel(name = "项目负责人", width = 15) | ||
55 | @ApiModelProperty(value = "项目负责人") | ||
56 | @Dict(dicCode = "id",dictTable="sys_user",dicText="realname") | ||
57 | private String projectLeaderId; | ||
58 | /**带班领导*/ | ||
59 | @Excel(name = "带班领导", width = 15) | ||
60 | @ApiModelProperty(value = "带班领导") | ||
61 | @Dict(dicCode = "id",dictTable="sys_user",dicText="realname") | ||
62 | private String leaderId; | ||
63 | /**附件*/ | ||
64 | @Excel(name = "附件", width = 15) | ||
65 | @ApiModelProperty(value = "附件") | ||
66 | private String filePath; | ||
67 | /**创建人id*/ | ||
68 | @Excel(name = "创建人id", width = 15) | ||
69 | @ApiModelProperty(value = "创建人id") | ||
70 | private String createBy; | ||
71 | /**创建时间*/ | ||
72 | @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") | ||
73 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
74 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
75 | @ApiModelProperty(value = "创建时间") | ||
76 | private Date createTime; | ||
77 | /**修改人id*/ | ||
78 | @Excel(name = "修改人id", width = 15) | ||
79 | @ApiModelProperty(value = "修改人id") | ||
80 | private String updateBy; | ||
81 | /**修改时间*/ | ||
82 | @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") | ||
83 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
84 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
85 | @ApiModelProperty(value = "修改时间") | ||
86 | private Date updateTime; | ||
87 | /**删除标识,0:有效,1:删除*/ | ||
88 | @Excel(name = "删除标识,0:有效,1:删除", width = 15) | ||
89 | @ApiModelProperty(value = "删除标识,0:有效,1:删除") | ||
90 | private Integer delFlag; | ||
91 | /**备注*/ | ||
92 | @Excel(name = "备注", width = 15) | ||
93 | @ApiModelProperty(value = "备注") | ||
94 | private String remark; | ||
95 | |||
96 | @TableField(exist=false) | ||
97 | @ApiModelProperty(value = "开始时间:yyyy-MM-dd") | ||
98 | private String startDate; | ||
99 | |||
100 | @TableField(exist=false) | ||
101 | @ApiModelProperty(value = "结束时间:yyyy-MM-dd") | ||
102 | private String endDate; | ||
103 | |||
104 | @ApiModelProperty(value = "部门集合") | ||
105 | private String departIds; | ||
106 | |||
107 | public String getStartDate() { | ||
108 | if(StringUtils.isEmpty(startDate)){ | ||
109 | startDate = DateUtil.getCurrentYear()+"-01-01"; | ||
110 | } | ||
111 | return startDate; | ||
112 | } | ||
113 | |||
114 | public String getEndDate() { | ||
115 | if(StringUtils.isEmpty(endDate)){ | ||
116 | endDate = DateUtil.getCurrentYear()+"-12-31"; | ||
117 | } | ||
118 | return endDate; | ||
119 | } | ||
120 | } |
sk-module-biz/src/main/java/com/skua/modules/ajh/mapper/LeaderInspectionRecordMapper.java
0 → 100644
1 | package com.skua.modules.ajh.mapper; | ||
2 | |||
3 | import com.skua.modules.ajh.entity.LeaderInspectionRecord; | ||
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
5 | import com.skua.modules.ajh.vo.LeaderInspectionRecordStatisticsVO; | ||
6 | import com.skua.modules.ajh.vo.LeaderInspectionRecordVO; | ||
7 | |||
8 | import java.util.List; | ||
9 | |||
10 | /** | ||
11 | * 领导带班检查记录 | ||
12 | */ | ||
13 | public interface LeaderInspectionRecordMapper extends BaseMapper<LeaderInspectionRecord> { | ||
14 | /** | ||
15 | * 统计数量 | ||
16 | * @param leaderInspectionRecord | ||
17 | * @return | ||
18 | */ | ||
19 | List<LeaderInspectionRecordVO> statisticsNum(LeaderInspectionRecord leaderInspectionRecord); | ||
20 | /** | ||
21 | * 根据时间统计 | ||
22 | * @param leaderInspectionRecord | ||
23 | * @return | ||
24 | */ | ||
25 | List<LeaderInspectionRecordStatisticsVO> statisticsByTime(LeaderInspectionRecord leaderInspectionRecord); | ||
26 | |||
27 | /*** | ||
28 | * 根据带班领导统计 | ||
29 | * @param leaderInspectionRecord | ||
30 | * @return | ||
31 | */ | ||
32 | List<LeaderInspectionRecordStatisticsVO> statisticsByLeader(LeaderInspectionRecord leaderInspectionRecord); | ||
33 | } |
sk-module-biz/src/main/java/com/skua/modules/ajh/mapper/xml/LeaderInspectionRecordMapper.xml
0 → 100644
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | <mapper namespace="com.skua.modules.ajh.mapper.LeaderInspectionRecordMapper"> | ||
4 | |||
5 | <!--统计数量 --> | ||
6 | <select id="statisticsNum" resultType="com.skua.modules.ajh.vo.LeaderInspectionRecordVO"> | ||
7 | SELECT | ||
8 | SUM(IF(`inspection_type`='1',inspection_type,0)) as 'swgsjcNum', | ||
9 | SUM(IF(`inspection_type`='2',inspection_type,0))/2 as 'xmbjcNum' | ||
10 | FROM ajh_leader_inspection_record | ||
11 | <where> | ||
12 | <if test="departIds != null and departIds != ''"> | ||
13 | and depart_id in (${departIds}) | ||
14 | </if> | ||
15 | <if test="inspectionType != null and inspectionType != ''"> | ||
16 | and inspection_type #{inspectionType} | ||
17 | </if> | ||
18 | <if test="projectLeaderId != null and projectLeaderId != ''"> | ||
19 | and project_leader_id = #{projectLeaderId} | ||
20 | </if> | ||
21 | <if test="leaderId != null and leaderId != ''"> | ||
22 | and leader_id = #{leaderId} | ||
23 | </if> | ||
24 | <if test="startDate != null and startDate != ''"> | ||
25 | and DATE_FORMAT( inspection_time, '%Y-%m-%d' ) >= #{startDate} | ||
26 | </if> | ||
27 | <if test="endDate != null and endDate != ''"> | ||
28 | and DATE_FORMAT( inspection_time, '%Y-%m-%d' ) <= #{endDate} | ||
29 | </if> | ||
30 | |||
31 | </where> | ||
32 | |||
33 | </select> | ||
34 | |||
35 | <!--根据时间统计 --> | ||
36 | <select id="statisticsByTime" resultType="com.skua.modules.ajh.vo.LeaderInspectionRecordStatisticsVO"> | ||
37 | SELECT | ||
38 | DATE_FORMAT( inspection_time, '%Y%m' ) time, | ||
39 | SUM(IF(`inspection_type`='1',inspection_type,0)) as 'swgsjcNum', | ||
40 | SUM(IF(`inspection_type`='2',inspection_type,0))/2 as 'xmbjcNum' | ||
41 | FROM ajh_leader_inspection_record | ||
42 | <where> | ||
43 | <if test="departIds != null and departIds != ''"> | ||
44 | and depart_id in (${departIds}) | ||
45 | </if> | ||
46 | <if test="inspectionType != null and inspectionType != ''"> | ||
47 | and inspection_type #{inspectionType} | ||
48 | </if> | ||
49 | <if test="projectLeaderId != null and projectLeaderId != ''"> | ||
50 | and project_leader_id = #{projectLeaderId} | ||
51 | </if> | ||
52 | <if test="leaderId != null and leaderId != ''"> | ||
53 | and leader_id = #{leaderId} | ||
54 | </if> | ||
55 | <if test="startDate != null and startDate != ''"> | ||
56 | and DATE_FORMAT( inspection_time, '%Y-%m-%d' ) >= #{startDate} | ||
57 | </if> | ||
58 | <if test="endDate != null and endDate != ''"> | ||
59 | and DATE_FORMAT( inspection_time, '%Y-%m-%d' ) <= #{endDate} | ||
60 | </if> | ||
61 | |||
62 | </where> | ||
63 | group by | ||
64 | DATE_FORMAT( inspection_time, '%Y%m' ) | ||
65 | </select> | ||
66 | |||
67 | <!--根据带班领导统计 --> | ||
68 | <select id="statisticsByLeader" resultType="com.skua.modules.ajh.vo.LeaderInspectionRecordStatisticsVO"> | ||
69 | select u.realname leaderName , aaa.* from ( | ||
70 | SELECT leader_id, | ||
71 | SUM(IF(`inspection_type`='1',inspection_type,0)) as 'swgsjcNum', | ||
72 | SUM(IF(`inspection_type`='2',inspection_type,0))/2 as 'xmbjcNum' | ||
73 | FROM ajh_leader_inspection_record | ||
74 | <where> | ||
75 | <if test="departIds != null and departIds != ''"> | ||
76 | and depart_id in (${departIds}) | ||
77 | </if> | ||
78 | <if test="inspectionType != null and inspectionType != ''"> | ||
79 | and inspection_type #{inspectionType} | ||
80 | </if> | ||
81 | <if test="projectLeaderId != null and projectLeaderId != ''"> | ||
82 | and project_leader_id = #{projectLeaderId} | ||
83 | </if> | ||
84 | <if test="leaderId != null and leaderId != ''"> | ||
85 | and leader_id = #{leaderId} | ||
86 | </if> | ||
87 | <if test="startDate != null and startDate != ''"> | ||
88 | and DATE_FORMAT( inspection_time, '%Y-%m-%d' ) >= #{startDate} | ||
89 | </if> | ||
90 | <if test="endDate != null and endDate != ''"> | ||
91 | and DATE_FORMAT( inspection_time, '%Y-%m-%d' ) <= #{endDate} | ||
92 | </if> | ||
93 | |||
94 | </where> | ||
95 | GROUP BY leader_id | ||
96 | )aaa | ||
97 | left join sys_user u on u.id = aaa.leader_id | ||
98 | </select> | ||
99 | </mapper> |
sk-module-biz/src/main/java/com/skua/modules/ajh/service/ILeaderInspectionRecordService.java
0 → 100644
1 | package com.skua.modules.ajh.service; | ||
2 | |||
3 | import com.skua.modules.ajh.entity.LeaderInspectionRecord; | ||
4 | import com.baomidou.mybatisplus.extension.service.IService; | ||
5 | import com.skua.modules.ajh.vo.LeaderInspectionRecordStatisticsVO; | ||
6 | import com.skua.modules.ajh.vo.LeaderInspectionRecordVO; | ||
7 | |||
8 | import java.util.List; | ||
9 | |||
10 | /** | ||
11 | * 领导带班检查记录 | ||
12 | */ | ||
13 | public interface ILeaderInspectionRecordService extends IService<LeaderInspectionRecord> { | ||
14 | |||
15 | /** | ||
16 | * 统计数量 | ||
17 | * @param leaderInspectionRecord | ||
18 | * @return | ||
19 | */ | ||
20 | LeaderInspectionRecordVO statisticsNum(LeaderInspectionRecord leaderInspectionRecord); | ||
21 | /** | ||
22 | * 根据时间统计 | ||
23 | * @param leaderInspectionRecord | ||
24 | * @return | ||
25 | */ | ||
26 | List<LeaderInspectionRecordStatisticsVO> statisticsByTime(LeaderInspectionRecord leaderInspectionRecord); | ||
27 | |||
28 | /*** | ||
29 | * 根据带班领导统计 | ||
30 | * @param leaderInspectionRecord | ||
31 | * @return | ||
32 | */ | ||
33 | List<LeaderInspectionRecordStatisticsVO> statisticsByLeader(LeaderInspectionRecord leaderInspectionRecord); | ||
34 | } |
sk-module-biz/src/main/java/com/skua/modules/ajh/service/impl/LeaderInspectionRecordServiceImpl.java
0 → 100644
1 | package com.skua.modules.ajh.service.impl; | ||
2 | |||
3 | import com.skua.modules.ajh.entity.LeaderInspectionRecord; | ||
4 | import com.skua.modules.ajh.mapper.LeaderInspectionRecordMapper; | ||
5 | import com.skua.modules.ajh.service.ILeaderInspectionRecordService; | ||
6 | import com.skua.modules.ajh.vo.LeaderInspectionRecordStatisticsVO; | ||
7 | import com.skua.modules.ajh.vo.LeaderInspectionRecordVO; | ||
8 | import org.springframework.stereotype.Service; | ||
9 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
10 | |||
11 | import java.util.ArrayList; | ||
12 | import java.util.List; | ||
13 | |||
14 | /** | ||
15 | * 领导带班检查记录 | ||
16 | */ | ||
17 | @Service | ||
18 | public class LeaderInspectionRecordServiceImpl extends ServiceImpl<LeaderInspectionRecordMapper, LeaderInspectionRecord> implements ILeaderInspectionRecordService { | ||
19 | /** | ||
20 | * 统计数量 | ||
21 | * @param leaderInspectionRecord | ||
22 | * @return | ||
23 | */ | ||
24 | public LeaderInspectionRecordVO statisticsNum(LeaderInspectionRecord leaderInspectionRecord){ | ||
25 | List<LeaderInspectionRecordVO> dataList = this.baseMapper.statisticsNum( leaderInspectionRecord) ; | ||
26 | if(dataList != null ){ | ||
27 | return dataList.get(0); | ||
28 | } | ||
29 | return new LeaderInspectionRecordVO("0","0",new ArrayList<>(),new ArrayList<>()); | ||
30 | } | ||
31 | /** | ||
32 | * 根据时间统计 | ||
33 | * @param leaderInspectionRecord | ||
34 | * @return | ||
35 | */ | ||
36 | public List<LeaderInspectionRecordStatisticsVO> statisticsByTime(LeaderInspectionRecord leaderInspectionRecord){ | ||
37 | return this.baseMapper.statisticsByTime( leaderInspectionRecord) ; | ||
38 | } | ||
39 | |||
40 | /*** | ||
41 | * 根据带班领导统计 | ||
42 | * @param leaderInspectionRecord | ||
43 | * @return | ||
44 | */ | ||
45 | public List<LeaderInspectionRecordStatisticsVO> statisticsByLeader(LeaderInspectionRecord leaderInspectionRecord){ | ||
46 | return this.baseMapper.statisticsByLeader( leaderInspectionRecord) ; | ||
47 | } | ||
48 | } |
sk-module-biz/src/main/java/com/skua/modules/ajh/vo/LeaderInspectionRecordStatisticsVO.java
0 → 100644
1 | package com.skua.modules.ajh.vo; | ||
2 | |||
3 | import io.swagger.annotations.ApiModel; | ||
4 | import io.swagger.annotations.ApiModelProperty; | ||
5 | import lombok.Data; | ||
6 | |||
7 | /** | ||
8 | * 文件类型统计对象 | ||
9 | */ | ||
10 | @Data | ||
11 | @ApiModel(value="带班领导检查对象", description="带班领导检查对象") | ||
12 | public class LeaderInspectionRecordStatisticsVO { | ||
13 | |||
14 | @ApiModelProperty(value = "时间") | ||
15 | private String time; | ||
16 | |||
17 | @ApiModelProperty(value = "领导编号") | ||
18 | private String leaderId; | ||
19 | @ApiModelProperty(value = "领导名称") | ||
20 | private String leaderName; | ||
21 | |||
22 | @ApiModelProperty(value = "水务公司检查数量") | ||
23 | private String swgsjcNum; | ||
24 | |||
25 | @ApiModelProperty(value = "项目部检查数量") | ||
26 | private String xmbjcNum; | ||
27 | |||
28 | public LeaderInspectionRecordStatisticsVO(){ | ||
29 | |||
30 | } | ||
31 | |||
32 | public LeaderInspectionRecordStatisticsVO(String time, String swgsjcNum, String xmbjcNum) { | ||
33 | this.time = time; | ||
34 | this.swgsjcNum = swgsjcNum; | ||
35 | this.xmbjcNum = xmbjcNum; | ||
36 | } | ||
37 | } |
1 | package com.skua.modules.ajh.vo; | ||
2 | |||
3 | import io.swagger.annotations.ApiModel; | ||
4 | import io.swagger.annotations.ApiModelProperty; | ||
5 | import lombok.Data; | ||
6 | |||
7 | import java.util.List; | ||
8 | |||
9 | /** | ||
10 | * 文件类型统计对象 | ||
11 | */ | ||
12 | @Data | ||
13 | @ApiModel(value="带班领导检查返回对象", description="带班领导检查返回对象") | ||
14 | public class LeaderInspectionRecordVO { | ||
15 | |||
16 | @ApiModelProperty(value = "水务公司检查数量") | ||
17 | private String swgsjcNum; | ||
18 | |||
19 | @ApiModelProperty(value = "项目部检查数量") | ||
20 | private String xmbjcNum; | ||
21 | |||
22 | @ApiModelProperty(value = "时间统计集合") | ||
23 | private List<LeaderInspectionRecordStatisticsVO> timeDataList ; | ||
24 | |||
25 | @ApiModelProperty(value = "人员统计集合") | ||
26 | private List<LeaderInspectionRecordStatisticsVO> leaderDataList ; | ||
27 | |||
28 | public LeaderInspectionRecordVO(){ | ||
29 | |||
30 | } | ||
31 | public LeaderInspectionRecordVO(String swgsjcNum, String xmbjcNum, List<LeaderInspectionRecordStatisticsVO> timeDataList, List<LeaderInspectionRecordStatisticsVO> leaderDataList) { | ||
32 | this.swgsjcNum = swgsjcNum; | ||
33 | this.xmbjcNum = xmbjcNum; | ||
34 | this.timeDataList = timeDataList; | ||
35 | this.leaderDataList = leaderDataList; | ||
36 | } | ||
37 | } |
... | @@ -343,6 +343,10 @@ public class DateUtil { | ... | @@ -343,6 +343,10 @@ public class DateUtil { |
343 | return formatDate(new Date(),null); | 343 | return formatDate(new Date(),null); |
344 | } | 344 | } |
345 | 345 | ||
346 | public static String getCurrentYear(){ | ||
347 | return formatDate(new Date(),"YYYY"); | ||
348 | } | ||
349 | |||
346 | /*** | 350 | /*** |
347 | * 字符串日期格式化 | 351 | * 字符串日期格式化 |
348 | * @param date | 352 | * @param date |
... | @@ -380,7 +384,6 @@ public class DateUtil { | ... | @@ -380,7 +384,6 @@ public class DateUtil { |
380 | return date; | 384 | return date; |
381 | } | 385 | } |
382 | 386 | ||
383 | |||
384 | /** | 387 | /** |
385 | * 格式化 | 388 | * 格式化 |
386 | * @param date | 389 | * @param date |
... | @@ -398,6 +401,7 @@ public class DateUtil { | ... | @@ -398,6 +401,7 @@ public class DateUtil { |
398 | return sformat.format(_date); | 401 | return sformat.format(_date); |
399 | } | 402 | } |
400 | 403 | ||
404 | |||
401 | /*** | 405 | /*** |
402 | * 两个时间差 | 406 | * 两个时间差 |
403 | * @param date1 | 407 | * @param date1 | ... | ... |
... | @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ... | @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
7 | import com.skua.core.api.vo.Result; | 7 | import com.skua.core.api.vo.Result; |
8 | import com.skua.core.aspect.annotation.AutoLog; | 8 | import com.skua.core.aspect.annotation.AutoLog; |
9 | import com.skua.core.context.BaseContextHandler; | 9 | import com.skua.core.context.BaseContextHandler; |
10 | import com.skua.core.context.SpringContextUtils; | ||
10 | import com.skua.core.query.QueryGenerator; | 11 | import com.skua.core.query.QueryGenerator; |
11 | import com.skua.core.util.DateUtils; | 12 | import com.skua.core.util.DateUtils; |
12 | import com.skua.modules.erp.entity.ErpSettlement; | 13 | import com.skua.modules.erp.entity.ErpSettlement; |
... | @@ -16,6 +17,7 @@ import com.skua.modules.material.entity.MaterialInfoHandleRecord; | ... | @@ -16,6 +17,7 @@ import com.skua.modules.material.entity.MaterialInfoHandleRecord; |
16 | import com.skua.modules.material.entity.MaterialInformation; | 17 | import com.skua.modules.material.entity.MaterialInformation; |
17 | import com.skua.modules.material.service.IMaterialInfoHandleRecordService; | 18 | import com.skua.modules.material.service.IMaterialInfoHandleRecordService; |
18 | import com.skua.modules.material.service.IMaterialInfoService; | 19 | import com.skua.modules.material.service.IMaterialInfoService; |
20 | import com.skua.modules.material.vo.MaterialInfoStatisticsVO; | ||
19 | import com.skua.modules.system.service.ISysDepartService; | 21 | import com.skua.modules.system.service.ISysDepartService; |
20 | import com.skua.tool.util.JSUtils; | 22 | import com.skua.tool.util.JSUtils; |
21 | import io.swagger.annotations.Api; | 23 | import io.swagger.annotations.Api; |
... | @@ -29,6 +31,8 @@ import org.jeecgframework.poi.excel.entity.ExportParams; | ... | @@ -29,6 +31,8 @@ import org.jeecgframework.poi.excel.entity.ExportParams; |
29 | import org.jeecgframework.poi.excel.entity.ImportParams; | 31 | import org.jeecgframework.poi.excel.entity.ImportParams; |
30 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | 32 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
31 | import org.springframework.beans.factory.annotation.Autowired; | 33 | import org.springframework.beans.factory.annotation.Autowired; |
34 | import org.springframework.jdbc.core.BeanPropertyRowMapper; | ||
35 | import org.springframework.jdbc.core.JdbcTemplate; | ||
32 | import org.springframework.web.bind.annotation.*; | 36 | import org.springframework.web.bind.annotation.*; |
33 | import org.springframework.web.multipart.MultipartFile; | 37 | import org.springframework.web.multipart.MultipartFile; |
34 | import org.springframework.web.multipart.MultipartHttpServletRequest; | 38 | import org.springframework.web.multipart.MultipartHttpServletRequest; |
... | @@ -424,6 +428,40 @@ public class MaterialInfoController { | ... | @@ -424,6 +428,40 @@ public class MaterialInfoController { |
424 | return Result.ok("文件导入失败!"); | 428 | return Result.ok("文件导入失败!"); |
425 | } | 429 | } |
426 | 430 | ||
431 | @AutoLog(value = "安全态势总览-安全生成知识库") | ||
432 | @ApiOperation(value = "安全态势总览-安全生成知识库", notes = "安全态势总览-安全生成知识库") | ||
433 | @GetMapping(value = "/statistics") | ||
434 | public Result<List<MaterialInfoStatisticsVO>> statistics() { | ||
435 | Result<List<MaterialInfoStatisticsVO>> result = new Result<>(); | ||
436 | /* if (StringUtils.isBlank(materialInfo.getDepartId())&&StringUtils.isNotBlank(BaseContextHandler.getDeparts())) { | ||
437 | materialInfo.setDepartId(departService.getChildDepartId(BaseContextHandler.getDeparts())); | ||
438 | }else{ | ||
439 | materialInfo.setDepartId(departService.getChildDepartId(materialInfo.getDepartId())); | ||
440 | }*/ | ||
441 | List<MaterialInfoStatisticsVO> resultList = new ArrayList<>(); | ||
442 | List<MaterialInfoStatisticsVO> flfgDataList = getMaterialInfoStatisticsSql("法律法规","flfg","laws_type"); | ||
443 | List<MaterialInfoStatisticsVO> bzgfDataList = getMaterialInfoStatisticsSql("标准规范","bzgf","standards_type"); | ||
444 | List<MaterialInfoStatisticsVO> gzzdDataList = getMaterialInfoStatisticsSql("企业安环制度","gzzd","rules_type"); | ||
445 | if(flfgDataList != null ) resultList.addAll(flfgDataList); | ||
446 | if(bzgfDataList != null ) resultList.addAll(bzgfDataList); | ||
447 | if(gzzdDataList != null ) resultList.addAll(gzzdDataList); | ||
448 | result.setSuccess(true); | ||
449 | result.setResult(resultList); | ||
450 | return result; | ||
451 | } | ||
452 | private List<MaterialInfoStatisticsVO> getMaterialInfoStatisticsSql(String fileTypeName,String fileType,String dictCode){ | ||
453 | String sql = "select '"+fileTypeName+"' sonFileTypeName, bbb.item_text file_type_name, aaa.* from ( "; | ||
454 | sql += " SELECT SUBSTRING_INDEX("+dictCode+", ',', 1) AS file_type, COUNT(*) AS count FROM material_info where fac_informationtype = '"+fileType+"' GROUP BY file_type "; | ||
455 | sql += ")aaa"; | ||
456 | sql+=" left join ( "; | ||
457 | sql += "SELECT item_text, item_value FROM sys_dict_item WHERE dict_id = ( SELECT id FROM sys_dict WHERE dict_code = '"+dictCode+"')"; | ||
458 | sql += ")bbb on bbb.item_value = aaa.file_type "; | ||
459 | JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); | ||
460 | List<MaterialInfoStatisticsVO> dataList = masterDB.query(sql,new BeanPropertyRowMapper<MaterialInfoStatisticsVO>(MaterialInfoStatisticsVO.class)); | ||
461 | return dataList; | ||
462 | } | ||
463 | |||
464 | |||
427 | 465 | ||
428 | /** | 466 | /** |
429 | * 类型统计查询 | 467 | * 类型统计查询 | ... | ... |
... | @@ -59,7 +59,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat | ... | @@ -59,7 +59,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat |
59 | map.put("count",count); | 59 | map.put("count",count); |
60 | tList.add(map); | 60 | tList.add(map); |
61 | } | 61 | } |
62 | }else if("flfg".equals(facInfo.getFacInformationtype())){ | 62 | }else if("flfg".equals(facInfo.getFacInformationtype())){ //法律法规 |
63 | dictCode = "laws_type"; | 63 | dictCode = "laws_type"; |
64 | List<Map<String, Object>> typeList = baseMapper.getAnalysis(dictCode); | 64 | List<Map<String, Object>> typeList = baseMapper.getAnalysis(dictCode); |
65 | for (Map<String, Object> map : typeList) { | 65 | for (Map<String, Object> map : typeList) { | ... | ... |
1 | package com.skua.modules.material.vo; | ||
2 | |||
3 | import io.swagger.annotations.ApiModel; | ||
4 | import io.swagger.annotations.ApiModelProperty; | ||
5 | import lombok.Data; | ||
6 | |||
7 | /** | ||
8 | * 文件类型统计对象 | ||
9 | */ | ||
10 | @Data | ||
11 | @ApiModel(value="文件类型统计对象", description="文件类型统计对象") | ||
12 | public class MaterialInfoStatisticsVO { | ||
13 | @ApiModelProperty(value = "文件名类型名称") | ||
14 | private String fileTypeName; | ||
15 | |||
16 | @ApiModelProperty(value = "二级子类名称") | ||
17 | private String sonFileTypeName; | ||
18 | |||
19 | @ApiModelProperty(value = "二级子类") | ||
20 | private String fileType; | ||
21 | |||
22 | @ApiModelProperty(value = "文件数量") | ||
23 | private Integer count; | ||
24 | } |
-
请 注册 或 登录 后发表评论