|
|
@@ -39,6 +39,9 @@ import com.xunmei.system.domain.SysWorkTimeSet;
|
|
|
import com.xunmei.system.service.ISysWorkTimeSetService;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import static com.xunmei.common.core.web.domain.AjaxResult.error;
|
|
|
+import static com.xunmei.common.core.web.domain.AjaxResult.success;
|
|
|
+
|
|
|
/**
|
|
|
* 作息设置Service业务层处理
|
|
|
*
|
|
|
@@ -265,8 +268,16 @@ public class SysWorkTimeSetServiceImpl extends ServiceImpl<SysWorkTimeSetMapper,
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
- public String add(SysWorkTimeSet request) {
|
|
|
+ public AjaxResult add(SysWorkTimeSet request) {
|
|
|
List<Long> orgIds = request.getOrgIds();
|
|
|
+ for (Long oid :
|
|
|
+ orgIds) {
|
|
|
+ List<SysWorkTimeSet> sysWorkTimeSets = baseMapper.selectList(new LambdaQueryWrapper<SysWorkTimeSet>().eq(SysWorkTimeSet::getOrgId, oid).eq(SysWorkTimeSet::getEffectiveDate, request.getEffectiveDate()));
|
|
|
+
|
|
|
+ if (sysWorkTimeSets.size()>0){
|
|
|
+ return error("机构'" + orgService.getById(oid).getName() + "'已存在选择时间的作息模板");
|
|
|
+ }
|
|
|
+ }
|
|
|
int year = Calendar.getInstance().get(Calendar.YEAR);
|
|
|
|
|
|
if (request.getEffectiveDate() != null) {
|
|
|
@@ -325,7 +336,7 @@ public class SysWorkTimeSetServiceImpl extends ServiceImpl<SysWorkTimeSetMapper,
|
|
|
changeOrgWorkTime(sets, dayOfWeeks, request.getEffectiveDate(), orgIds, request.getCheckDataResult());
|
|
|
}
|
|
|
}
|
|
|
- return "ok";
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
private void changeOrgWorkTime(List<SysWorkTimeSet> sets, List<SysWorkTimeSetDayofweek> dayOfWeeks, Date effectiveDate, List<Long> orgIds, Integer checkDataResult) {
|
|
|
@@ -449,7 +460,7 @@ public class SysWorkTimeSetServiceImpl extends ServiceImpl<SysWorkTimeSetMapper,
|
|
|
}, true);
|
|
|
|
|
|
|
|
|
- workTimeService.remove(new LambdaQueryWrapper<SysWorkTime>().eq(SysWorkTime::getOrgId,orgId).ge(SysWorkTime::getYmdDate,workTimeList.get(0).getDate()).eq(SysWorkTime::getIsManual,0));
|
|
|
+ workTimeService.remove(new LambdaQueryWrapper<SysWorkTime>().eq(SysWorkTime::getOrgId, orgId).ge(SysWorkTime::getYmdDate, workTimeList.get(0).getDate()).eq(SysWorkTime::getIsManual, 0));
|
|
|
List<SysWorkTime> exit = workTimeService.getBaseMapper().selectList(new LambdaQueryWrapper<SysWorkTime>().eq(SysWorkTime::getOrgId, orgId).ge(SysWorkTime::getYmdDate, workTimeList.get(0).getDate()).eq(SysWorkTime::getIsManual, 1));
|
|
|
//去掉workTimeList中orgId和ymd相同的数据
|
|
|
List<SysWorkTime> list1 = workTimeList.stream().filter(s -> {
|
|
|
@@ -477,7 +488,7 @@ public class SysWorkTimeSetServiceImpl extends ServiceImpl<SysWorkTimeSetMapper,
|
|
|
for (SysWorkTime s2 :
|
|
|
exit) {
|
|
|
if (s.getYmdDate().compareTo(s2.getYmdDate()) == 0) {
|
|
|
- BeanUtils.copyProperties(s2,s);
|
|
|
+ BeanUtils.copyProperties(s2, s);
|
|
|
}
|
|
|
}
|
|
|
}
|