Commit c99f3e4e by wangjian

2025-09-17 wj 整体修改1

parent d6a8468e
......@@ -207,53 +207,34 @@ public class SjGfjsBfzjcController extends BaseController
return AjaxResult.error("导入失败,第"+(i+1)+"行未匹配到三级单位");
}
zsdwwtcj.setDeptId(sjdept.getDeptId());
//问题描述
String wtms=new DataFormatter().formatCellValue(row.getCell(3)) ;
if(StringUtils.isEmpty(wtms)){
return AjaxResult.error("导入失败,第"+(i+1)+"行问题描述不能为空");
}
zsdwwtcj.setWtmc(wtms);
//考核内容
String khnr=new DataFormatter().formatCellValue(row.getCell(4)) ;
String khnr=new DataFormatter().formatCellValue(row.getCell(3)) ;
if(StringUtils.isEmpty(khnr)){
return AjaxResult.error("导入失败,第"+(i+1)+"行实施路径不能为空");
}
zsdwwtcj.setKhnr(khnr);
//考核项点
String khxd=new DataFormatter().formatCellValue(row.getCell(5)) ;
String khxd=new DataFormatter().formatCellValue(row.getCell(4)) ;
if(StringUtils.isEmpty(khxd)){
return AjaxResult.error("导入失败,第"+(i+1)+"行重点工作不能为空");
}
zsdwwtcj.setKhxd(khxd);
String pjbz=new DataFormatter().formatCellValue(row.getCell(6)) ;
if(StringUtils.isEmpty(pjbz)){
return AjaxResult.error("导入失败,第"+(i+1)+"行主要工作内容不能为空");
}
//匹配评价标准
String substring = pjbz.substring(6);
long l = Long.parseLong(substring);
SjGfjsZdgzCb sjGfjsZdgzCb=new SjGfjsZdgzCb();
sjGfjsZdgzCb.setKhxd(khxd);
sjGfjsZdgzCb.setKhnr(khnr);
sjGfjsZdgzCb.setLx("基础");
if(StringUtils.isEmpty(sjdept.getDeptLx())){
return AjaxResult.error("导入失败,第"+(i+1)+"行单位未设置类型");
}
sjGfjsZdgzCb.setPx(l);
sjGfjsZdgzCb.setNd(rq.substring(0,4));
SjGfjsZdgzCb cb=sjGfjsZdgzMapper.selectSjGfjsZdgzCb(sjGfjsZdgzCb);
if(cb==null){
return AjaxResult.error("导入失败,第"+(i+1)+"行未匹配到主要工作内容");
//问题描述
String wtms=new DataFormatter().formatCellValue(row.getCell(5)) ;
if(StringUtils.isEmpty(wtms)){
return AjaxResult.error("导入失败,第"+(i+1)+"行问题描述不能为空");
}
zsdwwtcj.setPjbzid(cb.getId()+"");
zsdwwtcj.setPjbzmc(cb.getPjbz());
String zgzrr=new DataFormatter().formatCellValue(row.getCell(7)) ;
zsdwwtcj.setWtmc(wtms);
String zgzrr=new DataFormatter().formatCellValue(row.getCell(6)) ;
zsdwwtcj.setZgzrr(zgzrr);
String zgcs=new DataFormatter().formatCellValue(row.getCell(8)) ;
String zgcs=new DataFormatter().formatCellValue(row.getCell(7)) ;
zsdwwtcj.setZgcs(zgcs);
String zgqx=new DataFormatter().formatCellValue(row.getCell(9)) ;
String zgqx=new DataFormatter().formatCellValue(row.getCell(8)) ;
zsdwwtcj.setZgqx(zgqx);
String zgzt=new DataFormatter().formatCellValue(row.getCell(10)) ;
String zgzt=new DataFormatter().formatCellValue(row.getCell(9)) ;
zsdwwtcj.setZgzt(zgzt);
zsdwwtcj.setJcjb("帮扶组检查");
zsdwwtcj.setCreateTime(DateUtils.getNowDate());
......
......@@ -80,17 +80,6 @@ public class SjGfjsBfzkhpjController extends BaseController
}
// 定义默认的最大值
private static final BigDecimal DEFAULT_MAX = new BigDecimal("99999");
// 定义默认的最小值
private static final BigDecimal DEFAULT_MIN = BigDecimal.ZERO;
@Autowired
private ISjGfjsZdgzService sjGfjsZdgzService;
@Autowired
private ISjGfjsDxjczService sjGfjsDxjczService;
@Autowired
private ISjGfjsFdgzService sjGfjsFdgzService;
/**
* 查询考核评价
......@@ -127,68 +116,14 @@ public class SjGfjsBfzkhpjController extends BaseController
List<SjGfjsZsdwkhpj> sjGfjsZsdwkhpjs = sjGfjsZsdwkhpjService.selectSjGfjsZsdwkhpjList(sjGfjsZsdwkhpj);
// List<SjGfjsZsdwkhpj>
if(sjGfjsZsdwkhpjs.size()<=0){
// 查询权重系数,
SjGfjsZdgz sjGfjsZdgz_qz = new SjGfjsZdgz();
sjGfjsZdgz_qz.setNd(nd);
sjGfjsZdgz_qz.setLx("基础");
List<SjGfjsZdgz> qzlist = sjGfjsZdgzService.selectSjGfjsZdgzList(sjGfjsZdgz_qz);
// 查询基础值,
SjGfjsDxjcz sjGfjsDxjcz = new SjGfjsDxjcz();
sjGfjsDxjcz.setNd(nd);
List<SjGfjsDxjcz> jczlist = sjGfjsDxjczService.selectSjGfjsDxjczList(sjGfjsDxjcz);
Map<String, BigDecimal> jczMap = new HashMap<>();
for (SjGfjsDxjcz dxjcz : jczlist) {
try {
// 将基础值字符串转换为BigDecimal
BigDecimal jczValue = new BigDecimal(dxjcz.getJcz());
jczMap.put(dxjcz.getJb(), jczValue);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("基础值格式错误,级别:" + dxjcz.getJb() + ",值:" + dxjcz.getJcz(), e);
}
}
// 分档规则
SjGfjsFdgz sjGfjsFdgz = new SjGfjsFdgz();
sjGfjsFdgz.setNd(nd);
List<SjGfjsFdgz> fdgzlist = sjGfjsFdgzService.selectSjGfjsFdgzList(sjGfjsFdgz);
// 计算总得分 初始直接照全是A计算
BigDecimal totalScore = BigDecimal.ZERO;
for(int i=0;i<qzlist.size();i++){
SjGfjsZdgz qzxsMap = qzlist.get(i);
BigDecimal qzxs = new BigDecimal(qzxsMap.getKhnrfs());// 系数
BigDecimal baseValue = jczMap.get("A");
// 计算单项得分并累加
BigDecimal itemScore = qzxs.multiply(baseValue);
totalScore = totalScore.add(itemScore);
}
// 计算单位分档级别
String fdjb = "未知";
for (SjGfjsFdgz fdgz : fdgzlist) {
// 处理最小基础值(null或空字符串视为0)
BigDecimal minJcz = DEFAULT_MIN;
String minStr = fdgz.getMinjcz();
if (minStr != null && !minStr.trim().isEmpty()) {
minJcz = new BigDecimal(minStr.trim());
}
// 处理最大基础值(null或空字符串视为99999)
BigDecimal maxJcz = DEFAULT_MAX;
String maxStr = fdgz.getMaxjcz();
if (maxStr != null && !maxStr.trim().isEmpty()) {
maxJcz = new BigDecimal(maxStr.trim());
}
// 检查总分是否在当前分档的范围内(包含边界值)
// 比较规则:minJcz ≤ totalScore < maxJcz
if (totalScore.compareTo(minJcz) >= 0 && totalScore.compareTo(maxJcz) < 0) {
fdjb = fdgz.getJb(); // 返回匹配的级别
}
}
//查询主表信息
SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZbnew=new SjGfjsZsdwkhpjZb();
SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZb=new SjGfjsZsdwkhpjZb();
sjGfjsZsdwkhpjZb.setNd(nd);
sjGfjsZsdwkhpjZb.setDeptId(deptId);
sjGfjsZsdwkhpjZb.setZqfw(sjGfjsZsdwkhpj.getZqfw());
SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZbnew =sjGfjsZsdwkhpjZbService.selectSjGfjsZsdwkhpjZb(sjGfjsZsdwkhpjZb);
if(sjGfjsZsdwkhpjZbnew==null){
sjGfjsZsdwkhpjZbnew=new SjGfjsZsdwkhpjZb();
sjGfjsZsdwkhpjZbnew.setNd(nd);
sjGfjsZsdwkhpjZbnew.setDeptId(deptId);
sjGfjsZsdwkhpjZbnew.setParentDeptId(dept.getParentId());
......@@ -199,11 +134,8 @@ public class SjGfjsBfzkhpjController extends BaseController
sjGfjsZsdwkhpjZbnew.setDeptLx(dept.getDeptLx());
sjGfjsZsdwkhpjZbnew.setDeptYwfl(dept.getDeptYwfl());
sjGfjsZsdwkhpjZbnew.setZt("0");//未提交
sjGfjsZsdwkhpjZbnew.setZdf(totalScore);
sjGfjsZsdwkhpjZbnew.setZhdf(totalScore);
sjGfjsZsdwkhpjZbnew.setFdjb(fdjb);
sjGfjsZsdwkhpjZbnew.setYl3(yl3);
sjGfjsZsdwkhpjZbService.insertSjGfjsZsdwkhpjZb(sjGfjsZsdwkhpjZbnew);
}
//先保存再查询
SjGfjsZdgz sjGfjsZdgz=new SjGfjsZdgz();
......@@ -234,10 +166,10 @@ public class SjGfjsBfzkhpjController extends BaseController
zsdwkhpj.setJb("帮扶组");
zsdwkhpj.setZbId(sjGfjsZsdwkhpjZbnew.getId());
zsdwkhpj.setYl1(i+1L);
zsdwkhpj.setYl3(yl3);
zsdwkhpj.setKhfz("A");
//计算问题
List<String> collect = sjGfjsZsdwwtcjs.stream().filter(item -> item.getPjbzid().equals(zsdwkhpj.getPjbzid()))
List<String> collect = sjGfjsZsdwwtcjs.stream()
.filter(item -> item.getKhnr().equals(zsdwkhpj.getKhnr()) && item.getKhxd().equals(zsdwkhpj.getKhxd()))
.map(SjGfjsZsdwwtcj::getWtmc).collect(Collectors.toList());
zsdwkhpj.setSj(collect.size()+"");
zsdwkhpj.setWtms(String.join(";",collect));
......@@ -252,7 +184,7 @@ public class SjGfjsBfzkhpjController extends BaseController
}
//查询考核评价
List<SjGfjsZsdwkhpj> resjGfjsZsdwkhpjs = sjGfjsZsdwkhpjService.selectSjGfjsZsdwkhpjList_Bfz(sjGfjsZsdwkhpj);
List<SjGfjsZsdwkhpj> resjGfjsZsdwkhpjs = sjGfjsZsdwkhpjService.selectSjGfjsZsdwkhpjList(sjGfjsZsdwkhpj);
//查询主表信息
SjGfjsZsdwkhpjZb zb = new SjGfjsZsdwkhpjZb();
......@@ -318,8 +250,6 @@ public class SjGfjsBfzkhpjController extends BaseController
int m = 0;
Cell cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getKhnr());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getKhxd());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getPjbzmc());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getSj());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getWtms());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getKhfz());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getId());
......@@ -481,13 +411,13 @@ public class SjGfjsBfzkhpjController extends BaseController
SjGfjsZsdwkhpj zsdwkhpj=new SjGfjsZsdwkhpj();
System.out.println(row);
//id
String id=new DataFormatter().formatCellValue(row.getCell(6));
String id=new DataFormatter().formatCellValue(row.getCell(4));
if(StringUtils.isEmpty(id)){
return AjaxResult.error("id不能为空");
}
zsdwkhpj.setId(Long.parseLong(id));
//主表id
String zbid=new DataFormatter().formatCellValue(row.getCell(7));
String zbid=new DataFormatter().formatCellValue(row.getCell(5));
if(StringUtils.isEmpty(zbid)){
return AjaxResult.error("主表id不能为空");
}
......@@ -499,16 +429,11 @@ public class SjGfjsBfzkhpjController extends BaseController
String xd=new DataFormatter().formatCellValue(row.getCell(1));
zsdwkhpj.setKhxd(xd);
String pj=new DataFormatter().formatCellValue(row.getCell(2));
zsdwkhpj.setPjbzmc(pj);
String sl=new DataFormatter().formatCellValue(row.getCell(3));
zsdwkhpj.setSj(sl);
//问题描述
String wtms=new DataFormatter().formatCellValue(row.getCell(4));
String wtms=new DataFormatter().formatCellValue(row.getCell(2));
zsdwkhpj.setWtms(wtms);
//考核分值
String khfz=new DataFormatter().formatCellValue(row.getCell(5));
String khfz=new DataFormatter().formatCellValue(row.getCell(3));
zsdwkhpj.setKhfz(khfz);
list.add(zsdwkhpj);
......
......@@ -84,17 +84,6 @@ public class SjGfjsJcdwkhpjController extends BaseController
}
@Autowired
private ISjGfjsZdgzService sjGfjsZdgzService;
@Autowired
private ISjGfjsDxjczService sjGfjsDxjczService;
@Autowired
private ISjGfjsFdgzService sjGfjsFdgzService;
// 定义默认的最大值
private static final BigDecimal DEFAULT_MAX = new BigDecimal("99999");
// 定义默认的最小值
private static final BigDecimal DEFAULT_MIN = BigDecimal.ZERO;
/**
* 查询考核评价
* @return
......@@ -140,69 +129,14 @@ public class SjGfjsJcdwkhpjController extends BaseController
List<SjGfjsZsdwkhpj> sjGfjsZsdwkhpjs = sjGfjsZsdwkhpjService.selectSjGfjsZsdwkhpjList(sjGfjsZsdwkhpj);
// List<SjGfjsZsdwkhpj>
if(sjGfjsZsdwkhpjs.size()<=0){
// 查询权重系数,
SjGfjsZdgz sjGfjsZdgz_qz = new SjGfjsZdgz();
sjGfjsZdgz_qz.setNd(nd);
sjGfjsZdgz_qz.setLx("基础");
List<SjGfjsZdgz> qzlist = sjGfjsZdgzService.selectSjGfjsZdgzList(sjGfjsZdgz_qz);
// 查询基础值,
SjGfjsDxjcz sjGfjsDxjcz = new SjGfjsDxjcz();
sjGfjsDxjcz.setNd(nd);
List<SjGfjsDxjcz> jczlist = sjGfjsDxjczService.selectSjGfjsDxjczList(sjGfjsDxjcz);
Map<String, BigDecimal> jczMap = new HashMap<>();
for (SjGfjsDxjcz dxjcz : jczlist) {
try {
// 将基础值字符串转换为BigDecimal
BigDecimal jczValue = new BigDecimal(dxjcz.getJcz());
jczMap.put(dxjcz.getJb(), jczValue);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("基础值格式错误,级别:" + dxjcz.getJb() + ",值:" + dxjcz.getJcz(), e);
}
}
// 分档规则
SjGfjsFdgz sjGfjsFdgz = new SjGfjsFdgz();
sjGfjsFdgz.setNd(nd);
List<SjGfjsFdgz> fdgzlist = sjGfjsFdgzService.selectSjGfjsFdgzList(sjGfjsFdgz);
// 计算总得分 初始直接照全是A计算
BigDecimal totalScore = BigDecimal.ZERO;
for(int i=0;i<qzlist.size();i++){
SjGfjsZdgz qzxsMap = qzlist.get(i);
BigDecimal qzxs = new BigDecimal(qzxsMap.getKhnrfs());// 系数
BigDecimal baseValue = jczMap.get("A");
// 计算单项得分并累加
BigDecimal itemScore = qzxs.multiply(baseValue);
totalScore = totalScore.add(itemScore);
}
// 计算单位分档级别
String fdjb = "未知";
for (SjGfjsFdgz fdgz : fdgzlist) {
// 处理最小基础值(null或空字符串视为0)
BigDecimal minJcz = DEFAULT_MIN;
String minStr = fdgz.getMinjcz();
if (minStr != null && !minStr.trim().isEmpty()) {
minJcz = new BigDecimal(minStr.trim());
}
// 处理最大基础值(null或空字符串视为99999)
BigDecimal maxJcz = DEFAULT_MAX;
String maxStr = fdgz.getMaxjcz();
if (maxStr != null && !maxStr.trim().isEmpty()) {
maxJcz = new BigDecimal(maxStr.trim());
}
// 检查总分是否在当前分档的范围内(包含边界值)
// 比较规则:minJcz ≤ totalScore < maxJcz
if (totalScore.compareTo(minJcz) >= 0 && totalScore.compareTo(maxJcz) < 0) {
fdjb = fdgz.getJb(); // 返回匹配的级别
}
}
//查询主表信息
SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZbnew=new SjGfjsZsdwkhpjZb();
SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZb=new SjGfjsZsdwkhpjZb();
sjGfjsZsdwkhpjZb.setNd(nd);
sjGfjsZsdwkhpjZb.setDeptId(deptId);
sjGfjsZsdwkhpjZb.setZqfw(sjGfjsZsdwkhpj.getZqfw());
SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZbnew =sjGfjsZsdwkhpjZbService.selectSjGfjsZsdwkhpjZb(sjGfjsZsdwkhpjZb);
if(sjGfjsZsdwkhpjZbnew==null){
sjGfjsZsdwkhpjZbnew=new SjGfjsZsdwkhpjZb();
sjGfjsZsdwkhpjZbnew.setNd(nd);
sjGfjsZsdwkhpjZbnew.setDeptId(deptId);
sjGfjsZsdwkhpjZbnew.setParentDeptId(dept.getParentId());
......@@ -212,11 +146,9 @@ public class SjGfjsJcdwkhpjController extends BaseController
sjGfjsZsdwkhpjZbnew.setDeptDfl(dept.getDeptDfl());
sjGfjsZsdwkhpjZbnew.setDeptLx(dept.getDeptLx());
sjGfjsZsdwkhpjZbnew.setDeptYwfl(dept.getDeptYwfl());
sjGfjsZsdwkhpjZbnew.setZdf(totalScore);
sjGfjsZsdwkhpjZbnew.setZhdf(totalScore);
sjGfjsZsdwkhpjZbnew.setFdjb(fdjb);
sjGfjsZsdwkhpjZbnew.setZt("0");//未提交
sjGfjsZsdwkhpjZbService.insertSjGfjsZsdwkhpjZb(sjGfjsZsdwkhpjZbnew);
}
//先保存再查询
SjGfjsZdgz sjGfjsZdgz=new SjGfjsZdgz();
......@@ -249,7 +181,8 @@ public class SjGfjsJcdwkhpjController extends BaseController
zsdwkhpj.setYl1(i+1L);
zsdwkhpj.setKhfz("A");
//计算问题
List<String> collect = sjGfjsZsdwwtcjs.stream().filter(item -> item.getPjbzid().equals(zsdwkhpj.getPjbzid()))
List<String> collect = sjGfjsZsdwwtcjs.stream()
.filter(item -> item.getKhnr().equals(zsdwkhpj.getKhnr()) && item.getKhxd().equals(zsdwkhpj.getKhxd()))
.map(SjGfjsZsdwwtcj::getWtmc).collect(Collectors.toList());
zsdwkhpj.setSj(collect.size()+"");
zsdwkhpj.setWtms(String.join(";",collect));
......@@ -266,6 +199,7 @@ public class SjGfjsJcdwkhpjController extends BaseController
//查询考核评价
List<SjGfjsZsdwkhpj> resjGfjsZsdwkhpjs = sjGfjsZsdwkhpjService.selectSjGfjsZsdwkhpjList(sjGfjsZsdwkhpj);
//查询主表信息
SjGfjsZsdwkhpjZb zb = new SjGfjsZsdwkhpjZb();
if(resjGfjsZsdwkhpjs.size()>0){
......@@ -330,8 +264,6 @@ public class SjGfjsJcdwkhpjController extends BaseController
int m = 0;
Cell cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getKhnr());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getKhxd());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getPjbzmc());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getSj());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getWtms());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getKhfz());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getId());
......@@ -493,13 +425,13 @@ public class SjGfjsJcdwkhpjController extends BaseController
SjGfjsZsdwkhpj zsdwkhpj=new SjGfjsZsdwkhpj();
System.out.println(row);
//id
String id=new DataFormatter().formatCellValue(row.getCell(6));
String id=new DataFormatter().formatCellValue(row.getCell(4));
if(StringUtils.isEmpty(id)){
return AjaxResult.error("id不能为空");
}
zsdwkhpj.setId(Long.parseLong(id));
//主表id
String zbid=new DataFormatter().formatCellValue(row.getCell(7));
String zbid=new DataFormatter().formatCellValue(row.getCell(5));
if(StringUtils.isEmpty(zbid)){
return AjaxResult.error("主表id不能为空");
}
......@@ -510,16 +442,11 @@ public class SjGfjsJcdwkhpjController extends BaseController
String xd=new DataFormatter().formatCellValue(row.getCell(1));
zsdwkhpj.setKhxd(xd);
String pj=new DataFormatter().formatCellValue(row.getCell(2));
zsdwkhpj.setPjbzmc(pj);
//数量
String sl=new DataFormatter().formatCellValue(row.getCell(3));
zsdwkhpj.setSj(sl);
//问题描述
String wtms=new DataFormatter().formatCellValue(row.getCell(4));
String wtms=new DataFormatter().formatCellValue(row.getCell(2));
zsdwkhpj.setWtms(wtms);
//考核分值
String khfz=new DataFormatter().formatCellValue(row.getCell(5));
String khfz=new DataFormatter().formatCellValue(row.getCell(3));
zsdwkhpj.setKhfz(khfz);
list.add(zsdwkhpj);
......
......@@ -183,10 +183,9 @@ public class SjGfjsYdjcjlController extends BaseController
int m = 0;
int xh = 1;//第一列的序号
Cell cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(xh);
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(tmp.getWtmc());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(tmp.getKhnr());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(tmp.getKhxd());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(tmp.getPjbzmc());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(tmp.getWtmc());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(tmp.getZgzrr());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(tmp.getZgcs());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(tmp.getZgqx());
......@@ -282,49 +281,36 @@ public class SjGfjsYdjcjlController extends BaseController
}
zsdwwtcj.setDeptId(jl.getDeptId());
zsdwwtcj.setYl3(jl.getDeptId());
//问题描述
String wtms=new DataFormatter().formatCellValue(row.getCell(1)) ;
if(StringUtils.isEmpty(wtms)){
return AjaxResult.error("导入失败,第"+(i+1)+"行问题描述不能为空");
}
zsdwwtcj.setWtmc(wtms);
//考核内容
String khnr=new DataFormatter().formatCellValue(row.getCell(2)) ;
String khnr=new DataFormatter().formatCellValue(row.getCell(1)) ;
if(StringUtils.isEmpty(khnr)){
return AjaxResult.error("导入失败,第"+(i+1)+"行实施路径不能为空");
}
zsdwwtcj.setKhnr(khnr);
//考核项点
String khxd=new DataFormatter().formatCellValue(row.getCell(3)) ;
String khxd=new DataFormatter().formatCellValue(row.getCell(2)) ;
if(StringUtils.isEmpty(khxd)){
return AjaxResult.error("导入失败,第"+(i+1)+"行重点工作不能为空");
}
zsdwwtcj.setKhxd(khxd);
String pjbz=new DataFormatter().formatCellValue(row.getCell(4)) ;
if(StringUtils.isEmpty(pjbz)){
return AjaxResult.error("导入失败,第"+(i+1)+"行主要工作要求不能为空");
}
//匹配评价标准
String substring = pjbz.substring(6);
long l = Long.parseLong(substring);
SjGfjsZdgzCb sjGfjsZdGzCb=new SjGfjsZdgzCb();
sjGfjsZdGzCb.setKhxd(khxd);
sjGfjsZdGzCb.setKhnr(khnr);
sjGfjsZdGzCb.setPx(l);
sjGfjsZdGzCb.setNd(jl.getRq().substring(0,4));
SjGfjsZdgzCb cb=sjGfjsZdgzMapper.selectSjGfjsZdgzCb(sjGfjsZdGzCb);
if(cb==null){
return AjaxResult.error("导入失败,第"+(i+1)+"行未匹配到主要工作要求");
//问题描述
String wtms=new DataFormatter().formatCellValue(row.getCell(3)) ;
if(StringUtils.isEmpty(wtms)){
return AjaxResult.error("导入失败,第"+(i+1)+"行问题描述不能为空");
}
zsdwwtcj.setPjbzid(cb.getId()+"");
zsdwwtcj.setPjbzmc(cb.getPjbz());
String zgzrr=new DataFormatter().formatCellValue(row.getCell(5)) ;
zsdwwtcj.setWtmc(wtms);
String zgzrr=new DataFormatter().formatCellValue(row.getCell(4)) ;
zsdwwtcj.setZgzrr(zgzrr);
String zgcs=new DataFormatter().formatCellValue(row.getCell(6)) ;
String zgcs=new DataFormatter().formatCellValue(row.getCell(5)) ;
zsdwwtcj.setZgcs(zgcs);
String zgqx=new DataFormatter().formatCellValue(row.getCell(7)) ;
String zgqx=new DataFormatter().formatCellValue(row.getCell(6)) ;
zsdwwtcj.setZgqx(zgqx);
String zgzt=new DataFormatter().formatCellValue(row.getCell(8)) ;
String zgzt=new DataFormatter().formatCellValue(row.getCell(7)) ;
zsdwwtcj.setZgzt(zgzt);
zsdwwtcj.setJcjb("基层单位自查");
zsdwwtcj.setCreateTime(DateUtils.getNowDate());
......
......@@ -139,7 +139,9 @@ public class SjGfjsZdgzController extends BaseController
String nd = cb.getNd();
cb.setNd(nd.substring(0,4));
cb.setLx("基础");
return success(sjGfjsZdgzService.getKhxdList(cb));
List<String> rl = sjGfjsZdgzService.getKhxdList(cb);
rl.add("其他");//统一加其他
return success();
}
/**
......
......@@ -80,17 +80,6 @@ public class SjGfjsZsdwkhpjController extends BaseController
return getDataTable(list);
}
// 定义默认的最大值
private static final BigDecimal DEFAULT_MAX = new BigDecimal("99999");
// 定义默认的最小值
private static final BigDecimal DEFAULT_MIN = BigDecimal.ZERO;
@Autowired
private ISjGfjsZdgzService sjGfjsZdgzService;
@Autowired
private ISjGfjsDxjczService sjGfjsDxjczService;
@Autowired
private ISjGfjsFdgzService sjGfjsFdgzService;
/**
* 查询考核评价
* @return
......@@ -128,67 +117,14 @@ public class SjGfjsZsdwkhpjController extends BaseController
List<SjGfjsZsdwkhpj> sjGfjsZsdwkhpjs = sjGfjsZsdwkhpjService.selectSjGfjsZsdwkhpjList(sjGfjsZsdwkhpj);
// List<SjGfjsZsdwkhpj>
if(sjGfjsZsdwkhpjs.size()<=0){
// 查询权重系数,
SjGfjsZdgz sjGfjsZdgz_qz = new SjGfjsZdgz();
sjGfjsZdgz_qz.setNd(nd);
sjGfjsZdgz_qz.setLx("基础");
List<SjGfjsZdgz> qzlist = sjGfjsZdgzService.selectSjGfjsZdgzList(sjGfjsZdgz_qz);
// 查询基础值,
SjGfjsDxjcz sjGfjsDxjcz = new SjGfjsDxjcz();
sjGfjsDxjcz.setNd(nd);
List<SjGfjsDxjcz> jczlist = sjGfjsDxjczService.selectSjGfjsDxjczList(sjGfjsDxjcz);
Map<String, BigDecimal> jczMap = new HashMap<>();
for (SjGfjsDxjcz dxjcz : jczlist) {
try {
// 将基础值字符串转换为BigDecimal
BigDecimal jczValue = new BigDecimal(dxjcz.getJcz());
jczMap.put(dxjcz.getJb(), jczValue);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("基础值格式错误,级别:" + dxjcz.getJb() + ",值:" + dxjcz.getJcz(), e);
}
}
// 分档规则
SjGfjsFdgz sjGfjsFdgz = new SjGfjsFdgz();
sjGfjsFdgz.setNd(nd);
List<SjGfjsFdgz> fdgzlist = sjGfjsFdgzService.selectSjGfjsFdgzList(sjGfjsFdgz);
// 计算总得分 初始直接照全是A计算
BigDecimal totalScore = BigDecimal.ZERO;
for(int i=0;i<qzlist.size();i++){
SjGfjsZdgz qzxsMap = qzlist.get(i);
BigDecimal qzxs = new BigDecimal(qzxsMap.getKhnrfs());// 系数
BigDecimal baseValue = jczMap.get("A");
// 计算单项得分并累加
BigDecimal itemScore = qzxs.multiply(baseValue);
totalScore = totalScore.add(itemScore);
}
// 计算单位分档级别
String fdjb = "未知";
for (SjGfjsFdgz fdgz : fdgzlist) {
// 处理最小基础值(null或空字符串视为0)
BigDecimal minJcz = DEFAULT_MIN;
String minStr = fdgz.getMinjcz();
if (minStr != null && !minStr.trim().isEmpty()) {
minJcz = new BigDecimal(minStr.trim());
}
// 处理最大基础值(null或空字符串视为99999)
BigDecimal maxJcz = DEFAULT_MAX;
String maxStr = fdgz.getMaxjcz();
if (maxStr != null && !maxStr.trim().isEmpty()) {
maxJcz = new BigDecimal(maxStr.trim());
}
// 检查总分是否在当前分档的范围内(包含边界值)
// 比较规则:minJcz ≤ totalScore < maxJcz
if (totalScore.compareTo(minJcz) >= 0 && totalScore.compareTo(maxJcz) < 0) {
fdjb = fdgz.getJb(); // 返回匹配的级别
}
}
//查询主表信息
SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZbnew=new SjGfjsZsdwkhpjZb();
SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZb=new SjGfjsZsdwkhpjZb();
sjGfjsZsdwkhpjZb.setNd(nd);
sjGfjsZsdwkhpjZb.setDeptId(deptId);
sjGfjsZsdwkhpjZb.setZqfw(sjGfjsZsdwkhpj.getZqfw());
SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZbnew =sjGfjsZsdwkhpjZbService.selectSjGfjsZsdwkhpjZb(sjGfjsZsdwkhpjZb);
if(sjGfjsZsdwkhpjZbnew==null){
sjGfjsZsdwkhpjZbnew=new SjGfjsZsdwkhpjZb();
sjGfjsZsdwkhpjZbnew.setNd(nd);
sjGfjsZsdwkhpjZbnew.setDeptId(deptId);
sjGfjsZsdwkhpjZbnew.setParentDeptId(dept.getParentId());
......@@ -199,10 +135,8 @@ public class SjGfjsZsdwkhpjController extends BaseController
sjGfjsZsdwkhpjZbnew.setDeptLx(dept.getDeptLx());
sjGfjsZsdwkhpjZbnew.setDeptYwfl(dept.getDeptYwfl());
sjGfjsZsdwkhpjZbnew.setZt("0");//未提交
sjGfjsZsdwkhpjZbnew.setZdf(totalScore);
sjGfjsZsdwkhpjZbnew.setZhdf(totalScore);
sjGfjsZsdwkhpjZbnew.setFdjb(fdjb);
sjGfjsZsdwkhpjZbService.insertSjGfjsZsdwkhpjZb(sjGfjsZsdwkhpjZbnew);
}
//先保存再查询
SjGfjsZdgz sjGfjsZdgz=new SjGfjsZdgz();
......@@ -235,7 +169,8 @@ public class SjGfjsZsdwkhpjController extends BaseController
zsdwkhpj.setYl1(i+1L);
zsdwkhpj.setKhfz("A");
//计算问题
List<String> collect = sjGfjsZsdwwtcjs.stream().filter(item -> item.getPjbzid().equals(zsdwkhpj.getPjbzid()))
List<String> collect = sjGfjsZsdwwtcjs.stream()
.filter(item -> item.getKhnr().equals(zsdwkhpj.getKhnr()) && item.getKhxd().equals(zsdwkhpj.getKhxd()))
.map(SjGfjsZsdwwtcj::getWtmc).collect(Collectors.toList());
zsdwkhpj.setSj(collect.size()+"");
zsdwkhpj.setWtms(String.join(";",collect));
......@@ -253,6 +188,7 @@ public class SjGfjsZsdwkhpjController extends BaseController
List<SjGfjsZsdwkhpj> resjGfjsZsdwkhpjs = sjGfjsZsdwkhpjService.selectSjGfjsZsdwkhpjList(sjGfjsZsdwkhpj);
//查询主表信息
SjGfjsZsdwkhpjZb zb = new SjGfjsZsdwkhpjZb();
if(resjGfjsZsdwkhpjs.size()>0){
......@@ -317,8 +253,6 @@ public class SjGfjsZsdwkhpjController extends BaseController
int m = 0;
Cell cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getKhnr());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getKhxd());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getPjbzmc());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getSj());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getWtms());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getKhfz());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getId());
......@@ -480,13 +414,13 @@ public class SjGfjsZsdwkhpjController extends BaseController
SjGfjsZsdwkhpj zsdwkhpj=new SjGfjsZsdwkhpj();
System.out.println(row);
//id
String id=new DataFormatter().formatCellValue(row.getCell(6));
String id=new DataFormatter().formatCellValue(row.getCell(4));
if(StringUtils.isEmpty(id)){
return AjaxResult.error("id不能为空");
}
zsdwkhpj.setId(Long.parseLong(id));
//主表id
String zbid=new DataFormatter().formatCellValue(row.getCell(7));
String zbid=new DataFormatter().formatCellValue(row.getCell(5));
if(StringUtils.isEmpty(zbid)){
return AjaxResult.error("主表id不能为空");
}
......@@ -498,16 +432,16 @@ public class SjGfjsZsdwkhpjController extends BaseController
String xd=new DataFormatter().formatCellValue(row.getCell(1));
zsdwkhpj.setKhxd(xd);
String pj=new DataFormatter().formatCellValue(row.getCell(2));
zsdwkhpj.setPjbzmc(pj);
// String pj=new DataFormatter().formatCellValue(row.getCell(2));
// zsdwkhpj.setPjbzmc(pj);
String sl=new DataFormatter().formatCellValue(row.getCell(3));
zsdwkhpj.setSj(sl);
// String sl=new DataFormatter().formatCellValue(row.getCell(3));
// zsdwkhpj.setSj(sl);
//问题描述
String wtms=new DataFormatter().formatCellValue(row.getCell(4));
String wtms=new DataFormatter().formatCellValue(row.getCell(2));
zsdwkhpj.setWtms(wtms);
//考核分值
String khfz=new DataFormatter().formatCellValue(row.getCell(5));
String khfz=new DataFormatter().formatCellValue(row.getCell(3));
zsdwkhpj.setKhfz(khfz);
list.add(zsdwkhpj);
......
......@@ -210,42 +210,29 @@ public class SjGfjsZsdwwtcjController extends BaseController
return AjaxResult.error("导入失败,第"+(i+1)+"行未匹配到三级单位");
}
zsdwwtcj.setDeptId(sjdept.getDeptId());
//问题描述
String wtms=new DataFormatter().formatCellValue(row.getCell(3)) ;
if(StringUtils.isEmpty(wtms)){
return AjaxResult.error("导入失败,第"+(i+1)+"行问题描述不能为空");
}
zsdwwtcj.setWtmc(wtms);
//考核内容
String khnr=new DataFormatter().formatCellValue(row.getCell(4)) ;
String khnr=new DataFormatter().formatCellValue(row.getCell(3)) ;
if(StringUtils.isEmpty(khnr)){
return AjaxResult.error("导入失败,第"+(i+1)+"行实施路径不能为空");
}
zsdwwtcj.setKhnr(khnr);
//考核项点
String khxd=new DataFormatter().formatCellValue(row.getCell(5)) ;
String khxd=new DataFormatter().formatCellValue(row.getCell(4)) ;
if(StringUtils.isEmpty(khxd)){
return AjaxResult.error("导入失败,第"+(i+1)+"行重点工作不能为空");
}
zsdwwtcj.setKhxd(khxd);
String pjbz=new DataFormatter().formatCellValue(row.getCell(6)) ;
if(StringUtils.isEmpty(pjbz)){
return AjaxResult.error("导入失败,第"+(i+1)+"行主要工作要求不能为空");
}
//匹配评价标准
String substring = pjbz.substring(6);
long l = Long.parseLong(substring);
SjGfjsZdgzCb sjGfjsZdgzCb=new SjGfjsZdgzCb();
sjGfjsZdgzCb.setKhxd(khxd);
sjGfjsZdgzCb.setKhnr(khnr);
sjGfjsZdgzCb.setPx(l);
sjGfjsZdgzCb.setNd(rq.substring(0,4));
SjGfjsZdgzCb cb=sjGfjsZdgzMapper.selectSjGfjsZdgzCb(sjGfjsZdgzCb);
if(cb==null){
return AjaxResult.error("导入失败,第"+(i+1)+"行未匹配到主要工作要求");
//问题描述
String wtms=new DataFormatter().formatCellValue(row.getCell(5)) ;
if(StringUtils.isEmpty(wtms)){
return AjaxResult.error("导入失败,第"+(i+1)+"行问题描述不能为空");
}
zsdwwtcj.setPjbzid(cb.getId()+"");
zsdwwtcj.setPjbzmc(cb.getPjbz());
zsdwwtcj.setWtmc(wtms);
String zgzrr=new DataFormatter().formatCellValue(row.getCell(7)) ;
zsdwwtcj.setZgzrr(zgzrr);
String zgcs=new DataFormatter().formatCellValue(row.getCell(8)) ;
......
......@@ -146,94 +146,13 @@ public class SjGfjsZsdwkhpjServiceImpl implements ISjGfjsZsdwkhpjService
private static final BigDecimal DEFAULT_MIN = BigDecimal.ZERO;
@Override
public int pledit(List<SjGfjsZsdwkhpj> list) {
//计算分数
SjGfjsZsdwkhpj sjGfjsZsdwkhpj = list.get(0);
SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZb = sjGfjsZsdwkhpjZbMapper.selectSjGfjsZsdwkhpjZbById(sjGfjsZsdwkhpj.getZbId());
String nd = sjGfjsZsdwkhpjZb.getNd();
// 查询权重系数,
SjGfjsZdgz sjGfjsZdgz_qz = new SjGfjsZdgz();
sjGfjsZdgz_qz.setNd(nd);
sjGfjsZdgz_qz.setLx("基础");
List<SjGfjsZdgz> qzlist = sjGfjsZdgzService.selectSjGfjsZdgzList(sjGfjsZdgz_qz);
// 查询基础值,
SjGfjsDxjcz sjGfjsDxjcz = new SjGfjsDxjcz();
sjGfjsDxjcz.setNd(nd);
List<SjGfjsDxjcz> jczlist = sjGfjsDxjczService.selectSjGfjsDxjczList(sjGfjsDxjcz);
Map<String, BigDecimal> jczMap = new HashMap<>();
for (SjGfjsDxjcz dxjcz : jczlist) {
try {
// 将基础值字符串转换为BigDecimal
BigDecimal jczValue = new BigDecimal(dxjcz.getJcz());
jczMap.put(dxjcz.getJb(), jczValue);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("基础值格式错误,级别:" + dxjcz.getJb() + ",值:" + dxjcz.getJcz(), e);
}
}
// 分档规则
SjGfjsFdgz sjGfjsFdgz = new SjGfjsFdgz();
sjGfjsFdgz.setNd(nd);
List<SjGfjsFdgz> fdgzlist = sjGfjsFdgzService.selectSjGfjsFdgzList(sjGfjsFdgz);
// 计算总得分
BigDecimal totalScore = BigDecimal.ZERO;
for(int i=0;i<qzlist.size();i++){
SjGfjsZdgz qzxsMap = qzlist.get(i);
BigDecimal qzxs = new BigDecimal(qzxsMap.getKhnrfs());// 系数
String khxd = qzxsMap.getKhxd();
List<SjGfjsZsdwkhpj> filteredDetails = list.stream().filter(item -> khxd.equals(item.getKhxd())).collect(Collectors.toList());
// 计算小项得分总和
BigDecimal xmTotal = BigDecimal.ZERO;
int validCount = 0;
for (SjGfjsZsdwkhpj detail : filteredDetails) {
String khfz = detail.getKhfz(); // 小项ABCD结果
BigDecimal jcz = jczMap.get(khfz);
xmTotal = xmTotal.add(jcz);
validCount++;
}
// 计算小项平均分(如果没有有效小项,得分为0)
BigDecimal avgScore = BigDecimal.ZERO;
if (validCount > 0) {
avgScore = xmTotal.divide(new BigDecimal(validCount), 2, RoundingMode.HALF_UP);
}
// 计算单项得分并累加
BigDecimal itemScore = qzxs.multiply(avgScore);
totalScore = totalScore.add(itemScore);
}
// 计算单位分档级别
String fdjb = "未知";
for (SjGfjsFdgz fdgz : fdgzlist) {
// 处理最小基础值(null或空字符串视为0)
BigDecimal minJcz = DEFAULT_MIN;
String minStr = fdgz.getMinjcz();
if (minStr != null && !minStr.trim().isEmpty()) {
minJcz = new BigDecimal(minStr.trim());
}
// 处理最大基础值(null或空字符串视为99999)
BigDecimal maxJcz = DEFAULT_MAX;
String maxStr = fdgz.getMaxjcz();
if (maxStr != null && !maxStr.trim().isEmpty()) {
maxJcz = new BigDecimal(maxStr.trim());
}
// 检查总分是否在当前分档的范围内(包含边界值)
// 比较规则:minJcz ≤ totalScore < maxJcz
if (totalScore.compareTo(minJcz) >= 0 && totalScore.compareTo(maxJcz) < 0) {
fdjb = fdgz.getJb(); // 返回匹配的级别
}
}
sjGfjsZsdwkhpjZb.setZdf(totalScore);
sjGfjsZsdwkhpjZb.setZhdf(totalScore);
sjGfjsZsdwkhpjZb.setFdjb(fdjb);
//更新主表
sjGfjsZsdwkhpjZbMapper.updateSjGfjsZsdwkhpjZb(sjGfjsZsdwkhpjZb);
// //计算分数
// SjGfjsZsdwkhpj sjGfjsZsdwkhpj = list.get(0);
// SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZb = sjGfjsZsdwkhpjZbMapper.selectSjGfjsZsdwkhpjZbById(sjGfjsZsdwkhpj.getZbId());
//
//
// //更新主表
// sjGfjsZsdwkhpjZbMapper.updateSjGfjsZsdwkhpjZb(sjGfjsZsdwkhpjZb);
//更新详情
int mxint = sjGfjsZsdwkhpjMapper.pledit(list);
......
......@@ -114,11 +114,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
limit 1
</select>
<select id="selectSjGfjsZdgzCxBzList" resultType="com.qianhe.domain.SjGfjsZdgzCb">
select b.id, a.khnr,a.khxd,b.pjbz
select a.khnr,a.khxd
from sj_gfjs_zdgz a
left join sj_gfjs_zdgz_cb b on a.id = b.zb_id
left join sj_gfjs_zdgz_cb b on a.id = b.zb_id
where 1=1
and a.lx=#{lx} and a.nd =#{nd}
group by a.khnr,a.khxd
order by (case when a.khnr='党建引领' then 1 when a.khnr='素质提升' then 2 when a.khnr='管理精益' then 3 else 4 end) ,a.xppx,b.px
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment