From c8bd4e03ada730389898fa87f305b18339111219 Mon Sep 17 00:00:00 2001 From: Mlxa0324 Date: Wed, 22 Mar 2023 23:20:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E8=B0=83=E8=BF=99=E4=B8=AA?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=88=E7=94=A8=E4=BA=8E=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=9A=84=E4=BD=BF=E7=94=A8=E6=97=B6=E9=95=BF?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/sql/mysql/2.tianze-pro-update.sql | 17 + .../java/com/ibeetl/jlw/dao/StudentDao.java | 6 - ...StudentTeacherSystemUseLogAnalysisDao.java | 40 ++ .../StudentTeacherSystemUseLogAnalysis.java | 228 ++++++++ ...dentTeacherSystemUseLogAnalysisAddDTO.java | 28 + .../ibeetl/jlw/service/AnalysisService.java | 11 - ...entTeacherSystemUseLogAnalysisService.java | 447 +++++++++++++++ .../ibeetl/jlw/web/AnalysisController.java | 40 -- ...TeacherSystemUseLogAnalysisController.java | 446 +++++++++++++++ ...udentTeacherSystemUseLogAnalysisQuery.java | 170 ++++++ .../jlw/studentTeacherSystemUseLogAnalysis.md | 507 ++++++++++++++++++ .../studentTeacherSystemUseLogAnalysis/add.js | 38 ++ .../studentTeacherSystemUseLogAnalysis/del.js | 23 + .../edit.js | 28 + .../index.js | 224 ++++++++ .../studentTeacherSystemUseLogAnalysisApi.js | 26 + .../add.html | 104 ++++ .../edit.html | 104 ++++ .../index.html | 31 ++ 19 files changed, 2461 insertions(+), 57 deletions(-) create mode 100644 web/src/main/java/com/ibeetl/jlw/dao/StudentTeacherSystemUseLogAnalysisDao.java create mode 100644 web/src/main/java/com/ibeetl/jlw/entity/StudentTeacherSystemUseLogAnalysis.java create mode 100644 web/src/main/java/com/ibeetl/jlw/entity/dto/StudentTeacherSystemUseLogAnalysisAddDTO.java create mode 100644 web/src/main/java/com/ibeetl/jlw/service/StudentTeacherSystemUseLogAnalysisService.java create mode 100644 web/src/main/java/com/ibeetl/jlw/web/StudentTeacherSystemUseLogAnalysisController.java create mode 100644 web/src/main/java/com/ibeetl/jlw/web/query/StudentTeacherSystemUseLogAnalysisQuery.java create mode 100644 web/src/main/resources/sql/jlw/studentTeacherSystemUseLogAnalysis.md create mode 100644 web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/add.js create mode 100644 web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/del.js create mode 100644 web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/edit.js create mode 100644 web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/index.js create mode 100644 web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/studentTeacherSystemUseLogAnalysisApi.js create mode 100644 web/src/main/resources/templates/jlw/studentTeacherSystemUseLogAnalysis/add.html create mode 100644 web/src/main/resources/templates/jlw/studentTeacherSystemUseLogAnalysis/edit.html create mode 100644 web/src/main/resources/templates/jlw/studentTeacherSystemUseLogAnalysis/index.html diff --git a/doc/sql/mysql/2.tianze-pro-update.sql b/doc/sql/mysql/2.tianze-pro-update.sql index 584cab5c..af28d54b 100644 --- a/doc/sql/mysql/2.tianze-pro-update.sql +++ b/doc/sql/mysql/2.tianze-pro-update.sql @@ -565,3 +565,20 @@ ALTER TABLE teacher_open_course_schedule_session ADD COLUMN schedule_session_tit ALTER TABLE core_user ADD COLUMN login_count bigint(20) COMMENT '登录次数'; ALTER TABLE core_user ADD COLUMN last_login_time datetime COMMENT '最后登录时间'; + +drop table if exists student_teacher_system_use_log_analysis; +CREATE TABLE `student_teacher_system_use_log_analysis` ( + `id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键ID', + `first_name` varchar(100) DEFAULT NULL COMMENT '一级名称', + `second_name` varchar(100) DEFAULT NULL COMMENT '二级名称', + `universities_colleges_name` varchar(255) DEFAULT NULL COMMENT '院校名称', + `universities_colleges_id` bigint(20) DEFAULT NULL COMMENT '院校ID', + `user_type` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户类型 UserTypeEnum', + `province` varchar(20) DEFAULT NULL COMMENT '所在省份', + `day_time` varchar(40) DEFAULT NULL COMMENT '日期', + `use_duration` bigint(20) DEFAULT NULL COMMENT '使用时长', + `add_time` datetime DEFAULT NULL COMMENT '创建时间', + `org_id` bigint(20) DEFAULT NULL COMMENT '机构ID', + `user_id` bigint(20) DEFAULT NULL COMMENT '用户ID', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='学生教师行为分析'; diff --git a/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java b/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java index bf7d1cd1..c58f9120 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java @@ -86,10 +86,4 @@ public interface StudentDao extends BaseMapper{ StudentActiveInfo studentActiveInfo(Long studentId, Long userId); - /** - * 分页查询使用记录,院校级别的统计。不关心哪个用户 - * @param dto - * @return - */ - PageQuery applicationUseLogsAnalysis(PageQuery dto); } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/dao/StudentTeacherSystemUseLogAnalysisDao.java b/web/src/main/java/com/ibeetl/jlw/dao/StudentTeacherSystemUseLogAnalysisDao.java new file mode 100644 index 00000000..38c9913a --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/dao/StudentTeacherSystemUseLogAnalysisDao.java @@ -0,0 +1,40 @@ +package com.ibeetl.jlw.dao; + +import com.ibeetl.jlw.entity.StudentTeacherSystemUseLogAnalysis; +import com.ibeetl.jlw.entity.dto.SystemUseLogsAnalysisDTO; +import com.ibeetl.jlw.entity.vo.SystemUseLogsAnalysisVO; +import com.ibeetl.jlw.web.query.StudentTeacherSystemUseLogAnalysisQuery; +import org.beetl.sql.core.engine.PageQuery; +import org.beetl.sql.mapper.BaseMapper; +import org.beetl.sql.mapper.annotation.SqlResource; +import org.beetl.sql.mapper.annotation.Update; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Map; + +/** + * 学生教师行为分析 Dao + */ +// 实际可以不用加Repository注解,调用的地方注入时候,Idea会报红,看着难受 +@Repository +@SqlResource("jlw.studentTeacherSystemUseLogAnalysis") +public interface StudentTeacherSystemUseLogAnalysisDao extends BaseMapper{ + PageQuery queryByCondition(PageQuery query); + PageQuery queryByConditionQuery(PageQuery query); + @Update + void deleteStudentTeacherSystemUseLogAnalysisByIds(String ids); + @Update + int updateGivenByIds(StudentTeacherSystemUseLogAnalysisQuery studentTeacherSystemUseLogAnalysisQuery); + List getByIds(String ids); + List getValuesByQuery(StudentTeacherSystemUseLogAnalysisQuery studentTeacherSystemUseLogAnalysisQuery); + List getValuesByQueryNotWithPermission(StudentTeacherSystemUseLogAnalysisQuery studentTeacherSystemUseLogAnalysisQuery); + List>getExcelValues(StudentTeacherSystemUseLogAnalysisQuery studentTeacherSystemUseLogAnalysisQuery); + + /** + * 分页查询使用记录,院校级别的统计。不关心哪个用户 + * @param page + * @return + */ + PageQuery applicationUseLogsAnalysis(PageQuery page); +} diff --git a/web/src/main/java/com/ibeetl/jlw/entity/StudentTeacherSystemUseLogAnalysis.java b/web/src/main/java/com/ibeetl/jlw/entity/StudentTeacherSystemUseLogAnalysis.java new file mode 100644 index 00000000..db494a30 --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/entity/StudentTeacherSystemUseLogAnalysis.java @@ -0,0 +1,228 @@ +package com.ibeetl.jlw.entity; + +import com.ibeetl.admin.core.entity.BaseEntity; +import com.ibeetl.admin.core.util.ValidateConfig; +import com.ibeetl.jlw.service.StudentTeacherSystemUseLogAnalysisService; +import org.beetl.sql.annotation.entity.AssignID; + +import javax.validation.constraints.NotNull; +import java.util.Date; + +/* +* 学生教师行为分析 +* gen by Spring Boot2 Admin 2023-03-22 +*/ +public class StudentTeacherSystemUseLogAnalysis extends BaseEntity{ + + //主键ID + @NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class) + // @SeqID(name = ORACLE_CORE_SEQ_NAME) + @AssignID(value = "maskAutoID",param = "com.ibeetl.jlw.entity.StudentTeacherSystemUseLogAnalysis") + + private String id ; + + //一级名称 + + private String firstName ; + + //二级名称 + + private String secondName ; + + //院校名称 + + private String universitiesCollegesName ; + + //院校ID + + private Long universitiesCollegesId ; + + //用户类型 UserTypeEnum + + private StudentTeacherSystemUseLogAnalysisService.UseTypeEnum userType ; + + //所在省份 + + private String province ; + + //日期 + + private String dayTime ; + + //使用时长 + + private Long useDuration ; + + //创建时间 + + private Date addTime ; + + //机构ID + + private Long orgId ; + + //用户ID + + private Long userId ; + + public StudentTeacherSystemUseLogAnalysis(){ + } + + /**主键ID + *@return + */ + public String getId(){ + return id; + } + /**主键ID + *@param id + */ + public void setId(String id){ + this.id = id; + } + + /**一级名称 + *@return + */ + public String getFirstName(){ + return firstName; + } + /**一级名称 + *@param firstName + */ + public void setFirstName(String firstName){ + this.firstName = firstName; + } + + /**二级名称 + *@return + */ + public String getSecondName(){ + return secondName; + } + /**二级名称 + *@param secondName + */ + public void setSecondName(String secondName){ + this.secondName = secondName; + } + + /**院校名称 + *@return + */ + public String getUniversitiesCollegesName(){ + return universitiesCollegesName; + } + /**院校名称 + *@param universitiesCollegesName + */ + public void setUniversitiesCollegesName(String universitiesCollegesName){ + this.universitiesCollegesName = universitiesCollegesName; + } + + /**院校ID + *@return + */ + public Long getUniversitiesCollegesId(){ + return universitiesCollegesId; + } + /**院校ID + *@param universitiesCollegesId + */ + public void setUniversitiesCollegesId(Long universitiesCollegesId){ + this.universitiesCollegesId = universitiesCollegesId; + } + + /**用户类型 UserTypeEnum + *@return + */ + public StudentTeacherSystemUseLogAnalysisService.UseTypeEnum getUserType(){ + return userType; + } + /**用户类型 UserTypeEnum + *@param userType + */ + public void setUserType(StudentTeacherSystemUseLogAnalysisService.UseTypeEnum userType){ + this.userType = userType; + } + + /**所在省份 + *@return + */ + public String getProvince(){ + return province; + } + /**所在省份 + *@param province + */ + public void setProvince(String province){ + this.province = province; + } + + /**日期 + *@return + */ + public String getDayTime(){ + return dayTime; + } + /**日期 + *@param dayTime + */ + public void setDayTime(String dayTime){ + this.dayTime = dayTime; + } + + /**使用时长 + *@return + */ + public Long getUseDuration(){ + return useDuration; + } + /**使用时长 + *@param useDuration + */ + public void setUseDuration(Long useDuration){ + this.useDuration = useDuration; + } + + /**创建时间 + *@return + */ + public Date getAddTime(){ + return addTime; + } + /**创建时间 + *@param addTime + */ + public void setAddTime(Date addTime){ + this.addTime = addTime; + } + + /**机构ID + *@return + */ + public Long getOrgId(){ + return orgId; + } + /**机构ID + *@param orgId + */ + public void setOrgId(Long orgId){ + this.orgId = orgId; + } + + /**用户ID + *@return + */ + public Long getUserId(){ + return userId; + } + /**用户ID + *@param userId + */ + public void setUserId(Long userId){ + this.userId = userId; + } + + +} diff --git a/web/src/main/java/com/ibeetl/jlw/entity/dto/StudentTeacherSystemUseLogAnalysisAddDTO.java b/web/src/main/java/com/ibeetl/jlw/entity/dto/StudentTeacherSystemUseLogAnalysisAddDTO.java new file mode 100644 index 00000000..0514a3dd --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/entity/dto/StudentTeacherSystemUseLogAnalysisAddDTO.java @@ -0,0 +1,28 @@ +package com.ibeetl.jlw.entity.dto; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + *学生教师行为分析查询 + */ +@Data +public class StudentTeacherSystemUseLogAnalysisAddDTO { + + /** + * 一级名称 + */ + @NotBlank(message = "一级名称不能为空!") + private String firstName; + /** + * 二级名称 + */ + @NotBlank(message = "二级名称不能为空!") + private String secondName; + /** + * 单次使用时长(单位:分钟),一般是定时器的配置时间。后台自动追加到时间基数上。默认5分钟 + */ + private Long useDuration; + +} diff --git a/web/src/main/java/com/ibeetl/jlw/service/AnalysisService.java b/web/src/main/java/com/ibeetl/jlw/service/AnalysisService.java index 1a09160f..3cf565c5 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/AnalysisService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/AnalysisService.java @@ -2,12 +2,9 @@ package com.ibeetl.jlw.service; import com.ibeetl.jlw.dao.StudentDao; import com.ibeetl.jlw.dao.SysLogDao; -import com.ibeetl.jlw.entity.dto.SystemUseLogsAnalysisDTO; -import com.ibeetl.jlw.entity.vo.SystemUseLogsAnalysisVO; import com.ibeetl.jlw.web.AnalysisController; import lombok.extern.slf4j.Slf4j; import org.beetl.sql.core.SQLManager; -import org.beetl.sql.core.engine.PageQuery; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -43,12 +40,4 @@ public class AnalysisService { return sqlManager.getMapper(SysLogDao.class).systemUseLogsAnalysis(dto); } - /** - * 分页查询使用记录,院校级别的统计。不关心哪个用户 - * @param page - * @return - */ - public PageQuery applicationUseLogsAnalysis(PageQuery page) { - return studentDao.applicationUseLogsAnalysis(page); - } } diff --git a/web/src/main/java/com/ibeetl/jlw/service/StudentTeacherSystemUseLogAnalysisService.java b/web/src/main/java/com/ibeetl/jlw/service/StudentTeacherSystemUseLogAnalysisService.java new file mode 100644 index 00000000..4d9be32b --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/service/StudentTeacherSystemUseLogAnalysisService.java @@ -0,0 +1,447 @@ +package com.ibeetl.jlw.service; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.EnumUtil; +import cn.jlw.util.ToolUtils; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.ibeetl.admin.core.entity.CoreUser; +import com.ibeetl.admin.core.service.CoreBaseService; +import com.ibeetl.admin.core.util.PlatformException; +import com.ibeetl.admin.core.util.TimeTool; +import com.ibeetl.admin.core.web.JsonResult; +import com.ibeetl.admin.core.web.JsonReturnCode; +import com.ibeetl.jlw.dao.StudentTeacherSystemUseLogAnalysisDao; +import com.ibeetl.jlw.entity.*; +import com.ibeetl.jlw.entity.dto.StudentTeacherSystemUseLogAnalysisAddDTO; +import com.ibeetl.jlw.entity.dto.SystemUseLogsAnalysisDTO; +import com.ibeetl.jlw.entity.vo.SystemUseLogsAnalysisVO; +import com.ibeetl.jlw.web.query.StudentTeacherSystemUseLogAnalysisQuery; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.beetl.sql.annotation.entity.EnumValue; +import org.beetl.sql.core.SqlId; +import org.beetl.sql.core.engine.PageQuery; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; + +import java.io.*; +import java.util.*; + +import static cn.hutool.core.collection.IterUtil.getFirst; +import static cn.hutool.core.date.DateTime.now; +import static cn.hutool.core.util.ObjectUtil.defaultIfNull; +import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue; + +/** + * 学生教师行为分析 Service + * 当分布式ID开启后请勿使用insert(*,true) + */ + +@Service +@Transactional +@Validated +public class StudentTeacherSystemUseLogAnalysisService extends CoreBaseService{ + + @Autowired private StudentTeacherSystemUseLogAnalysisDao studentTeacherSystemUseLogAnalysisDao; + @Autowired + private StudentService studentService; + @Autowired + private TeacherService teacherService; + @Autowired + private UniversitiesCollegesService universitiesCollegesService; + + public PageQueryqueryByCondition(PageQuery query){ + PageQuery ret = studentTeacherSystemUseLogAnalysisDao.queryByCondition(query); + queryListAfter(ret.getList()); + return ret; + } + + public PageQueryqueryByConditionQuery(PageQuery query){ + PageQuery ret = studentTeacherSystemUseLogAnalysisDao.queryByConditionQuery(query); + queryListAfter(ret.getList()); + return ret; + } + + public void deleteByList(List list){ + String ids = ""; + ToolUtils.deleteNullList(list); + for(int i=0;null != list && i studentTeacherSystemUseLogAnalysisList = new ArrayList<>(); + try { + studentTeacherSystemUseLogAnalysisList = JSON.parseArray(studentTeacherSystemUseLogAnalysisQuery.getStudentTeacherSystemUseLogAnalysisJsonStr(), StudentTeacherSystemUseLogAnalysis.class); + } catch (Exception e) { + try { + studentTeacherSystemUseLogAnalysisList.add(JSONObject.parseObject(studentTeacherSystemUseLogAnalysisQuery.getStudentTeacherSystemUseLogAnalysisJsonStr(), StudentTeacherSystemUseLogAnalysis.class)); + } catch (Exception e1) {} + } + ToolUtils.deleteNullList(studentTeacherSystemUseLogAnalysisList); + if(null != studentTeacherSystemUseLogAnalysisList && studentTeacherSystemUseLogAnalysisList.size()>0){ + for(int i=0;i 0; + if(!flag){ + msg = "更新指定参数失败"; + } + }else{ + msg = "指定参数为空"; + } + return msg; + } + + public List getValues (Object paras){ + return sqlManager.select(SqlId.of("jlw.studentTeacherSystemUseLogAnalysis.getStudentTeacherSystemUseLogAnalysisValues"), StudentTeacherSystemUseLogAnalysis.class, paras); + } + + public List getValuesByQuery (StudentTeacherSystemUseLogAnalysisQuery studentTeacherSystemUseLogAnalysisQuery){ + return studentTeacherSystemUseLogAnalysisDao.getValuesByQuery(studentTeacherSystemUseLogAnalysisQuery); + } + + public List getValuesByQueryNotWithPermission (StudentTeacherSystemUseLogAnalysisQuery studentTeacherSystemUseLogAnalysisQuery){ + return studentTeacherSystemUseLogAnalysisDao.getValuesByQueryNotWithPermission(studentTeacherSystemUseLogAnalysisQuery); + } + + public StudentTeacherSystemUseLogAnalysis getInfo (String id){ + StudentTeacherSystemUseLogAnalysisQuery studentTeacherSystemUseLogAnalysisQuery = new StudentTeacherSystemUseLogAnalysisQuery(); + studentTeacherSystemUseLogAnalysisQuery.setId(id); + List list = studentTeacherSystemUseLogAnalysisDao.getValuesByQuery(studentTeacherSystemUseLogAnalysisQuery); + if(null != list && list.size()>0){ + return list.get(0); + }else{ + return null; + } + } + + public StudentTeacherSystemUseLogAnalysis getInfo (StudentTeacherSystemUseLogAnalysisQuery studentTeacherSystemUseLogAnalysisQuery){ + List list = studentTeacherSystemUseLogAnalysisDao.getValuesByQuery(studentTeacherSystemUseLogAnalysisQuery); + if(null != list && list.size()>0){ + return list.get(0); + }else{ + return null; + } + } + + + public JsonResult importTemplate(List fileEntityList,Listlist,CoreUser coreUser){ + ListerrMsg = new ArrayList<>(); + String msg =""; + int count = 0; + Date date = new Date(); + for(int item=0;null != fileEntityList && item map = new HashMap<>();//获取需要的表头的列 + + //从第一列找到需要的表头 + for (int i=0; i0?JsonReturnCode.SUCCESS.getCode():JsonReturnCode.FAIL.getCode()); + jsonResult.setData(errMsg); + jsonResult.setMsg((count>0?"导入成功,共导入"+count+"条":"导入失败")+(StringUtils.isNotBlank(msg)?"
"+msg:"")); + return jsonResult; + } + + public List> getExcelValues (StudentTeacherSystemUseLogAnalysisQuery studentTeacherSystemUseLogAnalysisQuery){ + return studentTeacherSystemUseLogAnalysisDao.getExcelValues(studentTeacherSystemUseLogAnalysisQuery); + } + + /** + * 分页查询使用记录,院校级别的统计。不关心哪个用户 + * @param page + * @return + */ + public PageQuery applicationUseLogsAnalysis(PageQuery page) { + return studentTeacherSystemUseLogAnalysisDao.applicationUseLogsAnalysis(page); + } + + /** + * 用户类型 + */ + @Getter + public enum UseTypeEnum { + + STUDENT("学生"), TEACHER("教师"); + + @EnumValue + private String name; + + UseTypeEnum(String name) { + this.name = name; + } + } + + public void addOrUpdateUseLog(StudentTeacherSystemUseLogAnalysisAddDTO dto, CoreUser coreUser) { + // 追加的使用时长 + Long appendUseDuration = defaultIfNull(dto.getUseDuration(), 5L); + final String firstName = dto.getFirstName().trim(); + final String secondName = dto.getSecondName().trim(); + final Long userId = coreUser.getId(); + final Long orgId = coreUser.getOrgId(); + final String today = DateUtil.today(); + // 院校名称 + String universitiesCollegesName = ""; + // 院校ID + Long universitiesCollegesId = null; + // 院校所在省 + String province = null; + // 用户类型 + UseTypeEnum useType = null; + + // 查询唯一的条件,如果没查到那肯定是要新增一条数据咯 + StudentTeacherSystemUseLogAnalysisQuery query = new StudentTeacherSystemUseLogAnalysisQuery(); + query.setFirstName(firstName); + query.setSecondName(secondName); + query.setUserId(userId); + query.setOrgId(orgId); + query.setDayTime(today); + + // 追加院校ID条件 + if (coreUser.isStudent()) { + Student student = studentService.getByUserId(userId); + useType = UseTypeEnum.STUDENT; + if (student != null) { + UniversitiesColleges universitiesColleges = universitiesCollegesService.getUniversitiesCollegesByStudent(student); + province = universitiesColleges.getUniversitiesCollegesProvince(); + universitiesCollegesId = universitiesColleges.getUniversitiesCollegesId(); + universitiesCollegesName = universitiesColleges.getUniversitiesCollegesName(); + query.setUniversitiesCollegesId(universitiesCollegesId); + } + } + if (coreUser.isTeacher()) { + Teacher teacher = teacherService.getByUserId(userId); + useType = UseTypeEnum.TEACHER; + if (teacher != null) { + UniversitiesColleges universitiesColleges = universitiesCollegesService.getUniversitiesCollegesByTeacher(teacher); + province = universitiesColleges.getUniversitiesCollegesProvince(); + universitiesCollegesId = universitiesColleges.getUniversitiesCollegesId(); + universitiesCollegesName = universitiesColleges.getUniversitiesCollegesName(); + query.setUniversitiesCollegesId(universitiesColleges.getUniversitiesCollegesId()); + } + } + + List logAnalysisList = getValuesByQueryNotWithPermission(query); + + // 如果查询到数据,则追加使用时长(分钟) + if (CollectionUtil.isNotEmpty(logAnalysisList)) { + StudentTeacherSystemUseLogAnalysis logAnalysis = getFirst(logAnalysisList); + logAnalysis.setUseDuration(defaultIfNull(logAnalysis.getUseDuration(), 0L) + appendUseDuration); + updateTemplate(logAnalysis); + } + + // 否则新增一条数据 + else { + StudentTeacherSystemUseLogAnalysis useLogAnalysis = new StudentTeacherSystemUseLogAnalysis(); + useLogAnalysis.setFirstName(firstName); + useLogAnalysis.setSecondName(secondName); + useLogAnalysis.setUniversitiesCollegesName(universitiesCollegesName); + useLogAnalysis.setUniversitiesCollegesId(universitiesCollegesId); + useLogAnalysis.setUserType(useType); + useLogAnalysis.setProvince(province); + useLogAnalysis.setDayTime(today); + useLogAnalysis.setUseDuration(appendUseDuration); + useLogAnalysis.setAddTime(now()); + useLogAnalysis.setOrgId(orgId); + useLogAnalysis.setUserId(userId); + + insert(useLogAnalysis); + } + } +} diff --git a/web/src/main/java/com/ibeetl/jlw/web/AnalysisController.java b/web/src/main/java/com/ibeetl/jlw/web/AnalysisController.java index 9170e326..befb9672 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/AnalysisController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/AnalysisController.java @@ -1,29 +1,21 @@ package com.ibeetl.jlw.web; -import cn.hutool.core.lang.Assert; -import cn.hutool.core.util.StrUtil; import cn.jlw.Interceptor.SCoreUser; import com.ibeetl.admin.core.entity.CoreUser; import com.ibeetl.admin.core.web.JsonResult; -import com.ibeetl.jlw.entity.dto.SystemUseLogsAnalysisDTO; -import com.ibeetl.jlw.entity.vo.SystemUseLogsAnalysisVO; import com.ibeetl.jlw.service.AnalysisService; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.beetl.sql.core.engine.PageQuery; 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.ResponseBody; import org.springframework.web.bind.annotation.RestController; -import java.io.IOException; import java.util.Date; import java.util.List; -import static com.ibeetl.admin.core.util.ExcelUtil.write; import static com.ibeetl.jlw.job.OnLineRecordJob.ON_LINE_METHOD_NAME; /** @@ -78,37 +70,5 @@ public class AnalysisController extends BaseController { dto.setRequestUrl("在线人数统计"); return JsonResult.success(analysisService.systemUseLogsAnalysis(dto)); } - /** - * 分页查询使用记录,院校级别的统计。不关心哪个用户 - * TODO 理想 这里还没写完。 - * @param dto - * @return - */ - @PostMapping(MODEL + "/applicationUseLogsAnalysis.json") - @ResponseBody - public JsonResult applicationUseLogsAnalysis(SystemUseLogsAnalysisDTO dto, @SCoreUser CoreUser coreUser) { - return JsonResult.success(analysisService.applicationUseLogsAnalysis(dto.getPageQuery())); - } - - /** - * 功能描述:
- * 学生登录日志 导出 - * - * @param condition - * @param coreUser - * @Author: lx - * @Date: 2022/12/17 3:34 - */ - @GetMapping(MODEL + "/applicationUseLogsAnalysisExport.json") - @ResponseBody - public String applicationUseLogsAnalysisExport(SystemUseLogsAnalysisDTO condition, @SCoreUser CoreUser coreUser) throws IOException { - Assert.isFalse(coreUser.isStudent(), "暂无权限访问!"); - condition.setPage(1); condition.setLimit(Integer.MAX_VALUE + 0L); - PageQuery page = analysisService.applicationUseLogsAnalysis(condition.getPageQuery()); - - String filename = StrUtil.format("院校使用日志导出{}.xlsx", System.currentTimeMillis()); - write(response, filename, "Sheet1", SystemUseLogsAnalysisVO.class, page.getList()); - return null; - } } diff --git a/web/src/main/java/com/ibeetl/jlw/web/StudentTeacherSystemUseLogAnalysisController.java b/web/src/main/java/com/ibeetl/jlw/web/StudentTeacherSystemUseLogAnalysisController.java new file mode 100644 index 00000000..380064dd --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/web/StudentTeacherSystemUseLogAnalysisController.java @@ -0,0 +1,446 @@ +package com.ibeetl.jlw.web; + +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.StrUtil; +import cn.jlw.Interceptor.GetFile; +import cn.jlw.Interceptor.RFile; +import cn.jlw.Interceptor.SCoreUser; +import cn.jlw.util.ToolUtils; +import cn.jlw.validate.ValidateConfig; +import com.ibeetl.admin.core.annotation.Function; +import com.ibeetl.admin.core.entity.CoreUser; +import com.ibeetl.admin.core.file.FileService; +import com.ibeetl.admin.core.util.TimeTool; +import com.ibeetl.admin.core.web.JsonResult; +import com.ibeetl.jlw.entity.FileEntity; +import com.ibeetl.jlw.entity.StudentTeacherSystemUseLogAnalysis; +import com.ibeetl.jlw.entity.dto.StudentTeacherSystemUseLogAnalysisAddDTO; +import com.ibeetl.jlw.entity.dto.SystemUseLogsAnalysisDTO; +import com.ibeetl.jlw.entity.vo.SystemUseLogsAnalysisVO; +import com.ibeetl.jlw.service.StudentTeacherSystemUseLogAnalysisService; +import com.ibeetl.jlw.web.query.StudentTeacherSystemUseLogAnalysisQuery; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.poi.hssf.usermodel.*; +import org.apache.poi.ss.usermodel.HorizontalAlignment; +import org.apache.poi.ss.usermodel.VerticalAlignment; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.beetl.sql.core.engine.PageQuery; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import static com.ibeetl.admin.core.util.ExcelUtil.write; + +/** + * 学生教师行为分析 学生教师行为分析 接口 + * 切记不要对非线程安全的静态变量进行写操作 + */ + +@RestController +@Validated +public class StudentTeacherSystemUseLogAnalysisController extends BaseController { + + private final Log log = LogFactory.getLog(this.getClass()); + private static final String MODEL = "/jlw/studentTeacherSystemUseLogAnalysis"; + private static final String API = "/api/studentTeacherSystemUseLogAnalysis"; + + + @Autowired private StudentTeacherSystemUseLogAnalysisService studentTeacherSystemUseLogAnalysisService; + + @Autowired FileService fileService; + + /* 前端接口 */ + + @PostMapping(API + "/getPageList.do") + public JsonResult getPageList(StudentTeacherSystemUseLogAnalysisQuery condition,@SCoreUser CoreUser coreUser){ + PageQuery page = condition.getPageQuery(); + studentTeacherSystemUseLogAnalysisService.queryByConditionQuery(page); + return JsonResult.success(page); + } + + + @GetMapping(API + "/getInfo.do") + public JsonResultgetInfo(StudentTeacherSystemUseLogAnalysisQuery param,@SCoreUser CoreUser coreUser) { + StudentTeacherSystemUseLogAnalysis studentTeacherSystemUseLogAnalysis = studentTeacherSystemUseLogAnalysisService.getInfo(param); + return JsonResult.success(studentTeacherSystemUseLogAnalysis); + } + + + @GetMapping(API + "/getList.do") + public JsonResult>getList(StudentTeacherSystemUseLogAnalysisQuery param,@SCoreUser CoreUser coreUser) { + Listlist = studentTeacherSystemUseLogAnalysisService.getValuesByQuery(param); + return JsonResult.success(list); + } + + @PostMapping(API + "/add.do") + public JsonResult addDo( + @Validated(ValidateConfig.ADD.class) @RequestBody StudentTeacherSystemUseLogAnalysisAddDTO dto, + BindingResult result, @SCoreUser CoreUser coreUser){ + if(result.hasErrors()){ + return JsonResult.failMessage(result); + }else{ + studentTeacherSystemUseLogAnalysisService.addOrUpdateUseLog(dto, coreUser); + return JsonResult.success(); + } + } + + + /* 后台页面 */ + + @GetMapping(MODEL + "/index.do") + @Function("studentTeacherSystemUseLogAnalysis.query") + public ModelAndView index() { + ModelAndView view = new ModelAndView("/jlw/studentTeacherSystemUseLogAnalysis/index.html") ; + view.addObject("search", StudentTeacherSystemUseLogAnalysisQuery.class.getName()); + return view; + } + + @GetMapping(MODEL + "/edit.do") + @Function("studentTeacherSystemUseLogAnalysis.edit") + public ModelAndView edit(String id) { + ModelAndView view = new ModelAndView("/jlw/studentTeacherSystemUseLogAnalysis/edit.html"); + StudentTeacherSystemUseLogAnalysis studentTeacherSystemUseLogAnalysis = studentTeacherSystemUseLogAnalysisService.queryById(id); + view.addObject("studentTeacherSystemUseLogAnalysis", studentTeacherSystemUseLogAnalysis); + return view; + } + + @GetMapping(MODEL + "/add.do") + @Function("studentTeacherSystemUseLogAnalysis.add") + public ModelAndView add(String id) { + ModelAndView view = new ModelAndView("/jlw/studentTeacherSystemUseLogAnalysis/add.html"); + if(null != id){ + StudentTeacherSystemUseLogAnalysis studentTeacherSystemUseLogAnalysis = studentTeacherSystemUseLogAnalysisService.queryById(id); + view.addObject("studentTeacherSystemUseLogAnalysis", studentTeacherSystemUseLogAnalysis); + }else { + view.addObject("studentTeacherSystemUseLogAnalysis", new StudentTeacherSystemUseLogAnalysis()); + } + return view; + } + + /* 后台接口 */ + + @PostMapping(MODEL + "/list.json") + @Function("studentTeacherSystemUseLogAnalysis.query") + public JsonResult list(StudentTeacherSystemUseLogAnalysisQuery condition){ + PageQuery page = condition.getPageQuery(); + studentTeacherSystemUseLogAnalysisService.queryByCondition(page); + return JsonResult.success(page); + } + + @PostMapping(MODEL + "/addAll.json") + @Function("studentTeacherSystemUseLogAnalysis.add") + public JsonResult addAll(StudentTeacherSystemUseLogAnalysisQuery studentTeacherSystemUseLogAnalysisQuery,@SCoreUser CoreUser coreUser){ + studentTeacherSystemUseLogAnalysisQuery.setUserId(coreUser.getId()); + studentTeacherSystemUseLogAnalysisQuery.setOrgId(coreUser.getOrgId()); + String msg = studentTeacherSystemUseLogAnalysisService.addAll(studentTeacherSystemUseLogAnalysisQuery); + if (StringUtils.isBlank(msg)) { + return JsonResult.success(); + } else { + return JsonResult.failMessage("新增失败,"+msg); + } + } + + @PostMapping(MODEL + "/add.json") + @Function("studentTeacherSystemUseLogAnalysis.add") + public JsonResult add(@Validated(ValidateConfig.ADD.class) StudentTeacherSystemUseLogAnalysisQuery studentTeacherSystemUseLogAnalysisQuery, BindingResult result,@SCoreUser CoreUser coreUser){ + if(result.hasErrors()){ + return JsonResult.failMessage(result); + }else{ + studentTeacherSystemUseLogAnalysisQuery.setUserId(coreUser.getId()); + studentTeacherSystemUseLogAnalysisQuery.setOrgId(coreUser.getOrgId()); + return studentTeacherSystemUseLogAnalysisService.add(studentTeacherSystemUseLogAnalysisQuery); + } + } + + @PostMapping(MODEL + "/edit.json") + @Function("studentTeacherSystemUseLogAnalysis.edit") + public JsonResult update(@Validated(ValidateConfig.UPDATE.class) StudentTeacherSystemUseLogAnalysisQuery studentTeacherSystemUseLogAnalysisQuery, BindingResult result,@SCoreUser CoreUser coreUser) { + if(result.hasErrors()){ + return JsonResult.failMessage(result); + }else { + studentTeacherSystemUseLogAnalysisQuery.setUserId(null); + studentTeacherSystemUseLogAnalysisQuery.setOrgId(null); + String msg = studentTeacherSystemUseLogAnalysisService.edit(studentTeacherSystemUseLogAnalysisQuery); + if (StringUtils.isBlank(msg)) { + return JsonResult.success(); + } else { + return JsonResult.failMessage("更新失败,"+msg); + } + } + } + + + @GetMapping(MODEL + "/view.json") + @Function("studentTeacherSystemUseLogAnalysis.query") + public JsonResultqueryInfo(String id) { + StudentTeacherSystemUseLogAnalysis studentTeacherSystemUseLogAnalysis = studentTeacherSystemUseLogAnalysisService.queryById( id); + return JsonResult.success(studentTeacherSystemUseLogAnalysis); + } + + @GetMapping(MODEL + "/getValues.json") + @Function("studentTeacherSystemUseLogAnalysis.query") + public JsonResult>getValues(StudentTeacherSystemUseLogAnalysisQuery param) { + Listlist = studentTeacherSystemUseLogAnalysisService.getValuesByQuery(param); + return JsonResult.success(list); + } + + + @PostMapping(MODEL + "/delete.json") + @Function("studentTeacherSystemUseLogAnalysis.delete") + @ResponseBody + public JsonResult delete(String ids) { + studentTeacherSystemUseLogAnalysisService.deleteStudentTeacherSystemUseLogAnalysis(ids); + return JsonResult.success(); + } + + + //下载模板信息 + @GetMapping(MODEL + "/downloadTemplate.json") + public void download(HttpServletRequest request,HttpServletResponse response,@SCoreUser CoreUser coreUser) { + if(null == coreUser){ + return; + } + XSSFWorkbook workbook = null; + InputStream is = null; + try { + //TODO 改导入模板名字 + is = new FileInputStream(GetFile.p + File.separator +"filesystem"+ File.separator +"template"+ File.separator+ "导入模板.xlsx"); + + workbook = new XSSFWorkbook(is); + + try { + if(null != is){ + is.close(); + } + }catch (Exception e){ + e.printStackTrace(); + } + + //准备将Excel的输出流通过response输出到页面下载 + //八进制输出流 + response.setContentType("application/octet-stream"); + + //这后面可以设置导出Excel的名称,此例中名为template.xls + String fileName = ToolUtils.web2fileName(request,"studentTeacherSystemUseLogAnalysisTemplate(" + TimeTool.getNowTime("YMD") + ").xlsx"); + + response.setHeader("Content-disposition", "attachment;filename="+fileName); + + //刷新缓冲 + response.flushBuffer(); + + //workbook将Excel写入到response的输出流中,供页面下载 + workbook.write(response.getOutputStream()); + }catch (Exception e){ + e.printStackTrace(); + } finally { + try { + if (null != workbook) { + workbook.close(); + } + if (null != response && null != response.getOutputStream()) { + response.getOutputStream().close(); + } + } catch (Exception e) { } + } + } + + //导入模板信息 + @PostMapping(MODEL + "/importTemplate.json") + @Function("studentTeacherSystemUseLogAnalysis.importTemplate") + public JsonResult importTemplate(@RFile List fileEntityList,@SCoreUser CoreUser coreUser) { + if(null == coreUser){ + return JsonResult.failMessage("请登录后再操作"); + } + Listlist=new ArrayList<>(); + JsonResult jsonResult = studentTeacherSystemUseLogAnalysisService.importTemplate(fileEntityList,list,coreUser); + if(list.size()>0){ + studentTeacherSystemUseLogAnalysisService.deleteByList(list); + } + return jsonResult; + } + + //导出信息 + @GetMapping(MODEL + "/excel/export.json") + @Function("studentTeacherSystemUseLogAnalysis.exportDocument") + public void export(HttpServletRequest request,HttpServletResponse response,StudentTeacherSystemUseLogAnalysisQuery studentTeacherSystemUseLogAnalysisQuery,@SCoreUser CoreUser coreUser) { + if(null == coreUser){ + return; + } + HSSFWorkbook workbook = null; + try { + //表头数据 + String[] header = { + "一级名称", + "二级名称", + "院校名称", + "院校", + "用户类型 UserTypeEnum", + "所在省份", + "日期", + "使用时长", + "创建时间", + }; + String[] headerCode = { + "firstName", + "secondName", + "universitiesCollegesName", + "universitiesCollegesId", + "userType", + "province", + "dayTime", + "useDuration", + "addTime", + }; + + //数据内容 + List> mapList = studentTeacherSystemUseLogAnalysisService.getExcelValues(studentTeacherSystemUseLogAnalysisQuery); + + //内容宽度 + Map widthMap = mapList.get(0); + mapList.remove(0); + + //声明一个工作簿 + workbook = new HSSFWorkbook(); + + //生成一个表格,设置表格名称为"Sheet1" + HSSFSheet sheet = workbook.createSheet("Sheet1"); + + //冻结表头 + sheet.createFreezePane(0, 1, 0, 1); + + //设置默认列宽度为5个字节 + sheet.setDefaultColumnWidth(5); + + //创建第一行表头 + HSSFRow headRow = sheet.createRow(0); + + //头部样式 + HSSFCellStyle headerStyle = workbook.createCellStyle(); + //垂直居中 + headerStyle.setVerticalAlignment(VerticalAlignment.CENTER); + //水平居中 + headerStyle.setAlignment(HorizontalAlignment.CENTER); + + //单元格样式 + HSSFCellStyle cellStyle = workbook.createCellStyle(); + //垂直居中 + cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); + //水平居左 + cellStyle.setAlignment(HorizontalAlignment.CENTER); + //自动换行 + cellStyle.setWrapText(true); + + //遍历添加表头 + for (int i = 0; i < header.length; i++) { + + //设置表格特定的列宽度 + if (null != widthMap.get(headerCode[i])) { + String width = widthMap.get(headerCode[i]).toString().split("\\.")[0]; + Integer w = Integer.parseInt(width) > header[i].length()*3?Integer.parseInt(width):header[i].length()*3; + sheet.setColumnWidth(i, w * 190); + } + + //创建一个单元格 + HSSFCell cell = headRow.createCell(i); + + //创建一个内容对象 + HSSFRichTextString text = new HSSFRichTextString(header[i]); + + //将内容对象的文字内容写入到单元格中 + cell.setCellValue(text); + + //设置样式 + cell.setCellStyle(headerStyle); + } + + //遍历结果集,把内容加入表格 + for (int i = 0; i < mapList.size(); i++) { + HSSFRow row = sheet.createRow(i + 1); + + row.setHeight((short) (50*10)); + + Map map = mapList.get(i); + for (int j = 0; j < headerCode.length; j++) { + HSSFCell cell = row.createCell(j); + cell.setCellStyle(cellStyle); + HSSFRichTextString text = new HSSFRichTextString(null != map.get(headerCode[j]) ? map.get(headerCode[j]).toString() : " "); + cell.setCellValue(text); + } + } + + + //准备将Excel的输出流通过response输出到页面下载 + //八进制输出流 + response.setContentType("application/octet-stream"); + + //这后面可以设置导出Excel的名称,此例中名为student.xls + String fileName = ToolUtils.web2fileName(request,"studentTeacherSystemUseLogAnalysis(" + TimeTool.getNowTime("YMD") + ").xls"); + + response.setHeader("Content-disposition", "attachment;filename="+fileName); + + //刷新缓冲 + response.flushBuffer(); + + //workbook将Excel写入到response的输出流中,供页面下载 + workbook.write(response.getOutputStream()); + }catch (Exception e){ + e.printStackTrace(); + } finally { + try { + if (null != workbook) { + workbook.close(); + } + if (null != response && null != response.getOutputStream()) { + response.getOutputStream().close(); + } + } catch (Exception e) { } + } + } + + /** + * 分页查询使用记录,院校级别的统计。不关心哪个用户 + * @param dto + * @return + */ + @PostMapping(MODEL + "/applicationUseLogsAnalysis.json") + @ResponseBody + public JsonResult applicationUseLogsAnalysis(SystemUseLogsAnalysisDTO dto, @SCoreUser CoreUser coreUser) { + return JsonResult.success(studentTeacherSystemUseLogAnalysisService.applicationUseLogsAnalysis(dto.getPageQuery())); + } + + /** + * 功能描述:
+ * 学生登录日志 导出 + * + * @param condition + * @param coreUser + * @Author: lx + * @Date: 2022/12/17 3:34 + */ + @GetMapping(MODEL + "/applicationUseLogsAnalysisExport.json") + @ResponseBody + public String applicationUseLogsAnalysisExport(SystemUseLogsAnalysisDTO condition, @SCoreUser CoreUser coreUser) throws IOException { + Assert.isFalse(coreUser.isStudent(), "暂无权限访问!"); + + condition.setPage(1); condition.setLimit(Integer.MAX_VALUE + 0L); + PageQuery page = studentTeacherSystemUseLogAnalysisService.applicationUseLogsAnalysis(condition.getPageQuery()); + + String filename = StrUtil.format("院校使用日志导出{}.xlsx", System.currentTimeMillis()); + write(response, filename, "Sheet1", SystemUseLogsAnalysisVO.class, page.getList()); + return null; + } +} diff --git a/web/src/main/java/com/ibeetl/jlw/web/query/StudentTeacherSystemUseLogAnalysisQuery.java b/web/src/main/java/com/ibeetl/jlw/web/query/StudentTeacherSystemUseLogAnalysisQuery.java new file mode 100644 index 00000000..bb81310a --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/web/query/StudentTeacherSystemUseLogAnalysisQuery.java @@ -0,0 +1,170 @@ +package com.ibeetl.jlw.web.query; + +import cn.jlw.validate.ValidateConfig; +import com.ibeetl.admin.core.annotation.Query; +import com.ibeetl.admin.core.web.query.PageParam; +import com.ibeetl.jlw.entity.StudentTeacherSystemUseLogAnalysis; +import com.ibeetl.jlw.service.StudentTeacherSystemUseLogAnalysisService; + +import javax.validation.constraints.NotNull; +import java.util.Date; + +/** + *学生教师行为分析查询 + */ +public class StudentTeacherSystemUseLogAnalysisQuery extends PageParam { + @NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class) + @Query(name = "主键ID", display = false) + private String id; + @Query(name = "一级名称", display = false) + private String firstName; + @Query(name = "二级名称", display = false) + private String secondName; + @Query(name = "院校名称", display = false) + private String universitiesCollegesName; + @Query(name = "院校ID", display = false) + private Long universitiesCollegesId; + @Query(name = "用户类型 UserTypeEnum", display = false) + private StudentTeacherSystemUseLogAnalysisService.UseTypeEnum userType; + @Query(name = "所在省份", display = false) + private String province; + @Query(name = "日期", display = false) + private String dayTime; + @Query(name = "使用时长", display = false) + private Long useDuration; + @Query(name = "创建时间", display = false) + private Date addTime; + @Query(name = "机构ID", display = false) + private Long orgId; + @Query(name = "用户ID", display = false) + private Long userId; + + private String universitiesCollegesIdPlural; + private String orgIdPlural; + private String userIdPlural; + + private String studentTeacherSystemUseLogAnalysisJsonStr;//json格式 + + private String _given;//指定更新的特定字段,多个逗号隔开 + + public String getId(){ + return id; + } + public void setId(String id ){ + this.id = id; + } + public String getFirstName(){ + return firstName; + } + public void setFirstName(String firstName ){ + this.firstName = firstName; + } + public String getSecondName(){ + return secondName; + } + public void setSecondName(String secondName ){ + this.secondName = secondName; + } + public String getUniversitiesCollegesName(){ + return universitiesCollegesName; + } + public void setUniversitiesCollegesName(String universitiesCollegesName ){ + this.universitiesCollegesName = universitiesCollegesName; + } + public Long getUniversitiesCollegesId(){ + return universitiesCollegesId; + } + public void setUniversitiesCollegesId(Long universitiesCollegesId ){ + this.universitiesCollegesId = universitiesCollegesId; + } + public StudentTeacherSystemUseLogAnalysisService.UseTypeEnum getUserType(){ + return userType; + } + public void setUserType(StudentTeacherSystemUseLogAnalysisService.UseTypeEnum userType ){ + this.userType = userType; + } + public String getProvince(){ + return province; + } + public void setProvince(String province ){ + this.province = province; + } + public String getDayTime(){ + return dayTime; + } + public void setDayTime(String dayTime ){ + this.dayTime = dayTime; + } + public Long getUseDuration(){ + return useDuration; + } + public void setUseDuration(Long useDuration ){ + this.useDuration = useDuration; + } + public Date getAddTime(){ + return addTime; + } + public void setAddTime(Date addTime ){ + this.addTime = addTime; + } + public Long getOrgId(){ + return orgId; + } + public void setOrgId(Long orgId ){ + this.orgId = orgId; + } + public Long getUserId(){ + return userId; + } + public void setUserId(Long userId ){ + this.userId = userId; + } + + public StudentTeacherSystemUseLogAnalysis pojo(){ + StudentTeacherSystemUseLogAnalysis pojo = new StudentTeacherSystemUseLogAnalysis(); + pojo.setId(this.getId()); + pojo.setFirstName(this.getFirstName()); + pojo.setSecondName(this.getSecondName()); + pojo.setUniversitiesCollegesName(this.getUniversitiesCollegesName()); + pojo.setUniversitiesCollegesId(this.getUniversitiesCollegesId()); + pojo.setUserType(this.getUserType()); + pojo.setProvince(this.getProvince()); + pojo.setDayTime(this.getDayTime()); + pojo.setUseDuration(this.getUseDuration()); + pojo.setAddTime(this.getAddTime()); + pojo.setOrgId(this.getOrgId()); + pojo.setUserId(this.getUserId()); + return pojo; + } + + public String getUniversitiesCollegesIdPlural(){ + return universitiesCollegesIdPlural; + } + public void setUniversitiesCollegesIdPlural(String universitiesCollegesIdPlural){ + this.universitiesCollegesIdPlural = universitiesCollegesIdPlural; + } + public String getOrgIdPlural(){ + return orgIdPlural; + } + public void setOrgIdPlural(String orgIdPlural){ + this.orgIdPlural = orgIdPlural; + } + public String getUserIdPlural(){ + return userIdPlural; + } + public void setUserIdPlural(String userIdPlural){ + this.userIdPlural = userIdPlural; + } + public String getStudentTeacherSystemUseLogAnalysisJsonStr(){ + return studentTeacherSystemUseLogAnalysisJsonStr; + } + public void setStudentTeacherSystemUseLogAnalysisJsonStr(String studentTeacherSystemUseLogAnalysisJsonStr ){ + this.studentTeacherSystemUseLogAnalysisJsonStr = studentTeacherSystemUseLogAnalysisJsonStr; + } + public String get_given() { + return _given; + } + public void set_given(String _given) { + this._given = _given; + } +} diff --git a/web/src/main/resources/sql/jlw/studentTeacherSystemUseLogAnalysis.md b/web/src/main/resources/sql/jlw/studentTeacherSystemUseLogAnalysis.md new file mode 100644 index 00000000..a754c3b2 --- /dev/null +++ b/web/src/main/resources/sql/jlw/studentTeacherSystemUseLogAnalysis.md @@ -0,0 +1,507 @@ +queryByCondition +=== +* 根据不为空的参数进行分页查询 + + select + @pageTag(){ + t.* + @} + from student_teacher_system_use_log_analysis t + where 1=1 + @//数据权限,该sql语句功能点,如果不考虑数据权限,可以删除此行 + and #function("studentTeacherSystemUseLogAnalysis.query")# + @if(!isEmpty(id)){ + and t.id =#id# + @} + @if(!isEmpty(firstName)){ + and t.first_name =#firstName# + @} + @if(!isEmpty(secondName)){ + and t.second_name =#secondName# + @} + @if(!isEmpty(universitiesCollegesName)){ + and t.universities_colleges_name =#universitiesCollegesName# + @} + @if(!isEmpty(universitiesCollegesId)){ + and t.universities_colleges_id =#universitiesCollegesId# + @} + @if(!isEmpty(universitiesCollegesIdPlural)){ + and find_in_set(t.universities_colleges_id,#universitiesCollegesIdPlural#) + @} + @if(!isEmpty(userType)){ + and t.user_type =#userType# + @} + @if(!isEmpty(province)){ + and t.province =#province# + @} + @if(!isEmpty(dayTime)){ + and t.day_time =#dayTime# + @} + @if(!isEmpty(useDuration)){ + and t.use_duration =#useDuration# + @} + @if(!isEmpty(addTime)){ + and t.add_time =#addTime# + @} + @if(!isEmpty(orgId)){ + and t.org_id =#orgId# + @} + @if(!isEmpty(orgIdPlural)){ + and find_in_set(t.org_id,#orgIdPlural#) + @} + @if(!isEmpty(userId)){ + and t.user_id =#userId# + @} + @if(!isEmpty(userIdPlural)){ + and find_in_set(t.user_id,#userIdPlural#) + @} + + +queryByConditionQuery +=== +* 根据不为空的参数进行分页查询(无权限) + + select + @pageTag(){ + t.* + @} + from student_teacher_system_use_log_analysis t + where 1=1 + @if(!isEmpty(id)){ + and t.id =#id# + @} + @if(!isEmpty(firstName)){ + and t.first_name =#firstName# + @} + @if(!isEmpty(secondName)){ + and t.second_name =#secondName# + @} + @if(!isEmpty(universitiesCollegesName)){ + and t.universities_colleges_name =#universitiesCollegesName# + @} + @if(!isEmpty(universitiesCollegesId)){ + and t.universities_colleges_id =#universitiesCollegesId# + @} + @if(!isEmpty(universitiesCollegesIdPlural)){ + and find_in_set(t.universities_colleges_id,#universitiesCollegesIdPlural#) + @} + @if(!isEmpty(userType)){ + and t.user_type =#userType# + @} + @if(!isEmpty(province)){ + and t.province =#province# + @} + @if(!isEmpty(dayTime)){ + and t.day_time =#dayTime# + @} + @if(!isEmpty(useDuration)){ + and t.use_duration =#useDuration# + @} + @if(!isEmpty(addTime)){ + and t.add_time =#addTime# + @} + @if(!isEmpty(orgId)){ + and t.org_id =#orgId# + @} + @if(!isEmpty(orgIdPlural)){ + and find_in_set(t.org_id,#orgIdPlural#) + @} + @if(!isEmpty(userId)){ + and t.user_id =#userId# + @} + @if(!isEmpty(userIdPlural)){ + and find_in_set(t.user_id,#userIdPlural#) + @} + + + + +deleteStudentTeacherSystemUseLogAnalysisByIds +=== + +* 批量删除 + + delete from student_teacher_system_use_log_analysis where find_in_set(id,#ids#) + + + +getByIds +=== + +select * from student_teacher_system_use_log_analysis where find_in_set(id,#ids#) + + +updateGivenByIds +=== + +* 批量更新指定字段,无论此字段是否有值 + + update student_teacher_system_use_log_analysis + set + @if(contain("firstName",_given)){ + @if(isEmpty(firstName)){ + first_name = null , + @}else{ + first_name = #firstName# , + @} + @} + @if(contain("secondName",_given)){ + @if(isEmpty(secondName)){ + second_name = null , + @}else{ + second_name = #secondName# , + @} + @} + @if(contain("universitiesCollegesName",_given)){ + @if(isEmpty(universitiesCollegesName)){ + universities_colleges_name = null , + @}else{ + universities_colleges_name = #universitiesCollegesName# , + @} + @} + @if(contain("universitiesCollegesId",_given)){ + @if(isEmpty(universitiesCollegesId)){ + universities_colleges_id = null , + @}else{ + universities_colleges_id = #universitiesCollegesId# , + @} + @} + @if(contain("userType",_given)){ + @if(isEmpty(userType)){ + user_type = null , + @}else{ + user_type = #userType# , + @} + @} + @if(contain("province",_given)){ + @if(isEmpty(province)){ + province = null , + @}else{ + province = #province# , + @} + @} + @if(contain("dayTime",_given)){ + @if(isEmpty(dayTime)){ + day_time = null , + @}else{ + day_time = #dayTime# , + @} + @} + @if(contain("useDuration",_given)){ + @if(isEmpty(useDuration)){ + use_duration = null , + @}else{ + use_duration = #useDuration# , + @} + @} + @if(contain("addTime",_given)){ + @if(isEmpty(addTime)){ + add_time = null , + @}else{ + add_time = #addTime# , + @} + @} + @if(contain("orgId",_given)){ + @if(isEmpty(orgId)){ + org_id = null , + @}else{ + org_id = #orgId# , + @} + @} + @if(contain("userId",_given)){ + @if(isEmpty(userId)){ + user_id = null , + @}else{ + user_id = #userId# , + @} + @} + id = id + where find_in_set(id,#idPlural#) + + + +getStudentTeacherSystemUseLogAnalysisValues +=== + +* 根据不为空的参数进行查询 + + select t.* + from student_teacher_system_use_log_analysis t + where 1=1 + @if(!isEmpty(id)){ + and t.id =#id# + @} + @if(!isEmpty(firstName)){ + and t.first_name =#firstName# + @} + @if(!isEmpty(secondName)){ + and t.second_name =#secondName# + @} + @if(!isEmpty(universitiesCollegesName)){ + and t.universities_colleges_name =#universitiesCollegesName# + @} + @if(!isEmpty(universitiesCollegesId)){ + and t.universities_colleges_id =#universitiesCollegesId# + @} + @if(!isEmpty(userType)){ + and t.user_type =#userType# + @} + @if(!isEmpty(province)){ + and t.province =#province# + @} + @if(!isEmpty(dayTime)){ + and t.day_time =#dayTime# + @} + @if(!isEmpty(useDuration)){ + and t.use_duration =#useDuration# + @} + @if(!isEmpty(addTime)){ + and t.add_time =#addTime# + @} + @if(!isEmpty(orgId)){ + and t.org_id =#orgId# + @} + @if(!isEmpty(userId)){ + and t.user_id =#userId# + @} + + +getValuesByQuery +=== + +* 根据不为空的参数进行查询 + + select t.* + from student_teacher_system_use_log_analysis t + where 1=1 and #function("studentTeacherSystemUseLogAnalysis.query")# + @if(!isEmpty(id)){ + and t.id =#id# + @} + @if(!isEmpty(firstName)){ + and t.first_name =#firstName# + @} + @if(!isEmpty(secondName)){ + and t.second_name =#secondName# + @} + @if(!isEmpty(universitiesCollegesName)){ + and t.universities_colleges_name =#universitiesCollegesName# + @} + @if(!isEmpty(universitiesCollegesId)){ + and t.universities_colleges_id =#universitiesCollegesId# + @} + @if(!isEmpty(universitiesCollegesIdPlural)){ + and find_in_set(t.universities_colleges_id,#universitiesCollegesIdPlural#) + @} + @if(!isEmpty(userType)){ + and t.user_type =#userType# + @} + @if(!isEmpty(province)){ + and t.province =#province# + @} + @if(!isEmpty(dayTime)){ + and t.day_time =#dayTime# + @} + @if(!isEmpty(useDuration)){ + and t.use_duration =#useDuration# + @} + @if(!isEmpty(addTime)){ + and t.add_time =#addTime# + @} + @if(!isEmpty(orgId)){ + and t.org_id =#orgId# + @} + @if(!isEmpty(orgIdPlural)){ + and find_in_set(t.org_id,#orgIdPlural#) + @} + @if(!isEmpty(userId)){ + and t.user_id =#userId# + @} + @if(!isEmpty(userIdPlural)){ + and find_in_set(t.user_id,#userIdPlural#) + @} + + +getValuesByQueryNotWithPermission +=== + +* 根据不为空的参数进行查询(不包含权限) + + select t.* + from student_teacher_system_use_log_analysis t + where 1=1 + @if(!isEmpty(id)){ + and t.id =#id# + @} + @if(!isEmpty(firstName)){ + and t.first_name =#firstName# + @} + @if(!isEmpty(secondName)){ + and t.second_name =#secondName# + @} + @if(!isEmpty(universitiesCollegesName)){ + and t.universities_colleges_name =#universitiesCollegesName# + @} + @if(!isEmpty(universitiesCollegesId)){ + and t.universities_colleges_id =#universitiesCollegesId# + @} + @if(!isEmpty(universitiesCollegesIdPlural)){ + and find_in_set(t.universities_colleges_id,#universitiesCollegesIdPlural#) + @} + @if(!isEmpty(userType)){ + and t.user_type =#userType# + @} + @if(!isEmpty(province)){ + and t.province =#province# + @} + @if(!isEmpty(dayTime)){ + and t.day_time =#dayTime# + @} + @if(!isEmpty(useDuration)){ + and t.use_duration =#useDuration# + @} + @if(!isEmpty(addTime)){ + and t.add_time =#addTime# + @} + @if(!isEmpty(orgId)){ + and t.org_id =#orgId# + @} + @if(!isEmpty(orgIdPlural)){ + and find_in_set(t.org_id,#orgIdPlural#) + @} + @if(!isEmpty(userId)){ + and t.user_id =#userId# + @} + @if(!isEmpty(userIdPlural)){ + and find_in_set(t.user_id,#userIdPlural#) + @} + + + + +getExcelValues +=== + +* 根据不为空的参数进行查询导入需要的参数 + + SELECT * FROM ( + ( + select + MAX(LENGTH(t.first_name)) first_name, + MAX(LENGTH(t.second_name)) second_name, + MAX(LENGTH(t.universities_colleges_name)) universities_colleges_name, + MAX(LENGTH(t.universities_colleges_id)) universities_colleges_id, + MAX(LENGTH(t.user_type)) user_type, + MAX(LENGTH(t.province)) province, + MAX(LENGTH(t.day_time)) day_time, + MAX(LENGTH(t.use_duration)) use_duration, + MAX(LENGTH(t.add_time)) add_time, + from student_teacher_system_use_log_analysis t + where 1=1 and #function("studentTeacherSystemUseLogAnalysis.query")# + @if(!isEmpty(id)){ + and t.id =#id# + @} + @if(!isEmpty(firstName)){ + and t.first_name =#firstName# + @} + @if(!isEmpty(secondName)){ + and t.second_name =#secondName# + @} + @if(!isEmpty(universitiesCollegesName)){ + and t.universities_colleges_name =#universitiesCollegesName# + @} + @if(!isEmpty(universitiesCollegesId)){ + and t.universities_colleges_id =#universitiesCollegesId# + @} + @if(!isEmpty(universitiesCollegesIdPlural)){ + and find_in_set(t.universities_colleges_id,#universitiesCollegesIdPlural#) + @} + @if(!isEmpty(userType)){ + and t.user_type =#userType# + @} + @if(!isEmpty(province)){ + and t.province =#province# + @} + @if(!isEmpty(dayTime)){ + and t.day_time =#dayTime# + @} + @if(!isEmpty(useDuration)){ + and t.use_duration =#useDuration# + @} + @if(!isEmpty(addTime)){ + and t.add_time =#addTime# + @} + @if(!isEmpty(orgId)){ + and t.org_id =#orgId# + @} + @if(!isEmpty(orgIdPlural)){ + and find_in_set(t.org_id,#orgIdPlural#) + @} + @if(!isEmpty(userId)){ + and t.user_id =#userId# + @} + @if(!isEmpty(userIdPlural)){ + and find_in_set(t.user_id,#userIdPlural#) + @} + ) + UNION ALL + ( + select + t.first_name , + t.second_name , + t.universities_colleges_name , + t.universities_colleges_id , + t.user_type , + t.province , + t.day_time , + t.use_duration , + t.add_time , + from student_teacher_system_use_log_analysis t + where 1=1 and #function("studentTeacherSystemUseLogAnalysis.query")# + @if(!isEmpty(id)){ + and t.id =#id# + @} + @if(!isEmpty(firstName)){ + and t.first_name =#firstName# + @} + @if(!isEmpty(secondName)){ + and t.second_name =#secondName# + @} + @if(!isEmpty(universitiesCollegesName)){ + and t.universities_colleges_name =#universitiesCollegesName# + @} + @if(!isEmpty(universitiesCollegesId)){ + and t.universities_colleges_id =#universitiesCollegesId# + @} + @if(!isEmpty(universitiesCollegesIdPlural)){ + and find_in_set(t.universities_colleges_id,#universitiesCollegesIdPlural#) + @} + @if(!isEmpty(userType)){ + and t.user_type =#userType# + @} + @if(!isEmpty(province)){ + and t.province =#province# + @} + @if(!isEmpty(dayTime)){ + and t.day_time =#dayTime# + @} + @if(!isEmpty(useDuration)){ + and t.use_duration =#useDuration# + @} + @if(!isEmpty(addTime)){ + and t.add_time =#addTime# + @} + @if(!isEmpty(orgId)){ + and t.org_id =#orgId# + @} + @if(!isEmpty(orgIdPlural)){ + and find_in_set(t.org_id,#orgIdPlural#) + @} + @if(!isEmpty(userId)){ + and t.user_id =#userId# + @} + @if(!isEmpty(userIdPlural)){ + and find_in_set(t.user_id,#userIdPlural#) + @} + ) + )t + diff --git a/web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/add.js b/web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/add.js new file mode 100644 index 00000000..b940865a --- /dev/null +++ b/web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/add.js @@ -0,0 +1,38 @@ +layui.define([ 'form', 'laydate', 'table','studentTeacherSystemUseLogAnalysisApi'], function(exports) { + var form = layui.form; + var studentTeacherSystemUseLogAnalysisApi = layui.studentTeacherSystemUseLogAnalysisApi; + var index = layui.index; + var view = { + init:function(){ + Lib.initGenrealForm($("#addForm"),form); + this.initSubmit(); + }, + initSubmit:function(){ + $("#addButton").click(function(){ + form.on('submit(form)', function(){ + var id = $("#addForm input[name='id']").val(); + if(!$.isEmpty(id)){ + studentTeacherSystemUseLogAnalysisApi.updateStudentTeacherSystemUseLogAnalysis($('#addForm'),function(){ + parent.window.dataReload(); + Common.info("更新成功"); + Lib.closeFrame(); + }); + }else{ + studentTeacherSystemUseLogAnalysisApi.addStudentTeacherSystemUseLogAnalysis($('#addForm'),function(){ + parent.window.dataReload(); + Common.info("添加成功"); + Lib.closeFrame(); + }); + } + + }); + }); + + $("#addButton-cancel").click(function(){ + Lib.closeFrame(); + }); + } + + } + exports('add',view); +}); diff --git a/web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/del.js b/web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/del.js new file mode 100644 index 00000000..e4f0cc2d --- /dev/null +++ b/web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/del.js @@ -0,0 +1,23 @@ +layui.define(['table', 'studentTeacherSystemUseLogAnalysisApi'], function(exports) { + var studentTeacherSystemUseLogAnalysisApi = layui.studentTeacherSystemUseLogAnalysisApi; + var table=layui.table; + var view = { + init:function(){ + }, + delBatch:function(){ + var data = Common.getMoreDataFromTable(table,"studentTeacherSystemUseLogAnalysisTable"); + if(data==null){ + return ; + } + Common.openConfirm("确认要删除这些学生教师行为分析?",function(){ + var ids =Common.concatBatchId(data,"id"); + studentTeacherSystemUseLogAnalysisApi.del(ids,function(){ + Common.info("删除成功"); + dataReload(); + }) + }) + } + } + exports('del',view); + +}); \ No newline at end of file diff --git a/web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/edit.js b/web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/edit.js new file mode 100644 index 00000000..888172f3 --- /dev/null +++ b/web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/edit.js @@ -0,0 +1,28 @@ +layui.define([ 'form', 'laydate', 'table','studentTeacherSystemUseLogAnalysisApi'], function(exports) { + var form = layui.form; + var studentTeacherSystemUseLogAnalysisApi = layui.studentTeacherSystemUseLogAnalysisApi; + var index = layui.index; + var view = { + init:function(){ + Lib.initGenrealForm($("#updateForm"),form); + this.initSubmit(); + }, + initSubmit:function(){ + $("#updateButton").click(function(){ + form.on('submit(form)', function(){ + studentTeacherSystemUseLogAnalysisApi.updateStudentTeacherSystemUseLogAnalysis($('#updateForm'),function(){ + parent.window.dataReload(); + Common.info("更新成功"); + Lib.closeFrame(); + }); + }); + }); + $("#updateButton-cancel").click(function(){ + Lib.closeFrame(); + }); + } + + } + exports('edit',view); + +}); \ No newline at end of file diff --git a/web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/index.js b/web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/index.js new file mode 100644 index 00000000..b1282d19 --- /dev/null +++ b/web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/index.js @@ -0,0 +1,224 @@ +layui.define([ 'form', 'laydate', 'table' ], function(exports) { + var form = layui.form; + var laydate = layui.laydate; + var table = layui.table; + var studentTeacherSystemUseLogAnalysisTable = null; + var view ={ + init:function(){ + var that = this + this.initTable(); + this.initSearchForm(); + this.initToolBar(); + window.dataReload = function(){ + Lib.doSearchForm($("#searchForm"),studentTeacherSystemUseLogAnalysisTable) + that.initToolBar(); + } + }, + initTable:function(){ + var sx_ = localStorage.getItem("studentTeacherSystemUseLogAnalysisTable_field_"+Common.userInfoId); //筛选值显示、隐藏缓存 + if($.isEmpty(sx_)){sx_ = {};}else {sx_ = JSON.parse(sx_);} + studentTeacherSystemUseLogAnalysisTable = table.render({ + elem : '#studentTeacherSystemUseLogAnalysisTable', + height : Lib.getTableHeight(1), + cellMinWidth: 100, + method : 'post', + url : Common.ctxPath + '/jlw/studentTeacherSystemUseLogAnalysis/list.json' // 数据接口 + ,page : Lib.tablePage // 开启分页 + ,toolbar: '#toolbar_studentTeacherSystemUseLogAnalysis' //自定义头部左侧工具栏 + ,defaultToolbar: ['filter', 'print', 'exports'] //头部右侧工具栏 + ,limit : 10, + cols : [ [ // 表头 + { + type : 'checkbox', + + }, + { + field : 'id', + title : '主键ID', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['id'])?false:sx_['id'], + + width : 60, + }, + { + field : 'firstName', + title : '一级名称', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['firstName'])?false:sx_['firstName'], + }, + { + field : 'secondName', + title : '二级名称', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['secondName'])?false:sx_['secondName'], + }, + { + field : 'universitiesCollegesName', + title : '院校名称', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['universitiesCollegesName'])?false:sx_['universitiesCollegesName'], + }, + { + field : 'universitiesCollegesId', + title : '院校ID', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['universitiesCollegesId'])?false:sx_['universitiesCollegesId'], + }, + { + field : 'userType', + title : '用户类型 UserTypeEnum', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['userType'])?false:sx_['userType'], + }, + { + field : 'province', + title : '所在省份', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['province'])?false:sx_['province'], + }, + { + field : 'dayTime', + title : '日期', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['dayTime'])?false:sx_['dayTime'], + }, + { + field : 'useDuration', + title : '使用时长', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['useDuration'])?false:sx_['useDuration'], + }, + { + field : 'addTime', + title : '创建时间', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['addTime'])?false:sx_['addTime'], + }, + { + field : 'orgId', + title : '机构ID', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['orgId'])?false:sx_['orgId'], + }, + { + field : 'userId', + title : '用户ID', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['userId'])?false:sx_['userId'], + } + ,{ + field : 'operation_',title : '操作',align:"center", templet: function (d) { + var htm = ''; + htm += ''; + return htm; + } + } + + ] ] + + }); + + table.on('checkbox(studentTeacherSystemUseLogAnalysisTable)', function(obj){ + var studentTeacherSystemUseLogAnalysis = obj.data; + if(obj.checked){ + //按钮逻辑Lib.buttonEnable() + }else{ + + } + }) + }, + + initSearchForm:function(){ + Lib.initSearchForm( $("#searchForm"),studentTeacherSystemUseLogAnalysisTable,form); + }, + + initToolBar:function(){ + toolbar = { + add: function () { + var url = "/jlw/studentTeacherSystemUseLogAnalysis/add.do"; + Common.openDlg(url,"学生教师行为分析管理>新增"); + }, + edit: function () { + var data = Common.getOneFromTable(table,"studentTeacherSystemUseLogAnalysisTable"); + if(data==null){ + return ; + } + var url = "/jlw/studentTeacherSystemUseLogAnalysis/add.do?id="+data.id; + Common.openDlg(url,"学生教师行为分析管理>"+data.id+">编辑"); + }, + del: function () { + layui.use(['del'], function(){ + var delView = layui.del + delView.delBatch(); + }); + }, + search: function () { + Lib.doSearchForm($("#searchForm"), studentTeacherSystemUseLogAnalysisTable, 1); + view.initToolBar() + }, + refresh: function () { + searchForm.reset(); + Lib.doSearchForm($("#searchForm"), studentTeacherSystemUseLogAnalysisTable, 1); + view.initToolBar() + }, + exportDocument: function () { + layui.use([ 'studentTeacherSystemUseLogAnalysisApi' ], function() { + var studentTeacherSystemUseLogAnalysisApi = layui.studentTeacherSystemUseLogAnalysisApi + Common.openConfirm("确认要导出这些学生教师行为分析数据?", function() { + studentTeacherSystemUseLogAnalysisApi.exportExcel($("#searchForm"), function(fileId) { + Lib.download(fileId); + }) + }) + }); + }, + importDocument: function () { + var uploadUrl = Common.ctxPath+"/jlw/studentTeacherSystemUseLogAnalysis/importTemplate.json"; + //模板, + var templatePath= Common.ctxPath+"/jlw/studentTeacherSystemUseLogAnalysis/downloadTemplate.json"; + //公共的简单上传文件处理 + var url = "/core/file/simpleUpload.do?uploadUrl="+uploadUrl+"&templatePath="+templatePath; + Common.openDlg(url, "学生教师行为分析管理>上传"); + } + } + //触发事件 + $('.ext-toolbar').on('click', function() { + var type = $(this).data('type'); + toolbar[type] ? toolbar[type].call(this) : ''; + }); + + }, initTableTool: table.on('tool(studentTeacherSystemUseLogAnalysisTable)', function (obj) { + var data = obj.data; + if (obj.event === 'edit') { + var url = "/jlw/studentTeacherSystemUseLogAnalysis/add.do?id="+data.id; + Common.openDlg(url,"学生教师行为分析管理>"+data.id+">编辑"); + }else if(obj.event === "del"){ + layer.confirm('是否确定删除该信息?', function (index) { + var ret = Common.postAjax("/jlw/studentTeacherSystemUseLogAnalysis/delete.json",{ids:data.id}); + layer.msg(ret.code == 0?"删除成功!":ret.msg, { + offset: ['50%'], + icon: ret.code == 0?1:2, + time: 1500 //2秒关闭(如果不配置,默认是3秒) + },function (){ + if(ret.code == 0){ + Lib.tableRefresh(); + } + }); + }); + } + }) + } + exports('index',view); + +}); diff --git a/web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/studentTeacherSystemUseLogAnalysisApi.js b/web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/studentTeacherSystemUseLogAnalysisApi.js new file mode 100644 index 00000000..37f40d08 --- /dev/null +++ b/web/src/main/resources/static/js/jlw/studentTeacherSystemUseLogAnalysis/studentTeacherSystemUseLogAnalysisApi.js @@ -0,0 +1,26 @@ +/*访问后台的代码*/ +layui.define([], function(exports) { + var api={ + updateStudentTeacherSystemUseLogAnalysis:function(form,callback){ + Lib.submitForm("/jlw/studentTeacherSystemUseLogAnalysis/edit.json",form,{},callback) + }, + addStudentTeacherSystemUseLogAnalysis:function(form,callback){ + Lib.submitForm("/jlw/studentTeacherSystemUseLogAnalysis/add.json",form,{},callback) + }, + del:function(ids,callback){ + Common.post("/jlw/studentTeacherSystemUseLogAnalysis/delete.json",{"ids":ids},function(){ + callback(); + }) + } + , + exportExcel:function(form,callback){ + var formPara = form.serializeJson(); + Common.downLoad("/jlw/studentTeacherSystemUseLogAnalysis/excel/export.json", formPara, 'POST') + // Common.post("/jlw/studentTeacherSystemUseLogAnalysis/excel/export.json", formPara, function(fileId) { + // callback(fileId); + // }) + } + + }; + exports('studentTeacherSystemUseLogAnalysisApi',api); +}); \ No newline at end of file diff --git a/web/src/main/resources/templates/jlw/studentTeacherSystemUseLogAnalysis/add.html b/web/src/main/resources/templates/jlw/studentTeacherSystemUseLogAnalysis/add.html new file mode 100644 index 00000000..9cebc923 --- /dev/null +++ b/web/src/main/resources/templates/jlw/studentTeacherSystemUseLogAnalysis/add.html @@ -0,0 +1,104 @@ + + +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+ + + + + + diff --git a/web/src/main/resources/templates/jlw/studentTeacherSystemUseLogAnalysis/edit.html b/web/src/main/resources/templates/jlw/studentTeacherSystemUseLogAnalysis/edit.html new file mode 100644 index 00000000..1ff23867 --- /dev/null +++ b/web/src/main/resources/templates/jlw/studentTeacherSystemUseLogAnalysis/edit.html @@ -0,0 +1,104 @@ + + +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+ + + + + + diff --git a/web/src/main/resources/templates/jlw/studentTeacherSystemUseLogAnalysis/index.html b/web/src/main/resources/templates/jlw/studentTeacherSystemUseLogAnalysis/index.html new file mode 100644 index 00000000..b1f24432 --- /dev/null +++ b/web/src/main/resources/templates/jlw/studentTeacherSystemUseLogAnalysis/index.html @@ -0,0 +1,31 @@ + + + +
+ + + +