Merge remote-tracking branch 'origin/baotou-signup' into baotou-signup

This commit is contained in:
Renpc-kilig 2021-06-04 17:52:51 +08:00
commit b5ed2516ba
5 changed files with 79 additions and 48 deletions

View File

@ -178,16 +178,40 @@ public class IndexCountController extends DefaultBaseController {
} }
@ApiOperation(value = "统计当前登录机构分类教室", notes = "统计当前登录机构分类教室") @ApiOperation(value = "统计当前培训机构的讲师占比", notes = "统计当前培训机构的讲师占比接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("count-teacher-num") @GetMapping("count-teacher-num")
public SuccessResultData<Map<String, Object>> countTeacher(){ public SuccessResultData<List<Map<String, Object>>> countTeacher(){
Map<String,Object> map = new HashMap<>(); List<Map<String, Object>> list = new ArrayList<>();
Map<String,Object> map0 = new HashMap<>();
Map<String,Object> map1 = new HashMap<>();
Map<String,Object> map2 = new HashMap<>();
String institutionId = this.getInstitutionId(); String institutionId = this.getInstitutionId();
if(!StringUtils.isBlank(institutionId)){ if(!StringUtils.isBlank(institutionId)){
map = teacherService.count(institutionId); Map<String,Object> 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 = "统计当前机构计划分类占比") @ApiOperation(value = "统计当前机构计划分类占比", notes = "统计当前机构计划分类占比")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("count-plan-type") @GetMapping("count-plan-type")
public SuccessResultData<Map<String, Object>> countPlanType(){ public SuccessResultData<List<Map<String, Object>>> countPlanType(){
Map<String, Object> map = new HashMap<>(); List<Map<String, Object>> list = new ArrayList<>();
Map<String, Object> map1 = new HashMap<>();
Map<String, Object> map2 = new HashMap<>();
Map<String, Object> map3 = new HashMap<>();
String institutionId = this.getInstitutionId(); String institutionId = this.getInstitutionId();
if(!StringUtils.isBlank(institutionId)){ if(!StringUtils.isBlank(institutionId)){
map.put("orgId",institutionId); Map<String, Object> resultMap= classPlanService.countPlanType(institutionId);
map= 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);
} }

View File

@ -91,16 +91,25 @@ public class TeacherServiceImpl extends DefaultBaseService implements ITeacherSe
@Override @Override
public SuccessResultData save(String token, TeacherVO teacherVO) throws Exception { public SuccessResultData save(String token, TeacherVO teacherVO) throws Exception {
// 同机构下讲师不可重复
String idCardNumber = teacherVO.getIdCardNumber(); String idCardNumber = teacherVO.getIdCardNumber();
if(idCardNumber == null || "".equals(idCardNumber)){ if(idCardNumber == null || "".equals(idCardNumber)){
throw new SaveException("讲师证件号码不允许为空值"); throw new SaveException("讲师证件号码不允许为空值");
} }
if(teacherVO.getWorkerCategoryId() == null || "".equals(teacherVO.getWorkerCategoryId())){
throw new SaveException("讲师授课工种不能为空值");
}
Map<String, Object> queryMap = getHashMap(8); Map<String, Object> queryMap = getHashMap(8);
// 同工种下讲师不可重复跨工种可以重复
String WorkerCategoryIds[] = teacherVO.getWorkerCategoryId().split(",");
queryMap.put("idCardNumber",idCardNumber); queryMap.put("idCardNumber",idCardNumber);
TeacherDTO teacherDTO = teacherDao.get(queryMap); for(int i = 0; i < WorkerCategoryIds.length;i++){
if(teacherDTO != null && !"".equals(teacherDTO.getTeacherId())){ queryMap.put("workerCategoryId",WorkerCategoryIds[i]);
throw new SaveException("您不能添加证件号码相同的讲师"); TeacherDTO teacherDTO = teacherDao.get(queryMap);
if(teacherDTO != null && !"".equals(teacherDTO.getTeacherId())){
throw new SaveException("该证件号码已在 【"
+ teacherDTO.getWorkerCategoryName().split(",")[i]
+ "】 工种中注册讲师");
}
} }
String teacherId = UUIDUtil.getUUID(); String teacherId = UUIDUtil.getUUID();
Map<String, Object> params = HashMapUtil.beanToMap(teacherVO); Map<String, Object> params = HashMapUtil.beanToMap(teacherVO);

View File

@ -162,6 +162,9 @@
<if test="orgId != null and orgId != ''"> <if test="orgId != null and orgId != ''">
AND t1.org_id = #{orgId} AND t1.org_id = #{orgId}
</if> </if>
<if test="workerCategoryId != null and workerCategoryId != ''">
AND FIND_IN_SET( #{workerCategoryId},t1.worker_category_id)
</if>
<if test="idCardNumber != null and idCardNumber != ''"> <if test="idCardNumber != null and idCardNumber != ''">
AND t1.id_card_number = #{idCardNumber} AND t1.id_card_number = #{idCardNumber}
</if> </if>

View File

@ -276,7 +276,6 @@
// 初始化内容 // 初始化内容
function initData() { function initData() {
$('.layui-card').height($(window).height());
initPlanStartTimeDateTime(); initPlanStartTimeDateTime();
initPlanEndTimeDateTime(); initPlanEndTimeDateTime();
initTeacherList(); initTeacherList();

View File

@ -277,21 +277,7 @@
}, },
initTeacherEChart: function(){ initTeacherEChart: function(){
top.restAjax.get('api/indexcount/count-teacher-num', {}, null, function(code, data) { top.restAjax.get('api/indexcount/count-teacher-num', {}, null, function(code, data) {
var dataList = []; var dataList = data.data;
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)
}
self.teacherEChart = echarts.init(document.getElementById('teacherEChart')); self.teacherEChart = echarts.init(document.getElementById('teacherEChart'));
self.teacherEChart.setOption( self.teacherEChart.setOption(
{ {
@ -304,7 +290,7 @@
}, },
series: [ series: [
{ {
name: '访问来源', name: '讲师类型',
type: 'pie', type: 'pie',
radius: '70%', radius: '70%',
data: dataList, data: dataList,
@ -325,22 +311,8 @@
}, },
initPlanEChart: function(){ initPlanEChart: function(){
top.restAjax.get('api/indexcount/count-plan-type', {}, null, function(code, data) { top.restAjax.get('api/indexcount/count-plan-type', {}, null, function(code, data) {
var dataList = []; var dataList = data.data;
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)
self.teacherEChart = echarts.init(document.getElementById('planEChart')); self.teacherEChart = echarts.init(document.getElementById('planEChart'));
self.teacherEChart.setOption( self.teacherEChart.setOption(
{ {
@ -353,7 +325,7 @@
}, },
series: [ series: [
{ {
name: '访问来源', name: '培训类型',
type: 'pie', type: 'pie',
radius: '70%', radius: '70%',
data: dataList, data: dataList,