From af1896ce3191bf73f2d1d819bd59c853367f555a Mon Sep 17 00:00:00 2001 From: ly19960718 <1622779752@qq.com> Date: Fri, 4 Jun 2021 15:31:30 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=9C=BA=E6=9E=84=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=89=BE=E5=9B=9E=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/indexcount/IndexCountController.java | 68 ++++++++++++++++--- src/main/resources/templates/index1.html | 38 ++--------- 2 files changed, 63 insertions(+), 43 deletions(-) diff --git a/src/main/java/cn/com/tenlion/controller/api/indexcount/IndexCountController.java b/src/main/java/cn/com/tenlion/controller/api/indexcount/IndexCountController.java index cfe0b94..2ef4ff9 100644 --- a/src/main/java/cn/com/tenlion/controller/api/indexcount/IndexCountController.java +++ b/src/main/java/cn/com/tenlion/controller/api/indexcount/IndexCountController.java @@ -178,16 +178,40 @@ public class IndexCountController extends DefaultBaseController { } - @ApiOperation(value = "统计当前登录机构分类教室", notes = "统计当前登录机构分类教室") + @ApiOperation(value = "统计当前培训机构的讲师占比", notes = "统计当前培训机构的讲师占比接口") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("count-teacher-num") - public SuccessResultData> countTeacher(){ - Map map = new HashMap<>(); + public SuccessResultData>> countTeacher(){ + List> list = new ArrayList<>(); + Map map0 = new HashMap<>(); + Map map1 = new HashMap<>(); + Map map2 = new HashMap<>(); String institutionId = this.getInstitutionId(); if(!StringUtils.isBlank(institutionId)){ - map = teacherService.count(institutionId); + Map resultMap = teacherService.count(institutionId); + if(resultMap == null){ + map0.put("name","其他"); + map0.put("value",0); + list.add(map0); + map1.put("name","专职"); + map1.put("value",0); + list.add(map1); + map2.put("name","兼职"); + map2.put("value",0); + list.add(map2); + }else{ + map0.put("name","其他"); + map0.put("value",resultMap.get("0").toString()); + list.add(map0); + map1.put("name","专职"); + map1.put("value",resultMap.get("1").toString()); + list.add(map1); + map2.put("name","兼职"); + map2.put("value",resultMap.get("2").toString()); + list.add(map2); + } } - return new SuccessResultData<>(map); + return new SuccessResultData<>(list); } @@ -206,14 +230,38 @@ public class IndexCountController extends DefaultBaseController { @ApiOperation(value = "统计当前机构计划分类占比", notes = "统计当前机构计划分类占比") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("count-plan-type") - public SuccessResultData> countPlanType(){ - Map map = new HashMap<>(); + public SuccessResultData>> countPlanType(){ + List> list = new ArrayList<>(); + Map map1 = new HashMap<>(); + Map map2 = new HashMap<>(); + Map map3 = new HashMap<>(); String institutionId = this.getInstitutionId(); if(!StringUtils.isBlank(institutionId)){ - map.put("orgId",institutionId); - map= classPlanService.countPlanType(institutionId); + Map resultMap= classPlanService.countPlanType(institutionId); + if(resultMap == null){ + map1.put("name","初训"); + map1.put("value",0); + list.add(map1); + map2.put("name","复训"); + map2.put("value",0); + list.add(map2); + map3.put("name","换证"); + map3.put("value",0); + list.add(map3); + }else{ + map1.put("name","初训"); + map1.put("value",resultMap.get("1")); + list.add(map1); + map2.put("name","复训"); + map2.put("value",resultMap.get("2")); + list.add(map2); + map3.put("name","换证"); + map3.put("value",resultMap.get("3")); + list.add(map3); + } + } - return new SuccessResultData<>(map); + return new SuccessResultData<>(list); } diff --git a/src/main/resources/templates/index1.html b/src/main/resources/templates/index1.html index 6e9700d..80a1b90 100644 --- a/src/main/resources/templates/index1.html +++ b/src/main/resources/templates/index1.html @@ -277,21 +277,7 @@ }, initTeacherEChart: function(){ top.restAjax.get('api/indexcount/count-teacher-num', {}, null, function(code, data) { - var dataList = []; - for(var i= 0;i<=2;i++){ - var datajson = {}; - if(i === 0){ - datajson['name'] = "其他" - } - if(i === 1){ - datajson['name'] = "专职" - } - if(i === 2){ - datajson['name'] = "兼职" - } - datajson['value'] = data.data[i+""] - dataList.push(datajson) - } + var dataList = data.data; self.teacherEChart = echarts.init(document.getElementById('teacherEChart')); self.teacherEChart.setOption( { @@ -304,7 +290,7 @@ }, series: [ { - name: '访问来源', + name: '讲师类型', type: 'pie', radius: '70%', data: dataList, @@ -325,22 +311,8 @@ }, initPlanEChart: function(){ top.restAjax.get('api/indexcount/count-plan-type', {}, null, function(code, data) { - var dataList = []; - for(var i= 1;i<=3;i++){ - var datajson = {}; - if(i === 1){ - datajson['name'] = "初训" - } - if(i === 2){ - datajson['name'] = "复训" - } - if(i === 3){ - datajson['name'] = "换证" - } - datajson['value'] = data.data[i+""] - dataList.push(datajson) - } - console.log(dataList) + var dataList = data.data; + self.teacherEChart = echarts.init(document.getElementById('planEChart')); self.teacherEChart.setOption( { @@ -353,7 +325,7 @@ }, series: [ { - name: '访问来源', + name: '培训类型', type: 'pie', radius: '70%', data: dataList, From 69c7102b59b1ec7f52b119ccb5cfd59013721c3f Mon Sep 17 00:00:00 2001 From: wans <747101512@qq.com> Date: Fri, 4 Jun 2021 17:10:55 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=8C=E5=B7=A5?= =?UTF-8?q?=E7=A7=8D=E4=B8=8B=E4=B8=8D=E5=8F=AF=E4=BB=A5=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=9B=B8=E5=90=8C=E8=BA=AB=E4=BB=BD=E8=AF=81=E5=8F=B7=E7=9A=84?= =?UTF-8?q?=E8=AE=B2=E5=B8=88=E7=9A=84=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../teacher/impl/TeacherServiceImpl.java | 17 +++++++++++++---- .../mybatis/mapper/teacher/teacher-mapper.xml | 3 +++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/cn/com/tenlion/service/teacher/impl/TeacherServiceImpl.java b/src/main/java/cn/com/tenlion/service/teacher/impl/TeacherServiceImpl.java index 35a9ce4..bf97c7a 100644 --- a/src/main/java/cn/com/tenlion/service/teacher/impl/TeacherServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/teacher/impl/TeacherServiceImpl.java @@ -91,16 +91,25 @@ public class TeacherServiceImpl extends DefaultBaseService implements ITeacherSe @Override public SuccessResultData save(String token, TeacherVO teacherVO) throws Exception { - // 同机构下讲师不可重复 String idCardNumber = teacherVO.getIdCardNumber(); if(idCardNumber == null || "".equals(idCardNumber)){ throw new SaveException("讲师证件号码不允许为空值"); } + if(teacherVO.getWorkerCategoryId() == null || "".equals(teacherVO.getWorkerCategoryId())){ + throw new SaveException("讲师授课工种不能为空值"); + } Map queryMap = getHashMap(8); + // 同工种下讲师不可重复,跨工种可以重复 + String WorkerCategoryIds[] = teacherVO.getWorkerCategoryId().split(","); queryMap.put("idCardNumber",idCardNumber); - TeacherDTO teacherDTO = teacherDao.get(queryMap); - if(teacherDTO != null && !"".equals(teacherDTO.getTeacherId())){ - throw new SaveException("您不能添加证件号码相同的讲师"); + for(int i = 0; i < WorkerCategoryIds.length;i++){ + queryMap.put("workerCategoryId",WorkerCategoryIds[i]); + TeacherDTO teacherDTO = teacherDao.get(queryMap); + if(teacherDTO != null && !"".equals(teacherDTO.getTeacherId())){ + throw new SaveException("该证件号码已在 【" + + teacherDTO.getWorkerCategoryName().split(",")[i] + + "】 工种中注册讲师"); + } } String teacherId = UUIDUtil.getUUID(); Map params = HashMapUtil.beanToMap(teacherVO); diff --git a/src/main/resources/mybatis/mapper/teacher/teacher-mapper.xml b/src/main/resources/mybatis/mapper/teacher/teacher-mapper.xml index 9df318d..0ca6bb2 100644 --- a/src/main/resources/mybatis/mapper/teacher/teacher-mapper.xml +++ b/src/main/resources/mybatis/mapper/teacher/teacher-mapper.xml @@ -162,6 +162,9 @@ AND t1.org_id = #{orgId} + + AND FIND_IN_SET( #{workerCategoryId},t1.worker_category_id) + AND t1.id_card_number = #{idCardNumber} From 749cec9a689a7e6fd19f5ba275de2705fcdda735 Mon Sep 17 00:00:00 2001 From: wans <747101512@qq.com> Date: Fri, 4 Jun 2021 17:13:05 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=BC=80=E7=8F=AD=E8=AE=A1=E5=88=92=E6=97=B6PDF=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E6=97=B6=E9=81=AE=E7=9B=96=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/route/classplan/save.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/static/route/classplan/save.html b/src/main/resources/static/route/classplan/save.html index db1d758..ef4c1da 100644 --- a/src/main/resources/static/route/classplan/save.html +++ b/src/main/resources/static/route/classplan/save.html @@ -276,7 +276,7 @@ // 初始化内容 function initData() { - $('.layui-card').height($(window).height()); + $('.layui-card').height($('.layui-card').height()); initPlanStartTimeDateTime(); initPlanEndTimeDateTime(); initTeacherList(); From 90c0f126a23a65aa49d23924866644d45c53ec6e Mon Sep 17 00:00:00 2001 From: wans <747101512@qq.com> Date: Fri, 4 Jun 2021 17:17:18 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/route/classplan/save.html | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/resources/static/route/classplan/save.html b/src/main/resources/static/route/classplan/save.html index ef4c1da..5708152 100644 --- a/src/main/resources/static/route/classplan/save.html +++ b/src/main/resources/static/route/classplan/save.html @@ -276,7 +276,6 @@ // 初始化内容 function initData() { - $('.layui-card').height($('.layui-card').height()); initPlanStartTimeDateTime(); initPlanEndTimeDateTime(); initTeacherList();