修改bug

This commit is contained in:
yangjun 2023-12-04 23:44:55 +08:00
parent 2d2a46e85d
commit 704733c6b7
16 changed files with 420 additions and 73 deletions

View File

@ -95,7 +95,7 @@
<insert id="saveStudentMrtx">
INSERT INTO kc_messagelistcopy ( touser, template_id, tourl, firstdata, remarkdata, keyword1, keyword2, keyword3, scheduleddatetime ) SELECT
bd.openid,-- touser:oak6lwA02iVyBKrVSok4uUpzeBmY
'KtWw0lwQ8FOgJdKgrmya0eoafGkMfMN8ECdZs8oSJys',-- template_id:KtWw0lwQ8FOgJdKgrmya0eoafGkMfMN8ECdZs8oSJys
'PDS1hf6s8P5Ce-SFa9J95XvHhMIGlyhITAGq_CIoNMM',-- template_id:KtWw0lwQ8FOgJdKgrmya0eoafGkMfMN8ECdZs8oSJys
'https://zxkccx.webvpn.nenu.edu.cn/index',-- tourl:https://zxkccx.webvpn.nenu.edu.cn/index
CONCAT( xk.xm, '同学,您明天的课程安排如下:' ),-- firstdata:吴一凡同学,您明天的课程安排如下:
'',-- remarkdata:
@ -143,7 +143,7 @@
<insert id="saveTeacherMrtx">
INSERT INTO kc_messagelistcopy ( touser, template_id, tourl, firstdata, remarkdata, keyword1, keyword2, keyword3, scheduleddatetime ) SELECT
bd.openid,-- touser:oak6lwAa1epMAgwQziF2K9yBkiLE
'KtWw0lwQ8FOgJdKgrmya0eoafGkMfMN8ECdZs8oSJys',-- template_id:KtWw0lwQ8FOgJdKgrmya0eoafGkMfMN8ECdZs8oSJys
'PDS1hf6s8P5Ce-SFa9J95XvHhMIGlyhITAGq_CIoNMM',-- template_id:KtWw0lwQ8FOgJdKgrmya0eoafGkMfMN8ECdZs8oSJys
'https://zxkccx.webvpn.nenu.edu.cn/index',-- tourl:https://zxkccx.webvpn.nenu.edu.cn/index
CONCAT( kt.skjs, '老师,您明天的课程安排如下:' ),-- firstdata:张靖波老师,您明天的课程安排如下:
'',-- remarkdata:

View File

