|
|
@@ -14,6 +14,7 @@ import com.xjrsoft.module.student.dto.BaseStudentPunishmentInfoMobilePageDto;
|
|
|
import com.xjrsoft.module.student.dto.BaseStudentPunishmentInfoPageDto;
|
|
|
import com.xjrsoft.module.student.dto.UpdateBaseStudentPunishmentInfoDto;
|
|
|
import com.xjrsoft.module.student.entity.BasePunishmentStudentHandle;
|
|
|
+import com.xjrsoft.module.student.entity.BasePunishmentType;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudentPunishmentInfo;
|
|
|
import com.xjrsoft.module.student.service.IBasePunishmentStudentHandleService;
|
|
|
import com.xjrsoft.module.student.service.IBasePunishmentTypeService;
|
|
|
@@ -36,8 +37,11 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @title: 学生处分信息管理
|
|
|
@@ -127,7 +131,24 @@ public class BaseStudentPunishmentInfoController {
|
|
|
new QueryWrapper<BasePunishmentStudentHandle>().lambda()
|
|
|
.eq(BasePunishmentStudentHandle::getBaseStudentPunishmentInfoId, id)
|
|
|
);
|
|
|
- return RT.ok(BeanUtil.copyToList(list, BasePunishmentStudentHandleVo.class));
|
|
|
+
|
|
|
+ Map<Long, String> punishmentTypeMap = punishmentTypeService.list().stream().collect(Collectors.toMap(BasePunishmentType::getId, BasePunishmentType::getPunishmentType));
|
|
|
+
|
|
|
+ List<BasePunishmentStudentHandleVo> resultList = new ArrayList<>();
|
|
|
+ for (BasePunishmentStudentHandle el : list) {
|
|
|
+ BasePunishmentStudentHandleVo bean = BeanUtil.toBean(el, BasePunishmentStudentHandleVo.class);
|
|
|
+ String adjustType = null;
|
|
|
+ if(el.getAdjustType() == 1){
|
|
|
+ adjustType = "升级(" + punishmentTypeMap.get(el.getPunishmentTypeId()) + ")";
|
|
|
+ }else if(el.getAdjustType() == 2){
|
|
|
+ adjustType = "降级(" + punishmentTypeMap.get(el.getPunishmentTypeId()) + ")";
|
|
|
+ }else if(el.getAdjustType() == 3){
|
|
|
+ adjustType = "撤销(" + punishmentTypeMap.get(el.getPunishmentTypeId()) + ")";
|
|
|
+ }
|
|
|
+ bean.setAdjustType(adjustType);
|
|
|
+ resultList.add(bean);
|
|
|
+ }
|
|
|
+ return RT.ok(resultList);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/handle")
|
|
|
@@ -138,12 +159,6 @@ public class BaseStudentPunishmentInfoController {
|
|
|
handle.setCreateDate(new Date());
|
|
|
handle.setBaseStudentPunishmentInfoId(dto.getPunishmentInfoId());
|
|
|
boolean save = handleService.save(handle);
|
|
|
- if(dto.getPunishmentTypeId() != null){
|
|
|
- BaseStudentPunishmentInfo punishmentInfo = baseStudentPunishmentInfoService.getById(dto.getPunishmentInfoId());
|
|
|
- punishmentInfo.setPunishmentTypeId(dto.getPunishmentTypeId());
|
|
|
- punishmentInfo.setModifyDate(new Date());
|
|
|
- baseStudentPunishmentInfoService.updateById(punishmentInfo);
|
|
|
- }
|
|
|
|
|
|
return RT.ok(save);
|
|
|
}
|