diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/SyncTJwTkkcb.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/SyncTJwTkkcb.java index 19d8f696..9e51a1c0 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/SyncTJwTkkcb.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/SyncTJwTkkcb.java @@ -1,6 +1,8 @@ package org.jeecg.modules.kc.grab.SynchronizationService; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.compress.utils.Lists; import org.jeecg.modules.kc.grab.SynchronizationService.base.BaseSync; @@ -46,7 +48,11 @@ public class SyncTJwTkkcb extends BaseSync { List outDataList = Lists.newArrayList(); //清洗数据 - inDataList.forEach(x -> outDataList.add(BeanUtil.toBean(x, Xxhbtkkcb.class))); + inDataList.forEach(x -> { + Xxhbtkkcb outData = BeanUtil.toBean(x, Xxhbtkkcb.class); + outData.setTimestamps(DateUtil.format(x.getTimestamps(), DatePattern.NORM_DATETIME_PATTERN)); + outDataList.add(BeanUtil.toBean(x, Xxhbtkkcb.class)); + }); //保存到胃 int syncnum=0; diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/controller/KcKetangbiaoController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/controller/KcKetangbiaoController.java index 58be2b61..4cd30abb 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/controller/KcKetangbiaoController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/controller/KcKetangbiaoController.java @@ -1,10 +1,10 @@ package org.jeecg.modules.kc.ktgl.controller; +import java.math.BigDecimal; +import java.math.BigInteger; import java.util.*; +import java.util.concurrent.atomic.AtomicReference; 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; @@ -19,10 +19,6 @@ import org.apache.commons.lang3.StringUtils; import org.jeecg.common.api.CommonAPI; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; -import org.jeecg.common.system.util.JwtUtil; -import org.jeecg.common.system.vo.LoginUser; -import org.jeecg.common.system.vo.SysUserCacheInfo; -import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.kc.grab.SynchronizationService.tools.ChangeTingKeTongJi; import org.jeecg.modules.kc.kcXqxnHistory.entity.KcXqxnHistory; import org.jeecg.modules.kc.ktgl.entity.KcKetangbiao; @@ -33,25 +29,18 @@ 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.modules.kc.qa.entity.KcEvaluationstudent; +import org.jeecg.modules.kc.qa.service.IKcEvaluationstudentService; import org.jeecg.common.system.base.controller.JeecgController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.ModelAndView; -import com.alibaba.fastjson.JSON; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.jeecg.common.aspect.annotation.AutoLog; -import org.apache.shiro.authz.annotation.RequiresPermissions; - /** +/** * @Description: 课堂管理-子表 * @Author: jeecg-boot * @Date: 2023-04-01 @@ -68,6 +57,9 @@ public class KcKetangbiaoController extends JeecgController idSet = Sets.newHashSet(); IPage pageList = kcKetangbiaoService.fundAllPjjgList(page, queryWrapper); pageList.getRecords().forEach(x -> idSet.add(x.getId())); - //查询平均分 - - //查询教师平均分 + //查询教师平均分,查完了 //查询学生平均分 + QueryWrapper qw = new QueryWrapper<>(); + qw.in("ketangbiaoid",idSet); + List evaluationstudentList = kcEvaluationstudentService.list(qw); + Map> evaluationstudentListMap = evaluationstudentList.stream().collect(Collectors.groupingBy(KcEvaluationstudent::getKetangbiaoid)); + Map evaluationstudentAllDivideMap = Maps.newHashMap(); + + evaluationstudentListMap.forEach((k,v) -> { + String allNumKey = "allNum-" + k; + String numKey = "num-" + k; + evaluationstudentAllDivideMap.put(allNumKey, v.size());//数量 + AtomicReference sum = new AtomicReference<>(0); + v.forEach(x -> sum.updateAndGet(v1 -> v1 + x.getStars())); + evaluationstudentAllDivideMap.put(numKey,sum.get());//总分 +// if(evaluationstudentAllDivideMap.containsKey(allNumKey)){ +// Integer allNum = evaluationstudentAllDivideMap.get(allNumKey); +// allNum += 1; +// evaluationstudentAllDivideMap.put(allNumKey,allNum); +// }else{ +// evaluationstudentAllDivideMap.put(allNumKey,1); +// } +// if(evaluationstudentAllDivideMap.containsKey(numKey)){ +// Integer num = evaluationstudentAllDivideMap.get(numKey); +// num += v. +// } + }); + //再计算平均数扔给主list + + pageList.getRecords().forEach(x -> { + x.setXspjPjf("0"); + + String allNumKey = "allNum-" + x.getId(); + String numKey = "num-" + x.getId(); + Integer allNUm = null; + Integer num = null; + if(evaluationstudentAllDivideMap.containsKey(allNumKey)){ + allNUm = evaluationstudentAllDivideMap.get(allNumKey); + } + if(evaluationstudentAllDivideMap.containsKey(numKey)){ + num = evaluationstudentAllDivideMap.get(numKey); + } + if(allNUm != null && num != null && num != 0){ + x.setXspjPjf(String.valueOf(num / allNUm)); + } + }); return Result.OK(pageList); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/entity/KcKetangbiao.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/entity/KcKetangbiao.java index 211c45d1..94a40c9f 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/entity/KcKetangbiao.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/entity/KcKetangbiao.java @@ -291,4 +291,10 @@ public class KcKetangbiao implements Serializable { @TableField(exist = false) private boolean searchByNowXqxn; + @TableField(exist = false) + private String jspjPjf; + + @TableField(exist = false) + private String xspjPjf; + } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/KcKetangbiaoMapper.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/KcKetangbiaoMapper.java index 3a313041..93c0ec51 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/KcKetangbiaoMapper.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/KcKetangbiaoMapper.java @@ -51,5 +51,5 @@ public interface KcKetangbiaoMapper extends BaseMapper { List getKtbjList(KcKetangbiao kcKetangbiao); - IPage fundAllPjjgList(Page page, @Param(Constants.ENTITY) QueryWrapper queryWrapper); + IPage fundAllPjjgList(Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/xml/KcKetangbiaoMapper.xml b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/xml/KcKetangbiaoMapper.xml index b5c0136c..0f4b00ca 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/xml/KcKetangbiaoMapper.xml +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/xml/KcKetangbiaoMapper.xml @@ -548,9 +548,10 @@ diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/controller/KcEvaluationstudentController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/controller/KcEvaluationstudentController.java index 3485972c..5767dd68 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/controller/KcEvaluationstudentController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/controller/KcEvaluationstudentController.java @@ -56,7 +56,29 @@ public class KcEvaluationstudentController extends JeecgController pageList = kcEvaluationstudentService.page(page, queryWrapper); return Result.OK(pageList); } - + + /** + * 分页列表查询 + * + * @param kcEvaluationstudent + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "kc_evaluationstudent-分页列表查询") + @ApiOperation(value="kc_evaluationstudent-分页列表查询", notes="kc_evaluationstudent-分页列表查询") + @GetMapping(value = "/queryAllList") + public Result> queryAllList(KcEvaluationstudent kcEvaluationstudent, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(kcEvaluationstudent, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = kcEvaluationstudentService.queryAllList(page, queryWrapper); + return Result.OK(pageList); + } + /** * 添加 * diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/entity/KcEvaluationstudent.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/entity/KcEvaluationstudent.java index 6849f02b..8297ad10 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/entity/KcEvaluationstudent.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/entity/KcEvaluationstudent.java @@ -1,6 +1,7 @@ package org.jeecg.modules.kc.qa.entity; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -58,4 +59,8 @@ public class KcEvaluationstudent implements Serializable { @Excel(name = "星级", width = 15) @ApiModelProperty(value = "星级") private java.lang.Integer stars; + + //课程名称 + @TableField(exist = false) + private String kcmc; } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/mapper/KcEvaluationstudentMapper.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/mapper/KcEvaluationstudentMapper.java index 8ca9208d..baa4b53d 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/mapper/KcEvaluationstudentMapper.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/mapper/KcEvaluationstudentMapper.java @@ -1,6 +1,11 @@ package org.jeecg.modules.kc.qa.mapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +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.qa.entity.KcEvaluationstudent; /** @@ -11,4 +16,5 @@ import org.jeecg.modules.kc.qa.entity.KcEvaluationstudent; */ public interface KcEvaluationstudentMapper extends BaseMapper { + IPage queryAllList(Page page,@Param(Constants.WRAPPER) QueryWrapper queryWrapper); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/mapper/xml/KcEvaluationstudentMapper.xml b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/mapper/xml/KcEvaluationstudentMapper.xml index 4957d7d2..621ecbc6 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/mapper/xml/KcEvaluationstudentMapper.xml +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/mapper/xml/KcEvaluationstudentMapper.xml @@ -2,4 +2,12 @@ + \ No newline at end of file diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/service/IKcEvaluationstudentService.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/service/IKcEvaluationstudentService.java index fb9ea34e..c30c48df 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/service/IKcEvaluationstudentService.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/service/IKcEvaluationstudentService.java @@ -1,5 +1,8 @@ package org.jeecg.modules.kc.qa.service; +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.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.kc.qa.entity.KcEvaluationstudent; @@ -11,4 +14,5 @@ import org.jeecg.modules.kc.qa.entity.KcEvaluationstudent; */ public interface IKcEvaluationstudentService extends IService { + IPage queryAllList(Page page, QueryWrapper queryWrapper); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/service/impl/KcEvaluationstudentServiceImpl.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/service/impl/KcEvaluationstudentServiceImpl.java index e420ca6f..6d89328e 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/service/impl/KcEvaluationstudentServiceImpl.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/service/impl/KcEvaluationstudentServiceImpl.java @@ -1,5 +1,8 @@ package org.jeecg.modules.kc.qa.service.impl; +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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.modules.kc.qa.entity.KcEvaluationstudent; import org.jeecg.modules.kc.qa.mapper.KcEvaluationstudentMapper; @@ -15,4 +18,8 @@ import org.springframework.stereotype.Service; @Service public class KcEvaluationstudentServiceImpl extends ServiceImpl implements IKcEvaluationstudentService { + @Override + public IPage queryAllList(Page page, QueryWrapper queryWrapper) { + return baseMapper.queryAllList(page,queryWrapper); + } }