修改bug

This commit is contained in:
yangjun 2023-12-14 08:23:46 +08:00
parent e970f30e8c
commit 613e7c6061
9 changed files with 132 additions and 13 deletions

View File

@ -380,6 +380,10 @@ public class KcExportConfigTpkwcqkjzglxController extends JeecgController<KcExpo
return exportXls(request, kcExportConfigTpkwcqkjzglx, KcExportConfigTpkwcqkjzglx.class, "人员信息");
}
@RequestMapping(value = "/exportXls3")
public ModelAndView exportXls2(HttpServletRequest request, KcExportConfigTpkwcqkjzglx kcExportConfigTpkwcqkjzglx) {
return exportXls3(request, kcExportConfigTpkwcqkjzglx, KcExportConfigTpkwcqkjzglx.class, "人员信息");
}
public ModelAndView exportXls(HttpServletRequest request, KcExportConfigTpkwcqkjzglx object, Class<KcExportConfigTpkwcqkjzglx> clazz, String title) {
// Step.1 组装查询条件
QueryWrapper<KcExportConfigTpkwcqkjzglx> queryWrapper = QueryGenerator.initQueryWrapper(object, request.getParameterMap());
@ -445,6 +449,71 @@ public class KcExportConfigTpkwcqkjzglxController extends JeecgController<KcExpo
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}
public ModelAndView exportXls3(HttpServletRequest request, KcExportConfigTpkwcqkjzglx object, Class<KcExportConfigTpkwcqkjzglx> clazz, String title) {
// Step.1 组装查询条件
QueryWrapper<KcExportConfigTpkwcqkjzglx> queryWrapper = QueryGenerator.initQueryWrapper(object, request.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(object.isFindByDwmc()){
QueryWrapper<Xxhbuser> uqw = new QueryWrapper<>();
//LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
uqw.eq("gh",object.getFindGh());
uqw.last("limit 1");
Xxhbuser xxhbUser = xxhbuserService.getOne(uqw);
if(xxhbUser == null) {
queryWrapper.eq("dwmc ",-1);
}
queryWrapper.eq("dwmc ",xxhbUser.getDwmc());
}
// 过滤选中数据
String selections = request.getParameter("selections");
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
queryWrapper.in("id",selectionList);
}
// 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);
Set<String> xqxnSet = exportList.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);
});
//根据当前学期学年硬合并出来一个数据
exportList.forEach(x -> {
x.setTkxttj("0");
x.setYskcs("0");
if(tjMap.containsKey(x.getXqxn() + "-" + x.getGh())){
KcTkcstj tkcstj = tjMap.get(x.getXqxn() + "-" + x.getGh());
x.setTkxttj(StringUtils.defaultString(tkcstj.getTkxttj(),"0"));
x.setYskcs(StringUtils.defaultString(tkcstj.getYskcs(),"0"));
//x.setXqxn(kcXqxnHistory.getTitle());
}
});
// 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;
}
/**
* 通过excel导入数据

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.kc.grab.SynchronizationService;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.jeecg.modules.kc.grab.SynchronizationService.base.BaseSync;
@ -58,6 +59,22 @@ public class SyncTJwJxljbxxb extends BaseSync {
e.printStackTrace();
errorMessage = e.getMessage();
}
Xxhbjxljbxx xxhbjxljbxxUp = new Xxhbjxljbxx();
xxhbjxljbxxUp.setSort("4");
impService.updateSort(xxhbjxljbxxUp);
xxhbjxljbxxUp = new Xxhbjxljbxx();
xxhbjxljbxxUp.setSort("1");
xxhbjxljbxxUp.setJzwh("0106");
impService.updateSort(xxhbjxljbxxUp);
xxhbjxljbxxUp = new Xxhbjxljbxx();
xxhbjxljbxxUp.setSort("2");
xxhbjxljbxxUp.setJzwh("0108");
impService.updateSort(xxhbjxljbxxUp);
xxhbjxljbxxUp = new Xxhbjxljbxx();
xxhbjxljbxxUp.setSort("3");
xxhbjxljbxxUp.setJzwh("0295");
impService.updateSort(xxhbjxljbxxUp);
Xxhbjxljbxx Xxhbjxljbxx = impService.getSumnum();
int mysqlnum=Xxhbjxljbxx.getMysqlnum();
Xxhbsynclog xxhbsynclog = new Xxhbsynclog();

View File

@ -77,6 +77,8 @@ public class Xxhbjxljbxx implements Serializable {
@ApiModelProperty(value = "时间戳")
private java.util.Date timestamps;
private String sort;
@TableField(exist = false)
private Integer mysqlnum;
}

View File

@ -15,4 +15,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface XxhbjxljbxxMapper extends BaseMapper<Xxhbjxljbxx> {
Xxhbjxljbxx getSumnum();
void updateSort(Xxhbjxljbxx xxhbjxljbxxUp);
}

View File

@ -5,4 +5,13 @@
<select id="getSumnum" resultType="org.jeecg.modules.kc.grab.imports.entity.Xxhbjxljbxx">
select count(*) as mysqlnum from xxhbjxljbxx
</select>
<update id="updateSort">
update xxhbjxljbxx set sort =#{sort}
<where>
<if test="jzwh!=null and jzwh !=''">
and jzwh = #{jzwh}
</if>
</where>
</update>
</mapper>

View File

@ -20,4 +20,6 @@ public interface IXxhbjxljbxxService extends IService<Xxhbjxljbxx> {
boolean syncList(Collection<Xxhbjxljbxx> entityList, boolean isDelete);
Xxhbjxljbxx getSumnum();
void updateSort(Xxhbjxljbxx xxhbjxljbxxUp);
}

View File

@ -38,4 +38,9 @@ public class XxhbjxljbxxServiceImpl extends ServiceImpl<XxhbjxljbxxMapper, Xxhbj
public Xxhbjxljbxx getSumnum() {
return baseMapper.getSumnum();
}
@Override
public void updateSort(Xxhbjxljbxx xxhbjxljbxxUp) {
baseMapper.updateSort(xxhbjxljbxxUp);
}
}

View File

@ -124,20 +124,26 @@ public class KcWechatSendLogController extends JeecgController<KcWechatSendLog,
// 微信的基础accessToken
String url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken;
// String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/bizsend?access_token=" + accessToken;
// 1xx老师你好您本学期2023秋听课要求为5次当前实际听课次数3次请尽快完成本学期的听课任务
// 如需听评课请点击课程信息中心链接
sendMag.put("thing18", new WeChatTemplateMsg(kcWechatSendLog.getTeacherName()));//授课老师
sendMag.put("const14", new WeChatTemplateMsg(kcWechatSendLog.getXqxn()));//上课时间
sendMag.put("number4", new WeChatTemplateMsg(kcWechatSendLog.getYtkcs()));//应听课次数
sendMag.put("number9", new WeChatTemplateMsg(kcWechatSendLog.getSjtkcs()));//实际听课次数
sendMag.put("first", new WeChatTemplateMsg(kcWechatSendLog.getTeacherName()));//授课老师
sendMag.put("keyword1", new WeChatTemplateMsg(kcWechatSendLog.getXqxn()));//授课老师
sendMag.put("keyword2", new WeChatTemplateMsg("请尽快完成"));//授课老师
String message = "应听课次数:"+kcWechatSendLog.getYtkcs()+";实际听课次数:"+kcWechatSendLog.getSjtkcs();
sendMag.put("remark", new WeChatTemplateMsg(message));//授课老师
// sendMag.put("thing9", new WeChatTemplateMsg(message));//上课时间
// sendMag.put("number4", new WeChatTemplateMsg(kcWechatSendLog.getYtkcs()));//应听课次数
// sendMag.put("number9", new WeChatTemplateMsg(kcWechatSendLog.getSjtkcs()));//实际听课次数
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("topcolor", "#FF0000"); // 顶色
sendBody.put("data", sendMag); // 模板参数
sendBody.put("template_id", "ijrjginJ4RJGBMO0i1g0Ml-kO2bfDNXCchw1j_viJGE"); // 模板Id
sendBody.put("template_id", "PDS1hf6s8P5Ce-SFa9J95XvHhMIGlyhITAGq_CIoNMM"); // 模板Id
ResponseEntity<String> forEntity = restTemplate.postForEntity(url, sendBody, String.class);
JSONObject jsonObject2 = JSONObject.parseObject(forEntity.getBody());
System.out.println("jsonObject2 : " + jsonObject2);

View File

@ -186,8 +186,8 @@ public class KcEvaluationServiceImpl extends ServiceImpl<KcEvaluationMapper, KcE
openId = kcBdgxbcopy.getOpenid();
}
}catch (Exception e){e.printStackTrace();}
System.out.println("openId:"+openId+"");
// openId = "oak6lwKGlGQQwt83nuynZnP4HUR4";//曹老师账号
System.out.println("openId:"+openId+"");
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);
@ -205,18 +205,25 @@ public class KcEvaluationServiceImpl extends ServiceImpl<KcEvaluationMapper, KcE
// xx老师你好您于2023.12.01在逸夫楼101室任教的马克思列宁主义课程收到一条听课评价评价分数为5分满分5分
// 如需查看请点击课程信息中心链接
System.out.println("getSkjs : " + kcKetangbiao.getSkjs() + ", getSkrq: " +kcKetangbiao.getSkrq()+ ", getKcmc: " +kcKetangbiao.getKcmc());
sendMag.put("thing10", new WeChatTemplateMsg(kcKetangbiao.getSkjs()));//授课老师
sendMag.put("time4", new WeChatTemplateMsg(kcKetangbiao.getSkrq()));//上课时间
sendMag.put("thing3", new WeChatTemplateMsg(kcKetangbiao.getKcmc()));//课程名称
sendMag.put("thing7", new WeChatTemplateMsg("评价分数为5分满分5分"));//课后作业
sendMag.put("first", new WeChatTemplateMsg(kcKetangbiao.getSkjs()+"老师您好"));//授课老师
sendMag.put("keyword1", new WeChatTemplateMsg(kcKetangbiao.getSkrq()));//授课老师
sendMag.put("keyword2", new WeChatTemplateMsg("听课记录"));//授课老师
String message = "收到一条听课评价,评价分数为*分满分5分";
sendMag.put("remark", new WeChatTemplateMsg(message));//授课老师
// sendMag.put("thing7", new WeChatTemplateMsg(kcKetangbiao.getSkjs()));//授课老师
// sendMag.put("date5", new WeChatTemplateMsg(kcKetangbiao.getSkrq()));//上课时间
// sendMag.put("thing6", new WeChatTemplateMsg(kcKetangbiao.getKcmc()));//课程名称
// sendMag.put("thing4", new WeChatTemplateMsg("评价分数为5分满分5分"));//课后作业
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("topcolor", "#FF0000"); // 顶色
sendBody.put("data", sendMag); // 模板参数
sendBody.put("template_id", "-XCApC7nfBDmwEqP8b1WC1BfF3mXjtSTRPwUTJRtz2I"); // 模板Id
sendBody.put("template_id", "PDS1hf6s8P5Ce-SFa9J95XvHhMIGlyhITAGq_CIoNMM"); // 模板Id
ResponseEntity<String> forEntity = restTemplate.postForEntity(url, sendBody, String.class);
JSONObject jsonObject2 = JSONObject.parseObject(forEntity.getBody());
System.out.println("jsonObject2 : " + jsonObject2);