修改bug

This commit is contained in:
yangjun 2024-08-22 13:36:22 +08:00
parent c7052421fd
commit f7dd32a5d0
53 changed files with 2667 additions and 128 deletions

View File

@ -94,7 +94,7 @@ public class SyncKcktStat extends BaseSync {
kcKechengbiaoQueryWrapper.eq("jkzc",KcKechengbiaoPar.getJkzc());
kcKechengbiaoQueryWrapper.eq("xf",KcKechengbiaoPar.getXf());
kcKechengbiaoQueryWrapper.eq("xnxq",KcKechengbiaoPar.getXnxq());
kcKechengbiaoQueryWrapper.eq("kcdl",KcKechengbiaoPar.getKcdl());
// kcKechengbiaoQueryWrapper.eq("kcdl",KcKechengbiaoPar.getKcdl());
List<KcKechengbiao> KcKechengbiaoInsList = kcKechengbiaoService.list(kcKechengbiaoQueryWrapper);
if(KcKechengbiaoInsList!=null&&KcKechengbiaoInsList.size()>0){
for(KcKechengbiao KcKechengbiao : KcKechengbiaoInsList){
@ -180,6 +180,7 @@ public class SyncKcktStat extends BaseSync {
e.printStackTrace();
}
}
System.out.println("---------------arrayList.size()-------------------"+arrayList.size());
kcKetangbiaoService.saveBatch(arrayList);
//修改智慧教室关联的课堂表id-- 清洗智慧教室数据

View File

@ -60,65 +60,65 @@ public class SyncTJwKckb extends BaseSync {
public void run(Map<String, Object> param){
//查询数据
List<TJwKckb> inDataList = expService.list();
List<XxhbkckbOra> outDataList = Lists.newArrayList();
List<Xxhbkckb> outDataList = Lists.newArrayList();
//清洗数据
inDataList.forEach(x -> outDataList.add(BeanUtil.toBean(x, XxhbkckbOra.class)));
inDataList.forEach(x -> outDataList.add(BeanUtil.toBean(x, Xxhbkckb.class)));
//保存到胃
try {
xxhbkckbOraService.syncList(outDataList);
}catch (Exception e){
e.printStackTrace();
}
//查询异常的节次数据
List<XxhbkckbOra> oraList = xxhbkckbOraService.getSksjList();
List<KcJieciPipei> kcJieciPipeiList = new ArrayList<>();
for(int i=0;i<oraList.size();i++){
KcJieciPipei par = new KcJieciPipei();
par.setExpCol(oraList.get(i).getSksj());
kcJieciPipeiList.add(par);
}
//不为空则插入数据
if(kcJieciPipeiList != null){
kcJieciPipeiService.saveBatch(kcJieciPipeiList);
}
//查询全部ora数据
List<XxhbkckbOra> list = xxhbkckbOraService.list();
List<Xxhbkckb> importDataList = Lists.newArrayList();
for(XxhbkckbOra par:list){
String sksjArr = par.getSksj();//获取授课事件结合例如7010203040506070809101112
if(StringUtils.isEmpty(sksjArr)){
continue;
}
String week = sksjArr.substring(0,1);//获取周几上课例如7
String sksj = sksjArr.substring(1,sksjArr.length());//获取具体的上课节次例如010203040506070809101112
QueryWrapper<KcJieciPipei> kcJieciPipeiQueryWrapper = new QueryWrapper<>();
kcJieciPipeiQueryWrapper.eq("exp_col",sksj);
kcJieciPipeiQueryWrapper.last("limit 1");
KcJieciPipei kcJieciPipei = kcJieciPipeiService.getOne(kcJieciPipeiQueryWrapper);//根据当前节次获取对应的正确节次数据
//组装拆分后的数据封装到xxhbkckb表中
if(kcJieciPipei != null && StringUtils.isNotBlank(kcJieciPipei.getNorCol())){
String norCol[] = StringUtils.split(kcJieciPipei.getNorCol(),"|");
for(String nor : norCol){
Xxhbkckb xxhbkckb = new Xxhbkckb();
BeanUtil.copyProperties(par,xxhbkckb);
xxhbkckb.setId(null);
xxhbkckb.setSksj(week+nor);
importDataList.add(xxhbkckb);
}
}
}
// //保存到胃
// try {
// xxhbkckbOraService.syncList(outDataList);
// }catch (Exception e){
// e.printStackTrace();
// }
//
// //查询异常的节次数据
// List<XxhbkckbOra> oraList = xxhbkckbOraService.getSksjList();
// List<KcJieciPipei> kcJieciPipeiList = new ArrayList<>();
// for(int i=0;i<oraList.size();i++){
// KcJieciPipei par = new KcJieciPipei();
// par.setExpCol(oraList.get(i).getSksj());
// kcJieciPipeiList.add(par);
// }
// //不为空则插入数据
// if(kcJieciPipeiList != null){
// kcJieciPipeiService.saveBatch(kcJieciPipeiList);
// }
//
// //查询全部ora数据
// List<XxhbkckbOra> list = xxhbkckbOraService.list();
// List<Xxhbkckb> importDataList = Lists.newArrayList();
// for(XxhbkckbOra par:list){
// String sksjArr = par.getSksj();//获取授课事件结合例如7010203040506070809101112
// if(StringUtils.isEmpty(sksjArr)){
// continue;
// }
// String week = sksjArr.substring(0,1);//获取周几上课例如7
// String sksj = sksjArr.substring(1,sksjArr.length());//获取具体的上课节次例如010203040506070809101112
//
// QueryWrapper<KcJieciPipei> kcJieciPipeiQueryWrapper = new QueryWrapper<>();
// kcJieciPipeiQueryWrapper.eq("exp_col",sksj);
// kcJieciPipeiQueryWrapper.last("limit 1");
// KcJieciPipei kcJieciPipei = kcJieciPipeiService.getOne(kcJieciPipeiQueryWrapper);//根据当前节次获取对应的正确节次数据
// //组装拆分后的数据封装到xxhbkckb表中
// if(kcJieciPipei != null && StringUtils.isNotBlank(kcJieciPipei.getNorCol())){
// String norCol[] = StringUtils.split(kcJieciPipei.getNorCol(),"|");
// for(String nor : norCol){
// Xxhbkckb xxhbkckb = new Xxhbkckb();
// BeanUtil.copyProperties(par,xxhbkckb);
// xxhbkckb.setId(null);
// xxhbkckb.setSksj(week+nor);
// importDataList.add(xxhbkckb);
// }
// }
// }
//保存到胃
int syncnum=0;
String errorMessage = "";
try {
QueryWrapper dqw = new QueryWrapper();
impService.remove(dqw);
impService.syncList(importDataList);
impService.syncList(outDataList);
syncnum = outDataList.size();
}catch (Exception e){
e.printStackTrace();

View File

@ -5,4 +5,5 @@
<select id="getSumnum" resultType="org.jeecg.modules.kc.grab.imports.entity.Xxhbkckb">
select count(*) as mysqlnum from xxhbkckb
</select>
</mapper>

View File

@ -287,11 +287,83 @@ public class KcSysConfigController extends JeecgController<KcSysConfig, IKcSysCo
@AutoLog(value = "课程系统配置-通过id查询")
@GetMapping(value = "/listKcxx")
public Result<IPage<KcSysConfig>> listKcxx(KcSysConfig kcSysConfig,HttpServletRequest req) {
public Result<String> listKcxx(KcSysConfig kcSysConfig,HttpServletRequest req) {
try {
kcSysConfig = kcSysConfigService.getById("1");
Date dateNow = new Date();
QueryWrapper<KcKechengbiao> kcKechengbiaoQueryWrapper = new QueryWrapper<>();
kcKechengbiaoQueryWrapper.eq("xqxn",kcSysConfig.getFlag1());
kcKechengbiaoQueryWrapper.last("limit 1");
List<KcKechengbiao> kcbList = kcKechengbiaoService.list(kcKechengbiaoQueryWrapper);
if(kcbList.size()==0){
//-----------------删除对应数据--------------------------
QueryWrapper<KcKechengbiao> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("xqxn",kcSysConfig.getFlag1());
kcKechengbiaoService.remove(queryWrapper);
System.out.println("-------------11111111111111111111111------------------");
//-----------------删除对应数据-----------------------
//-----------------初始化数据------------------------
KcKechengbiao kcKechengbiao = new KcKechengbiao();
kcKechengbiao.setXqxn(kcSysConfig.getFlag1());
kcKechengbiaoService.syncKechengbiao(kcKechengbiao);
System.out.println("-------------22222222222222222222222------------------");
//-----------------初始化数据------------------------
//---------------删除对应数据--------------------
QueryWrapper<KcKetangbiao> queryWrapper2 = new QueryWrapper<>();
queryWrapper2.eq("xnxq",kcSysConfig.getFlag1());
kcKetangbiaoService.remove(queryWrapper2);
System.out.println("-------------33333333333333333333333333------------------");
//---------------删除对应数据--------------------
String bxqkssj = kcSysConfig.getBxqkssj();
//插入数据
KcKetangbiao kcKetangbiao = new KcKetangbiao();
kcKetangbiao.setXnxq(kcSysConfig.getFlag1());
kcKetangbiao.setFlag("0");
List<KcKetangbiao> list = kcKetangbiaoService.selectSyncList(kcKetangbiao);
System.out.println("-------------list。size------------------"+list.size());
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");
kcKetangbiaoAddNew.setSkrq(skrq);
kcKetangbiaoAddNew.setDijizhou(djz);
kcKetangbiaoAddNew.setXnxq(kcSysConfig.getFlag1());
kcKetangbiaoAddNew.setSkxs(1);
arrayList.add(kcKetangbiaoAddNew);
}
}catch (Exception e){
e.printStackTrace();
}
}
System.out.println("-------------4444444444444444444444444------------------");
kcKetangbiaoService.saveBatch(arrayList);
System.out.println("-------------5555555555555555555555555------------------");
}
// //-----------------向历史数据添加数据--------------------------
// List<KcKechengbiao> listKcb = kcKechengbiaoService.list();
@ -305,17 +377,7 @@ public class KcSysConfigController extends JeecgController<KcSysConfig, IKcSysCo
// listHisKcb.add(his);
// }
// kcKechengbiaoHisService.saveBatch(listHisKcb);
// //-----------------向历史数据添加数据--------------------------
// QueryWrapper<KcKechengbiao> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("xqxn",kcSysConfig.getFlag1());
// kcKechengbiaoService.remove(queryWrapper);
// //-----------------删除原来的数据-----------------------
//-----------------初始化数据------------------------
KcKechengbiao kcKechengbiao = new KcKechengbiao();
kcKechengbiao.setXqxn(kcSysConfig.getFlag1());
kcKechengbiaoService.syncKechengbiao(kcKechengbiao);
//-----------------初始化数据------------------------
@ -332,51 +394,13 @@ public class KcSysConfigController extends JeecgController<KcSysConfig, IKcSysCo
// }
// kcKetangbiaoHisService.saveBatch(arrayHisList);
// //---------------向历史数据里添加记录----------------
//
// //---------------删除对应数据--------------------
// QueryWrapper<KcKetangbiao> queryWrapper2 = new QueryWrapper<>();
// queryWrapper2.eq("xnxq",kcSysConfig.getFlag1());
// kcKetangbiaoService.remove(queryWrapper2);
// //---------------删除对应数据--------------------
String bxqkssj = kcSysConfig.getBxqkssj();
//插入数据
KcKetangbiao kcKetangbiao = new KcKetangbiao();
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");
kcKetangbiaoAddNew.setSkrq(skrq);
kcKetangbiaoAddNew.setDijizhou(djz);
kcKetangbiaoAddNew.setXnxq(kcSysConfig.getFlag1());
arrayList.add(kcKetangbiaoAddNew);
}
}catch (Exception e){
e.printStackTrace();
}
}
kcKetangbiaoService.saveBatch(arrayList);
return Result.OK("操作成功");

View File

@ -9,17 +9,16 @@
jrfs,ewmwj,qmc,qlx,leixing,isqzyz,jkzc1,xf,xq,jgh,xnxq,jzglb,sfcj,skxs,sfzc,bz,zt,kcdl,xqxn
) select
kcbh,kcmc,xm as skjs,zc,xkrs,pkrs,rwbh,kkdw,kcxz,skdd,sksj,
substring(jkzc,2,length(jkzc)-2) as jkzc,concat(substring(sksj,2,2),'、',substring(sksj,4,2)) as hh,substring(sksj,1,1) as week,
jkzc,concat(substring(sksj,2,2),'、',substring(sksj,4,2)) as hh,substring(sksj,1,1) as week,
jc.hhks as hhks,jc.hhjs as hhjs,
'' as dsz,'' as wwks, '' as wwjs,'腾讯会议' as zbfs,'' as hyh,'' as hymm,'' as kclj,'' as beizhu,'' as zbpx,kkdwid,
'' as jrfs,'' as ewmwj,'' as qmc, '' as qlx,'' as leixing,'' as isqzyz,substring(jkzc,2,length(jkzc)-2) as jkzc1,xf,
'' as jrfs,'' as ewmwj,'' as qmc, '' as qlx,'' as leixing,'' as isqzyz,jkzc as jkzc1,xf,
case when xqbh = 'B' then '本部'
when xqbh = 'J' then '净月'
when xqbh = 'U' then '全部'
ELSE '' END as xq,
jgh,xnxq,jzglb,1 as sfcj,sfxsk as skxs,'' as sfzc,'' as bz,'' as zt,kcdl,#{xqxn}
from xxhbkckb t,kc_jieci jc where concat(substring(sksj,2,2),'、',substring(sksj,4,2)) = jc.jieci
and (t.kcdl is null or t.kcdl != '毕业设计')
from v_xxhbkckb t,kc_jieci jc where concat(substring(sksj,2,2),'、',substring(sksj,4,2)) = jc.jieci
<!-- and (t.kcdl is null )-->
<!-- <if test="startTime != null and startTime != ''">-->
<!-- and sksj > #{startTime}-->
@ -68,16 +67,16 @@
<select id="getKechengbiaoList" resultType="org.jeecg.modules.kc.ktgl.entity.KcKechengbiao">
select
kcbh,kcmc,xm as skjs,zc,xkrs,pkrs,rwbh,kkdw,kcxz,skdd,sksj,
substring(jkzc,2,length(jkzc)-2) as jkzc,concat(substring(sksj,2,2),'、',substring(sksj,4,2)) as hh,substring(sksj,1,1) as week,
jkzc,concat(substring(sksj,2,2),'、',substring(sksj,4,2)) as hh,substring(sksj,1,1) as week,
jc.hhks as hhks,jc.hhjs as hhjs,
'' as dsz,'' as wwks, '' as wwjs,'腾讯会议' as zbfs,'' as hyh,'' as hymm,'' as kclj,'' as beizhu,'' as zbpx,kkdwid,
'' as jrfs,'' as ewmwj,'' as qmc, '' as qlx,'' as leixing,'' as isqzyz,substring(jkzc,2,length(jkzc)-2) as jkzc1,xf,
'' as jrfs,'' as ewmwj,'' as qmc, '' as qlx,'' as leixing,'' as isqzyz,jkzc as jkzc1,xf,
case when xqbh = 'B' then '本部'
when xqbh = 'J' then '净月'
when xqbh = 'U' then '全部'
ELSE '' END as xq,
jgh,xnxq,jzglb,1 as sfcj,sfxsk as skxs,'' as sfzc,'' as bz,'' as zt,kcdl,#{xqxn} as xqxn
from xxhbkckb t,kc_jieci jc where concat(substring(sksj,2,2),'、',substring(sksj,4,2)) = jc.jieci and t.kcdl != '毕业设计' and (t.jgh is not null or t.JKZC is not null)
from v_xxhbkckb t,kc_jieci jc where concat(substring(sksj,2,2),'、',substring(sksj,4,2)) = jc.jieci and t.kcmc != '毕业论文' and (t.jgh is not null or t.JKZC is not null)
<if test="skjs!=null and skjs!=''">
and t.xm =#{skjs}
</if>
@ -124,7 +123,7 @@
where kc.xqxn = #{xnxq}
</update>
<update id="updateYxByXxhbkckb">
update xxhbkckb a,kc_kechengbiao b
update v_xxhbkckb a,kc_kechengbiao b
set b.flag = '0'
where 1=1
and a.kcbh = b.kcbh
@ -133,8 +132,7 @@
and a.skdd = b.skdd
and a.sksj = b.sksj
and a.XNXQ = b.xnxq
and b.jkzc = substring(a.jkzc,2,length(a.jkzc)-2)
and a.XNXQ = b.xnxq
and b.jkzc = a.jkzc
</update>

View File

@ -115,7 +115,7 @@
</select>
<select id="findDjjgsPage" parameterType="org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxx" resultType="org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxx">
select a.atype,b.id,a.xqxn,a.kcmc,a.start_time,a.end_time,a.title,a.content,b.vid,b.jid,b.user_id,b.user_name,b.open_time,b.commit_time,b.score,b.total_score,b.answer_seconds
select a.atype,b.id,a.xqxn,a.kcmc,a.start_time,a.end_time,a.title,a.content,b.vid,b.jid,b.user_id,b.user_name,b.open_time,b.commit_time,b.score,b.total_score,b.answer_seconds,a.title
from wjx_wjxx a
inner join wjx_djxx b on a.vid = b.vid
where a.id = #{params.id}
@ -129,7 +129,7 @@
</select>
<select id="findUnDjjgsPage" parameterType="org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxx" resultType="org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxx">
select x.atype,x.id,x.xqxn,x.kcmc,x.start_time,x.end_time,x.title,x.content,'' as vid,'' as jid,y.xh as user_id,y.xm as user_name,0 as score,0 as total_score,'' as answerSfm
select x.atype,x.id,x.xqxn,x.kcmc,x.start_time,x.end_time,x.title,x.content,'' as vid,'' as jid,y.xh as user_id,y.xm as user_name,0 as score,0 as total_score,'' as answerSfm,x.title
from wjx_wjxx x
inner join (
select a.xh,a.xm,b.KCAPZBBH
@ -151,7 +151,7 @@
</select>
<select id="findAllDjjgsPage" parameterType="org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxx" resultType="org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxx">
select a.atype,b.id,a.xqxn,a.kcmc,a.start_time,a.end_time,a.title,a.content,b.vid,b.jid,y.xh as user_id,y.xm as user_name,b.open_time,b.commit_time,b.score,b.total_score,ifnull(b.answer_seconds,-1) as answer_seconds
select a.atype,b.id,a.xqxn,a.kcmc,a.start_time,a.end_time,a.title,a.content,b.vid,b.jid,y.xh as user_id,y.xm as user_name,b.open_time,b.commit_time,b.score,b.total_score,ifnull(b.answer_seconds,-1) as answer_seconds,a.title
from wjx_wjxx a
inner join (
select a.xh,a.xm,b.KCAPZBBH

View File

@ -1,15 +1,13 @@
package org.jeecg.modules.kc.wjxWjxx.controller;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.xkcoding.http.HttpUtil;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
@ -21,6 +19,7 @@ import org.jeecg.modules.kc.grab.imports.entity.Xxhbbks;
import org.jeecg.modules.kc.grab.imports.service.IXxhbbksService;
import org.jeecg.modules.kc.kcSysConfig.entity.KcSysConfig;
import org.jeecg.modules.kc.kcSysConfig.service.IKcSysConfigService;
import org.jeecg.modules.kc.kcWechatSendLog.entity.KcWechatSendLog;
import org.jeecg.modules.kc.ktgl.entity.KcKechengbiao;
import org.jeecg.modules.kc.ktgl.service.IKcKechengbiaoService;
import org.jeecg.modules.kc.wjxWjxx.entity.KccyglSys;
@ -47,7 +46,9 @@ import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -405,12 +406,100 @@ public class WjxWjxxController extends JeecgController<WjxWjxx, IWjxWjxxService>
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
zyDbtx.setFbr(user.getUsername());
zyDbtxService.save(zyDbtx);
try {
KcWechatSendLog kcWechatSendLog = new KcWechatSendLog();
// kcWechatSendLog.setOpenid(xxhbbks.getXh());
kcWechatSendLog.setOpenid("2016900057");//指定曹老师账号
kcWechatSendLog.setYtkcs(zyDbtx.getContent());
sendWxmessage(kcWechatSendLog);
}catch (Exception e){
e.printStackTrace();
}
}
return Result.OK(res);
}
@ApiOperation(value="发布问卷", notes="发布问卷")
@GetMapping(value = "/sendWjWechat")
public Result<WjxWjxx> sendWjWechat(@RequestParam(name="id",required=true) String id,@RequestParam(name="wjlx",required=true) String wjlx) {
WjxWjxx wjxWjxx=wjxWjxxService.getById(id);
QueryWrapper<Xxhbbks> queryWrapper = new QueryWrapper<>();
queryWrapper.apply("a.xh = b.xh");
queryWrapper.eq("b.KCAPZBBH",wjxWjxx.getRwbh());
List<Xxhbbks> list = xxhbbksService.getXsxkbAllList(queryWrapper);
String content = "";
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(StringUtils.equals(wjlx,"6")){
content = sysUser.getRealname()+"教师发起了["+wjxWjxx.getKcmc()+"]课程“"+wjxWjxx.getTitle()+"”测验,该测验完成时间: "+DateUtils.formatDate(wjxWjxx.getStartTime(),"yyyy-MM-dd")+" ~ "+DateUtils.formatDate(wjxWjxx.getEndTime(),"yyyy-MM-dd")+",请及时完成";
}else{
content = sysUser.getRealname()+"教师发起了["+wjxWjxx.getKcmc()+"]课程“"+wjxWjxx.getTitle()+"”问卷,该问卷完成时间: "+DateUtils.formatDate(wjxWjxx.getStartTime(),"yyyy-MM-dd")+" ~ "+DateUtils.formatDate(wjxWjxx.getEndTime(),"yyyy-MM-dd")+",请及时完成";
}
for(Xxhbbks xxhbbks:list){
try {
KcWechatSendLog kcWechatSendLog = new KcWechatSendLog();
// kcWechatSendLog.setOpenid(xxhbbks.getXh());
kcWechatSendLog.setOpenid("2016900057");//指定曹老师账号
kcWechatSendLog.setYtkcs(content);
sendWxmessage(kcWechatSendLog);
}catch (Exception e){
e.printStackTrace();
}
}
return Result.OK(null);
}
// appId
private static final String appId = "wx031697a8ca09a5ce";//东师
private static final String agentid = "1000065";//
// appIdSecret
private static final String appIdSecret = "6Qhnge3xfzAQMDX2TcjEyE0vUGP96hP9OTYUsYBze2Y";//东师
//微信通知点击后跳转的页面
private static final String domainTo = "https://zxkccx.webvpn.nenu.edu.cn";
public void sendWxmessage(KcWechatSendLog kcWechatSendLog) {
String openId = kcWechatSendLog.getOpenid();//曹老师账号
System.out.println("openId:"+openId+"");
if(org.apache.commons.lang3.StringUtils.isNotEmpty(openId)){
try {
String urlToken = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid="+ appId +"&corpsecret=" + appIdSecret;
System.out.println("urlToken "+ urlToken);
String res = HttpUtil.get(urlToken);
JSONObject jsonObjectToken = JSONObject.parseObject(res);
System.out.println("jsonObjectToken{}"+ jsonObjectToken);
String accessToken = jsonObjectToken.getString("access_token");
System.out.println("accessToken{}"+ accessToken);
// 微信的基础accessToken
String url = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=" + accessToken;
Map<String, Object> sendMag = new HashMap<>();
// 1xx老师你好您本学期2023秋听课要求为5次当前实际听课次数3次请尽快完成本学期的听课任务
String html = kcWechatSendLog.getYtkcs();
html = html + "\n<a href=\""+domainTo+"\">查看</a>";
sendMag.put("content", html);//授课老师推送内容
RestTemplate restTemplate = new RestTemplate();
//拼接base参数
Map<String, Object> sendBody = new HashMap<>();
sendBody.put("touser", openId); // openId
sendBody.put("msgtype", "text"); // 消息类型此时固定为text
sendBody.put("agentid", agentid); // 企业id
sendBody.put("text",sendMag); //发送内容
ResponseEntity<String> forEntity = restTemplate.postForEntity(url, sendBody, String.class);
JSONObject jsonObject2 = JSONObject.parseObject(forEntity.getBody());
System.out.println("jsonObject2 : " + jsonObject2);
String messageCode = jsonObject2.getString("errcode");
String msgId = jsonObject2.getString("msgid");
System.out.println("messageCode : " + messageCode + ", msgId: " +msgId);
}catch (Exception e) {
e.printStackTrace();
}
}else{
}
}
@ApiOperation(value="统计分析", notes="统计分析")
@GetMapping(value = "/wjxxTjfx")
public Result<JSONObject> wjxxTjfx(@RequestParam(name="id",required=true) String id) {
@ -538,4 +627,41 @@ public class WjxWjxxController extends JeecgController<WjxWjxx, IWjxWjxxService>
return Result.OK(WjxWjxx);
}
@ApiOperation(value="是否是学生-是否允许答卷", notes="是否是学生-是否允许答卷")
@GetMapping(value = "/getSfxs")
public Result<WjxWjxx> getSfxs(@RequestParam(name="id",required=true) String id) {
WjxWjxx WjxWjxx = wjxWjxxService.getById(id);
if(WjxWjxx==null) {
return Result.error("未找到对应数据");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
QueryWrapper<Xxhbbks> queryWrapper = new QueryWrapper<>();
queryWrapper.apply("a.xh = b.xh");
queryWrapper.eq("b.KCAPZBBH",WjxWjxx.getRwbh());
WjxWjxx.setNum("0");//不是本次学生不可以答卷
List<Xxhbbks> list = xxhbbksService.getXsxkbAllList(queryWrapper);
for(Xxhbbks par : list){
String xh = par.getXh();
if(org.apache.commons.lang.StringUtils.equals(xh,sysUser.getUsername())){
WjxWjxx.setNum("1");
break;
}
}
return Result.OK(WjxWjxx);
}
@ApiOperation(value="测验结果-通过id查询", notes="测验结果-通过id查询")
@GetMapping(value = "/queryCyjgById")
public Result<WjxWjxx> queryCyjgById(@RequestParam(name="id",required=true) String id) {
WjxWjxx wjxWjxx = wjxWjxxService.queryCyjgById(id);
if(wjxWjxx==null) {
return Result.error("未找到对应数据");
}
return Result.OK(wjxWjxx);
}
}

View File

@ -140,4 +140,6 @@ public class WjxWjxx implements Serializable {
@TableField(exist = false)
List<WjxWjxxTmlbPage> list;
@TableField(exist = false)
List<WjxWjxxTmlb> tmlbList;
}

View File

@ -30,4 +30,6 @@ public interface WjxWjxxMapper extends BaseMapper<WjxWjxx> {
WjxWjxx getByKechengId(@Param("id") String id);
String querySfdtById(@Param("id") String id, @Param("username") String username);
WjxWjxx queryCyjgById(String id);
}

View File

@ -136,4 +136,14 @@
where a.vid = b.vid and b.create_by = #{username} and a.id = #{id}
</select>
<select id="queryCyjgById" resultType="org.jeecg.modules.kc.wjxWjxx.entity.WjxWjxx">
select
a.*,
(select count(*) from wjx_djxx b where flag = '1' and vid = a.vid) as ywcrs,
xkrs - (SELECT count(*) FROM wjx_djxx b WHERE flag = '1' AND vid = a.vid ) AS wwcrs
from wjx_wjxx a
where id = #{id}
</select>
</mapper>

View File

@ -34,4 +34,6 @@ public interface IWjxWjxxService extends IService<WjxWjxx> {
WjxWjxx getByKechengId(String id);
String querySfdtById(String id, String username);
WjxWjxx queryCyjgById(String id);
}

View File

@ -12,6 +12,7 @@ import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.text.StringUtils;
import org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxx;
import org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxxTmxx;
import org.jeecg.modules.kc.wjxDjxx.mapper.WjxDjxxMapper;
import org.jeecg.modules.kc.wjxWjxx.entity.KccyglSys;
import org.jeecg.modules.kc.wjxWjxx.entity.WjxWjxx;
import org.jeecg.modules.kc.wjxWjxx.mapper.WjxWjxxMapper;
@ -48,6 +49,9 @@ public class WjxWjxxServiceImpl extends ServiceImpl<WjxWjxxMapper, WjxWjxx> impl
@Autowired
private WjxConfig wjxConfig;
@Autowired
private WjxDjxxMapper wjxDjxxMapper;
@Override
public Page<WjxWjxx> findPage(WjxWjxx wjxWjxx, Page<WjxWjxx> page){
List<WjxWjxx> list = baseMapper.findPage(page,wjxWjxx);
@ -381,5 +385,54 @@ public class WjxWjxxServiceImpl extends ServiceImpl<WjxWjxxMapper, WjxWjxx> impl
return baseMapper.querySfdtById(id,username);
}
@Override
public WjxWjxx queryCyjgById(String id) {
WjxWjxx wjxWjxx = baseMapper.queryCyjgById(id);
QueryWrapper<WjxWjxxTmlb> wjxWjxxTmlbQueryWrapper = new QueryWrapper<WjxWjxxTmlb>();
wjxWjxxTmlbQueryWrapper.eq("main_id",id);
wjxWjxxTmlbQueryWrapper.orderByAsc("wj_index");
List<WjxWjxxTmlb> list = wjxWjxxTmlbMapper.selectList(wjxWjxxTmlbQueryWrapper);
for(WjxWjxxTmlb WjxWjxxTmlb:list){
String num = "0";
String num2 = "0";
// if(org.apache.commons.lang3.StringUtils.equals("5",WjxWjxxTmlb.getWjType()+"")){
num= wjxDjxxMapper.getDjnumType(wjxWjxx.getVid(),WjxWjxxTmlb.getWjIndex(),null,"1");
num2= wjxDjxxMapper.getDjnumType(wjxWjxx.getVid(),WjxWjxxTmlb.getWjIndex(),null,"2");
WjxWjxxTmlb.setNum(num);
WjxWjxxTmlb.setNum2(num2);
// }
int yzd = Integer.parseInt(num) + Integer.parseInt(num2);
int ddrs = Integer.parseInt(num);
int dcrs = Integer.parseInt(num2);
List<WjxWjxxTmxx> list2= wjxWjxxTmxxMapper.selectByMainId(WjxWjxxTmlb.getId());
String itemSelected = "";
for(WjxWjxxTmxx WjxWjxxTmxx:list2){
String num3= wjxDjxxMapper.getDjnum(wjxWjxx.getVid(),WjxWjxxTmxx.getWjIndex(),WjxWjxxTmxx.getItemIndex());
if(org.apache.commons.lang3.StringUtils.equals(WjxWjxxTmxx.getItemSelected(),"true")){
itemSelected = itemSelected+WjxWjxxTmxx.getItemIndex()+",";
}
WjxWjxxTmxx.setNum(num3);
}
if(org.apache.commons.lang3.StringUtils.isNotBlank(itemSelected)){
itemSelected = itemSelected.substring(0, itemSelected.length()-1);
}
WjxWjxxTmlb.setItemSelected(itemSelected);
WjxWjxxTmlb.setWjxWjxxTmxxList(list2);
WjxWjxxTmlb.setYzd(yzd);
WjxWjxxTmlb.setDdrs(ddrs);
WjxWjxxTmlb.setDcrs(dcrs);
}
wjxWjxx.setTmlbList(list);
return wjxWjxx;
}
}

