|
|
|
@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
|
|
|
|
|
import com.ruoyi.bgt.domain.BgtProjectRecruitApply;
|
|
|
|
|
import com.ruoyi.bgt.domain.BgtProjectTaskProgress;
|
|
|
|
|
import com.ruoyi.bgt.domain.BgtWageApplication;
|
|
|
|
@ -20,13 +21,16 @@ import com.ruoyi.common.enums.RecruitApplyStatus;
|
|
|
|
|
import com.ruoyi.common.enums.SubcontractingApplyStatus;
|
|
|
|
|
import com.ruoyi.common.exception.BaseException;
|
|
|
|
|
import com.ruoyi.common.util.DataUtil;
|
|
|
|
|
import com.ruoyi.common.util.ValidUtil;
|
|
|
|
|
import com.ruoyi.common.utils.PageUtils;
|
|
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
|
|
import com.ruoyi.fbs.domain.FbsMessage;
|
|
|
|
|
import com.ruoyi.fbs.domain.FbsProjectTask;
|
|
|
|
|
import com.ruoyi.fbs.domain.FbsWageApplication;
|
|
|
|
|
import com.ruoyi.fbs.domain.dto.FbsProgressListDTO;
|
|
|
|
|
import com.ruoyi.fbs.domain.dto.FbsProjectListDTO;
|
|
|
|
|
import com.ruoyi.fbs.domain.vo.*;
|
|
|
|
|
import com.ruoyi.fbs.service.IFbsMessageService;
|
|
|
|
|
import com.ruoyi.fbs.service.IFbsProjectTaskService;
|
|
|
|
|
import com.ruoyi.fbs.service.IFbsWageApplicationService;
|
|
|
|
|
import com.ruoyi.wgz.domain.WgzPayCalculation;
|
|
|
|
@ -51,6 +55,14 @@ import java.time.LocalDate;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import static com.ruoyi.common.constants.BgtMessageConstant.HEADLINE;
|
|
|
|
|
import static com.ruoyi.common.constants.BgtMessageConstant.SUBHEADING;
|
|
|
|
|
import static com.ruoyi.common.constants.FbsMessageConstant.FBS_LARGE_OTHER;
|
|
|
|
|
import static com.ruoyi.common.constants.FbsMessageConstant.FBS_SMALL_SYSTEM;
|
|
|
|
|
import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*;
|
|
|
|
|
import static com.ruoyi.common.constants.ZbfMessageConstant.ZBF_REMIND;
|
|
|
|
|
import static com.ruoyi.common.constants.ZbfMessageConstant.zbfMessage;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 总包方项目Service业务层处理
|
|
|
|
|
*
|
|
|
|
@ -82,6 +94,8 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl<ZbfProjectMapper, Zbf
|
|
|
|
|
private IWgzPayCalculationService wgzPayCalculationService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IZbfUserService zbfUserService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IFbsMessageService fbsMessageService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ZbfProject queryById(Long id) {
|
|
|
|
@ -584,6 +598,12 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl<ZbfProjectMapper, Zbf
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public Boolean add(ZbfProjectAddDTO dto) {
|
|
|
|
|
if (!ValidUtil.verifyCreditCode(dto.getCreditCode())) {
|
|
|
|
|
throw new BaseException("统一社会信用代码格式不正确");
|
|
|
|
|
}
|
|
|
|
|
if (!ValidUtil.isValidChineseMobile(dto.getContactPhone())) {
|
|
|
|
|
throw new BaseException("手机号格式不正确");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//校验
|
|
|
|
|
Long appUserId = SecurityUtils.getAppUserId();
|
|
|
|
@ -615,6 +635,12 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl<ZbfProjectMapper, Zbf
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public Boolean edit(ZbfProjectAddDTO dto) {
|
|
|
|
|
if (!ValidUtil.verifyCreditCode(dto.getCreditCode())) {
|
|
|
|
|
throw new BaseException("统一社会信用代码格式不正确");
|
|
|
|
|
}
|
|
|
|
|
if (!ValidUtil.isValidChineseMobile(dto.getContactPhone())) {
|
|
|
|
|
throw new BaseException("手机号格式不正确");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//校验
|
|
|
|
|
//获取项目下的所有有人申请的分包
|
|
|
|
@ -647,7 +673,7 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl<ZbfProjectMapper, Zbf
|
|
|
|
|
sectionUpdateIds.add(section.getId());
|
|
|
|
|
}
|
|
|
|
|
for (ZbfProjectSubcontractingAddDTO sub : section.getSubList()) {
|
|
|
|
|
ZbfProjectSubcontracting projectSubcontracting = BeanUtil.copyProperties(sub, ZbfProjectSubcontracting.class, "id");
|
|
|
|
|
ZbfProjectSubcontracting projectSubcontracting = BeanUtil.copyProperties(sub, ZbfProjectSubcontracting.class);
|
|
|
|
|
projectSubcontracting.setProjectId(dto.getId());
|
|
|
|
|
projectSubcontracting.setSectionId(projectSection.getId());
|
|
|
|
|
if (sub.getId() == null) {
|
|
|
|
@ -781,10 +807,9 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl<ZbfProjectMapper, Zbf
|
|
|
|
|
wrapper.eq(ZbfProject::getUserId, SecurityUtils.getAppUserId());
|
|
|
|
|
List<ZbfProject> list = list(wrapper);
|
|
|
|
|
zbfProjectCountVO.setAllCount(list.size());
|
|
|
|
|
long startCount = list.stream().filter(zbfProject -> StrUtil.equals(zbfProject.getProjectStatus(), ProjectStatus.START.getCode())).count();
|
|
|
|
|
long completeCount = list.stream().filter(zbfProject -> StrUtil.equals(zbfProject.getProjectStatus(), ProjectStatus.COMPLETE.getCode())).count();
|
|
|
|
|
zbfProjectCountVO.setStartCount((int) startCount);
|
|
|
|
|
zbfProjectCountVO.setCompleteCount((int) completeCount);
|
|
|
|
|
zbfProjectCountVO.setStartCount(zbfProjectCountVO.getAllCount()-zbfProjectCountVO.getCompleteCount());
|
|
|
|
|
return zbfProjectCountVO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -958,4 +983,47 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl<ZbfProjectMapper, Zbf
|
|
|
|
|
Page<ZbfProject> result = page(PageUtils.buildPage(), wrapper);
|
|
|
|
|
return PageUtils.buildDataInfo(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean checkBeforeComplete(Long projectId) {
|
|
|
|
|
List<FbsProjectTask> list = fbsProjectTaskService.list(Wrappers.<FbsProjectTask>lambdaQuery()
|
|
|
|
|
.eq(FbsProjectTask::getProjectId, projectId)
|
|
|
|
|
.ne(FbsProjectTask::getStatus,ProjectStatus.COMPLETE.getCode())
|
|
|
|
|
);
|
|
|
|
|
return CollectionUtil.isEmpty(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean sendRemindMessage(Long projectId) {
|
|
|
|
|
List<FbsProjectTask> list = fbsProjectTaskService.list(Wrappers.<FbsProjectTask>lambdaQuery()
|
|
|
|
|
.eq(FbsProjectTask::getProjectId, projectId)
|
|
|
|
|
.ne(FbsProjectTask::getStatus,ProjectStatus.COMPLETE.getCode())
|
|
|
|
|
);
|
|
|
|
|
if (CollectionUtil.isEmpty(list)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ArrayList<FbsMessage> messages = new ArrayList<>();
|
|
|
|
|
for (FbsProjectTask task : list) {
|
|
|
|
|
//总包方发消息到分包商
|
|
|
|
|
HashMap<String, String> zmp = new HashMap<>();
|
|
|
|
|
zmp.put("projectName", task.getTaskName());
|
|
|
|
|
zmp.put("auditor", SecurityUtils.getUsername());
|
|
|
|
|
Map<String, String> zmap = zbfMessage(zmp, ZBF_REMIND, true);
|
|
|
|
|
FbsMessage fbsMessage = new FbsMessage()
|
|
|
|
|
.setSenderType(USERTYPE_ZBF)
|
|
|
|
|
.setSenderId(SecurityUtils.getAppUserId())
|
|
|
|
|
.setRecipientType(USERTYPE_FBS)
|
|
|
|
|
.setRecipientId(task.getCreateId())
|
|
|
|
|
.setHeadline(zmap.get(HEADLINE))
|
|
|
|
|
.setSubheading(zmap.get(SUBHEADING))
|
|
|
|
|
.setTableId(task.getId())
|
|
|
|
|
.setTableName(SqlHelper.table(FbsProjectTask.class).getTableName())
|
|
|
|
|
.setMessageLargeType(FBS_LARGE_OTHER)
|
|
|
|
|
.setMessageSmallType(FBS_SMALL_SYSTEM)
|
|
|
|
|
.setIsOperation(OPERATION_NO);
|
|
|
|
|
messages.add(fbsMessage);
|
|
|
|
|
}
|
|
|
|
|
return fbsMessageService.saveBatch(messages);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|