添加问卷星功能

This commit is contained in:
yangjun 2024-05-06 08:15:23 +08:00
parent 006f2e80e4
commit 6c9afd77c5
38 changed files with 1810 additions and 137 deletions

View File

@ -292,4 +292,20 @@ public class BlZyccController extends JeecgController<BlZycc, IBlZyccService> {
}
@AutoLog(value = "获取图片比对人数接口")
@ApiOperation(value="获取图片比对人数接口", notes="获取图片比对人数接口")
@PostMapping(value = "/getRlltj")
public Result<Map<String,String>> getRlltj(@RequestBody BlZycc blZycc) {
Map<String,String> map = new HashMap<>();
// String sign = authService.getAuth();
// System.out.println("sign:--->"+sign);
String filePath = uploadpath+"/"+blZycc.getRllfilePath();
String ret = authService.body_num(filePath);
map.put("ret--->",ret);
JSONObject object= JSONObject.parseObject(ret);
// JSONObject object2= JSONObject.parseObject(object.get("result").toString());
map.put("personnum",object.getString("person_num"));
return Result.OK(map);
}
}

View File

@ -73,6 +73,8 @@ public class BlZycc implements Serializable {
private String message;
@TableField(exist = false)
private String facefilePath;
@TableField(exist = false)
private String rllfilePath;
}

View File

@ -499,10 +499,21 @@ public class KcExportConfigTpkwcqkjzglxController extends JeecgController<KcExpo
//------------评课统计---2024-02-29新增的-------------------
QueryWrapper<KcEvaluation> kcEvaluationQueryWrapper = new QueryWrapper<>();
kcEvaluationQueryWrapper.in("kt.xnxq",xqxnSet);
kcEvaluationQueryWrapper.groupBy("concat(xnxq,'-',upuserid)");
kcEvaluationQueryWrapper.orderByDesc("kt.skrq");
List<KcEvaluation> pktjList = kcEvaluationService.findTj(kcEvaluationQueryWrapper);
kcEvaluationQueryWrapper.eq("xqxn",object.getXqxn());
kcEvaluationQueryWrapper.eq(StringUtils.isNotBlank(object.getDwmc()),"dwmc",object.getDwmc());
kcEvaluationQueryWrapper.apply("(zt = '在职' or (zt= '退休' and ytkcs-0 >0))");
kcEvaluationQueryWrapper.groupBy("a.gh");
// where xqxn = #{xqxn} and (zt = '在职' or (zt= '退休' and ytkcs-0 >0))
// <if test="code != null">
// and tklx in (${code})
// </if>
// <if test="dwmc != null and dwmc != ''">
// and dwmc = #{dwmc}
// </if>
// GROUP BY a.tklx,a.gh,a.xm,a.dwmc,a.ytkcs,a.rjzy
List<KcEvaluation> pktjList = kcEvaluationService.findTkcsTj(kcEvaluationQueryWrapper);
Map<String,KcEvaluation> pktjMap = Maps.newHashMap();
pktjList.forEach(x -> {
pktjMap.put(x.getXnxq() + "-" + x.getUpuserid(),x);

View File

@ -236,7 +236,10 @@
select a.tklx,a.gh,a.xm,a.dwmc,a.ytkcs,a.rjzy,count(c.upuserid) as sjtkcs from kc_export_config_tpkwcqkjzglx a
LEFT JOIN kc_xqxn_history b on a.xqxn = b.title
LEFT JOIN kc_evaluation c on a.gh = c.upuserid and c.up_date BETWEEN b.start_time and b.end_time
where xqxn = #{xqxn} and (zt = '在职' or (zt= '退休' and ytkcs-0 >0)) and tklx in (${code})
where xqxn = #{xqxn} and (zt = '在职' or (zt= '退休' and ytkcs-0 >0))
<if test="code != null">
and tklx in (${code})
</if>
<if test="dwmc != null and dwmc != ''">
and dwmc = #{dwmc}
</if>

View File

@ -251,8 +251,11 @@ public class KcExportConfigTpkwcqkjzglxServiceImpl extends ServiceImpl<KcExportC
Xxhbuser xxhbUser = xxhbuserService.getOne(uqw);
kcExportConfigTpkwcqkjzglx.setDwmc(xxhbUser.getDwmc());
}
KcSysConfig kcSysConfig = kcSysConfigService.getById("1");
kcExportConfigTpkwcqkjzglx.setXqxn(kcSysConfig.getFlag1());
if(StringUtils.isEmpty(kcExportConfigTpkwcqkjzglx.getXqxn())){
KcSysConfig kcSysConfig = kcSysConfigService.getById("1");
kcExportConfigTpkwcqkjzglx.setXqxn(kcSysConfig.getFlag1());
}
IPage<KcExportConfigTpkwcqkjzglx> infolist = baseMapper.getListByCode(page,kcExportConfigTpkwcqkjzglx);
return infolist;
@ -336,9 +339,13 @@ public class KcExportConfigTpkwcqkjzglxServiceImpl extends ServiceImpl<KcExportC
Xxhbuser xxhbUser = xxhbuserService.getOne(uqw);
kcExportConfigTpkwcqkjzglxXytktj.setDwmc(xxhbUser.getDwmc());
}
KcSysConfig kcSysConfig = kcSysConfigService.getById("1");
kcExportConfigTpkwcqkjzglxXytktj.setXqxn(kcSysConfig.getFlag1());
// KcSysConfig kcSysConfig = kcSysConfigService.getById("1");
// kcExportConfigTpkwcqkjzglxXytktj.setXqxn(kcSysConfig.getFlag1());
if(StringUtils.isEmpty(kcExportConfigTpkwcqkjzglxXytktj.getXqxn())){
KcSysConfig kcSysConfig = kcSysConfigService.getById("1");
kcExportConfigTpkwcqkjzglxXytktj.setXqxn(kcSysConfig.getFlag1());
}
List<KcExportConfigTpkwcqkjzglxXytktj> infolist = baseMapper.getListByCodeXytktj(kcExportConfigTpkwcqkjzglxXytktj);
return infolist;
}

View File

@ -107,6 +107,73 @@ public class SyncEvaluationsYbtkbStat extends BaseSync {
}
}
List<KcEvaluationsStat> ybtkb2list = kcEvaluationsStatService.getYbtkbTwoSyncList();
for(KcEvaluationsStat KcEvaluationsStat:ybtkb2list){
KcEvaluationsStat.setXqxn(kcSysConfig.getFlag1());
List<KcEvaluationsStat> entityList = kcEvaluationsStatService.getYbtkbJxsjSyncList(KcEvaluationsStat);
if(entityList!=null && entityList.size()>0){
KcEvaluationsStat entity = entityList.get(0);
String col1726 = entity.getCol1726();
if(col1726.length()>0){
System.out.println("ybtkb----"+entity.getCol00());
String arr[] = col1726.split("@");
try {
entity.setCol18(arr[1]);
}catch (Exception e){
entity.setCol18("");
}
try {
entity.setCol19(arr[2]);
}catch (Exception e){
entity.setCol19("");
}
try {
entity.setCol20(arr[3]);
}catch (Exception e){
entity.setCol20("");
}
try {
entity.setCol21(arr[4]);
}catch (Exception e){
entity.setCol21("");
}
try {
entity.setCol22(arr[5]);
}catch (Exception e){
entity.setCol22("");
}
try {
entity.setCol23(arr[6]);
}catch (Exception e){
entity.setCol23("");
}
try {
entity.setCol24(arr[7]);
}catch (Exception e){
entity.setCol24("");
}
try {
entity.setCol25(arr[8]);
}catch (Exception e){
entity.setCol25("");
}
try {
entity.setCol26(arr[9]);
}catch (Exception e){
entity.setCol26("");
}
try {
entity.setCol1726(arr[0]);
}catch (Exception e){
entity.setCol1726("");
}
kcEvaluationsStatService.save(entity);
}
}
}
//最后的保存
// kcEvaluationsStatService.saveBatch(inslist);

View File

@ -79,131 +79,130 @@ public class SyncKcktStat extends BaseSync {
//-----------------修改课程表数据------------------------
KcKechengbiao kcKechengbiao = new KcKechengbiao();
kcKechengbiao.setXqxn(kcSysConfig.getFlag1());
// kcKechengbiao.setSkjs("刘婷");
List<KcKechengbiao> kckblist = kcKechengbiaoService.getKechengbiaoList(kcKechengbiao);
for(KcKechengbiao KcKechengbiaoPar:kckblist){
QueryWrapper<KcKechengbiao> kcKechengbiaoQueryWrapper = new QueryWrapper<>();
kcKechengbiaoQueryWrapper.eq("kcbh",KcKechengbiaoPar.getKcbh());
kcKechengbiaoQueryWrapper.eq("kcmc",KcKechengbiaoPar.getKcmc());
kcKechengbiaoQueryWrapper.eq("jgh",KcKechengbiaoPar.getJgh());
kcKechengbiaoQueryWrapper.eq("skjs",KcKechengbiaoPar.getSkjs());
kcKechengbiaoQueryWrapper.eq("rwbh",KcKechengbiaoPar.getRwbh());
kcKechengbiaoQueryWrapper.eq("kkdwid",KcKechengbiaoPar.getKkdwid());
kcKechengbiaoQueryWrapper.eq("kcxz",KcKechengbiaoPar.getKcxz());
// kcKechengbiaoQueryWrapper.eq("skdd",KcKechengbiaoPar.getSkdd());
kcKechengbiaoQueryWrapper.eq("sksj",KcKechengbiaoPar.getSksj());
kcKechengbiaoQueryWrapper.eq("jkzc",KcKechengbiaoPar.getJkzc());
kcKechengbiaoQueryWrapper.eq("xf",KcKechengbiaoPar.getXf());
kcKechengbiaoQueryWrapper.eq("xnxq",KcKechengbiaoPar.getXnxq());
kcKechengbiaoQueryWrapper.eq("kcdl",KcKechengbiaoPar.getKcdl());
List<KcKechengbiao> KcKechengbiaoInsList = kcKechengbiaoService.list(kcKechengbiaoQueryWrapper);
if(KcKechengbiaoInsList!=null&&KcKechengbiaoInsList.size()>0){
for(KcKechengbiao KcKechengbiao : KcKechengbiaoInsList){
String id = KcKechengbiao.getId();
BeanUtils.copyProperties(KcKechengbiaoPar,KcKechengbiao);
KcKechengbiao.setId(id);
kcKechengbiaoService.updateById(KcKechengbiao);
}
}else{
kcKechengbiaoService.saveOne(KcKechengbiaoPar);
}
}
//-----------------初始化数据------------------------
//------------------去除课程表重复数据 20231024新增-----------------
KcKechengbiao KcKechengbiao = new KcKechengbiao();
KcKechengbiao.setXqxn(kcSysConfig.getFlag1());
kcKechengbiaoService.removeCfsj(KcKechengbiao);
//------------------去除课程表重复数据 20231024新增-----------------
//-----------------所有的数据都变成无效 20240321------------
KcKechengbiao kcbAll = new KcKechengbiao();
kcbAll.setXnxq(kcSysConfig.getFlag1());
kcKechengbiaoService.updateAllFlag(kcbAll);//所有的数据都变成无效
kcKechengbiaoService.updateYxByXxhbkckb(kcbAll);//根据条件变成有效数据
//-----------------所有的数据都变成无效 20240321------------
//------------------刨除指定表的数据 20240314新增 修改flag标志位----------------
KcKechengbiao ktbExculde = new KcKechengbiao();
ktbExculde.setXnxq(kcSysConfig.getFlag1());
kcKechengbiaoService.updateKechengExculde(ktbExculde);
//------------------刨除指定表的数据 20240314新增 修改flag标志位----------------
//-------------------删除本年的课程数据冰倩是当天及以后的----------------------
QueryWrapper<KcKetangbiao> KcKetangbiaoQueryWrapper = new QueryWrapper<>();
KcKetangbiaoQueryWrapper.eq("xnxq",kcSysConfig.getFlag1());
KcKetangbiaoQueryWrapper.ge("skrq",DateUtils.formatDate(dateNow,"yyyy-MM-dd"));
kcKetangbiaoService.remove(KcKetangbiaoQueryWrapper);
//-------------------删除本年的课程数据冰倩是当天及以后的----------------------
String bxqkssj = kcSysConfig.getBxqkssj();
//插入数据
KcKetangbiao kcKetangbiao = new KcKetangbiao();
kcKetangbiao.setXnxq(kcSysConfig.getFlag1());
kcKetangbiao.setFlag("0");
List<KcKetangbiao> list = kcKetangbiaoService.selectSyncList(kcKetangbiao);
List<KcKetangbiao> arrayList = new ArrayList<>();
for(int i=0;i<list.size();i++){
KcKetangbiao kcKetangbiaoOld = list.get(i);
try {
String jkzc[] = kcKetangbiaoOld.getJkzc().split(",");
String week = kcKetangbiaoOld.getWeek();
for(int j=0;j<jkzc.length;j++){
KcKetangbiao kcKetangbiaoAddNew = new KcKetangbiao();
int djz = Integer.parseInt(jkzc[j]);
BeanUtils.copyProperties(kcKetangbiaoOld,kcKetangbiaoAddNew);
kcKetangbiaoAddNew.setId(null);
//skrq 生成规则取本学开始时间kc_sys_config.bxqkssj+(jkzc-1)*7+week
int addSj = (djz -1 )*7+Integer.parseInt(week)-1;
Date date = DateUtils.parseDate(bxqkssj,"yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(Calendar.DAY_OF_MONTH, addSj);
String skrq = DateUtils.formatDate(c,"yyyy-MM-dd");
String dasj = DateUtils.formatDate(dateNow,"yyyy-MM-dd");
//判断生成数据的skrq是否大于等于当前日期如果满足则进行新增否则不动
if(DateUtils.parseDate(skrq,"yyyy-MM-dd").getTime()>=DateUtils.parseDate(dasj,"yyyy-MM-dd").getTime()){
kcKetangbiaoAddNew.setSkrq(skrq);
kcKetangbiaoAddNew.setDijizhou(djz);
kcKetangbiaoAddNew.setXnxq(kcSysConfig.getFlag1());
arrayList.add(kcKetangbiaoAddNew);
}
}
}catch (Exception e){
e.printStackTrace();
}
}
kcKetangbiaoService.saveBatch(arrayList);
//修改智慧教室关联的课堂表id-- 清洗智慧教室数据
kcKetangbiaoService.updateJsbh();
//修改智慧教室关联的课堂表id-- 清洗智慧教室数据
KcKetangbiao kcKetangbiaoup = new KcKetangbiao();
kcKetangbiaoup.setSkxs(1);
kcKetangbiaoup.setXnxq(kcSysConfig.getFlag1());
kcKetangbiaoService.updateSkxs(kcKetangbiaoup);
//修改调停课时间
String dasj = DateUtils.formatDate(dateNow,"yyyy-MM-dd");
QueryWrapper<KcKetangbiaoSkrqLog> kcKetangbiaoSkrqLogQueryWrapper = new QueryWrapper<>();
kcKetangbiaoSkrqLogQueryWrapper.ge("jsrq",dasj);
List<KcKetangbiaoSkrqLog> list1 = kcKetangbiaoSkrqLogService.list(kcKetangbiaoSkrqLogQueryWrapper);
for(KcKetangbiaoSkrqLog KcKetangbiaoSkrqLog:list1){
UpdateWrapper<KcKetangbiao> KcKetangbiaoUpdateWrapper = new UpdateWrapper<>();
KcKetangbiaoUpdateWrapper.set("skrq",KcKetangbiaoSkrqLog.getTzrq());
KcKetangbiaoUpdateWrapper.eq("skrq",KcKetangbiaoSkrqLog.getSkrq());
kcKetangbiaoService.update(KcKetangbiaoUpdateWrapper);
}
// List<KcKechengbiao> kckblist = kcKechengbiaoService.getKechengbiaoList(kcKechengbiao);
// for(KcKechengbiao KcKechengbiaoPar:kckblist){
// QueryWrapper<KcKechengbiao> kcKechengbiaoQueryWrapper = new QueryWrapper<>();
// kcKechengbiaoQueryWrapper.eq("kcbh",KcKechengbiaoPar.getKcbh());
// kcKechengbiaoQueryWrapper.eq("kcmc",KcKechengbiaoPar.getKcmc());
// kcKechengbiaoQueryWrapper.eq("jgh",KcKechengbiaoPar.getJgh());
// kcKechengbiaoQueryWrapper.eq("skjs",KcKechengbiaoPar.getSkjs());
// kcKechengbiaoQueryWrapper.eq("rwbh",KcKechengbiaoPar.getRwbh());
// kcKechengbiaoQueryWrapper.eq("kkdwid",KcKechengbiaoPar.getKkdwid());
// kcKechengbiaoQueryWrapper.eq("kcxz",KcKechengbiaoPar.getKcxz());
//// kcKechengbiaoQueryWrapper.eq("skdd",KcKechengbiaoPar.getSkdd());
// kcKechengbiaoQueryWrapper.eq("sksj",KcKechengbiaoPar.getSksj());
// kcKechengbiaoQueryWrapper.eq("jkzc",KcKechengbiaoPar.getJkzc());
// kcKechengbiaoQueryWrapper.eq("xf",KcKechengbiaoPar.getXf());
// kcKechengbiaoQueryWrapper.eq("xnxq",KcKechengbiaoPar.getXnxq());
// kcKechengbiaoQueryWrapper.eq("kcdl",KcKechengbiaoPar.getKcdl());
// List<KcKechengbiao> KcKechengbiaoInsList = kcKechengbiaoService.list(kcKechengbiaoQueryWrapper);
// if(KcKechengbiaoInsList!=null&&KcKechengbiaoInsList.size()>0){
// for(KcKechengbiao KcKechengbiao : KcKechengbiaoInsList){
// String id = KcKechengbiao.getId();
// BeanUtils.copyProperties(KcKechengbiaoPar,KcKechengbiao);
// KcKechengbiao.setId(id);
// kcKechengbiaoService.updateById(KcKechengbiao);
// }
// }else{
// kcKechengbiaoService.saveOne(KcKechengbiaoPar);
// }
// }
// //-----------------初始化数据------------------------
//
// //------------------去除课程表重复数据 20231024新增-----------------
// KcKechengbiao KcKechengbiao = new KcKechengbiao();
// KcKechengbiao.setXqxn(kcSysConfig.getFlag1());
// kcKechengbiaoService.removeCfsj(KcKechengbiao);
// //------------------去除课程表重复数据 20231024新增-----------------
//
//
//
// //-----------------所有的数据都变成无效 20240321------------
// KcKechengbiao kcbAll = new KcKechengbiao();
// kcbAll.setXnxq(kcSysConfig.getFlag1());
// kcKechengbiaoService.updateAllFlag(kcbAll);//所有的数据都变成无效
// kcKechengbiaoService.updateYxByXxhbkckb(kcbAll);//根据条件变成有效数据
//
// //-----------------所有的数据都变成无效 20240321------------
//
//
//
// //------------------刨除指定表的数据 20240314新增 修改flag标志位----------------
// KcKechengbiao ktbExculde = new KcKechengbiao();
// ktbExculde.setXnxq(kcSysConfig.getFlag1());
// kcKechengbiaoService.updateKechengExculde(ktbExculde);
// //------------------刨除指定表的数据 20240314新增 修改flag标志位----------------
//
//
//
//
// //-------------------删除本年的课程数据冰倩是当天及以后的----------------------
// QueryWrapper<KcKetangbiao> KcKetangbiaoQueryWrapper = new QueryWrapper<>();
// KcKetangbiaoQueryWrapper.eq("xnxq",kcSysConfig.getFlag1());
// KcKetangbiaoQueryWrapper.ge("skrq",DateUtils.formatDate(dateNow,"yyyy-MM-dd"));
// kcKetangbiaoService.remove(KcKetangbiaoQueryWrapper);
// //-------------------删除本年的课程数据冰倩是当天及以后的----------------------
//
// String bxqkssj = kcSysConfig.getBxqkssj();
// //插入数据
// KcKetangbiao kcKetangbiao = new KcKetangbiao();
// kcKetangbiao.setXnxq(kcSysConfig.getFlag1());
// kcKetangbiao.setFlag("0");
// List<KcKetangbiao> list = kcKetangbiaoService.selectSyncList(kcKetangbiao);
// List<KcKetangbiao> arrayList = new ArrayList<>();
// for(int i=0;i<list.size();i++){
// KcKetangbiao kcKetangbiaoOld = list.get(i);
// try {
// String jkzc[] = kcKetangbiaoOld.getJkzc().split(",");
// String week = kcKetangbiaoOld.getWeek();
// for(int j=0;j<jkzc.length;j++){
// KcKetangbiao kcKetangbiaoAddNew = new KcKetangbiao();
// int djz = Integer.parseInt(jkzc[j]);
// BeanUtils.copyProperties(kcKetangbiaoOld,kcKetangbiaoAddNew);
// kcKetangbiaoAddNew.setId(null);
// //skrq 生成规则取本学开始时间kc_sys_config.bxqkssj+(jkzc-1)*7+week
// int addSj = (djz -1 )*7+Integer.parseInt(week)-1;
// Date date = DateUtils.parseDate(bxqkssj,"yyyy-MM-dd");
// Calendar c = Calendar.getInstance();
// c.setTime(date);
// c.add(Calendar.DAY_OF_MONTH, addSj);
// String skrq = DateUtils.formatDate(c,"yyyy-MM-dd");
// String dasj = DateUtils.formatDate(dateNow,"yyyy-MM-dd");
// //判断生成数据的skrq是否大于等于当前日期如果满足则进行新增否则不动
// if(DateUtils.parseDate(skrq,"yyyy-MM-dd").getTime()>=DateUtils.parseDate(dasj,"yyyy-MM-dd").getTime()){
// kcKetangbiaoAddNew.setSkrq(skrq);
// kcKetangbiaoAddNew.setDijizhou(djz);
// kcKetangbiaoAddNew.setXnxq(kcSysConfig.getFlag1());
// arrayList.add(kcKetangbiaoAddNew);
// }
// }
// }catch (Exception e){
// e.printStackTrace();
// }
// }
// kcKetangbiaoService.saveBatch(arrayList);
//
// //修改智慧教室关联的课堂表id-- 清洗智慧教室数据
// kcKetangbiaoService.updateJsbh();
//
// //修改智慧教室关联的课堂表id-- 清洗智慧教室数据
// KcKetangbiao kcKetangbiaoup = new KcKetangbiao();
// kcKetangbiaoup.setSkxs(1);
// kcKetangbiaoup.setXnxq(kcSysConfig.getFlag1());
// kcKetangbiaoService.updateSkxs(kcKetangbiaoup);
//
// //修改调停课时间
// String dasj = DateUtils.formatDate(dateNow,"yyyy-MM-dd");
//
// QueryWrapper<KcKetangbiaoSkrqLog> kcKetangbiaoSkrqLogQueryWrapper = new QueryWrapper<>();
// kcKetangbiaoSkrqLogQueryWrapper.ge("jsrq",dasj);
// List<KcKetangbiaoSkrqLog> list1 = kcKetangbiaoSkrqLogService.list(kcKetangbiaoSkrqLogQueryWrapper);
// for(KcKetangbiaoSkrqLog KcKetangbiaoSkrqLog:list1){
// UpdateWrapper<KcKetangbiao> KcKetangbiaoUpdateWrapper = new UpdateWrapper<>();
// KcKetangbiaoUpdateWrapper.set("skrq",KcKetangbiaoSkrqLog.getTzrq());
// KcKetangbiaoUpdateWrapper.eq("skrq",KcKetangbiaoSkrqLog.getSkrq());
// kcKetangbiaoService.update(KcKetangbiaoUpdateWrapper);
// }
@ -217,7 +216,7 @@ public class SyncKcktStat extends BaseSync {
// 调课放假时间上调课时间内的课程
for(KcTtksdpz kcTtksdpz:sdpzList){
String tklx = kcTtksdpz.getTklx();
if(StringUtils.equals("1",tklx)){//调课
if(StringUtils.equals("0",tklx)){//调课
String fjsj = DateUtils.formatDate(kcTtksdpz.getFjsj(),"yyyy-MM-dd");//放假时间
String tksj = DateUtils.formatDate(kcTtksdpz.getTksj(),"yyyy-MM-dd");//调课时间
@ -231,7 +230,7 @@ public class SyncKcktStat extends BaseSync {
kcTtksdpz.setZxsj(dateNow);
kcTtksdpz.setZxsql1("update kc_ketangbiao set skrq = '"+fjsj+"' , is_delete = '0' where skrq = '"+tksj+"'");
kcTtksdpzService.updateById(kcTtksdpz);
}else if(StringUtils.equals("0",tklx)){//停课
}else if(StringUtils.equals("1",tklx)){//停课
String fjsj = DateUtils.formatDate(kcTtksdpz.getFjsj(),"yyyy-MM-dd");//放假时间
//更具调课时间修改成放假时间

View File

@ -31,4 +31,6 @@ public interface KcEvaluationsStatMapper extends BaseMapper<KcEvaluationsStat> {
List<KcEvaluationsStat> getLbpjbSyncList();
List<KcEvaluationsStat> getLbpjbJxsjSyncList(KcEvaluationsStat kcEvaluationsStat);
List<KcEvaluationsStat> getYbtkbTwoSyncList();
}

View File

@ -8,6 +8,17 @@
FROM kc_evaluation EV, KC_EVALUATIONS EVS
WHERE ev.id = evs.evaluationid
AND ev.evaluationver = '3'
and ev.source != '2'
and ev.up_date > '2024-02-01'
</select>
<select id="getYbtkbTwoSyncList" resultType="org.jeecg.modules.kc.kcEvaluationsStat.entity.KcEvaluationsStat">
SELECT DISTINCT ev.id as col00
FROM kc_evaluation EV, KC_EVALUATIONS EVS
WHERE ev.id = evs.evaluationid
AND ev.evaluationver = '3'
and ev.source = '2'
and ev.up_date > '2024-02-01'
</select>
<select id="getXstkbSyncList" resultType="org.jeecg.modules.kc.kcEvaluationsStat.entity.KcEvaluationsStat">

View File

@ -30,4 +30,6 @@ public interface IKcEvaluationsStatService extends IService<KcEvaluationsStat> {
List<KcEvaluationsStat> getLbpjbSyncList();
List<KcEvaluationsStat> getLbpjbJxsjSyncList(KcEvaluationsStat kcEvaluationsStat);
List<KcEvaluationsStat> getYbtkbTwoSyncList();
}

View File

@ -62,4 +62,9 @@ public class KcEvaluationsStatServiceImpl extends ServiceImpl<KcEvaluationsStatM
public List<KcEvaluationsStat> getLbpjbJxsjSyncList(KcEvaluationsStat kcEvaluationsStat) {
return baseMapper.getLbpjbJxsjSyncList(kcEvaluationsStat);
}
@Override
public List<KcEvaluationsStat> getYbtkbTwoSyncList() {
return baseMapper.getYbtkbTwoSyncList();
}
}

View File

@ -46,4 +46,6 @@ public interface KcEvaluationMapper extends BaseMapper<KcEvaluation> {
KcBdgxbcopy getOpenId(String skjs);
List<KcEvaluation> getCountlist(KcEvaluation kcEvaluation);
List<KcEvaluation> findTkcsTj(@Param(Constants.WRAPPER) QueryWrapper<KcEvaluation> kcEvaluationQueryWrapper);
}

View File

@ -563,6 +563,21 @@
${ew.customSqlSegment}
</select>
<select id="findTkcsTj" resultType="org.jeecg.modules.kc.qa.entity.KcEvaluation">
SELECT
a.gh upuserid,
count( c.upuserid ) AS pkNum,
xqxn as xnxq
FROM
kc_export_config_tpkwcqkjzglx a
LEFT JOIN kc_xqxn_history b ON a.xqxn = b.title
LEFT JOIN kc_evaluation c ON a.gh = c.upuserid
AND c.up_date BETWEEN b.start_time
AND b.end_time
${ew.customSqlSegment}
</select>
<select id="getOpenId" resultType="org.jeecg.modules.kc.KcBdgxbcopy.entity.KcBdgxbcopy">
SELECT a.* from choice.bdgxbcopy a
left join xxhbuser b on a.userid = b.gh where b.xm = #{username} and a.openid is not null limit 1

View File

@ -44,4 +44,6 @@ public interface IKcEvaluationService extends IService<KcEvaluation> {
List<KcEvaluation> findTj(QueryWrapper<KcEvaluation> queryWrapper);
List<KcEvaluation> getCountlist(KcEvaluation kcEvaluation);
List<KcEvaluation> findTkcsTj(QueryWrapper<KcEvaluation> kcEvaluationQueryWrapper);
}

View File

@ -160,6 +160,11 @@ public class KcEvaluationServiceImpl extends ServiceImpl<KcEvaluationMapper, KcE
return baseMapper.getCountlist(kcEvaluation);
}
@Override
public List<KcEvaluation> findTkcsTj(QueryWrapper<KcEvaluation> kcEvaluationQueryWrapper) {
return baseMapper.findTkcsTj(kcEvaluationQueryWrapper);
}
// appId
private static final String appId = "wx59920eb69d611d7f";//东师

View File

@ -0,0 +1,203 @@
package org.jeecg.modules.kc.wjxWjxx.controller;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
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.common.util.oConvertUtils;
import org.jeecg.modules.kc.wjxWjxx.entity.WjxWjxx;
import org.jeecg.modules.kc.wjxWjxx.service.IWjxWjxxService;
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.modules.tools.AuthService;
import org.jeecg.modules.tools.WjxAuthService;
import org.jeecg.modules.tools.baidu.Base64Util;
import org.jeecg.modules.tools.baidu.FileUtil;
import org.jeecg.modules.tools.baidu.HttpUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
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.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
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: 问卷信息
* @Author: jeecg-boot
* @Date: 2024-04-26
* @Version: V1.0
*/
@Api(tags="问卷信息")
@RestController
@RequestMapping("/wjxWjxx/wjxWjxx")
@Slf4j
public class WjxWjxxController extends JeecgController<WjxWjxx, IWjxWjxxService> {
@Autowired
private IWjxWjxxService wjxWjxxService;
@Autowired
private WjxAuthService wjxAuthService;
/**
* 分页列表查询
*
* @param wjxWjxx
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "问卷信息-分页列表查询")
@ApiOperation(value="问卷信息-分页列表查询", notes="问卷信息-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<WjxWjxx>> queryPageList(WjxWjxx wjxWjxx,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<WjxWjxx> queryWrapper = QueryGenerator.initQueryWrapper(wjxWjxx, req.getParameterMap());
Page<WjxWjxx> page = new Page<WjxWjxx>(pageNo, pageSize);
IPage<WjxWjxx> pageList = wjxWjxxService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param wjxWjxx
* @return
*/
@AutoLog(value = "问卷信息-添加")
@ApiOperation(value="问卷信息-添加", notes="问卷信息-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody WjxWjxx wjxWjxx) {
wjxWjxxService.save(wjxWjxx);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param wjxWjxx
* @return
*/
@AutoLog(value = "问卷信息-编辑")
@ApiOperation(value="问卷信息-编辑", notes="问卷信息-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody WjxWjxx wjxWjxx) {
wjxWjxxService.updateById(wjxWjxx);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "问卷信息-通过id删除")
@ApiOperation(value="问卷信息-通过id删除", notes="问卷信息-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
wjxWjxxService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "问卷信息-批量删除")
@ApiOperation(value="问卷信息-批量删除", notes="问卷信息-批量删除")
@RequiresPermissions("wjxWjxx:wjx_wjxx:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.wjxWjxxService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "问卷信息-通过id查询")
@ApiOperation(value="问卷信息-通过id查询", notes="问卷信息-通过id查询")
@GetMapping(value = "/queryById")
public Result<WjxWjxx> queryById(@RequestParam(name="id",required=true) String id) {
WjxWjxx wjxWjxx = wjxWjxxService.getById(id);
if(wjxWjxx==null) {
return Result.error("未找到对应数据");
}
return Result.OK(wjxWjxx);
}
/**
* 导出excel
*
* @param request
* @param wjxWjxx
*/
@RequiresPermissions("wjxWjxx:wjx_wjxx:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, WjxWjxx wjxWjxx) {
return super.exportXls(request, wjxWjxx, WjxWjxx.class, "问卷信息");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("wjxWjxx:wjx_wjxx:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, WjxWjxx.class);
}
@ApiOperation(value="问卷信息-通过id查询", notes="问卷信息-通过id查询")
@GetMapping(value = "/getWjxLogin")
public Result<WjxWjxx> getWjxLogin() {
try {
// 注意这里仅为了简化编码每一次请求都去获取access_token线上环境access_token有过期时间 客户端可自行缓存过期后重新获取
String accessToken = wjxAuthService.getAuth();
System.out.println(accessToken);
} catch (Exception e) {
e.printStackTrace();
}
return Result.OK(null);
}
@ApiOperation(value="发布问卷", notes="发布问卷")
@GetMapping(value = "/fbwj")
public Result<WjxWjxx> fbwj(@RequestParam(name="id",required=true) String id) {
WjxWjxx wjxWjxx = wjxWjxxService.fbwj(id);
return Result.OK(wjxWjxx);
}
}

View File

@ -0,0 +1,85 @@
package org.jeecg.modules.kc.wjxWjxx.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmxx;
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: 问卷信息
* @Author: jeecg-boot
* @Date: 2024-04-26
* @Version: V1.0
*/
@Data
@TableName("wjx_wjxx")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="wjx_wjxx对象", description="问卷信息")
public class WjxWjxx implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**创建人*/
@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;
/**创建账号*/
@Excel(name = "创建账号", width = 15)
@ApiModelProperty(value = "创建账号")
private java.lang.String creater;
/**问卷类型*/
@Excel(name = "问卷类型", width = 15)
@ApiModelProperty(value = "问卷类型")
private java.lang.Integer atype;
/**问卷名称*/
@Excel(name = "问卷名称", width = 15)
@ApiModelProperty(value = "问卷名称")
private java.lang.String title;
/**问卷描述*/
@Excel(name = "问卷描述", width = 15)
@ApiModelProperty(value = "问卷描述")
private java.lang.String content;
/**是否发布问卷*/
@Excel(name = "是否发布问卷", width = 15, dicCode = "yn")
@Dict(dicCode = "yn")
@ApiModelProperty(value = "是否发布问卷")
private java.lang.String qpublish;
/**是否图片压缩*/
@Excel(name = "是否图片压缩", width = 15)
@ApiModelProperty(value = "是否图片压缩")
private java.lang.String compressImg;
/**题目列表*/
@Excel(name = "题目列表", width = 15)
@ApiModelProperty(value = "题目列表")
private java.lang.String questions;
}

View File

@ -0,0 +1,17 @@
package org.jeecg.modules.kc.wjxWjxx.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.kc.wjxWjxx.entity.WjxWjxx;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 问卷信息
* @Author: jeecg-boot
* @Date: 2024-04-26
* @Version: V1.0
*/
public interface WjxWjxxMapper extends BaseMapper<WjxWjxx> {
}

View File

@ -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.wjxWjxx.mapper.WjxWjxxMapper">
</mapper>

View File

@ -0,0 +1,15 @@
package org.jeecg.modules.kc.wjxWjxx.service;
import org.jeecg.modules.kc.wjxWjxx.entity.WjxWjxx;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 问卷信息
* @Author: jeecg-boot
* @Date: 2024-04-26
* @Version: V1.0
*/
public interface IWjxWjxxService extends IService<WjxWjxx> {
WjxWjxx fbwj(String id);
}

View File

@ -0,0 +1,207 @@
package org.jeecg.modules.kc.wjxWjxx.service.impl;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.kc.wjxWjxx.entity.WjxWjxx;
import org.jeecg.modules.kc.wjxWjxx.mapper.WjxWjxxMapper;
import org.jeecg.modules.kc.wjxWjxx.service.IWjxWjxxService;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmlb;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmxx;
import org.jeecg.modules.kc.wjxWjxxTmlb.mapper.WjxWjxxTmlbMapper;
import org.jeecg.modules.kc.wjxWjxxTmlb.mapper.WjxWjxxTmxxMapper;
import org.jeecg.modules.tools.baidu.HttpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.time.Instant;
import java.util.*;
import static cn.hutool.crypto.digest.DigestUtil.sha1;
/**
* @Description: 问卷信息
* @Author: jeecg-boot
* @Date: 2024-04-26
* @Version: V1.0
*/
@Service
public class WjxWjxxServiceImpl extends ServiceImpl<WjxWjxxMapper, WjxWjxx> implements IWjxWjxxService {
@Autowired
private WjxWjxxTmlbMapper wjxWjxxTmlbMapper;
@Autowired
private WjxWjxxTmxxMapper wjxWjxxTmxxMapper;
@Override
public WjxWjxx fbwj(String id) {
WjxWjxx wjxWjxx = baseMapper.selectById(id);
QueryWrapper<WjxWjxxTmlb> wjxWjxxTmlbQueryWrapper = new QueryWrapper<>();
wjxWjxxTmlbQueryWrapper.eq("main_id", id);
List<WjxWjxxTmlb> wjxWjxxTmlbList =wjxWjxxTmlbMapper.selectList(wjxWjxxTmlbQueryWrapper);
// Map<String,Object> questionsMap = new HashMap<>();
// questionsMap.put("q_index","1");
// questionsMap.put("q_type","3");
// questionsMap.put("q_title",wjxWjxx.getTitle());
// questionsMap.put("q_score","0");
// questionsMap.put("is_requir","true");
// questionsMap.put("q_subtype","3");
// questionsMap.put("q_ceshi","false");
// questionsMap.put("is_zhenbie","false");
// questionsMap.put("min_time","0");
// questionsMap.put("max_time","0");
List<Map<String,Object>> questionsList = new ArrayList<>();
for(WjxWjxxTmlb wWjxWjxxTmlb:wjxWjxxTmlbList){
Map<String,Object> map = new HashMap<>();
map.put("q_index",wWjxWjxxTmlb.getWjIndex());
map.put("q_type",wWjxWjxxTmlb.getWjType());
map.put("q_title",wWjxWjxxTmlb.getWjTitle());
map.put("is_requir",true);
// map.put("q_score",0);
//---------------没用的参数------------------
// map.put("q_subtype",3);
// map.put("q_ceshi","false");
// map.put("q_parsing","解析测试");
// map.put("prompt","提示测试");
// map.put("is_zhenbie","false");
// map.put("min_time","0");
// map.put("max_time","0");
//---------------没用的参数------------------
List<Map<String,Object>> itemsList = new ArrayList<>();
List<WjxWjxxTmxx> tmxxList = wjxWjxxTmxxMapper.selectByMainId(wWjxWjxxTmlb.getId());
for(WjxWjxxTmxx wjxWjxxTmxx:tmxxList){
Map<String,Object> tmxxMap = new HashMap<>();
tmxxMap.put("q_index",wjxWjxxTmxx.getWjIndex());
tmxxMap.put("item_index",wjxWjxxTmxx.getItemIndex());
tmxxMap.put("item_title",wjxWjxxTmxx.getItemTitle());
tmxxMap.put("item_selected",Boolean.parseBoolean(wjxWjxxTmxx.getItemSelected()));
tmxxMap.put("item_score",0);
JSONObject json = new JSONObject(tmxxMap);
itemsList.add(json);
}
map.put("items",itemsList);
JSONObject json = new JSONObject(map);
questionsList.add(json);
}
Long unixTimestamp = Instant.now().getEpochSecond();
String ts = unixTimestamp.toString();
Map<String,Object> map = new HashMap<>();
//-----------题目必穿参数-------------
map.put("atype",1);
map.put("title",wjxWjxx.getTitle());
map.put("desc",wjxWjxx.getContent());
map.put("publish",true);
map.put("questions",questionsList.toString());
//-----------题目必穿参数-------------
//-----------题目没用参数-------------
// map.put("creater","jwctest");
// map.put("compress_img","false");
//-----------题目没用参数-------------
//----------固定传参---------------
map.put("appid","1321039");
map.put("ts",ts);
map.put("action","1000101");
//----------固定传参---------------
//---------------没用的参数------------------
// map.put("encode","SHA1");
// map.put("nocache","0");
//---------------没用的参数------------------
System.out.println("---->"+map);
String appkey = "55328ebd11964fc8b40c10011bcb425d";
// StringBuilder toSign = new StringBuilder();
// for (Map.Entry entry:map.entrySet()) {
// if(StringUtils.isNotBlank(entry.getValue().toString())){
// toSign.append(entry.getValue().toString());
// }
// }
String sign = "";
try {
sign = generateSignature(map, appkey,"SHA1");
}catch (Exception e) {
e.printStackTrace();
}
System.out.println("sign: "+sign);
map.put("sign",sign);
System.out.println("map:"+map.toString());
String url = "https://www.wjx.cn/openapi/default.aspx";
try {
JSONObject json = new JSONObject(map);
System.out.println("json:"+json.toString());
String result = HttpUtil.post(url, "" , "application/json", json.toString());
System.out.println(result);
}catch (Exception e) {
e.printStackTrace();
}
return null;
}
// public void cjwj(){
// String appkey = "":
// String appid = "":
// String ts= "":
// String acction = "":
// Map<String,String> map = new HashMap<String, String>();
// map.put("appid",appid);
// map.put("ts", ts);
// map.put("action",acction);
// String sign = generateSignature(map, appkey,"SHA1");
// }
public String generateSignature(final Map<String, Object> data, String key, String signType) throws Exception {
Set<String> keySet = data.keySet();
String[] keyArray = keySet.toArray(new String[keySet.size()]);
Arrays.sort(keyArray);
StringBuilder sb = new StringBuilder();
for (String k : keyArray) {
if (data.get(k).toString().length() > 0) // 参数值为空则不参与签名
sb.append(data.get(k).toString());
}
sb.append(key);
if ("SHA1".equals(signType)) {
return getSHA1(sb.toString()).toUpperCase();
}
else {
throw new Exception(String.format("Invalid sign_type: %s", signType));
}
}
public String getSHA1(String input) {
try {
MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
byte[] bytes = sha1.digest(input.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : bytes) {
sb.append(String.format("%02x", b));//十六进制
}
return sb.toString();
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
}
}

View File

@ -0,0 +1,283 @@
package org.jeecg.modules.kc.wjxWjxxTmlb.controller;
import java.io.UnsupportedEncodingException;
import java.io.IOException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.vo.LoginUser;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmxx;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmlb;
import org.jeecg.modules.kc.wjxWjxxTmlb.vo.WjxWjxxTmlbPage;
import org.jeecg.modules.kc.wjxWjxxTmlb.service.IWjxWjxxTmlbService;
import org.jeecg.modules.kc.wjxWjxxTmlb.service.IWjxWjxxTmxxService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
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 com.alibaba.fastjson.JSON;
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: 题目信息
* @Author: jeecg-boot
* @Date: 2024-04-26
* @Version: V1.0
*/
@Api(tags="题目信息")
@RestController
@RequestMapping("/wjxWjxxTmlb/wjxWjxxTmlb")
@Slf4j
public class WjxWjxxTmlbController {
@Autowired
private IWjxWjxxTmlbService wjxWjxxTmlbService;
@Autowired
private IWjxWjxxTmxxService wjxWjxxTmxxService;
/**
* 分页列表查询
*
* @param wjxWjxxTmlb
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "题目信息-分页列表查询")
@ApiOperation(value="题目信息-分页列表查询", notes="题目信息-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<WjxWjxxTmlb>> queryPageList(WjxWjxxTmlb wjxWjxxTmlb,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<WjxWjxxTmlb> queryWrapper = QueryGenerator.initQueryWrapper(wjxWjxxTmlb, req.getParameterMap());
Page<WjxWjxxTmlb> page = new Page<WjxWjxxTmlb>(pageNo, pageSize);
IPage<WjxWjxxTmlb> pageList = wjxWjxxTmlbService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
* @return
*/
@AutoLog(value = "题目信息-添加")
@ApiOperation(value="题目信息-添加", notes="题目信息-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody List<WjxWjxxTmlbPage> list) {
if(list.size()>0){
String mainId = list.get(0).getMainId();
QueryWrapper<WjxWjxxTmlb> wjxWjxxTmlbQueryWrapper = new QueryWrapper<WjxWjxxTmlb>();
wjxWjxxTmlbQueryWrapper.eq("main_id",mainId);
List<WjxWjxxTmlb> list2 = wjxWjxxTmlbService.list(wjxWjxxTmlbQueryWrapper);
for(WjxWjxxTmlb WjxWjxxTmlb:list2){
wjxWjxxTmlbService.removeByMainId(WjxWjxxTmlb.getId());
}
for(WjxWjxxTmlbPage wjxWjxxTmlbPage:list){
WjxWjxxTmlb wjxWjxxTmlb = new WjxWjxxTmlb();
BeanUtils.copyProperties(wjxWjxxTmlbPage, wjxWjxxTmlb);
wjxWjxxTmlbService.saveMain(wjxWjxxTmlb, wjxWjxxTmlbPage.getWjxWjxxTmxxList());
}
}
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param wjxWjxxTmlbPage
* @return
*/
@AutoLog(value = "题目信息-编辑")
@ApiOperation(value="题目信息-编辑", notes="题目信息-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody WjxWjxxTmlbPage wjxWjxxTmlbPage) {
WjxWjxxTmlb wjxWjxxTmlb = new WjxWjxxTmlb();
BeanUtils.copyProperties(wjxWjxxTmlbPage, wjxWjxxTmlb);
WjxWjxxTmlb wjxWjxxTmlbEntity = wjxWjxxTmlbService.getById(wjxWjxxTmlb.getId());
if(wjxWjxxTmlbEntity==null) {
return Result.error("未找到对应数据");
}
wjxWjxxTmlbService.updateMain(wjxWjxxTmlb, wjxWjxxTmlbPage.getWjxWjxxTmxxList());
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "题目信息-通过id删除")
@ApiOperation(value="题目信息-通过id删除", notes="题目信息-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
wjxWjxxTmlbService.delMain(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "题目信息-批量删除")
@ApiOperation(value="题目信息-批量删除", notes="题目信息-批量删除")
@RequiresPermissions("wjxWjxxTmlb:wjx_wjxx_tmlb:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.wjxWjxxTmlbService.delBatchMain(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "题目信息-通过id查询")
@ApiOperation(value="题目信息-通过id查询", notes="题目信息-通过id查询")
@GetMapping(value = "/queryById")
public Result<WjxWjxxTmlb> queryById(@RequestParam(name="id",required=true) String id) {
WjxWjxxTmlb wjxWjxxTmlb = wjxWjxxTmlbService.getById(id);
if(wjxWjxxTmlb==null) {
return Result.error("未找到对应数据");
}
return Result.OK(wjxWjxxTmlb);
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "选项信息通过主表ID查询")
@ApiOperation(value="选项信息主表ID查询", notes="选项信息-通主表ID查询")
@GetMapping(value = "/queryWjxWjxxTmxxByMainId")
public Result<List<WjxWjxxTmxx>> queryWjxWjxxTmxxListByMainId(@RequestParam(name="id",required=true) String id) {
List<WjxWjxxTmxx> wjxWjxxTmxxList = wjxWjxxTmxxService.selectByMainId(id);
return Result.OK(wjxWjxxTmxxList);
}
/**
* 导出excel
*
* @param request
* @param wjxWjxxTmlb
*/
@RequiresPermissions("wjxWjxxTmlb:wjx_wjxx_tmlb:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, WjxWjxxTmlb wjxWjxxTmlb) {
// Step.1 组装查询条件查询数据
QueryWrapper<WjxWjxxTmlb> queryWrapper = QueryGenerator.initQueryWrapper(wjxWjxxTmlb, request.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//配置选中数据查询条件
String selections = request.getParameter("selections");
if(oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
queryWrapper.in("id",selectionList);
}
//Step.2 获取导出数据
List<WjxWjxxTmlb> wjxWjxxTmlbList = wjxWjxxTmlbService.list(queryWrapper);
// Step.3 组装pageList
List<WjxWjxxTmlbPage> pageList = new ArrayList<WjxWjxxTmlbPage>();
for (WjxWjxxTmlb main : wjxWjxxTmlbList) {
WjxWjxxTmlbPage vo = new WjxWjxxTmlbPage();
BeanUtils.copyProperties(main, vo);
List<WjxWjxxTmxx> wjxWjxxTmxxList = wjxWjxxTmxxService.selectByMainId(main.getId());
vo.setWjxWjxxTmxxList(wjxWjxxTmxxList);
pageList.add(vo);
}
// Step.4 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "题目信息列表");
mv.addObject(NormalExcelConstants.CLASS, WjxWjxxTmlbPage.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("题目信息数据", "导出人:"+sysUser.getRealname(), "题目信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("wjxWjxxTmlb:wjx_wjxx_tmlb:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
// 获取上传文件对象
MultipartFile file = entity.getValue();
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<WjxWjxxTmlbPage> list = ExcelImportUtil.importExcel(file.getInputStream(), WjxWjxxTmlbPage.class, params);
for (WjxWjxxTmlbPage page : list) {
WjxWjxxTmlb po = new WjxWjxxTmlb();
BeanUtils.copyProperties(page, po);
wjxWjxxTmlbService.saveMain(po, page.getWjxWjxxTmxxList());
}
return Result.OK("文件导入成功!数据行数:" + list.size());
} catch (Exception e) {
log.error(e.getMessage(),e);
return Result.error("文件导入失败:"+e.getMessage());
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return Result.OK("文件导入失败!");
}
@ApiOperation(value="选项信息主表ID查询", notes="选项信息-通主表ID查询")
@GetMapping(value = "/queryByMainId")
public Result<List<WjxWjxxTmlb>> queryByMainId(@RequestParam(name="id",required=true) String id) {
List<WjxWjxxTmlb> WjxWjxxTmlbList = wjxWjxxTmlbService.queryByMainId(id);
return Result.OK(WjxWjxxTmlbList);
}
}

View File

@ -0,0 +1,97 @@
package org.jeecg.modules.kc.wjxWjxxTmlb.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.*;
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;
/**
* @Description: 题目信息
* @Author: jeecg-boot
* @Date: 2024-04-26
* @Version: V1.0
*/
@ApiModel(value="wjx_wjxx_tmlb对象", description="题目信息")
@Data
@TableName("wjx_wjxx_tmlb")
public class WjxWjxxTmlb implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**创建人*/
@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;
/**问卷id*/
@Excel(name = "问卷id", width = 15)
@ApiModelProperty(value = "问卷id")
private java.lang.String mainId;
/**题目编号*/
@Excel(name = "题目编号", width = 15)
@ApiModelProperty(value = "题目编号")
private java.lang.Integer wjIndex;
/**题目类型*/
@Excel(name = "题目类型", width = 15)
@ApiModelProperty(value = "题目类型")
private java.lang.Integer wjType;
/**题目细分类*/
@Excel(name = "题目细分类", width = 15)
@ApiModelProperty(value = "题目细分类")
private java.lang.Integer wjSubtype;
/**问题标题*/
@Excel(name = "问题标题", width = 15)
@ApiModelProperty(value = "问题标题")
private java.lang.String wjTitle;
/**是否必填*/
@Excel(name = "是否必填", width = 15)
@ApiModelProperty(value = "是否必填")
private java.lang.String isRequir;
/**是否是考试*/
@Excel(name = "是否是考试", width = 15)
@ApiModelProperty(value = "是否是考试")
private java.lang.String wjCeshi;
/**问题分值*/
@Excel(name = "问题分值", width = 15)
@ApiModelProperty(value = "问题分值")
private java.lang.Double wjScore;
/**题目解析*/
@Excel(name = "题目解析", width = 15)
@ApiModelProperty(value = "题目解析")
private java.lang.String wjParsing;
/**填写提示*/
@Excel(name = "填写提示", width = 15)
@ApiModelProperty(value = "填写提示")
private java.lang.String prompt;
@TableField(exist = false)
private String itemSelected;
@TableField(exist = false)
private List<WjxWjxxTmxx> wjxWjxxTmxxList;
}

View File

@ -0,0 +1,74 @@
package org.jeecg.modules.kc.wjxWjxxTmlb.entity;
import java.io.Serializable;
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 java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.UnsupportedEncodingException;
/**
* @Description: 选项信息
* @Author: jeecg-boot
* @Date: 2024-04-26
* @Version: V1.0
*/
@ApiModel(value="wjx_wjxx_tmxx对象", description="选项信息")
@Data
@TableName("wjx_wjxx_tmxx")
public class WjxWjxxTmxx implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**创建人*/
@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.Integer wjIndex;
/**选项编号*/
@Excel(name = "选项编号", width = 15)
@ApiModelProperty(value = "选项编号")
private java.lang.Integer itemIndex;
/**选项标题*/
@Excel(name = "选项标题", width = 15)
@ApiModelProperty(value = "选项标题")
private java.lang.String itemTitle;
/**选项文字描述*/
@Excel(name = "选项文字描述", width = 15)
@ApiModelProperty(value = "选项文字描述")
private java.lang.String itemImageText;
/**正确答案*/
@Excel(name = "正确答案", width = 15)
@ApiModelProperty(value = "正确答案")
private java.lang.String itemSelected;
/**选项分值*/
@Excel(name = "选项分值", width = 15)
@ApiModelProperty(value = "选项分值")
private java.lang.Double itemScore;
private String mainId;
}

View File

@ -0,0 +1,17 @@
package org.jeecg.modules.kc.wjxWjxxTmlb.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmlb;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 题目信息
* @Author: jeecg-boot
* @Date: 2024-04-26
* @Version: V1.0
*/
public interface WjxWjxxTmlbMapper extends BaseMapper<WjxWjxxTmlb> {
}

View File

@ -0,0 +1,31 @@
package org.jeecg.modules.kc.wjxWjxxTmlb.mapper;
import java.util.List;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmxx;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* @Description: 选项信息
* @Author: jeecg-boot
* @Date: 2024-04-26
* @Version: V1.0
*/
public interface WjxWjxxTmxxMapper extends BaseMapper<WjxWjxxTmxx> {
/**
* 通过主表id删除子表数据
*
* @param mainId 主表id
* @return boolean
*/
public boolean deleteByMainId(@Param("mainId") String mainId);
/**
* 通过主表id查询子表数据
*
* @param mainId 主表id
* @return List<WjxWjxxTmxx>
*/
public List<WjxWjxxTmxx> selectByMainId(@Param("mainId") String mainId);
}

View File

@ -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.wjxWjxxTmlb.mapper.WjxWjxxTmlbMapper">
</mapper>

View File

@ -0,0 +1,16 @@
<?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.wjxWjxxTmlb.mapper.WjxWjxxTmxxMapper">
<delete id="deleteByMainId" parameterType="java.lang.String">
DELETE
FROM wjx_wjxx_tmxx
WHERE
main_id = #{mainId} </delete>
<select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmxx">
SELECT *
FROM wjx_wjxx_tmxx
WHERE
main_id = #{mainId} </select>
</mapper>

View File

@ -0,0 +1,51 @@
package org.jeecg.modules.kc.wjxWjxxTmlb.service;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmxx;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmlb;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
/**
* @Description: 题目信息
* @Author: jeecg-boot
* @Date: 2024-04-26
* @Version: V1.0
*/
public interface IWjxWjxxTmlbService extends IService<WjxWjxxTmlb> {
/**
* 添加一对多
*
* @param wjxWjxxTmlb
* @param wjxWjxxTmxxList
*/
public void saveMain(WjxWjxxTmlb wjxWjxxTmlb,List<WjxWjxxTmxx> wjxWjxxTmxxList) ;
/**
* 修改一对多
*
* @param wjxWjxxTmlb
* @param wjxWjxxTmxxList
*/
public void updateMain(WjxWjxxTmlb wjxWjxxTmlb,List<WjxWjxxTmxx> wjxWjxxTmxxList);
/**
* 删除一对多
*
* @param id
*/
public void delMain (String id);
/**
* 批量删除一对多
*
* @param idList
*/
public void delBatchMain (Collection<? extends Serializable> idList);
void removeByMainId(String id);
List<WjxWjxxTmlb> queryByMainId(String id);
}

View File

@ -0,0 +1,23 @@
package org.jeecg.modules.kc.wjxWjxxTmlb.service;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmlb;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmxx;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @Description: 选项信息
* @Author: jeecg-boot
* @Date: 2024-04-26
* @Version: V1.0
*/
public interface IWjxWjxxTmxxService extends IService<WjxWjxxTmxx> {
/**
* 通过主表id查询子表数据
*
* @param mainId 主表id
* @return List<WjxWjxxTmxx>
*/
public List<WjxWjxxTmxx> selectByMainId(String mainId);
}

View File

@ -0,0 +1,119 @@
package org.jeecg.modules.kc.wjxWjxxTmlb.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmlb;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmxx;
import org.jeecg.modules.kc.wjxWjxxTmlb.mapper.WjxWjxxTmxxMapper;
import org.jeecg.modules.kc.wjxWjxxTmlb.mapper.WjxWjxxTmlbMapper;
import org.jeecg.modules.kc.wjxWjxxTmlb.service.IWjxWjxxTmlbService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import javax.management.Query;
import java.io.Serializable;
import java.util.List;
import java.util.Collection;
/**
* @Description: 题目信息
* @Author: jeecg-boot
* @Date: 2024-04-26
* @Version: V1.0
*/
@Service
public class WjxWjxxTmlbServiceImpl extends ServiceImpl<WjxWjxxTmlbMapper, WjxWjxxTmlb> implements IWjxWjxxTmlbService {
@Autowired
private WjxWjxxTmlbMapper wjxWjxxTmlbMapper;
@Autowired
private WjxWjxxTmxxMapper wjxWjxxTmxxMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public void saveMain(WjxWjxxTmlb wjxWjxxTmlb, List<WjxWjxxTmxx> wjxWjxxTmxxList) {
wjxWjxxTmlbMapper.insert(wjxWjxxTmlb);
if(wjxWjxxTmxxList!=null && wjxWjxxTmxxList.size()>0) {
for(WjxWjxxTmxx entity:wjxWjxxTmxxList) {
//外键设置
entity.setMainId(wjxWjxxTmlb.getId());
entity.setWjIndex(wjxWjxxTmlb.getWjIndex());
String itemSelected[] = wjxWjxxTmlb.getItemSelected().split(",");
String sfxz = "false";
for(String par:itemSelected){
if(StringUtils.equals(par, entity.getItemIndex().toString())){
sfxz = "true";
}
}
entity.setItemSelected(sfxz);
wjxWjxxTmxxMapper.insert(entity);
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateMain(WjxWjxxTmlb wjxWjxxTmlb,List<WjxWjxxTmxx> wjxWjxxTmxxList) {
wjxWjxxTmlbMapper.updateById(wjxWjxxTmlb);
//1.先删除子表数据
wjxWjxxTmxxMapper.deleteByMainId(wjxWjxxTmlb.getId());
//2.子表数据重新插入
if(wjxWjxxTmxxList!=null && wjxWjxxTmxxList.size()>0) {
for(WjxWjxxTmxx entity:wjxWjxxTmxxList) {
//外键设置
entity.setWjIndex(wjxWjxxTmlb.getWjIndex());
wjxWjxxTmxxMapper.insert(entity);
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delMain(String id) {
wjxWjxxTmxxMapper.deleteByMainId(id);
wjxWjxxTmlbMapper.deleteById(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delBatchMain(Collection<? extends Serializable> idList) {
for(Serializable id:idList) {
wjxWjxxTmxxMapper.deleteByMainId(id.toString());
wjxWjxxTmlbMapper.deleteById(id);
}
}
@Override
public void removeByMainId(String id) {
wjxWjxxTmxxMapper.deleteByMainId(id);
wjxWjxxTmlbMapper.deleteById(id);
}
@Override
public List<WjxWjxxTmlb> queryByMainId(String id) {
QueryWrapper<WjxWjxxTmlb> wjxWjxxTmlbQueryWrapper = new QueryWrapper<WjxWjxxTmlb>();
wjxWjxxTmlbQueryWrapper.eq("main_id",id);
List<WjxWjxxTmlb> list = wjxWjxxTmlbMapper.selectList(wjxWjxxTmlbQueryWrapper);
for(WjxWjxxTmlb WjxWjxxTmlb:list){
List<WjxWjxxTmxx> list2= wjxWjxxTmxxMapper.selectByMainId(WjxWjxxTmlb.getId());
String itemSelected = "";
for(WjxWjxxTmxx WjxWjxxTmxx:list2){
if(StringUtils.equals(WjxWjxxTmxx.getItemSelected(),"true")){
itemSelected = itemSelected+WjxWjxxTmxx.getItemIndex()+",";
}
}
if(StringUtils.isNotBlank(itemSelected)){
itemSelected = itemSelected.substring(0, itemSelected.length()-1);
}
WjxWjxxTmlb.setItemSelected(itemSelected);
WjxWjxxTmlb.setWjxWjxxTmxxList(list2);
}
return list;
}
}

View File

@ -0,0 +1,27 @@
package org.jeecg.modules.kc.wjxWjxxTmlb.service.impl;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmxx;
import org.jeecg.modules.kc.wjxWjxxTmlb.mapper.WjxWjxxTmxxMapper;
import org.jeecg.modules.kc.wjxWjxxTmlb.service.IWjxWjxxTmxxService;
import org.springframework.stereotype.Service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description: 选项信息
* @Author: jeecg-boot
* @Date: 2024-04-26
* @Version: V1.0
*/
@Service
public class WjxWjxxTmxxServiceImpl extends ServiceImpl<WjxWjxxTmxxMapper, WjxWjxxTmxx> implements IWjxWjxxTmxxService {
@Autowired
private WjxWjxxTmxxMapper wjxWjxxTmxxMapper;
@Override
public List<WjxWjxxTmxx> selectByMainId(String mainId) {
return wjxWjxxTmxxMapper.selectByMainId(mainId);
}
}

View File

@ -0,0 +1,26 @@
package org.jeecg.modules.kc.wjxWjxxTmlb.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmxx;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
/**
* @Description: 题目信息
* @Author: jeecg-boot
* @Date: 2024-04-26
* @Version: V1.0
*/
@Data
public class WjxWjxxTmlbNewPage {
private List<WjxWjxxTmlbPage> WjxWjxxTmlbPageList;
}

View File

@ -0,0 +1,93 @@
package org.jeecg.modules.kc.wjxWjxxTmlb.vo;
import java.util.List;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmlb;
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmxx;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelEntity;
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description: 题目信息
* @Author: jeecg-boot
* @Date: 2024-04-26
* @Version: V1.0
*/
@Data
@ApiModel(value="wjx_wjxx_tmlbPage对象", description="题目信息")
public class WjxWjxxTmlbPage {
/**id*/
@ApiModelProperty(value = "id")
private java.lang.String id;
/**创建人*/
@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;
/**问卷id*/
@Excel(name = "问卷id", width = 15)
@ApiModelProperty(value = "问卷id")
private java.lang.String mainId;
/**题目编号*/
@Excel(name = "题目编号", width = 15)
@ApiModelProperty(value = "题目编号")
private java.lang.Integer wjIndex;
/**题目类型*/
@Excel(name = "题目类型", width = 15)
@ApiModelProperty(value = "题目类型")
private java.lang.Integer wjType;
/**题目细分类*/
@Excel(name = "题目细分类", width = 15)
@ApiModelProperty(value = "题目细分类")
private java.lang.Integer wjSubtype;
/**问题标题*/
@Excel(name = "问题标题", width = 15)
@ApiModelProperty(value = "问题标题")
private java.lang.String wjTitle;
/**是否必填*/
@Excel(name = "是否必填", width = 15)
@ApiModelProperty(value = "是否必填")
private java.lang.String isRequir;
/**是否是考试*/
@Excel(name = "是否是考试", width = 15)
@ApiModelProperty(value = "是否是考试")
private java.lang.String wjCeshi;
/**问题分值*/
@Excel(name = "问题分值", width = 15)
@ApiModelProperty(value = "问题分值")
private java.lang.Double wjScore;
/**题目解析*/
@Excel(name = "题目解析", width = 15)
@ApiModelProperty(value = "题目解析")
private java.lang.String wjParsing;
/**填写提示*/
@Excel(name = "填写提示", width = 15)
@ApiModelProperty(value = "填写提示")
private java.lang.String prompt;
private String itemSelected;
@ExcelCollection(name="选项信息")
@ApiModelProperty(value = "选项信息")
private List<WjxWjxxTmxx> wjxWjxxTmxxList;
}

View File

@ -11,10 +11,10 @@ import org.springframework.stereotype.Component;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.net.URLEncoder;
/**
* 获取token类
@ -118,4 +118,28 @@ public class AuthService {
}
return null;
}
public String body_num(String filePath) {
// 请求url
String url = "https://aip.baidubce.com/rest/2.0/image-classify/v1/body_num";
try {
// 本地文件路径
byte[] imgData = FileUtil.readFileByBytes(filePath);
String imgStr = Base64Util.encode(imgData);
String imgParam = URLEncoder.encode(imgStr, "UTF-8");
String param = "image=" + imgParam;
// 注意这里仅为了简化编码每一次请求都去获取access_token线上环境access_token有过期时间 客户端可自行缓存过期后重新获取
String accessToken = getAuth();
String result = HttpUtil.post(url, accessToken, param);
System.out.println(result);
return result;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

View File

@ -54,6 +54,7 @@ public class URLEncoder implements Serializable {
this.safeCharacters = safeCharacters;
}
public void addSafeCharacter(char c) {
this.safeCharacters.set(c);
}

View File

@ -0,0 +1,101 @@
package org.jeecg.modules.tools;
import com.alibaba.fastjson.JSONObject;
import org.jeecg.modules.tools.baidu.Base64Util;
import org.jeecg.modules.tools.baidu.FileUtil;
import org.jeecg.modules.tools.baidu.GsonUtils;
import org.jeecg.modules.tools.baidu.HttpUtil;
import org.jeewx.api.core.util.DateUtils;
import org.springframework.stereotype.Component;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.time.Instant;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static cn.hutool.crypto.SecureUtil.sha1;
import static org.apache.poi.poifs.crypt.HashAlgorithm.sha1;
/**
* 获取token类
*/
@Component
public class WjxAuthService {
/**
* 获取权限token
* @return 返回示例
* {
* "access_token": "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567",
* "expires_in": 2592000
* }
*/
public static String getAuth() {
String appid = "1321039";
String appkey = "55328ebd11964fc8b40c10011bcb425d";
String subuser = "jwctest";
String mobile = "15844013241";
String email = "";
String roleId = "2";
Long unixTimestamp = Instant.now().getEpochSecond();
String ts = unixTimestamp.toString();
String sign = sha1(appid+appkey+subuser+mobile+roleId+ts);
return getAuth(appid, subuser,ts,sign);
}
/**
* 获取API访问token
* 该token有一定的有效期需要自行管理当失效时需重新获取.
*/
public static String getAuth(String appid, String subuser,String ts,String sign) {
// 获取token地址
String authHost = "https://www.wjx.cn/openapi/default.aspx?";
String getAccessTokenUrl = authHost
+ "appid="+appid
+ "&subuser=" + subuser
+ "&ts=" + ts
+ "&sign=" + sign;
System.out.println("----------------------------------------------------");
System.out.println(getAccessTokenUrl);
System.out.println("----------------------------------------------------");
try {
URL realUrl = new URL(getAccessTokenUrl);
// 打开和URL之间的连接
HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection();
connection.setRequestMethod("GET");
connection.connect();
// 获取所有响应头字段
Map<String, List<String>> map = connection.getHeaderFields();
// 遍历所有的响应头字段
for (String key : map.keySet()) {
System.err.println(key + "--->" + map.get(key));
}
// 定义 BufferedReader输入流来读取URL的响应
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String result = "";
String line;
while ((line = in.readLine()) != null) {
result += line;
}
/**
* 返回结果示例
*/
System.err.println("result:" + result);
JSONObject jsonObject = JSONObject.parseObject(result);
String access_token = jsonObject.getString("access_token");
return access_token;
} catch (Exception e) {
System.err.printf("获取token失败");
e.printStackTrace(System.err);
}
return null;
}
}

View File

@ -326,3 +326,7 @@ ffmpeg:
isDeleteSourceFile: true
# 压缩文件扩展名范围
extensionFilter: png,jpg,jpeg
# 维普检测接口
weipu:
userId: 765996
userKey: 330ed91f6c7e4600a454a6a5216723bf