@ -18,6 +18,7 @@ import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.kc.config.entity.KcExportConfigTpkwcqkjzglx;
import org.jeecg.modules.kc.config.entity.KcExportConfigTpkwcqkjzglxXytktj;
import org.jeecg.modules.kc.config.export.Export;
import org.jeecg.modules.kc.config.service.IKcExportConfigTpkwcqkjzglxService;
import org.jeecg.modules.kc.grab.SynchronizationService.tools.ChangeTingKeTongJi;
@ -106,7 +107,7 @@ public class KcExportConfigTpkwcqkjzglxController extends JeecgController<KcExpo
}
queryWrapper.eq("dwmc ",xxhbUser.getDwmc());
}
queryWrapper.eq("zt","在职");
// queryWrapper.eq("zt","在职");
queryWrapper.apply("dwmc in (select kkdw from kc_kkdw21_view)");
Page<KcExportConfigTpkwcqkjzglx> page = new Page<>(pageNo, pageSize);
IPage<KcExportConfigTpkwcqkjzglx> pageList = kcExportConfigTpkwcqkjzglxService.page(page, queryWrapper);
@ -181,6 +182,81 @@ public class KcExportConfigTpkwcqkjzglxController extends JeecgController<KcExpo
return Result.OK(pageList);
}
@ApiOperation(value="kc_export_config_tpkwcqkjzglx-分页列表查询", notes="kc_export_config_tpkwcqkjzglx-分页列表查询")
@GetMapping(value = "/list2")
public Result<IPage<KcExportConfigTpkwcqkjzglx>> queryPageList2(KcExportConfigTpkwcqkjzglx kcExportConfigTpkwcqkjzglx,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<KcExportConfigTpkwcqkjzglx> queryWrapper = QueryGenerator.initQueryWrapper(kcExportConfigTpkwcqkjzglx, req.getParameterMap());
if(kcExportConfigTpkwcqkjzglx.isFindByDwmc()){
QueryWrapper<Xxhbuser> uqw = new QueryWrapper<>();
uqw.eq("gh",kcExportConfigTpkwcqkjzglx.getFindGh());
uqw.last("limit 1");
Xxhbuser xxhbUser = xxhbuserService.getOne(uqw);
if(xxhbUser == null) {
return Result.OK(new Page<>());
}
queryWrapper.eq("dwmc ",xxhbUser.getDwmc());
}
// queryWrapper.eq("zt","在职");
queryWrapper.apply("(zt = '在职' or (zt= '退休' and ytkcs-0 >0))");
queryWrapper.apply("dwmc in (select kkdw from kc_kkdw21_view)");
Page<KcExportConfigTpkwcqkjzglx> page = new Page<>(pageNo, pageSize);
IPage<KcExportConfigTpkwcqkjzglx> pageList = kcExportConfigTpkwcqkjzglxService.page(page, queryWrapper);
Set<String> xqxnSet = pageList.getRecords().stream().filter(x -> StringUtils.isNotBlank(x.getXqxn())).map(KcExportConfigTpkwcqkjzglx::getXqxn).collect(Collectors.toSet());
//根据当前学期学年硬合并出来一个数据
QueryWrapper<KcTkcstj> tjQw = new QueryWrapper<>();
if(xqxnSet.isEmpty()){
tjQw.eq("xnxq",-1);
}else{
tjQw.in("xnxq",xqxnSet);
}
List<KcTkcstj> tjList = kcTkcstjService.list(tjQw);
Map<String,KcTkcstj> tjMap = Maps.newHashMap();
tjList.forEach(x -> {
tjMap.put(x.getXnxq() + "-" + x.getJgh(),x);
});
QueryWrapper<KcEvaluation> evaluationQw = new QueryWrapper<>();
evaluationQw.isNotNull("e.minkcid");
if(xqxnSet.isEmpty()){
evaluationQw.eq("kt.xnxq",-1);
}else{
evaluationQw.in("kt.xnxq",xqxnSet);
}
evaluationQw.groupBy("concat(xnxq,'-',upuserid)");
evaluationQw.orderByDesc("kt.skrq");
List<KcEvaluation> tjEvaList = evaluationService.findTj(evaluationQw);
Map<String,KcEvaluation> tjEvaMap = Maps.newHashMap();
tjEvaList.forEach(x -> {
tjEvaMap.put(x.getXnxq() + "-" + x.getUpuserid(),x);
});
pageList.getRecords().forEach(x -> {
x.setTkxttj("0");
x.setYskcs("0");
if(tjMap.containsKey(x.getXqxn() + "-" + x.getGh())){
KcTkcstj tkcstj = tjMap.get(x.getXqxn() + "-" + x.getGh());
x.setYskcs(StringUtils.defaultString(tkcstj.getYskcs(),"0"));
}
if(tjEvaMap.containsKey(x.getXqxn() + "-" + x.getGh())){
KcEvaluation tkcstj = tjEvaMap.get(x.getXqxn() + "-" + x.getGh());
x.setTkxttj(StringUtils.defaultString(String.valueOf(tkcstj.getPkNum()),"0"));
}
});
return Result.OK(pageList);
}
@ -325,7 +401,8 @@ public class KcExportConfigTpkwcqkjzglxController extends JeecgController<KcExpo
List<String> selectionList = Arrays.asList(selections.split(","));
queryWrapper.in("id",selectionList);
}
queryWrapper.eq("zt","在职");
// queryWrapper.eq("zt","在职");
queryWrapper.apply("(zt = '在职' or (zt= '退休' and ytkcs-0 >0))");
queryWrapper.apply("dwmc in (select kkdw from kc_kkdw21_view)");
// Step.2 获取导出数据
List<KcExportConfigTpkwcqkjzglx> exportList = service.list(queryWrapper);
@ -497,4 +574,30 @@ public class KcExportConfigTpkwcqkjzglxController extends JeecgController<KcExpo
return Result.OK(pageList);
}
@RequestMapping(value = "/exportXls2")
public ModelAndView exportXls2(HttpServletRequest request, KcExportConfigTpkwcqkjzglxXytktj kcExportConfigTpkwcqkjzglx) {
return exportXls2(request, kcExportConfigTpkwcqkjzglx, KcExportConfigTpkwcqkjzglxXytktj.class, "人员信息");
}
public ModelAndView exportXls2(HttpServletRequest request, KcExportConfigTpkwcqkjzglxXytktj object, Class<KcExportConfigTpkwcqkjzglxXytktj> clazz, String title) {
// Step.1 组装查询条件
QueryWrapper<KcExportConfigTpkwcqkjzglxXytktj> queryWrapper = QueryGenerator.initQueryWrapper(object, request.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<KcExportConfigTpkwcqkjzglxXytktj> exportList = service.getListByCodeXytktj(queryWrapper,object);
// Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
//此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(NormalExcelConstants.FILE_NAME, title);
mv.addObject(NormalExcelConstants.CLASS, clazz);
//update-begin--Author:liusq Date:20210126 for图片导出报错ImageBasePath未设置--------------------
ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
exportParams.setImageBasePath(upLoadPath);
//update-end--Author:liusq Date:20210126 for图片导出报错ImageBasePath未设置----------------------
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}
}

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.kc.config.entity.KcExportConfigTpkwcqkjzglx;
import org.jeecg.modules.kc.config.entity.KcExportConfigTpkwcqkjzglxXytktj;
import java.util.List;
@ -37,4 +38,6 @@ public interface KcExportConfigTpkwcqkjzglxMapper extends BaseMapper<KcExportCon
IPage<KcExportConfigTpkwcqkjzglx> getListQtzrjs(Page<KcExportConfigTpkwcqkjzglx> page, KcExportConfigTpkwcqkjzglx kcExportConfigTpkwcqkjzglx);
List<KcExportConfigTpkwcqkjzglx> getListQtzrjsChar(KcExportConfigTpkwcqkjzglx kcExportConfigTpkwcqkjzglx1);
List<KcExportConfigTpkwcqkjzglxXytktj> getListByCodeXytktj(KcExportConfigTpkwcqkjzglxXytktj kcExportConfigTpkwcqkjzglxXytktj);
}

