|
@@ -7,9 +7,12 @@ import com.qmth.sop.business.bean.result.SysDingGroupResult;
|
|
|
import com.qmth.sop.business.entity.SysDingGroup;
|
|
|
import com.qmth.sop.business.entity.SysDingObj;
|
|
|
import com.qmth.sop.business.entity.SysUser;
|
|
|
+import com.qmth.sop.business.entity.TBService;
|
|
|
import com.qmth.sop.business.mapper.SysDingGroupMapper;
|
|
|
import com.qmth.sop.business.service.SysDingGroupService;
|
|
|
import com.qmth.sop.business.service.SysDingObjService;
|
|
|
+import com.qmth.sop.business.service.TBServiceService;
|
|
|
+import com.qmth.sop.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.sop.common.enums.ServiceStatusEnum;
|
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -17,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* 考勤组表 服务实现.
|
|
@@ -32,6 +36,8 @@ public class SysDingGroupServiceImpl extends ServiceImpl<SysDingGroupMapper, Sys
|
|
|
|
|
|
@Resource
|
|
|
SysDingObjService sysDingObjService;
|
|
|
+ @Resource
|
|
|
+ TBServiceService tbServiceService;
|
|
|
|
|
|
/**
|
|
|
* 查询列表
|
|
@@ -41,7 +47,7 @@ public class SysDingGroupServiceImpl extends ServiceImpl<SysDingGroupMapper, Sys
|
|
|
*/
|
|
|
@Override
|
|
|
public IPage<SysDingGroupResult> query(IPage<Map> iPage, Long serviceId, ServiceStatusEnum status, Long[] supplierIds, Long[] dingRoleIds, Long[] approveRoleIds, Boolean faceOpen, Long createStartTime, Long createEndTime) {
|
|
|
- IPage<SysDingGroupResult> dingGroupResultIPage = this.baseMapper.query(iPage, serviceId,status,supplierIds,dingRoleIds,approveRoleIds,faceOpen,createStartTime,createEndTime);
|
|
|
+ IPage<SysDingGroupResult> dingGroupResultIPage = this.baseMapper.query(iPage, serviceId, status, supplierIds, dingRoleIds, approveRoleIds, faceOpen, createStartTime, createEndTime);
|
|
|
dingGroupResultIPage.getRecords().forEach(e -> {
|
|
|
e.setDingObjs(sysDingObjService.getList(e.getId()));
|
|
|
});
|
|
@@ -96,8 +102,21 @@ public class SysDingGroupServiceImpl extends ServiceImpl<SysDingGroupMapper, Sys
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void delete(Long id) {
|
|
|
- sysDingObjService.remove(new QueryWrapper<SysDingObj>().lambda().eq(SysDingObj::getDingGroupId, id));
|
|
|
- this.removeById(id);
|
|
|
+ SysDingGroup sysDingGroup = this.getById(id);
|
|
|
+ if (Objects.nonNull(sysDingGroup)) {
|
|
|
+ Long serviceId = sysDingGroup.getServiceId();
|
|
|
+ if (Objects.nonNull(serviceId)) {
|
|
|
+ TBService tbService = tbServiceService.getById(serviceId);
|
|
|
+ if (Objects.nonNull(tbService)) {
|
|
|
+ ServiceStatusEnum serviceStatus = tbService.getStatus();
|
|
|
+ if (!ServiceStatusEnum.NEW.equals(serviceStatus)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("只有[" + ServiceStatusEnum.NEW.getTitle() + "]状态的服务单元可以删除考勤组");
|
|
|
+ }
|
|
|
+ sysDingObjService.remove(new QueryWrapper<SysDingObj>().lambda().eq(SysDingObj::getDingGroupId, id));
|
|
|
+ this.removeById(id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|