添加新功能
This commit is contained in:
parent
8d41672e4f
commit
42f4e12faa
|
@ -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<ZyGonggao, IZyGonggaoSe
|
|||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody ZyGonggao zyGonggao) {
|
||||
String res = "编辑成功!";
|
||||
zyGonggao.setCreateTime(new Date());
|
||||
zyGonggaoService.updateById(zyGonggao);
|
||||
if(zyGonggao.getFlag()!=null){
|
||||
if(zyGonggao.getFlag().equals("1")){
|
||||
|
|
|
@ -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<ZyInfoStudent, IZyI
|
|||
private IKcExportConfigTpkwcqkjzglxService kcExportConfigTpkwcqkjzglxService;
|
||||
@Autowired
|
||||
private IKcSysConfigService kcSysConfigService;
|
||||
@Autowired
|
||||
private IZyInfoStudentHpService zyInfoStudentHpService;
|
||||
@Autowired
|
||||
private DictUtils dictUtils;
|
||||
|
||||
/**
|
||||
@Autowired
|
||||
private IZyInfoStudentPczService zyInfoStudentPczService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param zyInfoStudent
|
||||
|
@ -204,6 +215,47 @@ public class ZyInfoStudentController extends JeecgController<ZyInfoStudent, IZyI
|
|||
String score = zyInfoStudent.getScore();
|
||||
zyInfoStudentService.editFabu(zyInfoStudent);
|
||||
|
||||
Integer hpcjjl = Integer.parseInt(dictUtils.translateDictValue("hpcjsz","1"));
|
||||
//计算评分人的互评次数,计算互评人的绩效分数
|
||||
QueryWrapper<ZyInfoStudent> zyInfoStudentQueryWrapper = new QueryWrapper<>();
|
||||
zyInfoStudentQueryWrapper.eq("a.main_id",zyInfoStudent.getMainId());
|
||||
zyInfoStudentQueryWrapper.eq("a.create_by",zyInfoStudent.getCreateBy());
|
||||
List<ZyInfoStudent> listPfr = zyInfoStudentService.list(zyInfoStudentQueryWrapper);
|
||||
if(listPfr.size()>0){
|
||||
ZyInfoStudent hprInfo = listPfr.get(0);
|
||||
//计算绩效分数
|
||||
QueryWrapper<ZyInfoStudentHp> zyInfoStudentHpQueryWrapper3 = new QueryWrapper<>();
|
||||
zyInfoStudentHpQueryWrapper3.eq("main_id",hprInfo.getMainId());
|
||||
zyInfoStudentHpQueryWrapper3.eq("stu_id",zyInfoStudent.getCreateBy());
|
||||
List<ZyInfoStudentHp> 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<ZyInfoStudent, IZyI
|
|||
zyDbtxService.save(zyDbtx);
|
||||
}
|
||||
|
||||
QueryWrapper<ZyInfoStudent> zyInfoStudentQueryWrapper = new QueryWrapper<>();
|
||||
zyInfoStudentQueryWrapper.eq("main_id",zyInfoStudentPar.getMainId());
|
||||
List<ZyInfoStudent> list = zyInfoStudentService.list(zyInfoStudentQueryWrapper);
|
||||
QueryWrapper<ZyInfoStudent> zyInfoStudentQueryWrappertt = new QueryWrapper<>();
|
||||
zyInfoStudentQueryWrappertt.eq("main_id",zyInfoStudentPar.getMainId());
|
||||
List<ZyInfoStudent> list = zyInfoStudentService.list(zyInfoStudentQueryWrappertt);
|
||||
int a = list.size();
|
||||
|
||||
QueryWrapper<ZyInfoStudent> zyInfoStudentQueryWrapper2 = new QueryWrapper<>();
|
||||
|
@ -597,38 +649,67 @@ public class ZyInfoStudentController extends JeecgController<ZyInfoStudent, IZyI
|
|||
}
|
||||
|
||||
|
||||
@ApiOperation(value="获取互评作业信息", notes="获取互评作业信息")
|
||||
@ApiOperation(value="获取互评作业未评阅信息", notes="获取互评作业未评阅信息")
|
||||
@GetMapping(value = "/getHpxxList")
|
||||
public Result<IPage<ZyInfoStudent>> 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<ZyInfoStudentHp> zyInfoStudentHpQueryWrapper = new QueryWrapper<>();
|
||||
zyInfoStudentHpQueryWrapper.eq("main_id",zyInfoStudent.getMainId());
|
||||
zyInfoStudentHpQueryWrapper.eq("stu_id",user.getUsername());
|
||||
List<ZyInfoStudentHp> 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<ZyInfoStudent> queryWrapper = QueryGenerator.initQueryWrapper("a",zyInfoStudent, req.getParameterMap());
|
||||
Page<ZyInfoStudent> page = new Page<ZyInfoStudent>(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<ZyInfoStudent> pageList = zyInfoStudentService.getHpxxList(page, queryWrapper,user.getUsername());
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value="获取互评作业已评阅信息", notes="获取互评作业已评阅信息")
|
||||
@GetMapping(value = "/getHpxxYpyList")
|
||||
public Result<IPage<ZyInfoStudent>> 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<ZyInfoStudent> queryWrapper = QueryGenerator.initQueryWrapper("a",zyInfoStudent, req.getParameterMap());
|
||||
Page<ZyInfoStudent> page = new Page<ZyInfoStudent>(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<ZyInfoStudent> 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<ZyInfoStudent> pageList = zyInfoStudentService.getHpxxList(page, queryWrapper,user.getUsername());
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;//是否评分
|
||||
|
|
|
@ -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<ZyInfoStudent> {
|
|||
|
||||
void delweipulunwen(ZyInfoStudent zyInfoStudent, HttpServletResponse response);
|
||||
|
||||
IPage<ZyInfoStudent> getHpxxList(Page<ZyInfoStudent> page, @Param(Constants.WRAPPER) QueryWrapper<ZyInfoStudent> queryWrapper);
|
||||
IPage<ZyInfoStudent> getHpxxList(Page<ZyInfoStudent> page, @Param(Constants.WRAPPER) QueryWrapper<ZyInfoStudent> queryWrapper,@Param("zyStuId")String zyStuId);
|
||||
|
||||
void updateJxfs2(ZyInfo jspc);
|
||||
}
|
||||
|
|
|
@ -6,14 +6,15 @@
|
|||
delete from zy_info_student where main_id = #{mainId}
|
||||
</delete>
|
||||
<select id="selectPage" resultType="org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent">
|
||||
select a.*,b.wwcc,b.nwcc,b.aigccc,b.xncc,b.title as zyname, GREATEST(ifnull(a.wwxsl,0),ifnull(a.nwxsl,0),ifnull(a.aigcxsl,0),ifnull(a.xnxsl,0)) as zgccl,b.wwtgl as alltgl
|
||||
select a.*,round(IFNULL(a.jxfs,'0') + IFNULL(a.jxfs2,'0'),2) as jxzf,b.wwcc,b.nwcc,b.aigccc,b.xncc,b.title as zyname, GREATEST(ifnull(a.wwxsl,0),ifnull(a.nwxsl,0),ifnull(a.aigcxsl,0),ifnull(a.xnxsl,0)) as zgccl,b.wwtgl as alltgl
|
||||
from zy_info_student a
|
||||
left join zy_info b on a.main_id = b.id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
<select id="selectList" resultType="org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent">
|
||||
select a.*,b.wwcc,b.nwcc,b.aigccc,b.xncc,b.title as zyname from zy_info_student a
|
||||
left join zy_info b on a.main_id = b.id
|
||||
select a.*,round(IFNULL(a.jxfs,'0') + IFNULL(a.jxfs2,'0'),2) as jxzf,b.wwcc,b.nwcc,b.aigccc,b.xncc,b.title as zyname, GREATEST(ifnull(a.wwxsl,0),ifnull(a.nwxsl,0),ifnull(a.aigcxsl,0),ifnull(a.xnxsl,0)) as zgccl,b.wwtgl as alltgl
|
||||
from zy_info_student a
|
||||
left join zy_info b on a.main_id = b.id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
@ -136,9 +137,16 @@
|
|||
where a.main_id = #{mainId} and a.create_by = #{createBy} and b.cc_type = #{queryType} group by bdkbs
|
||||
</select>
|
||||
<select id="getHpxxList" resultType="org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent">
|
||||
select a.*,if(c.id is null ,'0','1') as sfpf,b.title as zytitle from zy_info_student a
|
||||
select * from (
|
||||
select a.*,if(c.id is null ,'0','1') as sfpf,b.title as zytitle,b.xshpkg,b.xshpkssj,b.xshpjssj,b.hpsfwctwo,b.title,b.rwbh from zy_info_student a
|
||||
inner join zy_info b on a.main_id = b.id
|
||||
LEFT JOIN zy_info_student_hp c on a.id = c.zy_stu_id
|
||||
LEFT JOIN zy_info_student_hp c on a.id = c.zy_stu_id AND c.stu_id = #{zyStuId}
|
||||
) a
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
<update id="updateJxfs2">
|
||||
update zy_info_student set jxfs2 = '0' where main_id=#{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
|
@ -39,5 +39,5 @@ public interface IZyInfoStudentService extends IService<ZyInfoStudent> {
|
|||
|
||||
boolean stuWpKsjc(ZyInfoStudent zyInfoStudent, HttpServletResponse response);
|
||||
|
||||
IPage<ZyInfoStudent> getHpxxList(Page<ZyInfoStudent> page, QueryWrapper<ZyInfoStudent> queryWrapper);
|
||||
IPage<ZyInfoStudent> getHpxxList(Page<ZyInfoStudent> page, QueryWrapper<ZyInfoStudent> queryWrapper,String zyStuId);
|
||||
}
|
||||
|
|
|
@ -190,8 +190,8 @@ public class ZyInfoStudentServiceImpl extends ServiceImpl<ZyInfoStudentMapper, Z
|
|||
}
|
||||
|
||||
@Override
|
||||
public IPage<ZyInfoStudent> getHpxxList(Page<ZyInfoStudent> page, QueryWrapper<ZyInfoStudent> queryWrapper) {
|
||||
return baseMapper.getHpxxList(page,queryWrapper);
|
||||
public IPage<ZyInfoStudent> getHpxxList(Page<ZyInfoStudent> page, QueryWrapper<ZyInfoStudent> queryWrapper,String zyStuId) {
|
||||
return baseMapper.getHpxxList(page,queryWrapper,zyStuId);
|
||||
}
|
||||
|
||||
private void delweipulunwen(ZyInfoStudent zyInfoStudent, HttpServletResponse response) {
|
||||
|
|
|
@ -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<ZyInfoStudentHp,
|
|||
private IZyInfoStudentHpService zyInfoStudentHpService;
|
||||
@Autowired
|
||||
private IZyInfoService zyInfoService;
|
||||
/**
|
||||
@Autowired
|
||||
private IZyInfoStudentService zyInfoStudentService;
|
||||
@Autowired
|
||||
private IZyInfoStudentPczService zyInfoStudentPczService;
|
||||
@Autowired
|
||||
private DictUtils dictUtils;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param zyInfoStudentHp
|
||||
|
@ -186,6 +198,7 @@ public class ZyInfoStudentHpController extends JeecgController<ZyInfoStudentHp,
|
|||
@PostMapping(value = "/saveOne")
|
||||
public Result<String> 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<ZyInfoStudentHp,
|
|||
zyInfoStudentHp.setStuId(sysUser.getUsername());
|
||||
zyInfoStudentHp.setStuName(sysUser.getRealname());
|
||||
zyInfoStudentHpService.save(zyInfoStudentHp);
|
||||
|
||||
|
||||
ZyInfoStudent zyInfoStudentPar = zyInfoStudentService.getById(zyStuId);
|
||||
ZyInfo zyInfo = zyInfoService.getById(zyInfoStudentPar.getMainId());
|
||||
|
||||
//计算互评次数
|
||||
QueryWrapper<ZyInfoStudentHp> zyInfoStudentHpQueryWrapper2 = new QueryWrapper<>();
|
||||
zyInfoStudentHpQueryWrapper2.eq("zy_stu_id",zyStuId);
|
||||
List<ZyInfoStudentHp> list2 = zyInfoStudentHpService.list(zyInfoStudentHpQueryWrapper2);
|
||||
ZyInfoStudent zyInfoStudent = new ZyInfoStudent();
|
||||
zyInfoStudent.setHpcs(list2.size()+"");
|
||||
zyInfoStudent.setId(zyStuId);
|
||||
// zyInfoStudentService.updateById(zyInfoStudent);
|
||||
|
||||
|
||||
|
||||
if(list2.size() == 3){
|
||||
//三个数的平均分,去掉差值最大的,剩余两个取平均分
|
||||
|
||||
ArrayList<Integer> 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<Integer> 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<ZyInfoStudent> zyInfoStudentQueryWrapper = new QueryWrapper<>();
|
||||
zyInfoStudentQueryWrapper.eq("a.main_id",zyInfoStudentPar.getMainId());
|
||||
zyInfoStudentQueryWrapper.eq("a.create_by",sysUser.getUsername());
|
||||
List<ZyInfoStudent> listPfr = zyInfoStudentService.list(zyInfoStudentQueryWrapper);
|
||||
if(listPfr.size()>0){
|
||||
ZyInfoStudent hprInfo = listPfr.get(0);
|
||||
//计算绩效分数
|
||||
QueryWrapper<ZyInfoStudentHp> zyInfoStudentHpQueryWrapper3 = new QueryWrapper<>();
|
||||
zyInfoStudentHpQueryWrapper3.eq("main_id",hprInfo.getMainId());
|
||||
zyInfoStudentHpQueryWrapper3.eq("stu_id",sysUser.getUsername());
|
||||
List<ZyInfoStudentHp> 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{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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<ZyInfoStudentPcz, IZyInfoStudentPczService> {
|
||||
@Autowired
|
||||
private IZyInfoStudentPczService zyInfoStudentPczService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param zyInfoStudentPcz
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "作业偏差值-分页列表查询")
|
||||
@ApiOperation(value="作业偏差值-分页列表查询", notes="作业偏差值-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<ZyInfoStudentPcz>> queryPageList(ZyInfoStudentPcz zyInfoStudentPcz,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<ZyInfoStudentPcz> queryWrapper = QueryGenerator.initQueryWrapper(zyInfoStudentPcz, req.getParameterMap());
|
||||
Page<ZyInfoStudentPcz> page = new Page<ZyInfoStudentPcz>(pageNo, pageSize);
|
||||
IPage<ZyInfoStudentPcz> 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<String> 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<String> 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<String> 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<String> 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<ZyInfoStudentPcz> 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<IPage<ZyInfoStudentPcz>> calculationPcz(ZyInfoStudentPcz zyInfoStudentPcz) {
|
||||
ZyInfo jspc = new ZyInfo();
|
||||
zyInfoStudentPczService.calculationPcz(jspc);
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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<ZyInfoStudentPcz> {
|
||||
|
||||
List<ZyInfoStudentPcz> getPczList(ZyInfo jspc);
|
||||
}
|
|
@ -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.zyInfoStudentPcz.mapper.ZyInfoStudentPczMapper">
|
||||
|
||||
|
||||
|
||||
<select id="getPczList" resultType="org.jeecg.modules.kc.zyInfoStudentPcz.entity.ZyInfoStudentPcz">
|
||||
select c.stu_id,c.main_id as zy_id,sum(pcz) as pcz from (
|
||||
select b.stu_id,a.main_id,round(ABS(b.stu_score - a.xshpfs),2) as pcz
|
||||
from zy_info_student a ,zy_info_student_hp b
|
||||
where a.id = b.zy_stu_id and a.main_id = #{id}
|
||||
) c
|
||||
GROUP BY c.stu_id,c.main_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -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<ZyInfoStudentPcz> {
|
||||
|
||||
void calculationPcz(ZyInfo jspc);
|
||||
}
|
|
@ -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<ZyInfoStudentPczMapper, ZyInfoStudentPcz> 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<ZyInfoStudentPcz>().eq("zy_id",jspc.getId()));
|
||||
|
||||
//修改原来的绩效数据
|
||||
zyInfoStudentMapper.updateJxfs2(jspc);
|
||||
|
||||
//查询方差数据并重新插入到数据库中
|
||||
List<ZyInfoStudentPcz> list = baseMapper.getPczList(jspc);
|
||||
for (ZyInfoStudentPcz zyInfoStudentPcz : list) {
|
||||
baseMapper.insert(zyInfoStudentPcz);
|
||||
}
|
||||
|
||||
//查询方差数据并按照方差数据的大小进行排序
|
||||
List<ZyInfoStudentPcz> list2 = baseMapper.selectList(new QueryWrapper<ZyInfoStudentPcz>().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<ZyInfoStudent> 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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue