2023年6月3日 新增听课日志,修改同步数据逻辑
This commit is contained in:
parent
a8c912f83d
commit
d672d9b237
|
@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.modules.kc.grab.SynchronizationService.base.BaseSync;
|
||||
import org.jeecg.modules.kc.grab.SynchronizationService.tools.ChangeTingKeTongJi;
|
||||
import org.jeecg.modules.kc.grab.imports.entity.Xxhbbkjxtkpj;
|
||||
import org.jeecg.modules.kc.grab.imports.entity.Xxhbsynclog;
|
||||
import org.jeecg.modules.kc.ktgl.entity.KcKetangbiao;
|
||||
|
@ -61,6 +62,8 @@ public class SyncOldEvaluation extends BaseSync {
|
|||
//----------------------------------纸质评价(后台导入)------------------------------------------
|
||||
//----------------------------------纸质评价(后台导入)END------------------------------------------
|
||||
|
||||
@Autowired
|
||||
private ChangeTingKeTongJi changeTingKeTongJi;
|
||||
|
||||
|
||||
Map<String,String> queOptionMap = Maps.newHashMap();
|
||||
|
@ -203,8 +206,8 @@ public class SyncOldEvaluation extends BaseSync {
|
|||
main.setUpDate(DateUtil.parse(x.getPksj(),NORM_DATE_PATTERN));
|
||||
// main.setUpTime(DateUtil.parse(x.getPksj(),NORM_TIME_PATTERN));//数据中没有时间,
|
||||
main.setUpTimestamp(x.getPksj());
|
||||
|
||||
main.setUpuser(x.getTkjs());
|
||||
// main.setUserid(x.getTkjgh());
|
||||
if(StringUtils.isNotBlank(x.getTkjgh())){
|
||||
main.setUpuserid(Integer.parseInt(x.getTkjgh()));
|
||||
}
|
||||
|
@ -256,6 +259,10 @@ public class SyncOldEvaluation extends BaseSync {
|
|||
// String optionId9 = queOptionMap.get(main.getAnswer10());
|
||||
|
||||
kcEvaluationService.save(main);
|
||||
//添加听课日志
|
||||
if(StringUtils.isNotBlank(main.getMinkcid())){
|
||||
changeTingKeTongJi.addTingKeData(String.valueOf(main.getUpuserid()),main.getMinkcid(),main.getUpDate());
|
||||
}
|
||||
|
||||
for (int i = 1; 10 >= i; i++){
|
||||
String optionId = "";
|
||||
|
@ -304,7 +311,9 @@ public class SyncOldEvaluation extends BaseSync {
|
|||
//kcEvaluationService.saveBatch(saveMainList);
|
||||
kcEvaluationsService.saveBatch(saveChildList);
|
||||
|
||||
// List<KcEvaluationque> saveList = Lists.newArrayList();
|
||||
changeTingKeTongJi.changeTingKeTongji();
|
||||
|
||||
// List<KcEvaluationque> saveList = Lists.newArrayList();
|
||||
//
|
||||
//
|
||||
// //删除旧数据
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.modules.kc.grab.SynchronizationService;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
@ -8,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.modules.kc.grab.SynchronizationService.base.BaseSync;
|
||||
import org.jeecg.modules.kc.grab.SynchronizationService.tools.ChangeTingKeTongJi;
|
||||
import org.jeecg.modules.kc.grab.imports.entity.Xxhbbkjxtkpj;
|
||||
import org.jeecg.modules.kc.grab.imports.entity.Xxhbsynclog;
|
||||
import org.jeecg.modules.kc.grab.imports.service.IXxhbbkjxtkpjService;
|
||||
|
@ -15,18 +17,18 @@ import org.jeecg.modules.kc.ktgl.entity.KcKetangbiao;
|
|||
import org.jeecg.modules.kc.ktgl.service.IKcKetangbiaoService;
|
||||
import org.jeecg.modules.kc.qa.entity.KcEvaluation;
|
||||
import org.jeecg.modules.kc.qa.entity.KcEvaluations;
|
||||
import org.jeecg.modules.kc.qa.entity.KcOldEvaluationans;
|
||||
import org.jeecg.modules.kc.qa.entity.KcOldEvaluationque;
|
||||
import org.jeecg.modules.kc.qa.service.*;
|
||||
import org.jeecg.modules.kc.qa.service.IKcEvaluationService;
|
||||
import org.jeecg.modules.kc.qa.service.IKcEvaluationansService;
|
||||
import org.jeecg.modules.kc.qa.service.IKcEvaluationqueService;
|
||||
import org.jeecg.modules.kc.qa.service.IKcEvaluationsService;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMAT;
|
||||
import static cn.hutool.core.date.DatePattern.NORM_TIME_FORMAT;
|
||||
|
||||
/**
|
||||
* 同步旧版本调查问卷
|
||||
*/
|
||||
|
@ -64,6 +66,9 @@ public class SyncZwdtEvaluation extends BaseSync {
|
|||
//----------------------------------纸质评价(后台导入)------------------------------------------
|
||||
//----------------------------------纸质评价(后台导入)END------------------------------------------
|
||||
|
||||
@Autowired
|
||||
private ChangeTingKeTongJi changeTingKeTongJi;
|
||||
|
||||
|
||||
Map<String,String> queOptionMap = Maps.newHashMap();
|
||||
Map<String,String> ansOptionMap = Maps.newHashMap();
|
||||
|
@ -176,7 +181,7 @@ public class SyncZwdtEvaluation extends BaseSync {
|
|||
|
||||
DateTime now = DateUtil.date();
|
||||
|
||||
boolean isAll = true;
|
||||
boolean isAll = false;
|
||||
if(param != null){
|
||||
if(param.containsKey("isAll")){
|
||||
String isAllStr = (String)param.get("isAll");
|
||||
|
@ -192,28 +197,30 @@ public class SyncZwdtEvaluation extends BaseSync {
|
|||
}
|
||||
|
||||
}
|
||||
//时间得减一天
|
||||
now = DateUtil.offsetDay(now,-1);
|
||||
|
||||
String nowStr = DateUtil.format(now,DatePattern.NORM_DATE_FORMAT);
|
||||
|
||||
int source = 2;
|
||||
|
||||
//删除旧数据
|
||||
QueryWrapper<KcEvaluation> kcEvaluation = new QueryWrapper<>();
|
||||
kcEvaluation.eq("source",source);
|
||||
if(isAll){
|
||||
kcEvaluation.eq("up_timestamp",now);
|
||||
}
|
||||
kcEvaluation.eq(!isAll,"up_timestamp",nowStr);
|
||||
kcEvaluationService.remove(kcEvaluation);
|
||||
QueryWrapper<KcEvaluations> kcEvaluations = new QueryWrapper<>();
|
||||
kcEvaluations.eq("source",source);
|
||||
if(isAll) {
|
||||
kcEvaluations.eq("up_timestamp", now);
|
||||
}
|
||||
kcEvaluations.eq(!isAll,"up_timestamp", nowStr);
|
||||
kcEvaluationsService.remove(kcEvaluations);
|
||||
|
||||
|
||||
//查询数据
|
||||
QueryWrapper<Xxhbbkjxtkpj> inQw = new QueryWrapper<>();
|
||||
inQw.eq("timestamps",now);
|
||||
inQw.eq(!isAll,"timestamps",nowStr);
|
||||
//筛选符合条件的答案
|
||||
inQw.like("tksjxq","(");
|
||||
inQw.notLike("tksjxq","()");
|
||||
inQw.in("jspg1","A", "B", "C", "D", "E");
|
||||
inQw.in("jspg2","A", "B", "C", "D", "E");
|
||||
inQw.in("jspg3","A", "B", "C", "D", "E");
|
||||
|
@ -232,9 +239,20 @@ public class SyncZwdtEvaluation extends BaseSync {
|
|||
|
||||
inDataList.forEach(x -> {
|
||||
KcEvaluation main = new KcEvaluation();
|
||||
main.setUpDate(x.getTimestamps());
|
||||
main.setUpTime(x.getTimestamps());
|
||||
main.setUpTimestamp(DateUtil.format(x.getTimestamps(),NORM_DATETIME_FORMAT));
|
||||
|
||||
//类似这样的。。2020年春季第17周星期一(2020年06月14日) 2020年春季第8周星期三(2020年04月14日)
|
||||
String tksjxq = x.getTksjxq();
|
||||
if(StringUtils.isNotBlank(tksjxq)){
|
||||
int startIndex = StringUtils.indexOf(tksjxq,"(");
|
||||
int endIndex = StringUtils.indexOf(tksjxq,")");
|
||||
if(startIndex != -1 && endIndex != -1){
|
||||
String dateStr = StringUtils.substring(tksjxq,startIndex+1,endIndex);
|
||||
Date pksj = DateUtil.parse(dateStr);
|
||||
main.setUpDate(pksj);
|
||||
main.setUpTime(pksj);
|
||||
main.setUpTimestamp(DateUtil.format(pksj, DatePattern.NORM_DATE_FORMAT));
|
||||
}
|
||||
}
|
||||
main.setUpuser(x.getTkrxm());
|
||||
// main.setUserid(x.getTkrgh());
|
||||
if(StringUtils.isNotBlank(x.getTkrgh())){
|
||||
|
@ -291,6 +309,11 @@ public class SyncZwdtEvaluation extends BaseSync {
|
|||
|
||||
kcEvaluationService.save(main);
|
||||
|
||||
//添加听课日志
|
||||
if(StringUtils.isNotBlank(main.getMinkcid())){
|
||||
changeTingKeTongJi.addTingKeData(String.valueOf(main.getUpuserid()),main.getMinkcid(),main.getUpDate());
|
||||
}
|
||||
|
||||
for (int i = 1; 10 >= i; i++){
|
||||
String optionId = "";
|
||||
String ansKey = "";
|
||||
|
@ -309,7 +332,7 @@ public class SyncZwdtEvaluation extends BaseSync {
|
|||
KcEvaluations child = new KcEvaluations();
|
||||
child.setUpDate(x.getTimestamps());
|
||||
child.setUpTime(x.getTimestamps());
|
||||
child.setUpTimestamp(DateUtil.format(x.getTimestamps(),NORM_DATETIME_FORMAT));
|
||||
child.setUpTimestamp(DateUtil.format(x.getTimestamps(),DatePattern.NORM_DATETIME_FORMAT));
|
||||
child.setUpuser(x.getTkrxm());
|
||||
child.setUpuserid(x.getTkrgh());
|
||||
child.setKetangbiaoid(ketangbiao.getId());//用上面的ID
|
||||
|
@ -337,6 +360,8 @@ public class SyncZwdtEvaluation extends BaseSync {
|
|||
//kcEvaluationService.saveBatch(saveMainList);
|
||||
kcEvaluationsService.saveBatch(saveChildList);
|
||||
// List<KcEvaluationque> saveList = Lists.newArrayList();
|
||||
|
||||
changeTingKeTongJi.changeTingKeTongji();
|
||||
//
|
||||
//
|
||||
// //删除旧数据
|
||||
|
@ -363,4 +388,18 @@ public class SyncZwdtEvaluation extends BaseSync {
|
|||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
//类似这样的。。2020年春季第17周星期一(2020年06月14日) 2020年春季第8周星期三(2020年04月14日)
|
||||
String tksjxq = "2020年春季第17周星期一(2020年06月14日)";
|
||||
if(StringUtils.isNotBlank(tksjxq)){
|
||||
int startIndex = StringUtils.indexOf(tksjxq,"(");
|
||||
int endIndex = StringUtils.indexOf(tksjxq,")");
|
||||
if(startIndex != -1 && endIndex != -1){
|
||||
String dateStr = StringUtils.substring(tksjxq,startIndex+1,endIndex);
|
||||
System.out.println(dateStr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,352 @@
|
|||
package org.jeecg.modules.kc.grab.SynchronizationService.tools;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.beust.jcommander.internal.Sets;
|
||||
import com.google.common.collect.Maps;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecg.modules.kc.grab.imports.entity.Xxhbuser;
|
||||
import org.jeecg.modules.kc.grab.imports.service.IXxhbuserService;
|
||||
import org.jeecg.modules.kc.kcSysConfig.entity.KcSysConfig;
|
||||
import org.jeecg.modules.kc.kcSysConfig.service.IKcSysConfigService;
|
||||
import org.jeecg.modules.kc.qa.entity.KcEvaluation;
|
||||
import org.jeecg.modules.kc.qa.service.IKcEvaluationService;
|
||||
import org.jeecg.modules.kc.tksf.kctkcstj.entity.KcTkcstj;
|
||||
import org.jeecg.modules.kc.tksf.kctkcstj.service.IKcTkcstjService;
|
||||
import org.jeecg.modules.kc.tksf.kctksfrzb.entity.KcTksfrzb;
|
||||
import org.jeecg.modules.kc.tksf.kctksfrzb.service.IKcTksfrzbService;
|
||||
import org.jeecg.modules.kc.tktj.entity.KcTingke;
|
||||
import org.jeecg.modules.kc.tktj.service.IKcTingkeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 清洗听课统计
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ChangeTingKeTongJi {
|
||||
|
||||
@Autowired
|
||||
private IKcSysConfigService kcSysConfigService;
|
||||
|
||||
@Autowired
|
||||
private IKcTkcstjService kcTkcstjService;
|
||||
|
||||
@Autowired
|
||||
private IKcTksfrzbService kcTksfrzbService;
|
||||
|
||||
@Autowired
|
||||
private IXxhbuserService xxhbuserService;
|
||||
|
||||
@Autowired
|
||||
private IKcEvaluationService kcEvaluationService;//正在使用问题(回答主表)
|
||||
|
||||
@Autowired
|
||||
private IKcTingkeService kcTingkeService;
|
||||
|
||||
public KcSysConfig getXqConfig(){
|
||||
return kcSysConfigService.getById("1");
|
||||
}
|
||||
|
||||
public void changeTingKeTongji(){
|
||||
//全部
|
||||
updateTingKeTongJiByUserId(null);
|
||||
}
|
||||
|
||||
public void updateTingKeTongJiByUserId(String userId){
|
||||
KcSysConfig common = getXqConfig();
|
||||
if(common != null) {
|
||||
//Map<String, KcTkcstj> tongJiMap = Maps.newHashMap();
|
||||
//清洗数据核心
|
||||
String startSj = common.getBxqkssj();
|
||||
String endSj = common.getBxqjssj();
|
||||
String xqxn = common.getFlag1();
|
||||
|
||||
Set<String> tjSet = Sets.newHashSet();
|
||||
//此法会造成数据变多,,改为新方法统计
|
||||
// saveMainList.forEach(x -> {
|
||||
// //先过滤数据为本学期的。
|
||||
// Date pkDate = x.getUpDate();
|
||||
// long startDiffer = DateUtil.between(DateUtil.parse(startSj), pkDate, DateUnit.DAY,true);
|
||||
// long endDiffer = DateUtil.between(pkDate, DateUtil.parse(endSj), DateUnit.DAY,true);
|
||||
//
|
||||
// if(startDiffer > 0 && endDiffer > 0){
|
||||
// tjSet.add(x.getUserid());
|
||||
// if(tongJiMap.containsKey(x.getUserid())){
|
||||
// KcTkcstj tj = tongJiMap.get(x.getUserid());
|
||||
// String tks = tj.getTkxttj();
|
||||
// tj.setTkxttj(String.valueOf(Integer.parseInt(tks)+1));//听课数量+1
|
||||
// }else{
|
||||
// KcTkcstj tj = new KcTkcstj();
|
||||
// tj.setXnxq(xqxn);//学期学年
|
||||
// tj.setJgh(x.getUserid());
|
||||
// //tj.setJsxm("");//后面补
|
||||
// //tj.setSsxy();
|
||||
// //tj.setTksf();
|
||||
// //tj.setYskcs();
|
||||
// tj.setTkxttj("0");
|
||||
// tongJiMap.put(x.getUserid(),tj);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
QueryWrapper<KcEvaluation> evaQw = new QueryWrapper<>();
|
||||
evaQw.select("count(upuserid) as pkNum,upuserid");
|
||||
evaQw.eq(StringUtils.isNotBlank(userId),"upuserid",userId);
|
||||
evaQw.apply("up_date >= STR_TO_DATE('"+ startSj +"', '%Y-%m-%d') ");
|
||||
evaQw.apply("up_date <= STR_TO_DATE('"+ endSj +"', '%Y-%m-%d') ");
|
||||
evaQw.groupBy("upuserid");
|
||||
evaQw.orderByAsc("up_date");
|
||||
List<KcEvaluation> countTjList = kcEvaluationService.list(evaQw);
|
||||
|
||||
//Map<String, KcEvaluation> countTj = Maps.newHashMap();
|
||||
countTjList.forEach(x -> {
|
||||
Integer ixuserId = x.getUpuserid();
|
||||
String xuserId = String.valueOf(ixuserId);
|
||||
tjSet.add(xuserId);
|
||||
//countTj.put(x.getUserid(),x);
|
||||
});
|
||||
|
||||
if(tjSet.isEmpty()){
|
||||
log.error("工号为空,咋办?");
|
||||
return;
|
||||
}
|
||||
|
||||
//查询所在单位
|
||||
QueryWrapper<Xxhbuser> szdwQw = new QueryWrapper<>();
|
||||
szdwQw.in("gh",tjSet);
|
||||
List<Xxhbuser> szdwList = xxhbuserService.list(szdwQw);
|
||||
Map<String, Xxhbuser> szdwMap = Maps.newHashMap();
|
||||
szdwList.forEach(x -> {
|
||||
szdwMap.put(x.getGh(),x);
|
||||
});
|
||||
|
||||
//查询听课身份
|
||||
QueryWrapper<KcTksfrzb> tksfQw = new QueryWrapper<>();
|
||||
tksfQw.in("gh",tjSet);
|
||||
List<KcTksfrzb> tksfList = kcTksfrzbService.list(tksfQw);
|
||||
Map<String, KcTksfrzb> tksfMap = Maps.newHashMap();
|
||||
tksfList.forEach(x -> {
|
||||
if(tksfMap.containsKey(x.getGh())){
|
||||
//存在了,拼接职务名称,取最大的听课要求
|
||||
KcTksfrzb currentData = tksfMap.get(x.getGh());
|
||||
String currentZwmc = currentData.getZwmc();
|
||||
String currentTkyq = currentData.getTkyq();
|
||||
if(StringUtils.isNotBlank(currentTkyq)){
|
||||
int tkyq = Integer.parseInt(currentTkyq);
|
||||
int xtkyq = Integer.parseInt(x.getTkyq());
|
||||
x.setZwmc(currentZwmc + "、" + x.getZwmc());
|
||||
if(tkyq > xtkyq){
|
||||
x.setTkyq(String.valueOf(tkyq));
|
||||
}else{
|
||||
x.setTkyq(String.valueOf(xtkyq));
|
||||
}
|
||||
}
|
||||
tksfMap.put(x.getGh(),x);
|
||||
}else {
|
||||
tksfMap.put(x.getGh(),x);
|
||||
}
|
||||
});
|
||||
|
||||
//删除已有听课数据重新生成
|
||||
QueryWrapper<KcTkcstj> tjQw = new QueryWrapper<>();
|
||||
tjQw.eq(StringUtils.isNotBlank(userId),"jgh",userId);
|
||||
tjQw.eq("xnxq",xqxn);
|
||||
tjQw.in("jgh",tjSet);
|
||||
kcTkcstjService.remove(tjQw);
|
||||
|
||||
//查询已有听课数据
|
||||
// QueryWrapper<KcTkcstj> tjQw = new QueryWrapper<>();
|
||||
// tjQw.eq("xnxq",xqxn);
|
||||
// tjQw.in("jgh",tjSet);
|
||||
// List<KcTkcstj> tjList = kcTkcstjService.list(tjQw);
|
||||
// Map<String, KcTkcstj> tjMap = Maps.newHashMap();
|
||||
// tjList.forEach(x -> {
|
||||
// tjMap.put(x.getJgh(),x);
|
||||
// //刷新身份和听课要求
|
||||
// if(tksfMap.containsKey(x.getJgh())){
|
||||
// KcTksfrzb currentData = tksfMap.get(x.getJgh());
|
||||
// x.setTksf(currentData.getZwmc());
|
||||
// x.setYskcs(currentData.getTkyq());
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
// List<KcTkcstj> updateTjList = Lists.newArrayList();
|
||||
List<KcTkcstj> addTjList = Lists.newArrayList();
|
||||
countTjList.forEach(x-> {
|
||||
KcTkcstj tj = new KcTkcstj();
|
||||
//填充所在单位
|
||||
Integer ixuserId = x.getUpuserid();
|
||||
String xuserId = String.valueOf(ixuserId);
|
||||
|
||||
tj.setXnxq(xqxn);
|
||||
tj.setJgh(xuserId);
|
||||
if(szdwMap.containsKey(xuserId)){
|
||||
Xxhbuser currentData = szdwMap.get(xuserId);
|
||||
tj.setSsxy(currentData.getDwmc());
|
||||
}
|
||||
if(tksfMap.containsKey(xuserId)){
|
||||
KcTksfrzb currentData = tksfMap.get(xuserId);
|
||||
tj.setJsxm(currentData.getXm());
|
||||
tj.setTksf(currentData.getZwmc());
|
||||
tj.setYskcs(currentData.getTkyq());
|
||||
}
|
||||
tj.setTkxttj(String.valueOf(x.getPkNum()));
|
||||
addTjList.add(tj);
|
||||
});
|
||||
|
||||
// tongJiMap.forEach((k,v) -> {
|
||||
// if(tjMap.containsKey(k)){
|
||||
// //旧数据更新
|
||||
// KcTkcstj tjData = tjMap.get(k);
|
||||
// v.setJsxm(tjData.getJsxm());
|
||||
// v.setSsxy(tjData.getSsxy());
|
||||
// v.setTksf(tjData.getTksf());
|
||||
// v.setYskcs(tjData.getYskcs());
|
||||
// String sjtks = v.getTkxttj();
|
||||
// if(StringUtils.isNotBlank((sjtks))){
|
||||
// int xtks = 0;
|
||||
// if(StringUtils.isNotBlank(tjData.getTkxttj())){
|
||||
// xtks = Integer.parseInt(tjData.getTksf());
|
||||
// }
|
||||
// v.setTkxttj(String.valueOf(Integer.parseInt(sjtks) + xtks));
|
||||
// }
|
||||
// //转成更新List
|
||||
// //updateTjList.add(v);
|
||||
// UpdateWrapper<KcTkcstj> uw = new UpdateWrapper<>();
|
||||
// uw.set("tksf",v.getTksf());
|
||||
// uw.set("yskcs",v.getYskcs());
|
||||
// uw.set("tkxttj",v.getTkxttj());
|
||||
// uw.eq("xnxq",v.getXnxq());
|
||||
// uw.eq("jgh",v.getJgh());
|
||||
// kcTkcstjService.update(uw);
|
||||
// }else {
|
||||
// //新数据
|
||||
// //添加身份和听课要求
|
||||
// if(tksfMap.containsKey(k)){
|
||||
// KcTksfrzb currentData = tksfMap.get(k);
|
||||
// v.setTksf(currentData.getZwmc());
|
||||
// v.setYskcs(currentData.getTkyq());
|
||||
// v.setJsxm(currentData.getXm());
|
||||
// //v.setSsxy(currentData.());//?
|
||||
// String sjtks = v.getTkxttj();
|
||||
// if(StringUtils.isNotBlank((sjtks))){
|
||||
// v.setTkxttj(sjtks);
|
||||
// }
|
||||
// addTjList.add(v);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
kcTkcstjService.saveBatch(addTjList);
|
||||
}else {
|
||||
log.error("查不到基本配置!【去kc_sys_config表添加ID为1的数据】");
|
||||
}
|
||||
}
|
||||
|
||||
public void addTingKeData(String userId,String kbId){
|
||||
addTingKeData(userId, kbId, new Date());
|
||||
}
|
||||
|
||||
public void addTingKeData(String userId,String kbId,Date tkSj){
|
||||
//删除旧数据
|
||||
QueryWrapper<KcTingke> removeQw = new QueryWrapper<>();
|
||||
removeQw.eq("userid",userId);
|
||||
removeQw.eq("kechengbiaoid",kbId);
|
||||
kcTingkeService.remove(removeQw);
|
||||
//查询辅助数据
|
||||
//查询所在单位
|
||||
QueryWrapper<Xxhbuser> szdwQw = new QueryWrapper<>();
|
||||
szdwQw.eq("gh",userId);
|
||||
List<Xxhbuser> szdwList = xxhbuserService.list(szdwQw);
|
||||
Map<String, Xxhbuser> szdwMap = Maps.newHashMap();
|
||||
szdwList.forEach(x -> {
|
||||
szdwMap.put(x.getGh(),x);
|
||||
});
|
||||
|
||||
//查询听课身份
|
||||
QueryWrapper<KcTksfrzb> tksfQw = new QueryWrapper<>();
|
||||
tksfQw.eq("gh",userId);
|
||||
List<KcTksfrzb> tksfList = kcTksfrzbService.list(tksfQw);
|
||||
Map<String, KcTksfrzb> tksfMap = Maps.newHashMap();
|
||||
tksfList.forEach(x -> {
|
||||
if(tksfMap.containsKey(x.getGh())){
|
||||
//存在了,拼接职务名称,取最大的听课要求
|
||||
KcTksfrzb currentData = tksfMap.get(x.getGh());
|
||||
String currentZwmc = currentData.getZwmc();
|
||||
String currentTkyq = currentData.getTkyq();
|
||||
if(StringUtils.isNotBlank(currentTkyq)){
|
||||
int tkyq = Integer.parseInt(currentTkyq);
|
||||
int xtkyq = Integer.parseInt(x.getTkyq());
|
||||
x.setZwmc(currentZwmc + "、" + x.getZwmc());
|
||||
if(tkyq > xtkyq){
|
||||
x.setTkyq(String.valueOf(tkyq));
|
||||
}else{
|
||||
x.setTkyq(String.valueOf(xtkyq));
|
||||
}
|
||||
}
|
||||
tksfMap.put(x.getGh(),x);
|
||||
}else {
|
||||
tksfMap.put(x.getGh(),x);
|
||||
}
|
||||
});
|
||||
|
||||
//组合数据
|
||||
KcTingke kcTingke = new KcTingke();
|
||||
kcTingke.setTingketime(DateUtil.format(tkSj, DatePattern.NORM_DATETIME_FORMAT));
|
||||
kcTingke.setKechengbiaoid(kbId);
|
||||
kcTingke.setUserid(userId);
|
||||
if(tksfMap.containsKey(userId)){
|
||||
KcTksfrzb currentData = tksfMap.get(userId);
|
||||
kcTingke.setUsername(currentData.getXm());
|
||||
if(StringUtils.isNotBlank(currentData.getTkyq())){
|
||||
kcTingke.setUsertkyq(Integer.parseInt(currentData.getTkyq()));
|
||||
}else{
|
||||
kcTingke.setUsertkyq(0);
|
||||
}
|
||||
|
||||
String tksfs = currentData.getZwmc();
|
||||
if(StringUtils.isNotBlank(tksfs)){
|
||||
if(StringUtils.indexOf(tksfs,"、") != 1){
|
||||
String[] tksfArray = tksfs.split("、");
|
||||
kcTingke.setUsertksf1(tksfArray[0]);
|
||||
if(tksfArray.length >= 2){
|
||||
kcTingke.setUsertksf2(tksfArray[1]);
|
||||
}
|
||||
}else {
|
||||
kcTingke.setUsertksf1(tksfs);
|
||||
}
|
||||
}
|
||||
}
|
||||
kcTingkeService.save(kcTingke);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void updateTingKeTongJiAndPingKeByUserId(String userId,String kbId){
|
||||
addTingKeData(userId,kbId);
|
||||
updateTingKeTongJiByUserId(userId);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String startSj = "2023-02-20";
|
||||
String endSj = "2023-07-17";
|
||||
Date pkDate = DateUtil.parse("2023-02-18");
|
||||
long startDiffer = DateUtil.between(DateUtil.parse(startSj), pkDate, DateUnit.DAY,false);
|
||||
long endDiffer = DateUtil.between(pkDate, DateUtil.parse(endSj), DateUnit.DAY,false);
|
||||
System.out.println(startDiffer);
|
||||
System.out.println(endDiffer);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
package org.jeecg.modules.kc.grab.imports.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.kc.grab.imports.entity.Xxhbuser;
|
||||
import org.jeecg.modules.kc.grab.imports.service.IXxhbuserService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: xxhbuser
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-06-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="xxhbuser")
|
||||
@RestController
|
||||
@RequestMapping("/xxhb/xxhbuser")
|
||||
@Slf4j
|
||||
public class XxhbuserController extends JeecgController<Xxhbuser, IXxhbuserService> {
|
||||
@Autowired
|
||||
private IXxhbuserService xxhbuserService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param xxhbuser
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "xxhbuser-分页列表查询")
|
||||
@ApiOperation(value="xxhbuser-分页列表查询", notes="xxhbuser-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Xxhbuser>> queryPageList(Xxhbuser xxhbuser,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<Xxhbuser> queryWrapper = QueryGenerator.initQueryWrapper(xxhbuser, req.getParameterMap());
|
||||
Page<Xxhbuser> page = new Page<Xxhbuser>(pageNo, pageSize);
|
||||
IPage<Xxhbuser> pageList = xxhbuserService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param xxhbuser
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "xxhbuser-添加")
|
||||
@ApiOperation(value="xxhbuser-添加", notes="xxhbuser-添加")
|
||||
@RequiresPermissions("xxhb:xxhbuser:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Xxhbuser xxhbuser) {
|
||||
xxhbuserService.save(xxhbuser);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param xxhbuser
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "xxhbuser-编辑")
|
||||
@ApiOperation(value="xxhbuser-编辑", notes="xxhbuser-编辑")
|
||||
@RequiresPermissions("xxhb:xxhbuser:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Xxhbuser xxhbuser) {
|
||||
xxhbuserService.updateById(xxhbuser);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "xxhbuser-通过id删除")
|
||||
@ApiOperation(value="xxhbuser-通过id删除", notes="xxhbuser-通过id删除")
|
||||
@RequiresPermissions("xxhb:xxhbuser:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
xxhbuserService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "xxhbuser-批量删除")
|
||||
@ApiOperation(value="xxhbuser-批量删除", notes="xxhbuser-批量删除")
|
||||
@RequiresPermissions("xxhb:xxhbuser:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.xxhbuserService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "xxhbuser-通过id查询")
|
||||
@ApiOperation(value="xxhbuser-通过id查询", notes="xxhbuser-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Xxhbuser> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Xxhbuser xxhbuser = xxhbuserService.getById(id);
|
||||
if(xxhbuser==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(xxhbuser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param xxhbuser
|
||||
*/
|
||||
@RequiresPermissions("xxhb:xxhbuser:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, Xxhbuser xxhbuser) {
|
||||
return super.exportXls(request, xxhbuser, Xxhbuser.class, "xxhbuser");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("xxhb:xxhbuser:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, Xxhbuser.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package org.jeecg.modules.kc.grab.imports.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: xxhbuser
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-06-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("xxhbuser")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="xxhbuser对象", description="xxhbuser")
|
||||
public class Xxhbuser implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.Integer id;
|
||||
/**工号*/
|
||||
@Excel(name = "工号", width = 15)
|
||||
@ApiModelProperty(value = "工号")
|
||||
private java.lang.String gh;
|
||||
/**spxldm*/
|
||||
@Excel(name = "spxldm", width = 15)
|
||||
@ApiModelProperty(value = "spxldm")
|
||||
private java.lang.String spxldm;
|
||||
/**xbm*/
|
||||
@Excel(name = "xbm", width = 15)
|
||||
@ApiModelProperty(value = "xbm")
|
||||
private java.lang.String xbm;
|
||||
/**姓名*/
|
||||
@Excel(name = "姓名", width = 15)
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private java.lang.String xm;
|
||||
/**单位号*/
|
||||
@Excel(name = "单位号", width = 15)
|
||||
@ApiModelProperty(value = "单位号")
|
||||
private java.lang.String dwh;
|
||||
/**单位名称*/
|
||||
@Excel(name = "单位名称", width = 15)
|
||||
@ApiModelProperty(value = "单位名称")
|
||||
private java.lang.String dwmc;
|
||||
/**csrq*/
|
||||
@Excel(name = "csrq", width = 15)
|
||||
@ApiModelProperty(value = "csrq")
|
||||
private java.lang.String csrq;
|
||||
/**sfzxm*/
|
||||
@Excel(name = "sfzxm", width = 15)
|
||||
@ApiModelProperty(value = "sfzxm")
|
||||
private java.lang.String sfzxm;
|
||||
/**zdxms*/
|
||||
@Excel(name = "zdxms", width = 15)
|
||||
@ApiModelProperty(value = "zdxms")
|
||||
private java.lang.String zdxms;
|
||||
/**zzzt*/
|
||||
@Excel(name = "zzzt", width = 15)
|
||||
@ApiModelProperty(value = "zzzt")
|
||||
private java.lang.String zzzt;
|
||||
/**时间戳*/
|
||||
@Excel(name = "时间戳", width = 15)
|
||||
@ApiModelProperty(value = "时间戳")
|
||||
private java.lang.String timestamps;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package org.jeecg.modules.kc.grab.imports.mapper;
|
||||
|
||||
import org.jeecg.modules.kc.grab.imports.entity.Xxhbuser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: xxhbuser
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-06-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface XxhbuserMapper extends BaseMapper<Xxhbuser> {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.kc.grab.imports.mapper.XxhbuserMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,14 @@
|
|||
package org.jeecg.modules.kc.grab.imports.service;
|
||||
|
||||
import org.jeecg.modules.kc.grab.imports.entity.Xxhbuser;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: xxhbuser
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-06-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IXxhbuserService extends IService<Xxhbuser> {
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.jeecg.modules.kc.grab.imports.service.impl;
|
||||
|
||||
import org.jeecg.modules.kc.grab.imports.entity.Xxhbuser;
|
||||
import org.jeecg.modules.kc.grab.imports.mapper.XxhbuserMapper;
|
||||
import org.jeecg.modules.kc.grab.imports.service.IXxhbuserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: xxhbuser
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-06-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class XxhbuserServiceImpl extends ServiceImpl<XxhbuserMapper, Xxhbuser> implements IXxhbuserService {
|
||||
|
||||
}
|
|
@ -188,4 +188,7 @@ public class KcEvaluation implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private List<KcEvaluations> ansList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer pkNum;
|
||||
|
||||
}
|
||||
|
|
|
@ -6,12 +6,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.modules.kc.grab.SynchronizationService.tools.ChangeTingKeTongJi;
|
||||
import org.jeecg.modules.kc.qa.entity.KcEvaluation;
|
||||
import org.jeecg.modules.kc.qa.entity.KcEvaluationPkmx;
|
||||
import org.jeecg.modules.kc.qa.mapper.KcEvaluationMapper;
|
||||
import org.jeecg.modules.kc.qa.service.IKcEvaluationService;
|
||||
import org.jeecg.modules.kc.qa.service.IKcEvaluationsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
@ -33,6 +35,10 @@ public class KcEvaluationServiceImpl extends ServiceImpl<KcEvaluationMapper, KcE
|
|||
@Autowired
|
||||
private IKcEvaluationsService kcEvaluationsService;
|
||||
|
||||
@Lazy//防止循环
|
||||
@Autowired
|
||||
private ChangeTingKeTongJi changeTingKeTongJi;
|
||||
|
||||
public IPage<KcEvaluation> getPktjbList(Page<KcEvaluation> page, KcEvaluation kcEvaluation) {
|
||||
return baseMapper.getPktjbList(page,kcEvaluation);
|
||||
}
|
||||
|
@ -79,6 +85,8 @@ public class KcEvaluationServiceImpl extends ServiceImpl<KcEvaluationMapper, KcE
|
|||
});
|
||||
kcEvaluationsService.saveBatch(kcEvaluation.getAnsList());
|
||||
}
|
||||
//添加评课数据和统计数据
|
||||
changeTingKeTongJi.updateTingKeTongJiAndPingKeByUserId(String.valueOf(kcEvaluation.getUpuserid()),kcEvaluation.getMinkcid());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/kctkcstj/kcTkcstj/list',
|
||||
save='/kctkcstj/kcTkcstj/add',
|
||||
edit='/kctkcstj/kcTkcstj/edit',
|
||||
deleteOne = '/kctkcstj/kcTkcstj/delete',
|
||||
deleteBatch = '/kctkcstj/kcTkcstj/deleteBatch',
|
||||
importExcel = '/kctkcstj/kcTkcstj/importExcel',
|
||||
exportXls = '/kctkcstj/kcTkcstj/exportXls',
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
*/
|
||||
export const getExportUrl = Api.exportXls;
|
||||
|
||||
/**
|
||||
* 导入api
|
||||
*/
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
* @param params
|
||||
* @param handleSuccess
|
||||
*/
|
||||
export const deleteOne = (params,handleSuccess) => {
|
||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
* @param handleSuccess
|
||||
*/
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
* @param isUpdate
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
import { rules} from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '学年学期',
|
||||
align: "center",
|
||||
dataIndex: 'xnxq'
|
||||
},
|
||||
{
|
||||
title: '教师工号',
|
||||
align: "center",
|
||||
dataIndex: 'jgh'
|
||||
},
|
||||
{
|
||||
title: '教师姓名',
|
||||
align: "center",
|
||||
dataIndex: 'jsxm'
|
||||
},
|
||||
{
|
||||
title: '所属学院',
|
||||
align: "center",
|
||||
dataIndex: 'ssxy'
|
||||
},
|
||||
{
|
||||
title: '听课身份',
|
||||
align: "center",
|
||||
dataIndex: 'tksf'
|
||||
},
|
||||
{
|
||||
title: '应听课次数',
|
||||
align: "center",
|
||||
dataIndex: 'yskcs'
|
||||
},
|
||||
{
|
||||
title: '应听课次数',
|
||||
align: "center",
|
||||
dataIndex: 'tkxttj'
|
||||
},
|
||||
];
|
||||
|
||||
//查询数据
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: "学年学期",
|
||||
field: 'xnxq',
|
||||
component: 'Input',
|
||||
colProps: {span: 6},
|
||||
},
|
||||
{
|
||||
label: "教师工号",
|
||||
field: 'jgh',
|
||||
component: 'Input',
|
||||
colProps: {span: 6},
|
||||
},
|
||||
{
|
||||
label: "教师姓名",
|
||||
field: 'jsxm',
|
||||
component: 'Input',
|
||||
colProps: {span: 6},
|
||||
},
|
||||
{
|
||||
label: "听课身份",
|
||||
field: 'tksf',
|
||||
component: 'Input',
|
||||
colProps: {span: 6},
|
||||
},
|
||||
];
|
||||
|
||||
//表单数据
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
label: '学年学期',
|
||||
field: 'xnxq',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '教师工号',
|
||||
field: 'jgh',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '教师姓名',
|
||||
field: 'jsxm',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '所属学院',
|
||||
field: 'ssxy',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '听课身份',
|
||||
field: 'tksf',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '应听课次数',
|
||||
field: 'yskcs',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '应听课次数',
|
||||
field: 'tkxttj',
|
||||
component: 'Input',
|
||||
},
|
||||
// TODO 主键隐藏字段,目前写死为ID
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
];
|
|
@ -1,249 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<!--查询区域-->
|
||||
<div class="jeecg-basic-table-form-container">
|
||||
<a-form @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||
<a-row :gutter="24">
|
||||
<a-col :lg="8">
|
||||
<a-form-item label="学年学期">
|
||||
<a-input placeholder="请输入学年学期" v-model:value="queryParam.xnxq"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="8">
|
||||
<a-form-item label="教师工号">
|
||||
<a-input placeholder="请输入教师工号" v-model:value="queryParam.jgh"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!--<template v-if="toggleSearchStatus">-->
|
||||
<a-col :lg="8">
|
||||
<a-form-item label="教师姓名">
|
||||
<a-input placeholder="请输入教师姓名" v-model:value="queryParam.jsxm"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="8">
|
||||
<a-form-item label="听课身份">
|
||||
<a-input placeholder="请输入听课身份" v-model:value="queryParam.tksf"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!--</template>-->
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
|
||||
<a-col :lg="6">
|
||||
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
|
||||
<!--<a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
|
||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||
<Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />
|
||||
</a>-->
|
||||
</a-col>
|
||||
</span>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
||||
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
<Icon icon="ant-design:delete-outlined"></Icon>
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button>批量操作
|
||||
<Icon icon="mdi:chevron-down"></Icon>
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
|
||||
</template>
|
||||
<!--字段回显插槽-->
|
||||
<template #htmlSlot="{text}">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
<!--省市区字段回显插槽-->
|
||||
<!--<template #pcaSlot="{text}">
|
||||
{{ getAreaTextByCode(text) }}
|
||||
</template>-->
|
||||
<template #fileSlot="{text}">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<KcTkcstjModal ref="registerModal" @success="handleSuccess"></KcTkcstjModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="kctkcstj-kcTkcstj" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns } from './KcTkcstj.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './KcTkcstj.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import KcTkcstjModal from './components/KcTkcstjModal.vue'
|
||||
|
||||
const queryParam = ref<any>({});
|
||||
const toggleSearchStatus = ref<boolean>(false);
|
||||
const registerModal = ref();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '听课次数统计',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:false,
|
||||
useSearchForm: false,
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
params.column = '',params.order = '';//新生成的默认不带排序
|
||||
return Object.assign(params, queryParam.value);
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: "听课次数统计",
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess
|
||||
},
|
||||
});
|
||||
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const labelCol = reactive({
|
||||
xs: { span: 24 },
|
||||
sm: { span: 7 },
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
});
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.add();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
registerModal.value.disableSubmit = true;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
queryParam.value = {};
|
||||
selectedRowKeys.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.jeecg-basic-table-form-container {
|
||||
.table-page-search-submitButtons {
|
||||
display: block;
|
||||
margin-bottom: 24px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.query-group-cust{
|
||||
width: calc(50% - 15px);
|
||||
min-width: 100px !important;
|
||||
}
|
||||
.query-group-split-cust{
|
||||
width: 30px;
|
||||
display: inline-block;
|
||||
text-align: center
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,26 +0,0 @@
|
|||
-- 注意:该页面对应的前台目录为views/kctkcstj文件夹下
|
||||
-- 如果你想更改到其他目录,请修改sql中component字段对应的值
|
||||
|
||||
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external)
|
||||
VALUES ('2023052702565770120', NULL, '听课次数统计', '/kctkcstj/kcTkcstjList', 'kctkcstj/KcTkcstjList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2023-05-27 14:56:12', NULL, NULL, 0);
|
||||
|
||||
-- 权限控制sql
|
||||
-- 新增
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2023052702565770121', '2023052702565770120', '添加听课次数统计', NULL, NULL, 0, NULL, NULL, 2, 'kctkcstj:kc_tkcstj:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-05-27 14:56:12', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 编辑
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2023052702565770122', '2023052702565770120', '编辑听课次数统计', NULL, NULL, 0, NULL, NULL, 2, 'kctkcstj:kc_tkcstj:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-05-27 14:56:12', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 删除
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2023052702565770123', '2023052702565770120', '删除听课次数统计', NULL, NULL, 0, NULL, NULL, 2, 'kctkcstj:kc_tkcstj:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-05-27 14:56:12', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 批量删除
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2023052702565770124', '2023052702565770120', '批量删除听课次数统计', NULL, NULL, 0, NULL, NULL, 2, 'kctkcstj:kc_tkcstj:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-05-27 14:56:12', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 导出excel
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2023052702565770125', '2023052702565770120', '导出excel_听课次数统计', NULL, NULL, 0, NULL, NULL, 2, 'kctkcstj:kc_tkcstj:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-05-27 14:56:12', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 导入excel
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2023052702565770126', '2023052702565770120', '导入excel_听课次数统计', NULL, NULL, 0, NULL, NULL, 2, 'kctkcstj:kc_tkcstj:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-05-27 14:56:12', NULL, NULL, 0, 0, '1', 0);
|
|
@ -1,163 +0,0 @@
|
|||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="学年学期" v-bind="validateInfos.xnxq">
|
||||
<a-input v-model:value="formData.xnxq" placeholder="请输入学年学期" :disabled="disabled"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="教师工号" v-bind="validateInfos.jgh">
|
||||
<a-input v-model:value="formData.jgh" placeholder="请输入教师工号" :disabled="disabled"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="教师姓名" v-bind="validateInfos.jsxm">
|
||||
<a-input v-model:value="formData.jsxm" placeholder="请输入教师姓名" :disabled="disabled"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="所属学院" v-bind="validateInfos.ssxy">
|
||||
<a-input v-model:value="formData.ssxy" placeholder="请输入所属学院" :disabled="disabled"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="听课身份" v-bind="validateInfos.tksf">
|
||||
<a-input v-model:value="formData.tksf" placeholder="请输入听课身份" :disabled="disabled"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="应听课次数" v-bind="validateInfos.yskcs">
|
||||
<a-input v-model:value="formData.yskcs" placeholder="请输入应听课次数" :disabled="disabled"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="应听课次数" v-bind="validateInfos.tkxttj">
|
||||
<a-input v-model:value="formData.tkxttj" placeholder="请输入应听课次数" :disabled="disabled"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getValueType } from '/@/utils';
|
||||
import { saveOrUpdate } from '../KcTkcstj.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
|
||||
const props = defineProps({
|
||||
formDisabled: { type: Boolean, default: false },
|
||||
formData: { type: Object, default: ()=>{} },
|
||||
formBpm: { type: Boolean, default: true }
|
||||
});
|
||||
const formRef = ref();
|
||||
const useForm = Form.useForm;
|
||||
const emit = defineEmits(['register', 'ok']);
|
||||
const formData = reactive<Record<string, any>>({
|
||||
id: '',
|
||||
xnxq: '',
|
||||
jgh: '',
|
||||
jsxm: '',
|
||||
ssxy: '',
|
||||
tksf: '',
|
||||
yskcs: '',
|
||||
tkxttj: '',
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||
const confirmLoading = ref<boolean>(false);
|
||||
//表单验证
|
||||
const validatorRules = {
|
||||
};
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
|
||||
|
||||
// 表单禁用
|
||||
const disabled = computed(()=>{
|
||||
if(props.formBpm === true){
|
||||
if(props.formData.disabled === false){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return props.formDisabled;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
edit({});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function edit(record) {
|
||||
nextTick(() => {
|
||||
resetFields();
|
||||
//赋值
|
||||
Object.assign(formData, record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交数据
|
||||
*/
|
||||
async function submitForm() {
|
||||
// 触发表单验证
|
||||
await validate();
|
||||
confirmLoading.value = true;
|
||||
const isUpdate = ref<boolean>(false);
|
||||
//时间格式化
|
||||
let model = formData;
|
||||
if (model.id) {
|
||||
isUpdate.value = true;
|
||||
}
|
||||
//循环数据
|
||||
for (let data in model) {
|
||||
//如果该数据是数组并且是字符串类型
|
||||
if (model[data] instanceof Array) {
|
||||
let valueType = getValueType(formRef.value.getProps, data);
|
||||
//如果是字符串类型的需要变成以逗号分割的字符串
|
||||
if (valueType === 'string') {
|
||||
model[data] = model[data].join(',');
|
||||
}
|
||||
}
|
||||
}
|
||||
await saveOrUpdate(model, isUpdate.value)
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
createMessage.success(res.message);
|
||||
emit('ok');
|
||||
} else {
|
||||
createMessage.warning(res.message);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
confirmLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
submitForm,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.antd-modal-form {
|
||||
min-height: 500px !important;
|
||||
overflow-y: auto;
|
||||
padding: 24px 24px 24px 24px;
|
||||
}
|
||||
</style>
|
|
@ -1,75 +0,0 @@
|
|||
<template>
|
||||
<a-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||
<KcTkcstjForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></KcTkcstjForm>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import KcTkcstjForm from './KcTkcstjForm.vue'
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<number>(800);
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
title.value = '新增';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.add();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param record
|
||||
*/
|
||||
function edit(record) {
|
||||
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.edit(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback() {
|
||||
handleCancel();
|
||||
emit('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
disableSubmit,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
|
@ -12,6 +12,7 @@ import org.jeecg.common.api.vo.Result;
|
|||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.kc.grab.SynchronizationService.tools.ChangeTingKeTongJi;
|
||||
import org.jeecg.modules.kc.qa.entity.KcEvaluation;
|
||||
import org.jeecg.modules.kc.qa.service.IKcEvaluationService;
|
||||
import org.jeecg.modules.kc.tktj.entity.KcKkdw;
|
||||
|
@ -51,8 +52,11 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|||
public class KcTingkeController extends JeecgController<KcTingke, IKcTingkeService> {
|
||||
@Autowired
|
||||
private IKcTingkeService kcTingkeService;
|
||||
@Autowired
|
||||
private IKcEvaluationService kcEvaluationService;
|
||||
@Autowired
|
||||
private IKcEvaluationService kcEvaluationService;
|
||||
|
||||
@Autowired
|
||||
private ChangeTingKeTongJi changeTingKeTongJi;
|
||||
|
||||
@Value("${jeecg.path.upload}")
|
||||
private String upLoadPath;
|
||||
|
@ -101,6 +105,20 @@ public class KcTingkeController extends JeecgController<KcTingke, IKcTingkeServi
|
|||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param kcTingke
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "kc_tingke-添加听课记录")
|
||||
@ApiOperation(value="kc_tingke-添加听课记录", notes="kc_tingke-添加听课记录")
|
||||
@PostMapping(value = "/addTingKeLog")
|
||||
public Result<String> addTingKeLog(@RequestBody KcTingke kcTingke) {
|
||||
changeTingKeTongJi.addTingKeData(kcTingke.getUserid(),kcTingke.getKechengbiaoid());
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
|
|
|
@ -85,24 +85,24 @@ public class KcTingke implements Serializable {
|
|||
/**usertksfcode*/
|
||||
private java.lang.String usertksfcode;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
//@ApiModelProperty(value = "创建人")
|
||||
//private java.lang.String createBy;
|
||||
/**创建时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private java.util.Date createTime;
|
||||
/**修改人*/
|
||||
@ApiModelProperty(value = "修改人")
|
||||
private java.lang.String updateBy;
|
||||
/**修改时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门编码*/
|
||||
@ApiModelProperty(value = "所属部门编码")
|
||||
private java.lang.String sysOrgCode;
|
||||
// @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
// @DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
// @ApiModelProperty(value = "创建时间")
|
||||
// private java.util.Date createTime;
|
||||
// /**修改人*/
|
||||
// @ApiModelProperty(value = "修改人")
|
||||
// private java.lang.String updateBy;
|
||||
// /**修改时间*/
|
||||
// @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
// @DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
// @ApiModelProperty(value = "修改时间")
|
||||
// private java.util.Date updateTime;
|
||||
// /**所属部门编码*/
|
||||
// @ApiModelProperty(value = "所属部门编码")
|
||||
// private java.lang.String sysOrgCode;
|
||||
|
||||
@TableField(exist = false)
|
||||
private java.lang.String startTime;
|
||||
|
|
Loading…
Reference in New Issue