View File

@ -127,4 +127,27 @@
GROUP BY a.gh,a.xm
</select>
<select id="getListByCodeXytktj" resultType="org.jeecg.modules.kc.config.entity.KcExportConfigTpkwcqkjzglxXytktj">
select * from (
select a.tklx,a.gh,a.xm,a.dwmc,a.ytkcs,a.rjzy,count(c.upuserid) as sjtkcs from kc_export_config_tpkwcqkjzglx a
LEFT JOIN kc_xqxn_history b on a.xqxn = b.title
LEFT JOIN kc_evaluation c on a.gh = c.upuserid and c.up_date BETWEEN b.start_time and b.end_time
where xqxn = #{xqxn} and zt = '在职' and tklx in (${code})
<if test="dwmc != null and dwmc != ''">
and dwmc = #{dwmc}
</if>
GROUP BY a.tklx,a.gh,a.xm,a.dwmc,a.ytkcs,a.rjzy
) a
<where>
<if test='type != null and type == "1"'>
and ytkcs -0 &lt;= sjtkcs - 0
</if>
<if test='type != null and type == "2"'>
and ytkcs -0 > sjtkcs - 0
</if>
</where>
</select>
</mapper>

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.kc.config.entity.KcExportConfigTpkwcqkjzglx;
import org.jeecg.modules.kc.config.entity.KcExportConfigTpkwcqkjzglxXytktj;
import java.util.List;
import java.util.Map;
@ -36,4 +37,6 @@ public interface IKcExportConfigTpkwcqkjzglxService extends IService<KcExportCon
IPage<KcExportConfigTpkwcqkjzglx> getListQtzrjs(Page<KcExportConfigTpkwcqkjzglx> page, KcExportConfigTpkwcqkjzglx kcExportConfigTpkwcqkjzglx);
List<KcExportConfigTpkwcqkjzglx> getListQtzrjsChar(KcExportConfigTpkwcqkjzglx kcExportConfigTpkwcqkjzglx);
List<KcExportConfigTpkwcqkjzglxXytktj> getListByCodeXytktj(QueryWrapper<KcExportConfigTpkwcqkjzglxXytktj> queryWrapper,KcExportConfigTpkwcqkjzglxXytktj KcExportConfigTpkwcqkjzglxXytktj);
}

View File