View File

@ -14,6 +14,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.kc.grab.imports.entity.Xxhbbks;
import org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxx;
import org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxxDj;
import org.jeecg.modules.kc.wjxDjxx.service.IWjxDjxxService;
@ -367,4 +368,5 @@ public class WjxWjxxTmlbController extends JeecgController<WjxWjxxTmlb, IWjxWjxx
return Result.OK("设置成功!");
}
}

View File

@ -116,4 +116,13 @@ public class WjxWjxxTmlb implements Serializable {
private String num;
@TableField(exist = false)
private String num2;
@TableField(exist = false)
private Integer yzd;
@TableField(exist = false)
private Integer ddrs;
@TableField(exist = false)
private Integer dcrs;
}

View File

@ -74,4 +74,5 @@ public class WjxWjxxTmxx implements Serializable {
@TableField(exist = false)
private String num;
}

View File

@ -7,4 +7,8 @@
select distinct exp_col from kc_jieci_pipei
)
</select>
<select id="selectList" resultType="org.jeecg.modules.kc.xxhbkckbOra.entity.XxhbkckbOra">
select * from v_xxhbkckb
</select>
</mapper>

View File

@ -1,9 +1,11 @@
package org.jeecg.modules.kc.zyInfo.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xkcoding.http.HttpUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@ -22,6 +24,7 @@ import org.jeecg.modules.kc.grab.imports.entity.Xxhbbks;
import org.jeecg.modules.kc.grab.imports.service.IXxhbbksService;
import org.jeecg.modules.kc.kcSysConfig.entity.KcSysConfig;
import org.jeecg.modules.kc.kcSysConfig.service.IKcSysConfigService;
import org.jeecg.modules.kc.kcWechatSendLog.entity.KcWechatSendLog;
import org.jeecg.modules.kc.ktgl.entity.KcKechengbiao;
import org.jeecg.modules.kc.ktgl.service.IKcKechengbiaoService;
import org.jeecg.modules.kc.zyDbtx.entity.ZyDbtx;
@ -37,14 +40,14 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -136,19 +139,33 @@ public class ZyInfoController extends JeecgController<ZyInfo, IZyInfoService> {
//作业代办提醒
ZyDbtx zyDbtx = new ZyDbtx();
zyDbtx.setCreateBy(xxhbbks.getXh());
zyDbtx.setType("0");//0发布作业 1评分 2测验 3问卷 4讨论
zyDbtx.setMainId(zyInfo2.getId());
zyDbtx.setRwbh(zyInfo2.getRwbh());
String hpts = "";
if(StringUtils.equals(zyInfo2.getXshpkg(),"1")){
hpts = "互评时间:"+DateUtils.formatDate(zyInfo2.getXshpkssj(),"yyyy-MM-dd HH:mm")+" ~ "+ DateUtils.formatDate(zyInfo2.getXshpjssj(),"yyyy-MM-dd HH:mm");
}
zyDbtx.setContent(user.getRealname()+"老师主讲的["+kcKechengbiao.getKcmc()+"]课程于"+DateUtils.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss")+"发布了一篇题目为“"+zyInfo2.getTitle()+"”的作业,该作业提交时间为:"+ DateUtils.formatDate(zyInfo2.getStartTime(),"yyyy-MM-dd HH:mm")+" ~ "+ DateUtils.formatDate(zyInfo2.getEndTime(),"yyyy-MM-dd HH:mm")+",请按时完成! "+hpts);
if(StringUtils.equals(zyInfo2.getZyLeixing(),"0")) {
zyDbtx.setType("0");//0发布作业 1评分 2测验 3问卷 4讨论
zyDbtx.setContent(user.getRealname()+"老师主讲的["+kcKechengbiao.getKcmc()+"]课程于"+DateUtils.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss")+"发布了一篇题目为“"+zyInfo2.getTitle()+"”的作业,该作业提交时间为:"+ DateUtils.formatDate(zyInfo2.getStartTime(),"yyyy-MM-dd HH:mm")+" ~ "+ DateUtils.formatDate(zyInfo2.getEndTime(),"yyyy-MM-dd HH:mm")+",请按时完成! "+hpts);
}else if (StringUtils.equals(zyInfo.getZyLeixing(),"1")){
zyDbtx.setType("10");//0发布作业 1评分 2测验 3问卷 4讨论
zyDbtx.setContent(user.getRealname() + "老师主讲的[" + kcKechengbiao.getKcmc() + "]课程于" + DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss") + "发布了一篇题目为“" + zyInfo2.getTitle() + "”的期末考试,该期末考试提交时间为:" + DateUtils.formatDate(zyInfo2.getStartTime(), "yyyy-MM-dd HH:mm") + " ~ " + DateUtils.formatDate(zyInfo2.getEndTime(), "yyyy-MM-dd HH:mm") + ",请按时完成! " + hpts);
}
zyDbtx.setFlag("0");
zyDbtx.setFbr(user.getUsername());
zyDbtxService.save(zyDbtx);
try {
KcWechatSendLog kcWechatSendLog = new KcWechatSendLog();
// kcWechatSendLog.setOpenid(xxhbbks.getXh());
kcWechatSendLog.setOpenid("2016900057");//指定曹老师账号
kcWechatSendLog.setYtkcs(zyDbtx.getContent());
sendWxmessage(kcWechatSendLog);
}catch (Exception e){
e.printStackTrace();
}
}
}
}
@ -297,29 +314,93 @@ public class ZyInfoController extends JeecgController<ZyInfo, IZyInfoService> {
zyInfoStudent.setMainId(zyInfo.getId());
zyInfoStudent.setCreateBy(xxhbbks.getXh());
zyInfoStudent.setStudentName(xxhbbks.getXm());
zyInfoStudent.setZyLeixing(zyInfo.getZyLeixing());
zyInfoStudentService.save(zyInfoStudent);
//作业代办提醒
ZyDbtx zyDbtx = new ZyDbtx();
zyDbtx.setCreateBy(xxhbbks.getXh());
zyDbtx.setType("0");//0发布作业 1评分 2测验 3问卷 4讨论
zyDbtx.setMainId(zyInfo.getId());
zyDbtx.setRwbh(zyInfo.getRwbh());
String hpts = "";
if(StringUtils.equals(zyInfo.getXshpkg(),"1")){
hpts = "互评时间:"+DateUtils.formatDate(zyInfo.getXshpkssj(),"yyyy-MM-dd HH:mm")+" ~ "+ DateUtils.formatDate(zyInfo.getXshpjssj(),"yyyy-MM-dd HH:mm");
}
zyDbtx.setContent(user.getRealname()+"老师主讲的["+kcKechengbiao.getKcmc()+"]课程于"+DateUtils.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss")+"发布了一篇题目为“"+zyInfo.getTitle()+"”的作业,该作业提交时间为:"+ DateUtils.formatDate(zyInfo.getStartTime(),"yyyy-MM-dd HH:mm")+" ~ "+ DateUtils.formatDate(zyInfo.getEndTime(),"yyyy-MM-dd HH:mm")+",请按时完成! "+hpts);
if(StringUtils.equals(zyInfo.getZyLeixing(),"0")) {
zyDbtx.setType("0");//0发布作业 1评分 2测验 3问卷 4讨论
zyDbtx.setContent(user.getRealname() + "老师主讲的[" + kcKechengbiao.getKcmc() + "]课程于" + DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss") + "发布了一篇题目为“" + zyInfo.getTitle() + "”的作业,该作业提交时间为:" + DateUtils.formatDate(zyInfo.getStartTime(), "yyyy-MM-dd HH:mm") + " ~ " + DateUtils.formatDate(zyInfo.getEndTime(), "yyyy-MM-dd HH:mm") + ",请按时完成! " + hpts);
}else if (StringUtils.equals(zyInfo.getZyLeixing(),"1")){
zyDbtx.setType("10");//0发布作业 1评分 2测验 3问卷 4讨论
zyDbtx.setContent(user.getRealname() + "老师主讲的[" + kcKechengbiao.getKcmc() + "]课程于" + DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss") + "发布了一篇题目为“" + zyInfo.getTitle() + "”的期末考试,该期末考试提交时间为:" + DateUtils.formatDate(zyInfo.getStartTime(), "yyyy-MM-dd HH:mm") + " ~ " + DateUtils.formatDate(zyInfo.getEndTime(), "yyyy-MM-dd HH:mm") + ",请按时完成! " + hpts);
}
zyDbtx.setFlag("0");
zyDbtx.setFbr(user.getUsername());
zyDbtxService.save(zyDbtx);
try {
KcWechatSendLog kcWechatSendLog = new KcWechatSendLog();
// kcWechatSendLog.setOpenid(xxhbbks.getXh());
kcWechatSendLog.setOpenid("2016900057");//指定曹老师账号
kcWechatSendLog.setYtkcs(zyDbtx.getContent());
sendWxmessage(kcWechatSendLog);
}catch (Exception e){
e.printStackTrace();
}
}
}
return Result.OK(zyInfo);
}
@ApiOperation(value="推送微信信息", notes="推送微信信息")
@GetMapping(value = "/sendZyWechat")
public Result<ZyInfo> sendZyWechat(@RequestParam(name="id",required=true) String id) {
ZyInfo zyInfo = zyInfoService.getById(id);
if(zyInfo!=null) {
zyInfo = zyInfoService.getKechengById(zyInfo.getId());
QueryWrapper<Xxhbbks> queryWrapper = new QueryWrapper<>();
queryWrapper.apply("a.xh = b.xh");
queryWrapper.eq("b.KCAPZBBH",zyInfo.getRwbh());
List<Xxhbbks> list = xxhbbksService.getXsxkbAllList(queryWrapper);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
QueryWrapper<KcKechengbiao> kcKechengbiaoQueryWrapper = new QueryWrapper<>();
kcKechengbiaoQueryWrapper.eq("rwbh",zyInfo.getRwbh());
kcKechengbiaoQueryWrapper.eq("jgh",zyInfo.getCreateBy());
kcKechengbiaoQueryWrapper.eq("xqxn",zyInfo.getXnxq());
kcKechengbiaoQueryWrapper.last("limit 1");
KcKechengbiao kcKechengbiao = kcKechengbiaoService.getOne(kcKechengbiaoQueryWrapper);
//作业代办提醒
String hpts = "";
if(StringUtils.equals(zyInfo.getXshpkg(),"1")){
hpts = "互评时间:"+DateUtils.formatDate(zyInfo.getXshpkssj(),"yyyy-MM-dd HH:mm")+" ~ "+ DateUtils.formatDate(zyInfo.getXshpjssj(),"yyyy-MM-dd HH:mm");
}
String content = "";
if(StringUtils.equals(zyInfo.getZyLeixing(),"0")) {
content = user.getRealname() + "老师主讲的[" + kcKechengbiao.getKcmc() + "]课程于" + DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss") + "发布了一篇题目为“" + zyInfo.getTitle() + "”的作业,该作业提交时间为:" + DateUtils.formatDate(zyInfo.getStartTime(), "yyyy-MM-dd HH:mm") + " ~ " + DateUtils.formatDate(zyInfo.getEndTime(), "yyyy-MM-dd HH:mm") + ",请按时完成! " + hpts;
}else if (StringUtils.equals(zyInfo.getZyLeixing(),"1")){
content = user.getRealname() + "老师主讲的[" + kcKechengbiao.getKcmc() + "]课程于" + DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss") + "发布了一篇题目为“" + zyInfo.getTitle() + "”的期末考试,该期末考试提交时间为:" + DateUtils.formatDate(zyInfo.getStartTime(), "yyyy-MM-dd HH:mm") + " ~ " + DateUtils.formatDate(zyInfo.getEndTime(), "yyyy-MM-dd HH:mm") + ",请按时完成! " + hpts;
}
for(Xxhbbks xxhbbks:list){
try {
KcWechatSendLog kcWechatSendLog = new KcWechatSendLog();
// kcWechatSendLog.setOpenid(xxhbbks.getXh());
kcWechatSendLog.setOpenid("2016900057");//指定曹老师账号
kcWechatSendLog.setYtkcs(content);
sendWxmessage(kcWechatSendLog);
}catch (Exception e){
e.printStackTrace();
}
}
}
return Result.OK(zyInfo);
}
/**
* 通过id删除
*
@ -542,6 +623,7 @@ public class ZyInfoController extends JeecgController<ZyInfo, IZyInfoService> {
QueryWrapper<ZyInfo> query = new QueryWrapper<>();
query.eq("rwbh", zyInfo.getRwbh());
query.eq("create_by",zyInfo.getCreateBy());
query.eq("zy_leixing","0");
List<ZyInfo> oldList = zyInfoService.list(query);
zyInfoService.remove(query);
@ -568,4 +650,100 @@ public class ZyInfoController extends JeecgController<ZyInfo, IZyInfoService> {
}
return Result.OK("添加成功!");
}
@AutoLog(value = "期末作业发布-添加")
@ApiOperation(value="期末作业发布-添加", notes="期末作业发布-添加")
@PostMapping(value = "/batchQmAdd")
public Result<String> batchQmAdd(@RequestBody List<ZyInfo> list) {
ZyInfo zyInfo = list.get(0);
//删除老师留过的作业重新生成新的
QueryWrapper<ZyInfo> query = new QueryWrapper<>();
query.eq("rwbh", zyInfo.getRwbh());
query.eq("create_by",zyInfo.getCreateBy());
query.eq("zy_leixing","1");
List<ZyInfo> oldList = zyInfoService.list(query);
zyInfoService.remove(query);
KcSysConfig kcSysConfig = kcSysConfigService.getById("1");
QueryWrapper<KcKechengbiao> kcKechengbiaoQueryWrapper = new QueryWrapper<>();
kcKechengbiaoQueryWrapper.eq("xqxn",kcSysConfig.getFlag1());
kcKechengbiaoQueryWrapper.eq("rwbh",zyInfo.getRwbh());
kcKechengbiaoQueryWrapper.last("limit 1");
KcKechengbiao kcKechengbiao = kcKechengbiaoService.getOne(kcKechengbiaoQueryWrapper);
for(int i = 0; i < list.size(); i++) {
ZyInfo par = list.get(i);
List<ZyInfo> zyInfo1 = oldList.stream().filter(zyInfo2 -> zyInfo2.getId().equals(par.getId())).collect(Collectors.toList());
if(zyInfo1!=null && zyInfo1.size()>0){
ZyInfo zypar = zyInfo1.get(0);
zypar.setSort(par.getSort());
zypar.setScore(par.getScore());
zyInfoService.save(zypar);
}else{
par.setXnxq(kcSysConfig.getFlag1());
par.setZyStatus("0");
par.setXkxs(kcKechengbiao.getXkrs());
zyInfoService.save(par);
}
}
return Result.OK("添加成功!");
}
// appId
private static final String appId = "wx031697a8ca09a5ce";//东师
private static final String agentid = "1000065";//
// appIdSecret
private static final String appIdSecret = "6Qhnge3xfzAQMDX2TcjEyE0vUGP96hP9OTYUsYBze2Y";//东师
//微信通知点击后跳转的页面
private static final String domainTo = "https://zxkccx.webvpn.nenu.edu.cn";
public void sendWxmessage(KcWechatSendLog kcWechatSendLog) {
String openId = kcWechatSendLog.getOpenid();//曹老师账号
System.out.println("openId:"+openId+"");
if(org.apache.commons.lang3.StringUtils.isNotEmpty(openId)){
try {
String urlToken = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid="+ appId +"&corpsecret=" + appIdSecret;
System.out.println("urlToken "+ urlToken);
String res = HttpUtil.get(urlToken);
JSONObject jsonObjectToken = JSONObject.parseObject(res);
System.out.println("jsonObjectToken{}"+ jsonObjectToken);
String accessToken = jsonObjectToken.getString("access_token");
System.out.println("accessToken{}"+ accessToken);
// 微信的基础accessToken
String url = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=" + accessToken;
Map<String, Object> sendMag = new HashMap<>();
// 1xx老师你好您本学期2023秋听课要求为5次当前实际听课次数3次请尽快完成本学期的听课任务
String html = kcWechatSendLog.getYtkcs();
html = html + "\n<a href=\""+domainTo+"\">查看</a>";
sendMag.put("content", html);//授课老师推送内容
RestTemplate restTemplate = new RestTemplate();
//拼接base参数
Map<String, Object> sendBody = new HashMap<>();
sendBody.put("touser", openId); // openId
sendBody.put("msgtype", "text"); // 消息类型此时固定为text
sendBody.put("agentid", agentid); // 企业id
sendBody.put("text",sendMag); //发送内容
ResponseEntity<String> forEntity = restTemplate.postForEntity(url, sendBody, String.class);
JSONObject jsonObject2 = JSONObject.parseObject(forEntity.getBody());
System.out.println("jsonObject2 : " + jsonObject2);
String messageCode = jsonObject2.getString("errcode");
String msgId = jsonObject2.getString("msgid");
System.out.println("messageCode : " + messageCode + ", msgId: " +msgId);
}catch (Exception e) {
e.printStackTrace();
}
}else{
}
}
@ApiOperation(value="作业发布-通过id查询", notes="作业发布-通过id查询")
@GetMapping(value = "/zyzb")
public Result<ZyInfo> zyzb(@RequestParam(name="rwbh") String rwbh,@RequestParam(name="xqxn") String xqxn,@RequestParam(name="teano") String teano,@RequestParam(name="zyLeixing") String zyLeixing) {
ZyInfo zyInfo = zyInfoService.zyzb(rwbh,xqxn,teano,zyLeixing);
return Result.OK(zyInfo);
}
}

View File

@ -133,6 +133,8 @@ public class ZyInfo implements Serializable {
private Integer sort;//序号
private java.lang.String xshpkg;//学生互评开关
private java.lang.String xshprsq;//学生互评人数
private String zyLeixing;//作业类型 0课程作业 1期末作业
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
private java.util.Date xshpkssj;//学生互评开始时间

View File

@ -26,4 +26,6 @@ public interface ZyInfoMapper extends BaseMapper<ZyInfo> {
List<ZyInfoSys> exportSysXls(@Param(Constants.WRAPPER) QueryWrapper<ZyInfoSys> queryWrapper);
ZyInfo getKechengById(@Param("id") String id);
ZyInfo zyzb(@Param("rwbh")String rwbh, @Param("xqxn")String xqxn, @Param("teano")String teano, @Param("zyLeixing")String zyLeixing);
}

View File

@ -62,4 +62,7 @@
limit 1
</select>
<select id="zyzb" resultType="org.jeecg.modules.kc.zyInfo.entity.ZyInfo">
select sum(score) as score from zy_info where xnxq = #{xqxn} and rwbh = #{rwbh} and zy_leixing = #{zyLeixing}
</select>
</mapper>

View File

@ -24,4 +24,6 @@ public interface IZyInfoService extends IService<ZyInfo> {
List<ZyInfoSys> exportSysXls(QueryWrapper<ZyInfoSys> queryWrapper);
ZyInfo getKechengById(String id);
ZyInfo zyzb(String rwbh, String xqxn, String teano, String zyLeixing);
}

View File

@ -41,4 +41,9 @@ public class ZyInfoServiceImpl extends ServiceImpl<ZyInfoMapper, ZyInfo> impleme
public ZyInfo getKechengById(String id) {
return baseMapper.getKechengById(id);
}
@Override
public ZyInfo zyzb(String rwbh, String xqxn, String teano, String zyLeixing) {
return baseMapper.zyzb(rwbh,xqxn,teano,zyLeixing);
}
}

View File

@ -122,6 +122,7 @@ public class ZyInfoStudent implements Serializable {
private String scoreFabu;
private String hpcs;
private String jxfs2;
private String zyLeixing;//作业类型 0课程作业 1期末作业
@TableField(exist = false)
private String jxzf;

View File

@ -0,0 +1,182 @@
package org.jeecg.modules.kc.zyJxdgBanben.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.zyJxdgBanben.entity.ZyJxdgMain;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgBanben;
import org.jeecg.modules.kc.zyJxdgBanben.vo.ZyJxdgBanbenPage;
import org.jeecg.modules.kc.zyJxdgBanben.service.IZyJxdgBanbenService;
import org.jeecg.modules.kc.zyJxdgBanben.service.IZyJxdgMainService;
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-08-19
* @Version: V1.0
*/
@Api(tags="教学大纲版本配置")
@RestController
@RequestMapping("/zyJxdgBanben/zyJxdgBanben")
@Slf4j
public class ZyJxdgBanbenController {
@Autowired
private IZyJxdgBanbenService zyJxdgBanbenService;
@Autowired
private IZyJxdgMainService zyJxdgMainService;
/**
* 分页列表查询
*
* @param zyJxdgBanben
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "教学大纲版本配置-分页列表查询")
@ApiOperation(value="教学大纲版本配置-分页列表查询", notes="教学大纲版本配置-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<ZyJxdgBanben>> queryPageList(ZyJxdgBanben zyJxdgBanben,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<ZyJxdgBanben> queryWrapper = QueryGenerator.initQueryWrapper(zyJxdgBanben, req.getParameterMap());
Page<ZyJxdgBanben> page = new Page<ZyJxdgBanben>(pageNo, pageSize);
IPage<ZyJxdgBanben> pageList = zyJxdgBanbenService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param zyJxdgBanbenPage
* @return
*/
@AutoLog(value = "教学大纲版本配置-添加")
@ApiOperation(value="教学大纲版本配置-添加", notes="教学大纲版本配置-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ZyJxdgBanbenPage zyJxdgBanbenPage) {
ZyJxdgBanben zyJxdgBanben = new ZyJxdgBanben();
BeanUtils.copyProperties(zyJxdgBanbenPage, zyJxdgBanben);
zyJxdgBanbenService.saveMain(zyJxdgBanben, zyJxdgBanbenPage.getZyJxdgMainList());
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param zyJxdgBanbenPage
* @return
*/
@AutoLog(value = "教学大纲版本配置-编辑")
@ApiOperation(value="教学大纲版本配置-编辑", notes="教学大纲版本配置-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody ZyJxdgBanbenPage zyJxdgBanbenPage) {
ZyJxdgBanben zyJxdgBanben = new ZyJxdgBanben();
BeanUtils.copyProperties(zyJxdgBanbenPage, zyJxdgBanben);
ZyJxdgBanben zyJxdgBanbenEntity = zyJxdgBanbenService.getById(zyJxdgBanben.getId());
if(zyJxdgBanbenEntity==null) {
return Result.error("未找到对应数据");
}
zyJxdgBanbenService.updateMain(zyJxdgBanben, zyJxdgBanbenPage.getZyJxdgMainList());
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) {
zyJxdgBanbenService.delMain(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "教学大纲版本配置-批量删除")
@ApiOperation(value="教学大纲版本配置-批量删除", notes="教学大纲版本配置-批量删除")
@RequiresPermissions("zyJxdgBanben:zy_jxdg_banben:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.zyJxdgBanbenService.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<ZyJxdgBanben> queryById(@RequestParam(name="id",required=true) String id) {
ZyJxdgBanben zyJxdgBanben = zyJxdgBanbenService.getById(id);
if(zyJxdgBanben==null) {
return Result.error("未找到对应数据");
}
return Result.OK(zyJxdgBanben);
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "教学大纲配置信息通过主表ID查询")
@ApiOperation(value="教学大纲配置信息主表ID查询", notes="教学大纲配置信息-通主表ID查询")
@GetMapping(value = "/queryZyJxdgMainByMainId")
public Result<List<ZyJxdgMain>> queryZyJxdgMainListByMainId(@RequestParam(name="id",required=true) String id) {
List<ZyJxdgMain> zyJxdgMainList = zyJxdgMainService.selectByMainId(id);
return Result.OK(zyJxdgMainList);
}
}

View File

@ -0,0 +1,178 @@
package org.jeecg.modules.kc.zyJxdgBanben.controller;
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.zyJxdgBanben.entity.ZyJxdgPzxx;
import org.jeecg.modules.kc.zyJxdgBanben.service.IZyJxdgPzxxService;
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.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: zy_jxdg_pzxx
* @Author: jeecg-boot
* @Date: 2024-08-19
* @Version: V1.0
*/
@Api(tags="zy_jxdg_pzxx")
@RestController
@RequestMapping("/zyJxdgBanben/zyJxdgPzxx")
@Slf4j
public class ZyJxdgPzxxController extends JeecgController<ZyJxdgPzxx, IZyJxdgPzxxService> {
@Autowired
private IZyJxdgPzxxService zyJxdgPzxxService;
/**
* 分页列表查询
*
* @param zyJxdgPzxx
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "zy_jxdg_pzxx-分页列表查询")
@ApiOperation(value="zy_jxdg_pzxx-分页列表查询", notes="zy_jxdg_pzxx-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<ZyJxdgPzxx>> queryPageList(ZyJxdgPzxx zyJxdgPzxx,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<ZyJxdgPzxx> queryWrapper = QueryGenerator.initQueryWrapper(zyJxdgPzxx, req.getParameterMap());
Page<ZyJxdgPzxx> page = new Page<ZyJxdgPzxx>(pageNo, pageSize);
IPage<ZyJxdgPzxx> pageList = zyJxdgPzxxService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param zyJxdgPzxx
* @return
*/
@AutoLog(value = "zy_jxdg_pzxx-添加")
@ApiOperation(value="zy_jxdg_pzxx-添加", notes="zy_jxdg_pzxx-添加")
@RequiresPermissions("zyJxdgBanben:zy_jxdg_pzxx:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ZyJxdgPzxx zyJxdgPzxx) {
zyJxdgPzxxService.save(zyJxdgPzxx);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param zyJxdgPzxx
* @return
*/
@AutoLog(value = "zy_jxdg_pzxx-编辑")
@ApiOperation(value="zy_jxdg_pzxx-编辑", notes="zy_jxdg_pzxx-编辑")
@RequiresPermissions("zyJxdgBanben:zy_jxdg_pzxx:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody ZyJxdgPzxx zyJxdgPzxx) {
zyJxdgPzxxService.updateById(zyJxdgPzxx);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "zy_jxdg_pzxx-通过id删除")
@ApiOperation(value="zy_jxdg_pzxx-通过id删除", notes="zy_jxdg_pzxx-通过id删除")
@RequiresPermissions("zyJxdgBanben:zy_jxdg_pzxx:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
zyJxdgPzxxService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "zy_jxdg_pzxx-批量删除")
@ApiOperation(value="zy_jxdg_pzxx-批量删除", notes="zy_jxdg_pzxx-批量删除")
@RequiresPermissions("zyJxdgBanben:zy_jxdg_pzxx:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.zyJxdgPzxxService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "zy_jxdg_pzxx-通过id查询")
@ApiOperation(value="zy_jxdg_pzxx-通过id查询", notes="zy_jxdg_pzxx-通过id查询")
@GetMapping(value = "/queryById")
public Result<ZyJxdgPzxx> queryById(@RequestParam(name="id",required=true) String id) {
ZyJxdgPzxx zyJxdgPzxx = zyJxdgPzxxService.getById(id);
if(zyJxdgPzxx==null) {
return Result.error("未找到对应数据");
}
return Result.OK(zyJxdgPzxx);
}
/**
* 导出excel
*
* @param request
* @param zyJxdgPzxx
*/
@RequiresPermissions("zyJxdgBanben:zy_jxdg_pzxx:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ZyJxdgPzxx zyJxdgPzxx) {
return super.exportXls(request, zyJxdgPzxx, ZyJxdgPzxx.class, "zy_jxdg_pzxx");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("zyJxdgBanben:zy_jxdg_pzxx:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, ZyJxdgPzxx.class);
}
}

View File

@ -0,0 +1,64 @@
package org.jeecg.modules.kc.zyJxdgBanben.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
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;
/**
* @Description: 教学大纲版本配置
* @Author: jeecg-boot
* @Date: 2024-08-19
* @Version: V1.0
*/
@ApiModel(value="zy_jxdg_banben对象", description="教学大纲版本配置")
@Data
@TableName("zy_jxdg_banben")
public class ZyJxdgBanben implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**createBy*/
@ApiModelProperty(value = "createBy")
private java.lang.String createBy;
/**createTime*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "createTime")
private java.util.Date createTime;
/**updateBy*/
@ApiModelProperty(value = "updateBy")
private java.lang.String updateBy;
/**updateTime*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "updateTime")
private java.util.Date updateTime;
/**版本*/
@Excel(name = "版本", width = 15)
@ApiModelProperty(value = "版本")
private java.lang.String title;
/**版本*/
@Excel(name = "版本", width = 15)
@ApiModelProperty(value = "版本")
@Dict(dicCode = "kclx")
private java.lang.String twoTitle;
/**是否使用*/
@Excel(name = "是否使用", width = 15)
@Dict(dicCode = "yn")
@ApiModelProperty(value = "是否使用")
private java.lang.String sfsy;
}

View File

@ -0,0 +1,89 @@
package org.jeecg.modules.kc.zyJxdgBanben.entity;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
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;
import java.util.List;
import java.util.Map;
/**
* @Description: 教学大纲配置信息
* @Author: jeecg-boot
* @Date: 2024-08-19
* @Version: V1.0
*/
@ApiModel(value="zy_jxdg_main对象", description="教学大纲配置信息")
@Data
@TableName("zy_jxdg_main")
public class ZyJxdgMain implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**createBy*/
@ApiModelProperty(value = "createBy")
private java.lang.String createBy;
/**createTime*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "createTime")
private java.util.Date createTime;
/**updateBy*/
@ApiModelProperty(value = "updateBy")
private java.lang.String updateBy;
/**updateTime*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "updateTime")
private java.util.Date updateTime;
/**主表*/
@ApiModelProperty(value = "主表")
private java.lang.String mainId;
/**名称*/
@Excel(name = "名称", width = 15)
@ApiModelProperty(value = "名称")
private java.lang.String title;
/**类型 (1普通文本 2多行文本 3富文本 4表单 表格)*/
@Excel(name = "类型 (1普通文本 2多行文本 3富文本 4表单 表格)", width = 15)
@ApiModelProperty(value = "类型 (1普通文本 2多行文本 3富文本 4表单 表格)")
private java.lang.String type;
/**关联*/
@Excel(name = "关联", width = 15)
@ApiModelProperty(value = "关联")
private java.lang.String guanlian;
/**排序*/
@Excel(name = "排序", width = 15)
@ApiModelProperty(value = "排序")
private java.lang.String sort;
/**提示语*/
@Excel(name = "提示语", width = 15)
@ApiModelProperty(value = "提示语")
private java.lang.String tsy;
/**是否是关联项目0不是 1是*/
@Excel(name = "是否是关联项目0不是 1是", width = 15)
@ApiModelProperty(value = "是否是关联项目0不是 1是")
private java.lang.String sfsglxm;
@TableField(exist = false)
private java.lang.String content;
@TableField(exist = false)
@ApiModelProperty(value = "教学大纲配置信息")
private List<ZyJxdgPzxx> zyJxdgPzxxList;
@TableField(exist = false)
@ApiModelProperty(value = "教学大纲配置信息")
private List<Map<String,Object>> list;
}

View File

@ -0,0 +1,79 @@
package org.jeecg.modules.kc.zyJxdgBanben.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: zy_jxdg_pzxx
* @Author: jeecg-boot
* @Date: 2024-08-19
* @Version: V1.0
*/
@Data
@TableName("zy_jxdg_pzxx")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="zy_jxdg_pzxx对象", description="zy_jxdg_pzxx")
public class ZyJxdgPzxx implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private String id;
/**createBy*/
@ApiModelProperty(value = "createBy")
private String createBy;
/**createTime*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "createTime")
private Date createTime;
/**updateBy*/
@ApiModelProperty(value = "updateBy")
private String updateBy;
/**updateTime*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "updateTime")
private Date updateTime;
/**主表zy_jxdg_banben*/
@Excel(name = "主表zy_jxdg_banben", width = 15)
@ApiModelProperty(value = "主表zy_jxdg_banben")
private String mainId;
/**配置表id zy_jxdg_main*/
@Excel(name = "配置表id zy_jxdg_main", width = 15)
@ApiModelProperty(value = "配置表id zy_jxdg_main")
private String twoMainId;
/**名称*/
@Excel(name = "名称", width = 15)
@ApiModelProperty(value = "名称")
private String title;
/**类型*/
@Excel(name = "类型", width = 15)
@ApiModelProperty(value = "类型")
private String type;
/**内容*/
@Excel(name = "内容", width = 15)
@ApiModelProperty(value = "内容")
private String content;
/**排序*/
@Excel(name = "排序", width = 15)
@ApiModelProperty(value = "排序")
private String sort;
}

View File

@ -0,0 +1,17 @@
package org.jeecg.modules.kc.zyJxdgBanben.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgBanben;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 教学大纲版本配置
* @Author: jeecg-boot
* @Date: 2024-08-19
* @Version: V1.0
*/
public interface ZyJxdgBanbenMapper extends BaseMapper<ZyJxdgBanben> {
}

View File

@ -0,0 +1,31 @@
package org.jeecg.modules.kc.zyJxdgBanben.mapper;
import java.util.List;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgMain;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* @Description: 教学大纲配置信息
* @Author: jeecg-boot
* @Date: 2024-08-19
* @Version: V1.0
*/
public interface ZyJxdgMainMapper extends BaseMapper<ZyJxdgMain> {
/**
* 通过主表id删除子表数据
*
* @param mainId 主表id
* @return boolean
*/
public boolean deleteByMainId(@Param("mainId") String mainId);
/**
* 通过主表id查询子表数据
*
* @param mainId 主表id
* @return List<ZyJxdgMain>
*/
public List<ZyJxdgMain> selectByMainId(@Param("mainId") String mainId);
}

View File

@ -0,0 +1,20 @@
package org.jeecg.modules.kc.zyJxdgBanben.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgPzxx;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: zy_jxdg_pzxx
* @Author: jeecg-boot
* @Date: 2024-08-19
* @Version: V1.0
*/
public interface ZyJxdgPzxxMapper extends BaseMapper<ZyJxdgPzxx> {
void deleteByMainId(@Param("mainId") String id);
List<ZyJxdgPzxx> selectByTwoMainId(@Param("mainId") String id);
}

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.zyJxdgBanben.mapper.ZyJxdgBanbenMapper">
</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.zyJxdgBanben.mapper.ZyJxdgMainMapper">
<delete id="deleteByMainId" parameterType="java.lang.String">
DELETE
FROM zy_jxdg_main
WHERE
main_id = #{mainId} </delete>
<select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgMain">
SELECT *
FROM zy_jxdg_main
WHERE
main_id = #{mainId} </select>
</mapper>

View File

@ -0,0 +1,18 @@
<?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.zyJxdgBanben.mapper.ZyJxdgPzxxMapper">
<delete id="deleteByMainId" parameterType="java.lang.String">
DELETE
FROM zy_jxdg_pzxx
WHERE
main_id = #{mainId}
</delete>
<select id="selectByTwoMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgPzxx">
SELECT *
FROM zy_jxdg_pzxx
WHERE
two_main_id = #{mainId} </select>
</mapper>

View File

@ -0,0 +1,48 @@
package org.jeecg.modules.kc.zyJxdgBanben.service;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgMain;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgBanben;
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-08-19
* @Version: V1.0
*/
public interface IZyJxdgBanbenService extends IService<ZyJxdgBanben> {
/**
* 添加一对多
*
* @param zyJxdgBanben
* @param zyJxdgMainList
*/
public void saveMain(ZyJxdgBanben zyJxdgBanben,List<ZyJxdgMain> zyJxdgMainList) ;
/**
* 修改一对多
*
* @param zyJxdgBanben
* @param zyJxdgMainList
*/
public void updateMain(ZyJxdgBanben zyJxdgBanben,List<ZyJxdgMain> zyJxdgMainList);
/**
* 删除一对多
*
* @param id
*/
public void delMain (String id);
/**
* 批量删除一对多
*
* @param idList
*/
public void delBatchMain (Collection<? extends Serializable> idList);
}

View File

@ -0,0 +1,22 @@
package org.jeecg.modules.kc.zyJxdgBanben.service;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgMain;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @Description: 教学大纲配置信息
* @Author: jeecg-boot
* @Date: 2024-08-19
* @Version: V1.0
*/
public interface IZyJxdgMainService extends IService<ZyJxdgMain> {
/**
* 通过主表id查询子表数据
*
* @param mainId 主表id
* @return List<ZyJxdgMain>
*/
public List<ZyJxdgMain> selectByMainId(String mainId);
}

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.kc.zyJxdgBanben.service;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgPzxx;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: zy_jxdg_pzxx
* @Author: jeecg-boot
* @Date: 2024-08-19
* @Version: V1.0
*/
public interface IZyJxdgPzxxService extends IService<ZyJxdgPzxx> {
}

View File

@ -0,0 +1,100 @@
package org.jeecg.modules.kc.zyJxdgBanben.service.impl;
import org.jeecg.common.util.text.StringUtils;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgBanben;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgMain;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgPzxx;
import org.jeecg.modules.kc.zyJxdgBanben.mapper.ZyJxdgMainMapper;
import org.jeecg.modules.kc.zyJxdgBanben.mapper.ZyJxdgBanbenMapper;
import org.jeecg.modules.kc.zyJxdgBanben.mapper.ZyJxdgPzxxMapper;
import org.jeecg.modules.kc.zyJxdgBanben.service.IZyJxdgBanbenService;
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 java.io.Serializable;
import java.util.List;
import java.util.Collection;
/**
* @Description: 教学大纲版本配置
* @Author: jeecg-boot
* @Date: 2024-08-19
* @Version: V1.0
*/
@Service
public class ZyJxdgBanbenServiceImpl extends ServiceImpl<ZyJxdgBanbenMapper, ZyJxdgBanben> implements IZyJxdgBanbenService {
@Autowired
private ZyJxdgBanbenMapper zyJxdgBanbenMapper;
@Autowired
private ZyJxdgMainMapper zyJxdgMainMapper;
@Autowired
private ZyJxdgPzxxMapper zyJxdgPzxxMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public void saveMain(ZyJxdgBanben zyJxdgBanben, List<ZyJxdgMain> zyJxdgMainList) {
zyJxdgBanbenMapper.insert(zyJxdgBanben);
if(zyJxdgMainList!=null && zyJxdgMainList.size()>0) {
for(ZyJxdgMain entity:zyJxdgMainList) {
//外键设置
entity.setMainId(zyJxdgBanben.getId());
zyJxdgMainMapper.insert(entity);
if(entity.getZyJxdgPzxxList()!=null && entity.getZyJxdgPzxxList().size()>0 && (StringUtils.equals("4",entity.getType()) || StringUtils.equals("5",entity.getType()) || StringUtils.equals("9",entity.getType()) || StringUtils.equals("10",entity.getType()))) {
for(ZyJxdgPzxx zyJxdgPzxx:entity.getZyJxdgPzxxList()) {
zyJxdgPzxx.setMainId(entity.getId());
zyJxdgPzxx.setTwoMainId(zyJxdgBanben.getId());
zyJxdgPzxxMapper.insert(zyJxdgPzxx);
}
}
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateMain(ZyJxdgBanben zyJxdgBanben,List<ZyJxdgMain> zyJxdgMainList) {
zyJxdgBanbenMapper.updateById(zyJxdgBanben);
//1.先删除子表数据
zyJxdgMainMapper.deleteByMainId(zyJxdgBanben.getId());
//1.先删除子表数据
zyJxdgPzxxMapper.deleteByMainId(zyJxdgBanben.getId());
//2.子表数据重新插入
if(zyJxdgMainList!=null && zyJxdgMainList.size()>0) {
for(ZyJxdgMain entity:zyJxdgMainList) {
//外键设置
entity.setMainId(zyJxdgBanben.getId());
zyJxdgMainMapper.insert(entity);
if(entity.getZyJxdgPzxxList()!=null && entity.getZyJxdgPzxxList().size()>0 && (StringUtils.equals("4",entity.getType()) || StringUtils.equals("5",entity.getType()) || StringUtils.equals("9",entity.getType()) || StringUtils.equals("10",entity.getType()))) {
for(ZyJxdgPzxx zyJxdgPzxx:entity.getZyJxdgPzxxList()) {
zyJxdgPzxx.setMainId(zyJxdgBanben.getId());
zyJxdgPzxx.setTwoMainId(entity.getId());
zyJxdgPzxxMapper.insert(zyJxdgPzxx);
}
}
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delMain(String id) {
zyJxdgMainMapper.deleteByMainId(id);
zyJxdgBanbenMapper.deleteById(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delBatchMain(Collection<? extends Serializable> idList) {
for(Serializable id:idList) {
zyJxdgMainMapper.deleteByMainId(id.toString());
zyJxdgBanbenMapper.deleteById(id);
}
}
}

View File

@ -0,0 +1,36 @@
package org.jeecg.modules.kc.zyJxdgBanben.service.impl;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgMain;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgPzxx;
import org.jeecg.modules.kc.zyJxdgBanben.mapper.ZyJxdgMainMapper;
import org.jeecg.modules.kc.zyJxdgBanben.mapper.ZyJxdgPzxxMapper;
import org.jeecg.modules.kc.zyJxdgBanben.service.IZyJxdgMainService;
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-08-19
* @Version: V1.0
*/
@Service
public class ZyJxdgMainServiceImpl extends ServiceImpl<ZyJxdgMainMapper, ZyJxdgMain> implements IZyJxdgMainService {
@Autowired
private ZyJxdgMainMapper zyJxdgMainMapper;
@Autowired
private ZyJxdgPzxxMapper zyJxdgPzxxMapper;
@Override
public List<ZyJxdgMain> selectByMainId(String mainId) {
List<ZyJxdgMain> list = zyJxdgMainMapper.selectByMainId(mainId);
for(ZyJxdgMain par : list){
List<ZyJxdgPzxx> list2 = zyJxdgPzxxMapper.selectByTwoMainId(par.getId());
par.setZyJxdgPzxxList(list2);
}
return list;
}
}

View File

@ -0,0 +1,19 @@
package org.jeecg.modules.kc.zyJxdgBanben.service.impl;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgPzxx;
import org.jeecg.modules.kc.zyJxdgBanben.mapper.ZyJxdgPzxxMapper;
import org.jeecg.modules.kc.zyJxdgBanben.service.IZyJxdgPzxxService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: zy_jxdg_pzxx
* @Author: jeecg-boot
* @Date: 2024-08-19
* @Version: V1.0
*/
@Service
public class ZyJxdgPzxxServiceImpl extends ServiceImpl<ZyJxdgPzxxMapper, ZyJxdgPzxx> implements IZyJxdgPzxxService {
}

View File

@ -0,0 +1,65 @@
package org.jeecg.modules.kc.zyJxdgBanben.vo;
import java.util.List;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgBanben;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgMain;
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-08-19
* @Version: V1.0
*/
@Data
@ApiModel(value="zy_jxdg_banbenPage对象", description="教学大纲版本配置")
public class ZyJxdgBanbenPage {
/**id*/
@ApiModelProperty(value = "id")
private java.lang.String id;
/**createBy*/
@ApiModelProperty(value = "createBy")
private java.lang.String createBy;
/**createTime*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "createTime")
private java.util.Date createTime;
/**updateBy*/
@ApiModelProperty(value = "updateBy")
private java.lang.String updateBy;
/**updateTime*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "updateTime")
private java.util.Date updateTime;
/**版本*/
@Excel(name = "版本", width = 15)
@ApiModelProperty(value = "版本")
private java.lang.String title;
/**版本*/
@Excel(name = "版本", width = 15)
@ApiModelProperty(value = "版本")
private java.lang.String twoTitle;
/**是否使用*/
@Excel(name = "是否使用", width = 15)
@ApiModelProperty(value = "是否使用")
private java.lang.String sfsy;
@ExcelCollection(name="教学大纲配置信息")
@ApiModelProperty(value = "教学大纲配置信息")
private List<ZyJxdgMain> zyJxdgMainList;
}

View File

@ -0,0 +1,312 @@
package org.jeecg.modules.kc.zyJxdgTeacherMain.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.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgBanben;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgMain;
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.zyJxdgTeacherMain.entity.ZyJxdgTeacherCenter;
import org.jeecg.modules.kc.zyJxdgTeacherMain.entity.ZyJxdgTeacherMain;
import org.jeecg.modules.kc.zyJxdgTeacherMain.vo.ZyJxdgTeacherMainPage;
import org.jeecg.modules.kc.zyJxdgTeacherMain.service.IZyJxdgTeacherMainService;
import org.jeecg.modules.kc.zyJxdgTeacherMain.service.IZyJxdgTeacherCenterService;
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-08-20
* @Version: V1.0
*/
@Api(tags="教师填写教学大纲")
@RestController
@RequestMapping("/zyJxdgTeacherMain/zyJxdgTeacherMain")
@Slf4j
public class ZyJxdgTeacherMainController {
@Autowired
private IZyJxdgTeacherMainService zyJxdgTeacherMainService;
@Autowired
private IZyJxdgTeacherCenterService zyJxdgTeacherCenterService;
/**
* 分页列表查询
*
* @param zyJxdgTeacherMain
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "教师填写教学大纲-分页列表查询")
@ApiOperation(value="教师填写教学大纲-分页列表查询", notes="教师填写教学大纲-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<ZyJxdgTeacherMain>> queryPageList(ZyJxdgTeacherMain zyJxdgTeacherMain,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<ZyJxdgTeacherMain> queryWrapper = QueryGenerator.initQueryWrapper(zyJxdgTeacherMain, req.getParameterMap());
Page<ZyJxdgTeacherMain> page = new Page<ZyJxdgTeacherMain>(pageNo, pageSize);
IPage<ZyJxdgTeacherMain> pageList = zyJxdgTeacherMainService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param zyJxdgTeacherMainPage
* @return
*/
@AutoLog(value = "教师填写教学大纲-添加")
@ApiOperation(value="教师填写教学大纲-添加", notes="教师填写教学大纲-添加")
@RequiresPermissions("zyJxdgTeacherMain:zy_jxdg_teacher_main:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ZyJxdgTeacherMainPage zyJxdgTeacherMainPage) {
ZyJxdgTeacherMain zyJxdgTeacherMain = new ZyJxdgTeacherMain();
BeanUtils.copyProperties(zyJxdgTeacherMainPage, zyJxdgTeacherMain);
zyJxdgTeacherMainService.saveMain(zyJxdgTeacherMain, zyJxdgTeacherMainPage.getZyJxdgTeacherCenterList());
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param zyJxdgTeacherMainPage
* @return
*/
@AutoLog(value = "教师填写教学大纲-编辑")
@ApiOperation(value="教师填写教学大纲-编辑", notes="教师填写教学大纲-编辑")
@RequiresPermissions("zyJxdgTeacherMain:zy_jxdg_teacher_main:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody ZyJxdgTeacherMainPage zyJxdgTeacherMainPage) {
ZyJxdgTeacherMain zyJxdgTeacherMain = new ZyJxdgTeacherMain();
BeanUtils.copyProperties(zyJxdgTeacherMainPage, zyJxdgTeacherMain);
ZyJxdgTeacherMain zyJxdgTeacherMainEntity = zyJxdgTeacherMainService.getById(zyJxdgTeacherMain.getId());
if(zyJxdgTeacherMainEntity==null) {
return Result.error("未找到对应数据");
}
zyJxdgTeacherMainService.updateMain(zyJxdgTeacherMain, zyJxdgTeacherMainPage.getZyJxdgTeacherCenterList());
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "教师填写教学大纲-通过id删除")
@ApiOperation(value="教师填写教学大纲-通过id删除", notes="教师填写教学大纲-通过id删除")
@RequiresPermissions("zyJxdgTeacherMain:zy_jxdg_teacher_main:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
zyJxdgTeacherMainService.delMain(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "教师填写教学大纲-批量删除")
@ApiOperation(value="教师填写教学大纲-批量删除", notes="教师填写教学大纲-批量删除")
@RequiresPermissions("zyJxdgTeacherMain:zy_jxdg_teacher_main:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.zyJxdgTeacherMainService.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<ZyJxdgTeacherMain> queryById(@RequestParam(name="id",required=true) String id) {
ZyJxdgTeacherMain zyJxdgTeacherMain = zyJxdgTeacherMainService.getById(id);
if(zyJxdgTeacherMain==null) {
return Result.error("未找到对应数据");
}
return Result.OK(zyJxdgTeacherMain);
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "教师填写教学大纲内容通过主表ID查询")
@ApiOperation(value="教师填写教学大纲内容主表ID查询", notes="教师填写教学大纲内容-通主表ID查询")
@GetMapping(value = "/queryZyJxdgTeacherCenterByMainId")
public Result<List<ZyJxdgTeacherCenter>> queryZyJxdgTeacherCenterListByMainId(@RequestParam(name="id",required=true) String id) {
List<ZyJxdgTeacherCenter> zyJxdgTeacherCenterList = zyJxdgTeacherCenterService.selectByMainId(id);
return Result.OK(zyJxdgTeacherCenterList);
}
/**
* 导出excel
*
* @param request
* @param zyJxdgTeacherMain
*/
@RequiresPermissions("zyJxdgTeacherMain:zy_jxdg_teacher_main:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ZyJxdgTeacherMain zyJxdgTeacherMain) {
// Step.1 组装查询条件查询数据
QueryWrapper<ZyJxdgTeacherMain> queryWrapper = QueryGenerator.initQueryWrapper(zyJxdgTeacherMain, 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<ZyJxdgTeacherMain> zyJxdgTeacherMainList = zyJxdgTeacherMainService.list(queryWrapper);
// Step.3 组装pageList
List<ZyJxdgTeacherMainPage> pageList = new ArrayList<ZyJxdgTeacherMainPage>();
for (ZyJxdgTeacherMain main : zyJxdgTeacherMainList) {
ZyJxdgTeacherMainPage vo = new ZyJxdgTeacherMainPage();
BeanUtils.copyProperties(main, vo);
List<ZyJxdgTeacherCenter> zyJxdgTeacherCenterList = zyJxdgTeacherCenterService.selectByMainId(main.getId());
vo.setZyJxdgTeacherCenterList(zyJxdgTeacherCenterList);
pageList.add(vo);
}
// Step.4 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "教师填写教学大纲列表");
mv.addObject(NormalExcelConstants.CLASS, ZyJxdgTeacherMainPage.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("教师填写教学大纲数据", "导出人:"+sysUser.getRealname(), "教师填写教学大纲"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("zyJxdgTeacherMain:zy_jxdg_teacher_main: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<ZyJxdgTeacherMainPage> list = ExcelImportUtil.importExcel(file.getInputStream(), ZyJxdgTeacherMainPage.class, params);
for (ZyJxdgTeacherMainPage page : list) {
ZyJxdgTeacherMain po = new ZyJxdgTeacherMain();
BeanUtils.copyProperties(page, po);
zyJxdgTeacherMainService.saveMain(po, page.getZyJxdgTeacherCenterList());
}
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("文件导入失败!");
}
@PostMapping(value = "/addMap")
public Result<String> addMap(@RequestBody Map<String,Object> map) {
// ZyJxdgTeacherMain zyJxdgTeacherMain = new ZyJxdgTeacherMain();
// BeanUtils.copyProperties(zyJxdgTeacherMainPage, zyJxdgTeacherMain);
zyJxdgTeacherMainService.addMap(map);
return Result.OK("添加成功!");
}
@PostMapping(value = "/editMap")
public Result<String> editMap(@RequestBody Map<String,Object> map) {
zyJxdgTeacherMainService.editMap(map);
return Result.OK("添加成功!");
}
@ApiOperation(value="获取教学大纲教师填写信息", notes="获取教学大纲教师填写信息")
@GetMapping(value = "/queryByRwbhList")
public Result<List<ZyJxdgMain>> queryByRwbhList(@RequestParam(name="rwbh",required=true) String rwbh,@RequestParam(name="teacherNo",required=true) String teacherNo) {
List<ZyJxdgMain> list = zyJxdgTeacherMainService.queryByRwbhList(rwbh,teacherNo);
if(list==null) {
return Result.error("未找到对应数据");
}
return Result.OK(list);
}
@ApiOperation(value="获取教学大纲教师填写信息", notes="获取教学大纲教师填写信息")
@GetMapping(value = "/queryByRwbh")
public Result<ZyJxdgTeacherMain> queryByRwbh(ZyJxdgTeacherMain zyJxdgTeacherMain) {
QueryWrapper<ZyJxdgTeacherMain> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("rwbh",zyJxdgTeacherMain.getRwbh());
queryWrapper.eq("teacher_no",zyJxdgTeacherMain.getTeacherNo());
queryWrapper.last("limit 1");
ZyJxdgTeacherMain list = zyJxdgTeacherMainService.getOne(queryWrapper);
if(list==null) {
return Result.error("未找到对应数据");
}
return Result.OK(list);
}
}

View File

@ -0,0 +1,72 @@
package org.jeecg.modules.kc.zyJxdgTeacherMain.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-08-20
* @Version: V1.0
*/
@ApiModel(value="zy_jxdg_teacher_center对象", description="教师填写教学大纲内容")
@Data
@TableName("zy_jxdg_teacher_center")
public class ZyJxdgTeacherCenter implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**createBy*/
@ApiModelProperty(value = "createBy")
private java.lang.String createBy;
/**createTime*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "createTime")
private java.util.Date createTime;
/**updateBy*/
@ApiModelProperty(value = "updateBy")
private java.lang.String updateBy;
/**updateTime*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "updateTime")
private java.util.Date updateTime;
/**主表id*/
@ApiModelProperty(value = "主表id")
private java.lang.String mainId;
/**一级id*/
@Excel(name = "一级id", width = 15)
@ApiModelProperty(value = "一级id")
private java.lang.String oneId;
/**二级id*/
@Excel(name = "二级id", width = 15)
@ApiModelProperty(value = "二级id")
private java.lang.String twoId;
/**三级id*/
@Excel(name = "三级id", width = 15)
@ApiModelProperty(value = "三级id")
private java.lang.String threeId;
/**类型*/
@Excel(name = "类型", width = 15)
@ApiModelProperty(value = "类型")
private java.lang.String type;
/**填写内容*/
@Excel(name = "填写内容", width = 15)
@ApiModelProperty(value = "填写内容")
private java.lang.String content;
}

View File

@ -0,0 +1,88 @@
package org.jeecg.modules.kc.zyJxdgTeacherMain.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
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;
/**
* @Description: 教师填写教学大纲
* @Author: jeecg-boot
* @Date: 2024-08-20
* @Version: V1.0
*/
@ApiModel(value="zy_jxdg_teacher_main对象", description="教师填写教学大纲")
@Data
@TableName("zy_jxdg_teacher_main")
public class ZyJxdgTeacherMain implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**createBy*/
@ApiModelProperty(value = "createBy")
private java.lang.String createBy;
/**createTime*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "createTime")
private java.util.Date createTime;
/**updateBy*/
@ApiModelProperty(value = "updateBy")
private java.lang.String updateBy;
/**updateTime*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "updateTime")
private java.util.Date updateTime;
/**版本id*/
@Excel(name = "版本id", width = 15, dictTable = "zy_jxdg_banben", dicText = "title", dicCode = "id")
@Dict(dictTable = "zy_jxdg_banben", dicText = "title", dicCode = "id")
@ApiModelProperty(value = "版本id")
private java.lang.String banbenId;
/**是否发布0未发布 1已发布*/
@Excel(name = "是否发布0未发布 1已发布", width = 15, dicCode = "yn")
@Dict(dicCode = "yn")
@ApiModelProperty(value = "是否发布0未发布 1已发布")
private java.lang.String sffb;
/**任务编号*/
@Excel(name = "任务编号", width = 15)
@ApiModelProperty(value = "任务编号")
private java.lang.String rwbh;
/**教师工号*/
@Excel(name = "教师工号", width = 15)
@ApiModelProperty(value = "教师工号")
private java.lang.String teacherNo;
/**教师姓名*/
@Excel(name = "教师姓名", width = 15)
@ApiModelProperty(value = "教师姓名")
private java.lang.String teacherName;
/**课程名称*/
@Excel(name = "课程名称", width = 15)
@ApiModelProperty(value = "课程名称")
private java.lang.String kcmc;
/**开课单位*/
@Excel(name = "开课单位", width = 15)
@ApiModelProperty(value = "开课单位")
private java.lang.String kkdw;
/**开课单位id*/
@Excel(name = "开课单位id", width = 15)
@ApiModelProperty(value = "开课单位id")
private java.lang.String kkdwid;
/**选课人数*/
@Excel(name = "选课人数", width = 15)
@ApiModelProperty(value = "选课人数")
private java.lang.String xkrs;
}

View File

@ -0,0 +1,31 @@
package org.jeecg.modules.kc.zyJxdgTeacherMain.mapper;
import java.util.List;
import org.jeecg.modules.kc.zyJxdgTeacherMain.entity.ZyJxdgTeacherCenter;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* @Description: 教师填写教学大纲内容
* @Author: jeecg-boot
* @Date: 2024-08-20
* @Version: V1.0
*/
public interface ZyJxdgTeacherCenterMapper extends BaseMapper<ZyJxdgTeacherCenter> {
/**
* 通过主表id删除子表数据
*
* @param mainId 主表id
* @return boolean
*/
public boolean deleteByMainId(@Param("mainId") String mainId);
/**
* 通过主表id查询子表数据
*
* @param mainId 主表id
* @return List<ZyJxdgTeacherCenter>
*/
public List<ZyJxdgTeacherCenter> selectByMainId(@Param("mainId") String mainId);
}

View File

@ -0,0 +1,17 @@
package org.jeecg.modules.kc.zyJxdgTeacherMain.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.kc.zyJxdgTeacherMain.entity.ZyJxdgTeacherMain;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 教师填写教学大纲
* @Author: jeecg-boot
* @Date: 2024-08-20
* @Version: V1.0
*/
public interface ZyJxdgTeacherMainMapper extends BaseMapper<ZyJxdgTeacherMain> {
}

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.zyJxdgTeacherMain.mapper.ZyJxdgTeacherCenterMapper">
<delete id="deleteByMainId" parameterType="java.lang.String">
DELETE
FROM zy_jxdg_teacher_center
WHERE
main_id = #{mainId} </delete>
<select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.kc.zyJxdgTeacherMain.entity.ZyJxdgTeacherCenter">
SELECT *
FROM zy_jxdg_teacher_center
WHERE
main_id = #{mainId} </select>
</mapper>

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.zyJxdgTeacherMain.mapper.ZyJxdgTeacherMainMapper">
</mapper>

View File

@ -0,0 +1,22 @@
package org.jeecg.modules.kc.zyJxdgTeacherMain.service;
import org.jeecg.modules.kc.zyJxdgTeacherMain.entity.ZyJxdgTeacherCenter;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @Description: 教师填写教学大纲内容
* @Author: jeecg-boot
* @Date: 2024-08-20
* @Version: V1.0
*/
public interface IZyJxdgTeacherCenterService extends IService<ZyJxdgTeacherCenter> {
/**
* 通过主表id查询子表数据
*
* @param mainId 主表id
* @return List<ZyJxdgTeacherCenter>
*/
public List<ZyJxdgTeacherCenter> selectByMainId(String mainId);
}

View File

@ -0,0 +1,56 @@
package org.jeecg.modules.kc.zyJxdgTeacherMain.service;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgBanben;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgMain;
import org.jeecg.modules.kc.zyJxdgTeacherMain.entity.ZyJxdgTeacherCenter;
import org.jeecg.modules.kc.zyJxdgTeacherMain.entity.ZyJxdgTeacherMain;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* @Description: 教师填写教学大纲
* @Author: jeecg-boot
* @Date: 2024-08-20
* @Version: V1.0
*/
public interface IZyJxdgTeacherMainService extends IService<ZyJxdgTeacherMain> {
/**
* 添加一对多
*
* @param zyJxdgTeacherMain
* @param zyJxdgTeacherCenterList
*/
public void saveMain(ZyJxdgTeacherMain zyJxdgTeacherMain,List<ZyJxdgTeacherCenter> zyJxdgTeacherCenterList) ;
/**
* 修改一对多
*
* @param zyJxdgTeacherMain
* @param zyJxdgTeacherCenterList
*/
public void updateMain(ZyJxdgTeacherMain zyJxdgTeacherMain,List<ZyJxdgTeacherCenter> zyJxdgTeacherCenterList);
/**
* 删除一对多
*
* @param id
*/
public void delMain (String id);
/**
* 批量删除一对多
*
* @param idList
*/
public void delBatchMain (Collection<? extends Serializable> idList);
void addMap(Map<String, Object> map);
List<ZyJxdgMain> queryByRwbhList(String id, String teacherNo);
void editMap(Map<String, Object> map);
}

View File

@ -0,0 +1,27 @@
package org.jeecg.modules.kc.zyJxdgTeacherMain.service.impl;
import org.jeecg.modules.kc.zyJxdgTeacherMain.entity.ZyJxdgTeacherCenter;
import org.jeecg.modules.kc.zyJxdgTeacherMain.mapper.ZyJxdgTeacherCenterMapper;
import org.jeecg.modules.kc.zyJxdgTeacherMain.service.IZyJxdgTeacherCenterService;
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-08-20
* @Version: V1.0
*/
@Service
public class ZyJxdgTeacherCenterServiceImpl extends ServiceImpl<ZyJxdgTeacherCenterMapper, ZyJxdgTeacherCenter> implements IZyJxdgTeacherCenterService {
@Autowired
private ZyJxdgTeacherCenterMapper zyJxdgTeacherCenterMapper;
@Override
public List<ZyJxdgTeacherCenter> selectByMainId(String mainId) {
return zyJxdgTeacherCenterMapper.selectByMainId(mainId);
}
}

View File

@ -0,0 +1,373 @@
package org.jeecg.modules.kc.zyJxdgTeacherMain.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.text.StringUtils;
import org.jeecg.modules.kc.kcSysConfig.entity.KcSysConfig;
import org.jeecg.modules.kc.kcSysConfig.service.IKcSysConfigService;
import org.jeecg.modules.kc.ktgl.entity.KcKechengbiao;
import org.jeecg.modules.kc.ktgl.service.IKcKechengbiaoService;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgBanben;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgMain;
import org.jeecg.modules.kc.zyJxdgBanben.entity.ZyJxdgPzxx;
import org.jeecg.modules.kc.zyJxdgBanben.mapper.ZyJxdgMainMapper;
import org.jeecg.modules.kc.zyJxdgBanben.mapper.ZyJxdgPzxxMapper;
import org.jeecg.modules.kc.zyJxdgTeacherMain.entity.ZyJxdgTeacherMain;
import org.jeecg.modules.kc.zyJxdgTeacherMain.entity.ZyJxdgTeacherCenter;
import org.jeecg.modules.kc.zyJxdgTeacherMain.mapper.ZyJxdgTeacherCenterMapper;
import org.jeecg.modules.kc.zyJxdgTeacherMain.mapper.ZyJxdgTeacherMainMapper;
import org.jeecg.modules.kc.zyJxdgTeacherMain.service.IZyJxdgTeacherMainService;
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 java.io.Serializable;
import java.util.*;
/**
* @Description: 教师填写教学大纲
* @Author: jeecg-boot
* @Date: 2024-08-20
* @Version: V1.0
*/
@Service
public class ZyJxdgTeacherMainServiceImpl extends ServiceImpl<ZyJxdgTeacherMainMapper, ZyJxdgTeacherMain> implements IZyJxdgTeacherMainService {
@Autowired
private ZyJxdgTeacherMainMapper zyJxdgTeacherMainMapper;
@Autowired
private ZyJxdgTeacherCenterMapper zyJxdgTeacherCenterMapper;
@Autowired
private ZyJxdgMainMapper zyJxdgMainMapper;
@Autowired
private ZyJxdgPzxxMapper zyJxdgPzxxMapper;
@Autowired
private IKcSysConfigService kcSysConfigService;
@Autowired
private IKcKechengbiaoService kcKechengbiaoService;
@Override
@Transactional(rollbackFor = Exception.class)
public void saveMain(ZyJxdgTeacherMain zyJxdgTeacherMain, List<ZyJxdgTeacherCenter> zyJxdgTeacherCenterList) {
zyJxdgTeacherMainMapper.insert(zyJxdgTeacherMain);
if(zyJxdgTeacherCenterList!=null && zyJxdgTeacherCenterList.size()>0) {
for(ZyJxdgTeacherCenter entity:zyJxdgTeacherCenterList) {
//外键设置
entity.setMainId(zyJxdgTeacherMain.getId());
zyJxdgTeacherCenterMapper.insert(entity);
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateMain(ZyJxdgTeacherMain zyJxdgTeacherMain,List<ZyJxdgTeacherCenter> zyJxdgTeacherCenterList) {
zyJxdgTeacherMainMapper.updateById(zyJxdgTeacherMain);
//1.先删除子表数据
zyJxdgTeacherCenterMapper.deleteByMainId(zyJxdgTeacherMain.getId());
//2.子表数据重新插入
if(zyJxdgTeacherCenterList!=null && zyJxdgTeacherCenterList.size()>0) {
for(ZyJxdgTeacherCenter entity:zyJxdgTeacherCenterList) {
//外键设置
entity.setMainId(zyJxdgTeacherMain.getId());
zyJxdgTeacherCenterMapper.insert(entity);
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delMain(String id) {
zyJxdgTeacherCenterMapper.deleteByMainId(id);
zyJxdgTeacherMainMapper.deleteById(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delBatchMain(Collection<? extends Serializable> idList) {
for(Serializable id:idList) {
zyJxdgTeacherCenterMapper.deleteByMainId(id.toString());
zyJxdgTeacherMainMapper.deleteById(id);
}
}
@Override
public void addMap(Map<String, Object> map) {
KcSysConfig kcSysConfig = kcSysConfigService.getById("1");
String rwbh = map.get("rwbh")+"";
String banbenId = map.get("banbenId")+"";
String teacherNo = map.get("teacherNo")+"";
QueryWrapper<KcKechengbiao> kcKechengbiaoQueryWrapper = new QueryWrapper<>();
kcKechengbiaoQueryWrapper.eq("xqxn",kcSysConfig.getFlag1());
kcKechengbiaoQueryWrapper.eq("rwbh",rwbh);
kcKechengbiaoQueryWrapper.eq("jgh",teacherNo);
kcKechengbiaoQueryWrapper.last("limit 1");
KcKechengbiao kcKechengbiao = kcKechengbiaoService.getOne(kcKechengbiaoQueryWrapper);
String sffb = map.get("sffb")+"";
String teacherName = kcKechengbiao.getSkjs();
String kcmc = kcKechengbiao.getKcmc();
String kkdw = kcKechengbiao.getKkdw();
String kkdwid = kcKechengbiao.getKkdwid();
String xkrs = kcKechengbiao.getXkrs();
List<ZyJxdgTeacherCenter> zyJxdgTeacherCenterList = new ArrayList<>();
List<Map<String,Object>> list = (List<Map<String, Object>>) map.get("list");
for(Map<String,Object> par : list){
String oneId = par.get("mainId")+"";
String twoId = par.get("id")+"";
if(StringUtils.equals(par.get("type")+"","3") || StringUtils.equals(par.get("type")+"","2") || StringUtils.equals(par.get("type")+"","1")){
String content = par.get("content")+"";
if(StringUtils.equals(content,"null")){
content = "";
}
ZyJxdgTeacherCenter ZyJxdgTeacherCenter = new ZyJxdgTeacherCenter();
ZyJxdgTeacherCenter.setOneId(oneId);
ZyJxdgTeacherCenter.setTwoId(twoId);
ZyJxdgTeacherCenter.setContent(content);
ZyJxdgTeacherCenter.setType(par.get("type")+"");
zyJxdgTeacherCenterList.add(ZyJxdgTeacherCenter);
}else if(StringUtils.equals(par.get("type")+"","4")){
List<Map<String,Object>> list2 = (List<Map<String, Object>>) par.get("zyJxdgPzxxList");
if(list2!=null){
for(Map<String,Object> par2 : list2){
String threeId = par2.get("id")+"";
String content = par2.get("content")+"";
if(StringUtils.equals(content,"null")){
content = "";
}
ZyJxdgTeacherCenter ZyJxdgTeacherCenter = new ZyJxdgTeacherCenter();
ZyJxdgTeacherCenter.setOneId(oneId);
ZyJxdgTeacherCenter.setTwoId(twoId);
ZyJxdgTeacherCenter.setThreeId(threeId);
ZyJxdgTeacherCenter.setContent(content);
ZyJxdgTeacherCenter.setType(par.get("type")+"");
zyJxdgTeacherCenterList.add(ZyJxdgTeacherCenter);
}
}
}else if(StringUtils.equals(par.get("type")+"","5") || StringUtils.equals(par.get("type")+"","9") || StringUtils.equals(par.get("type")+"","10")){
List<Map<String,Object>> list2 = (List<Map<String, Object>>) par.get("zyJxdgPzxxList");
List<Map<String,Object>> list3 = (List<Map<String, Object>>) par.get("list");
if(list2!=null && list3!=null){
for(Map<String,Object> par2 : list2){
for(Map<String,Object> par3 : list3){
String threeId = par2.get("id")+"";
String content = par3.get(threeId)+"";
ZyJxdgTeacherCenter ZyJxdgTeacherCenter = new ZyJxdgTeacherCenter();
ZyJxdgTeacherCenter.setOneId(oneId);
ZyJxdgTeacherCenter.setTwoId(twoId);
ZyJxdgTeacherCenter.setThreeId(threeId);
ZyJxdgTeacherCenter.setContent(content);
ZyJxdgTeacherCenter.setType(par.get("type")+"");
zyJxdgTeacherCenterList.add(ZyJxdgTeacherCenter);
}
}
}
}else if(StringUtils.equals(par.get("type")+"","6") || StringUtils.equals(par.get("type")+"","7") || StringUtils.equals(par.get("type")+"","8")){
List<Map<String,Object>> list2 = (List<Map<String, Object>>) par.get("list");
if(list2!=null){
for(Map<String,Object> par2 : list2){
String content = par2.get("title")+"";
ZyJxdgTeacherCenter ZyJxdgTeacherCenter = new ZyJxdgTeacherCenter();
ZyJxdgTeacherCenter.setOneId(oneId);
ZyJxdgTeacherCenter.setTwoId(twoId);
ZyJxdgTeacherCenter.setContent(content);
ZyJxdgTeacherCenter.setType(par.get("type")+"");
zyJxdgTeacherCenterList.add(ZyJxdgTeacherCenter);
}
}
}
}
ZyJxdgTeacherMain zyJxdgTeacherMain = new ZyJxdgTeacherMain();
zyJxdgTeacherMain.setRwbh(rwbh);
zyJxdgTeacherMain.setBanbenId(banbenId);
zyJxdgTeacherMain.setTeacherNo(teacherNo);
zyJxdgTeacherMain.setTeacherName(teacherName);
zyJxdgTeacherMain.setKcmc(kcmc);
zyJxdgTeacherMain.setKkdw(kkdw);
zyJxdgTeacherMain.setKkdwid(kkdwid);
zyJxdgTeacherMain.setXkrs(xkrs);
zyJxdgTeacherMain.setSffb(sffb);
zyJxdgTeacherMainMapper.insert(zyJxdgTeacherMain);
if(zyJxdgTeacherCenterList!=null && zyJxdgTeacherCenterList.size()>0) {
for(ZyJxdgTeacherCenter entity:zyJxdgTeacherCenterList) {
//外键设置
entity.setMainId(zyJxdgTeacherMain.getId());
zyJxdgTeacherCenterMapper.insert(entity);
}
}
}
@Override
public List<ZyJxdgMain> queryByRwbhList(String rwbh,String teacherNo) {
QueryWrapper<ZyJxdgTeacherMain> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("rwbh",rwbh);
queryWrapper.eq("teacher_no",teacherNo);
queryWrapper.last("limit 1");
ZyJxdgTeacherMain zyJxdgTeacherMain= zyJxdgTeacherMainMapper.selectOne(queryWrapper);
List<ZyJxdgTeacherCenter> conlist = zyJxdgTeacherCenterMapper.selectByMainId(zyJxdgTeacherMain.getId());
List<ZyJxdgMain> list = zyJxdgMainMapper.selectByMainId(zyJxdgTeacherMain.getBanbenId());
for(ZyJxdgMain par : list){
List<ZyJxdgPzxx> list2 = zyJxdgPzxxMapper.selectByTwoMainId(par.getId());
List<Map<String,Object>> listMap = new ArrayList<>();
if(StringUtils.equals(par.getType(),"4")){
for(ZyJxdgPzxx par2 : list2){
for(ZyJxdgTeacherCenter par3 : conlist){
if(StringUtils.equals(par2.getId(),par3.getThreeId())){
par2.setContent(par3.getContent());
}
}
}
}else if(StringUtils.equals(par.getType(),"6") || StringUtils.equals(par.getType(),"7") || StringUtils.equals(par.getType(),"8")){
for(ZyJxdgTeacherCenter par3 : conlist){
if(StringUtils.equals(par.getId(),par3.getTwoId())&&StringUtils.isEmpty(par3.getThreeId())){
Map<String,Object> map = new HashMap<>();
map.put("title", par3.getContent());
listMap.add(map);
}
}
}else if(StringUtils.equals(par.getType(),"5") || StringUtils.equals(par.getType(),"9")|| StringUtils.equals(par.getType(),"10")){
List<Map<String,Object>> listmap2 = new ArrayList<>();
for(int i=0;i< list2.size();i++){
int j=0;
ZyJxdgPzxx par2 = list2.get(i);
for(ZyJxdgTeacherCenter par3 : conlist){
if(StringUtils.equals(par2.getId(),par3.getThreeId())) {
Map<String, Object> map3 = new HashMap<>();
if(i==0){
map3.put(par2.getId(), par3.getContent());
listmap2.add(map3);
}else{
listmap2.get(j).put(par3.getThreeId(), par3.getContent());
}
j++;
}
}
}
listMap = listmap2;
}else{
for(ZyJxdgTeacherCenter par3 : conlist){
if(StringUtils.equals(par.getId(),par3.getTwoId())&&StringUtils.isEmpty(par3.getThreeId())){
par.setContent(par3.getContent());
}
}
}
par.setList(listMap);
par.setZyJxdgPzxxList(list2);
}
return list;
}
@Override
public void editMap(Map<String, Object> map) {
String id = map.get("id")+"";
String banbenId = map.get("banbenId")+"";
String sffb = map.get("sffb")+"";
String kcmc = "";
String kkdw = "";
String kkdwid = "";
String xkrs = "";
List<ZyJxdgTeacherCenter> zyJxdgTeacherCenterList = new ArrayList<>();
List<Map<String,Object>> list = (List<Map<String, Object>>) map.get("list");
for(Map<String,Object> par : list){
String oneId = par.get("mainId")+"";
String twoId = par.get("id")+"";
if(StringUtils.equals(par.get("type")+"","3") || StringUtils.equals(par.get("type")+"","2") || StringUtils.equals(par.get("type")+"","1")){
String content = par.get("content")+"";
if(StringUtils.equals(content,"null")){
content = "";
}
ZyJxdgTeacherCenter ZyJxdgTeacherCenter = new ZyJxdgTeacherCenter();
ZyJxdgTeacherCenter.setOneId(oneId);
ZyJxdgTeacherCenter.setTwoId(twoId);
ZyJxdgTeacherCenter.setContent(content);
ZyJxdgTeacherCenter.setType(par.get("type")+"");
zyJxdgTeacherCenterList.add(ZyJxdgTeacherCenter);
}else if(StringUtils.equals(par.get("type")+"","4")){
List<Map<String,Object>> list2 = (List<Map<String, Object>>) par.get("zyJxdgPzxxList");
for(Map<String,Object> par2 : list2){
String threeId = par2.get("id")+"";
String content = par2.get("content")+"";
if(StringUtils.equals(content,"null")){
content = "";
}
ZyJxdgTeacherCenter ZyJxdgTeacherCenter = new ZyJxdgTeacherCenter();
ZyJxdgTeacherCenter.setOneId(oneId);
ZyJxdgTeacherCenter.setTwoId(twoId);
ZyJxdgTeacherCenter.setThreeId(threeId);
ZyJxdgTeacherCenter.setContent(content);
ZyJxdgTeacherCenter.setType(par.get("type")+"");
zyJxdgTeacherCenterList.add(ZyJxdgTeacherCenter);
}
}else if(StringUtils.equals(par.get("type")+"","5") || StringUtils.equals(par.get("type")+"","9") || StringUtils.equals(par.get("type")+"","10")){
List<Map<String,Object>> list2 = (List<Map<String, Object>>) par.get("zyJxdgPzxxList");
List<Map<String,Object>> list3 = (List<Map<String, Object>>) par.get("list");
for(Map<String,Object> par2 : list2){
for(Map<String,Object> par3 : list3){
// if(StringUtils.equals(par2.get("id")+"",par3.get(par2.get("id")+"")+"")){
String threeId = par2.get("id")+"";
String content = par3.get(threeId)+"";
ZyJxdgTeacherCenter ZyJxdgTeacherCenter = new ZyJxdgTeacherCenter();
ZyJxdgTeacherCenter.setOneId(oneId);
ZyJxdgTeacherCenter.setTwoId(twoId);
ZyJxdgTeacherCenter.setThreeId(threeId);
ZyJxdgTeacherCenter.setContent(content);
ZyJxdgTeacherCenter.setType(par.get("type")+"");
zyJxdgTeacherCenterList.add(ZyJxdgTeacherCenter);
// }
}
}
}else if(StringUtils.equals(par.get("type")+"","6") || StringUtils.equals(par.get("type")+"","7") || StringUtils.equals(par.get("type")+"","8")){
List<Map<String,Object>> list2 = (List<Map<String, Object>>) par.get("list");
for(Map<String,Object> par2 : list2){
String content = par2.get("title")+"";
ZyJxdgTeacherCenter ZyJxdgTeacherCenter = new ZyJxdgTeacherCenter();
ZyJxdgTeacherCenter.setOneId(oneId);
ZyJxdgTeacherCenter.setTwoId(twoId);
ZyJxdgTeacherCenter.setContent(content);
ZyJxdgTeacherCenter.setType(par.get("type")+"");
zyJxdgTeacherCenterList.add(ZyJxdgTeacherCenter);
}
}
}
ZyJxdgTeacherMain zyJxdgTeacherMain = new ZyJxdgTeacherMain();
zyJxdgTeacherMain.setBanbenId(banbenId);
zyJxdgTeacherMain.setKcmc(kcmc);
zyJxdgTeacherMain.setKkdw(kkdw);
zyJxdgTeacherMain.setKkdwid(kkdwid);
zyJxdgTeacherMain.setXkrs(xkrs);
zyJxdgTeacherMain.setSffb(sffb);
zyJxdgTeacherMain.setId(id);
zyJxdgTeacherMainMapper.updateById(zyJxdgTeacherMain);
zyJxdgTeacherCenterMapper.deleteByMainId(id);
if(zyJxdgTeacherCenterList!=null && zyJxdgTeacherCenterList.size()>0) {
for(ZyJxdgTeacherCenter entity:zyJxdgTeacherCenterList) {
//外键设置
entity.setMainId(zyJxdgTeacherMain.getId());
zyJxdgTeacherCenterMapper.insert(entity);
}
}
}
}

View File

@ -0,0 +1,89 @@
package org.jeecg.modules.kc.zyJxdgTeacherMain.vo;
import java.util.List;
import org.jeecg.modules.kc.zyJxdgTeacherMain.entity.ZyJxdgTeacherMain;
import org.jeecg.modules.kc.zyJxdgTeacherMain.entity.ZyJxdgTeacherCenter;
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-08-20
* @Version: V1.0
*/
@Data
@ApiModel(value="zy_jxdg_teacher_mainPage对象", description="教师填写教学大纲")
public class ZyJxdgTeacherMainPage {
/**id*/
@ApiModelProperty(value = "id")
private java.lang.String id;
/**createBy*/
@ApiModelProperty(value = "createBy")
private java.lang.String createBy;
/**createTime*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "createTime")
private java.util.Date createTime;
/**updateBy*/
@ApiModelProperty(value = "updateBy")
private java.lang.String updateBy;
/**updateTime*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "updateTime")
private java.util.Date updateTime;
/**版本id*/
@Excel(name = "版本id", width = 15, dictTable = "zy_jxdg_banben", dicText = "title", dicCode = "id")
@Dict(dictTable = "zy_jxdg_banben", dicText = "title", dicCode = "id")
@ApiModelProperty(value = "版本id")
private java.lang.String banbenId;
/**是否发布0未发布 1已发布*/
@Excel(name = "是否发布0未发布 1已发布", width = 15, dicCode = "yn")
@Dict(dicCode = "yn")
@ApiModelProperty(value = "是否发布0未发布 1已发布")
private java.lang.String sffb;
/**任务编号*/
@Excel(name = "任务编号", width = 15)
@ApiModelProperty(value = "任务编号")
private java.lang.String rwbh;
/**教师工号*/
@Excel(name = "教师工号", width = 15)
@ApiModelProperty(value = "教师工号")
private java.lang.String teacherNo;
/**教师姓名*/
@Excel(name = "教师姓名", width = 15)
@ApiModelProperty(value = "教师姓名")
private java.lang.String teacherName;
/**课程名称*/
@Excel(name = "课程名称", width = 15)
@ApiModelProperty(value = "课程名称")
private java.lang.String kcmc;
/**开课单位*/
@Excel(name = "开课单位", width = 15)
@ApiModelProperty(value = "开课单位")
private java.lang.String kkdw;
/**开课单位id*/
@Excel(name = "开课单位id", width = 15)
@ApiModelProperty(value = "开课单位id")
private java.lang.String kkdwid;
/**选课人数*/
@Excel(name = "选课人数", width = 15)
@ApiModelProperty(value = "选课人数")
private java.lang.String xkrs;
@ExcelCollection(name="教师填写教学大纲内容")
@ApiModelProperty(value = "教师填写教学大纲内容")
private List<ZyJxdgTeacherCenter> zyJxdgTeacherCenterList;
}