评分保存修改
parent
3de7f0e535
commit
b0f7b5eed1
|
|
@ -9,8 +9,10 @@ import com.gunshi.project.xyt.service.AssessTaskService;
|
||||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||||
import com.gunshi.project.xyt.validate.markers.Update;
|
import com.gunshi.project.xyt.validate.markers.Update;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
@ -103,6 +105,12 @@ public class AssessTaskController extends AbstractCommonFileController{
|
||||||
return R.ok(service.result(id));
|
return R.ok(service.result(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "考核结果导出")
|
||||||
|
@GetMapping("/result/export")
|
||||||
|
public void resultExport(@RequestParam("id") @Parameter(description = "考核任务id") Long id, HttpServletResponse response) {
|
||||||
|
service.resultExport(id,response);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGroupId() {
|
public String getGroupId() {
|
||||||
return "assessTask";
|
return "assessTask";
|
||||||
|
|
|
||||||
|
|
@ -19,15 +19,18 @@ public class AssessResultVo {
|
||||||
private String objectUserName;
|
private String objectUserName;
|
||||||
|
|
||||||
@ExcelProperty({"考核类目"})
|
@ExcelProperty({"考核类目"})
|
||||||
|
@ColumnWidth(15)
|
||||||
private String categoryName;
|
private String categoryName;
|
||||||
|
|
||||||
@ExcelProperty({"指标名称"})
|
@ExcelProperty({"指标名称"})
|
||||||
|
@ColumnWidth(15)
|
||||||
private String indicatorName;
|
private String indicatorName;
|
||||||
|
|
||||||
@ExcelProperty({"扣分"})
|
@ExcelProperty({"扣分"})
|
||||||
private BigDecimal deductScore;
|
private BigDecimal deductScore;
|
||||||
|
|
||||||
@ExcelProperty({"考核得分"})
|
@ExcelProperty({"考核得分"})
|
||||||
|
@ColumnWidth(15)
|
||||||
private BigDecimal resScore;
|
private BigDecimal resScore;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,4 +108,27 @@ public class AssessTeamRating implements Serializable {
|
||||||
@Schema(description = "现场图片")
|
@Schema(description = "现场图片")
|
||||||
private List<FileAssociations> files;
|
private List<FileAssociations> files;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 整改状态(0未整改 1已整改)
|
||||||
|
*/
|
||||||
|
@TableField(value="rectify_status")
|
||||||
|
@Schema(description="整改状态(0未整改 1已整改)")
|
||||||
|
private Integer rectifyStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 完成日期
|
||||||
|
*/
|
||||||
|
@TableField(value="finish_date")
|
||||||
|
@Schema(description="完成日期")
|
||||||
|
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD, timezone = "GMT+8")
|
||||||
|
private Date finishDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 整改说明
|
||||||
|
*/
|
||||||
|
@TableField(value="rectify_desc")
|
||||||
|
@Schema(description="整改说明")
|
||||||
|
@Size(max = 500,message = "整改说明最大长度要小于 500")
|
||||||
|
private String rectifyDesc;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -14,6 +14,8 @@ import com.gunshi.project.xyt.model.AssessObject;
|
||||||
import com.gunshi.project.xyt.model.AssessTask;
|
import com.gunshi.project.xyt.model.AssessTask;
|
||||||
import com.gunshi.project.xyt.model.AssessTeam;
|
import com.gunshi.project.xyt.model.AssessTeam;
|
||||||
import com.gunshi.project.xyt.model.AssessTemplate;
|
import com.gunshi.project.xyt.model.AssessTemplate;
|
||||||
|
import com.gunshi.project.xyt.util.ExcelUtil;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -188,6 +190,11 @@ public class AssessTaskService extends ServiceImpl<AssessTaskMapper, AssessTask>
|
||||||
list.stream().forEach(o->o.setDeductScore(new BigDecimal(o.getStandardScore()).subtract(o.getAssessScore())));
|
list.stream().forEach(o->o.setDeductScore(new BigDecimal(o.getStandardScore()).subtract(o.getAssessScore())));
|
||||||
return list.stream().filter(o->o.getDeductScore().compareTo(new BigDecimal(0)) > 0).collect(Collectors.toList());
|
return list.stream().filter(o->o.getDeductScore().compareTo(new BigDecimal(0)) > 0).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resultExport(Long id, HttpServletResponse response) {
|
||||||
|
List<AssessResultVo> list = this.result(id);
|
||||||
|
ExcelUtil.exportExcel(list,"考核结果",AssessResultVo.class,1,new int[]{0,4},response,"考核结果");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -171,10 +171,12 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
|
||||||
fileService.saveFile(rating.getFiles(), getGroupId(), rating.getId().toString());
|
fileService.saveFile(rating.getFiles(), getGroupId(), rating.getId().toString());
|
||||||
}
|
}
|
||||||
Long teamId = ratings.get(0).getTeamId();
|
Long teamId = ratings.get(0).getTeamId();
|
||||||
|
this.delData(teamId);
|
||||||
AssessTeam assessTeam = teamMapper.selectById(teamId);
|
AssessTeam assessTeam = teamMapper.selectById(teamId);
|
||||||
|
assessTeam.setAssessScore(vo.getScore());
|
||||||
assessTeam.setStatus(9);
|
assessTeam.setStatus(9);
|
||||||
teamMapper.updateById(assessTeam);
|
teamMapper.updateById(assessTeam);
|
||||||
return this.saveBatch(ratings);
|
return this.saveOrUpdateBatch(ratings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Long,List<AssessRatingVo>> scoreDetail(Long objectId) {
|
public Map<Long,List<AssessRatingVo>> scoreDetail(Long objectId) {
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,29 @@ public class ExcelUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> void exportExcel(List<T> list, String filename, Class<T> clazz,int mergeRowIndex, int[] mergeColumnIndex, HttpServletResponse response, String sheetName) {
|
||||||
|
OutputStream out = null;
|
||||||
|
try {
|
||||||
|
out = getOutputStream(filename, response);
|
||||||
|
ExcelWriterSheetBuilder builder = EasyExcel.write(out, clazz)
|
||||||
|
//是否自动关闭流
|
||||||
|
.autoCloseStream(Boolean.FALSE)
|
||||||
|
//自动列宽(不太精确)
|
||||||
|
.registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex, mergeColumnIndex))
|
||||||
|
.sheet(sheetName);
|
||||||
|
builder.doWrite(list);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (out != null) {
|
||||||
|
out.flush();
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException("导出Excel异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出excel,合并指定单元格
|
* 导出excel,合并指定单元格
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue