heheng
2025-01-06 56287f4037defafbd3a3bbebd1827fd20a8b91d4
assess-system/src/main/java/com/gkhy/assess/system/service/impl/AssWorkNotificationServiceImpl.java
@@ -3,8 +3,10 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.assess.common.exception.ApiException;
import com.gkhy.assess.system.domain.AssWorkNotification;
import com.gkhy.assess.system.enums.AccessoryFileTypeEnum;
import com.gkhy.assess.system.enums.ReportProgressEnum;
import com.gkhy.assess.system.mapper.AssWorkNotificationMapper;
import com.gkhy.assess.system.service.AssAccessoryFileService;
import com.gkhy.assess.system.service.AssProjectService;
import com.gkhy.assess.system.service.AssWorkNotificationService;
import com.gkhy.assess.system.utils.ShiroUtils;
@@ -24,13 +26,18 @@
public class AssWorkNotificationServiceImpl extends ServiceImpl<AssWorkNotificationMapper, AssWorkNotification> implements AssWorkNotificationService {
    @Autowired
    private AssProjectService projectService;
    @Autowired
    private AssAccessoryFileService accessoryFileService;
    @Override
    @Transactional(rollbackFor = RuntimeException.class)
    public int addWorkNotification(AssWorkNotification workNotification) {
        Long projectId=workNotification.getProjectId();
        projectService.checkUserAllowed(projectId);
        checkWorkNotificationCount(projectId);
        Integer fileCount=accessoryFileService.getAccessoryFileCountByProjectId(projectId,null, AccessoryFileTypeEnum.EMPLOYMENT_NOTICE.getCode());
        if(fileCount==0){
            throw new ApiException("未上传从业告知书");
        }
        //校验项目状态
        projectService.checkReportProgress(projectId, ReportProgressEnum.ESTIMATE_PLAN);
        workNotification.setCreateBy(ShiroUtils.getSysUser().getUsername());