@ -9,6 +9,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.kc.config.entity.KcExportConfigTpkwcqkjzglx;
import org.jeecg.modules.kc.config.entity.KcExportConfigTpkwcqkjzglxXytktj;
import org.jeecg.modules.kc.config.mapper.KcExportConfigTpkwcqkjzglxMapper;
import org.jeecg.modules.kc.config.service.IKcExportConfigTpkwcqkjzglxService;
import org.jeecg.modules.kc.grab.SynchronizationService.tools.ChangeTingKeTongJi;
@ -340,4 +341,30 @@ public class KcExportConfigTpkwcqkjzglxServiceImpl extends ServiceImpl<KcExportC
List<KcExportConfigTpkwcqkjzglx> infolist = baseMapper.getListQtzrjsChar(kcExportConfigTpkwcqkjzglx);
return infolist;
}
@Override
public List<KcExportConfigTpkwcqkjzglxXytktj> getListByCodeXytktj(QueryWrapper<KcExportConfigTpkwcqkjzglxXytktj> queryWrapper,KcExportConfigTpkwcqkjzglxXytktj kcExportConfigTpkwcqkjzglxXytktj) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//-------------获取当前登陆人是否是管理员角色如果不是都按照教务秘书处理---------------------------
List<String> roleList = sysBaseApi.getRolesByUsername(sysUser.getUsername());
String adminRole = "1";//0 admin 1教务秘书
for(String role :roleList){
if(StringUtils.equals("admin",role)){
adminRole = "0";
break;
}
}
if(StringUtils.equals("1",adminRole)){
QueryWrapper<Xxhbuser> uqw = new QueryWrapper<>();
uqw.eq("gh",sysUser.getUsername());
uqw.last("limit 1");
Xxhbuser xxhbUser = xxhbuserService.getOne(uqw);
kcExportConfigTpkwcqkjzglxXytktj.setDwmc(xxhbUser.getDwmc());
}
KcSysConfig kcSysConfig = kcSysConfigService.getById("1");
kcExportConfigTpkwcqkjzglxXytktj.setXqxn(kcSysConfig.getFlag1());
List<KcExportConfigTpkwcqkjzglxXytktj> infolist = baseMapper.getListByCodeXytktj(kcExportConfigTpkwcqkjzglxXytktj);
return infolist;
}
}

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xkcoding.http.HttpUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.kc.KcBdgxbcopy.entity.KcBdgxbcopy;
import org.jeecg.modules.kc.KcBdgxbcopy.service.IKcBdgxbcopyService;
@ -49,6 +50,16 @@ public class SyncWechartTsxx extends BaseSync {
* @param param
*/
public void run(Map<String, Object> param){
String urlToken = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+ appId +"&secret=" + 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);
if(StringUtils.isNotBlank(accessToken)){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar nowTime = Calendar.getInstance();
nowTime.add(Calendar.MINUTE, 30);//30分钟后的时间
@ -66,11 +77,6 @@ public class SyncWechartTsxx extends BaseSync {
Map<String, WeChatTemplateMsg> sendMag = new HashMap<String, WeChatTemplateMsg>();
// openId代表一个唯一微信用户即微信消息的接收人
String openId = KcMessagelistcopy.getTouser();
// 微信的基础accessToken
String urlToken = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+ appId +"&secret=" + appIdSecret;
String res = HttpUtil.get(urlToken);
JSONObject jsonTokenObject = JSONObject.parseObject(res);
String accessToken = jsonTokenObject.getString("access_token");
String url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken;
/**
@ -108,9 +114,14 @@ public class SyncWechartTsxx extends BaseSync {
// 2431260672639467520
String msgId = jsonObject.getString("msgid");
System.out.println("messageCode : " + messageCode + ", msgId: " +msgId);
if(StringUtils.isNotBlank(msgId)){
KcMessagelistcopy.setStatus("1");
kcMessagelistcopyService.updateById(KcMessagelistcopy);
}
}
}
}

View File

@ -9,8 +9,12 @@ import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.kc.kcKechengtixingdingyue.entity.KcKechengtixingdingyue;
import org.jeecg.modules.kc.kcKechengtixingdingyue.service.IKcKechengtixingdingyueService;
@ -27,6 +31,7 @@ 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.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -51,6 +56,8 @@ public class KcKechengtixingdingyueController extends JeecgController<KcKechengt
@Autowired
private IKcKechengtixingdingyueService kcKechengtixingdingyueService;
@Value("${jeecg.path.upload}")
private String upLoadPath;
/**
* 分页列表查询
*
@ -157,10 +164,51 @@ public class KcKechengtixingdingyueController extends JeecgController<KcKechengt
* @param request
* @param kcKechengtixingdingyue
*/
@RequiresPermissions("kcKechengtixingdingyue:kc_kechengtixingdingyue:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, KcKechengtixingdingyue kcKechengtixingdingyue) {
return super.exportXls(request, kcKechengtixingdingyue, KcKechengtixingdingyue.class, "课程提醒订阅");
return exportXls(request, kcKechengtixingdingyue, KcKechengtixingdingyue.class, "课程提醒订阅");
}
protected ModelAndView exportXls(HttpServletRequest request, KcKechengtixingdingyue object, Class<KcKechengtixingdingyue> clazz, String title) {
// Step.1 组装查询条件
QueryWrapper<KcKechengtixingdingyue> queryWrapper = QueryGenerator.initQueryWrapper(object, 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 获取导出数据
queryWrapper.apply("username is not null");
List<KcKechengtixingdingyue> exportList = service.list(queryWrapper);
for(KcKechengtixingdingyue kcKechengtixingdingyuePar:exportList){
if(StringUtils.equals("0",kcKechengtixingdingyuePar.getKqtx())){
kcKechengtixingdingyuePar.setKqtx("");
}else{
kcKechengtixingdingyuePar.setKqtx("");
}
if(StringUtils.equals("0",kcKechengtixingdingyuePar.getMrkctx())){
kcKechengtixingdingyuePar.setMrkctx("");
}else{
kcKechengtixingdingyuePar.setMrkctx("");
}
}
// Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
//此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(NormalExcelConstants.FILE_NAME, title);
mv.addObject(NormalExcelConstants.CLASS, clazz);
//update-begin--Author:liusq Date:20210126 for图片导出报错ImageBasePath未设置--------------------
ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
exportParams.setImageBasePath(upLoadPath);
//update-end--Author:liusq Date:20210126 for图片导出报错ImageBasePath未设置----------------------
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}
/**

View File

@ -4,10 +4,8 @@ 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 com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@ -32,14 +30,22 @@ import lombok.experimental.Accessors;
public class KcKechengtixingdingyue implements Serializable {
private static final long serialVersionUID = 1L;
@Excel(name = "所在学院", width = 15)
@TableField(exist = false)
private java.lang.String dwmc;
@Excel(name = "任教专业", width = 15)
@TableField(exist = false)
private java.lang.String rjzy;
/**账号*/
@TableId
@Excel(name = "账号", width = 15)
@ApiModelProperty(value = "账号")
@Excel(name = "", width = 15)
@ApiModelProperty(value = "")
private java.lang.String userid;
/**用户名*/
@Excel(name = "用户名", width = 15)
@ApiModelProperty(value = "用户名")
@Excel(name = "教师姓", width = 15)
@ApiModelProperty(value = "教师姓")
private java.lang.String username;
/**课前提醒*/
@Excel(name = "课前提醒", width = 15)
@ -51,4 +57,5 @@ public class KcKechengtixingdingyue implements Serializable {
@ApiModelProperty(value = "每日课程提醒")
@Dict(dicCode = "sfcj")
private java.lang.String mrkctx;
}

View File

@ -2,4 +2,14 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.kc.kcKechengtixingdingyue.mapper.KcKechengtixingdingyueMapper">
<select id="selectPage" resultType="org.jeecg.modules.kc.kcKechengtixingdingyue.entity.KcKechengtixingdingyue">
select distinct a.*,b.dwmc,b.rjzy from kc_kechengtixingdingyue a
left join kc_export_config_tpkwcqkjzglx b on a.userid = b.gh
${ew.customSqlSegment}
</select>
<select id="selectList" resultType="org.jeecg.modules.kc.kcKechengtixingdingyue.entity.KcKechengtixingdingyue">
select distinct a.*,b.dwmc,b.rjzy from kc_kechengtixingdingyue a
left join kc_export_config_tpkwcqkjzglx b on a.userid = b.gh
${ew.customSqlSegment}
</select>
</mapper>

View File

@ -97,6 +97,7 @@ public class KcZzThpjbController extends JeecgController<KcZzThpjb, IKcZzThpjbSe
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<KcZzThpjb> queryWrapper = QueryGenerator.initQueryWrapper(kcZzThpjb, req.getParameterMap());
queryWrapper.eq(StringUtils.isNotBlank(kcZzThpjb.getXqxn()),"b.title",kcZzThpjb.getXqxn());
Page<KcZzThpjb> page = new Page<KcZzThpjb>(pageNo, pageSize);
IPage<KcZzThpjb> pageList = kcZzThpjbService.page(page, queryWrapper);
return Result.OK(pageList);

View File

@ -93,6 +93,7 @@ public class KcZzXstkbController extends JeecgController<KcZzXstkb, IKcZzXstkbSe
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<KcZzXstkb> queryWrapper = QueryGenerator.initQueryWrapper(kcZzXstkb, req.getParameterMap());
queryWrapper.eq(StringUtils.isNotBlank(kcZzXstkb.getXqxn()),"b.title",kcZzXstkb.getXqxn());
Page<KcZzXstkb> page = new Page<KcZzXstkb>(pageNo, pageSize);
IPage<KcZzXstkb> pageList = kcZzXstkbService.page(page, queryWrapper);
return Result.OK(pageList);

View File

@ -98,6 +98,7 @@ public class KcZzYbtkbController extends JeecgController<KcZzYbtkb, IKcZzYbtkbSe
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<KcZzYbtkb> queryWrapper = QueryGenerator.initQueryWrapper("a",kcZzYbtkb, req.getParameterMap());
queryWrapper.eq(StringUtils.isNotBlank(kcZzYbtkb.getXqxn()),"b.title",kcZzYbtkb.getXqxn());
Page<KcZzYbtkb> page = new Page<KcZzYbtkb>(pageNo, pageSize);
IPage<KcZzYbtkb> pageList = kcZzYbtkbService.page(page, queryWrapper);
return Result.OK(pageList);

View File

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.kc.KcBdgxbcopy.entity.KcBdgxbcopy;
import org.jeecg.modules.kc.qa.entity.KcEvaluation;
import org.jeecg.modules.kc.qa.entity.KcEvaluationPkmx;
import org.jeecg.modules.kc.statistics.KcEvaluationVo;
@ -41,4 +42,6 @@ public interface KcEvaluationMapper extends BaseMapper<KcEvaluation> {
List<KcEvaluation> queryPkZuJiPage(Page<KcEvaluation> page, @Param(Constants.WRAPPER) QueryWrapper<KcEvaluation> queryWrapper);
List<KcEvaluation> findTj(@Param(Constants.WRAPPER) QueryWrapper<KcEvaluation> queryWrapper);
KcBdgxbcopy getOpenId(String skjs);
}

View File

@ -501,4 +501,7 @@
${ew.customSqlSegment}
</select>
<select id="getOpenId" resultType="org.jeecg.modules.kc.qa.entity.KcEvaluation">
SELECT * from choice.bdgxbcopy where
</select>
</mapper>

View File

@ -2,14 +2,20 @@ package org.jeecg.modules.kc.qa.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xkcoding.http.HttpUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.kc.KcBdgxbcopy.entity.KcBdgxbcopy;
import org.jeecg.modules.kc.grab.SynchronizationService.tools.ChangeTingKeTongJi;
import org.jeecg.modules.kc.ktgl.entity.KcKetangbiao;
import org.jeecg.modules.kc.ktgl.service.IKcKetangbiaoService;
import org.jeecg.modules.kc.qa.entity.KcEvaluation;
import org.jeecg.modules.kc.qa.entity.KcEvaluationPkmx;
import org.jeecg.modules.kc.qa.mapper.KcEvaluationMapper;
@ -17,16 +23,23 @@ import org.jeecg.modules.kc.qa.service.IKcEvaluationService;
import org.jeecg.modules.kc.qa.service.IKcEvaluationsService;
import org.jeecg.modules.kc.statistics.KcEvaluationVo;
import org.jeecg.modules.kc.statistics.KcEvaluationVo2;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysUserService;
import org.jeecg.modules.wxgzh.WeChatTemplateMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description: 调查问卷-回答主表
@ -43,6 +56,10 @@ public class KcEvaluationServiceImpl extends ServiceImpl<KcEvaluationMapper, KcE
@Lazy//防止循环
@Autowired
private ChangeTingKeTongJi changeTingKeTongJi;
@Autowired
private IKcKetangbiaoService kcKetangbiaoService;
@Autowired
private ISysUserService sysUserService;
public IPage<KcEvaluation> getPktjbList(Page<KcEvaluation> page, KcEvaluation kcEvaluation) {
return baseMapper.getPktjbList(page,kcEvaluation);
@ -96,6 +113,11 @@ public class KcEvaluationServiceImpl extends ServiceImpl<KcEvaluationMapper, KcE
}
//添加评课数据和统计数据
changeTingKeTongJi.updateTingKeTongJiAndPingKeByUserId(String.valueOf(kcEvaluation.getUpuserid()),kcEvaluation.getMinkcid());
// String ketangbiaoid = kcEvaluation.getKetangbiaoid();//课堂表id
// KcKetangbiao kcKetangbiao = kcKetangbiaoService.getById(ketangbiaoid);
// sendWxmessage(kcKetangbiao);
}
@Override
@ -133,5 +155,86 @@ public class KcEvaluationServiceImpl extends ServiceImpl<KcEvaluationMapper, KcE
return baseMapper.findTj(queryWrapper);
}
// appId
private static final String appId = "wx59920eb69d611d7f";//东师
// appIdSecret
private static final String appIdSecret = "bf0c19af0e956f447ede4dd902ea63b7";//东师
// 公众号的模板id(也有相应的接口可以查询到)
private static final String templateId = "KtWw0lwQ8FOgJdKgrmya0eoafGkMfMN8ECdZs8oSJys";//东师
//微信通知点击后跳转的页面
private static final String domainTo = "https://zxkccx.webvpn.nenu.edu.cn";
/**
* 发送微信通知
* @param kcKetangbiao
*/
public void sendWxmessage(KcKetangbiao kcKetangbiao) {
String skjs = kcKetangbiao.getSkjs();
QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("realname",skjs);
List<SysUser> sysUserList = sysUserService.list(queryWrapper);
String openId = "";
for(SysUser SysUserPar : sysUserList){
KcBdgxbcopy kcBdgxbcopy=baseMapper.getOpenId(SysUserPar.getUsername());
if(kcBdgxbcopy !=null){
openId = kcBdgxbcopy.getOpenid();
break;
}
}
if(StringUtils.isNotEmpty(openId)){
String urlToken = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+ appId +"&secret=" + 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);
// 模板参数
Map<String, WeChatTemplateMsg> sendMag = new HashMap<String, WeChatTemplateMsg>();
// openId = "oak6lwKGlGQQwt83nuynZnP4HUR4";//曹老师账号
// 微信的基础accessToken
String url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken;
/**
* 其他模板可以从模板库中自己添加
* 模板ID
* KtWw0lwQ8FOgJdKgrmya0eoafGkMfMN8ECdZs8oSJys
* 开发者调用模板消息接口时需提供模板ID
* 标题 上课提醒
* 行业 教育 - 院校
* 详细内容
* {{first.DATA}}
* 课程{{keyword1.DATA}}
* 时间{{keyword2.DATA}}
* 地点{{keyword3.DATA}}
* {{remark.DATA}}
*/
sendMag.put("first", new WeChatTemplateMsg("有课程即将开始"));
sendMag.put("keyword1", new WeChatTemplateMsg("线性代数"));
sendMag.put("keyword2", new WeChatTemplateMsg("[1,2节] 08:30-10:00"));
sendMag.put("keyword3", new WeChatTemplateMsg("上课地点N304"));
sendMag.put("remark", new WeChatTemplateMsg("请开发者为用户提供定制提醒的选项,以免打扰。"));
RestTemplate restTemplate = new RestTemplate();
//拼接base参数
Map<String, Object> sendBody = new HashMap<>();
sendBody.put("touser", openId); // openId
sendBody.put("url", domainTo); // 点击模板信息跳转地址
sendBody.put("topcolor", "#FF0000"); // 顶色
sendBody.put("data", sendMag); // 模板参数
sendBody.put("template_id", templateId); // 模板Id
ResponseEntity<String> forEntity = restTemplate.postForEntity(url, sendBody, String.class);
JSONObject jsonObject2 = JSONObject.parseObject(forEntity.getBody());
String messageCode = jsonObject2.getString("errcode");
String msgId = jsonObject2.getString("msgid");
System.out.println("messageCode : " + messageCode + ", msgId: " +msgId);
}
}
}