diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyGonggao/controller/ZyGonggaoController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyGonggao/controller/ZyGonggaoController.java index a9c21bd3..2b65eae2 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyGonggao/controller/ZyGonggaoController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyGonggao/controller/ZyGonggaoController.java @@ -1,6 +1,7 @@ package org.jeecg.modules.kc.zyGonggao.controller; import java.util.Arrays; +import java.util.Date; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -98,6 +99,7 @@ public class ZyGonggaoController extends JeecgController edit(@RequestBody ZyGonggao zyGonggao) { String res = "编辑成功!"; + zyGonggao.setCreateTime(new Date()); zyGonggaoService.updateById(zyGonggao); if(zyGonggao.getFlag()!=null){ if(zyGonggao.getFlag().equals("1")){ diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java index 19b5df37..978521c6 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java @@ -40,7 +40,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; +import org.jeecg.modules.kc.zyInfoStudentHp.entity.ZyInfoStudentHp; +import org.jeecg.modules.kc.zyInfoStudentHp.service.IZyInfoStudentHpService; +import org.jeecg.modules.kc.zyInfoStudentPcz.service.IZyInfoStudentPczService; import org.jeecg.modules.system.service.impl.SysBaseApiImpl; +import org.jeecg.modules.tools.DictUtils; import org.jeecg.modules.tools.Global; import org.jeecg.modules.tools.pdf.PDFUtil; import org.jeecg.modules.zyk.entity.ZykInfo; @@ -103,8 +107,15 @@ public class ZyInfoStudentController extends JeecgController zyInfoStudentQueryWrapper = new QueryWrapper<>(); + zyInfoStudentQueryWrapper.eq("a.main_id",zyInfoStudent.getMainId()); + zyInfoStudentQueryWrapper.eq("a.create_by",zyInfoStudent.getCreateBy()); + List listPfr = zyInfoStudentService.list(zyInfoStudentQueryWrapper); + if(listPfr.size()>0){ + ZyInfoStudent hprInfo = listPfr.get(0); + //计算绩效分数 + QueryWrapper zyInfoStudentHpQueryWrapper3 = new QueryWrapper<>(); + zyInfoStudentHpQueryWrapper3.eq("main_id",hprInfo.getMainId()); + zyInfoStudentHpQueryWrapper3.eq("stu_id",zyInfoStudent.getCreateBy()); + List list3 = zyInfoStudentHpService.list(zyInfoStudentHpQueryWrapper3); + if(list3.size()>4){ + if(StringUtils.isNotEmpty(hprInfo.getScore())){ + double hpcj = Double.parseDouble(hprInfo.getScore());//获取教师的互评成绩 + double jxcj = hpcj * hpcjjl / 100; + hprInfo.setJxfs(String.format("%.1f",jxcj)); + } + } + //计算最终得分 + if(StringUtils.isNotEmpty(hprInfo.getScore())){ + double hpcj = Double.parseDouble(hprInfo.getScore());//获取教师的互评成绩 + double jxcj = 0.0;//获取教师的互评成绩 + if(StringUtils.isNotEmpty(hprInfo.getJxfs())){ + jxcj = Double.parseDouble(hprInfo.getJxfs());//获取教师的互评成绩 + } + double zzcj = hpcj + jxcj; + hprInfo.setZzdf(String.format("%.1f",zzcj)); + } + zyInfoStudentService.updateById(hprInfo); + } + + + + //计算二次绩效奖励 + ZyInfo jspc = new ZyInfo(); + jspc.setId(zyInfoStudent.getMainId()); + zyInfoStudentPczService.calculationPcz(jspc); + + ZyInfoStudent zyInfoStudentPar = zyInfoStudentService.getById(zyInfoStudent.getId()); if(StringUtils.isNotEmpty(score)){ ZyInfo zyInfo = zyInfoService.getKechengById(zyInfoStudentPar.getMainId()); @@ -220,9 +272,9 @@ public class ZyInfoStudentController extends JeecgController zyInfoStudentQueryWrapper = new QueryWrapper<>(); - zyInfoStudentQueryWrapper.eq("main_id",zyInfoStudentPar.getMainId()); - List list = zyInfoStudentService.list(zyInfoStudentQueryWrapper); + QueryWrapper zyInfoStudentQueryWrappertt = new QueryWrapper<>(); + zyInfoStudentQueryWrappertt.eq("main_id",zyInfoStudentPar.getMainId()); + List list = zyInfoStudentService.list(zyInfoStudentQueryWrappertt); int a = list.size(); QueryWrapper zyInfoStudentQueryWrapper2 = new QueryWrapper<>(); @@ -597,38 +649,67 @@ public class ZyInfoStudentController extends JeecgController> getHpxxList(ZyInfoStudent zyInfoStudent, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) { -// //查询作业查重结果 -// zyCcjgService.getCcjg(); + + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + QueryWrapper zyInfoStudentHpQueryWrapper = new QueryWrapper<>(); + zyInfoStudentHpQueryWrapper.eq("main_id",zyInfoStudent.getMainId()); + zyInfoStudentHpQueryWrapper.eq("stu_id",user.getUsername()); + List hplist = zyInfoStudentHpService.list(zyInfoStudentHpQueryWrapper); + String minhpcs = dictUtils.translateDictValue("hpcjsz","4"); + pageSize = Integer.parseInt(minhpcs); + if(hplist.size()>0){ + pageSize = pageSize - hplist.size(); + if(pageSize<0){ + pageSize = 0; + } + } + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper("a",zyInfoStudent, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + queryWrapper.isNotNull("a.file_path"); + queryWrapper.eq("a.xshpkg","1"); + queryWrapper.eq("sfpf","0"); + queryWrapper.apply("xshpkssj <= now() and xshpjssj >= now() and hpsfwctwo = 0"); + + queryWrapper.ne("a.create_by",user.getUsername()); + queryWrapper.like(StringUtils.isNotEmpty(zyInfoStudent.getZytitle()),"a.title",zyInfoStudent.getZytitle()); + queryWrapper.eq(StringUtils.isNotEmpty(zyInfoStudent.getRwbh()),"a.rwbh",zyInfoStudent.getRwbh()); + queryWrapper.apply("a.hpcs - 0 < "+pageSize); + queryWrapper.orderByAsc("a.hpcs - 0 "); + IPage pageList = zyInfoStudentService.getHpxxList(page, queryWrapper,user.getUsername()); + return Result.OK(pageList); + } + + + @ApiOperation(value="获取互评作业已评阅信息", notes="获取互评作业已评阅信息") + @GetMapping(value = "/getHpxxYpyList") + public Result> getHpxxYpyList(ZyInfoStudent zyInfoStudent, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + + + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper("a",zyInfoStudent, req.getParameterMap()); Page page = new Page(pageNo, pageSize); queryWrapper.isNotNull("a.file_path"); - queryWrapper.eq("b.xshpkg","1"); + queryWrapper.eq("a.xshpkg","1"); + queryWrapper.eq("a.sfpf","1"); queryWrapper.apply("xshpkssj <= now() and xshpjssj >= now() and hpsfwctwo = 0"); - - queryWrapper.like(StringUtils.isNotEmpty(zyInfoStudent.getZytitle()),"b.title",zyInfoStudent.getZytitle()); - queryWrapper.eq(StringUtils.isNotEmpty(zyInfoStudent.getRwbh()),"b.rwbh",zyInfoStudent.getRwbh()); -// queryWrapper.like("a.xshpkg",zyInfoStudent.getZytitle()); -// if(StringUtils.isNotEmpty(zyInfoStudent.getQueryType())){ -// if(StringUtils.equals("1",zyInfoStudent.getQueryType())){//未提交 -// queryWrapper.isNull("a.file_path"); -// }else if(StringUtils.equals("2",zyInfoStudent.getQueryType())){//已提交 -// queryWrapper.isNotNull("a.file_path"); -// }else if(StringUtils.equals("3",zyInfoStudent.getQueryType())){//未评阅 -// queryWrapper.isNull("a.score"); -// }else if(StringUtils.equals("4",zyInfoStudent.getQueryType())){//已评阅 -// queryWrapper.isNotNull("a.score"); -// } -// } - IPage pageList = zyInfoStudentService.getHpxxList(page, queryWrapper); + queryWrapper.ne("a.create_by",user.getUsername()); + queryWrapper.like(StringUtils.isNotEmpty(zyInfoStudent.getZytitle()),"a.title",zyInfoStudent.getZytitle()); + queryWrapper.eq(StringUtils.isNotEmpty(zyInfoStudent.getRwbh()),"a.rwbh",zyInfoStudent.getRwbh()); + queryWrapper.orderByAsc("a.hpcs - 0 "); + IPage pageList = zyInfoStudentService.getHpxxList(page, queryWrapper,user.getUsername()); return Result.OK(pageList); } } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/entity/ZyInfoStudent.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/entity/ZyInfoStudent.java index 41bdc1d3..c8381b34 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/entity/ZyInfoStudent.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/entity/ZyInfoStudent.java @@ -61,21 +61,36 @@ public class ZyInfoStudent implements Serializable { @Excel(name = "提交时间", width = 15,format = "yyyy-MM-dd") private java.util.Date publishTime; - @Excel(name = "评分", width = 15) + @Excel(name = "教师评分", width = 15) private java.lang.String score; + + @Excel(name = "学生评分", width = 15) + private String xshpfs; + @Excel(name = "绩效分", width = 15) + private String jxfs; + @Excel(name = "最终得分", width = 15) + private String zzdf; + @Excel(name = "最高查重率", width = 15) + @TableField(exist = false) + private String zgccl;//最高相似律 + /**外网相似律*/ - @Excel(name = "维普查重(%)", width = 15) +// @Excel(name = "维普查重(%)", width = 15) @ApiModelProperty(value = "维普查重(%)") private java.lang.String wwxsl; /**内网相似律*/ - @Excel(name = "作业查重(%)", width = 15) +// @Excel(name = "作业查重(%)", width = 15) @ApiModelProperty(value = "作业查重(%)") private java.lang.String nwxsl; /**aigc相似律*/ - @Excel(name = "aigc查重(%)", width = 15) +// @Excel(name = "aigc查重(%)", width = 15) @ApiModelProperty(value = "aigc查重(%)") private java.lang.String aigcxsl; - @Excel(name = "存档类型", width = 15,dicCode = "cdlx") + /**校内相似律*/ +// @Excel(name = "校内查重(%)", width = 15) + @ApiModelProperty(value = "校内查重(%)") + private java.lang.String xnxsl; + @Excel(name = "标记作业", width = 15,dicCode = "cdlx") @Dict(dicCode = "cdlx") private String cdlx;//存档类型 @@ -98,13 +113,14 @@ public class ZyInfoStudent implements Serializable { /**校内是否通过*/ @ApiModelProperty(value = "校内是否通过") private java.lang.String xnsftg; - /**校内相似律*/ - @Excel(name = "校内查重(%)", width = 15) - @ApiModelProperty(value = "校内查重(%)") - private java.lang.String xnxsl; private java.lang.String pdfPath; private String scoreFabu; + private String hpcs; + private String jxfs2; + + @TableField(exist = false) + private String jxzf; @TableField(exist = false) private String catename; @@ -174,8 +190,6 @@ public class ZyInfoStudent implements Serializable { @TableField(exist = false) private String queryType;//作业状态查询 @TableField(exist = false) - private String zgccl;//最高相似律 - @TableField(exist = false) private String alltgl;//通过率 @TableField(exist = false) private String sfpf;//是否评分 diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/ZyInfoStudentMapper.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/ZyInfoStudentMapper.java index ec91bff4..f5501110 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/ZyInfoStudentMapper.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/ZyInfoStudentMapper.java @@ -6,8 +6,10 @@ 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.zyInfo.entity.ZyInfo; import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent; import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudentSys; +import org.jeecg.modules.kc.zyInfoStudentPcz.entity.ZyInfoStudentPcz; import javax.servlet.http.HttpServletResponse; import java.util.List; @@ -37,5 +39,7 @@ public interface ZyInfoStudentMapper extends BaseMapper { void delweipulunwen(ZyInfoStudent zyInfoStudent, HttpServletResponse response); - IPage getHpxxList(Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + IPage getHpxxList(Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper,@Param("zyStuId")String zyStuId); + + void updateJxfs2(ZyInfo jspc); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml index 7c4776ed..cd96761a 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml @@ -6,14 +6,15 @@ delete from zy_info_student where main_id = #{mainId} @@ -136,9 +137,16 @@ where a.main_id = #{mainId} and a.create_by = #{createBy} and b.cc_type = #{queryType} group by bdkbs + + + update zy_info_student set jxfs2 = '0' where main_id=#{id} + + \ No newline at end of file diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java index c441c14d..e52434b1 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java @@ -39,5 +39,5 @@ public interface IZyInfoStudentService extends IService { boolean stuWpKsjc(ZyInfoStudent zyInfoStudent, HttpServletResponse response); - IPage getHpxxList(Page page, QueryWrapper queryWrapper); + IPage getHpxxList(Page page, QueryWrapper queryWrapper,String zyStuId); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java index 3df1b082..26a30f30 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java @@ -190,8 +190,8 @@ public class ZyInfoStudentServiceImpl extends ServiceImpl getHpxxList(Page page, QueryWrapper queryWrapper) { - return baseMapper.getHpxxList(page,queryWrapper); + public IPage getHpxxList(Page page, QueryWrapper queryWrapper,String zyStuId) { + return baseMapper.getHpxxList(page,queryWrapper,zyStuId); } private void delweipulunwen(ZyInfoStudent zyInfoStudent, HttpServletResponse response) { diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentHp/controller/ZyInfoStudentHpController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentHp/controller/ZyInfoStudentHpController.java index a33cee9b..cedd6e1e 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentHp/controller/ZyInfoStudentHpController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentHp/controller/ZyInfoStudentHpController.java @@ -1,5 +1,6 @@ package org.jeecg.modules.kc.zyInfoStudentHp.controller; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -18,6 +19,8 @@ import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.kc.zyInfo.entity.ZyInfo; import org.jeecg.modules.kc.zyInfo.service.IZyInfoService; +import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent; +import org.jeecg.modules.kc.zyInfoStudent.service.IZyInfoStudentService; import org.jeecg.modules.kc.zyInfoStudentHp.entity.ZyInfoStudentHp; import org.jeecg.modules.kc.zyInfoStudentHp.service.IZyInfoStudentHpService; @@ -26,6 +29,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; +import org.jeecg.modules.kc.zyInfoStudentPcz.service.IZyInfoStudentPczService; +import org.jeecg.modules.tools.DictUtils; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; @@ -58,7 +63,14 @@ public class ZyInfoStudentHpController extends JeecgController saveOne(@RequestBody ZyInfoStudentHp zyInfoStudentHp) { + zyInfoStudentHp.setId(null); String zyStuId = zyInfoStudentHp.getZyStuId(); if(StringUtils.isNotEmpty(zyStuId)){ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); @@ -201,6 +214,114 @@ public class ZyInfoStudentHpController extends JeecgController zyInfoStudentHpQueryWrapper2 = new QueryWrapper<>(); + zyInfoStudentHpQueryWrapper2.eq("zy_stu_id",zyStuId); + List list2 = zyInfoStudentHpService.list(zyInfoStudentHpQueryWrapper2); + ZyInfoStudent zyInfoStudent = new ZyInfoStudent(); + zyInfoStudent.setHpcs(list2.size()+""); + zyInfoStudent.setId(zyStuId); +// zyInfoStudentService.updateById(zyInfoStudent); + + + + if(list2.size() == 3){ + //三个数的平均分,去掉差值最大的,剩余两个取平均分 + + ArrayList numbers = new ArrayList<>(); + // 假设有一个整数数组numbers + for(ZyInfoStudentHp par:list2){ + numbers.add(Integer.parseInt(par.getStuScore())); + } + // 去掉最大值 + int max = Integer.MIN_VALUE; + int sum = 0; + for (int num : numbers) { + max = Math.max(max, num); + sum += num; + } + sum -= max ; + + // 计算平均值 + double average = (double) sum / (numbers.size() - 1); + zyInfoStudent.setXshpfs(average+""); + }else if(list2.size() > 3){ + //去掉做高分和最低分 取平均值 + + ArrayList numbers = new ArrayList<>(); + // 假设有一个整数数组numbers + for(ZyInfoStudentHp par:list2){ + numbers.add(Integer.parseInt(par.getStuScore())); + } + // 去掉最大值和最小值 + int max = Integer.MIN_VALUE; + int min = Integer.MAX_VALUE; + int sum = 0; + for (int num : numbers) { + max = Math.max(max, num); + min = Math.min(min, num); + sum += num; + } + sum -= max + min; + + // 计算平均值 + double average = (double) sum / (numbers.size() - 2); + zyInfoStudent.setXshpfs(String.format("%.1f",average)+""); + } + + //判断互评成绩是否为最终成绩 + if(StringUtils.equals(zyInfo.getSfzzcj(),"1")){ + zyInfoStudent.setScore(zyInfoStudent.getXshpfs()); + } + zyInfoStudentService.updateById(zyInfoStudent); + + Integer hpcjjl = Integer.parseInt(dictUtils.translateDictValue("hpcjsz","1")); + //计算评分人的互评次数,计算互评人的绩效分数 + QueryWrapper zyInfoStudentQueryWrapper = new QueryWrapper<>(); + zyInfoStudentQueryWrapper.eq("a.main_id",zyInfoStudentPar.getMainId()); + zyInfoStudentQueryWrapper.eq("a.create_by",sysUser.getUsername()); + List listPfr = zyInfoStudentService.list(zyInfoStudentQueryWrapper); + if(listPfr.size()>0){ + ZyInfoStudent hprInfo = listPfr.get(0); + //计算绩效分数 + QueryWrapper zyInfoStudentHpQueryWrapper3 = new QueryWrapper<>(); + zyInfoStudentHpQueryWrapper3.eq("main_id",hprInfo.getMainId()); + zyInfoStudentHpQueryWrapper3.eq("stu_id",sysUser.getUsername()); + List list3 = zyInfoStudentHpService.list(zyInfoStudentHpQueryWrapper3); + if(list3.size()>4){ + if(StringUtils.isNotEmpty(hprInfo.getScore())){ + double hpcj = Double.parseDouble(hprInfo.getScore());//获取教师的互评成绩 + double jxcj = hpcj * hpcjjl / 100; + hprInfo.setJxfs(String.format("%.1f",jxcj)); + } + } + //计算最终得分 + if(StringUtils.isNotEmpty(hprInfo.getScore())){ + double hpcj = Double.parseDouble(hprInfo.getScore());//获取教师的互评成绩 + double jxcj = 0.0;//获取教师的互评成绩 + if(StringUtils.isNotEmpty(hprInfo.getJxfs())){ + jxcj = Double.parseDouble(hprInfo.getJxfs());//获取教师的互评成绩 + } + double zzcj = hpcj + jxcj; + hprInfo.setZzdf(String.format("%.1f",zzcj)); + } + zyInfoStudentService.updateById(hprInfo); + } + + + + //计算二次绩效奖励 + ZyInfo jspc = new ZyInfo(); + jspc.setId(zyInfoStudentPar.getMainId()); + zyInfoStudentPczService.calculationPcz(jspc); + + + return Result.OK("互评成功!"); } }else{ diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentHp/entity/ZyInfoStudentHp.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentHp/entity/ZyInfoStudentHp.java index 7ba7859c..cbc2ca70 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentHp/entity/ZyInfoStudentHp.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentHp/entity/ZyInfoStudentHp.java @@ -80,4 +80,8 @@ public class ZyInfoStudentHp implements Serializable { @Excel(name = "作业主id", width = 15) @ApiModelProperty(value = "作业主id") private java.lang.String mainId; + /**作业主id*/ + @Excel(name = "rwbh", width = 15) + @ApiModelProperty(value = "rwbh") + private java.lang.String rwbh; } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/controller/ZyInfoStudentPczController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/controller/ZyInfoStudentPczController.java new file mode 100644 index 00000000..f3842f33 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/controller/ZyInfoStudentPczController.java @@ -0,0 +1,195 @@ +package org.jeecg.modules.kc.zyInfoStudentPcz.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.zyInfo.entity.ZyInfo; +import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent; +import org.jeecg.modules.kc.zyInfoStudentPcz.entity.ZyInfoStudentPcz; +import org.jeecg.modules.kc.zyInfoStudentPcz.service.IZyInfoStudentPczService; + +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: 作业偏差值 + * @Author: jeecg-boot + * @Date: 2024-07-31 + * @Version: V1.0 + */ +@Api(tags="作业偏差值") +@RestController +@RequestMapping("/zyInfoStudentPcz/zyInfoStudentPcz") +@Slf4j +public class ZyInfoStudentPczController extends JeecgController { + @Autowired + private IZyInfoStudentPczService zyInfoStudentPczService; + + /** + * 分页列表查询 + * + * @param zyInfoStudentPcz + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "作业偏差值-分页列表查询") + @ApiOperation(value="作业偏差值-分页列表查询", notes="作业偏差值-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(ZyInfoStudentPcz zyInfoStudentPcz, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(zyInfoStudentPcz, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = zyInfoStudentPczService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param zyInfoStudentPcz + * @return + */ + @AutoLog(value = "作业偏差值-添加") + @ApiOperation(value="作业偏差值-添加", notes="作业偏差值-添加") + @RequiresPermissions("zyInfoStudentPcz:zy_info_student_pcz:add") + @PostMapping(value = "/add") + public Result add(@RequestBody ZyInfoStudentPcz zyInfoStudentPcz) { + zyInfoStudentPczService.save(zyInfoStudentPcz); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param zyInfoStudentPcz + * @return + */ + @AutoLog(value = "作业偏差值-编辑") + @ApiOperation(value="作业偏差值-编辑", notes="作业偏差值-编辑") + @RequiresPermissions("zyInfoStudentPcz:zy_info_student_pcz:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody ZyInfoStudentPcz zyInfoStudentPcz) { + zyInfoStudentPczService.updateById(zyInfoStudentPcz); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "作业偏差值-通过id删除") + @ApiOperation(value="作业偏差值-通过id删除", notes="作业偏差值-通过id删除") + @RequiresPermissions("zyInfoStudentPcz:zy_info_student_pcz:delete") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + zyInfoStudentPczService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "作业偏差值-批量删除") + @ApiOperation(value="作业偏差值-批量删除", notes="作业偏差值-批量删除") + @RequiresPermissions("zyInfoStudentPcz:zy_info_student_pcz:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.zyInfoStudentPczService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "作业偏差值-通过id查询") + @ApiOperation(value="作业偏差值-通过id查询", notes="作业偏差值-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + ZyInfoStudentPcz zyInfoStudentPcz = zyInfoStudentPczService.getById(id); + if(zyInfoStudentPcz==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(zyInfoStudentPcz); + } + + /** + * 导出excel + * + * @param request + * @param zyInfoStudentPcz + */ + @RequiresPermissions("zyInfoStudentPcz:zy_info_student_pcz:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ZyInfoStudentPcz zyInfoStudentPcz) { + return super.exportXls(request, zyInfoStudentPcz, ZyInfoStudentPcz.class, "作业偏差值"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequiresPermissions("zyInfoStudentPcz:zy_info_student_pcz:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, ZyInfoStudentPcz.class); + } + + + /** + * 分页列表查询 + * + * @return + */ + //@AutoLog(value = "作业偏差值-分页列表查询") + @ApiOperation(value="计算偏差值", notes="计算偏差值") + @GetMapping(value = "/calculationPcz") + public Result> calculationPcz(ZyInfoStudentPcz zyInfoStudentPcz) { + ZyInfo jspc = new ZyInfo(); + zyInfoStudentPczService.calculationPcz(jspc); + return Result.OK(); + } + +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/entity/ZyInfoStudentPcz.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/entity/ZyInfoStudentPcz.java new file mode 100644 index 00000000..d112ab73 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/entity/ZyInfoStudentPcz.java @@ -0,0 +1,71 @@ +package org.jeecg.modules.kc.zyInfoStudentPcz.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: 作业偏差值 + * @Author: jeecg-boot + * @Date: 2024-07-31 + * @Version: V1.0 + */ +@Data +@TableName("zy_info_student_pcz") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="zy_info_student_pcz对象", description="作业偏差值") +public class ZyInfoStudentPcz 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) + @ApiModelProperty(value = "本次作业id") + private java.lang.String zyStuId; + /**主作业id*/ + @Excel(name = "主作业id", width = 15) + @ApiModelProperty(value = "主作业id") + private java.lang.String zyId; + /**学生id*/ + @Excel(name = "学生id", width = 15) + @ApiModelProperty(value = "学生id") + private java.lang.String stuId; + /**偏差值*/ + @Excel(name = "偏差值", width = 15) + @ApiModelProperty(value = "偏差值") + private java.lang.String pcz; +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/mapper/ZyInfoStudentPczMapper.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/mapper/ZyInfoStudentPczMapper.java new file mode 100644 index 00000000..ce84289a --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/mapper/ZyInfoStudentPczMapper.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.kc.zyInfoStudentPcz.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.kc.zyInfo.entity.ZyInfo; +import org.jeecg.modules.kc.zyInfoStudentPcz.entity.ZyInfoStudentPcz; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 作业偏差值 + * @Author: jeecg-boot + * @Date: 2024-07-31 + * @Version: V1.0 + */ +public interface ZyInfoStudentPczMapper extends BaseMapper { + + List getPczList(ZyInfo jspc); +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/mapper/xml/ZyInfoStudentPczMapper.xml b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/mapper/xml/ZyInfoStudentPczMapper.xml new file mode 100644 index 00000000..4336de65 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/mapper/xml/ZyInfoStudentPczMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + + \ No newline at end of file diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/service/IZyInfoStudentPczService.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/service/IZyInfoStudentPczService.java new file mode 100644 index 00000000..5294a2c9 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/service/IZyInfoStudentPczService.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.kc.zyInfoStudentPcz.service; + +import org.jeecg.modules.kc.zyInfo.entity.ZyInfo; +import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent; +import org.jeecg.modules.kc.zyInfoStudentPcz.entity.ZyInfoStudentPcz; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 作业偏差值 + * @Author: jeecg-boot + * @Date: 2024-07-31 + * @Version: V1.0 + */ +public interface IZyInfoStudentPczService extends IService { + + void calculationPcz(ZyInfo jspc); +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/service/impl/ZyInfoStudentPczServiceImpl.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/service/impl/ZyInfoStudentPczServiceImpl.java new file mode 100644 index 00000000..ea6db9df --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudentPcz/service/impl/ZyInfoStudentPczServiceImpl.java @@ -0,0 +1,93 @@ +package org.jeecg.modules.kc.zyInfoStudentPcz.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import org.jeecg.common.util.text.StringUtils; +import org.jeecg.modules.kc.zyInfo.entity.ZyInfo; +import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent; +import org.jeecg.modules.kc.zyInfoStudent.mapper.ZyInfoStudentMapper; +import org.jeecg.modules.kc.zyInfoStudentPcz.entity.ZyInfoStudentPcz; +import org.jeecg.modules.kc.zyInfoStudentPcz.mapper.ZyInfoStudentPczMapper; +import org.jeecg.modules.kc.zyInfoStudentPcz.service.IZyInfoStudentPczService; +import org.jeecg.modules.tools.DictUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import java.util.List; + +/** + * @Description: 作业偏差值 + * @Author: jeecg-boot + * @Date: 2024-07-31 + * @Version: V1.0 + */ +@Service +public class ZyInfoStudentPczServiceImpl extends ServiceImpl implements IZyInfoStudentPczService { + + @Autowired + private ZyInfoStudentMapper zyInfoStudentMapper; + + private final DictUtils dictUtils; + + public ZyInfoStudentPczServiceImpl(DictUtils dictUtils) { + this.dictUtils = dictUtils; + } + + @Override + public void calculationPcz(ZyInfo jspc) { + + //删除所有方差作业数据 + baseMapper.delete(new QueryWrapper().eq("zy_id",jspc.getId())); + + //修改原来的绩效数据 + zyInfoStudentMapper.updateJxfs2(jspc); + + //查询方差数据并重新插入到数据库中 + List list = baseMapper.getPczList(jspc); + for (ZyInfoStudentPcz zyInfoStudentPcz : list) { + baseMapper.insert(zyInfoStudentPcz); + } + + //查询方差数据并按照方差数据的大小进行排序 + List list2 = baseMapper.selectList(new QueryWrapper().eq("zy_id",jspc.getId()).orderByAsc("pcz -0")); + //获取百分比有效数据 + String bfb = dictUtils.translateDictValue("hpcjsz","2"); + String bfbFs = dictUtils.translateDictValue("hpcjsz","3"); + //计算有多少数据是需要给绩效的 + Double bfb2 =Double.parseDouble((Double.parseDouble(bfb) * list2.size() / 100)+""); + int rounded = roundToInteger(bfb2); + + for (int i = 0; i < rounded; i++) { + ZyInfoStudentPcz zyInfoStudentPcz = list2.get(i); + + //查询学生对应的数据 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("a.main_id",zyInfoStudentPcz.getZyId()); + wrapper.eq("a.create_by",zyInfoStudentPcz.getStuId()); + wrapper.last("limit 1"); + ZyInfoStudent zyInfoStudent = zyInfoStudentMapper.selectOne(wrapper); + + String score = zyInfoStudent.getScore(); + if(StringUtils.isEmpty(score)){ + score = "0"; + } + Double jxfs2 = Double.parseDouble(score) * Double.parseDouble(bfbFs) /100; + zyInfoStudent.setJxfs2(String.format("%.1f",jxfs2));//第二次绩效 + String jxfs = zyInfoStudent.getJxfs(); + if(StringUtils.isEmpty(jxfs)){ + jxfs = "0"; + } + Double zdf = Double.parseDouble(score) + Double.parseDouble(jxfs) + jxfs2; + zyInfoStudent.setZzdf(String.format("%.1f",zdf)); + zyInfoStudentMapper.updateById(zyInfoStudent); + } + + + } + public static int roundToInteger(double value) { + return (int) Math.round(value); + } + +}