forked from liweijie/education
课表模板新增的时候报错修复
This commit is contained in:
+37
-37
@@ -26,8 +26,8 @@ public class KCBMBServiceImpl implements KCBMBService {
|
||||
public PageResult<KCBMBB> page(PageQuery query, String mbmc) {
|
||||
Page<KCBMBB> page = new Page<>(query.getPageNum(), query.getPageSize());
|
||||
LambdaQueryWrapper<KCBMBB> qw = new LambdaQueryWrapper<KCBMBB>()
|
||||
.like(mbmc != null && !mbmc.isEmpty(), KCBMBB::getMBMC, mbmc)
|
||||
.orderByDesc(KCBMBB::getGXSJ);
|
||||
.like(mbmc != null && !mbmc.isEmpty(), KCBMBB::getMbmc, mbmc)
|
||||
.orderByDesc(KCBMBB::getGxsj);
|
||||
Page<KCBMBB> result = kcbmbbMapper.selectPage(page, qw);
|
||||
return new PageResult<>(result.getRecords(), result.getTotal(), query.getPageNum(), query.getPageSize());
|
||||
}
|
||||
@@ -39,15 +39,15 @@ public class KCBMBServiceImpl implements KCBMBService {
|
||||
|
||||
@Override
|
||||
public void add(KCBMBB tpl) {
|
||||
if (tpl.getMBMC() == null || tpl.getMBMC().isEmpty()) {
|
||||
if (tpl.getMbmc() == null || tpl.getMbmc().isEmpty()) {
|
||||
throw new BusinessException("模版名称不能为空");
|
||||
}
|
||||
tpl.setBH(UuidUtil.getUUID());
|
||||
tpl.setGXSJ(LocalDateTime.now());
|
||||
if (tpl.getMBKY() == null) {
|
||||
tpl.setMBKY(true);
|
||||
tpl.setBh(UuidUtil.getUUID());
|
||||
tpl.setGxsj(LocalDateTime.now());
|
||||
if (tpl.getMbky() == null) {
|
||||
tpl.setMbky(true);
|
||||
}
|
||||
tpl.setMBCZ(tpl.getMB() != null && !tpl.getMB().isEmpty());
|
||||
tpl.setMbcz(tpl.getMb() != null && !tpl.getMb().isEmpty());
|
||||
applyLayoutDefaults(tpl);
|
||||
kcbmbbMapper.insert(tpl);
|
||||
}
|
||||
@@ -57,39 +57,39 @@ public class KCBMBServiceImpl implements KCBMBService {
|
||||
* 未填写时给占位值,上传者取当前登录账号。
|
||||
*/
|
||||
private void applyLayoutDefaults(KCBMBB tpl) {
|
||||
if (tpl.getBTWZ() == null || tpl.getBTWZ().isEmpty()) tpl.setBTWZ("0");
|
||||
if (tpl.getZYXXWZ() == null || tpl.getZYXXWZ().isEmpty()) tpl.setZYXXWZ("0");
|
||||
if (tpl.getKBSJHH() == null || tpl.getKBSJHH().isEmpty()) tpl.setKBSJHH("0");
|
||||
if (tpl.getMWLWZ() == null || tpl.getMWLWZ().isEmpty()) tpl.setMWLWZ("0");
|
||||
if (tpl.getKCHWZ() == null || tpl.getKCHWZ().isEmpty()) tpl.setKCHWZ("0");
|
||||
if (tpl.getKCXHLWZ() == null || tpl.getKCXHLWZ().isEmpty()) tpl.setKCXHLWZ("0");
|
||||
if (tpl.getKCMCLWZ() == null || tpl.getKCMCLWZ().isEmpty()) tpl.setKCMCLWZ("0");
|
||||
if (tpl.getKCJCLWZ() == null || tpl.getKCJCLWZ().isEmpty()) tpl.setKCJCLWZ("0");
|
||||
if (tpl.getKCXSLWZ() == null || tpl.getKCXSLWZ().isEmpty()) tpl.setKCXSLWZ("0");
|
||||
if (tpl.getKCLXLWZ() == null || tpl.getKCLXLWZ().isEmpty()) tpl.setKCLXLWZ("0");
|
||||
if (tpl.getKCZRJYSLWZ() == null || tpl.getKCZRJYSLWZ().isEmpty()) tpl.setKCZRJYSLWZ("0");
|
||||
if (tpl.getKCZRJYLWZ() == null || tpl.getKCZRJYLWZ().isEmpty()) tpl.setKCZRJYLWZ("0");
|
||||
if (tpl.getKCSKJYLWZ() == null || tpl.getKCSKJYLWZ().isEmpty()) tpl.setKCSKJYLWZ("0");
|
||||
if (tpl.getKCRSLWZ() == null || tpl.getKCRSLWZ().isEmpty()) tpl.setKCRSLWZ("0");
|
||||
if (tpl.getKCCDLWZ() == null || tpl.getKCCDLWZ().isEmpty()) tpl.setKCCDLWZ("0");
|
||||
if (tpl.getQJBZWZ() == null || tpl.getQJBZWZ().isEmpty()) tpl.setQJBZWZ("0");
|
||||
if (tpl.getSCZ() == null || tpl.getSCZ().isEmpty()) {
|
||||
if (tpl.getBtwz() == null || tpl.getBtwz().isEmpty()) tpl.setBtwz("0");
|
||||
if (tpl.getZyxxwz() == null || tpl.getZyxxwz().isEmpty()) tpl.setZyxxwz("0");
|
||||
if (tpl.getKbsjhh() == null || tpl.getKbsjhh().isEmpty()) tpl.setKbsjhh("0");
|
||||
if (tpl.getMwlwz() == null || tpl.getMwlwz().isEmpty()) tpl.setMwlwz("0");
|
||||
if (tpl.getKchwz() == null || tpl.getKchwz().isEmpty()) tpl.setKchwz("0");
|
||||
if (tpl.getKcxhlwz() == null || tpl.getKcxhlwz().isEmpty()) tpl.setKcxhlwz("0");
|
||||
if (tpl.getKcmclwz() == null || tpl.getKcmclwz().isEmpty()) tpl.setKcmclwz("0");
|
||||
if (tpl.getKcjclwz() == null || tpl.getKcjclwz().isEmpty()) tpl.setKcjclwz("0");
|
||||
if (tpl.getKcxslwz() == null || tpl.getKcxslwz().isEmpty()) tpl.setKcxslwz("0");
|
||||
if (tpl.getKclxlwz() == null || tpl.getKclxlwz().isEmpty()) tpl.setKclxlwz("0");
|
||||
if (tpl.getKczrjyslwz() == null || tpl.getKczrjyslwz().isEmpty()) tpl.setKczrjyslwz("0");
|
||||
if (tpl.getKczrjylwz() == null || tpl.getKczrjylwz().isEmpty()) tpl.setKczrjylwz("0");
|
||||
if (tpl.getKcskjylwz() == null || tpl.getKcskjylwz().isEmpty()) tpl.setKcskjylwz("0");
|
||||
if (tpl.getKcrslwz() == null || tpl.getKcrslwz().isEmpty()) tpl.setKcrslwz("0");
|
||||
if (tpl.getKccdlwz() == null || tpl.getKccdlwz().isEmpty()) tpl.setKccdlwz("0");
|
||||
if (tpl.getQjbzwz() == null || tpl.getQjbzwz().isEmpty()) tpl.setQjbzwz("0");
|
||||
if (tpl.getScz() == null || tpl.getScz().isEmpty()) {
|
||||
try {
|
||||
tpl.setSCZ(com.roomroot.common.utils.SecurityUtils.getUsername());
|
||||
tpl.setScz(com.roomroot.common.utils.SecurityUtils.getUsername());
|
||||
} catch (Exception e) {
|
||||
tpl.setSCZ("system");
|
||||
tpl.setScz("system");
|
||||
}
|
||||
}
|
||||
if (tpl.getXSYJ() == null) tpl.setXSYJ(false);
|
||||
if (tpl.getXsyj() == null) tpl.setXsyj(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(KCBMBB tpl) {
|
||||
if (tpl.getBH() == null || tpl.getBH().isEmpty()) {
|
||||
if (tpl.getBh() == null || tpl.getBh().isEmpty()) {
|
||||
throw new BusinessException("模版编号不能为空");
|
||||
}
|
||||
tpl.setGXSJ(LocalDateTime.now());
|
||||
tpl.setMBCZ(tpl.getMB() != null && !tpl.getMB().isEmpty());
|
||||
tpl.setGxsj(LocalDateTime.now());
|
||||
tpl.setMbcz(tpl.getMb() != null && !tpl.getMb().isEmpty());
|
||||
kcbmbbMapper.updateById(tpl);
|
||||
}
|
||||
|
||||
@@ -104,21 +104,21 @@ public class KCBMBServiceImpl implements KCBMBService {
|
||||
if (tpl == null) {
|
||||
throw new BusinessException("模版不存在:" + bh);
|
||||
}
|
||||
tpl.setMBKY(enabled);
|
||||
tpl.setGXSJ(LocalDateTime.now());
|
||||
tpl.setMbky(enabled);
|
||||
tpl.setGxsj(LocalDateTime.now());
|
||||
kcbmbbMapper.updateById(tpl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KCBMBB> options() {
|
||||
return kcbmbbMapper.selectList(new LambdaQueryWrapper<KCBMBB>()
|
||||
.eq(KCBMBB::getMBKY, true)
|
||||
.orderByDesc(KCBMBB::getGXSJ))
|
||||
.eq(KCBMBB::getMbky, true)
|
||||
.orderByDesc(KCBMBB::getGxsj))
|
||||
.stream()
|
||||
.map(t -> {
|
||||
KCBMBB o = new KCBMBB();
|
||||
o.setBH(t.getBH());
|
||||
o.setMBMC(t.getMBMC());
|
||||
o.setBh(t.getBh());
|
||||
o.setMbmc(t.getMbmc());
|
||||
return o;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
+5
-5
@@ -293,7 +293,7 @@ public class TimetableGridServiceImpl implements TimetableGridService {
|
||||
}
|
||||
SSKC course = courses.get(l.getSskcbh());
|
||||
KB kb = course == null ? null : kbByKbh.get(course.getKmbh());
|
||||
if (tpl != null && Boolean.FALSE.equals(tpl.getKBBHXX())
|
||||
if (tpl != null && Boolean.FALSE.equals(tpl.getKbbhxx())
|
||||
&& kb != null && kb.getKclx() != null && kb.getKclx().contains("选修")) {
|
||||
continue;
|
||||
}
|
||||
@@ -315,7 +315,7 @@ public class TimetableGridServiceImpl implements TimetableGridService {
|
||||
TimetableGridVO.Day day = new TimetableGridVO.Day();
|
||||
day.setDate(date.format(DAY));
|
||||
day.setWeekday(wd);
|
||||
if (tpl != null && tpl.getZXXSTS() != null && tpl.getZXXSTS() <= 5 && wd > tpl.getZXXSTS()) {
|
||||
if (tpl != null && tpl.getZxxsts() != null && tpl.getZxxsts() <= 5 && wd > tpl.getZxxsts()) {
|
||||
// 模板「纵向显示天数」截断周末列
|
||||
continue;
|
||||
}
|
||||
@@ -610,9 +610,9 @@ public class TimetableGridServiceImpl implements TimetableGridService {
|
||||
}
|
||||
if (tpl != null) {
|
||||
periods = periods.stream().filter(p -> {
|
||||
if (Boolean.FALSE.equals(tpl.getZXXS78J()) && (p.getJc() == 7 || p.getJc() == 8)) return false;
|
||||
if (Boolean.FALSE.equals(tpl.getZXXSWS()) && "晚上".equals(p.getSd())) return false;
|
||||
if (Boolean.FALSE.equals(tpl.getXSYJ()) && "夜间".equals(p.getSd())) return false;
|
||||
if (Boolean.FALSE.equals(tpl.getZxxs78j()) && (p.getJc() == 7 || p.getJc() == 8)) return false;
|
||||
if (Boolean.FALSE.equals(tpl.getZxxsws()) && "晚上".equals(p.getSd())) return false;
|
||||
if (Boolean.FALSE.equals(tpl.getXsyj()) && "夜间".equals(p.getSd())) return false;
|
||||
return true;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user