diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectTaskApplyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectTaskApplyController.java index e86e9c5..ae7bba2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectTaskApplyController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectTaskApplyController.java @@ -42,9 +42,9 @@ public class AppBgtProjectTaskApplyController extends BaseController { @ApiOperation("App取消申请项目任务") - @Log(title = "App取消申请项目任务" , businessType = BusinessType.DELETE) - @DeleteMapping() - public AjaxResult cancelApply(BgtTaskApplyDTO dto) { + @Log(title = "App取消申请项目任务" , businessType = BusinessType.UPDATE) + @PutMapping() + public AjaxResult cancelApply(@Validated @RequestBody BgtTaskApplyDTO dto) { return AjaxResult.success(iFbsProjectTaskApplyService.cancelApply(dto)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/AppLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/AppLoginController.java index 34ab2f7..e20c608 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/AppLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/AppLoginController.java @@ -4,11 +4,10 @@ import cn.hutool.core.lang.Validator; import com.ruoyi.bgt.service.IBgtUserService; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.entity.BgtUser; -import com.ruoyi.common.core.domain.entity.SysDictData; -import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.entity.*; import com.ruoyi.common.core.domain.model.BgtLoginBody; import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.service.ICompanyService; import com.ruoyi.common.util.DataUtil; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.ServletUtils; @@ -19,6 +18,7 @@ import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.system.service.ISysDictTypeService; import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.wgz.service.IWgzUserService; +import com.ruoyi.zbf.service.IZbfUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -64,8 +64,13 @@ public class AppLoginController @Autowired private IFbsUserService fbsUserService; + @Autowired + private IZbfUserService zbfUserService; + @Autowired private ISysDictTypeService dictTypeService; + @Autowired + private ICompanyService companyService; /** * 登录方法 @@ -108,7 +113,14 @@ public class AppLoginController ajax.put("user", wgzUserService.userLongIn(user.getPhonenumber())); break; case Constants.FBS: - ajax.put("user", fbsUserService.selectUserByPhone(user.getPhonenumber())); + FbsUser fbsUser = fbsUserService.selectUserByPhone(user.getPhonenumber()); + fbsUser.setCompanyName(companyService.getCompanyNameById(fbsUser.getCompanyId())); + ajax.put("user", fbsUser); + break; + case Constants.ZBF: + ZbfUser zbfUser = zbfUserService.selectUserByPhone(user.getPhonenumber()); + zbfUser.setCompanyName(companyService.getCompanyNameById(zbfUser.getCompanyId())); + ajax.put("user", zbfUser); break; default: break; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CompanyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CompanyController.java new file mode 100644 index 0000000..4ebebd4 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CompanyController.java @@ -0,0 +1,52 @@ +package com.ruoyi.web.controller.common; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.domain.Company; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.service.ICompanyService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotNull; + +/** + * 企业认证Controller + * + * @author ruoyi + * @date 2025-03-26 + */ +@Api(value = "企业认证控制器", tags = {"企业认证管理"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RestController +@RequestMapping("/common/company") +public class CompanyController extends BaseController { + + private final ICompanyService iCommonCompanyService; + + + /** + * 获取企业认证详细信息 + */ + @ApiOperation("获取企业认证详细信息") + @GetMapping("/{id}") + public AjaxResult getInfo(@NotNull(message = "主键不能为空") + @PathVariable("id") Long id) { + return AjaxResult.success(iCommonCompanyService.queryById(id)); + } + + @ApiOperation("修改企业认证") + @Log(title = "企业认证", businessType = BusinessType.UPDATE) + @RepeatSubmit + @PutMapping() + public AjaxResult edit(@Validated @RequestBody Company bo) { + return AjaxResult.success(iCommonCompanyService.update(bo)); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectController.java index b3a4a45..cf95bbc 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectController.java @@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.fbs.domain.dto.FbsProjectListDTO; import com.ruoyi.fbs.domain.vo.FbsProjectDetailVO; +import com.ruoyi.fbs.domain.vo.FbsProjectListCountVO; import com.ruoyi.fbs.domain.vo.FbsProjectListVO; import com.ruoyi.zbf.service.IZbfProjectService; import io.swagger.annotations.Api; @@ -40,7 +41,7 @@ public class AppFbsProjectController extends BaseController { @ApiOperation("分包商查询自己的项目列表") @GetMapping("/myList") - public TableDataInfo applyList(FbsProjectListDTO dto) { + public TableDataInfo myList(FbsProjectListDTO dto) { if(dto.getType()==0){ return zbfProjectService.applyList(dto); } else if (dto.getType()==1) { @@ -49,6 +50,11 @@ public class AppFbsProjectController extends BaseController { return zbfProjectService.completeList(dto); } } + @ApiOperation("分包商查询自己的项目列表数量统计") + @GetMapping("/myListCount") + public AjaxResult myListCount() { + return AjaxResult.success(zbfProjectService.myListCount()); + } @ApiOperation("分包商查看可报名项目详情") @GetMapping("/signUp/{id}") @@ -71,10 +77,11 @@ public class AppFbsProjectController extends BaseController { return AjaxResult.success(zbfProjectService.joinOrCompleteDetail(id)); } - - - - + @ApiOperation("分包商查询我的项目列表-项目切换") + @GetMapping("/switchList") + public TableDataInfo switchList(FbsProjectListDTO dto) { + return zbfProjectService.switchList(dto); + } // diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/FbsProjectSectionController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectSectionController.java similarity index 89% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/FbsProjectSectionController.java rename to ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectSectionController.java index 92ce451..71905ac 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/FbsProjectSectionController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectSectionController.java @@ -24,11 +24,11 @@ import org.springframework.web.bind.annotation.RestController; @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/app/fbs/section") -public class FbsProjectSectionController extends BaseController { +public class AppFbsProjectSectionController extends BaseController { private final IZbfProjectSectionService iZbfProjectSectionService; - @ApiOperation("分包商查询自己的项目分包列表") + @ApiOperation("分包商查询自己的项目分包列表-分包切换") @GetMapping("/fbsSubList") public TableDataInfo fbsSubList(@Validated FbsProjectSectionListDTO dto) { return iZbfProjectSectionService.fbsSubList(dto); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectSubcontractingController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectSubcontractingController.java index 5544046..866eb38 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectSubcontractingController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectSubcontractingController.java @@ -1,8 +1,11 @@ package com.ruoyi.web.controller.fbs; +import cn.hutool.core.bean.BeanUtil; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.fbs.domain.vo.FbsProjectSubcontractingDetailVO; import com.ruoyi.zbf.domain.ZbfProjectSubcontracting; +import com.ruoyi.zbf.service.IZbfProjectSectionService; import com.ruoyi.zbf.service.IZbfProjectSubcontractingService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -28,12 +31,16 @@ import javax.validation.constraints.NotNull; public class AppFbsProjectSubcontractingController extends BaseController { private final IZbfProjectSubcontractingService iZbfProjectSubcontractingService; + private final IZbfProjectSectionService zbfProjectSectionService; @ApiOperation("分包商查询项目分包详细信息") @GetMapping("/{id}") - public AjaxResult getInfo(@NotNull(message = "主键不能为空") + public AjaxResult getInfo(@NotNull(message = "主键不能为空") @PathVariable("id") Long id) { - return AjaxResult.success(iZbfProjectSubcontractingService.queryById(id)); + ZbfProjectSubcontracting zbfProjectSubcontracting = iZbfProjectSubcontractingService.queryById(id); + FbsProjectSubcontractingDetailVO vo = BeanUtil.copyProperties(zbfProjectSubcontracting, FbsProjectSubcontractingDetailVO.class); + vo.setSectionName(zbfProjectSectionService.getById(vo.getSectionId()).getSectionName()); + return AjaxResult.success(vo); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectTaskApplyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectTaskApplyController.java new file mode 100644 index 0000000..98fdf65 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectTaskApplyController.java @@ -0,0 +1,42 @@ +package com.ruoyi.web.controller.fbs; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.fbs.service.IFbsProjectTaskApplyService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotNull; + +/** + * 分包商项目任务申请Controller + * + * @author ruoyi + * @date 2025-02-17 + */ +@Api(value = "App分包商项目任务申请控制器", tags = {"App分包商"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RestController +@RequestMapping("/app/fbs/apply") +public class AppFbsProjectTaskApplyController extends BaseController { + + private final IFbsProjectTaskApplyService iFbsProjectTaskApplyService; + + + @ApiOperation("分包商选择包工头") + @Log(title = "分包商选择包工头", businessType = BusinessType.UPDATE) + @RepeatSubmit + @PutMapping("/{id}") + public AjaxResult choose(@NotNull(message = "主键不能为空") + @PathVariable("id") Long id) { + return AjaxResult.success(iFbsProjectTaskApplyService.choose(id)); + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectTaskController.java index c7a2277..baccff5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectTaskController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectTaskController.java @@ -71,6 +71,11 @@ public class AppFbsProjectTaskController extends BaseController { public TableDataInfo list(@Validated FbsTaskListDTO dto) { return iFbsProjectTaskService.fbsPageList(dto); } + @ApiOperation("分包商查询任务列表数量统计") + @GetMapping("/listCount") + public AjaxResult listCount() { + return AjaxResult.success(iFbsProjectTaskService.fbsListCount()); + } @ApiOperation("分包商查询任务详情-基础信息") @GetMapping("/base/{id}") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectTaskProgressController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectTaskProgressController.java index 857c78b..e43efdd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectTaskProgressController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectTaskProgressController.java @@ -58,8 +58,9 @@ public class AppFbsProjectTaskProgressController extends BaseController { @RepeatSubmit @PutMapping() public AjaxResult edit(@Validated @RequestBody FbsProjectTaskProgressAuditDTO dto) { - BgtProjectTaskProgress bo = BeanUtil.copyProperties(dto, BgtProjectTaskProgress.class); - return AjaxResult.success(iBgtProjectTaskProgressService.update(bo)); + BgtProjectTaskProgress bo = iBgtProjectTaskProgressService.getById(dto.getId()); + BeanUtil.copyProperties(dto, bo); + return AjaxResult.success(iBgtProjectTaskProgressService.fbsAudit(bo)); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsUserController.java index e2917dc..38dc884 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsUserController.java @@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.RestController; * @author ruoyi * @date 2025-03-26 */ -@Api(value = "APP分包商用户控制器", tags = {"APP分包商"}) +@Api(value = "App分包商用户控制器", tags = {"App分包商"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/app/fbs/user") @@ -36,7 +36,7 @@ public class AppFbsUserController extends BaseController { @Log(title = "分包商企业认证", businessType = BusinessType.UPDATE) @RepeatSubmit @PutMapping() - public AjaxResult edit(@Validated @RequestBody CompanyAuthenticateDTO dto) { + public AjaxResult edit(@Validated @RequestBody CompanyAuthenticateDTO dto) { return AjaxResult.success(iFbsUserService.authenticate(dto)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsWageApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsWageApplicationController.java index faf699c..3ad2240 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsWageApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsWageApplicationController.java @@ -16,7 +16,6 @@ import com.ruoyi.fbs.domain.dto.FbsWageApplicationListDTO; import com.ruoyi.fbs.domain.dto.FbsWageAuditDTO; import com.ruoyi.fbs.domain.dto.FbsWageAuditListDTO; import com.ruoyi.fbs.service.IFbsWageApplicationService; -import com.ruoyi.zbf.service.IZbfProjectService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -40,7 +39,6 @@ public class AppFbsWageApplicationController extends BaseController { private final IFbsWageApplicationService iFbsWageApplicationService; private final IBgtWageApplicationService iBgtWageApplicationService; - private final IZbfProjectService iZbfProjectService; @ApiOperation("分包商查询自己的工资申请列表") @GetMapping("/list") @@ -87,7 +85,7 @@ public class AppFbsWageApplicationController extends BaseController { public AjaxResult audit(@Validated @RequestBody FbsWageAuditDTO dto) { BgtWageApplication bo = iBgtWageApplicationService.getById(dto.getId()); BeanUtil.copyProperties(dto, bo); - return AjaxResult.success(iBgtWageApplicationService.update(bo)); + return AjaxResult.success(iBgtWageApplicationService.fbsAudit(bo)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zbf/AppZbfProjectController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zbf/AppZbfProjectController.java new file mode 100644 index 0000000..d8374d2 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zbf/AppZbfProjectController.java @@ -0,0 +1,57 @@ +package com.ruoyi.web.controller.zbf; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.zbf.domain.dto.ZbfProjectAddDTO; +import com.ruoyi.zbf.domain.dto.ZbfProjectListDTO; +import com.ruoyi.zbf.domain.vo.ZbfProjectCountVO; +import com.ruoyi.zbf.domain.vo.ZbfProjectListVO; +import com.ruoyi.zbf.service.IZbfProjectService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * 总包方项目Controller + * + * @author ruoyi + * @date 2025-02-17 + */ +@Api(value = "App总包方项目控制器", tags = {"App总包方"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RestController +@RequestMapping("/app/zbf/project") +public class AppZbfProjectController extends BaseController { + + private final IZbfProjectService iZbfProjectService; + + + @ApiOperation("总包方新增项目") + @Log(title = "总包方新增项目", businessType = BusinessType.INSERT) + @RepeatSubmit + @PostMapping() + public AjaxResult add(@Validated @RequestBody ZbfProjectAddDTO dto) { + return AjaxResult.success(iZbfProjectService.add(dto)); + } + + @ApiOperation("总包方查询我的项目列表") + @GetMapping("/list") + public TableDataInfo list(@Validated ZbfProjectListDTO dto) { + return iZbfProjectService.queryZbfList(dto); + } + + @ApiOperation("总包方查询自建项目统计") + @GetMapping("/count") + public AjaxResult projectCount() { + return AjaxResult.success(iZbfProjectService.projectCount()); + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zbf/AppZbfProjectSubcontractingApplyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zbf/AppZbfProjectSubcontractingApplyController.java new file mode 100644 index 0000000..1ea208d --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zbf/AppZbfProjectSubcontractingApplyController.java @@ -0,0 +1,45 @@ +package com.ruoyi.web.controller.zbf; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.zbf.service.IZbfProjectSubcontractingApplyService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.constraints.NotNull; + +/** + * 总包方项目分包申请Controller + * + * @author ruoyi + * @date 2025-03-26 + */ +@Api(value = "App总包方项目分包申请控制器", tags = {"App总包方"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RestController +@RequestMapping("/app/zbf/apply") +public class AppZbfProjectSubcontractingApplyController extends BaseController { + + private final IZbfProjectSubcontractingApplyService iZbfProjectSubcontractingApplyService; + + + @ApiOperation("总包方选择分包商") + @Log(title = "总包方选择分包商", businessType = BusinessType.UPDATE) + @RepeatSubmit + @PutMapping("/{id}") + public AjaxResult choose(@NotNull(message = "主键不能为空") + @PathVariable("id") Long id) { + return toAjax(iZbfProjectSubcontractingApplyService.choose(id)); + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zbf/ZbfUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zbf/ZbfUserController.java new file mode 100644 index 0000000..640ef1d --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zbf/ZbfUserController.java @@ -0,0 +1,109 @@ +package com.ruoyi.web.controller.zbf; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.ZbfUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.zbf.bo.ZbfUserQueryBo; +import com.ruoyi.zbf.service.IZbfUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.Arrays; +import java.util.List; + +/** + * APP总包方用户Controller + * + * @author ruoyi + * @date 2025-03-31 + */ +@Api(value = "总包方用户控制器", tags = {"总包方用户管理"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RestController +@RequestMapping("/zbf/user") +public class ZbfUserController extends BaseController { + + private final IZbfUserService iZbfUserService; + + /** + * 查询APP总包方用户列表 + */ + @ApiOperation("查询APP总包方用户列表") + @PreAuthorize("@ss.hasPermi('zbf:user:list')") + @GetMapping("/list") + public TableDataInfo list(@Validated ZbfUserQueryBo bo) { + return iZbfUserService.queryPageList(bo); + } + + /** + * 导出APP总包方用户列表 + */ + @ApiOperation("导出APP总包方用户列表") + @PreAuthorize("@ss.hasPermi('zbf:user:export')") + @Log(title = "APP总包方用户", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(@Validated ZbfUserQueryBo bo) { + List list = iZbfUserService.queryList(bo); + ExcelUtil util = new ExcelUtil(ZbfUser.class); + return util.exportExcel(list, "APP总包方用户"); + } + + /** + * 获取APP总包方用户详细信息 + */ + @ApiOperation("获取APP总包方用户详细信息") + @PreAuthorize("@ss.hasPermi('zbf:user:query')") + @GetMapping("/{id}") + public AjaxResult getInfo(@NotNull(message = "主键不能为空") + @PathVariable("id") Long id) { + return AjaxResult.success(iZbfUserService.queryById(id)); + } + + /** + * 新增APP总包方用户 + */ + @ApiOperation("新增APP总包方用户") + @PreAuthorize("@ss.hasPermi('zbf:user:add')") + @Log(title = "APP总包方用户", businessType = BusinessType.INSERT) + @RepeatSubmit + @PostMapping() + public AjaxResult add(@Validated @RequestBody ZbfUser bo) { + return toAjax(iZbfUserService.insert(bo) ? 1 : 0); + } + + /** + * 修改APP总包方用户 + */ + @ApiOperation("修改APP总包方用户") + @PreAuthorize("@ss.hasPermi('zbf:user:edit')") + @Log(title = "APP总包方用户", businessType = BusinessType.UPDATE) + @RepeatSubmit + @PutMapping() + public AjaxResult edit(@Validated @RequestBody ZbfUser bo) { + return toAjax(iZbfUserService.update(bo) ? 1 : 0); + } + + /** + * 删除APP总包方用户 + */ + @ApiOperation("删除APP总包方用户") + @PreAuthorize("@ss.hasPermi('zbf:user:remove')") + @Log(title = "APP总包方用户" , businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ids) { + return toAjax(iZbfUserService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index fb654ce..d2f1330 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -138,9 +138,15 @@ public class Constants public static final String REDIS_LOCK_KEY = "redis_lock:"; /** - * 包工头用户标志 前缀 + * 总包方用户标志 前缀 + */ + public static final String ZBF = "zbf"; + + /** + * 分包商用户标志 前缀 */ public static final String FBS = "fbs"; + /** * 包工头用户标志 前缀 */ diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/FbsUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/FbsUser.java index b352a80..e662c16 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/FbsUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/FbsUser.java @@ -156,4 +156,8 @@ public class FbsUser implements Serializable { @ApiModelProperty("备注") private String remark; + @ApiModelProperty("公司名称") + @TableField(exist = false) + private String companyName; + } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/ZbfUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/ZbfUser.java new file mode 100644 index 0000000..ec48d1f --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/ZbfUser.java @@ -0,0 +1,163 @@ +package com.ruoyi.common.core.domain.entity; + +import com.ruoyi.common.annotation.Excel; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import java.io.Serializable; + +import java.time.LocalDateTime; + +/** + * APP总包方用户对象 zbf_user + * + * @author ruoyi + * @date 2025-03-31 + */ +@Data +@NoArgsConstructor +@Accessors(chain = true) +@TableName("zbf_user") +@ApiModel("APP总包方用户视图对象") +public class ZbfUser implements Serializable { + + private static final long serialVersionUID=1L; + + /** 主键ID */ + @ApiModelProperty("主键ID") + @TableId(value = "id") + private Long id; + + /** 唯一标识 */ + @Excel(name = "唯一标识") + @ApiModelProperty("唯一标识") + private Long userId; + + /** 联系电话 */ + @Excel(name = "联系电话") + @ApiModelProperty("联系电话") + private String phone; + + /** 姓名 */ + @Excel(name = "姓名") + @ApiModelProperty("姓名") + private String username; + + /** 性别(0男 1女 2未知) */ + @Excel(name = "性别" , readConverterExp = "0=男,1=女,2=未知") + @ApiModelProperty("性别(0男 1女 2未知)") + private String gender; + + /** 民族 */ + @Excel(name = "民族") + @ApiModelProperty("民族") + private String nation; + + /** 出生日期 */ + @Excel(name = "出生日期") + @ApiModelProperty("出生日期") + private String birthdate; + + /** 身份证号码 */ + @Excel(name = "身份证号码") + @ApiModelProperty("身份证号码") + private String identityCard; + + /** 所在区域 */ + @Excel(name = "所在区域") + @ApiModelProperty("所在区域") + private String area; + + /** 地址 */ + @Excel(name = "地址") + @ApiModelProperty("地址") + private String site; + + /** 银行 */ + @Excel(name = "银行") + @ApiModelProperty("银行") + private String bank; + + /** 银行卡号 */ + @Excel(name = "银行卡号") + @ApiModelProperty("银行卡号") + private String cardNo; + + /** 头像地址 */ + @Excel(name = "头像地址") + @ApiModelProperty("头像地址") + private String avatarName; + + /** 密码 */ + @Excel(name = "密码") + @ApiModelProperty("密码") + private String password; + + /** 身份证正面图路径 */ + @Excel(name = "身份证正面图路径") + @ApiModelProperty("身份证正面图路径") + private String frontPath; + + /** 身份证反面图路径 */ + @Excel(name = "身份证反面图路径") + @ApiModelProperty("身份证反面图路径") + private String reverseSidePath; + + /** 银行卡图路径 */ + @Excel(name = "银行卡图路径") + @ApiModelProperty("银行卡图路径") + private String bankCardPath; + + /** 关联公司Id */ + @Excel(name = "关联公司Id") + @ApiModelProperty("关联公司Id") + private Long companyId; + + /** 帐号状态(0正常 1停用) */ + @Excel(name = "帐号状态" , readConverterExp = "0=正常,1=停用") + @ApiModelProperty("帐号状态(0正常 1停用)") + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + @Excel(name = "删除标志" , readConverterExp = "0=代表存在,2=代表删除") + @ApiModelProperty("删除标志(0代表存在 2代表删除)") + private String delFlag; + + /** 创建者 */ + @Excel(name = "创建者") + @ApiModelProperty("创建者") + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** 创建时间 */ + @Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** 更新者 */ + @Excel(name = "更新者") + @ApiModelProperty("更新者") + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** 更新时间 */ + @Excel(name = "更新时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** 备注 */ + @Excel(name = "备注") + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("公司名称") + @TableField(exist = false) + private String companyName; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/AuditStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/AuditStatus.java index aa9876c..33263f1 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/AuditStatus.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/AuditStatus.java @@ -39,12 +39,17 @@ public enum AuditStatus // 获取审核状态列表 public static List getAudit(){ - // 将PASS和REFUSE的code值转换为List类型 return Arrays.asList(PASS.getCode(),REFUSE.getCode()); } // 获取待审核的列表 public static List getToAudit(){ - // 将UNREAD和AUDIT的code值转换为List类型 return Arrays.asList(UNREAD.getCode(),AUDIT.getCode()); } + + // 获取已使用的列表 + public static List getUse(){ + return Arrays.asList(UNREAD.getCode(),AUDIT.getCode(),PASS.getCode()); + } + + } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/ProjectStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/ProjectStatus.java new file mode 100644 index 0000000..ef9137e --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/ProjectStatus.java @@ -0,0 +1,36 @@ +package com.ruoyi.common.enums; + +/** + * 项目状态 + * + * @author ruoyi + */ +public enum ProjectStatus +{ + NOT_START("0","未开工"), + START("1", "已开工"), + COMPLETE("2", "已竣工"), + ; + + private final String code; + private final String info; + + ProjectStatus(String code, String info) + { + this.code = code; + this.info = info; + } + + public String getCode() + { + return code; + } + + public String getInfo() + { + return info; + } + + + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/SubcontractingApplyStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/SubcontractingApplyStatus.java index 78acb30..d73f30b 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/SubcontractingApplyStatus.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/SubcontractingApplyStatus.java @@ -14,6 +14,7 @@ public enum SubcontractingApplyStatus PASS("1", "已同意"), REFUSE("2", "已拒绝"), CANCEL("3", "已取消"), + CHOOSE("4", "已被他人承接(只是拿来返回,不存进数据库)"), ; private final String code; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AllUserDetailsServiceImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AllUserDetailsServiceImpl.java index e9fd035..1017368 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AllUserDetailsServiceImpl.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AllUserDetailsServiceImpl.java @@ -29,7 +29,7 @@ public class AllUserDetailsServiceImpl implements UserDetailsService @Override public UserDetails loadUserByUsername(String var) throws UsernameNotFoundException { - if(var.contains(Constants.BGT)||var.contains(Constants.WGZ) ||var.contains(Constants.FBS)){ + if(var.contains(Constants.BGT)||var.contains(Constants.WGZ) ||var.contains(Constants.FBS) || var.contains(Constants.ZBF)){ return appUserDetailsService.loadUserByUsername(var); } else { return userDetailsService.loadUserByUsername(var); diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppUserDetailsServiceImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppUserDetailsServiceImpl.java index cce265c..08db440 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppUserDetailsServiceImpl.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppUserDetailsServiceImpl.java @@ -6,12 +6,14 @@ import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.entity.BgtUser; import com.ruoyi.common.core.domain.entity.FbsUser; import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.entity.ZbfUser; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.enums.UserStatus; import com.ruoyi.common.exception.BaseException; import com.ruoyi.fbs.service.IFbsUserService; import com.ruoyi.wgz.domain.WgzUser; import com.ruoyi.wgz.service.IWgzUserService; +import com.ruoyi.zbf.service.IZbfUserService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -41,6 +43,9 @@ public class AppUserDetailsServiceImpl implements UserDetailsService @Autowired private IFbsUserService fbsUserService; + @Autowired + private IZbfUserService zbfUserService; + @Autowired private SysPermissionService permissionService; @@ -60,6 +65,10 @@ public class AppUserDetailsServiceImpl implements UserDetailsService FbsUser fbsUser = fbsUserService.selectUserByPhone(phone.replace(Constants.FBS, "")); check(fbsUser,phone); userDetailsl = createLoginUser(fbsUser,Constants.FBS); + }else if (phone.contains(Constants.ZBF)) { + ZbfUser zbfUser = zbfUserService.selectUserByPhone(phone.replace(Constants.ZBF, "")); + check(zbfUser,phone); + userDetailsl = createLoginUser(zbfUser,Constants.ZBF); } return userDetailsl; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtTaskApplyDTO.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtTaskApplyDTO.java index 2acb8ae..65cd823 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtTaskApplyDTO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtTaskApplyDTO.java @@ -4,13 +4,16 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import javax.validation.constraints.NotNull; + @Data -@ApiModel("app申请/取消项目任务") +@ApiModel("包工头申请/取消项目任务") public class BgtTaskApplyDTO { @ApiModelProperty("任务ID") + @NotNull(message = "任务ID不能为空") private Long taskId; - @ApiModelProperty("包工头用户ID") - private Long userId; +// @ApiModelProperty("包工头用户ID") +// private Long userId; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtMessageService.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtMessageService.java index 877eb51..fe1aa7f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtMessageService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtMessageService.java @@ -92,7 +92,7 @@ public interface IBgtMessageService extends IServicePlus { TableDataInfo unAuditList(BgtMessageUnAuditDetailDTO dto); /** - * operation + * 已操作 */ void operation(String senderType,Long senderId,String recipientType,Long recipientId,Long tableId,String tableName); diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtProjectTaskProgressService.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtProjectTaskProgressService.java index b932ba7..00ac3c4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtProjectTaskProgressService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtProjectTaskProgressService.java @@ -70,4 +70,8 @@ public interface IBgtProjectTaskProgressService extends IServicePlus appQueryList(BgtWageApplicationQueryDTO dto); - /** * 分包商查询审核列表 */ TableDataInfo fbsAuditPageList(FbsWageAuditListDTO dto); + /** + * 分包商审核 + */ + Boolean fbsAudit(BgtWageApplication bo); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtMessageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtMessageServiceImpl.java index 9a9d239..b2a742e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtMessageServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtMessageServiceImpl.java @@ -8,8 +8,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.bgt.bo.BgtMessageQueryBo; import com.ruoyi.bgt.domain.BgtMessage; -import com.ruoyi.bgt.domain.BgtProjectRecruit; -import com.ruoyi.bgt.domain.BgtProjectRecruitApply; import com.ruoyi.bgt.domain.BgtWageApplication; import com.ruoyi.bgt.domain.dto.BgtMessageDetailDTO; import com.ruoyi.bgt.domain.dto.BgtMessageMyListDTO; @@ -28,10 +26,11 @@ import com.ruoyi.common.enums.BgtMessageType; import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.fbs.domain.FbsProjectTask; +import com.ruoyi.fbs.domain.FbsProjectTaskApply; +import com.ruoyi.fbs.service.IFbsProjectTaskApplyService; import com.ruoyi.fbs.service.IFbsProjectTaskService; import com.ruoyi.wgz.domain.WgzDailyClock; import com.ruoyi.wgz.domain.WgzLeave; -import com.ruoyi.wgz.domain.WgzPayCalculation; import com.ruoyi.wgz.domain.WgzReissueacard; import com.ruoyi.wgz.service.*; import org.springframework.beans.factory.annotation.Autowired; @@ -85,6 +84,10 @@ public class BgtMessageServiceImpl extends ServicePlusImpl implements IBgtProjectTaskProgressService { + @Autowired + private IFbsProjectTaskService taskService; + @Autowired + private IFbsMessageService fbsMessageService; + @Autowired + private IBgtMessageService bgtMessageService; + @Override public BgtProjectTaskProgress queryById(Long id){ return getById(id); @@ -79,8 +99,32 @@ public class BgtProjectTaskProgressServiceImpl extends ServicePlusImpl fmp = new HashMap<>(); + fmp.put("projectName", task.getTaskName()); + fmp.put("auditor", SecurityUtils.getUsername()); + Map fmap = bgtMessage(fmp, BGT_TYPE_PROGRESS_TO_FBS, true); + FbsMessage fbsMessage = new FbsMessage() + .setSenderType(USERTYPE_BGT) + .setSenderId(SecurityUtils.getAppUserId()) + .setRecipientType(USERTYPE_FBS) + .setRecipientId(task.getCreateId()) + .setHeadline(fmap.get(HEADLINE)) + .setSubheading(fmap.get(SUBHEADING)) + .setTableId(bo.getId()) + .setTableName(SqlHelper.table(BgtProjectTaskProgress.class).getTableName()) + .setMessageLargeType(FBS_LARGE_OTHER) + .setMessageSmallType(FBS_SMALL_PROGRESS) + .setIsOperation(OPERATION_NEED); + fbsMessageService.sendAMessage(fbsMessage); + + return save; } @Override @@ -129,9 +173,38 @@ public class BgtProjectTaskProgressServiceImpl extends ServicePlusImpl wrapper = new LambdaQueryWrapper<>(); wrapper.eq(BgtProjectTaskProgress::getTaskId, taskId); - wrapper.eq(BgtProjectTaskProgress::getAuditStatus, AuditStatus.PASS.getCode()); wrapper.orderByDesc(BgtProjectTaskProgress::getProgress); List list = baseMapper.selectList(wrapper); return CollectionUtil.isEmpty(list)?0:list.get(0).getProgress(); } + + @Override + public Boolean fbsAudit(BgtProjectTaskProgress bo) { + boolean b = updateById(bo); + + FbsProjectTask task = taskService.getById(bo.getTaskId()); + + //分包商发消息到包工头 + HashMap mp = new HashMap<>(); + mp.put("projectName", task.getTaskName()); + mp.put("auditor", SecurityUtils.getUsername()); + Map map = fbsMessage(mp, FBS_TYPE_PROGRESS, AuditStatus.PASS.getCode().equals(bo.getAuditStatus())); + BgtMessage bgtMessage = new BgtMessage() + .setSenderType(USERTYPE_FBS) + .setSenderId(SecurityUtils.getAppUserId()) + .setRecipientType(USERTYPE_BGT) + .setRecipientId(bo.getUploaderId()) + .setHeadline(map.get(HEADLINE)) + .setSubheading(map.get(SUBHEADING)) + .setTableId(bo.getId()) + .setTableName(SqlHelper.table(BgtProjectTaskProgress.class).getTableName()) + .setMessageLargeType(BGT_LARGE_OTHER) + .setMessageSmallType(BGT_SMALL_PROGRESS) + .setIsOperation(OPERATION_NO); + bgtMessageService.sendAMessage(bgtMessage); + + fbsMessageService.operation(USERTYPE_BGT, bo.getUploaderId(), USERTYPE_FBS, SecurityUtils.getAppUserId(), bo.getId(), SqlHelper.table(BgtProjectTaskProgress.class).getTableName()); + + return b; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtWageApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtWageApplicationServiceImpl.java index 4f67ed7..74e65ca 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtWageApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtWageApplicationServiceImpl.java @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; import com.ruoyi.bgt.bo.BgtWageApplicationQueryBo; import com.ruoyi.bgt.domain.BgtMessage; +import com.ruoyi.bgt.domain.BgtProjectTaskProgress; import com.ruoyi.bgt.domain.BgtWageApplication; import com.ruoyi.bgt.domain.dto.BgtWageApplicationQueryDTO; import com.ruoyi.bgt.domain.vo.BgtWageApplicationDetailVO; @@ -18,23 +19,28 @@ import com.ruoyi.bgt.service.IBgtMessageService; import com.ruoyi.bgt.service.IBgtWageApplicationService; import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.AuditStatus; +import com.ruoyi.common.exception.BaseException; 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.dto.FbsWageAuditListDTO; +import com.ruoyi.fbs.service.IFbsMessageService; import com.ruoyi.fbs.service.IFbsProjectTaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import static com.ruoyi.common.constants.BgtMessageConstant.*; -import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.USERTYPE_BGT; -import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.USERTYPE_SYSTEM; +import static com.ruoyi.common.constants.FbsMessageConstant.*; +import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*; /** * 包工头工资申请Service业务层处理 @@ -51,6 +57,9 @@ public class BgtWageApplicationServiceImpl extends ServicePlusImpl list = list(Wrappers.lambdaQuery().eq(BgtWageApplication::getTaskId, bo.getTaskId()) + .eq(BgtWageApplication::getUserId, SecurityUtils.getAppUserId()) + .eq(BgtWageApplication::getAuditStatus, AuditStatus.getUse())); + //收款金额 + int taskUseAmount = list.stream() + .map(BgtWageApplication::getApplicantAmount) + .reduce(BigDecimal.ZERO, BigDecimal::add).intValue(); + + //任务金额单位是万元,工资申请金额单位是元 + FbsProjectTask task = taskService.getById(bo.getTaskId()); + BigDecimal taskAmount = task.getTaskAmount(); + taskAmount = taskAmount.multiply(new BigDecimal(10000)); + + BigDecimal subtract = taskAmount.subtract(new BigDecimal(String.valueOf(taskUseAmount))); + if(subtract.compareTo(bo.getApplicantAmount()) < 0){ + throw new BaseException("申请金额已超出,剩余申请金额:"+subtract+"元"); + } + + BgtWageApplication add = BeanUtil.toBean(bo, BgtWageApplication.class); boolean save = save(add); - //发消息 - FbsProjectTask task = taskService.getById(add.getTaskId()); - HashMap mp = new HashMap<>(); - mp.put("projectName", task.getTaskName()); - mp.put("amount", add.getApplicantAmount().toString()); - Map map = bgtMessage(mp, BGT_TYPE_SETTLEMENT, true); - BgtMessage bgtMessage = new BgtMessage() - .setSenderType(USERTYPE_SYSTEM) - .setRecipientType(USERTYPE_BGT) - .setRecipientId(add.getUserId()) - .setHeadline(map.get(HEADLINE)) - .setSubheading(map.get(SUBHEADING)) + //系统发消息到包工头 +// HashMap mp = new HashMap<>(); +// mp.put("projectName", task.getTaskName()); +// mp.put("amount", add.getApplicantAmount().toString()); +// Map map = bgtMessage(mp, BGT_TYPE_SETTLEMENT, true); +// BgtMessage bgtMessage = new BgtMessage() +// .setSenderType(USERTYPE_SYSTEM) +// .setRecipientType(USERTYPE_BGT) +// .setRecipientId(add.getUserId()) +// .setHeadline(map.get(HEADLINE)) +// .setSubheading(map.get(SUBHEADING)) +// .setTableId(add.getId()) +// .setTableName(SqlHelper.table(BgtWageApplication.class).getTableName()) +// .setMessageLargeType(BGT_LARGE_SETTLEMENT); +// bgtMessageService.sendAMessage(bgtMessage); + + //包工头发消息到分包商 + HashMap fmp = new HashMap<>(); + fmp.put("projectName", task.getTaskName()); + fmp.put("auditor", SecurityUtils.getUsername()); + Map fmap = bgtMessage(fmp, BGT_TYPE_SETTLEMENT_TO_FBS, true); + FbsMessage fbsMessage = new FbsMessage() + .setSenderType(USERTYPE_BGT) + .setSenderId(SecurityUtils.getAppUserId()) + .setRecipientType(USERTYPE_FBS) + .setRecipientId(task.getCreateId()) + .setHeadline(fmap.get(HEADLINE)) + .setSubheading(fmap.get(SUBHEADING)) .setTableId(add.getId()) .setTableName(SqlHelper.table(BgtWageApplication.class).getTableName()) - .setMessageLargeType(BGT_LARGE_SETTLEMENT); - bgtMessageService.sendAMessage(bgtMessage); + .setMessageLargeType(FBS_LARGE_OTHER) + .setMessageSmallType(FBS_SMALL_PAY) + .setIsOperation(OPERATION_NEED); + fbsMessageService.sendAMessage(fbsMessage); return save; } @@ -163,4 +208,31 @@ public class BgtWageApplicationServiceImpl extends ServicePlusImpl queryVOPage = baseMapper.fbsAuditPageList(queryDTOPage, dto); return PageUtils.buildDataInfo(queryVOPage); } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean fbsAudit(BgtWageApplication bo) { + boolean b = updateById(bo); + FbsProjectTask task = taskService.getById(bo.getTaskId()); + + //分包商发消息到包工头 + HashMap mp = new HashMap<>(); + mp.put("projectName", task.getTaskName()); + mp.put("auditor", SecurityUtils.getUsername()); + Map map = fbsMessage(mp, FBS_TYPE_PAY,AuditStatus.PASS.getCode().equals(bo.getAuditStatus())); + BgtMessage bgtMessage = new BgtMessage() + .setSenderType(USERTYPE_FBS) + .setSenderId(SecurityUtils.getAppUserId()) + .setRecipientType(USERTYPE_BGT) + .setRecipientId(bo.getUserId()) + .setHeadline(map.get(HEADLINE)) + .setSubheading(map.get(SUBHEADING)) + .setTableId(bo.getId()) + .setTableName(SqlHelper.table(BgtWageApplication.class).getTableName()) + .setMessageLargeType(BGT_LARGE_SETTLEMENT) + .setIsOperation(OPERATION_NO); + bgtMessageService.sendAMessage(bgtMessage); + fbsMessageService.operation(USERTYPE_BGT, bo.getUserId(), USERTYPE_FBS, SecurityUtils.getAppUserId(), bo.getId(), SqlHelper.table(BgtProjectTaskProgress.class).getTableName()); + return b; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/constants/BgtMessageConstant.java b/ruoyi-system/src/main/java/com/ruoyi/common/constants/BgtMessageConstant.java index 87c7fd1..de24e86 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/common/constants/BgtMessageConstant.java +++ b/ruoyi-system/src/main/java/com/ruoyi/common/constants/BgtMessageConstant.java @@ -17,6 +17,7 @@ public class BgtMessageConstant { public static final String BGT_SMALL_LEAVE = "3"; //小类型-请假 public static final String BGT_SMALL_MAKE_UP = "4"; //小类型-补卡 public static final String BGT_SMALL_REPORT_MAKE_UP = "5"; //小类型-日报补卡 + public static final String BGT_SMALL_PROGRESS = "5"; //小类型-任务进度 public static final List AUDIT_TYPE = Arrays.asList("2", "3", "4", "5"); /** @@ -65,13 +66,13 @@ public class BgtMessageConstant { * ============================================系统->包工头 模板================================================== */ //承接任务 - public static final String BGT_TASK_APPLY_HEADLINE = "您已申请【%s】项目"; - public static final String BGT_TASK_APPLY_SUBHEADING = "您已成功申请到【%s】项目,请耐心等待回复!"; + public static final String BGT_TASK_APPLY_HEADLINE = "您已申请【%s】任务"; + public static final String BGT_TASK_APPLY_SUBHEADING = "您已成功申请到【%s】任务,请耐心等待回复!"; //取消承接任务 - public static final String BGT_TASK_APPLY_CANCEL_HEADLINE = "您已申请取消【%s】项目!"; - public static final String BGT_TASK_APPLY_CANCEL_SUBHEADING = "您已成功取消【%s】项目"; + public static final String BGT_TASK_APPLY_CANCEL_HEADLINE = "您已取消【%s】任务申请!"; + public static final String BGT_TASK_APPLY_CANCEL_SUBHEADING = "您已成功取消【%s】项目申请!"; //工资结算 - public static final String BGT_SETTLEMENT_APPLY_HEADLINE = "您正在申请【%s】项目,总共【%s】元的工资结算操作!"; + public static final String BGT_SETTLEMENT_APPLY_HEADLINE = "您正在申请【%s】任务,总共【%s】元的工资结算操作!"; public static final String BGT_SETTLEMENT_APPLY_SUBHEADING = "您已成功发起金额为【%s】元的工资结算操作,请耐心等待回复!"; @@ -92,10 +93,14 @@ public class BgtMessageConstant { //工资结算 public static final String BGT_TO_FBG_SETTLEMENT_APPLY_HEADLINE = "包工头【%s】正在向你发起工资结算!"; public static final String BGT_TO_FBG_SETTLEMENT_APPLY_SUBHEADING = "包工头【%s】向你发起金额为【%s】元的工资结算操作!"; + //任务进度 + public static final String BGT_TO_FBG_PROGRESS_HEADLINE = "包工头【%s】已提交【%s】任务的新进度!"; + public static final String BGT_TO_FBG_PROGRESS_SUBHEADING = "包工头【%s】已提交【%s】任务的新进度,请查看!"; //包工头->分包商 消息类型 - public static final String BGT_TYPE_TASK_TO_FBG = "9"; //任务 - public static final String BGT_TYPE_SETTLEMEN_TO_FBGT = "10"; //结算 + public static final String BGT_TYPE_TASK_TO_FBS = "9"; //任务 + public static final String BGT_TYPE_SETTLEMENT_TO_FBS = "10"; //结算 + public static final String BGT_TYPE_PROGRESS_TO_FBS = "13"; //结算 /** @@ -167,6 +172,10 @@ public class BgtMessageConstant { map.put(HEADLINE, String.format(BGT_LEAVE_REPORT_MAKE_UP_HEADLINE, projectName)); map.put(SUBHEADING, String.format(BGT_LEAVE_REPORT_MAKE_UP_SUBHEADING_ONE, projectName,auditor,pass)); break; + case "13": + map.put(HEADLINE, String.format(BGT_TO_FBG_PROGRESS_HEADLINE,auditor, projectName)); + map.put(SUBHEADING, String.format(BGT_TO_FBG_PROGRESS_SUBHEADING, auditor,projectName)); + break; default: break; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/constants/FbsMessageConstant.java b/ruoyi-system/src/main/java/com/ruoyi/common/constants/FbsMessageConstant.java index 268a249..1cfd456 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/common/constants/FbsMessageConstant.java +++ b/ruoyi-system/src/main/java/com/ruoyi/common/constants/FbsMessageConstant.java @@ -5,6 +5,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static com.ruoyi.common.constants.BgtMessageConstant.HEADLINE; +import static com.ruoyi.common.constants.BgtMessageConstant.SUBHEADING; + public class FbsMessageConstant { // 公共常量 @@ -14,7 +17,7 @@ public class FbsMessageConstant { public static final String FBS_SMALL_SIGN_UP = "1"; //小类型-包工头报名 public static final String FBS_SMALL_PAY = "2"; //小类型-付款 - public static final String FBS_SMALL_LEAVE = "3"; //小类型-进度 + public static final String FBS_SMALL_PROGRESS = "3"; //小类型-进度 public static final List AUDIT_TYPE = Arrays.asList("2", "3"); /** @@ -77,7 +80,7 @@ public class FbsMessageConstant { //分包商->总包方 消息类型 public static final String FBS_TYPE_SUB_TO_ZBF = "7"; //任务 - public static final String FBS_TYPE_SETTLEMEN_TO_FBGT = "8"; //结算 + public static final String FBS_TYPE_SETTLEMENT_TO_ZBF = "8"; //结算 /** @@ -85,12 +88,9 @@ public class FbsMessageConstant { * ============================================调用方法================================================== * ============================================调用方法================================================== */ - //主副标志 - public static final String HEADLINE = "headline"; //主标题 - public static final String SUBHEADING = "subheading"; //副标题 //包工头消息返回 - public static Map bgtMessage(Map mp, String type, Boolean isPass) { + public static Map fbsMessage(Map mp, String type, Boolean isPass) { Map map = new HashMap<>(); String pass = isPass ? "通过" : "拒绝"; String projectName = mp.get("projectName"); diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/constants/WgzAndBgtMessageConstant.java b/ruoyi-system/src/main/java/com/ruoyi/common/constants/WgzAndBgtMessageConstant.java index a2e5ce9..8c9dbdb 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/common/constants/WgzAndBgtMessageConstant.java +++ b/ruoyi-system/src/main/java/com/ruoyi/common/constants/WgzAndBgtMessageConstant.java @@ -8,7 +8,10 @@ public class WgzAndBgtMessageConstant { public static final String USERTYPE_WGZ = "1"; //务工者 public static final String USERTYPE_BGT = "2"; //包工头 public static final String USERTYPE_FBS = "3"; //分包商 + public static final String USERTYPE_ZBF = "4"; //分包商 + //系统ID + public static final Long SYSTEM_ID = 0L; public static final String OPERATION_NO = "0"; //不需要操作 public static final String OPERATION_NEED = "1"; //需要操作 diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/constants/ZbfMessageConstant.java b/ruoyi-system/src/main/java/com/ruoyi/common/constants/ZbfMessageConstant.java new file mode 100644 index 0000000..307ad23 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/common/constants/ZbfMessageConstant.java @@ -0,0 +1,93 @@ +package com.ruoyi.common.constants; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.ruoyi.common.constants.BgtMessageConstant.HEADLINE; +import static com.ruoyi.common.constants.BgtMessageConstant.SUBHEADING; + +public class ZbfMessageConstant { + // 公共常量 + + public static final String ZBF_LARGE_TASK = "1"; //大类型-任务 + public static final String ZBF_LARGE_SETTLEMENT = "2"; //大类型-结算 + public static final String ZBF_LARGE_OTHER = "3"; //大类型-其它 + + public static final String ZBF_SMALL_SIGN_UP = "1"; //小类型-分包商报名 + public static final String ZBF_SMALL_PAY = "2"; //小类型-付款 + public static final String ZBF_SMALL_PROGRESS = "3"; //小类型-进度 + + public static final List AUDIT_TYPE = Arrays.asList("2", "3"); + /** + * ============================================总包方->分包商 模板================================================== + * ============================================总包方->分包商 模板================================================== + * ============================================总包方->分包商 模板================================================== + */ + + //任务审批 + public static final String ZBF_SIGN_UP_APPLY_HEADLINE = "您申请的【%s】项目【%s】分包,已得到回复!"; + public static final String ZBF_SIGN_UP_APPLY_SUBHEADING = "您申请的【%s】任务【%s】分包,审核人【%s】已%s!"; + //工资审批 + public static final String ZBF_PAY_APPLY_HEADLINE = "您【%s】任务【%s】分包工资申请已审批!"; + public static final String ZBF_PAY_APPLY_SUBHEADING = "您申请的【%s】任务【%s】分包工资,审核人【%s】已%s!"; + + + //分包商->包工头 消息类型 + public static final String ZBF_TYPE_SIGN_UP = "1"; //包工头报名 + public static final String ZBF_TYPE_PAY = "2"; //付款 + + /** + * ============================================系统->分包商 模板================================================== + * ============================================系统->分包商 模板================================================== + * ============================================系统->分包商 模板================================================== + */ +// //承接任务 +// public static final String FBS_SUB_APPLY_HEADLINE = "您已成功申请【%s】项目【%s】分包"; +// public static final String FBS_SUB_APPLY_SUBHEADING = "您已成功申请到【%s】项目【%s】分包,请耐心等待回复!"; +// //取消承接任务 +// public static final String FBS_TASK_APPLY_CANCEL_HEADLINE = "您已成功取消【%s】项目【%s】分包申请!"; +// public static final String FBS_TASK_APPLY_CANCEL_SUBHEADING = "您已成功取消【%s】项目【%s】分包申请"; +// //工资结算 +// public static final String FBS_SETTLEMENT_APPLY_HEADLINE = "您正在申请【%s】项目【%s】分包,总共【%s】元的工资结算操作!"; +// public static final String FBS_SETTLEMENT_APPLY_SUBHEADING = "您已成功发起金额为【%s】元的工资结算操作,请耐心等待回复!"; +// +// +// //系统->包工头 消息类型 +// public static final String FBS_TYPE_TASK = "4"; //任务报名 +// public static final String FBS_TYPE_TASK_CANCEL = "5"; //任务取消 +// public static final String FBS_TYPE_SETTLEMENT = "6"; //结算 + + + /** + * ============================================调用方法================================================== + * ============================================调用方法================================================== + * ============================================调用方法================================================== + */ + + //包工头消息返回 + public static Map zbfMessage(Map mp, String type, Boolean isPass) { + Map map = new HashMap<>(); + String pass = isPass ? "通过" : "拒绝"; + String projectName = mp.get("projectName"); + String subName = mp.get("subName"); + String auditor = mp.get("auditor"); + String amount = mp.get("amount"); + switch (type) { + case "1": + map.put(HEADLINE, String.format(ZBF_SIGN_UP_APPLY_HEADLINE, projectName,subName)); + map.put(SUBHEADING, String.format(ZBF_SIGN_UP_APPLY_SUBHEADING, projectName,subName, auditor, pass)); + break; + case "2": + map.put(HEADLINE, String.format(ZBF_PAY_APPLY_HEADLINE, projectName,subName)); + map.put(SUBHEADING, String.format(ZBF_PAY_APPLY_SUBHEADING, projectName,subName, auditor, pass)); + break; + default: + break; + } + return map; + } + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/controller/CompanyController.java b/ruoyi-system/src/main/java/com/ruoyi/common/controller/CompanyController.java deleted file mode 100644 index d5ebe14..0000000 --- a/ruoyi-system/src/main/java/com/ruoyi/common/controller/CompanyController.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.ruoyi.common.controller; - -import java.util.List; -import java.util.Arrays; - -import com.ruoyi.common.domain.Company; -import lombok.RequiredArgsConstructor; -import javax.validation.constraints.*; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import org.springframework.validation.annotation.Validated; -import com.ruoyi.common.annotation.RepeatSubmit; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.bo.CompanyQueryBo; -import com.ruoyi.common.service.ICompanyService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - -/** - * 企业认证Controller - * - * @author ruoyi - * @date 2025-03-26 - */ -@Api(value = "企业认证控制器", tags = {"企业认证管理"}) -@RequiredArgsConstructor(onConstructor_ = @Autowired) -@RestController -@RequestMapping("/common/company") -public class CompanyController extends BaseController { - - private final ICompanyService iCommonCompanyService; - - /** - * 查询企业认证列表 - */ - @ApiOperation("查询企业认证列表") - @PreAuthorize("@ss.hasPermi('common:company:list')") - @GetMapping("/list") - public TableDataInfo list(@Validated CompanyQueryBo bo) { - return iCommonCompanyService.queryPageList(bo); - } - - /** - * 导出企业认证列表 - */ - @ApiOperation("导出企业认证列表") - @PreAuthorize("@ss.hasPermi('common:company:export')") - @Log(title = "企业认证", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(@Validated CompanyQueryBo bo) { - List list = iCommonCompanyService.queryList(bo); - ExcelUtil util = new ExcelUtil(Company.class); - return util.exportExcel(list, "企业认证"); - } - - /** - * 获取企业认证详细信息 - */ - @ApiOperation("获取企业认证详细信息") - @PreAuthorize("@ss.hasPermi('common:company:query')") - @GetMapping("/{id}") - public AjaxResult getInfo(@NotNull(message = "主键不能为空") - @PathVariable("id") Long id) { - return AjaxResult.success(iCommonCompanyService.queryById(id)); - } - - /** - * 新增企业认证 - */ - @ApiOperation("新增企业认证") - @PreAuthorize("@ss.hasPermi('common:company:add')") - @Log(title = "企业认证", businessType = BusinessType.INSERT) - @RepeatSubmit - @PostMapping() - public AjaxResult add(@Validated @RequestBody Company bo) { - return toAjax(iCommonCompanyService.insert(bo) ? 1 : 0); - } - - /** - * 修改企业认证 - */ - @ApiOperation("修改企业认证") - @PreAuthorize("@ss.hasPermi('common:company:edit')") - @Log(title = "企业认证", businessType = BusinessType.UPDATE) - @RepeatSubmit - @PutMapping() - public AjaxResult edit(@Validated @RequestBody Company bo) { - return toAjax(iCommonCompanyService.update(bo) ? 1 : 0); - } - - /** - * 删除企业认证 - */ - @ApiOperation("删除企业认证") - @PreAuthorize("@ss.hasPermi('common:company:remove')") - @Log(title = "企业认证" , businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@NotEmpty(message = "主键不能为空") - @PathVariable Long[] ids) { - return toAjax(iCommonCompanyService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); - } -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/domain/Company.java b/ruoyi-system/src/main/java/com/ruoyi/common/domain/Company.java index 22dc617..614eed3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/common/domain/Company.java +++ b/ruoyi-system/src/main/java/com/ruoyi/common/domain/Company.java @@ -1,9 +1,6 @@ package com.ruoyi.common.domain; -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.*; import com.ruoyi.common.annotation.Excel; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -33,7 +30,7 @@ public class Company implements Serializable { /** 主键ID */ @ApiModelProperty("主键ID") - @TableId(value = "id") + @TableId(value = "id", type = IdType.AUTO) private Long id; /** 企业名称 */ @@ -66,6 +63,19 @@ public class Company implements Serializable { @ApiModelProperty("注册资本") private BigDecimal registrationAmount; + + @ApiModelProperty("联系人") + private String contact; + + @ApiModelProperty("联系电话") + private String contactPhone; + + @ApiModelProperty("银行") + private String bank; + + @ApiModelProperty("银行卡号") + private String cardNo; + /** 企业简介 */ @Excel(name = "企业简介") @ApiModelProperty("企业简介") diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/domain/dto/CompanyAuthenticateDTO.java b/ruoyi-system/src/main/java/com/ruoyi/common/domain/dto/CompanyAuthenticateDTO.java index 06fccd0..4004a90 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/common/domain/dto/CompanyAuthenticateDTO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/common/domain/dto/CompanyAuthenticateDTO.java @@ -40,6 +40,18 @@ public class CompanyAuthenticateDTO { @ApiModelProperty("注册资本") private BigDecimal registrationAmount; + @ApiModelProperty("联系人") + private String contact; + + @ApiModelProperty("联系电话") + private String contactPhone; + + @ApiModelProperty("银行") + private String bank; + + @ApiModelProperty("银行卡号") + private String cardNo; + @ApiModelProperty("企业简介") private String introduce; diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/service/ICompanyService.java b/ruoyi-system/src/main/java/com/ruoyi/common/service/ICompanyService.java index f32046e..9a2db74 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/common/service/ICompanyService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/common/service/ICompanyService.java @@ -52,4 +52,9 @@ public interface ICompanyService extends IServicePlus { * @return */ Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + /** + * 获取公司的名称 + */ + String getCompanyNameById(Long id); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/service/impl/CompanyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/common/service/impl/CompanyServiceImpl.java index a6136a5..6decdfe 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/common/service/impl/CompanyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/common/service/impl/CompanyServiceImpl.java @@ -89,4 +89,13 @@ public class CompanyServiceImpl extends ServicePlusImpl subList; diff --git a/ruoyi-system/src/main/java/com/ruoyi/fbs/domain/vo/FbsProjectSubcontractingDetailVO.java b/ruoyi-system/src/main/java/com/ruoyi/fbs/domain/vo/FbsProjectSubcontractingDetailVO.java new file mode 100644 index 0000000..2b0c37d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/fbs/domain/vo/FbsProjectSubcontractingDetailVO.java @@ -0,0 +1,71 @@ +package com.ruoyi.fbs.domain.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * 总包方项目分包对象 zbf_project_subcontracting + * + * @author ruoyi + * @date 2025-02-17 + */ +@Data +@Accessors(chain = true) +@ApiModel("分包商查询项目分包详情视图对象") +public class FbsProjectSubcontractingDetailVO { + + /** 主键ID */ + @ApiModelProperty("主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("标段ID") + private Long sectionId; + + @ApiModelProperty("标段名") + private String sectionName; + + @ApiModelProperty("分包主题") + private String subName; + + @ApiModelProperty("分包描述") + private String subDescribe; + + @ApiModelProperty("分包金额") + private BigDecimal subAmount; + + @ApiModelProperty("资质要求") + private String qualification; + + @ApiModelProperty("分包商用户ID") + private Long userId; + + @ApiModelProperty("删除标志(0代表存在 2代表删除)") + private String delFlag; + + @ApiModelProperty("创建者") + private String createBy; + + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + @ApiModelProperty("更新者") + private String updateBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateTime; + + @ApiModelProperty("备注") + private String remark; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/fbs/domain/vo/FbsProjectSubcontractingListVO.java b/ruoyi-system/src/main/java/com/ruoyi/fbs/domain/vo/FbsProjectSubcontractingListVO.java index a9c0545..14e5821 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/fbs/domain/vo/FbsProjectSubcontractingListVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/fbs/domain/vo/FbsProjectSubcontractingListVO.java @@ -16,6 +16,10 @@ public class FbsProjectSubcontractingListVO { @ApiModelProperty("项目ID") private Long projectId; + + @ApiModelProperty("项目地址") + private String projectAddress; + /** 标段ID */ @ApiModelProperty("标段ID") private Long sectionId; @@ -32,7 +36,7 @@ public class FbsProjectSubcontractingListVO { @ApiModelProperty("资质要求") private String qualification; - - + @ApiModelProperty("申请状态(0=申请中,1=已同意,2=已拒绝,3=已取消)") + private String applyStatus; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/fbs/domain/vo/FbsProjectTaskListCountVO.java b/ruoyi-system/src/main/java/com/ruoyi/fbs/domain/vo/FbsProjectTaskListCountVO.java new file mode 100644 index 0000000..bdb8656 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/fbs/domain/vo/FbsProjectTaskListCountVO.java @@ -0,0 +1,25 @@ +package com.ruoyi.fbs.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 分包商项目任务对象 fbs_project_task + * + * @author ruoyi + * @date 2025-02-17 + */ +@Data +@NoArgsConstructor +@ApiModel("分包商任务列表数量统计视图对象") +public class FbsProjectTaskListCountVO { + + @ApiModelProperty("已发布数量") + private Integer releaseCount; + + @ApiModelProperty("已完成数量") + private Integer completeCount; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/IFbsMessageService.java b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/IFbsMessageService.java index 3d25e8e..9fcdb80 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/IFbsMessageService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/IFbsMessageService.java @@ -72,4 +72,23 @@ public interface IFbsMessageService extends IServicePlus { * 消息详情列表 */ TableDataInfo queryDetailPageList(FbsMessageDetailDTO dto); + + /** + * 发送消息 + */ + Boolean sendAMessage(FbsMessage bo); + + /** + * 已操作 + */ + void operation(String senderType,Long senderId,String recipientType,Long recipientId,Long tableId,String tableName); + + /** + * 批量已操作 + */ + void operationBatch(String recipientType,Long recipientId,List tableIds,String tableName); + + + + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/IFbsProjectTaskApplyService.java b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/IFbsProjectTaskApplyService.java index f913d82..34e5701 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/IFbsProjectTaskApplyService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/IFbsProjectTaskApplyService.java @@ -75,4 +75,9 @@ public interface IFbsProjectTaskApplyService extends IServicePlus queryPageListByTaskId(FbsTaskApplyListDTO dto); + + /** + * 分包商选择包工头 + */ + Boolean choose(Long id); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/IFbsProjectTaskService.java b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/IFbsProjectTaskService.java index 32b2e5f..017087a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/IFbsProjectTaskService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/IFbsProjectTaskService.java @@ -116,6 +116,11 @@ public interface IFbsProjectTaskService extends IServicePlus { */ TableDataInfo fbsPageList(FbsTaskListDTO dto); + /** + * 分包商查询任务列表数量统计 + */ + FbsProjectTaskListCountVO fbsListCount(); + /** * 分包商查询任务详情-工资结算审批 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/IFbsUserService.java b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/IFbsUserService.java index b0573d9..ce6ca88 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/IFbsUserService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/IFbsUserService.java @@ -62,7 +62,7 @@ public interface IFbsUserService extends IServicePlus { /** * 企业认证 */ - Boolean authenticate(CompanyAuthenticateDTO dto); + Long authenticate(CompanyAuthenticateDTO dto); /** * 企业认证 diff --git a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsMessageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsMessageServiceImpl.java index 3453d14..da90b63 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsMessageServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsMessageServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.fbs.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; @@ -28,6 +29,7 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.OPERATION_ALREADY; import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.OPERATION_NEED; /** @@ -204,4 +206,32 @@ public class FbsMessageServiceImpl extends ServicePlusImpl wrapper = new LambdaUpdateWrapper<>(); + wrapper.eq(FbsMessage::getRecipientId, recipientId); + wrapper.eq(FbsMessage::getRecipientType, recipientType); + wrapper.eq(FbsMessage::getSenderId, senderId); + wrapper.eq(FbsMessage::getSenderType, senderType); + wrapper.eq(FbsMessage::getTableId, tableId); + wrapper.eq(FbsMessage::getTableName, tableName); + wrapper.set(FbsMessage::getIsOperation, OPERATION_ALREADY); + update(wrapper); + } + + @Override + public void operationBatch(String recipientType, Long recipientId, List tableIds, String tableName) { + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.eq(FbsMessage::getRecipientId, recipientId); + wrapper.eq(FbsMessage::getRecipientType, recipientType); + wrapper.in(FbsMessage::getTableId, tableIds); + wrapper.eq(FbsMessage::getTableName, tableName); + wrapper.set(FbsMessage::getIsOperation, OPERATION_ALREADY); + update(wrapper); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsProjectTaskApplyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsProjectTaskApplyServiceImpl.java index 58f3acb..fe9fb9f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsProjectTaskApplyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsProjectTaskApplyServiceImpl.java @@ -11,30 +11,30 @@ import com.ruoyi.bgt.domain.dto.BgtTaskApplyDTO; import com.ruoyi.bgt.service.IBgtMessageService; import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.TaskApplyStatus; import com.ruoyi.common.exception.BaseException; import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.fbs.bo.FbsProjectTaskApplyQueryBo; +import com.ruoyi.fbs.domain.FbsMessage; import com.ruoyi.fbs.domain.FbsProjectTask; import com.ruoyi.fbs.domain.FbsProjectTaskApply; import com.ruoyi.fbs.domain.dto.FbsTaskApplyListDTO; import com.ruoyi.fbs.domain.vo.FbsProjectTaskApplyListVO; import com.ruoyi.fbs.mapper.FbsProjectTaskApplyMapper; +import com.ruoyi.fbs.service.IFbsMessageService; import com.ruoyi.fbs.service.IFbsProjectTaskApplyService; import com.ruoyi.fbs.service.IFbsProjectTaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; import static com.ruoyi.common.constants.BgtMessageConstant.*; -import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.USERTYPE_BGT; -import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.USERTYPE_SYSTEM; +import static com.ruoyi.common.constants.FbsMessageConstant.*; +import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*; /** * 分包商项目任务申请Service业务层处理 @@ -49,7 +49,8 @@ public class FbsProjectTaskApplyServiceImpl extends ServicePlusImpl wrapper = new LambdaQueryWrapper<>(); wrapper.eq(FbsProjectTaskApply::getTaskId, entity.getTaskId()); wrapper.eq(FbsProjectTaskApply::getUserId, entity.getUserId()); + wrapper.eq(FbsProjectTaskApply::getApplyStatus, TaskApplyStatus.APPLY.getCode()); List list = baseMapper.selectList(wrapper); if (CollUtil.isNotEmpty(list)) { throw new BaseException("该任务已申请"); @@ -115,24 +117,46 @@ public class FbsProjectTaskApplyServiceImpl extends ServicePlusImpl mp = new HashMap<>(); - mp.put("projectName", task.getTaskName()); - mp.put("auditor", SecurityUtils.getUsername()); - Map map = bgtMessage(mp, BGT_TYPE_TASK, true); - BgtMessage bgtMessage = new BgtMessage() - .setSenderType(USERTYPE_SYSTEM) - .setRecipientType(USERTYPE_BGT) - .setRecipientId(dto.getUserId()) - .setHeadline(map.get(HEADLINE)) - .setSubheading(map.get(SUBHEADING)) - .setTableId(task.getId()) - .setTableName(SqlHelper.table(FbsProjectTask.class).getTableName()) - .setMessageLargeType(BGT_LARGE_TASK); - bgtMessageService.sendAMessage(bgtMessage); +// HashMap mp = new HashMap<>(); +// mp.put("projectName", task.getTaskName()); +// mp.put("auditor", SecurityUtils.getUsername()); +// Map map = bgtMessage(mp, BGT_TYPE_TASK, true); +// BgtMessage bgtMessage = new BgtMessage() +// .setSenderType(USERTYPE_SYSTEM) +// .setSenderId(SYSTEM_ID) +// .setRecipientType(USERTYPE_BGT) +// .setRecipientId(dto.getUserId()) +// .setHeadline(map.get(HEADLINE)) +// .setSubheading(map.get(SUBHEADING)) +// .setTableId(fbsProjectTaskApply.getId()) +// .setTableName(SqlHelper.table(FbsProjectTaskApply.class).getTableName()) +// .setMessageLargeType(BGT_LARGE_TASK); +// bgtMessageService.sendAMessage(bgtMessage); + + //包工头发消息到分包商 + HashMap fmp = new HashMap<>(); + fmp.put("projectName", task.getTaskName()); + fmp.put("auditor", SecurityUtils.getUsername()); + Map fmap = bgtMessage(fmp, BGT_TYPE_TASK_TO_FBS, true); + FbsMessage fbsMessage = new FbsMessage() + .setSenderType(USERTYPE_BGT) + .setSenderId(SecurityUtils.getAppUserId()) + .setRecipientType(USERTYPE_FBS) + .setRecipientId(task.getCreateId()) + .setHeadline(fmap.get(HEADLINE)) + .setSubheading(fmap.get(SUBHEADING)) + .setTableId(fbsProjectTaskApply.getId()) + .setTableName(SqlHelper.table(FbsProjectTaskApply.class).getTableName()) + .setMessageLargeType(FBS_LARGE_OTHER) + .setMessageSmallType(FBS_SMALL_SIGN_UP) + .setIsOperation(OPERATION_NEED); + fbsMessageService.sendAMessage(fbsMessage); + return save(fbsProjectTaskApply); } @@ -144,25 +168,42 @@ public class FbsProjectTaskApplyServiceImpl extends ServicePlusImpllambdaQuery().eq(FbsProjectTaskApply::getTaskId, dto.getTaskId()) - .eq(FbsProjectTaskApply::getUserId, dto.getUserId())); - //发消息 + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(FbsProjectTaskApply::getTaskId, dto.getTaskId()); + wrapper.eq(FbsProjectTaskApply::getUserId, SecurityUtils.getAppUserId()); + wrapper.eq(FbsProjectTaskApply::getApplyStatus, TaskApplyStatus.APPLY.getCode()); + List list = baseMapper.selectList(wrapper); + if (CollUtil.isEmpty(list)) { + throw new BaseException("该任务尚未申请"); + } + FbsProjectTaskApply fbsProjectTaskApply = list.get(0); + fbsProjectTaskApply.setApplyStatus(TaskApplyStatus.CANCEL.getCode()); + boolean update = updateById(fbsProjectTaskApply); + FbsProjectTask task = taskService.getById(dto.getTaskId()); - HashMap mp = new HashMap<>(); - mp.put("projectName", task.getTaskName()); - mp.put("auditor", SecurityUtils.getUsername()); - Map map = bgtMessage(mp, BGT_TYPE_TASK_CANCEL, true); - BgtMessage bgtMessage = new BgtMessage() - .setSenderType(USERTYPE_SYSTEM) - .setRecipientType(USERTYPE_BGT) - .setRecipientId(dto.getUserId()) - .setHeadline(map.get(HEADLINE)) - .setSubheading(map.get(SUBHEADING)) - .setTableId(task.getId()) - .setTableName(SqlHelper.table(FbsProjectTask.class).getTableName()) - .setMessageLargeType(BGT_LARGE_TASK); - bgtMessageService.sendAMessage(bgtMessage); - return delete>0; + + //修改消息操作 + fbsMessageService.operation(USERTYPE_BGT,SecurityUtils.getAppUserId(),USERTYPE_FBS,task.getCreateId() + ,fbsProjectTaskApply.getId(),SqlHelper.table(FbsProjectTaskApply.class).getTableName()); + + //发消息 +// FbsProjectTask task = taskService.getById(dto.getTaskId()); +// HashMap mp = new HashMap<>(); +// mp.put("projectName", task.getTaskName()); +// mp.put("auditor", SecurityUtils.getUsername()); +// Map map = bgtMessage(mp, BGT_TYPE_TASK_CANCEL, true); +// BgtMessage bgtMessage = new BgtMessage() +// .setSenderType(USERTYPE_SYSTEM) +// .setRecipientType(USERTYPE_BGT) +// .setRecipientId(dto.getUserId()) +// .setHeadline(map.get(HEADLINE)) +// .setSubheading(map.get(SUBHEADING)) +// .setTableId(task.getId()) +// .setTableName(SqlHelper.table(FbsProjectTask.class).getTableName()) +// .setMessageLargeType(BGT_LARGE_TASK); +// bgtMessageService.sendAMessage(bgtMessage); + return update; } @Override @@ -173,4 +214,57 @@ public class FbsProjectTaskApplyServiceImpl extends ServicePlusImpl voPage = baseMapper.queryPageListByTaskId(page, dto); return PageUtils.buildDataInfo(voPage); } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean choose(Long id) { + FbsProjectTaskApply taskApply = getById(id); + if(taskApply == null || TaskApplyStatus.CANCEL.getCode().equals(taskApply.getApplyStatus())){ + throw new BaseException("该申请已取消"); + } + FbsProjectTask task = taskService.getById(taskApply.getTaskId()); + if(task!=null && task.getUserId()!=null){ + throw new BaseException("该任务已被承接"); + } + + //拒绝其余包工头 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(FbsProjectTaskApply::getTaskId, taskApply.getTaskId()); + wrapper.eq(FbsProjectTaskApply::getApplyStatus, TaskApplyStatus.APPLY.getCode()); + List list = baseMapper.selectList(wrapper); + + + ArrayList bgtMessages = new ArrayList<>(); + + + for (FbsProjectTaskApply fbsProjectTaskApply : list){ + boolean equals = fbsProjectTaskApply.getId().equals(id); + if (equals){ + fbsProjectTaskApply.setApplyStatus(TaskApplyStatus.PASS.getCode()); + }else{ + fbsProjectTaskApply.setApplyStatus(TaskApplyStatus.REFUSE.getCode()); + } + + //分包商发消息到包工头 + HashMap mp = new HashMap<>(); + mp.put("projectName", task.getTaskName()); + mp.put("auditor", SecurityUtils.getUsername()); + Map map = fbsMessage(mp, FBS_TYPE_SIGN_UP, equals); + BgtMessage bgtMessage = new BgtMessage() + .setSenderType(USERTYPE_FBS) + .setSenderId(SecurityUtils.getAppUserId()) + .setRecipientType(USERTYPE_BGT) + .setRecipientId(fbsProjectTaskApply.getUserId()) + .setHeadline(map.get(HEADLINE)) + .setSubheading(map.get(SUBHEADING)) + .setTableId(fbsProjectTaskApply.getId()) + .setTableName(SqlHelper.table(FbsProjectTaskApply.class).getTableName()) + .setMessageLargeType(BGT_LARGE_TASK) + .setIsOperation(OPERATION_NO); + bgtMessages.add(bgtMessage); + } + bgtMessageService.saveBatch(bgtMessages); + fbsMessageService.operationBatch(USERTYPE_FBS,SecurityUtils.getAppUserId(),list.stream().map(FbsProjectTaskApply::getId).collect(Collectors.toList()),SqlHelper.table(FbsProjectTaskApply.class).getTableName()); + return super.updateBatchById(list); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsProjectTaskServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsProjectTaskServiceImpl.java index ad9076b..bea5c31 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsProjectTaskServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsProjectTaskServiceImpl.java @@ -37,6 +37,8 @@ import com.ruoyi.fbs.service.IFbsProjectTaskService; import com.ruoyi.wgz.service.IWgzAttendanceService; import com.ruoyi.wgz.service.IWgzPayCalculationService; import com.ruoyi.zbf.domain.ZbfProject; +import com.ruoyi.zbf.domain.ZbfProjectSection; +import com.ruoyi.zbf.service.IZbfProjectSectionService; import com.ruoyi.zbf.service.IZbfProjectService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -72,6 +74,8 @@ public class FbsProjectTaskServiceImpl extends ServicePlusImpl wageList = wageApplicationService.appQueryList(wageDTO); -// appTaskDetailVO.setWageApplication(CollectionUtil.isEmpty(wageList)?null:wageList.get(0)); -// //收款金额 -// Integer taskReceiveAmount = wageList.stream().filter(wage -> AuditStatus.PASS.getCode().equals(wage.getAuditStatus())) -// .map(BgtWageApplicationListVO::getApplicantAmount) -// .reduce(BigDecimal.ZERO, BigDecimal::add).intValue(); -// appTaskDetailVO.setTaskReceiveAmount(taskReceiveAmount); -// //付款金额 -// BigDecimal payByTaskAndBgt = payCalculationService.getPayByTaskAndBgt(byId.getId(), byId.getUserId()); -// appTaskDetailVO.setTaskPaymentAmount(payByTaskAndBgt); - } return appTaskDetailVO; } @@ -198,7 +190,7 @@ public class FbsProjectTaskServiceImpl extends ServicePlusImpl fbsPageList(FbsTaskListDTO dto) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(FbsProjectTask::getCreateId,SecurityUtils.getAppUserId()); wrapper.in(dto.getType()==0,FbsProjectTask::getStatus,ProjectTaskStatus.getRelease()); wrapper.eq(dto.getType()==1,FbsProjectTask::getStatus,ProjectTaskStatus.COMPLETE.getCode()); wrapper.orderByDesc(FbsProjectTask::getId); @@ -339,6 +332,24 @@ public class FbsProjectTaskServiceImpl extends ServicePlusImpl releaseWrapper = new LambdaQueryWrapper<>(); + releaseWrapper.eq(FbsProjectTask::getCreateId,SecurityUtils.getAppUserId()); + releaseWrapper.in(FbsProjectTask::getStatus,ProjectTaskStatus.getRelease()); + Integer releaseCount = baseMapper.selectCount(releaseWrapper); + + LambdaQueryWrapper completeWrapper = new LambdaQueryWrapper<>(); + completeWrapper.eq(FbsProjectTask::getCreateId,SecurityUtils.getAppUserId()); + completeWrapper.eq(FbsProjectTask::getStatus,ProjectTaskStatus.COMPLETE.getCode()); + Integer completeCount = baseMapper.selectCount(completeWrapper); + + FbsProjectTaskListCountVO fbsProjectTaskListCountVO = new FbsProjectTaskListCountVO(); + fbsProjectTaskListCountVO.setReleaseCount(releaseCount); + fbsProjectTaskListCountVO.setCompleteCount(completeCount); + return fbsProjectTaskListCountVO; + } + @Override public FbsTaskDetailWageVO fbsWage(Long id) { FbsTaskDetailWageVO fbsTaskDetailWageVO = new FbsTaskDetailWageVO(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsUserServiceImpl.java index b792931..3980bd3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsUserServiceImpl.java @@ -18,6 +18,7 @@ import com.ruoyi.fbs.mapper.FbsUserMapper; import com.ruoyi.fbs.service.IFbsUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.Collection; import java.util.List; @@ -113,12 +114,14 @@ public class FbsUserServiceImpl extends ServicePlusImpl } @Override - public Boolean authenticate(CompanyAuthenticateDTO dto) { + @Transactional(rollbackFor = Exception.class) + public Long authenticate(CompanyAuthenticateDTO dto) { Company company = BeanUtil.copyProperties(dto, Company.class); - companyService.insert(company); + companyService.save(company); FbsUser fbsUser = selectUserByUserId(SecurityUtils.getAppUserId()); fbsUser.setCompanyId(company.getId()); - return updateById(fbsUser); + updateById(fbsUser); + return company.getId(); } @Override diff --git a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsWageApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsWageApplicationServiceImpl.java index 8a2b35c..1d7dbf7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsWageApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/fbs/service/impl/FbsWageApplicationServiceImpl.java @@ -5,6 +5,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.common.core.mybatisplus.core.ServicePlusImpl; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.AuditStatus; @@ -15,12 +16,26 @@ import com.ruoyi.fbs.domain.FbsWageApplication; import com.ruoyi.fbs.domain.dto.FbsWageApplicationListDTO; import com.ruoyi.fbs.mapper.FbsWageApplicationMapper; import com.ruoyi.fbs.service.IFbsWageApplicationService; +import com.ruoyi.zbf.domain.ZbfMessage; +import com.ruoyi.zbf.service.IZbfMessageService; +import com.ruoyi.zbf.service.IZbfProjectService; +import com.ruoyi.zbf.service.IZbfProjectSubcontractingService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.Collection; +import java.util.HashMap; import java.util.List; import java.util.Map; +import static com.ruoyi.common.constants.BgtMessageConstant.HEADLINE; +import static com.ruoyi.common.constants.BgtMessageConstant.SUBHEADING; +import static com.ruoyi.common.constants.FbsMessageConstant.FBS_TYPE_SETTLEMENT_TO_ZBF; +import static com.ruoyi.common.constants.FbsMessageConstant.fbsMessage; +import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*; +import static com.ruoyi.common.constants.ZbfMessageConstant.ZBF_LARGE_SETTLEMENT; + /** * 分包商工资申请Service业务层处理 * @@ -30,6 +45,13 @@ import java.util.Map; @Service public class FbsWageApplicationServiceImpl extends ServicePlusImpl implements IFbsWageApplicationService { + @Autowired + private IZbfMessageService zbfMessageService; + @Autowired + private IZbfProjectService projectService; + @Autowired + private IZbfProjectSubcontractingService projectSubcontractingService; + @Override public FbsWageApplication queryById(Long id){ return getById(id); @@ -72,10 +94,30 @@ public class FbsWageApplicationServiceImpl extends ServicePlusImpl fmp = new HashMap<>(); + fmp.put("auditor", SecurityUtils.getUsername()); + fmp.put("amount", bo.getApplicantAmount().toString()); + Map fmap = fbsMessage(fmp, FBS_TYPE_SETTLEMENT_TO_ZBF, true); + ZbfMessage zbfMessage = new ZbfMessage() + .setSenderType(USERTYPE_FBS) + .setSenderId(SecurityUtils.getAppUserId()) + .setRecipientType(USERTYPE_ZBF) + .setRecipientId(add.getReviewerId()) + .setHeadline(fmap.get(HEADLINE)) + .setSubheading(fmap.get(SUBHEADING)) + .setTableId(add.getId()) + .setTableName(SqlHelper.table(FbsWageApplication.class).getTableName()) + .setMessageLargeType(ZBF_LARGE_SETTLEMENT) + .setIsOperation(OPERATION_NEED); + zbfMessageService.sendAMessage(zbfMessage); + return save; } @Override diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/bo/ZbfMessageQueryBo.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/bo/ZbfMessageQueryBo.java new file mode 100644 index 0000000..5add8eb --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/bo/ZbfMessageQueryBo.java @@ -0,0 +1,79 @@ +package com.ruoyi.zbf.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.LocalDate; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 消息分页查询对象 zbf_message + * + * @author ruoyi + * @date 2025-03-31 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel("消息分页查询对象") +public class ZbfMessageQueryBo extends BaseEntity { + + /** 分页大小 */ + @ApiModelProperty("分页大小") + private Integer pageSize; + /** 当前页数 */ + @ApiModelProperty("当前页数") + private Integer pageNum; + /** 排序列 */ + @ApiModelProperty("排序列") + private String orderByColumn; + /** 排序的方向desc或者asc */ + @ApiModelProperty(value = "排序的方向", example = "asc,desc") + private String isAsc; + + + /** 发送类型(0系统 1务工者 2包工头 3分包商 4总包方) */ + @ApiModelProperty("发送类型(0系统 1务工者 2包工头 3分包商 4总包方)") + private String senderType; + /** 发送人 */ + @ApiModelProperty("发送人") + private Long senderId; + /** 接收类型(1务工者 2包工头 3分包商 4总包方) */ + @ApiModelProperty("接收类型(1务工者 2包工头 3分包商 4总包方)") + private String recipientType; + /** 接收人 */ + @ApiModelProperty("接收人") + private Long recipientId; + /** 标题 */ + @ApiModelProperty("标题") + private String headline; + /** 副标题 */ + @ApiModelProperty("副标题") + private String subheading; + /** 表ID */ + @ApiModelProperty("表ID") + private Long tableId; + /** 表名 */ + @ApiModelProperty("表名") + private String tableName; + /** 大类型(字典bgt_message_large_type) */ + @ApiModelProperty("大类型(字典bgt_message_large_type)") + private String messageLargeType; + /** 小类型(字典bgt_message_small_type) */ + @ApiModelProperty("小类型(字典bgt_message_small_type)") + private String messageSmallType; + /** 读状态(0未读 1已读) */ + @ApiModelProperty("读状态(0未读 1已读)") + private String readStatus; + /** 是否需要操作(0不需要 1需要 2已操作) */ + @ApiModelProperty("是否需要操作(0不需要 1需要 2已操作)") + private String isOperation; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/bo/ZbfUserQueryBo.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/bo/ZbfUserQueryBo.java new file mode 100644 index 0000000..3a9e09e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/bo/ZbfUserQueryBo.java @@ -0,0 +1,97 @@ +package com.ruoyi.zbf.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.LocalDate; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * APP总包方用户分页查询对象 zbf_user + * + * @author ruoyi + * @date 2025-03-31 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel("APP总包方用户分页查询对象") +public class ZbfUserQueryBo extends BaseEntity { + + /** 分页大小 */ + @ApiModelProperty("分页大小") + private Integer pageSize; + /** 当前页数 */ + @ApiModelProperty("当前页数") + private Integer pageNum; + /** 排序列 */ + @ApiModelProperty("排序列") + private String orderByColumn; + /** 排序的方向desc或者asc */ + @ApiModelProperty(value = "排序的方向", example = "asc,desc") + private String isAsc; + + + /** 唯一标识 */ + @ApiModelProperty("唯一标识") + private Long userId; + /** 联系电话 */ + @ApiModelProperty("联系电话") + private String phone; + /** 姓名 */ + @ApiModelProperty("姓名") + private String username; + /** 性别(0男 1女 2未知) */ + @ApiModelProperty("性别(0男 1女 2未知)") + private String gender; + /** 民族 */ + @ApiModelProperty("民族") + private String nation; + /** 出生日期 */ + @ApiModelProperty("出生日期") + private String birthdate; + /** 身份证号码 */ + @ApiModelProperty("身份证号码") + private String identityCard; + /** 所在区域 */ + @ApiModelProperty("所在区域") + private String area; + /** 地址 */ + @ApiModelProperty("地址") + private String site; + /** 银行 */ + @ApiModelProperty("银行") + private String bank; + /** 银行卡号 */ + @ApiModelProperty("银行卡号") + private String cardNo; + /** 头像地址 */ + @ApiModelProperty("头像地址") + private String avatarName; + /** 密码 */ + @ApiModelProperty("密码") + private String password; + /** 身份证正面图路径 */ + @ApiModelProperty("身份证正面图路径") + private String frontPath; + /** 身份证反面图路径 */ + @ApiModelProperty("身份证反面图路径") + private String reverseSidePath; + /** 银行卡图路径 */ + @ApiModelProperty("银行卡图路径") + private String bankCardPath; + /** 关联公司Id */ + @ApiModelProperty("关联公司Id") + private Long companyId; + /** 帐号状态(0正常 1停用) */ + @ApiModelProperty("帐号状态(0正常 1停用)") + private String status; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/controller/ZbfMessageController.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/controller/ZbfMessageController.java new file mode 100644 index 0000000..1372f33 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/controller/ZbfMessageController.java @@ -0,0 +1,108 @@ +package com.ruoyi.zbf.controller; + +import java.util.List; +import java.util.Arrays; + +import com.ruoyi.zbf.domain.ZbfMessage; +import lombok.RequiredArgsConstructor; +import javax.validation.constraints.*; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.zbf.bo.ZbfMessageQueryBo; +import com.ruoyi.zbf.service.IZbfMessageService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * 消息Controller + * + * @author ruoyi + * @date 2025-03-31 + */ +@Api(value = "消息控制器", tags = {"消息管理"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RestController +@RequestMapping("/zbf/message") +public class ZbfMessageController extends BaseController { + + private final IZbfMessageService iZbfMessageService; + + /** + * 查询消息列表 + */ + @ApiOperation("查询消息列表") + @PreAuthorize("@ss.hasPermi('zbf:message:list')") + @GetMapping("/list") + public TableDataInfo list(@Validated ZbfMessageQueryBo bo) { + return iZbfMessageService.queryPageList(bo); + } + + /** + * 导出消息列表 + */ + @ApiOperation("导出消息列表") + @PreAuthorize("@ss.hasPermi('zbf:message:export')") + @Log(title = "消息", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(@Validated ZbfMessageQueryBo bo) { + List list = iZbfMessageService.queryList(bo); + ExcelUtil util = new ExcelUtil(ZbfMessage.class); + return util.exportExcel(list, "消息"); + } + + /** + * 获取消息详细信息 + */ + @ApiOperation("获取消息详细信息") + @PreAuthorize("@ss.hasPermi('zbf:message:query')") + @GetMapping("/{id}") + public AjaxResult getInfo(@NotNull(message = "主键不能为空") + @PathVariable("id") Long id) { + return AjaxResult.success(iZbfMessageService.queryById(id)); + } + + /** + * 新增消息 + */ + @ApiOperation("新增消息") + @PreAuthorize("@ss.hasPermi('zbf:message:add')") + @Log(title = "消息", businessType = BusinessType.INSERT) + @RepeatSubmit + @PostMapping() + public AjaxResult add(@Validated @RequestBody ZbfMessage bo) { + return toAjax(iZbfMessageService.insert(bo) ? 1 : 0); + } + + /** + * 修改消息 + */ + @ApiOperation("修改消息") + @PreAuthorize("@ss.hasPermi('zbf:message:edit')") + @Log(title = "消息", businessType = BusinessType.UPDATE) + @RepeatSubmit + @PutMapping() + public AjaxResult edit(@Validated @RequestBody ZbfMessage bo) { + return toAjax(iZbfMessageService.update(bo) ? 1 : 0); + } + + /** + * 删除消息 + */ + @ApiOperation("删除消息") + @PreAuthorize("@ss.hasPermi('zbf:message:remove')") + @Log(title = "消息" , businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ids) { + return toAjax(iZbfMessageService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/ZbfMessage.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/ZbfMessage.java new file mode 100644 index 0000000..8a20a7a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/ZbfMessage.java @@ -0,0 +1,133 @@ +package com.ruoyi.zbf.domain; + +import com.ruoyi.common.annotation.Excel; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import java.io.Serializable; +import java.util.Date; +import java.math.BigDecimal; + +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.LocalDate; + +/** + * 消息对象 zbf_message + * + * @author ruoyi + * @date 2025-03-31 + */ +@Data +@NoArgsConstructor +@Accessors(chain = true) +@TableName("zbf_message") +@ApiModel("消息视图对象") +public class ZbfMessage implements Serializable { + + private static final long serialVersionUID=1L; + + /** 主键自增ID */ + @ApiModelProperty("主键自增ID") + @TableId(value = "id") + private Long id; + + /** 发送类型(0系统 1务工者 2包工头 3分包商 4总包方) */ + @Excel(name = "发送类型" , readConverterExp = "0=系统,1=务工者,2=包工头,3=分包商,4=总包方") + @ApiModelProperty("发送类型(0系统 1务工者 2包工头 3分包商 4总包方)") + private String senderType; + + /** 发送人 */ + @Excel(name = "发送人") + @ApiModelProperty("发送人") + private Long senderId; + + /** 接收类型(1务工者 2包工头 3分包商 4总包方) */ + @Excel(name = "接收类型" , readConverterExp = "1=务工者,2=包工头,3=分包商,4=总包方") + @ApiModelProperty("接收类型(1务工者 2包工头 3分包商 4总包方)") + private String recipientType; + + /** 接收人 */ + @Excel(name = "接收人") + @ApiModelProperty("接收人") + private Long recipientId; + + /** 标题 */ + @Excel(name = "标题") + @ApiModelProperty("标题") + private String headline; + + /** 副标题 */ + @Excel(name = "副标题") + @ApiModelProperty("副标题") + private String subheading; + + /** 表ID */ + @Excel(name = "表ID") + @ApiModelProperty("表ID") + private Long tableId; + + /** 表名 */ + @Excel(name = "表名") + @ApiModelProperty("表名") + private String tableName; + + /** 大类型(字典bgt_message_large_type) */ + @Excel(name = "大类型" , readConverterExp = "字=典bgt_message_large_type") + @ApiModelProperty("大类型(字典bgt_message_large_type)") + private String messageLargeType; + + /** 小类型(字典bgt_message_small_type) */ + @Excel(name = "小类型" , readConverterExp = "字=典bgt_message_small_type") + @ApiModelProperty("小类型(字典bgt_message_small_type)") + private String messageSmallType; + + /** 读状态(0未读 1已读) */ + @Excel(name = "读状态" , readConverterExp = "0=未读,1=已读") + @ApiModelProperty("读状态(0未读 1已读)") + private String readStatus; + + /** 删除标志(0代表存在 2代表删除) */ + @Excel(name = "删除标志" , readConverterExp = "0=代表存在,2=代表删除") + @ApiModelProperty("删除标志(0代表存在 2代表删除)") + private String delFlag; + + /** 创建者 */ + @Excel(name = "创建者") + @ApiModelProperty("创建者") + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** 创建时间 */ + @Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** 更新者 */ + @Excel(name = "更新者") + @ApiModelProperty("更新者") + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** 更新时间 */ + @Excel(name = "更新时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** 备注 */ + @Excel(name = "备注") + @ApiModelProperty("备注") + private String remark; + + /** 是否需要操作(0不需要 1需要 2已操作) */ + @Excel(name = "是否需要操作" , readConverterExp = "0=不需要,1=需要,2=已操作") + @ApiModelProperty("是否需要操作(0不需要 1需要 2已操作)") + private String isOperation; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/dto/ZbfProjectAddDTO.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/dto/ZbfProjectAddDTO.java new file mode 100644 index 0000000..86ec0ba --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/dto/ZbfProjectAddDTO.java @@ -0,0 +1,48 @@ +package com.ruoyi.zbf.domain.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * 总包方项目对象 zbf_project + * + * @author ruoyi + * @date 2025-02-17 + */ +@Data +@Accessors(chain = true) +@ApiModel("总包方项目新增视图对象") +public class ZbfProjectAddDTO { + + @ApiModelProperty("单位名称") + private String unitName; + + @ApiModelProperty("统一社会信用代码") + private String creditCode; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("项目图片") + private String projectImg; + + @ApiModelProperty("项目地址") + private String projectAddress; + + @ApiModelProperty("联系人") + private String contactPerson; + + @ApiModelProperty("联系电话") + private String contactPhone; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("标段列表") + private List sectionList; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/dto/ZbfProjectListDTO.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/dto/ZbfProjectListDTO.java new file mode 100644 index 0000000..5c15ee8 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/dto/ZbfProjectListDTO.java @@ -0,0 +1,32 @@ +package com.ruoyi.zbf.domain.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 总包方项目对象 zbf_project + * + * @author ruoyi + * @date 2025-02-17 + */ +@Data +@Accessors(chain = true) +@ApiModel("总包方项目列表视图对象") +public class ZbfProjectListDTO { + + /** 分页大小 */ + @ApiModelProperty("分页大小") + private Integer pageSize; + /** 当前页数 */ + @ApiModelProperty("当前页数") + private Integer pageNum; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("项目状态(0-未开工,1-已开工,2已竣工,3已停工)") + private String projectStatus; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/dto/ZbfProjectSectionAddDTO.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/dto/ZbfProjectSectionAddDTO.java new file mode 100644 index 0000000..be1d36b --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/dto/ZbfProjectSectionAddDTO.java @@ -0,0 +1,30 @@ +package com.ruoyi.zbf.domain.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * 总包方项目标段对象 zbf_project_section + * + * @author ruoyi + * @date 2025-02-17 + */ +@Data +@Accessors(chain = true) +@ApiModel("总包方项目标段新增视图对象") +public class ZbfProjectSectionAddDTO { + + @ApiModelProperty("标段名称") + private String sectionName; + + @ApiModelProperty("标段描述") + private String sectionDescribe; + + @ApiModelProperty("分包列表") + private List subList; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/dto/ZbfProjectSubcontractingAddDTO.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/dto/ZbfProjectSubcontractingAddDTO.java new file mode 100644 index 0000000..8376c44 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/dto/ZbfProjectSubcontractingAddDTO.java @@ -0,0 +1,37 @@ +package com.ruoyi.zbf.domain.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +/** + * 总包方项目分包对象 zbf_project_subcontracting + * + * @author ruoyi + * @date 2025-02-17 + */ +@Data +@Accessors(chain = true) +@ApiModel("总包方项目分包新增视图对象") +public class ZbfProjectSubcontractingAddDTO { + + + @ApiModelProperty("分包主题") + private String subName; + + @ApiModelProperty("分包描述") + private String subDescribe; + + @ApiModelProperty("分包金额") + private BigDecimal subAmount; + + @ApiModelProperty("资质要求") + private String qualification; + + @ApiModelProperty("备注") + private String remark; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/vo/ZbfProjectCountVO.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/vo/ZbfProjectCountVO.java new file mode 100644 index 0000000..6a2426e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/vo/ZbfProjectCountVO.java @@ -0,0 +1,22 @@ +package com.ruoyi.zbf.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("包工头项目统计") +public class ZbfProjectCountVO { + + @ApiModelProperty("项目总数") + private Integer allCount; + + @ApiModelProperty("在建总数") + private Integer startCount; + + @ApiModelProperty("完成总数") + private Integer completeCount; + + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/vo/ZbfProjectListVO.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/vo/ZbfProjectListVO.java new file mode 100644 index 0000000..68ebf14 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/vo/ZbfProjectListVO.java @@ -0,0 +1,34 @@ +package com.ruoyi.zbf.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +@ApiModel("分包商项目列表") +public class ZbfProjectListVO { + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("单位名称") + private String unitName; + + @ApiModelProperty("项目地址") + private String projectAddress; + + @ApiModelProperty("项目图片") + private String projectImg; + + @ApiModelProperty("项目状态(0-未开工,1-已开工,2已竣工,3已停工)") + private String projectStatus; + + @ApiModelProperty("标段列表") + private List sectionList; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/vo/ZbfProjectSectionListVO.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/vo/ZbfProjectSectionListVO.java new file mode 100644 index 0000000..c0d766d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/vo/ZbfProjectSectionListVO.java @@ -0,0 +1,29 @@ +package com.ruoyi.zbf.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +@ApiModel("分包商项目标段列表") +public class ZbfProjectSectionListVO { + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + /** 标段名称 */ + @ApiModelProperty("标段名称") + private String sectionName; + + @ApiModelProperty("项目地址") + private String projectAddress; + + @ApiModelProperty("分包列表") + private List subList; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/vo/ZbfProjectSubcontractingListVO.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/vo/ZbfProjectSubcontractingListVO.java new file mode 100644 index 0000000..bfd6174 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/domain/vo/ZbfProjectSubcontractingListVO.java @@ -0,0 +1,42 @@ +package com.ruoyi.zbf.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +@ApiModel("分包商项目分包列表") +public class ZbfProjectSubcontractingListVO { + + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目地址") + private String projectAddress; + + /** 标段ID */ + @ApiModelProperty("标段ID") + private Long sectionId; + /** 分包主题 */ + @ApiModelProperty("分包主题") + private String subName; + /** 分包描述 */ + @ApiModelProperty("分包描述") + private String subDescribe; + /** 分包金额 */ + @ApiModelProperty("分包金额") + private BigDecimal subAmount; + /** 资质要求 */ + @ApiModelProperty("资质要求") + private String qualification; + + @ApiModelProperty("申请状态(0=申请中,1=已同意,2=已拒绝,3=已取消)") + private String applyStatus; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/mapper/ZbfMessageMapper.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/mapper/ZbfMessageMapper.java new file mode 100644 index 0000000..4a36f24 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/mapper/ZbfMessageMapper.java @@ -0,0 +1,18 @@ +package com.ruoyi.zbf.mapper; + +import com.ruoyi.zbf.domain.ZbfMessage; +import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus; +import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache; +import org.apache.ibatis.annotations.CacheNamespace; + +/** + * 消息Mapper接口 + * + * @author ruoyi + * @date 2025-03-31 + */ +// 如使需切换数据源 请勿使用缓存 会造成数据不一致现象 +@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class) +public interface ZbfMessageMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/mapper/ZbfProjectMapper.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/mapper/ZbfProjectMapper.java index e0f54ef..a29d87f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/zbf/mapper/ZbfProjectMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/mapper/ZbfProjectMapper.java @@ -31,4 +31,18 @@ public interface ZbfProjectMapper extends BaseMapperPlus { // 查询分包商已竣工的项目列表 Page completeList(@Param("page") Page page, @Param("dto") FbsProjectListDTO dto); + + // 查询分包商项目切换列表 + Page switchList(@Param("page") Page page, @Param("dto") FbsProjectListDTO dto); + + // 申请中的项目列表统计 + Integer applyCount(@Param("fbsUserId") Long fbsUserId); + + // 已加入的项目列表统计 + Integer joinCount(@Param("fbsUserId") Long fbsUserId); + + // 已竣工的项目列表统计 + Integer completeCount(@Param("fbsUserId") Long fbsUserId); + + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/mapper/ZbfUserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/mapper/ZbfUserMapper.java new file mode 100644 index 0000000..9ab04d1 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/mapper/ZbfUserMapper.java @@ -0,0 +1,18 @@ +package com.ruoyi.zbf.mapper; + +import com.ruoyi.common.core.domain.entity.ZbfUser; +import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus; +import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache; +import org.apache.ibatis.annotations.CacheNamespace; + +/** + * APP总包方用户Mapper接口 + * + * @author ruoyi + * @date 2025-03-31 + */ +// 如使需切换数据源 请勿使用缓存 会造成数据不一致现象 +@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class) +public interface ZbfUserMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/service/IZbfMessageService.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/service/IZbfMessageService.java new file mode 100644 index 0000000..3b92cb6 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/service/IZbfMessageService.java @@ -0,0 +1,60 @@ +package com.ruoyi.zbf.service; + +import com.ruoyi.common.core.mybatisplus.core.IServicePlus; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.zbf.bo.ZbfMessageQueryBo; +import com.ruoyi.zbf.domain.ZbfMessage; + +import java.util.Collection; +import java.util.List; + +/** + * 消息Service接口 + * + * @author ruoyi + * @date 2025-03-31 + */ +public interface IZbfMessageService extends IServicePlus { + /** + * 查询单个 + * @return + */ + ZbfMessage queryById(Long id); + + /** + * 查询列表 + */ + TableDataInfo queryPageList(ZbfMessageQueryBo bo); + + /** + * 查询列表 + */ + List queryList(ZbfMessageQueryBo bo); + + /** + * 根据新增业务对象插入消息 + * @param bo 消息新增业务对象 + * @return + */ + Boolean insert(ZbfMessage bo); + + /** + * 根据编辑业务对象修改消息 + * @param bo 消息编辑业务对象 + * @return + */ + Boolean update(ZbfMessage bo); + + /** + * 校验并删除数据 + * @param ids 主键集合 + * @param isValid 是否校验,true-删除前校验,false-不校验 + * @return + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + /** + * 发送消息 + */ + Boolean sendAMessage(ZbfMessage bo); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/service/IZbfProjectService.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/service/IZbfProjectService.java index cc16e15..569e42e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/zbf/service/IZbfProjectService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/service/IZbfProjectService.java @@ -5,9 +5,14 @@ import com.ruoyi.common.core.mybatisplus.core.IServicePlus; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.fbs.domain.dto.FbsProjectListDTO; import com.ruoyi.fbs.domain.vo.FbsProjectDetailVO; +import com.ruoyi.fbs.domain.vo.FbsProjectListCountVO; import com.ruoyi.fbs.domain.vo.FbsProjectListVO; import com.ruoyi.zbf.bo.ZbfProjectQueryBo; import com.ruoyi.zbf.domain.ZbfProject; +import com.ruoyi.zbf.domain.dto.ZbfProjectAddDTO; +import com.ruoyi.zbf.domain.dto.ZbfProjectListDTO; +import com.ruoyi.zbf.domain.vo.ZbfProjectCountVO; +import com.ruoyi.zbf.domain.vo.ZbfProjectListVO; import java.util.Collection; import java.util.List; @@ -77,6 +82,16 @@ public interface IZbfProjectService extends IServicePlus { */ TableDataInfo completeList(FbsProjectListDTO dto); + /** + * 分包商查询我的项目列表-项目切换 + */ + TableDataInfo switchList(FbsProjectListDTO dto); + + /** + * 分包商查询自己的项目列表数量统计 + */ + FbsProjectListCountVO myListCount(); + /** * 分包商查看可报名项目详情 */ @@ -92,4 +107,18 @@ public interface IZbfProjectService extends IServicePlus { */ FbsProjectDetailVO joinOrCompleteDetail(Long projectId); + /** + * 总包方新增项目 + */ + Boolean add(ZbfProjectAddDTO dto); + + /** + * 总包方查询我的项目列表 + */ + TableDataInfo queryZbfList(ZbfProjectListDTO dto); + + /** + * 总包方查询自建项目统计 + */ + ZbfProjectCountVO projectCount(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/service/IZbfProjectSubcontractingApplyService.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/service/IZbfProjectSubcontractingApplyService.java index 803db0d..da26f83 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/zbf/service/IZbfProjectSubcontractingApplyService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/service/IZbfProjectSubcontractingApplyService.java @@ -52,4 +52,9 @@ public interface IZbfProjectSubcontractingApplyService extends IServicePlus ids, Boolean isValid); + + /** + * 总包方选择分包商 + */ + Boolean choose(Long id); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/service/IZbfUserService.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/service/IZbfUserService.java new file mode 100644 index 0000000..305cded --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/service/IZbfUserService.java @@ -0,0 +1,60 @@ +package com.ruoyi.zbf.service; + +import com.ruoyi.common.core.domain.entity.ZbfUser; +import com.ruoyi.common.core.mybatisplus.core.IServicePlus; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.zbf.bo.ZbfUserQueryBo; + +import java.util.Collection; +import java.util.List; + +/** + * APP总包方用户Service接口 + * + * @author ruoyi + * @date 2025-03-31 + */ +public interface IZbfUserService extends IServicePlus { + /** + * 查询单个 + * @return + */ + ZbfUser queryById(Long id); + + /** + * 查询列表 + */ + TableDataInfo queryPageList(ZbfUserQueryBo bo); + + /** + * 查询列表 + */ + List queryList(ZbfUserQueryBo bo); + + /** + * 根据新增业务对象插入APP总包方用户 + * @param bo APP总包方用户新增业务对象 + * @return + */ + Boolean insert(ZbfUser bo); + + /** + * 根据编辑业务对象修改APP总包方用户 + * @param bo APP总包方用户编辑业务对象 + * @return + */ + Boolean update(ZbfUser bo); + + /** + * 校验并删除数据 + * @param ids 主键集合 + * @param isValid 是否校验,true-删除前校验,false-不校验 + * @return + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + /** + * 通过电话查询用户 + */ + ZbfUser selectUserByPhone(String phone); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/service/impl/ZbfMessageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/service/impl/ZbfMessageServiceImpl.java new file mode 100644 index 0000000..838377f --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/service/impl/ZbfMessageServiceImpl.java @@ -0,0 +1,99 @@ +package com.ruoyi.zbf.service.impl; + +import cn.hutool.core.bean.BeanUtil; +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.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.zbf.bo.ZbfMessageQueryBo; +import com.ruoyi.zbf.domain.ZbfMessage; +import com.ruoyi.zbf.mapper.ZbfMessageMapper; +import com.ruoyi.zbf.service.IZbfMessageService; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * 消息Service业务层处理 + * + * @author ruoyi + * @date 2025-03-31 + */ +@Service +public class ZbfMessageServiceImpl extends ServicePlusImpl implements IZbfMessageService { + + @Override + public ZbfMessage queryById(Long id){ + return getById(id); + } + + @Override + public TableDataInfo queryPageList(ZbfMessageQueryBo bo) { + Page result = page(PageUtils.buildPage(), buildQueryWrapper(bo)); + return PageUtils.buildDataInfo(result); + } + + @Override + public List queryList(ZbfMessageQueryBo bo) { + return list(buildQueryWrapper(bo)); + } + + private LambdaQueryWrapper buildQueryWrapper(ZbfMessageQueryBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(StrUtil.isNotBlank(bo.getSenderType()), ZbfMessage::getSenderType, bo.getSenderType()); + lqw.eq(bo.getSenderId() != null, ZbfMessage::getSenderId, bo.getSenderId()); + lqw.eq(StrUtil.isNotBlank(bo.getRecipientType()), ZbfMessage::getRecipientType, bo.getRecipientType()); + lqw.eq(bo.getRecipientId() != null, ZbfMessage::getRecipientId, bo.getRecipientId()); + lqw.eq(StrUtil.isNotBlank(bo.getHeadline()), ZbfMessage::getHeadline, bo.getHeadline()); + lqw.eq(StrUtil.isNotBlank(bo.getSubheading()), ZbfMessage::getSubheading, bo.getSubheading()); + lqw.eq(bo.getTableId() != null, ZbfMessage::getTableId, bo.getTableId()); + lqw.like(StrUtil.isNotBlank(bo.getTableName()), ZbfMessage::getTableName, bo.getTableName()); + lqw.eq(StrUtil.isNotBlank(bo.getMessageLargeType()), ZbfMessage::getMessageLargeType, bo.getMessageLargeType()); + lqw.eq(StrUtil.isNotBlank(bo.getMessageSmallType()), ZbfMessage::getMessageSmallType, bo.getMessageSmallType()); + lqw.eq(StrUtil.isNotBlank(bo.getReadStatus()), ZbfMessage::getReadStatus, bo.getReadStatus()); + lqw.eq(StrUtil.isNotBlank(bo.getIsOperation()), ZbfMessage::getIsOperation, bo.getIsOperation()); + return lqw; + } + + @Override + public Boolean insert(ZbfMessage bo) { + ZbfMessage add = BeanUtil.toBean(bo, ZbfMessage.class); + validEntityBeforeSave(add); + return save(add); + } + + @Override + public Boolean update(ZbfMessage bo) { + ZbfMessage update = BeanUtil.toBean(bo, ZbfMessage.class); + validEntityBeforeSave(update); + return updateById(update); + } + + /** + * 保存前的数据校验 + * + * @param entity 实体类数据 + */ + private void validEntityBeforeSave(ZbfMessage entity){ + //TODO 做一些数据校验,如唯一约束 + } + + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return removeByIds(ids); + } + + @Override + public Boolean sendAMessage(ZbfMessage bo) { + return save(bo); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/service/impl/ZbfProjectSectionServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/service/impl/ZbfProjectSectionServiceImpl.java index 3ca1854..d9dbcfb 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/zbf/service/impl/ZbfProjectSectionServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/service/impl/ZbfProjectSectionServiceImpl.java @@ -113,6 +113,7 @@ public class ZbfProjectSectionServiceImpl extends ServicePlusImpl queryPageList(ZbfProjectQueryBo bo) { - Page result = page(PageUtils.buildPage(), buildQueryWrapper(bo)); - return PageUtils.buildDataInfo(result); - } + @Override + public TableDataInfo queryPageList(ZbfProjectQueryBo bo) { + Page result = page(PageUtils.buildPage(), buildQueryWrapper(bo)); + return PageUtils.buildDataInfo(result); + } - @Override - public List queryList(ZbfProjectQueryBo bo) { - return list(buildQueryWrapper(bo)); - } + @Override + public List queryList(ZbfProjectQueryBo bo) { + return list(buildQueryWrapper(bo)); + } - private LambdaQueryWrapper buildQueryWrapper(ZbfProjectQueryBo bo) { - Map params = bo.getParams(); - LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); - lqw.eq(bo.getUserId() != null, ZbfProject::getUserId, bo.getUserId()); - lqw.like(StrUtil.isNotBlank(bo.getUnitName()), ZbfProject::getUnitName, bo.getUnitName()); - lqw.eq(StrUtil.isNotBlank(bo.getCreditCode()), ZbfProject::getCreditCode, bo.getCreditCode()); - lqw.like(StrUtil.isNotBlank(bo.getProjectName()), ZbfProject::getProjectName, bo.getProjectName()); - lqw.eq(StrUtil.isNotBlank(bo.getProjectImg()), ZbfProject::getProjectImg, bo.getProjectImg()); - lqw.eq(StrUtil.isNotBlank(bo.getProjectAddress()), ZbfProject::getProjectAddress, bo.getProjectAddress()); - lqw.eq(StrUtil.isNotBlank(bo.getContactPerson()), ZbfProject::getContactPerson, bo.getContactPerson()); - lqw.eq(StrUtil.isNotBlank(bo.getContactPhone()), ZbfProject::getContactPhone, bo.getContactPhone()); - return lqw; - } + private LambdaQueryWrapper buildQueryWrapper(ZbfProjectQueryBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getUserId() != null, ZbfProject::getUserId, bo.getUserId()); + lqw.like(StrUtil.isNotBlank(bo.getUnitName()), ZbfProject::getUnitName, bo.getUnitName()); + lqw.eq(StrUtil.isNotBlank(bo.getCreditCode()), ZbfProject::getCreditCode, bo.getCreditCode()); + lqw.like(StrUtil.isNotBlank(bo.getProjectName()), ZbfProject::getProjectName, bo.getProjectName()); + lqw.eq(StrUtil.isNotBlank(bo.getProjectImg()), ZbfProject::getProjectImg, bo.getProjectImg()); + lqw.eq(StrUtil.isNotBlank(bo.getProjectAddress()), ZbfProject::getProjectAddress, bo.getProjectAddress()); + lqw.eq(StrUtil.isNotBlank(bo.getContactPerson()), ZbfProject::getContactPerson, bo.getContactPerson()); + lqw.eq(StrUtil.isNotBlank(bo.getContactPhone()), ZbfProject::getContactPhone, bo.getContactPhone()); + return lqw; + } - @Override - public Boolean insert(ZbfProject bo) { - ZbfProject add = BeanUtil.toBean(bo, ZbfProject.class); - validEntityBeforeSave(add); - return save(add); - } + @Override + public Boolean insert(ZbfProject bo) { + ZbfProject add = BeanUtil.toBean(bo, ZbfProject.class); + validEntityBeforeSave(add); + return save(add); + } - @Override - public Boolean update(ZbfProject bo) { - ZbfProject update = BeanUtil.toBean(bo, ZbfProject.class); - validEntityBeforeSave(update); - return updateById(update); - } + @Override + public Boolean update(ZbfProject bo) { + ZbfProject update = BeanUtil.toBean(bo, ZbfProject.class); + validEntityBeforeSave(update); + return updateById(update); + } - /** - * 保存前的数据校验 - * - * @param entity 实体类数据 - */ - private void validEntityBeforeSave(ZbfProject entity){ - //TODO 做一些数据校验,如唯一约束 - } + /** + * 保存前的数据校验 + * + * @param entity 实体类数据 + */ + private void validEntityBeforeSave(ZbfProject entity) { + //TODO 做一些数据校验,如唯一约束 + } - @Override - public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { - if(isValid){ - //TODO 做一些业务上的校验,判断是否需要校验 - } - return removeByIds(ids); - } + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if (isValid) { + //TODO 做一些业务上的校验,判断是否需要校验 + } + return removeByIds(ids); + } @Override public TableDataInfo signUpList(FbsProjectListDTO dto) { @@ -121,34 +125,44 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl queryVOPage = baseMapper.signUpList(queryDTOPage, dto); //处理标段和分包 for (FbsProjectListVO fbsProjectListVO : queryVOPage.getRecords()) { - Long projectId = fbsProjectListVO.getId(); + Long projectId = fbsProjectListVO.getId(); //查询项目下的所有申请 List applyList = zbfProjectSubcontractingApplyService.list(Wrappers.lambdaQuery() - .eq(ZbfProjectSubcontractingApply::getProjectId, projectId).eq(ZbfProjectSubcontractingApply::getFbsUserId, SecurityUtils.getAppUserId())); - List applyIds = applyList.stream().map(ZbfProjectSubcontractingApply::getSubId).collect(Collectors.toList()); + .eq(ZbfProjectSubcontractingApply::getProjectId, projectId) + .eq(ZbfProjectSubcontractingApply::getFbsUserId, SecurityUtils.getAppUserId())); + HashMap map = applyList.stream() + .collect(Collectors.toMap( + ZbfProjectSubcontractingApply::getSubId, + ZbfProjectSubcontractingApply::getApplyStatus, + (existing, replacement) -> replacement, + HashMap::new + )); //标段处理 List sectionListVO = new ArrayList<>(); //查询项目下的所有标段 List sectionList = zbfProjectSectionService.list(Wrappers.lambdaQuery() .eq(ZbfProjectSection::getProjectId, projectId)); - for (ZbfProjectSection zbfProjectSection : sectionList){ + for (ZbfProjectSection zbfProjectSection : sectionList) { //分包处理 List subListVO = new ArrayList<>(); - //查询标段下的所有未承接的分包 + //查询标段下的所有的分包 List subList = zbfProjectSubcontractingService.list(Wrappers.lambdaQuery() - .eq(ZbfProjectSubcontracting::getSectionId, zbfProjectSection.getId()) - .isNull(ZbfProjectSubcontracting::getUserId)); + .eq(ZbfProjectSubcontracting::getSectionId, zbfProjectSection.getId()) + //.isNull(ZbfProjectSubcontracting::getUserId) + ); //排除掉已申请的分包 - for (ZbfProjectSubcontracting sub : subList){ - if(applyIds.contains(sub.getId())){ - continue; - } + for (ZbfProjectSubcontracting sub : subList) { FbsProjectSubcontractingListVO fbsProjectSubcontractingListVO = new FbsProjectSubcontractingListVO(); BeanUtil.copyProperties(sub, fbsProjectSubcontractingListVO); + String applyStatus = map.get(sub.getId()); + fbsProjectSubcontractingListVO.setApplyStatus(applyStatus); + if (sub.getUserId() != null && !sub.getUserId().equals(SecurityUtils.getAppUserId())) { + fbsProjectSubcontractingListVO.setApplyStatus(SubcontractingApplyStatus.CHOOSE.getCode()); + } subListVO.add(fbsProjectSubcontractingListVO); } - if(CollectionUtil.isEmpty(subListVO)){ + if (CollectionUtil.isEmpty(subListVO)) { continue; } FbsProjectSectionListVO fbsProjectSectionListVO = new FbsProjectSectionListVO(); @@ -158,7 +172,7 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl queryVOPage = baseMapper.applyList(queryDTOPage, dto); //处理标段和分包 for (FbsProjectListVO fbsProjectListVO : queryVOPage.getRecords()) { - Long projectId = fbsProjectListVO.getId(); + Long projectId = fbsProjectListVO.getId(); //查询项目下的所有已申请和已拒绝申请 List applyList = zbfProjectSubcontractingApplyService.list(Wrappers.lambdaQuery() .eq(ZbfProjectSubcontractingApply::getProjectId, projectId) @@ -185,22 +199,22 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl sectionList = zbfProjectSectionService.list(Wrappers.lambdaQuery() .eq(ZbfProjectSection::getProjectId, projectId)); - for (ZbfProjectSection zbfProjectSection : sectionList){ + for (ZbfProjectSection zbfProjectSection : sectionList) { //分包处理 List subListVO = new ArrayList<>(); //查询标段下的所有的分包 List subList = zbfProjectSubcontractingService.list(Wrappers.lambdaQuery() .eq(ZbfProjectSubcontracting::getSectionId, zbfProjectSection.getId())); //排除掉未申请和已同意的分包 - for (ZbfProjectSubcontracting sub : subList){ - if(!applyIds.contains(sub.getId())){ + for (ZbfProjectSubcontracting sub : subList) { + if (!applyIds.contains(sub.getId())) { continue; } FbsProjectSubcontractingListVO fbsProjectSubcontractingListVO = new FbsProjectSubcontractingListVO(); BeanUtil.copyProperties(sub, fbsProjectSubcontractingListVO); subListVO.add(fbsProjectSubcontractingListVO); } - if(CollectionUtil.isEmpty(subListVO)){ + if (CollectionUtil.isEmpty(subListVO)) { continue; } FbsProjectSectionListVO fbsProjectSectionListVO = new FbsProjectSectionListVO(); @@ -223,7 +237,7 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl queryVOPage = baseMapper.joinList(queryDTOPage, dto); //处理标段和分包 for (FbsProjectListVO fbsProjectListVO : queryVOPage.getRecords()) { - Long projectId = fbsProjectListVO.getId(); + Long projectId = fbsProjectListVO.getId(); fbsProjectListVO.setSectionList(handleSection(projectId)); } return PageUtils.buildDataInfo(queryVOPage); @@ -238,12 +252,32 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl queryVOPage = baseMapper.completeList(queryDTOPage, dto); //处理标段和分包 for (FbsProjectListVO fbsProjectListVO : queryVOPage.getRecords()) { - Long projectId = fbsProjectListVO.getId(); + Long projectId = fbsProjectListVO.getId(); fbsProjectListVO.setSectionList(handleSection(projectId)); } return PageUtils.buildDataInfo(queryVOPage); } + @Override + public TableDataInfo switchList(FbsProjectListDTO dto) { + Page queryDTOPage = new Page<>(); + queryDTOPage.setCurrent(dto.getPageNum()); + queryDTOPage.setSize(dto.getPageSize()); + dto.setFbsUserId(SecurityUtils.getAppUserId()); + Page queryVOPage = baseMapper.switchList(queryDTOPage, dto); + return PageUtils.buildDataInfo(queryVOPage); + } + + @Override + public FbsProjectListCountVO myListCount() { + FbsProjectListCountVO fbsProjectListCountVO = new FbsProjectListCountVO(); + Long appUserId = SecurityUtils.getAppUserId(); + fbsProjectListCountVO.setApplyCount(baseMapper.applyCount(appUserId)); + fbsProjectListCountVO.setJoinCount(baseMapper.joinCount(appUserId)); + fbsProjectListCountVO.setCompleteCount(baseMapper.completeCount(appUserId)); + return fbsProjectListCountVO; + } + @Override public FbsProjectDetailVO signUpDetail(Long projectId) { ZbfProject byId = getById(projectId); @@ -251,31 +285,41 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl applyList = zbfProjectSubcontractingApplyService.list(Wrappers.lambdaQuery() - .eq(ZbfProjectSubcontractingApply::getProjectId, projectId).eq(ZbfProjectSubcontractingApply::getFbsUserId, SecurityUtils.getAppUserId())); - List applyIds = applyList.stream().map(ZbfProjectSubcontractingApply::getSubId).collect(Collectors.toList()); - + .eq(ZbfProjectSubcontractingApply::getProjectId, projectId) + .eq(ZbfProjectSubcontractingApply::getFbsUserId, SecurityUtils.getAppUserId())); + HashMap map = applyList.stream() + .collect(Collectors.toMap( + ZbfProjectSubcontractingApply::getSubId, + ZbfProjectSubcontractingApply::getApplyStatus, + (existing, replacement) -> replacement, + HashMap::new + )); //标段处理 List sectionListVO = new ArrayList<>(); //查询项目下的所有标段 List sectionList = zbfProjectSectionService.list(Wrappers.lambdaQuery() .eq(ZbfProjectSection::getProjectId, projectId)); - for (ZbfProjectSection zbfProjectSection : sectionList){ + for (ZbfProjectSection zbfProjectSection : sectionList) { //分包处理 List subListVO = new ArrayList<>(); - //查询标段下的所有未承接的分包 + //查询标段下的所有的分包 List subList = zbfProjectSubcontractingService.list(Wrappers.lambdaQuery() - .eq(ZbfProjectSubcontracting::getSectionId, zbfProjectSection.getId()) - .isNull(ZbfProjectSubcontracting::getUserId)); + .eq(ZbfProjectSubcontracting::getSectionId, zbfProjectSection.getId()) + //.isNull(ZbfProjectSubcontracting::getUserId) + ); //排除掉已申请的分包 - for (ZbfProjectSubcontracting sub : subList){ - if(applyIds.contains(sub.getId())){ - continue; - } + for (ZbfProjectSubcontracting sub : subList) { + FbsProjectSubcontractingListVO fbsProjectSubcontractingListVO = new FbsProjectSubcontractingListVO(); BeanUtil.copyProperties(sub, fbsProjectSubcontractingListVO); + String applyStatus = map.get(sub.getId()); + fbsProjectSubcontractingListVO.setApplyStatus(applyStatus); + if (sub.getUserId() != null && !sub.getUserId().equals(SecurityUtils.getAppUserId())) { + fbsProjectSubcontractingListVO.setApplyStatus(SubcontractingApplyStatus.CHOOSE.getCode()); + } subListVO.add(fbsProjectSubcontractingListVO); } - if(CollectionUtil.isEmpty(subListVO)){ + if (CollectionUtil.isEmpty(subListVO)) { continue; } FbsProjectSectionListVO fbsProjectSectionListVO = new FbsProjectSectionListVO(); @@ -304,22 +348,22 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl sectionList = zbfProjectSectionService.list(Wrappers.lambdaQuery() .eq(ZbfProjectSection::getProjectId, projectId)); - for (ZbfProjectSection zbfProjectSection : sectionList){ + for (ZbfProjectSection zbfProjectSection : sectionList) { //分包处理 List subListVO = new ArrayList<>(); //查询标段下的所有的分包 List subList = zbfProjectSubcontractingService.list(Wrappers.lambdaQuery() .eq(ZbfProjectSubcontracting::getSectionId, zbfProjectSection.getId())); //排除掉未申请和已同意的分包 - for (ZbfProjectSubcontracting sub : subList){ - if(!applyIds.contains(sub.getId())){ + for (ZbfProjectSubcontracting sub : subList) { + if (!applyIds.contains(sub.getId())) { continue; } FbsProjectSubcontractingListVO fbsProjectSubcontractingListVO = new FbsProjectSubcontractingListVO(); BeanUtil.copyProperties(sub, fbsProjectSubcontractingListVO); subListVO.add(fbsProjectSubcontractingListVO); } - if(CollectionUtil.isEmpty(subListVO)){ + if (CollectionUtil.isEmpty(subListVO)) { continue; } FbsProjectSectionListVO fbsProjectSectionListVO = new FbsProjectSectionListVO(); @@ -350,7 +394,7 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl sectionList = zbfProjectSectionService.list(Wrappers.lambdaQuery() .eq(ZbfProjectSection::getProjectId, projectId)); - for (ZbfProjectSection zbfProjectSection : sectionList){ + for (ZbfProjectSection zbfProjectSection : sectionList) { //分包处理 List subListVO = new ArrayList<>(); //查询标段下的所有已承接的分包 @@ -358,12 +402,12 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl addList = new ArrayList<>(); + for (ZbfProjectSubcontractingAddDTO sub : section.getSubList()) { + ZbfProjectSubcontracting projectSubcontracting = BeanUtil.copyProperties(sub, ZbfProjectSubcontracting.class); + projectSubcontracting.setProjectId(project.getId()); + projectSubcontracting.setSectionId(projectSection.getId()); + addList.add(projectSubcontracting); + } + zbfProjectSubcontractingService.saveBatch(addList); + } + return save; + } + + @Override + public TableDataInfo queryZbfList(ZbfProjectListDTO dto) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ZbfProject::getUserId, SecurityUtils.getAppUserId()); + wrapper.like(StrUtil.isNotBlank(dto.getProjectName()), ZbfProject::getProjectName, dto.getProjectName()); + + Page result = page(PageUtils.buildPage(), wrapper); + List zbfProjectListVOS = BeanUtil.copyToList(result.getRecords(), ZbfProjectListVO.class); + + for (ZbfProjectListVO zbfProjectListVO : zbfProjectListVOS){ + //标段处理 + List sectionListVO = new ArrayList<>(); + //查询项目下的所有标段 + List sectionList = zbfProjectSectionService.list(Wrappers.lambdaQuery() + .eq(ZbfProjectSection::getProjectId, zbfProjectListVO.getId())); + for (ZbfProjectSection zbfProjectSection : sectionList) { + //分包处理 + List subListVO = new ArrayList<>(); + //查询标段下的所有的分包 + List subList = zbfProjectSubcontractingService.list(Wrappers.lambdaQuery() + .eq(ZbfProjectSubcontracting::getSectionId, zbfProjectSection.getId())); + + ZbfProjectSectionListVO zbfProjectSectionListVO = new ZbfProjectSectionListVO(); + BeanUtil.copyProperties(zbfProjectSection, zbfProjectSectionListVO); + zbfProjectSectionListVO.setSubList(subListVO); + sectionListVO.add(zbfProjectSectionListVO); + } + zbfProjectListVO.setSectionList(sectionListVO); + } + + Page zbfProjectListVOPage = new Page<>(); + zbfProjectListVOPage.setTotal(result.getTotal()); + zbfProjectListVOPage.setRecords(zbfProjectListVOS); + + return PageUtils.buildDataInfo(zbfProjectListVOPage); + } + + @Override + public ZbfProjectCountVO projectCount() { + ZbfProjectCountVO zbfProjectCountVO = new ZbfProjectCountVO(); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ZbfProject::getUserId, SecurityUtils.getAppUserId()); + List list = list(wrapper); + zbfProjectCountVO.setAllCount(list.size()); + long startCount = list.stream().filter(zbfProject -> StrUtil.equals(zbfProject.getProjectStatus(), ProjectStatus.START.getCode())).count(); + long completeCcount = list.stream().filter(zbfProject -> StrUtil.equals(zbfProject.getProjectStatus(), ProjectStatus.COMPLETE.getCode())).count(); + zbfProjectCountVO.setStartCount((int) startCount); + zbfProjectCountVO.setCompleteCount((int) completeCcount); + return zbfProjectCountVO; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/service/impl/ZbfProjectSubcontractingApplyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/service/impl/ZbfProjectSubcontractingApplyServiceImpl.java index 3416cf1..07cb1a7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/zbf/service/impl/ZbfProjectSubcontractingApplyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/service/impl/ZbfProjectSubcontractingApplyServiceImpl.java @@ -1,23 +1,43 @@ package com.ruoyi.zbf.service.impl; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.ruoyi.common.utils.PageUtils; -import com.ruoyi.common.core.page.PagePlus; -import com.ruoyi.common.core.page.TableDataInfo; -import org.springframework.stereotype.Service; -import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; 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.common.core.mybatisplus.core.ServicePlusImpl; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.ProjectStatus; +import com.ruoyi.common.enums.SubcontractingApplyStatus; +import com.ruoyi.common.enums.TaskApplyStatus; +import com.ruoyi.common.exception.BaseException; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.fbs.domain.FbsMessage; +import com.ruoyi.fbs.service.IFbsMessageService; import com.ruoyi.zbf.bo.ZbfProjectSubcontractingApplyQueryBo; +import com.ruoyi.zbf.domain.ZbfMessage; +import com.ruoyi.zbf.domain.ZbfProject; +import com.ruoyi.zbf.domain.ZbfProjectSubcontracting; import com.ruoyi.zbf.domain.ZbfProjectSubcontractingApply; import com.ruoyi.zbf.mapper.ZbfProjectSubcontractingApplyMapper; +import com.ruoyi.zbf.service.IZbfMessageService; +import com.ruoyi.zbf.service.IZbfProjectService; import com.ruoyi.zbf.service.IZbfProjectSubcontractingApplyService; +import com.ruoyi.zbf.service.IZbfProjectSubcontractingService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; -import java.util.List; -import java.util.Map; -import java.util.Collection; +import java.util.*; + +import static com.ruoyi.common.constants.BgtMessageConstant.HEADLINE; +import static com.ruoyi.common.constants.BgtMessageConstant.SUBHEADING; +import static com.ruoyi.common.constants.FbsMessageConstant.*; +import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*; +import static com.ruoyi.common.constants.ZbfMessageConstant.*; /** * 总包方项目分包申请Service业务层处理 @@ -28,6 +48,16 @@ import java.util.Collection; @Service public class ZbfProjectSubcontractingApplyServiceImpl extends ServicePlusImpl implements IZbfProjectSubcontractingApplyService { + @Autowired + private IZbfProjectService projectService; + @Autowired + private IZbfProjectSubcontractingService projectSubcontractingService; + @Autowired + private IFbsMessageService fbsMessageService; + @Autowired + private IZbfMessageService zbfMessageService; + + @Override public ZbfProjectSubcontractingApply queryById(Long id){ return getById(id); @@ -56,10 +86,65 @@ public class ZbfProjectSubcontractingApplyServiceImpl extends ServicePlusImpl list = list(Wrappers.lambdaQuery() + .eq(ZbfProjectSubcontractingApply::getSubId, bo.getSubId()) + .eq(ZbfProjectSubcontractingApply::getApplyStatus, SubcontractingApplyStatus.APPLY.getCode()) + .eq(ZbfProjectSubcontractingApply::getFbsUserId, appUserId) + ); + if(CollectionUtil.isNotEmpty(list)){ + throw new BaseException("您已经申请过该分包"); + } + boolean save = save(add); + //给分包商自己发消息 +// HashMap mp = new HashMap<>(); +// mp.put("projectName", projectService.getById(bo.getProjectId()).getProjectName()); +// mp.put("subName", projectSubcontractingService.getById(bo.getSubId()).getSubName()); +// mp.put("auditor", SecurityUtils.getUsername()); +// Map map = fbsMessage(mp, FBS_TYPE_TASK, true); +// FbsMessage fbsMessage = new FbsMessage() +// .setSenderType(USERTYPE_SYSTEM) +// .setSenderId(SYSTEM_ID) +// .setRecipientType(USERTYPE_FBS) +// .setRecipientId(SecurityUtils.getAppUserId()) +// .setHeadline(map.get(HEADLINE)) +// .setSubheading(map.get(SUBHEADING)) +// .setTableId(add.getId()) +// .setTableName(SqlHelper.table(ZbfProjectSubcontractingApply.class).getTableName()) +// .setMessageLargeType(FBS_LARGE_TASK) +// .setIsOperation(OPERATION_NO); +// fbsMessageService.sendAMessage(fbsMessage); + + ZbfProject project = projectService.getById(sub.getProjectId()); + //分包商发消息到总包方 + HashMap fmp = new HashMap<>(); + fmp.put("projectName", project.getProjectName()); + fmp.put("subName", sub.getSubName()); + fmp.put("auditor", SecurityUtils.getUsername()); + Map fmap = fbsMessage(fmp, FBS_TYPE_SUB_TO_ZBF, true); + ZbfMessage zbfMessage = new ZbfMessage() + .setSenderType(USERTYPE_FBS) + .setSenderId(SecurityUtils.getAppUserId()) + .setRecipientType(USERTYPE_ZBF) + .setRecipientId(project.getUserId()) + .setHeadline(fmap.get(HEADLINE)) + .setSubheading(fmap.get(SUBHEADING)) + .setTableId(add.getId()) + .setTableName(SqlHelper.table(ZbfProjectSubcontractingApply.class).getTableName()) + .setMessageLargeType(ZBF_LARGE_TASK) + .setIsOperation(OPERATION_NEED); + zbfMessageService.sendAMessage(zbfMessage); + return save; } @Override @@ -85,4 +170,65 @@ public class ZbfProjectSubcontractingApplyServiceImpl extends ServicePlusImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ZbfProjectSubcontractingApply::getSubId, subApply.getSubId()); + wrapper.eq(ZbfProjectSubcontractingApply::getApplyStatus, TaskApplyStatus.APPLY.getCode()); + List list = baseMapper.selectList(wrapper); + + ArrayList fbsMessages = new ArrayList<>(); + for (ZbfProjectSubcontractingApply subcontractApply : list){ + boolean equals = subcontractApply.getId().equals(id); + if (equals){ + subcontractApply.setApplyStatus(TaskApplyStatus.PASS.getCode()); + }else{ + subcontractApply.setApplyStatus(TaskApplyStatus.REFUSE.getCode()); + } + + //总包方发消息到分包商 + HashMap zmp = new HashMap<>(); + zmp.put("projectName", project.getProjectName()); + zmp.put("subName", sub.getSubName()); + zmp.put("auditor", SecurityUtils.getUsername()); + Map zmap = zbfMessage(zmp, ZBF_TYPE_SIGN_UP, equals); + FbsMessage fbsMessage = new FbsMessage() + .setSenderType(USERTYPE_ZBF) + .setSenderId(SecurityUtils.getAppUserId()) + .setRecipientType(USERTYPE_FBS) + .setRecipientId(subcontractApply.getFbsUserId()) + .setHeadline(zmap.get(HEADLINE)) + .setSubheading(zmap.get(SUBHEADING)) + .setTableId(subcontractApply.getId()) + .setTableName(SqlHelper.table(ZbfProjectSubcontractingApply.class).getTableName()) + .setMessageLargeType(FBS_LARGE_TASK) + .setIsOperation(OPERATION_NO); + fbsMessages.add(fbsMessage); + } + fbsMessageService.saveBatch(fbsMessages); +// fbsMessageService.operationBatch(USERTYPE_FBS,SecurityUtils.getAppUserId(),list.stream().map(FbsProjectTaskApply::getId).collect(Collectors.toList()),SqlHelper.table(FbsProjectTaskApply.class).getTableName()); + return super.updateBatchById(list); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/zbf/service/impl/ZbfUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/zbf/service/impl/ZbfUserServiceImpl.java new file mode 100644 index 0000000..a1eaa4a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/zbf/service/impl/ZbfUserServiceImpl.java @@ -0,0 +1,105 @@ +package com.ruoyi.zbf.service.impl; + +import cn.hutool.core.bean.BeanUtil; +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.ruoyi.common.core.domain.entity.ZbfUser; +import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.zbf.bo.ZbfUserQueryBo; +import com.ruoyi.zbf.mapper.ZbfUserMapper; +import com.ruoyi.zbf.service.IZbfUserService; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * APP总包方用户Service业务层处理 + * + * @author ruoyi + * @date 2025-03-31 + */ +@Service +public class ZbfUserServiceImpl extends ServicePlusImpl implements IZbfUserService { + + @Override + public ZbfUser queryById(Long id){ + return getById(id); + } + + @Override + public TableDataInfo queryPageList(ZbfUserQueryBo bo) { + Page result = page(PageUtils.buildPage(), buildQueryWrapper(bo)); + return PageUtils.buildDataInfo(result); + } + + @Override + public List queryList(ZbfUserQueryBo bo) { + return list(buildQueryWrapper(bo)); + } + + private LambdaQueryWrapper buildQueryWrapper(ZbfUserQueryBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getUserId() != null, ZbfUser::getUserId, bo.getUserId()); + lqw.eq(StrUtil.isNotBlank(bo.getPhone()), ZbfUser::getPhone, bo.getPhone()); + lqw.like(StrUtil.isNotBlank(bo.getUsername()), ZbfUser::getUsername, bo.getUsername()); + lqw.eq(StrUtil.isNotBlank(bo.getGender()), ZbfUser::getGender, bo.getGender()); + lqw.eq(StrUtil.isNotBlank(bo.getNation()), ZbfUser::getNation, bo.getNation()); + lqw.eq(StrUtil.isNotBlank(bo.getBirthdate()), ZbfUser::getBirthdate, bo.getBirthdate()); + lqw.eq(StrUtil.isNotBlank(bo.getIdentityCard()), ZbfUser::getIdentityCard, bo.getIdentityCard()); + lqw.eq(StrUtil.isNotBlank(bo.getArea()), ZbfUser::getArea, bo.getArea()); + lqw.eq(StrUtil.isNotBlank(bo.getSite()), ZbfUser::getSite, bo.getSite()); + lqw.eq(StrUtil.isNotBlank(bo.getBank()), ZbfUser::getBank, bo.getBank()); + lqw.eq(StrUtil.isNotBlank(bo.getCardNo()), ZbfUser::getCardNo, bo.getCardNo()); + lqw.like(StrUtil.isNotBlank(bo.getAvatarName()), ZbfUser::getAvatarName, bo.getAvatarName()); + lqw.eq(StrUtil.isNotBlank(bo.getPassword()), ZbfUser::getPassword, bo.getPassword()); + lqw.eq(StrUtil.isNotBlank(bo.getFrontPath()), ZbfUser::getFrontPath, bo.getFrontPath()); + lqw.eq(StrUtil.isNotBlank(bo.getReverseSidePath()), ZbfUser::getReverseSidePath, bo.getReverseSidePath()); + lqw.eq(StrUtil.isNotBlank(bo.getBankCardPath()), ZbfUser::getBankCardPath, bo.getBankCardPath()); + lqw.eq(bo.getCompanyId() != null, ZbfUser::getCompanyId, bo.getCompanyId()); + lqw.eq(StrUtil.isNotBlank(bo.getStatus()), ZbfUser::getStatus, bo.getStatus()); + return lqw; + } + + @Override + public Boolean insert(ZbfUser bo) { + ZbfUser add = BeanUtil.toBean(bo, ZbfUser.class); + validEntityBeforeSave(add); + return save(add); + } + + @Override + public Boolean update(ZbfUser bo) { + ZbfUser update = BeanUtil.toBean(bo, ZbfUser.class); + validEntityBeforeSave(update); + return updateById(update); + } + + /** + * 保存前的数据校验 + * + * @param entity 实体类数据 + */ + private void validEntityBeforeSave(ZbfUser entity){ + //TODO 做一些数据校验,如唯一约束 + } + + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return removeByIds(ids); + } + + @Override + public ZbfUser selectUserByPhone(String phone) { + return baseMapper.selectOne(new LambdaQueryWrapper().eq(ZbfUser::getPhone, phone)); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/zbf/ZbfMessageMapper.xml b/ruoyi-system/src/main/resources/mapper/zbf/ZbfMessageMapper.xml new file mode 100644 index 0000000..79505df --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/zbf/ZbfMessageMapper.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/zbf/ZbfProjectMapper.xml b/ruoyi-system/src/main/resources/mapper/zbf/ZbfProjectMapper.xml index d0380fc..ad008cc 100644 --- a/ruoyi-system/src/main/resources/mapper/zbf/ZbfProjectMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/zbf/ZbfProjectMapper.xml @@ -27,15 +27,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" unit_name, project_name, project_address, + project_img, project_status FROM zbf_project zp - WHERE EXISTS ( - SELECT 1 - FROM zbf_project_subcontracting zps - WHERE zps.user_id IS NULL - AND zp.id = zps.project_id - and zps.id NOT EXISTS(select zpsa.sub_id from zbf_project_subcontracting_apply zpsa where zpsa.fbs_user_id = #{dto.fbsUserId}) - ) order by zp.id desc @@ -44,12 +38,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" unit_name, project_name, project_address, + project_img, project_status FROM zbf_project zp WHERE EXISTS ( SELECT 1 FROM zbf_project_subcontracting_apply zpsa - WHERE zpsa.fbs_user_id = #{dto.fbsUserId} and zpsa.apply_status in('0','2') + WHERE zpsa.fbs_user_id = #{dto.fbsUserId} and zpsa.apply_status ='0' AND zp.id = zpsa.project_id ) order by zp.id desc @@ -59,13 +54,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" unit_name, project_name, project_address, + project_img, project_status FROM zbf_project zp WHERE zp.project_status = '1' and EXISTS ( SELECT 1 FROM zbf_project_subcontracting zps - WHERE zps.user_id = 1 AND zp.id = zps.project_id + WHERE zps.user_id = #{dto.fbsUserId} AND zp.id = zps.project_id ) order by zp.id desc @@ -75,15 +71,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" unit_name, project_name, project_address, + project_img, project_status FROM zbf_project zp WHERE zp.project_status = '2' and EXISTS ( SELECT 1 FROM zbf_project_subcontracting zps - WHERE zps.user_id = 1 AND zp.id = zps.project_id + WHERE zps.user_id = #{dto.fbsUserId} AND zp.id = zps.project_id + ) + order by zp.id desc + + + + + + + + + diff --git a/ruoyi-system/src/main/resources/mapper/zbf/ZbfProjectSectionMapper.xml b/ruoyi-system/src/main/resources/mapper/zbf/ZbfProjectSectionMapper.xml index 1080c4d..accc6dc 100644 --- a/ruoyi-system/src/main/resources/mapper/zbf/ZbfProjectSectionMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/zbf/ZbfProjectSectionMapper.xml @@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"