ruoyi-admin/pom.xml
@@ -140,17 +140,17 @@ <dependency> <groupId>cn.afterturn</groupId> <artifactId>easypoi-base</artifactId> <version>3.0.3</version> <version>4.3.0</version> </dependency> <dependency> <groupId>cn.afterturn</groupId> <artifactId>easypoi-web</artifactId> <version>3.0.3</version> <version>4.3.0</version> </dependency> <dependency> <groupId>cn.afterturn</groupId> <artifactId>easypoi-annotation</artifactId> <version>3.0.3</version> <version>4.3.0</version> </dependency> <!-- 阿里云短信 --> ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/StateProcessController.java
@@ -1,6 +1,5 @@ package com.ruoyi.web.controller.api; import com.aizuda.bpm.engine.entity.FlwTask; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -8,18 +7,15 @@ import com.ruoyi.common.annotation.Log; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseModel; import com.ruoyi.common.core.domain.BasePage; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.page.PageDomain; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.exception.GlobalException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.system.bo.*; import com.ruoyi.system.model.StateProcessModule; import com.ruoyi.system.model.StateProcessTemplate; import com.ruoyi.system.model.TContract; import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.StateProcessModuleService; import com.ruoyi.system.service.StateProcessTemplateService; @@ -32,7 +28,10 @@ import org.springframework.web.bind.annotation.*; import java.time.LocalDateTime; import java.util.*; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TBankFlowController.java
@@ -44,7 +44,7 @@ /** * 获取流水列表 */ @PreAuthorize("@ss.hasPermi('system:bankFlow:list')") @PreAuthorize("@ss.hasPermi('flow:bank:detail:list')") @ApiOperation(value = "获取银行流水列表") @PostMapping("/list") public R<PageInfo<TBankFlow>> list(@RequestBody TBankFlowQuery query) { ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TBannerController.java
@@ -60,7 +60,7 @@ /** * 修改轮播图 */ @PreAuthorize("@ss.hasPermi('system:banner:update')") @PreAuthorize("@ss.hasPermi('system:banner:edit')") @Log(title = "轮播图信息-修改轮播图", businessType = BusinessType.UPDATE) @ApiOperation(value = "修改轮播图") @PostMapping(value = "/update") ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TBillController.java
@@ -45,7 +45,7 @@ @Autowired TBillConfirmService tBillConfirmService; @PreAuthorize("@ss.hasPermi('system:bill:list')") @PreAuthorize("@ss.hasPermi('bill:list')") @PostMapping("list") @ApiOperation("分页查询账单列表") public R<PageInfo<TBillDto>> list(@RequestBody TBillQuery query){ @@ -53,7 +53,7 @@ return R.ok(pageInfo); } @PreAuthorize("@ss.hasPermi('system:bill:add')") @PreAuthorize("@ss.hasPermi('bill:list:addRent')") @PostMapping("add") @ApiOperation("新增账单") public R<PageInfo<TBillDto>> add(@Validated @RequestBody TbillSaveDto bill){ @@ -83,7 +83,7 @@ } @PreAuthorize("@ss.hasPermi('system:bill:checkOfflinePay')") @PreAuthorize("@ss.hasPermi('bill:list:paid')") @ApiOperation("确认线下缴费") @PostMapping("checkOfflinePay") public R checkOfflinePay(@Validated @RequestBody OfflinePayCheckDto dto){ @@ -91,7 +91,7 @@ return R.ok(); } @PreAuthorize("@ss.hasPermi('system:bill:sendSmsByBillIds')") @PreAuthorize("@ss.hasPermi('bill:list:sendMsg')") @ApiOperation("账单批量发送短信通知") @PostMapping("sendSmsByBillIds") public R sendSmsByBillIds(@Validated @RequestBody SmsByBillDto dto){ @@ -100,8 +100,8 @@ } @PreAuthorize("@ss.hasPermi('system:bill:sendMailBatchByBillIds')") @ApiOperation("账单批量发送邮件通知") @PreAuthorize("@ss.hasPermi('bill:list:sendMail')") @ApiOperation("账单批量发送邮箱通知") @PostMapping("sendMailBatchByBillIds") public R sendMailBatchByBillIds(@Validated @RequestBody SmsByBillDto dto){ Integer failNum = tBillService.sendMailBatchByBillIds(dto); @@ -111,7 +111,7 @@ @PreAuthorize("@ss.hasPermi('system:bill:cashPay')") @PreAuthorize("@ss.hasPermi('bill:list:receipt')") @ApiOperation("收款") @PostMapping("cashPay") public R cashPay(@RequestBody CachPayDto cachPayDto){ @@ -126,8 +126,6 @@ BillStatisticsDto dto = tBillService.statistics(); return R.ok(dto); } ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCheckAcceptRecordController.java
@@ -7,10 +7,12 @@ import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.model.TBill; import com.ruoyi.system.model.TCheckAcceptRecord; import com.ruoyi.system.model.TContract; import com.ruoyi.system.model.THouse; import com.ruoyi.system.query.TCheckAcceptRecordQuery; import com.ruoyi.system.service.TBillService; import com.ruoyi.system.service.TCheckAcceptRecordService; import com.ruoyi.system.service.TContractService; import com.ruoyi.system.service.THouseService; @@ -23,6 +25,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; @@ -44,6 +47,8 @@ private final TContractService contractService; private final THouseService houseService; @Autowired private TBillService billService; @Autowired public TCheckAcceptRecordController(TCheckAcceptRecordService checkAcceptRecordService, TContractService contractService, THouseService houseService) { this.checkAcceptRecordService = checkAcceptRecordService; this.contractService = contractService; @@ -53,7 +58,7 @@ /** * 获取验收记录管理列表 */ @PreAuthorize("@ss.hasPermi('system:accept:list')") @PreAuthorize("@ss.hasPermi('houseManage:check:list')") @ApiOperation(value = "获取验收记录分页列表") @PostMapping(value = "/pageList") public R<PageInfo<TCheckAcceptRecordVO>> pageList(@RequestBody TCheckAcceptRecordQuery query) { @@ -88,7 +93,7 @@ /** * 添加验收记录管理 */ @PreAuthorize("@ss.hasPermi('system:accept:add')") @PreAuthorize("@ss.hasPermi('houseManage:check:add')") @Log(title = "验收记录信息-新增验收记录", businessType = BusinessType.INSERT) @ApiOperation(value = "添加验收记录") @PostMapping(value = "/add") @@ -101,8 +106,19 @@ dto.setCode(replace.substring(2)+String.format("%03d", size+1)); // 添加验收记录 checkAcceptRecordService.save(dto); // TODO 生成结算帐单 if (dto.getCheckMoney()!=null&&(dto.getCheckMoney().compareTo(new BigDecimal("0"))!=0)){ TContract contract = contractService.getById(dto.getContractId()); // TODO 生成结算帐单 TBill tBill = new TBill(); tBill.setContractId(dto.getContractId()); tBill.setContractNumber(contract.getContractNumber()); tBill.setPayableFeesMoney(dto.getCheckMoney()); tBill.setPayableFeesTime(LocalDate.now()); tBill.setPayFeesStatus("1"); tBill.setBillType("4"); tBill.setSmsStatus(0); billService.save(tBill); } return R.ok(); } @@ -110,7 +126,7 @@ /** * 查看验收记录详情 */ @PreAuthorize("@ss.hasPermi('system:accept:detail')") @PreAuthorize("@ss.hasPermi('houseManage:check:detail')") @ApiOperation(value = "查看验收记录详情") @GetMapping(value = "/getDetailById") public R<TCheckAcceptRecordVO> getDetailById(@RequestParam String id) { @@ -127,7 +143,7 @@ /** * 删除验收记录 */ @PreAuthorize("@ss.hasPermi('system:accept:delete')") @PreAuthorize("@ss.hasPermi('houseManage:check:delete')") @Log(title = "验收记录信息-删除验收记录", businessType = BusinessType.DELETE) @ApiOperation(value = "删除验收记录") @DeleteMapping(value = "/deleteById") @@ -138,7 +154,7 @@ /** * 批量删除验收记录 */ @PreAuthorize("@ss.hasPermi('system:accept:delete')") @PreAuthorize("@ss.hasPermi('houseManage:check:delete')") @Log(title = "验收记录信息-删除验收记录", businessType = BusinessType.DELETE) @ApiOperation(value = "批量删除验收记录") @DeleteMapping(value = "/deleteByIds") ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java
@@ -3,33 +3,39 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.hutool.core.util.ObjectUtil; import com.aizuda.bpm.engine.entity.FlwTask; import com.aizuda.bpm.mybatisplus.mapper.FlwTaskMapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.ImmutableMap; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.constant.DictConstants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.ProcessCategoryEnum; import com.ruoyi.common.utils.*; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DictUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.WebUtils; import com.ruoyi.system.bo.ProcessStartBO; import com.ruoyi.system.dto.*; import com.ruoyi.system.dto.RevokeDTO; import com.ruoyi.system.dto.SetContractDto; import com.ruoyi.system.dto.TContractDTO; import com.ruoyi.system.dto.TerminateContractDTO; import com.ruoyi.system.export.ContractExport; import com.ruoyi.system.export.OpticalInspectionExport; import com.ruoyi.system.model.*; import com.ruoyi.system.query.TContractBillQuery; import com.ruoyi.system.query.TContractQuery; import com.ruoyi.system.query.THouseQuery; import com.ruoyi.system.query.TUserHistoryQuery; import com.ruoyi.system.service.*; import com.ruoyi.system.task.base.QuartzManager; import com.ruoyi.system.task.base.TimeJobType; import com.ruoyi.system.task.jobs.StateProcessJob; import com.ruoyi.system.vo.BillVO; import com.ruoyi.system.vo.CheckAcceptRecordVO; import com.ruoyi.system.vo.HouseVO; import com.ruoyi.system.vo.TContractVO; import com.ruoyi.web.controller.tool.NumberToChineseUtils; import com.ruoyi.web.controller.tool.WordUtil; import io.swagger.annotations.Api; import com.ruoyi.system.vo.TContractVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.poi.ss.usermodel.Workbook; @@ -44,7 +50,6 @@ import java.io.IOException; import java.math.BigDecimal; import java.net.URLEncoder; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.*; @@ -73,121 +78,24 @@ private TCheckAcceptRecordService checkAcceptRecordService; @Autowired private StateProcessTemplateService stateProcessTemplateService; @Autowired private FlwTaskMapper flwTaskMapper; @ApiOperation(value = "测试生成账单") @PostMapping(value = "/testBill") public R testBill(String id) { TContract contract = contractService.getById(id); // 查询所有已签订的合同并且未生成第一笔账单的 List<TBill> bills = new ArrayList<>(); List<TContractRentType> contractRentTypes = contractRentTypeService.list(); contract.setFirstPayTime(contract.getStartTime().plusDays(10)); // 第一次应缴费日期 LocalDateTime firstPayTime = contract.getStartTime().plusDays(10).withHour(0).withMinute(0).withSecond(0); TBill rentBill = new TBill(); rentBill.setContractId(contract.getId()); rentBill.setContractNumber(contract.getContractNumber()); rentBill.setPayableFeesTime(firstPayTime.toLocalDate()); rentBill.setPayFeesStatus("1"); rentBill.setBillType("1"); rentBill.setStartTime(contract.getStartPayTime()); TContractRentType tContractRentType = contractRentTypes.stream().filter(e -> e.getContractId().equals(contract.getId())).findFirst().orElse(null); if (tContractRentType!=null && contract.getStartPayTime().plusMonths(contract.getPayType().equals("1")? 1:contract.getPayType().equals("2")? 3:12).isAfter(tContractRentType.getChangeTime())){ // 计算租金变动的天数 long moneyDays = ChronoUnit.DAYS.between(tContractRentType.getChangeTime(), contract.getStartPayTime().plusMonths(contract.getPayType().equals("1")? 1:contract.getPayType().equals("2")? 3:12))+1L; contract.setChangeTime(LocalDateTime.now()); // 递增递减的租金 BigDecimal contractRentTypeMoney = new BigDecimal("0"); // 不递增递减的租金 BigDecimal originalMoney = new BigDecimal("0"); // 原租金 switch (tContractRentType.getIncreasingDecreasingType()){ case 1: switch (tContractRentType.getIncreasingDecreasing()){ case 1: contractRentTypeMoney =contractRentTypeMoney.add(contract.getChangeRent().multiply(new BigDecimal(100).add(tContractRentType.getNumericalValue())).divide(new BigDecimal(100),2,BigDecimal.ROUND_DOWN).divide(new BigDecimal(30), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(moneyDays))); contract.setChangeRent(contractRentTypeMoney); break; case 2: contractRentTypeMoney = contractRentTypeMoney.add(contract.getChangeRent().multiply((new BigDecimal(100).subtract(tContractRentType.getNumericalValue()))).divide(new BigDecimal(100),2,BigDecimal.ROUND_DOWN).divide(new BigDecimal(30), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(moneyDays)).divide(new BigDecimal(contract.getPayType().equals("1")? 1:contract.getPayType().equals("2")? 3:12),2,BigDecimal.ROUND_DOWN)); contract.setChangeRent(contractRentTypeMoney); break; } break; case 2: switch (tContractRentType.getIncreasingDecreasing()){ case 1: contractRentTypeMoney =contractRentTypeMoney.add(contract.getChangeRent().add(tContractRentType.getNumericalValue())).divide(new BigDecimal(30), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(moneyDays)); contract.setChangeRent(contractRentTypeMoney); break; case 2: contractRentTypeMoney = contractRentTypeMoney.add(contract.getChangeRent().subtract(tContractRentType.getNumericalValue())).divide(new BigDecimal(30), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(moneyDays)); contract.setChangeRent(contractRentTypeMoney); break; } break; } // 不需要涨租金的时间段 if (contract.getFirstPayTime().isBefore(tContractRentType.getChangeTime())){ long originalDays = ChronoUnit.DAYS.between(contract.getFirstPayTime(), tContractRentType.getChangeTime()); originalMoney=originalMoney.add(contract.getMonthRent().divide(new BigDecimal(30), 2, BigDecimal.ROUND_DOWN)) .multiply(new BigDecimal(originalDays)); rentBill.setPayableFeesMoney(contractRentTypeMoney.add(originalMoney)); rentBill.setOutstandingMoney(rentBill.getPayableFeesMoney()); }else{ rentBill.setPayableFeesMoney(contractRentTypeMoney); rentBill.setOutstandingMoney(rentBill.getPayableFeesMoney()); } if (contract.getFirstPayTime().plusMonths(contract.getPayType().equals("1")? 1:contract.getPayType().equals("2")? 3:12).isAfter(contract.getEndTime())){ rentBill.setEndTime(contract.getFirstPayTime().plusMonths(contract.getPayType().equals("1")? 1:contract.getPayType().equals("2")? 3:12)); }else{ rentBill.setEndTime(contract.getEndTime()); } }else{ if (contract.getFirstPayTime().plusMonths(contract.getPayType().equals("1")? 1:contract.getPayType().equals("2")? 3:12).isAfter(contract.getEndTime())){ rentBill.setEndTime(contract.getFirstPayTime().plusMonths(contract.getPayType().equals("1")? 1:contract.getPayType().equals("2")? 3:12)); }else{ rentBill.setEndTime(contract.getEndTime()); } // 不走递增递减 long allDays = ChronoUnit.DAYS.between(contract.getFirstPayTime(), rentBill.getEndTime()); rentBill.setPayableFeesMoney(contract.getMonthRent().divide(new BigDecimal(30), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(allDays))); rentBill.setOutstandingMoney(rentBill.getPayableFeesMoney()); } // 租金账单 bills.add(rentBill); // 押金账单 TBill depositBill = new TBill(); depositBill.setContractId(contract.getId()); depositBill.setContractNumber(contract.getContractNumber()); depositBill.setPayableFeesMoney(contract.getDeposit()); depositBill.setOutstandingMoney(depositBill.getPayableFeesMoney()); depositBill.setPayableFeesTime(firstPayTime.toLocalDate()); depositBill.setPayFeesStatus("1"); depositBill.setBillType("2"); contractService.updateById(contract); billService.save(rentBill); billService.save(depositBill); return R.ok(); } @ApiOperation(value = "获取合同分页列表") @PostMapping(value = "/contractList") @PreAuthorize("@ss.hasPermi('system:contract:list')") @PreAuthorize("@ss.hasPermi('contract:list')") public R<PageInfo<TContract>> contractList(@RequestBody TContractQuery query) { return R.ok(contractService.contractList(query)); } @Log(title = "合同管理-新增合同", businessType = BusinessType.INSERT) @ApiOperation(value = "新增合同") @PostMapping(value = "/addContract") @PreAuthorize("@ss.hasPermi('system:contract:add')") @PreAuthorize("@ss.hasPermi('contract:list:add')") public R<Boolean> addContract(@Validated @RequestBody TContractDTO dto) { long count = contractService.count(new LambdaQueryWrapper<TContract>().eq(TContract::getContractNumber, dto.getContractNumber())); if (count!=0){ return R.fail("合同编号不可重复"); } dto.setChangeRent(dto.getMonthRent()); contractService.save(dto); if (dto.getStatus().equals("2")){ @@ -204,7 +112,21 @@ variable.put("projectId", dto.getId()); processStartBO.setVariable(variable); //开启工作流程 stateProcessTemplateService.start(processStartBO); Boolean start = stateProcessTemplateService.start(processStartBO); if(start){ FlwTask flwTask = flwTaskMapper.selectOne(Wrappers.lambdaQuery(FlwTask.class) .like(FlwTask::getVariable, dto.getId()) .orderByDesc(FlwTask::getCreateTime) .last("LIMIT 1")); if(Objects.nonNull(flwTask)){ // 添加定时任务 Map<String, ? extends Object> maps = new ImmutableMap.Builder<String, Long>(). put("id", flwTask.getId()) .build(); QuartzManager.addJob(StateProcessJob.class, (StateProcessJob.name+flwTask.getId()).toUpperCase(), TimeJobType.AUTO_AUDIT,new Date(new Date().getTime()+48*60*60*1000L), maps); } } } if (dto.getIsIncreasing()){ TContractRentType tContractRentType = new TContractRentType(); @@ -221,7 +143,7 @@ @Log(title = "合同管理-编辑合同", businessType = BusinessType.UPDATE) @ApiOperation(value = "编辑合同") @PostMapping(value = "/updateContract") @PreAuthorize("@ss.hasPermi('system:contract:update')") @PreAuthorize("@ss.hasPermi('contract:list:edit')") public R<Boolean> updateContract(@Validated @RequestBody TContractDTO dto) { contractService.updateById(dto); contractRentTypeService.remove(new LambdaQueryWrapper<TContractRentType>() @@ -240,8 +162,7 @@ } @Log(title = "合同管理-批量删除合同", businessType = BusinessType.DELETE) @ApiOperation(value = "批量删除合同") @PreAuthorize("@ss.hasPermi('system:contract:delete')") @PreAuthorize("@ss.hasPermi('contract:list:delete')") @DeleteMapping(value = "/deleteContractByIds") public R<Boolean> deleteContractByIds(@RequestParam String ids) { if (StringUtils.isNotEmpty(ids)){ @@ -252,7 +173,7 @@ @ApiOperation(value = "查询合同信息信息") @GetMapping(value = "/getContractById") @PreAuthorize("@ss.hasPermi('system:contract:detail')") @PreAuthorize("@ss.hasPermi('contract:list:detail')") public R<TContractVO> getContractById(@RequestParam String id) { TContractVO res = new TContractVO(); TContract contract = contractService.getById(id); @@ -263,15 +184,13 @@ if (contractRentType!=null){ BeanUtils.copyProperties(contractRentType,res); } TContract oldContract = contractService.getOne(new LambdaQueryWrapper<TContract>() .eq(TContract::getHouseId,contract.getHouseId()) .eq(TContract::getStatus, 4) .le(TContract::getStartTime, LocalDateTime.now()) .ge(TContract::getEndTime, LocalDateTime.now())); // TContract oldContract = contractService.getOne(new LambdaQueryWrapper<TContract>() // .eq(TContract::getHouseId,contract.getHouseId()) // .eq(TContract::getStatus, 4) // .le(TContract::getStartTime, LocalDateTime.now()) // .ge(TContract::getEndTime, LocalDateTime.now())); THouse house = houseService.getById(contract.getHouseId()); if (oldContract!=null){ house.setTenantType(oldContract.getPayType()); } house.setTenantType(contract.getPayType()); res.setHouse(house); List<TBill> list = billService.lambdaQuery() .eq(TBill::getContractId, id) @@ -289,17 +208,18 @@ } @Log(title = "合同管理-撤销审批", businessType = BusinessType.UPDATE) @ApiOperation(value = "撤销审批") @PreAuthorize("@ss.hasPermi('system:contract:revoke')") @GetMapping(value = "/updateContractStatus") public R<Boolean> updateContractStatus(String id) { TContract contract = contractService.getById(id); @PreAuthorize("@ss.hasPermi('contract:list:cancel')") @PostMapping(value = "/updateContractStatus") public R<Boolean> updateContractStatus(@RequestBody RevokeDTO dto) { TContract contract = contractService.getById(dto.getContractId()); contract.setStatus("1"); contractService.updateById(contract); // 撤销审批实例 stateProcessTemplateService.revoke(dto.getInstanceId()); return R.ok(); } @PreAuthorize("@ss.hasPermi('system:contract:confirm')") @PreAuthorize("@ss.hasPermi('contract:list:settlement')") @Log(title = "合同管理-确认结算", businessType = BusinessType.UPDATE) @ApiOperation(value = "确认结算") @PostMapping(value = "/confirmSettlement") @@ -312,21 +232,18 @@ } @ApiOperation(value = "终止合同剩余未缴费账单列表") @PostMapping(value = "/contractBillList") @PreAuthorize("@ss.hasPermi('system:contract:billList')") public R<PageInfo<BillVO>> contractBillList(@RequestBody TContractBillQuery query) { return R.ok(contractService.contractBillList(query)); } @ApiOperation(value = "终止合同") @PostMapping(value = "/terminateContract") @PreAuthorize("@ss.hasPermi('system:contract:terminate')") @PreAuthorize("@ss.hasPermi('contract:list:break')") public R terminateContract(@RequestBody TerminateContractDTO dto) { contractService.terminateContract(dto); // 生成房屋验收记录 待验收 return R.ok(); } @ApiOperation(value = "根据合同id查看验收记录") @GetMapping(value = "/getCheckByContractId") @PreAuthorize("@ss.hasPermi('system:contract:checkDetail')") public R<CheckAcceptRecordVO> getCheckByContractId(String id) { return R.ok(contractService.getCheckByContractId(id)); } @@ -335,7 +252,7 @@ @ApiOperation(value = "生成合同附件") @PostMapping("/set") @Log(title = "生成合同附件", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:contract:set')") @PreAuthorize("@ss.hasPermi('contract:list:generate')") public R<List<String>> set(@RequestBody SetContractDto dto,HttpServletResponse response){ List<TContract> list = contractService.lambdaQuery().in(TContract::getId, dto.getIds()).list(); List<String> res = new ArrayList<>(); @@ -375,7 +292,7 @@ * 导出 */ @ApiOperation(value = "导出") @PreAuthorize("@ss.hasPermi('system:contract:export')") @PreAuthorize("@ss.hasPermi('contract:list:export')") @Log(title = "导出", businessType = BusinessType.EXPORT) @PostMapping("/export") public void exportOpticalInspection(@RequestBody TContractQuery query) ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TDeptController.java
@@ -51,7 +51,7 @@ /** * 获取部门管理管理列表 */ @PreAuthorize("@ss.hasPermi('system:dept:list')") @PreAuthorize("@ss.hasPermi('system:department:list')") @ApiOperation(value = "获取部门管理分页列表") @PostMapping(value = "/pageList") public R<PageInfo<DeptVO>> pageList(@RequestBody TDeptQuery query) { @@ -59,9 +59,19 @@ } /** * 获取部门管理管理列表 */ @ApiOperation(value = "获取部门管理列表") @PostMapping(value = "/list") public R<List<TDept>> list() { return R.ok(deptService.list(Wrappers.lambdaQuery(TDept.class) .eq(TDept::getStatus, 1))); } /** * 添加部门管理管理 */ @PreAuthorize("@ss.hasPermi('system:dept:add')") @PreAuthorize("@ss.hasPermi('system:department:add')") @Log(title = "部门管理信息-新增部门管理", businessType = BusinessType.INSERT) @ApiOperation(value = "添加部门管理") @PostMapping(value = "/add") @@ -77,7 +87,7 @@ /** * 修改部门管理 */ @PreAuthorize("@ss.hasPermi('system:dept:update')") @PreAuthorize("@ss.hasPermi('system:department:edit')") @Log(title = "部门管理信息-修改部门管理", businessType = BusinessType.UPDATE) @ApiOperation(value = "修改部门管理") @PostMapping(value = "/update") @@ -93,7 +103,7 @@ /** * 查看部门管理详情 */ @PreAuthorize("@ss.hasPermi('system:dept:detail')") @PreAuthorize("@ss.hasPermi('system:department:edit')") @ApiOperation(value = "查看部门管理详情") @GetMapping(value = "/getDetailById") public R<TDept> getDetailById(@RequestParam String id) { @@ -103,7 +113,7 @@ /** * 删除部门管理 */ @PreAuthorize("@ss.hasPermi('system:dept:delete')") @PreAuthorize("@ss.hasPermi('system:department:delete')") @Log(title = "部门管理信息-删除部门管理", businessType = BusinessType.DELETE) @ApiOperation(value = "删除部门管理") @DeleteMapping(value = "/deleteById") @@ -117,7 +127,7 @@ /** * 批量删除部门管理 */ @PreAuthorize("@ss.hasPermi('system:dept:delete')") @PreAuthorize("@ss.hasPermi('system:department:delete')") @Log(title = "部门管理信息-删除部门管理", businessType = BusinessType.DELETE) @ApiOperation(value = "批量删除部门管理") @DeleteMapping(value = "/deleteByIds") @@ -131,7 +141,7 @@ /** * 轮播图上下架 */ @PreAuthorize("@ss.hasPermi('system:dept:upAndDown')") @PreAuthorize("@ss.hasPermi('system:department:open')") @ApiOperation(value = "部门管理上下架",notes = "true:上架,false:下架") @PostMapping(value = "/upAndDown") public R upAndDown(@RequestBody TDeptUpAndDownDTO dto) { ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TFaultAreaDicController.java
@@ -76,7 +76,7 @@ /** * 修改故障区域 */ @PreAuthorize("@ss.hasPermi('system:faultArea:update')") @PreAuthorize("@ss.hasPermi('system:faultArea:edit')") @Log(title = "故障区域信息-修改故障区域", businessType = BusinessType.UPDATE) @ApiOperation(value = "修改故障区域") @PostMapping(value = "/update") @@ -90,7 +90,7 @@ /** * 查看故障区域详情 */ @PreAuthorize("@ss.hasPermi('system:faultArea:detail')") @PreAuthorize("@ss.hasPermi('system:faultArea:edit')") @ApiOperation(value = "查看故障区域详情") @GetMapping(value = "/getDetailById") public R<TFaultAreaDic> getDetailById(@RequestParam String id) { ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TFaultDescribeDicController.java
@@ -41,7 +41,7 @@ /** * 获取故障描述管理列表 */ @PreAuthorize("@ss.hasPermi('system:faultDescribe:list')") @PreAuthorize("@ss.hasPermi('system:tag:list')") @ApiOperation(value = "获取故障描述分页列表") @PostMapping(value = "/pageList") public R<PageInfo<TFaultDescribeDicVO>> pageList(@RequestBody TFaultDescribeDicQuery query) { @@ -51,7 +51,7 @@ /** * 添加故障描述管理 */ @PreAuthorize("@ss.hasPermi('system:faultDescribe:add')") @PreAuthorize("@ss.hasPermi('system:tag:add')") @Log(title = "故障描述信息-新增故障描述", businessType = BusinessType.INSERT) @ApiOperation(value = "添加故障描述") @PostMapping(value = "/add") @@ -62,7 +62,7 @@ /** * 修改故障描述 */ @PreAuthorize("@ss.hasPermi('system:faultDescribe:update')") @PreAuthorize("@ss.hasPermi('system:tag:edit')") @Log(title = "故障描述信息-修改故障描述", businessType = BusinessType.UPDATE) @ApiOperation(value = "修改故障描述") @PostMapping(value = "/update") @@ -73,7 +73,7 @@ /** * 查看故障描述详情 */ @PreAuthorize("@ss.hasPermi('system:faultDescribe:detail')") @PreAuthorize("@ss.hasPermi('system:tag:edit')") @ApiOperation(value = "查看故障描述详情") @GetMapping(value = "/getDetailById") public R<TFaultDescribeDic> getDetailById(@RequestParam String id) { @@ -83,7 +83,7 @@ /** * 删除故障描述 */ @PreAuthorize("@ss.hasPermi('system:faultDescribe:delete')") @PreAuthorize("@ss.hasPermi('system:tag:delete')") @Log(title = "故障描述信息-删除故障描述", businessType = BusinessType.DELETE) @ApiOperation(value = "删除故障描述") @DeleteMapping(value = "/deleteById") @@ -94,7 +94,7 @@ /** * 批量删除故障描述 */ @PreAuthorize("@ss.hasPermi('system:faultDescribe:delete')") @PreAuthorize("@ss.hasPermi('system:tag:delete')") @Log(title = "故障描述信息-删除故障描述", businessType = BusinessType.DELETE) @ApiOperation(value = "批量删除故障描述") @DeleteMapping(value = "/deleteByIds") ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TFaultRepairMessageController.java
@@ -41,7 +41,7 @@ /** * 获取报修管理列表 */ @PreAuthorize("@ss.hasPermi('system:fault:list')") @PreAuthorize("@ss.hasPermi('houseManage:acceptance:list')") @ApiOperation(value = "获取报修分页列表") @PostMapping(value = "/pageList") public R<PageInfo<TFaultRepairMessageVO>> pageList(@RequestBody TFaultRepairMessageQuery query) { @@ -51,7 +51,7 @@ /** * 处理维修 */ @PreAuthorize("@ss.hasPermi('system:fault:update')") @PreAuthorize("@ss.hasPermi('houseManage:acceptance:dispose')") @Log(title = "报修信息-处理维修", businessType = BusinessType.UPDATE) @ApiOperation(value = "处理维修") @PostMapping(value = "/update") @@ -63,7 +63,7 @@ /** * 查看报修详情 */ @PreAuthorize("@ss.hasPermi('system:fault:detail')") @PreAuthorize("@ss.hasPermi('houseManage:acceptance:detail')") @ApiOperation(value = "查看报修详情") @GetMapping(value = "/getDetailById") public R<TFaultRepairMessageVO> getDetailById(@RequestParam String id) { @@ -74,7 +74,7 @@ /** * 删除报修 */ @PreAuthorize("@ss.hasPermi('system:fault:delete')") @PreAuthorize("@ss.hasPermi('houseManage:acceptance:delete')") @Log(title = "报修信息-删除报修", businessType = BusinessType.DELETE) @ApiOperation(value = "删除报修") @DeleteMapping(value = "/deleteById") @@ -85,7 +85,7 @@ /** * 批量删除报修 */ @PreAuthorize("@ss.hasPermi('system:fault:delete')") @PreAuthorize("@ss.hasPermi('houseManage:acceptance:delete')") @Log(title = "报修信息-删除报修", businessType = BusinessType.DELETE) @ApiOperation(value = "批量删除报修") @DeleteMapping(value = "/deleteByIds") ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TFlowManagementController.java
@@ -32,7 +32,7 @@ /** * 获取流水列表 */ @PreAuthorize("@ss.hasPermi('system:flow:list')") @PreAuthorize("@ss.hasPermi('flow:sys:detail:list')") @ApiOperation(value = "获取流水列表") @PostMapping("/list") public R<PageInfo<TFlowManagement>> list(@RequestBody TFlowManagementQuery query) { ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/THouseController.java
@@ -46,45 +46,42 @@ @Log(title = "房屋基础信息管理-新增房屋", businessType = BusinessType.INSERT) @ApiOperation(value = "新增房屋") @PostMapping(value = "/addHouse") @PreAuthorize("@ss.hasPermi('system:house:add')") @PreAuthorize("@ss.hasPermi('house:list:add')") public R<Boolean> addHouse(@Validated @RequestBody THouseDTO dto) { return R.ok(tHouseService.save(dto)); } @Log(title = "房屋基础信息管理-编辑房屋", businessType = BusinessType.UPDATE) @ApiOperation(value = "编辑房屋") @PostMapping(value = "/updateHouse") @PreAuthorize("@ss.hasPermi('system:house:edit')") @PreAuthorize("@ss.hasPermi('house:list:edit')") public R<Boolean> updateHouse(@Validated @RequestBody THouseDTO dto) { return R.ok(tHouseService.updateById(dto)); } @Log(title = "房屋基础信息管理-查询房屋信息", businessType = BusinessType.DELETE) @ApiOperation(value = "查询房屋信息") @GetMapping(value = "/getHouseById") @PreAuthorize("@ss.hasPermi('system:house:detail')") @PreAuthorize("@ss.hasPermi('house:list:detail')") public R<THouse> getHouseById(@RequestParam String id) { THouse tHouse = tHouseService.getById(id); tHouse.setLeaseStatus(DictUtils.getDictLabel(DictConstants.DICT_TYPE_LEASE_STATUS,tHouse.getLeaseStatus())); tHouse.setBusinessAttributes(DictUtils.getDictLabel(DictConstants.DICT_TYPE_BUSINESS_ATTRIBUTES,tHouse.getBusinessAttributes())); // tHouse.setLeaseStatus(DictUtils.getDictLabel(DictConstants.DICT_TYPE_LEASE_STATUS,tHouse.getLeaseStatus())); // tHouse.setBusinessAttributes(DictUtils.getDictLabel(DictConstants.DICT_TYPE_BUSINESS_ATTRIBUTES,tHouse.getBusinessAttributes())); return R.ok(tHouse); } @Log(title = "房屋基础信息管理-删除房屋", businessType = BusinessType.DELETE) @ApiOperation(value = "删除房屋") @DeleteMapping(value = "/deleteHouseById") @PreAuthorize("@ss.hasPermi('system:house:delete')") @PreAuthorize("@ss.hasPermi('house:list:delete')") public R<Boolean> deleteHouseById(@RequestParam String id) { return R.ok(tHouseService.removeById(id)); } @ApiOperation(value = "获取房屋分页列表") @PostMapping(value = "/houseList") @PreAuthorize("@ss.hasPermi('system:house:list')") @PreAuthorize("@ss.hasPermi('house:list')") public R<PageInfo<THouse>> houseList(@RequestBody THouseQuery query) { return R.ok(tHouseService.houseList(query)); } @ApiOperation(value = "历史租户列表") @PostMapping(value = "/userHistoryList") @PreAuthorize("@ss.hasPermi('system:house:historyList')") public R<PageInfo<HouseVO>> userHistoryList(@RequestBody TUserHistoryQuery query) { return R.ok(tHouseService.userHistoryList(query)); } ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInformationController.java
@@ -39,7 +39,7 @@ /** * 获取资讯管理管理列表 */ @PreAuthorize("@ss.hasPermi('system:information:list')") @PreAuthorize("@ss.hasPermi('dynamic:list')") @ApiOperation(value = "获取资讯管理分页列表") @PostMapping(value = "/pageList") public R<PageInfo<TInformation>> pageList(@RequestBody TInformationQuery query) { @@ -49,7 +49,7 @@ /** * 添加资讯管理管理 */ @PreAuthorize("@ss.hasPermi('system:information:add')") @PreAuthorize("@ss.hasPermi('dynamic:list:add')") @Log(title = "资讯管理信息-新增资讯管理", businessType = BusinessType.INSERT) @ApiOperation(value = "添加资讯管理") @PostMapping(value = "/add") @@ -60,7 +60,7 @@ /** * 修改资讯管理 */ @PreAuthorize("@ss.hasPermi('system:information:update')") @PreAuthorize("@ss.hasPermi('dynamic:list:edit')") @Log(title = "资讯管理信息-修改资讯管理", businessType = BusinessType.UPDATE) @ApiOperation(value = "修改资讯管理") @PostMapping(value = "/update") @@ -71,7 +71,7 @@ /** * 查看资讯管理详情 */ @PreAuthorize("@ss.hasPermi('system:information:detail')") @PreAuthorize("@ss.hasPermi('dynamic:list:detail')") @ApiOperation(value = "查看资讯管理详情") @GetMapping(value = "/getDetailById") public R<TInformation> getDetailById(@RequestParam String id) { @@ -81,7 +81,7 @@ /** * 删除资讯管理 */ @PreAuthorize("@ss.hasPermi('system:information:delete')") @PreAuthorize("@ss.hasPermi('dynamic:list:delete')") @Log(title = "资讯管理信息-删除资讯管理", businessType = BusinessType.DELETE) @ApiOperation(value = "删除资讯管理") @DeleteMapping(value = "/deleteById") @@ -92,7 +92,7 @@ /** * 批量删除资讯管理 */ @PreAuthorize("@ss.hasPermi('system:information:delete')") @PreAuthorize("@ss.hasPermi('dynamic:list:delete')") @Log(title = "资讯管理信息-删除资讯管理", businessType = BusinessType.DELETE) @ApiOperation(value = "批量删除资讯管理") @DeleteMapping(value = "/deleteByIds") ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInvoiceController.java
@@ -32,14 +32,14 @@ private TInvoiceService invoiceService; @Autowired TBillService tBillService; @PreAuthorize("@ss.hasPermi('system:invoice:list')") @PreAuthorize("@ss.hasPermi('invoice:list')") @ApiOperation(value = "获取开票列表") @PostMapping("/list") public R<PageInfo<TInvoice>> list(@RequestBody TInvoiceQuery query) { return R.ok(invoiceService.pageList(query)); } @PreAuthorize("@ss.hasPermi('system:invoice:delete')") @PreAuthorize("@ss.hasPermi('invoice:list:del')") @Log(title = "开票信息-删除开票", businessType = BusinessType.DELETE) @ApiOperation(value = "删除开票") @DeleteMapping(value = "/deleteById") @@ -55,6 +55,7 @@ @ApiOperation(value = "上传开票凭证") @PostMapping("/uploadVoucher") @PreAuthorize("@ss.hasPermi('invoice:list:payment')") public R<Boolean> uploadVoucher(@RequestBody TInvoiceQuery query) { TInvoice tInvoice = new TInvoice(); tInvoice.setId(query.getId()); ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TItemController.java
@@ -40,7 +40,7 @@ /** * 获取维修物品管理列表 */ @PreAuthorize("@ss.hasPermi('system:item:list')") @PreAuthorize("@ss.hasPermi('houseManage:list:list')") @ApiOperation(value = "获取维修物品分页列表") @PostMapping(value = "/pageList") public R<PageInfo<TItemVO>> pageList(@RequestBody TItemQuery query) { @@ -50,7 +50,7 @@ /** * 添加维修物品管理 */ @PreAuthorize("@ss.hasPermi('system:item:add')") @PreAuthorize("@ss.hasPermi('houseManage:list:add')") @Log(title = "维修物品信息-新增维修物品", businessType = BusinessType.INSERT) @ApiOperation(value = "添加维修物品") @PostMapping(value = "/add") @@ -61,7 +61,7 @@ /** * 修改维修物品 */ @PreAuthorize("@ss.hasPermi('system:item:update')") @PreAuthorize("@ss.hasPermi('houseManage:list:edit')") @Log(title = "维修物品信息-修改维修物品", businessType = BusinessType.UPDATE) @ApiOperation(value = "修改维修物品") @PostMapping(value = "/update") @@ -82,7 +82,7 @@ /** * 删除维修物品 */ @PreAuthorize("@ss.hasPermi('system:item:delete')") @PreAuthorize("@ss.hasPermi('houseManage:list:delete')") @Log(title = "维修物品信息-删除维修物品", businessType = BusinessType.DELETE) @ApiOperation(value = "删除维修物品") @DeleteMapping(value = "/deleteById") @@ -93,7 +93,7 @@ /** * 批量删除维修物品 */ @PreAuthorize("@ss.hasPermi('system:item:delete')") @PreAuthorize("@ss.hasPermi('houseManage:list:delete')") @Log(title = "维修物品信息-删除维修物品", businessType = BusinessType.DELETE) @ApiOperation(value = "批量删除维修物品") @DeleteMapping(value = "/deleteByIds") ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TItemTypeController.java
@@ -44,7 +44,7 @@ /** * 获取维修物品分类管理列表 */ @PreAuthorize("@ss.hasPermi('system:itemType:list')") @PreAuthorize("@ss.hasPermi('houseManage:class_list')") @ApiOperation(value = "获取维修物品分类分页列表") @PostMapping(value = "/pageList") public R<PageInfo<TItemType>> pageList(@RequestBody TItemTypeQuery query) { @@ -63,7 +63,7 @@ /** * 添加维修物品分类管理 */ @PreAuthorize("@ss.hasPermi('system:itemType:add')") @PreAuthorize("@ss.hasPermi('houseManage:class:add')") @Log(title = "维修物品分类信息-新增维修物品分类", businessType = BusinessType.INSERT) @ApiOperation(value = "添加维修物品分类") @PostMapping(value = "/add") @@ -77,7 +77,7 @@ /** * 修改维修物品分类 */ @PreAuthorize("@ss.hasPermi('system:itemType:update')") @PreAuthorize("@ss.hasPermi('houseManage:class:edit')") @Log(title = "维修物品分类信息-修改维修物品分类", businessType = BusinessType.UPDATE) @ApiOperation(value = "修改维修物品分类") @PostMapping(value = "/update") @@ -91,7 +91,7 @@ /** * 查看维修物品分类详情 */ @PreAuthorize("@ss.hasPermi('system:itemType:detail')") @PreAuthorize("@ss.hasPermi('houseManage:class:edit')") @ApiOperation(value = "查看维修物品分类详情") @GetMapping(value = "/getDetailById") public R<TItemType> getDetailById(@RequestParam String id) { @@ -101,7 +101,7 @@ /** * 删除维修物品分类 */ @PreAuthorize("@ss.hasPermi('system:itemType:delete')") @PreAuthorize("@ss.hasPermi('houseManage:class:delete')") @Log(title = "维修物品分类信息-删除维修物品分类", businessType = BusinessType.DELETE) @ApiOperation(value = "删除维修物品分类") @DeleteMapping(value = "/deleteById") @@ -116,7 +116,7 @@ /** * 批量删除维修物品分类 */ @PreAuthorize("@ss.hasPermi('system:itemType:delete')") @PreAuthorize("@ss.hasPermi('houseManage:class:delete')") @Log(title = "维修物品分类信息-删除维修物品分类", businessType = BusinessType.DELETE) @ApiOperation(value = "批量删除维修物品分类") @DeleteMapping(value = "/deleteByIds") ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysConfigController.java
@@ -44,7 +44,7 @@ /** * 系统公共参数设置详情 */ @PreAuthorize("@ss.hasPermi('system:config:detail')") @PreAuthorize("@ss.hasPermi('system:commonParameter')") @ApiOperation(value = "查看系统公共参数设置详情") @GetMapping(value = "/getDetailById") public R<TSysConfig> getDetailById() { @@ -54,7 +54,7 @@ /** * 修改系统公共参数设置 */ @PreAuthorize("@ss.hasPermi('system:config:update')") @PreAuthorize("@ss.hasPermi('system:commonParameter:save')") @Log(title = "租户信息-修改系统公共参数设置", businessType = BusinessType.UPDATE) @ApiOperation(value = "修改系统公共参数设置") @PostMapping(value = "/update") ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTenantController.java
@@ -58,7 +58,7 @@ /** * 获取租户管理列表 */ @PreAuthorize("@ss.hasPermi('system:tenant:list')") @PreAuthorize("@ss.hasPermi('tenant:list')") @ApiOperation(value = "获取租户分页列表") @PostMapping(value = "/pageList") public R<PageInfo<TenantVO>> pageList(@RequestBody TTenantQuery query) { @@ -68,11 +68,14 @@ /** * 添加租户管理 */ @PreAuthorize("@ss.hasPermi('system:tenant:add')") @PreAuthorize("@ss.hasPermi('tenant:list:add')") @Log(title = "租户信息-新增租户", businessType = BusinessType.INSERT) @ApiOperation(value = "添加租户") @PostMapping(value = "/add") public R<Boolean> add(@Validated @RequestBody TTenantDTO dto) { if(tenantService.isExit(dto)){ return R.fail("该账号已存在"); } // 密码加密 dto.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); return R.ok(tenantService.save(dto)); @@ -81,11 +84,14 @@ /** * 修改租户 */ @PreAuthorize("@ss.hasPermi('system:tenant:update')") @PreAuthorize("@ss.hasPermi('tenant:list:edit')") @Log(title = "租户信息-修改租户", businessType = BusinessType.UPDATE) @ApiOperation(value = "修改租户") @PostMapping(value = "/update") public R<Boolean> update(@Validated @RequestBody TTenantDTO dto) { if(tenantService.isExit(dto)){ return R.fail("该账号已存在"); } // 密码加密 if(StringUtils.isNotBlank(dto.getPassword())){ dto.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); @@ -96,17 +102,16 @@ /** * 查看租户详情 */ @PreAuthorize("@ss.hasPermi('system:tenant:detail')") @PreAuthorize("@ss.hasPermi('tenant:list:detail')") @ApiOperation(value = "查看租户详情") @GetMapping(value = "/getDetailById") public R<TTenant> getDetailById(@RequestParam String id) { TTenant tenant = tenantService.getById(id); tenant.setTenantAttributes(StringUtils.isNotEmpty(tenant.getTenantAttributes())?DictUtils.getDictLabel(DictConstants.DICT_TYPE_TENANT_ATTRIBUTE,tenant.getTenantAttributes()):""); tenant.setTenantType(StringUtils.isNotEmpty(tenant.getTenantType())?DictUtils.getDictLabel(DictConstants.DICT_TYPE_TENANT_TYPE,tenant.getTenantType()):""); // tenant.setTenantAttributes(StringUtils.isNotEmpty(tenant.getTenantAttributes())?DictUtils.getDictLabel(DictConstants.DICT_TYPE_TENANT_ATTRIBUTE,tenant.getTenantAttributes()):""); // tenant.setTenantType(StringUtils.isNotEmpty(tenant.getTenantType())?DictUtils.getDictLabel(DictConstants.DICT_TYPE_TENANT_TYPE,tenant.getTenantType()):""); return R.ok(tenant); } @PreAuthorize("@ss.hasPermi('system:contract:list')") @ApiOperation(value = "获取合同分页列表") @GetMapping(value = "/contractListByTenantId") public R<List<TContract>> contractListByTenantId(@RequestParam String tenantId) { @@ -116,7 +121,7 @@ /** * 删除租户 */ @PreAuthorize("@ss.hasPermi('system:tenant:delete')") @PreAuthorize("@ss.hasPermi('tenant:list:edit')") @Log(title = "租户信息-删除租户", businessType = BusinessType.DELETE) @ApiOperation(value = "删除租户") @DeleteMapping(value = "/deleteById") @@ -127,7 +132,7 @@ /** * 批量删除租户 */ @PreAuthorize("@ss.hasPermi('system:tenant:delete')") @PreAuthorize("@ss.hasPermi('tenant:list:edit')") @Log(title = "租户信息-删除租户", businessType = BusinessType.DELETE) @ApiOperation(value = "批量删除租户") @DeleteMapping(value = "/deleteByIds") @@ -139,7 +144,6 @@ * 导出 */ @ApiOperation(value = "导出") @PreAuthorize("@ss.hasPermi('system:contract:export')") @Log(title = "导出", businessType = BusinessType.EXPORT) @PostMapping("/export") public void exportOpticalInspection(@Validated @RequestBody TContractQuery query) ruoyi-admin/src/main/java/com/ruoyi/web/controller/interceptor/MybatisConfiguration.java
@@ -1,17 +1,17 @@ package com.ruoyi.web.controller.interceptor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class MybatisConfiguration { /** * 注册拦截器 */ @Bean public MybatisInterceptor getMybatisInterceptor() { return new MybatisInterceptor(); } } //package com.ruoyi.web.controller.interceptor; // //import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Configuration; // //@Configuration //public class MybatisConfiguration { // // /** // * 注册拦截器 // */ // @Bean // public MybatisInterceptor getMybatisInterceptor() { // return new MybatisInterceptor(); // } // //} ruoyi-admin/src/main/java/com/ruoyi/web/controller/interceptor/MybatisInterceptor.java
@@ -1,119 +1,119 @@ package com.ruoyi.web.controller.interceptor; import com.ruoyi.framework.web.service.TokenService; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.executor.Executor; import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.mapping.SqlCommandType; import org.apache.ibatis.plugin.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.lang.reflect.Field; import java.time.LocalDateTime; import java.util.*; @Slf4j @Component @Intercepts({ @Signature(type = Executor.class, method = "update", args = { MappedStatement.class, Object.class }) }) public class MybatisInterceptor implements Interceptor { @Autowired private TokenService tokenService; @Override public Object intercept(Invocation invocation) throws Throwable { MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0]; if("com.ruoyi.system.mapper.SysLogininforMapper.insertLogininfor".equals(mappedStatement.getId())){ return invocation.proceed(); } // sql类型:insert、update、select、delete SqlCommandType sqlCommandType = mappedStatement.getSqlCommandType(); Object parameter = invocation.getArgs()[1]; if (parameter == null) { return invocation.proceed(); } // 当sql为新增或更新类型时,自动填充操作人相关信息 if (SqlCommandType.INSERT == sqlCommandType) { Field[] fields = getAllFields(parameter); for (Field field : fields) { try { // 注入创建人 if ("createBy".equals(field.getName())) { // 获取当前登录用户信息 if(Objects.nonNull(tokenService.getLoginUser())){ String userName = tokenService.getLoginUser().getUser().getUserName(); field.setAccessible(true); field.set(parameter, userName); field.setAccessible(false); } } //注入创建时间 if ("createTime".equals(field.getName())) { field.setAccessible(true); // field.set(parameter, LocalDateTime.now()); field.setAccessible(false); } } catch (Exception e) { log.error("failed to insert data, exception = ", e); } } } if (SqlCommandType.UPDATE == sqlCommandType) { Field[] fields = getAllFields(parameter); for (Field field : fields) { try { if ("updateBy".equals(field.getName())) { // 获取当前登录用户信息 if(Objects.nonNull(tokenService.getLoginUser())){ String userName = tokenService.getLoginUser().getUser().getUserName(); field.setAccessible(true); field.set(parameter, userName); field.setAccessible(false); } } if ("updateTime".equals(field.getName())) { field.setAccessible(true); // field.set(parameter, new Date()); field.setAccessible(false); } } catch (Exception e) { log.error("failed to update data, exception = ", e); } } } return invocation.proceed(); } @Override public Object plugin(Object target) { return Plugin.wrap(target, this); } @Override public void setProperties(Properties properties) { // TODO Auto-generated method stub } /** * 获取类的所有属性,包括父类 * * @param object * @return */ private Field[] getAllFields(Object object) { Class<?> clazz = object.getClass(); List<Field> fieldList = new ArrayList<>(); while (clazz != null) { fieldList.addAll(new ArrayList<>(Arrays.asList(clazz.getDeclaredFields()))); clazz = clazz.getSuperclass(); } Field[] fields = new Field[fieldList.size()]; fieldList.toArray(fields); return fields; } } //package com.ruoyi.web.controller.interceptor; // //import com.ruoyi.framework.web.service.TokenService; //import lombok.extern.slf4j.Slf4j; //import org.apache.ibatis.executor.Executor; //import org.apache.ibatis.mapping.MappedStatement; //import org.apache.ibatis.mapping.SqlCommandType; //import org.apache.ibatis.plugin.*; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.stereotype.Component; // //import java.lang.reflect.Field; //import java.time.LocalDateTime; //import java.util.*; // //@Slf4j //@Component //@Intercepts({ @Signature(type = Executor.class, method = "update", args = { MappedStatement.class, Object.class }) }) //public class MybatisInterceptor implements Interceptor { // // @Autowired // private TokenService tokenService; // // @Override // public Object intercept(Invocation invocation) throws Throwable { // MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0]; // if("com.ruoyi.system.mapper.SysLogininforMapper.insertLogininfor".equals(mappedStatement.getId())){ // return invocation.proceed(); // } // // sql类型:insert、update、select、delete // SqlCommandType sqlCommandType = mappedStatement.getSqlCommandType(); // Object parameter = invocation.getArgs()[1]; // // if (parameter == null) { // return invocation.proceed(); // } // // // 当sql为新增或更新类型时,自动填充操作人相关信息 // if (SqlCommandType.INSERT == sqlCommandType) { // // Field[] fields = getAllFields(parameter); // for (Field field : fields) { // try { // // 注入创建人 // if ("createBy".equals(field.getName())) { // // 获取当前登录用户信息 // if(Objects.nonNull(tokenService.getLoginUser())){ // String userName = tokenService.getLoginUser().getUser().getUserName(); // field.setAccessible(true); // field.set(parameter, userName); // field.setAccessible(false); // } // } // //注入创建时间 // if ("createTime".equals(field.getName())) { // field.setAccessible(true); //// field.set(parameter, LocalDateTime.now()); // field.setAccessible(false); // } // } catch (Exception e) { // log.error("failed to insert data, exception = ", e); // } // } // } // if (SqlCommandType.UPDATE == sqlCommandType) { // Field[] fields = getAllFields(parameter); // for (Field field : fields) { // try { // if ("updateBy".equals(field.getName())) { // // 获取当前登录用户信息 // if(Objects.nonNull(tokenService.getLoginUser())){ // String userName = tokenService.getLoginUser().getUser().getUserName(); // field.setAccessible(true); // field.set(parameter, userName); // field.setAccessible(false); // } // } // if ("updateTime".equals(field.getName())) { // field.setAccessible(true); //// field.set(parameter, new Date()); // field.setAccessible(false); // } // } catch (Exception e) { // log.error("failed to update data, exception = ", e); // } // } // } // return invocation.proceed(); // } // // @Override // public Object plugin(Object target) { // return Plugin.wrap(target, this); // } // // @Override // public void setProperties(Properties properties) { // // TODO Auto-generated method stub // } // // /** // * 获取类的所有属性,包括父类 // * // * @param object // * @return // */ // private Field[] getAllFields(Object object) { // Class<?> clazz = object.getClass(); // List<Field> fieldList = new ArrayList<>(); // while (clazz != null) { // fieldList.addAll(new ArrayList<>(Arrays.asList(clazz.getDeclaredFields()))); // clazz = clazz.getSuperclass(); // } // Field[] fields = new Field[fieldList.size()]; // fieldList.toArray(fields); // return fields; // } // //} ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -26,6 +26,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -243,11 +244,15 @@ @PutMapping("/changeStatus") public AjaxResult changeStatus(@RequestBody SysUserUpdateStatusDTO dto) { SysUser loginUser = tokenService.getLoginUser().getUser(); SysUser user = new SysUser(); user.setUserId(dto.getUserId()); user.setStatus(String.valueOf(dto.getStatus())); user.setRemark(dto.getRemark()); // user.setRemark(dto.getRemark()); user.setUpdateBy(getUsername()); user.setDisableRemark(dto.getRemark()); user.setOperatingTime(LocalDateTime.now()); user.setOperatingPerson(loginUser.getNickName()+"("+loginUser.getUserName()+")"); return AjaxResult.success(userService.updateUserStatus(user)); } ruoyi-admin/src/main/resources/application-test.yml
@@ -227,4 +227,4 @@ appId: 1400957506 secretid: AKIDCF5EF2c0DE1e5JK8r4EGJF4mNsMgp26x secretkey: lLl184rUyFOOE0d5KNGC3kmfNsCWk4GU sign: 四川金达通信工程 sign: 畅云出行 ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/StateProcessController.java
@@ -156,21 +156,21 @@ @ApiOperation("待办列表") @PostMapping("/wait/task/page") public AjaxResult<PageInfo<ProcessTaskListVO>> waitTaskPage(@RequestBody ProcessTaskListBO processTemplatePageBO) { return AjaxResult.success(processTemplateService.waitTaskPage(processTemplatePageBO)); return AjaxResult.success(processTemplateService.waitTaskPageApplet(processTemplatePageBO)); } //已办 @ApiOperation("已办列表") @PostMapping("/deal/task/page") public AjaxResult<PageInfo<ProcessTaskListVO>> dealTaskPage(@RequestBody ProcessTaskListBO processTemplatePageBO) { return AjaxResult.success(processTemplateService.dealTaskPage(processTemplatePageBO)); return AjaxResult.success(processTemplateService.dealTaskPageApplet(processTemplatePageBO)); } //待办和已办列表 @ApiOperation("待办和已办列表") @PostMapping("/dealAndWait/task/page") public AjaxResult<PageInfo<ProcessTaskListVO>> dealAndWaitTaskPage(@RequestBody ProcessTaskListBO processTemplatePageBO) { return AjaxResult.success(processTemplateService.dealAndWaitTaskPage(processTemplatePageBO)); //我发起的 @ApiOperation("我发起的列表") @PostMapping("/initiate/task/page") public AjaxResult<PageInfo<ProcessTaskListVO>> initiateTaskPage(@RequestBody ProcessTaskListBO processTemplatePageBO) { return AjaxResult.success(processTemplateService.initiateTaskPage(processTemplatePageBO)); } //抄送 ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TBillController.java
@@ -21,6 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; @@ -61,6 +63,14 @@ return R.ok(pageInfo); } public static void main(String[] args) { LocalDateTime localDateTime1 = LocalDateTime.now().withYear(2025).withMonth(11).withDayOfMonth(1); LocalDateTime localDateTime2 = LocalDateTime.now().withYear(2025).withMonth(11).withDayOfMonth(28); long allDays = ChronoUnit.DAYS.between(localDateTime1, localDateTime2); System.err.println(allDays); } @ApiOperation(value = "缴费账单查询列表") @PostMapping("/getBillIds") public R<List<String>> getBillIds(@RequestBody TBillQuery query){ ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TContractController.java
@@ -2,13 +2,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.constant.DictConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.model.LoginUserApplet; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DictUtils; import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.system.dto.RevokeDTO; import com.ruoyi.system.dto.SignContractDTO; import com.ruoyi.system.model.TContract; import com.ruoyi.system.model.TContractRentType; @@ -23,6 +26,7 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.time.LocalDateTime; @@ -52,6 +56,8 @@ private TokenService tokenService; @Autowired private TTenantService tTenantService; @Autowired private StateProcessTemplateService stateProcessTemplateService; @ApiOperation(value = " 签订合同") @PostMapping(value = "/signContract") public R signContract(@RequestBody SignContractDTO dto) { @@ -67,6 +73,18 @@ query.setTenantId(loginUserApplet.getUserId()); return R.ok(contractService.contractAppletList(query)); } @Log(title = "合同管理-撤销审批", businessType = BusinessType.UPDATE) @ApiOperation(value = "撤销审批") @PostMapping(value = "/updateContractStatus") public R<Boolean> updateContractStatus(@RequestBody RevokeDTO dto) { TContract contract = contractService.getById(dto.getContractId()); contract.setStatus("1"); contractService.updateById(contract); // 撤销审批实例 stateProcessTemplateService.revoke(dto.getInstanceId()); return R.ok(); } @ApiOperation(value = "查询合同信息信息") @GetMapping(value = "/getContractById") public R<TContractAppletVO> getContractById(@RequestParam String id) { ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/THouseController.java
@@ -1,8 +1,19 @@ package com.ruoyi.web.controller.api; import com.ruoyi.common.constant.DictConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.utils.DictUtils; import com.ruoyi.system.model.THouse; import com.ruoyi.system.service.THouseService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; /** @@ -13,9 +24,20 @@ * @author xiaochen * @since 2025-01-17 */ @Api(tags = "房屋管理") @RestController @RequestMapping("/t-house") public class THouseController { @Autowired private THouseService tHouseService; @ApiOperation(value = "查询房屋信息") @GetMapping(value = "/getHouseById") public R<THouse> getHouseById(@RequestParam String id) { THouse tHouse = tHouseService.getById(id); tHouse.setLeaseStatus(DictUtils.getDictLabel(DictConstants.DICT_TYPE_LEASE_STATUS,tHouse.getLeaseStatus())); tHouse.setBusinessAttributes(DictUtils.getDictLabel(DictConstants.DICT_TYPE_BUSINESS_ATTRIBUTES,tHouse.getBusinessAttributes())); return R.ok(tHouse); } } ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/WxLoginController.java
@@ -118,8 +118,8 @@ appletUserDecodeData.setOpenId(openid); // 先使用openId和当前手机号进行查询 TTenant tenant = tTenantService.getOne(Wrappers.lambdaQuery(TTenant.class) .eq(TTenant::getOpenId, appletUserDecodeData.getOpenId()) .eq(TTenant::getPhone, appletUserDecodeData.getPhoneNumber())); .and(e->e.eq(TTenant::getOpenId, appletUserDecodeData.getOpenId()).or() .eq(TTenant::getPhone, appletUserDecodeData.getPhoneNumber()))); if (tenant==null){ // appUser.setTenantAttributes(); // appUser.setTenantType(); ruoyi-applet/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java
@@ -44,7 +44,6 @@ caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数")); } @PreAuthorize("@ss.hasPermi('monitor:cache:list')") @GetMapping() public AjaxResult getInfo() throws Exception { @@ -68,14 +67,12 @@ return AjaxResult.success(result); } @PreAuthorize("@ss.hasPermi('monitor:cache:list')") @GetMapping("/getNames") public AjaxResult cache() { return AjaxResult.success(caches); } @PreAuthorize("@ss.hasPermi('monitor:cache:list')") @GetMapping("/getKeys/{cacheName}") public AjaxResult getCacheKeys(@PathVariable String cacheName) { @@ -83,7 +80,6 @@ return AjaxResult.success(cacheKeys); } @PreAuthorize("@ss.hasPermi('monitor:cache:list')") @GetMapping("/getValue/{cacheName}/{cacheKey}") public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) { @@ -92,7 +88,6 @@ return AjaxResult.success(sysCache); } @PreAuthorize("@ss.hasPermi('monitor:cache:list')") @DeleteMapping("/clearCacheName/{cacheName}") public AjaxResult clearCacheName(@PathVariable String cacheName) { @@ -101,7 +96,6 @@ return AjaxResult.success(); } @PreAuthorize("@ss.hasPermi('monitor:cache:list')") @DeleteMapping("/clearCacheKey/{cacheKey}") public AjaxResult clearCacheKey(@PathVariable String cacheKey) { @@ -109,7 +103,6 @@ return AjaxResult.success(); } @PreAuthorize("@ss.hasPermi('monitor:cache:list')") @DeleteMapping("/clearCacheAll") public AjaxResult clearCacheAll() { ruoyi-applet/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java
@@ -16,7 +16,6 @@ @RequestMapping("/monitor/server") public class ServerController { @PreAuthorize("@ss.hasPermi('monitor:server:list')") @GetMapping() public AjaxResult getInfo() throws Exception { ruoyi-applet/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java
@@ -35,7 +35,6 @@ @Autowired private SysPasswordService passwordService; @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") @GetMapping("/list") public TableDataInfo list(SysLogininfor logininfor) { @@ -45,7 +44,6 @@ } // @Log(title = "登录日志", businessType = BusinessType.EXPORT) // @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") // @PostMapping("/export") // public void export(HttpServletResponse response, SysLogininfor logininfor) // { @@ -54,7 +52,6 @@ // util.exportExcel(response, list, "登录日志"); // } @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @Log(title = "登录日志", businessType = BusinessType.DELETE) @DeleteMapping("/{infoIds}") public AjaxResult remove(@PathVariable Long[] infoIds) @@ -62,7 +59,6 @@ return toAjax(logininforService.deleteLogininforByIds(infoIds)); } @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @Log(title = "登录日志", businessType = BusinessType.CLEAN) @DeleteMapping("/clean") public AjaxResult clean() @@ -71,7 +67,6 @@ return success(); } @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')") @Log(title = "账户解锁", businessType = BusinessType.OTHER) @GetMapping("/unlock/{userName}") public AjaxResult unlock(@PathVariable("userName") String userName) ruoyi-applet/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java
@@ -38,7 +38,6 @@ @Autowired private RedisCache redisCache; @PreAuthorize("@ss.hasPermi('monitor:online:list')") @GetMapping("/list") public TableDataInfo list(String ipaddr, String userName) { @@ -72,7 +71,6 @@ /** * 强退用户 */ @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')") @Log(title = "在线用户", businessType = BusinessType.FORCE) @DeleteMapping("/{tokenId}") public AjaxResult forceLogout(@PathVariable String tokenId) ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
@@ -35,7 +35,6 @@ private ISysConfigService configService; // @Log(title = "参数管理", businessType = BusinessType.EXPORT) // @PreAuthorize("@ss.hasPermi('system:config:export')") // @PostMapping("/export") // public void export(HttpServletResponse response, SysConfig config) // { @@ -47,7 +46,6 @@ /** * 根据参数编号获取详细信息 */ @PreAuthorize("@ss.hasPermi('system:config:query')") @GetMapping(value = "/{configId}") public AjaxResult getInfo(@PathVariable Long configId) { @@ -66,7 +64,6 @@ /** * 新增参数配置 */ @PreAuthorize("@ss.hasPermi('system:config:add')") @Log(title = "参数管理", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@Validated @RequestBody SysConfig config) @@ -82,7 +79,6 @@ /** * 修改参数配置 */ @PreAuthorize("@ss.hasPermi('system:config:edit')") @Log(title = "参数管理", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@Validated @RequestBody SysConfig config) @@ -98,7 +94,6 @@ /** * 删除参数配置 */ @PreAuthorize("@ss.hasPermi('system:config:remove')") @Log(title = "参数管理", businessType = BusinessType.DELETE) @DeleteMapping("/{configIds}") public AjaxResult remove(@PathVariable Long[] configIds) @@ -110,7 +105,6 @@ /** * 刷新参数缓存 */ @PreAuthorize("@ss.hasPermi('system:config:remove')") @Log(title = "参数管理", businessType = BusinessType.CLEAN) @DeleteMapping("/refreshCache") public AjaxResult refreshCache() ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
@@ -37,7 +37,6 @@ /** * 获取部门列表 */ // @PreAuthorize("@ss.hasPermi('system:dept:list')") @GetMapping("/list") public AjaxResult list(SysDept dept) { @@ -48,7 +47,6 @@ /** * 查询部门列表(排除节点) */ // @PreAuthorize("@ss.hasPermi('system:dept:list')") @GetMapping("/list/exclude/{deptId}") public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) { @@ -60,7 +58,6 @@ /** * 根据部门编号获取详细信息 */ // @PreAuthorize("@ss.hasPermi('system:dept:query')") @GetMapping(value = "/{deptId}") public AjaxResult getInfo(@PathVariable Long deptId) { @@ -71,7 +68,6 @@ /** * 新增部门 */ // @PreAuthorize("@ss.hasPermi('system:dept:add')") @Log(title = "部门管理", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@Validated @RequestBody SysDept dept) @@ -87,7 +83,6 @@ /** * 修改部门 */ // @PreAuthorize("@ss.hasPermi('system:dept:edit')") @Log(title = "部门管理", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@Validated @RequestBody SysDept dept) @@ -113,7 +108,6 @@ /** * 删除部门 */ // @PreAuthorize("@ss.hasPermi('system:dept:remove')") @Log(title = "部门管理", businessType = BusinessType.DELETE) @DeleteMapping("/{deptId}") public AjaxResult remove(@PathVariable Long deptId) ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
@@ -40,7 +40,6 @@ @Autowired private ISysDictTypeService dictTypeService; @PreAuthorize("@ss.hasPermi('system:dict:list')") @GetMapping("/list") public TableDataInfo list(SysDictData dictData) { @@ -50,7 +49,6 @@ } // @Log(title = "字典数据", businessType = BusinessType.EXPORT) // @PreAuthorize("@ss.hasPermi('system:dict:export')") // @PostMapping("/export") // public void export(HttpServletResponse response, SysDictData dictData) // { @@ -62,7 +60,6 @@ /** * 查询字典数据详细 */ @PreAuthorize("@ss.hasPermi('system:dict:query')") @GetMapping(value = "/{dictCode}") public AjaxResult getInfo(@PathVariable Long dictCode) { @@ -86,7 +83,6 @@ /** * 新增字典类型 */ @PreAuthorize("@ss.hasPermi('system:dict:add')") @Log(title = "字典数据", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@Validated @RequestBody SysDictData dict) @@ -98,7 +94,6 @@ /** * 修改保存字典类型 */ @PreAuthorize("@ss.hasPermi('system:dict:edit')") @Log(title = "字典数据", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@Validated @RequestBody SysDictData dict) @@ -110,7 +105,6 @@ /** * 删除字典类型 */ @PreAuthorize("@ss.hasPermi('system:dict:remove')") @Log(title = "字典类型", businessType = BusinessType.DELETE) @DeleteMapping("/{dictCodes}") public AjaxResult remove(@PathVariable Long[] dictCodes) ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
@@ -34,7 +34,6 @@ @Autowired private ISysDictTypeService dictTypeService; @PreAuthorize("@ss.hasPermi('system:dict:list')") @GetMapping("/list") public TableDataInfo list(SysDictType dictType) { @@ -44,7 +43,6 @@ } // @Log(title = "字典类型", businessType = BusinessType.EXPORT) // @PreAuthorize("@ss.hasPermi('system:dict:export')") // @PostMapping("/export") // public void export(HttpServletResponse response, SysDictType dictType) // { @@ -56,7 +54,6 @@ /** * 查询字典类型详细 */ @PreAuthorize("@ss.hasPermi('system:dict:query')") @GetMapping(value = "/{dictId}") public AjaxResult getInfo(@PathVariable Long dictId) { @@ -66,7 +63,6 @@ /** * 新增字典类型 */ @PreAuthorize("@ss.hasPermi('system:dict:add')") @Log(title = "字典类型", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@Validated @RequestBody SysDictType dict) @@ -82,7 +78,6 @@ /** * 修改字典类型 */ @PreAuthorize("@ss.hasPermi('system:dict:edit')") @Log(title = "字典类型", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@Validated @RequestBody SysDictType dict) @@ -98,7 +93,6 @@ /** * 删除字典类型 */ @PreAuthorize("@ss.hasPermi('system:dict:remove')") @Log(title = "字典类型", businessType = BusinessType.DELETE) @DeleteMapping("/{dictIds}") public AjaxResult remove(@PathVariable Long[] dictIds) @@ -110,7 +104,6 @@ /** * 刷新字典缓存 */ @PreAuthorize("@ss.hasPermi('system:dict:remove')") @Log(title = "字典类型", businessType = BusinessType.CLEAN) @DeleteMapping("/refreshCache") public AjaxResult refreshCache() ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
@@ -130,7 +130,7 @@ String code = String.valueOf((int) (Math.random() * 1000000)); redisCache.setCacheObject(phone, code,5*60,TimeUnit.SECONDS); try { smsUtil.sendSms(phone, "", new String[]{code}); smsUtil.sendSms(phone, "2369926", new String[]{code}); } catch (Exception e) { throw new RuntimeException(e); } ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
@@ -62,7 +62,6 @@ /** * 获取菜单列表 */ // @PreAuthorize("@ss.hasPermi('system:menu:list')") @GetMapping("/list") public AjaxResult list(SysMenu menu) { @@ -73,7 +72,6 @@ /** * 根据菜单编号获取详细信息 */ // @PreAuthorize("@ss.hasPermi('system:menu:query')") @GetMapping(value = "/{menuId}") public AjaxResult getInfo(@PathVariable Long menuId) { @@ -106,7 +104,6 @@ /** * 新增菜单 */ // @PreAuthorize("@ss.hasPermi('system:menu:add')") @Log(title = "菜单管理", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@Validated @RequestBody SysMenu menu) @@ -126,7 +123,6 @@ /** * 修改菜单 */ // @PreAuthorize("@ss.hasPermi('system:menu:edit')") @Log(title = "菜单管理", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@Validated @RequestBody SysMenu menu) @@ -150,7 +146,6 @@ /** * 删除菜单 */ // @PreAuthorize("@ss.hasPermi('system:menu:remove')") @Log(title = "菜单管理", businessType = BusinessType.DELETE) @DeleteMapping("/{menuId}") public AjaxResult remove(@PathVariable("menuId") Long menuId) ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java
@@ -35,7 +35,6 @@ /** * 获取通知公告列表 */ @PreAuthorize("@ss.hasPermi('system:notice:list')") @GetMapping("/list") public TableDataInfo list(SysNotice notice) { @@ -47,7 +46,6 @@ /** * 根据通知公告编号获取详细信息 */ @PreAuthorize("@ss.hasPermi('system:notice:query')") @GetMapping(value = "/{noticeId}") public AjaxResult getInfo(@PathVariable Long noticeId) { @@ -57,7 +55,6 @@ /** * 新增通知公告 */ @PreAuthorize("@ss.hasPermi('system:notice:add')") @Log(title = "通知公告", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@Validated @RequestBody SysNotice notice) @@ -69,7 +66,6 @@ /** * 修改通知公告 */ @PreAuthorize("@ss.hasPermi('system:notice:edit')") @Log(title = "通知公告", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@Validated @RequestBody SysNotice notice) @@ -81,7 +77,6 @@ /** * 删除通知公告 */ @PreAuthorize("@ss.hasPermi('system:notice:remove')") @Log(title = "通知公告", businessType = BusinessType.DELETE) @DeleteMapping("/{noticeIds}") public AjaxResult remove(@PathVariable Long[] noticeIds) ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
@@ -37,7 +37,6 @@ /** * 获取岗位列表 */ @PreAuthorize("@ss.hasPermi('system:post:list')") @GetMapping("/list") public TableDataInfo list(SysPost post) { @@ -47,7 +46,6 @@ } // @Log(title = "岗位管理", businessType = BusinessType.EXPORT) // @PreAuthorize("@ss.hasPermi('system:post:export')") // @PostMapping("/export") // public void export(HttpServletResponse response, SysPost post) // { @@ -59,7 +57,6 @@ /** * 根据岗位编号获取详细信息 */ @PreAuthorize("@ss.hasPermi('system:post:query')") @GetMapping(value = "/{postId}") public AjaxResult getInfo(@PathVariable Long postId) { @@ -69,7 +66,6 @@ /** * 新增岗位 */ @PreAuthorize("@ss.hasPermi('system:post:add')") @Log(title = "岗位管理", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@Validated @RequestBody SysPost post) @@ -89,7 +85,6 @@ /** * 修改岗位 */ @PreAuthorize("@ss.hasPermi('system:post:edit')") @Log(title = "岗位管理", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@Validated @RequestBody SysPost post) @@ -109,7 +104,6 @@ /** * 删除岗位 */ @PreAuthorize("@ss.hasPermi('system:post:remove')") @Log(title = "岗位管理", businessType = BusinessType.DELETE) @DeleteMapping("/{postIds}") public AjaxResult remove(@PathVariable Long[] postIds) ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
@@ -61,7 +61,6 @@ @Autowired private ISysMenuService menuService; // @PreAuthorize("@ss.hasPermi('system:role:list')") @ApiOperation(value = "角色列表") @PostMapping("/list") public AjaxResult list(@RequestBody SysRoleQuery query) @@ -94,7 +93,6 @@ } // @Log(title = "角色管理", businessType = BusinessType.EXPORT) // // @PreAuthorize("@ss.hasPermi('system:role:export')") // @PostMapping("/export") // public void export(HttpServletResponse response, SysRole role) // { @@ -106,7 +104,6 @@ /** * 根据角色编号获取详细信息 */ // @PreAuthorize("@ss.hasPermi('system:role:query')") @GetMapping(value = "/{roleId}") public AjaxResult getInfo(@PathVariable Long roleId) { @@ -150,7 +147,6 @@ /** * 新增角色 */ // @PreAuthorize("@ss.hasPermi('system:role:add')") @ApiOperation(value = "新增角色") @Log(title = "角色信息-新增角色", businessType = BusinessType.INSERT) @PostMapping("/add") @@ -168,7 +164,6 @@ /** * 修改保存角色 */ // @PreAuthorize("@ss.hasPermi('system:role:edit')") @ApiOperation(value = "编辑角色") @Log(title = "角色信息-编辑角色", businessType = BusinessType.UPDATE) @PutMapping @@ -196,7 +191,6 @@ /** * 修改保存数据权限 */ // @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "角色管理", businessType = BusinessType.UPDATE) @PutMapping("/dataScope") public AjaxResult dataScope(@RequestBody SysRole role) @@ -209,7 +203,6 @@ /** * 状态修改 */ // @PreAuthorize("@ss.hasPermi('system:role:edit')") @ApiOperation(value = "状态修改") @Log(title = "角色信息-角色状态修改", businessType = BusinessType.UPDATE) @PutMapping("/changeStatus") @@ -223,7 +216,6 @@ /** * 删除角色 */ // @PreAuthorize("@ss.hasPermi('system:role:remove')") @ApiOperation(value = "删除角色") @Log(title = "角色信息-角色删除角色", businessType = BusinessType.DELETE) @DeleteMapping("/deleteById/{ids}") @@ -240,7 +232,6 @@ /** * 获取角色选择框列表 */ // @PreAuthorize("@ss.hasPermi('system:role:query')") @GetMapping("/optionselect") public AjaxResult optionselect() { @@ -250,7 +241,6 @@ /** * 查询已分配用户角色列表 */ // @PreAuthorize("@ss.hasPermi('system:role:list')") @GetMapping("/authUser/allocatedList") public TableDataInfo allocatedList(SysUser user) { @@ -262,7 +252,6 @@ /** * 查询未分配用户角色列表 */ // @PreAuthorize("@ss.hasPermi('system:role:list')") @GetMapping("/authUser/unallocatedList") public TableDataInfo unallocatedList(SysUser user) { @@ -274,7 +263,6 @@ /** * 取消授权用户 */ // @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "角色管理", businessType = BusinessType.GRANT) @PutMapping("/authUser/cancel") public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) @@ -285,7 +273,6 @@ /** * 批量取消授权用户 */ // @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "角色管理", businessType = BusinessType.GRANT) @PutMapping("/authUser/cancelAll") public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) @@ -296,7 +283,6 @@ /** * 批量选择用户授权 */ // @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "角色管理", businessType = BusinessType.GRANT) @PutMapping("/authUser/selectAll") public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) @@ -308,7 +294,6 @@ /** * 获取对应角色部门树列表 */ // @PreAuthorize("@ss.hasPermi('system:role:query')") @GetMapping(value = "/deptTree/{roleId}") public AjaxResult deptTree(@PathVariable("roleId") Long roleId) { ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -232,7 +232,6 @@ // @Log(title = "用户管理", businessType = BusinessType.EXPORT) //// // @PreAuthorize("@ss.hasPermi('system:user:export')") // @PostMapping("/export") // public void export(HttpServletResponse response, SysUser user) // { @@ -242,7 +241,6 @@ // } // @Log(title = "用户管理", businessType = BusinessType.IMPORT) //// // @PreAuthorize("@ss.hasPermi('system:user:import')") // @PostMapping("/importData") // public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception // { @@ -264,7 +262,6 @@ /** * 新增用户 */ // @PreAuthorize("@ss.hasPermi('system:user:add')") @ApiOperation(value = "新增用户管理") @Log(title = "用户信息-新增用户", businessType = BusinessType.INSERT) @PostMapping("/add") @@ -288,7 +285,6 @@ /** * 修改用户 */ // @PreAuthorize("@ss.hasPermi('system:user:edit')") @ApiOperation(value = "修改用户管理") @Log(title = "用户信息-修改用户", businessType = BusinessType.UPDATE) @PostMapping("/edit") @@ -314,7 +310,6 @@ /** * 删除用户 */ // @PreAuthorize("@ss.hasPermi('system:user:remove')") @ApiOperation(value = "批量删除用户") @Log(title = "用户信息-批量删除用户", businessType = BusinessType.DELETE) @DeleteMapping("/deleteById/{ids}") @@ -335,7 +330,6 @@ /** * 重置密码 */ // @PreAuthorize("@ss.hasPermi('system:user:resetPwd')") @ApiOperation(value = "重置密码") @Log(title = "用户信息-重置密码", businessType = BusinessType.UPDATE) @PostMapping("/resetPwd") @@ -367,7 +361,6 @@ /** * 根据用户编号获取授权角色 */ // @PreAuthorize("@ss.hasPermi('system:user:query')") @GetMapping("/authRole/{userId}") public AjaxResult authRole(@PathVariable("userId") Long userId) { @@ -382,7 +375,6 @@ /** * 用户授权角色 */ // @PreAuthorize("@ss.hasPermi('system:user:edit')") @Log(title = "用户管理", businessType = BusinessType.GRANT) @PutMapping("/authRole") public AjaxResult insertAuthRole(Long userId, Long[] roleIds) @@ -395,7 +387,6 @@ /** * 获取部门树列表 */ // @PreAuthorize("@ss.hasPermi('system:user:list')") @GetMapping("/deptTree") public AjaxResult deptTree(SysDept dept) { ruoyi-applet/src/main/resources/application-test.yml
@@ -220,3 +220,9 @@ bucketAddr: ap-chengdu rootSrc: https://xzgttest-1305134071.cos.ap-chengdu.myqcloud.com/ location: xizang sms: enable: true appId: 1400957506 secretid: AKIDCF5EF2c0DE1e5JK8r4EGJF4mNsMgp26x secretkey: lLl184rUyFOOE0d5KNGC3kmfNsCWk4GU sign: 畅云出行 ruoyi-common/src/main/java/com/ruoyi/common/constant/DictConstants.java
@@ -40,7 +40,7 @@ */ public static final String DICT_TYPE_PAY_FEES_STATUS = "t_pay_fees_status"; /** * 账单类型 1=租金 2=押金 3=生活费用 * 账单类型 1=租金 2=押金 3=生活费用 4=房屋验收 */ public static final String DICT_TYPE_BILL_TYPE = "t_bill_type"; /** ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java
@@ -1,12 +1,16 @@ package com.ruoyi.common.core.domain; import java.io.Serializable; import java.time.LocalDateTime; import java.util.Date; import java.util.HashMap; import java.util.Map; import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import io.swagger.annotations.ApiModelProperty; /** * Entity基类 @@ -38,6 +42,43 @@ /** 备注 */ private String remark; @ApiModelProperty(value = "禁用备注") @TableField("disable_remark") private String disableRemark; @ApiModelProperty(value = "操作时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @TableField("operating_time") private LocalDateTime operatingTime; @ApiModelProperty(value = "操作人 登录名(登录账号)") @TableField("operating_person") private String operatingPerson; public String getDisableRemark() { return disableRemark; } public void setDisableRemark(String disableRemark) { this.disableRemark = disableRemark; } public LocalDateTime getOperatingTime() { return operatingTime; } public void setOperatingTime(LocalDateTime operatingTime) { this.operatingTime = operatingTime; } public String getOperatingPerson() { return operatingPerson; } public void setOperatingPerson(String operatingPerson) { this.operatingPerson = operatingPerson; } /** 请求参数 */ @JsonInclude(JsonInclude.Include.NON_EMPTY) private Map<String, Object> params; ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseModel.java
@@ -60,7 +60,6 @@ * 最后修改时间 */ @ApiModelProperty(value = "记录修改时间,前端忽略") @JsonIgnore @TableField("update_time") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime updateTime; ruoyi-common/src/main/java/com/ruoyi/common/enums/TaskEventType.java
New file @@ -0,0 +1,146 @@ /* * Copyright 2023-2025 Licensed under the Dual Licensing * website: https://aizuda.com */ package com.ruoyi.common.enums; /** * 流程引擎监听类型 * * <p> * <a href="https://aizuda.com">官网</a>尊重知识产权,不允许非法使用,后果自负 * </p> * * @author lizhongyuan * @since 1.0 */ public enum TaskEventType { /** * 发起 */ start, /** * 创建 */ create, /** * 再创建,仅用于流程回退 */ recreate, /** * 抄送 */ cc, /** * 分配 */ assignment, /** * 委派任务解决 */ delegateResolve, /** * 任务加签 */ addTaskActor, /** * 任务减签 */ removeTaskActor, /** * 驳回至上一步处理 */ reject, /** * 角色认领 */ claimRole, /** * 部门认领 */ claimDepartment, /** * 拿回未执行任务 */ reclaim, /** * 撤回指定任务 */ withdraw, /** * 唤醒历史任务 */ resume, /** * 完成 */ complete, /** * 撤销 */ revoke, /** * 终止 */ terminate, /** * 更新 */ update, /** * 删除 */ delete, /** * 调用外部流程任务【办理子流程】 */ callProcess, /** * 超时 */ timeout, /** * 跳转 */ jump, /** * 自动跳转 */ autoJump, /** * 驳回跳转 */ rejectJump, /** * 路由跳转 */ routeJump, /** * 驳回重新审批跳转 */ reApproveJump, /** * 自动审批完成 */ autoComplete, /** * 自动审批拒绝 */ autoReject, /** * 触发器任务 */ trigger, /** * 结束 */ end; public boolean eq(TaskEventType eventType) { return this == eventType; } public boolean ne(TaskEventType eventType) { return this != eventType; } } ruoyi-system/pom.xml
@@ -32,6 +32,10 @@ <!-- </exclusion>--> <!-- </exclusions>--> </dependency> <dependency> <groupId>com.ruoyi</groupId> <artifactId>ruoyi-quartz</artifactId> </dependency> <dependency> <groupId>cn.afterturn</groupId> ruoyi-system/src/main/java/com/ruoyi/system/bo/ProcessAgreeBO.java
@@ -1,5 +1,6 @@ package com.ruoyi.system.bo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -22,5 +23,14 @@ * 理由 */ private String remark; /** * 图片 */ private String pictures; /** * 审批用户id */ @ApiModelProperty(value = "前端忽略") private Long userId; } ruoyi-system/src/main/java/com/ruoyi/system/bo/ProcessRefuseBO.java
@@ -22,6 +22,9 @@ * 理由 */ private String remark; /** * 图片 */ private String pictures; } ruoyi-system/src/main/java/com/ruoyi/system/bo/ProcessTaskListBO.java
@@ -42,4 +42,11 @@ @ApiModelProperty(value = "前端忽略") private List<String> instanceIds; @ApiModelProperty(value = "时间筛选 1=1天 2=7天 3=30天") private Integer timeType; @ApiModelProperty(value = "排序 1=最早到达 2=最新到达") private Integer sortBy=2; } ruoyi-system/src/main/java/com/ruoyi/system/dto/RevokeDTO.java
New file @@ -0,0 +1,19 @@ package com.ruoyi.system.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; @Data @ApiModel(value = "撤销DTO") public class RevokeDTO implements Serializable { @ApiModelProperty(value = "审批流实例id") private Long instanceId; @ApiModelProperty(value = "合同id") private String contractId; } ruoyi-system/src/main/java/com/ruoyi/system/mapper/StateProcessInstanceActionMapper.java
@@ -4,4 +4,6 @@ import com.ruoyi.system.model.StateProcessInstanceAction; public interface StateProcessInstanceActionMapper extends BaseMapper<StateProcessInstanceAction> { void saveData(StateProcessInstanceAction stateProcessInstanceAction); } ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java
@@ -72,5 +72,5 @@ */ public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds); void insertBatchUserDept(List<TDeptToUser> deptToUserList); void insertBatchUserDept(@Param("deptToUserList")List<TDeptToUser> deptToUserList); } ruoyi-system/src/main/java/com/ruoyi/system/mapper/TDeptToUserMapper.java
@@ -3,6 +3,9 @@ import com.ruoyi.system.model.TDeptToUser; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; /** * <p> @@ -22,4 +25,6 @@ * @return 删除结果 **/ int deleteUserDeptByUserId(Long userId); void insertBatchUserDept(@Param("deptToUserList") List<TDeptToUser> deptToUserList); } ruoyi-system/src/main/java/com/ruoyi/system/model/StateProcessInstanceAction.java
@@ -1,20 +1,22 @@ package com.ruoyi.system.model; import com.baomidou.mybatisplus.annotation.IdType; 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.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.ruoyi.common.core.domain.BaseModel; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serializable; import java.time.LocalDateTime; @Data @EqualsAndHashCode(callSuper = false) @ApiModel(value = "工作流-实例操作记录表") @TableName(value = "state_process_instance_action") public class StateProcessInstanceAction extends BaseModel { public class StateProcessInstanceAction implements Serializable { @TableId(value = "id", type = IdType.ASSIGN_ID) private String id; @@ -42,5 +44,22 @@ @ApiModelProperty(value = "备注") @TableField("remark") private String remark; @ApiModelProperty(value = "图片") @TableField("pictures") private String pictures; /** * 删除 未删除 */ @TableField("`disabled`") @TableLogic private Boolean disabled; @ApiModelProperty(value = "记录创建时间,前端忽略") @TableField("create_time") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime createTime; @TableField(exist = false) private String nickName; } ruoyi-system/src/main/java/com/ruoyi/system/model/TBill.java
@@ -67,7 +67,7 @@ private BigDecimal payFeesMoney; @ApiModelProperty(value = "缴费日期") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @TableField("pay_fees_time") private LocalDateTime payFeesTime; @@ -75,7 +75,7 @@ @TableField("pay_fees_type") private Integer payFeesType; @ApiModelProperty(value = "账单类型 1=租金 2=押金 3=生活费用") @ApiModelProperty(value = "账单类型 1=租金 2=押金 3=生活费用 4=房屋验收") @TableField("bill_type") private String billType; ruoyi-system/src/main/java/com/ruoyi/system/model/TContract.java
@@ -16,6 +16,8 @@ import lombok.Data; import lombok.EqualsAndHashCode; import javax.validation.constraints.NotBlank; /** * <p> * 合同管理 @@ -127,6 +129,7 @@ @ApiModelProperty(value = "合同附件,多个逗号拼接") @TableField("contract_file") @NotBlank(message = "合同附件不能为空") private String contractFile; @ApiModelProperty(value = "备注") @@ -167,5 +170,8 @@ @ApiModelProperty(value = "房屋地址") @TableField(exist = false) private String houseAddress; @ApiModelProperty(value = "审批流实例id") @TableField(exist = false) private Long instanceId; } ruoyi-system/src/main/java/com/ruoyi/system/query/SysUserQuery.java
@@ -12,10 +12,10 @@ public class SysUserQuery extends BasePage { @ApiModelProperty(value = "姓名") private String nickNameAndPhone; private String nickNameOrPhone; @ApiModelProperty(value = "角色id") private Integer roleId; private List<Integer> roleIds; @ApiModelProperty(value = "部门id集合") private List<String> deptIds; ruoyi-system/src/main/java/com/ruoyi/system/query/TBillAppletQuery.java
@@ -1,12 +1,14 @@ package com.ruoyi.system.query; import com.ruoyi.common.core.domain.BasePage; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; @Data @ApiModel("租户详情-缴费账单列表查询") public class TBillAppletQuery extends BasePage { /** * 缴费状态 1=未缴费 2=待确认 3=已缴费 4=已逾期 ruoyi-system/src/main/java/com/ruoyi/system/query/TContractQuery.java
@@ -16,7 +16,7 @@ @ApiModelProperty(value = "合同编号") private String contractNumber; @ApiModelProperty(value = "合同名称") private Integer contractName; private String contractName; @ApiModelProperty(value = "合同状态 1=待提交 2=待审批 3=未签订 4=已签订 5=已驳回 6=已终止 7=待结算 8=已结算") private Integer status; @ApiModelProperty(value = "选中的行") ruoyi-system/src/main/java/com/ruoyi/system/query/THouseQuery.java
@@ -16,6 +16,6 @@ private String propertyRightPerson; @ApiModelProperty(value = "租赁状态 1=待出租 2=已出租 3=维修中") private Integer leaseStatus; private String leaseStatus; } ruoyi-system/src/main/java/com/ruoyi/system/service/StateProcessInstanceActionService.java
@@ -4,4 +4,7 @@ import com.ruoyi.system.model.StateProcessInstanceAction; public interface StateProcessInstanceActionService extends IService<StateProcessInstanceAction> { void saveData(StateProcessInstanceAction stateProcessInstanceAction); } ruoyi-system/src/main/java/com/ruoyi/system/service/StateProcessTemplateService.java
@@ -1,6 +1,7 @@ package com.ruoyi.system.service; import com.aizuda.bpm.engine.core.FlowCreator; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.basic.PageInfo; @@ -25,11 +26,20 @@ */ Boolean start(ProcessStartBO processStartBO); /** * 启动流程 * @param processStartBO * @return */ Boolean startApplet(ProcessStartBO processStartBO); //待办 PageInfo<ProcessTaskListVO> waitTaskPage(ProcessTaskListBO processTaskListBO); PageInfo<ProcessTaskListVO> waitTaskPageApplet(ProcessTaskListBO processTaskListBO); //已办 PageInfo<ProcessTaskListVO> dealTaskPage(ProcessTaskListBO processTaskListBO); PageInfo<ProcessTaskListVO> dealTaskPageApplet(ProcessTaskListBO processTaskListBO); //抄送 PageInfo<ProcessTaskListVO> copyTaskPage(ProcessTaskListBO processTaskListBO); @@ -39,8 +49,16 @@ //拒绝 void refuse(ProcessRefuseBO processRefuseBO); /** * 流程实例撤销(用于错误发起审批申请,发起人主动撤销) * * @param instanceId 流程实例ID */ void revoke(Long instanceId); PageInfo<ProcessTaskListVO> dealAndWaitTaskPage(ProcessTaskListBO processTemplatePageBO); ProcessDetailVO detail(String taskId); PageInfo<ProcessTaskListVO> initiateTaskPage(ProcessTaskListBO processTemplatePageBO); } ruoyi-system/src/main/java/com/ruoyi/system/service/TTenantService.java
@@ -3,7 +3,9 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.dto.TBillDto; import com.ruoyi.system.dto.TTenantDTO; import com.ruoyi.system.model.TContract; import com.ruoyi.system.model.TDept; import com.ruoyi.system.model.THouse; import com.ruoyi.system.query.TBillAppletQuery; import com.ruoyi.system.query.TExamineAppletQuery; @@ -45,4 +47,11 @@ PageInfo<ExamineVO> examineList(TExamineAppletQuery dto); /** * 判断租户是否已存在 * @param dto * @return */ boolean isExit(TTenantDTO dto); } ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FlowListenerService.java
@@ -25,19 +25,21 @@ import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.google.common.collect.ImmutableMap; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.enums.ProcessCategoryEnum; import com.ruoyi.common.enums.SubmitStatusEnum; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.TContractService; import com.ruoyi.system.task.base.QuartzManager; import com.ruoyi.system.task.base.TimeJobType; import com.ruoyi.system.task.jobs.StateProcessJob; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.*; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -93,6 +95,15 @@ if (ObjectUtil.isEmpty(flwHisTask)) { return true; } // 添加定时任务 Map<String, ? extends Object> maps = new ImmutableMap.Builder<String, Long>(). put("id", flwTask.getId()) .build(); QuartzManager.addJob(StateProcessJob.class, (StateProcessJob.name+flwTask.getId()).toUpperCase(), TimeJobType.AUTO_AUDIT,new Date(new Date().getTime()+48*60*60*1000L), maps); //对比发起人和节点审批人 if (nodeAssigneeList.stream().noneMatch(t -> Objects.equals(t.getId(), flwHisTask.getCreateId()))) { return true; @@ -135,6 +146,15 @@ if (ObjectUtil.isEmpty(flwHisTask)) { return true; } // 添加定时任务 Map<String, ? extends Object> maps = new ImmutableMap.Builder<String, Long>(). put("id", flwTask.getId()) .build(); QuartzManager.addJob(StateProcessJob.class, (StateProcessJob.name+flwTask.getId()).toUpperCase(), TimeJobType.AUTO_AUDIT,new Date(new Date().getTime()+48*60*60*1000L), maps); //对比发起人和节点审批人 if (flwTaskActors.stream().noneMatch(t -> Objects.equals(t.getActorId(), flwHisTask.getCreateId()))) { return true; @@ -231,10 +251,14 @@ } case CATEGORY2: { // 合同签订审批 int submitStatus = status==0?3:(status==1?4:5); contractService.updateContractAuditStatus(processParameter.getString("projectId"), submitStatus); break; } case CATEGORY3: { // 合同提前终止审批 int submitStatus = status==0?4:(status==1?6:5); contractService.updateContractAuditStatus(processParameter.getString("projectId"), submitStatus); break; } default: ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StateProcessInstanceActionServiceImpl.java
@@ -8,4 +8,8 @@ @Service public class StateProcessInstanceActionServiceImpl extends ServiceImpl<StateProcessInstanceActionMapper, StateProcessInstanceAction> implements StateProcessInstanceActionService { @Override public void saveData(StateProcessInstanceAction stateProcessInstanceAction) { this.baseMapper.saveData(stateProcessInstanceAction); } } ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StateProcessTemplateServiceImpl.java
@@ -1,13 +1,17 @@ package com.ruoyi.system.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.json.JSONUtil; import com.aizuda.bpm.engine.FlowLongEngine; import com.aizuda.bpm.engine.TaskService; import com.aizuda.bpm.engine.core.FlowCreator; import com.aizuda.bpm.engine.core.enums.InstanceState; import com.aizuda.bpm.engine.core.enums.TaskType; import com.aizuda.bpm.engine.dao.FlwInstanceDao; import com.aizuda.bpm.engine.entity.*; import com.aizuda.bpm.engine.model.NodeModel; import com.aizuda.bpm.mybatisplus.mapper.*; @@ -18,17 +22,21 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.collect.ImmutableMap; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.core.domain.BaseModel; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUserApplet; import com.ruoyi.common.enums.StateProcessActionEnum; import com.ruoyi.common.enums.TaskEventType; import com.ruoyi.common.exception.GlobalException; import com.ruoyi.common.exception.state.StateErrorCode; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.system.bo.*; import com.ruoyi.system.mapper.StateProcessTemplateMapper; import com.ruoyi.system.mapper.TContractMapper; import com.ruoyi.system.model.*; import com.ruoyi.system.service.*; import com.ruoyi.system.vo.ProcessDetailVO; @@ -45,6 +53,7 @@ import java.time.LocalDateTime; import java.util.*; import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collectors; @Service @@ -63,6 +72,8 @@ @Autowired private FlwTaskMapper flwTaskMapper; @Autowired private TaskService taskService; @Autowired private StateTaskCenterService stateTaskCenterService; @Autowired private StateProcessModuleService stateProcessModuleService; @@ -73,7 +84,7 @@ @Autowired private ISysUserService sysUserService; @Autowired private TContractService contractService; private TContractMapper contractMapper; /** * 流程模版分页 @@ -290,6 +301,83 @@ } /** * 启动流程 * @param processStartBO * @return */ @Transactional(rollbackFor = Exception.class) @Override public Boolean startApplet(ProcessStartBO processStartBO) { String userId = "1"; String nickName = "admin"; FlowCreator creator = FlowCreator.of(userId, nickName); //查询流程绑定 StateProcessModule stateProcessModule = stateProcessModuleService.getOne(Wrappers.<StateProcessModule>lambdaQuery() .eq(StateProcessModule::getCategory, processStartBO.getCategory())); if (ObjectUtil.isNull(stateProcessModule) || ObjectUtil.isEmpty(stateProcessModule.getTemplateId())) { throw new GlobalException("请先配置流程引擎模版!"); } //查询模版,准备启动 StateProcessTemplate template = this.getById(stateProcessModule.getTemplateId()); StateProcessTemplate lastTemplate = this.getOne(Wrappers.<StateProcessTemplate>lambdaQuery() .eq(StateProcessTemplate::getTemplateKey, template.getTemplateKey()) .apply("(template_key, template_version) in(" + "SELECT template_key, MAX(template_version) " + "FROM state_process_template " + "GROUP BY template_key)") ); if (ObjectUtil.isNull(lastTemplate)) { throw new GlobalException(StateErrorCode.PROCESS_TEMPLATE_NOT_EXISTS.getValue()); } FlwProcess flwProcess = flowLongEngine.processService().getProcessById(lastTemplate.getWorkFlowId()); if (ObjectUtil.isNull(flwProcess)) { throw new GlobalException(StateErrorCode.PROCESS_NOT_DEPLOY.getValue()); } if (!Objects.equals(lastTemplate.getWorkflowVersion(), flwProcess.getProcessVersion())) { throw new GlobalException(StateErrorCode.PROCESS_VERSION_ERROR.getValue()); } //监听器参数补全 processStartBO.getVariable().put("category", processStartBO.getCategory()); // 开启流程 Optional<FlwInstance> flwInstanceOptional = flowLongEngine.startInstanceById(flwProcess.getId(), creator, processStartBO.getVariable()); if(flwInstanceOptional.isPresent()){ FlwInstance instance = flwInstanceOptional.get(); //存储任务中心信息 StateTaskCenter stateTaskCenter = new StateTaskCenter(); stateTaskCenter.setId(IdUtils.simpleUUID()); stateTaskCenter.setName(processStartBO.getName()); stateTaskCenter.setModuleName(processStartBO.getModuleName()); stateTaskCenter.setCategory(processStartBO.getCategory()); stateTaskCenter.setFlowId(instance.getId().toString()); stateTaskCenter.setRemark(processStartBO.getRemark()); stateTaskCenter.setCreateBy(nickName); stateTaskCenter.setVariable(JSONUtil.toJsonStr(processStartBO.getVariable())); stateTaskCenter.setProjectId(JSONObject.parseObject(JSONUtil.toJsonStr(processStartBO.getVariable())).getString("projectId")); stateTaskCenterService.save(stateTaskCenter); // action记录 StateProcessInstanceAction stateProcessInstanceAction = new StateProcessInstanceAction(); stateProcessInstanceAction.setId(IdUtils.simpleUUID()); stateProcessInstanceAction.setInstanceId(instance.getId().toString()); stateProcessInstanceAction.setActionType(StateProcessActionEnum.START.getValue()); stateProcessInstanceAction.setAuditorId(creator.getCreateId()); stateProcessInstanceActionService.save(stateProcessInstanceAction); // 添加拓展信息 StateProcessExtInstance stateProcessExtInstance = new StateProcessExtInstance(); stateProcessExtInstance.setId(instance.getId().toString()); stateProcessExtInstance.setTemplateId(lastTemplate.getId()); stateProcessExtInstance.setProcessId(flwProcess.getId().toString()); //保存version stateProcessExtInstance.setProcessVersion(flwProcess.getProcessVersion()); stateProcessExtInstanceService.save(stateProcessExtInstance); } return true; } /** * 待办 * @param processTaskListBO * @return @@ -360,7 +448,149 @@ // 查询合同信息 for (ProcessTaskListVO processTaskListVO : processTaskListVOS) { // 查询合同信息 TContract contract = contractService.getById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); TContract contract = contractMapper.selectById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); processTaskListVO.setContract(contract); } pageInfo.setRecords(processTaskListVOS); List<String> updateUserId = processTaskListVOS.stream().map(ProcessTaskListVO::getCreateBy).collect(Collectors.toList()); Map<Long, SysUser> sysUserMap; if (!CollectionUtils.isEmpty(updateUserId)) { //根据用户id查询更新人信息 List<SysUser> sysUsers = sysUserService.selectUserByUserNameList(updateUserId); if (!CollectionUtils.isEmpty(sysUsers)) { sysUserMap = sysUsers.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity())); } else { sysUserMap = new HashMap<>(); } } else { sysUserMap = new HashMap<>(); } Map<Long, List<FlwTask>> flwHisTaskMap = flwTasks.stream().collect(Collectors.groupingBy(FlwTask::getInstanceId)); for (ProcessTaskListVO processTaskListVO : processTaskListVOS) { List<FlwTask> flwTask = flwHisTaskMap.get(NumberUtil.parseLong(processTaskListVO.getFlowId())); if (!CollectionUtils.isEmpty(flwTask) && ObjectUtil.isNotEmpty(flwTask.get(0))) { //待审核 processTaskListVO.setStatus("0"); processTaskListVO.setNodeName(flwTask.get(0).getTaskName()); processTaskListVO.setTaskId(flwTask.get(0).getId().toString()); processTaskListVO.setVariable(flwTask.get(0).getVariable()); } SysUser sysUser = sysUserMap.get(processTaskListVO.getCreateBy()); if (Objects.nonNull(sysUser)) { processTaskListVO.setCreateBy(sysUser.getNickName()); } } return pageInfo; } /** * 待办 * @param processTaskListBO * @return */ @Override public PageInfo<ProcessTaskListVO> waitTaskPageApplet(ProcessTaskListBO processTaskListBO) { String startTime = null; String endTime = null; if(Objects.nonNull(processTaskListBO.getTimeType())){ switch (processTaskListBO.getTimeType()){ case 1: startTime = DateUtil.format(DateUtil.offsetDay(new Date(), -1), "yyyy-MM-dd") + " 00:00:00"; endTime = DateUtil.format(DateUtil.offsetDay(new Date(), -1), "yyyy-MM-dd") + " 23:59:59"; break; case 2: startTime = DateUtil.format(DateUtil.offsetDay(new Date(), -7), "yyyy-MM-dd") + " 00:00:00"; endTime = DateUtil.format(DateUtil.offsetDay(new Date(), -1), "yyyy-MM-dd") + " 23:59:59"; break; case 3: startTime = DateUtil.format(DateUtil.offsetDay(new Date(), -30), "yyyy-MM-dd") + " 00:00:00"; endTime = DateUtil.format(DateUtil.offsetDay(new Date(), -1), "yyyy-MM-dd") + " 23:59:59"; break; } } //获取当前登录用户信息 Long userId = SecurityUtils.getLoginUser().getUserId(); //或签时查询其他审批人是否通过(不能省略),比如 同一任务需要A,B审核,A通过了,B不用在审核了,在历史表查询A的审核记录 LambdaQueryWrapper<FlwHisInstance> lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.orderByDesc(FlowEntity::getCreateTime); //待审核 lambdaQueryWrapper.eq(FlwHisInstance::getInstanceState, 0); List<Long> flwHisInstances = flwHisInstanceMapper.selectList(lambdaQueryWrapper).stream() .map(FlwHisInstance::getId).collect(Collectors.toList()); if (ObjectUtil.isEmpty(flwHisInstances)) { return new PageInfo<>(); } //查询任务参与者 LambdaQueryWrapper<FlwTaskActor> query = new LambdaQueryWrapper<>(); query.and(qy -> qy.eq(FlwTaskActor::getActorId, userId) //0指定用户 .eq(FlwTaskActor::getActorType, 0) .or().in(FlwTaskActor::getActorId, userId) //1指定角色 .eq(FlwTaskActor::getActorType, 1)); if (ObjectUtil.isNotNull(processTaskListBO) && ObjectUtil.isNotNull(flwHisInstances)) { // 添加条件 query = query.in(FlwTaskActor::getInstanceId, flwHisInstances); } List<FlwTaskActor> flwTaskActorPage = flwTaskActorMapper.selectList(query); if (ObjectUtil.isEmpty(flwTaskActorPage)) { return new PageInfo<>(); } //查询任务信息 List<FlwTask> flwTasks = flwTaskMapper.selectList(Wrappers.<FlwTask>lambdaQuery() .orderByDesc(FlwTask::getCreateTime) .in(FlwTask::getId, flwTaskActorPage.stream() .map(FlwTaskActor::getTaskId).collect(Collectors.toList()))); if (ObjectUtil.isNull(flwTasks)) { return new PageInfo<>(); } List<String> instanceIds = flwTasks.stream().map(FlwTask::getInstanceId) .map(String::valueOf).collect(Collectors.toList()); //分页查询任务中心任务 LambdaQueryWrapper<StateTaskCenter> stateTaskQuery = new LambdaQueryWrapper<>(); if (ObjectUtil.isNotEmpty(processTaskListBO.getName())) { stateTaskQuery.like(StateTaskCenter::getName, processTaskListBO.getName()); } if (ObjectUtil.isNotEmpty(processTaskListBO.getModuleName())) { stateTaskQuery.like(StateTaskCenter::getModuleName, processTaskListBO.getModuleName()); } if (ObjectUtil.isNotEmpty(processTaskListBO.getCreateBy())) { stateTaskQuery.like(StateTaskCenter::getCreateBy, processTaskListBO.getCreateBy()); } if (ObjectUtil.isNotEmpty(startTime) && ObjectUtil.isNotEmpty(endTime)) { stateTaskQuery.between(StateTaskCenter::getCreateTime, startTime, endTime); } if(Objects.isNull(processTaskListBO.getSortBy())){ processTaskListBO.setSortBy(2); } if (processTaskListBO.getSortBy() == 1) { stateTaskQuery.orderByAsc(BaseModel::getCreateTime); } if (processTaskListBO.getSortBy() == 2) { stateTaskQuery.orderByDesc(BaseModel::getCreateTime); } stateTaskQuery.in(StateTaskCenter::getFlowId, instanceIds); PageInfo pageInfo = new PageInfo(processTaskListBO.getPageNum(), processTaskListBO.getPageSize()); PageInfo<StateTaskCenter> taskCenters = stateTaskCenterService.page(pageInfo,stateTaskQuery); //转换类 List<ProcessTaskListVO> processTaskListVOS = BeanUtil.copyToList(taskCenters.getRecords(), ProcessTaskListVO.class); // 查询合同信息 for (ProcessTaskListVO processTaskListVO : processTaskListVOS) { // 查询合同信息 TContract contract = contractMapper.selectById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); processTaskListVO.setContract(contract); } @@ -429,6 +659,122 @@ new PageInfo<>(); } List<String> instanceIds = flwHisTaskList.stream().map(FlwTask::getInstanceId) .map(String::valueOf).collect(Collectors.toList()); //分页查询任务中心任务 // LambdaQueryWrapper<StateTaskCenter> stateTaskQuery = new LambdaQueryWrapper<>(); // if (ObjectUtil.isNotEmpty(processTaskListBO.getName())) { // stateTaskQuery.like(StateTaskCenter::getName, processTaskListBO.getName()); // } // if (ObjectUtil.isNotEmpty(processTaskListBO.getModuleName())) { // stateTaskQuery.like(StateTaskCenter::getModuleName, processTaskListBO.getModuleName()); // } // if (ObjectUtil.isNotEmpty(processTaskListBO.getCreateBy())) { // stateTaskQuery.like(StateTaskCenter::getCreateBy, processTaskListBO.getCreateBy()); // } // if (ObjectUtil.isEmpty(instanceId)) { // return new PageInfo<>(); // } // stateTaskQuery.in(StateTaskCenter::getFlowId, instanceId); // stateTaskQuery.orderByDesc(BaseModel::getCreateTime); processTaskListBO.setInstanceIds(instanceIds); PageInfo<ProcessTaskListVO> processTaskListVOS = stateTaskCenterService.pageList(processTaskListBO); if (ObjectUtil.isEmpty(processTaskListVOS)) { return new PageInfo<>(); } Map<Long, List<FlwHisTask>> flwHisTaskMap = flwHisTaskList.stream().collect(Collectors.groupingBy(FlwHisTask::getInstanceId)); //查询原因 List<String> taskIds = flwHisTaskList.stream().map(FlowEntity::getId).map(String::valueOf).collect(Collectors.toList()); List<StateProcessInstanceAction> actions = stateProcessInstanceActionService.list( Wrappers.<StateProcessInstanceAction>lambdaQuery().in(StateProcessInstanceAction::getNodeId, taskIds)); Map<String, StateProcessInstanceAction> actionMap = actions.stream().collect(Collectors.toMap(StateProcessInstanceAction::getNodeId, Function.identity())); List<String> updateUserId = processTaskListVOS.getRecords().stream().map(ProcessTaskListVO::getCreateBy).collect(Collectors.toList()); Map<Long, SysUser> sysUserMap; if (!CollectionUtils.isEmpty(updateUserId)) { List<SysUser> sysUsers = sysUserService.selectUserByUserNameList(updateUserId); if (!CollectionUtils.isEmpty(sysUsers)) { sysUserMap = sysUsers.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity())); } else { sysUserMap = new HashMap<>(); } } else { sysUserMap = new HashMap<>(); } for (ProcessTaskListVO processTaskListVO : processTaskListVOS.getRecords()) { List<FlwHisTask> flwHisTasks = flwHisTaskMap.get(NumberUtil.parseLong(processTaskListVO.getFlowId())); if (ObjectUtil.isNotEmpty(flwHisTaskMap)) { //当某个用户在同一个模块审批流的多个节点都存在时,多次审核后,已审核列表页报错 for (FlwHisTask flwHisTask : flwHisTasks) { if (flwHisTask.getInstanceId().toString().equals(processTaskListVO.getFlowId())) { //10等于发起人与审批人一致自动审核完成 processTaskListVO.setStatus(flwHisTask.getTaskState() == 10 ? "2" : flwHisTask.getTaskState().toString()); processTaskListVO.setNodeName(flwHisTask.getTaskName()); processTaskListVO.setTaskId(flwHisTask.getId().toString()); processTaskListVO.setVariable(flwHisTask.getVariable()); } } } StateProcessInstanceAction action = actionMap.get(processTaskListVO.getTaskId()); if (ObjectUtil.isNotEmpty(action)) { processTaskListVO.setReason(action.getRemark()); } SysUser sysUser = sysUserMap.get(processTaskListVO.getCreateBy()); if (Objects.nonNull(sysUser)) { processTaskListVO.setCreateBy(sysUser.getNickName()); } } return processTaskListVOS; } @Override public PageInfo<ProcessTaskListVO> dealTaskPageApplet(ProcessTaskListBO processTaskListBO) { String startTime = null; String endTime = null; if(Objects.nonNull(processTaskListBO.getTimeType())){ switch (processTaskListBO.getTimeType()){ case 1: startTime = DateUtil.format(DateUtil.offsetDay(new Date(), -1), "yyyy-MM-dd") + " 00:00:00"; endTime = DateUtil.format(DateUtil.offsetDay(new Date(), -1), "yyyy-MM-dd") + " 23:59:59"; break; case 2: startTime = DateUtil.format(DateUtil.offsetDay(new Date(), -7), "yyyy-MM-dd") + " 00:00:00"; endTime = DateUtil.format(DateUtil.offsetDay(new Date(), -1), "yyyy-MM-dd") + " 23:59:59"; break; case 3: startTime = DateUtil.format(DateUtil.offsetDay(new Date(), -30), "yyyy-MM-dd") + " 00:00:00"; endTime = DateUtil.format(DateUtil.offsetDay(new Date(), -1), "yyyy-MM-dd") + " 23:59:59"; break; } } //获取当前登录用户信息 Long userId = SecurityUtils.getLoginUser().getUserId(); LambdaQueryWrapper<FlwHisTaskActor> query = Wrappers.<FlwHisTaskActor>lambdaQuery() .and(qy -> qy.eq(FlwTaskActor::getActorId, userId) //0指定用户 .eq(FlwTaskActor::getActorType, 0) //指定角色 .or().in(FlwTaskActor::getActorId, userId) .eq(FlwTaskActor::getActorType, 1)); List<FlwHisTaskActor> flwHisTaskActors = flwHisTaskActorMapper.selectList(query); List<Long> hisTaskIds = flwHisTaskActors.stream().map(FlwTaskActor::getTaskId).collect(Collectors.toList()); if (hisTaskIds.isEmpty()) { return new PageInfo<>(); } List<FlwHisTask> flwHisTaskList = flwHisTaskMapper.selectList( Wrappers.<FlwHisTask>lambdaQuery() .notIn(FlwHisTask::getTaskType, TaskType.cc.getValue(), TaskType.major.getValue()) .orderByDesc(FlwHisTask::getCreateTime) .in(FlwHisTask::getId, hisTaskIds)); if (ObjectUtil.isEmpty(flwHisTaskList)) { new PageInfo<>(); } List<String> instanceId = flwHisTaskList.stream().map(FlwTask::getInstanceId) .map(String::valueOf).collect(Collectors.toList()); //分页查询任务中心任务 @@ -445,8 +791,19 @@ if (ObjectUtil.isEmpty(instanceId)) { return new PageInfo<>(); } if (ObjectUtil.isNotEmpty(startTime) && ObjectUtil.isNotEmpty(endTime)) { stateTaskQuery.between(StateTaskCenter::getCreateTime, startTime, endTime); } if(Objects.isNull(processTaskListBO.getSortBy())){ processTaskListBO.setSortBy(2); } if (processTaskListBO.getSortBy() == 1) { stateTaskQuery.orderByAsc(BaseModel::getCreateTime); } if (processTaskListBO.getSortBy() == 2) { stateTaskQuery.orderByDesc(BaseModel::getCreateTime); } stateTaskQuery.in(StateTaskCenter::getFlowId, instanceId); stateTaskQuery.orderByDesc(BaseModel::getCreateTime); PageInfo pageInfo = new PageInfo<>(processTaskListBO.getPageNum(), processTaskListBO.getPageSize()); PageInfo<StateTaskCenter> taskCenters = stateTaskCenterService.page(pageInfo,stateTaskQuery); //转换类 @@ -455,7 +812,7 @@ // 查询合同信息 for (ProcessTaskListVO processTaskListVO : processTaskListVOS) { // 查询合同信息 TContract contract = contractService.getById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); TContract contract = contractMapper.selectById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); processTaskListVO.setContract(contract); } @@ -623,15 +980,21 @@ if (ObjectUtil.isNull(flwTask)) { throw new GlobalException("任务已处理或者不存在"); } flowLongEngine.executeTask(taskId, currentFlowCreator()); // 动作执行记录 StateProcessInstanceAction stateProcessInstanceAction = new StateProcessInstanceAction(); if(Objects.nonNull(processAgreeBO.getUserId())){ flowLongEngine.executeTask(taskId, currentFlowCreator(processAgreeBO.getUserId())); stateProcessInstanceAction.setAuditorId(String.valueOf(processAgreeBO.getUserId())); }else { stateProcessInstanceAction.setAuditorId(String.valueOf(SecurityUtils.getUserId())); flowLongEngine.executeTask(taskId, currentFlowCreator()); } // 动作执行记录 stateProcessInstanceAction.setId(IdUtils.simpleUUID()); stateProcessInstanceAction.setInstanceId(flwTask.getInstanceId().toString()); stateProcessInstanceAction.setAuditorId(String.valueOf(SecurityUtils.getUserId())); stateProcessInstanceAction.setActionType(StateProcessActionEnum.APPROVED.getValue()); stateProcessInstanceAction.setNodeId(processAgreeBO.getTaskId()); stateProcessInstanceAction.setRemark(processAgreeBO.getRemark()); stateProcessInstanceAction.setPictures(processAgreeBO.getPictures()); stateProcessInstanceActionService.save(stateProcessInstanceAction); } @@ -649,7 +1012,13 @@ record.setActionType(StateProcessActionEnum.REJECTED.getValue()); record.setNodeId(processRefuseBO.getTaskId()); record.setRemark(processRefuseBO.getRemark()); record.setPictures(processRefuseBO.getPictures()); stateProcessInstanceActionService.save(record); } @Override public void revoke(Long instanceId) { FlowCreator flowCreator = FlowCreator.of(String.valueOf(SecurityUtils.getUserId()), SecurityUtils.getLoginUser().getUser().getNickName()); flowLongEngine.runtimeService().revoke(instanceId, flowCreator); } @Override @@ -759,19 +1128,251 @@ return processTaskListVOS; } // @Override // public PageInfo<ProcessTaskListVO> dealAndWaitTaskPage(ProcessTaskListBO processTaskListBO) { // //获取当前登录用户信息 // Long userId = SecurityUtils.getLoginUser().getUserId(); // // //或签时查询其他审批人是否通过(不能省略),比如 同一任务需要A,B审核,A通过了,B不用在审核了,在历史表查询A的审核记录 // LambdaQueryWrapper<FlwHisInstance> lambdaQueryWrapper = new LambdaQueryWrapper<>(); // lambdaQueryWrapper.orderByDesc(FlowEntity::getCreateTime); // //待审核,通过,拒绝 // lambdaQueryWrapper.in(FlwHisInstance::getInstanceState, 0,1,2); // // List<Long> flwHisInstances = flwHisInstanceMapper.selectList(lambdaQueryWrapper).stream() // .map(FlwHisInstance::getId).collect(Collectors.toList()); // // //查询任务参与者 // LambdaQueryWrapper<FlwTaskActor> query = new LambdaQueryWrapper<>(); // query.and(qy -> qy.eq(FlwTaskActor::getActorId, userId) // //0指定用户 // .eq(FlwTaskActor::getActorType, 0) // .or().in(FlwTaskActor::getActorId, userId) // //1指定角色 // .eq(FlwTaskActor::getActorType, 1)); // if (ObjectUtil.isNotNull(processTaskListBO) && ObjectUtil.isNotNull(flwHisInstances)) { // // 添加条件 // query = query.in(FlwTaskActor::getInstanceId, flwHisInstances); // } // List<FlwTaskActor> flwTaskActorPage = flwTaskActorMapper.selectList(query); // List<String> instanceIds = new ArrayList<>(); // List<FlwTask> flwTasks = new ArrayList<>(); // if (ObjectUtil.isNotEmpty(flwTaskActorPage)) { // //查询任务信息 // flwTasks = flwTaskMapper.selectList(Wrappers.<FlwTask>lambdaQuery() // .orderByDesc(FlwTask::getCreateTime) // .in(FlwTask::getId, flwTaskActorPage.stream() // .map(FlwTaskActor::getTaskId).collect(Collectors.toList()))); // if (ObjectUtil.isNotNull(flwTasks)) { // instanceIds = flwTasks.stream().map(FlwTask::getInstanceId) // .map(String::valueOf).collect(Collectors.toList()); // } // } // // LambdaQueryWrapper<FlwHisTaskActor> hisQuery= Wrappers.<FlwHisTaskActor>lambdaQuery() // .and(qy -> qy.eq(FlwTaskActor::getActorId, userId) // //0指定用户 // .eq(FlwTaskActor::getActorType, 0) // //指定角色 // .or().in(FlwTaskActor::getActorId, userId) // .eq(FlwTaskActor::getActorType, 1)); // List<FlwHisTaskActor> flwHisTaskActors = flwHisTaskActorMapper.selectList(hisQuery); // List<Long> hisTaskIds = flwHisTaskActors.stream().map(FlwTaskActor::getTaskId).collect(Collectors.toList()); // // if (!CollectionUtils.isEmpty(hisTaskIds)) { // List<FlwHisTask> flwHisTaskList = flwHisTaskMapper.selectList( // Wrappers.<FlwHisTask>lambdaQuery() // .notIn(FlwHisTask::getTaskType, TaskType.cc.getValue(), TaskType.major.getValue()) // .orderByDesc(FlwHisTask::getCreateTime) // .in(FlwHisTask::getId, hisTaskIds)); // if (ObjectUtil.isNotEmpty(flwHisTaskList)) { // instanceIds.addAll(flwHisTaskList.stream().map(FlwHisTask::getInstanceId) // .map(String::valueOf).collect(Collectors.toList())); // } // } // // // //分页查询任务中心任务 //// LambdaQueryWrapper<StateTaskCenter> stateTaskQuery = new LambdaQueryWrapper<>(); //// if (ObjectUtil.isNotEmpty(processTaskListBO.getName())) { //// stateTaskQuery.like(StateTaskCenter::getName, processTaskListBO.getName()); //// } //// if (ObjectUtil.isNotEmpty(processTaskListBO.getModuleName())) { //// stateTaskQuery.like(StateTaskCenter::getModuleName, processTaskListBO.getModuleName()); //// } //// if (ObjectUtil.isNotEmpty(processTaskListBO.getCreateBy())) { //// stateTaskQuery.like(StateTaskCenter::getCreateBy, processTaskListBO.getCreateBy()); //// } //// stateTaskQuery.in(StateTaskCenter::getFlowId, instanceIds); //// stateTaskQuery.orderByDesc(BaseModel::getCreateTime); // processTaskListBO.setInstanceIds(instanceIds); //// PageInfo pageInfo = new PageInfo(processTaskListBO.getPageNum(), processTaskListBO.getPageSize()); //// PageInfo<StateTaskCenter> taskCenters = stateTaskCenterService.page(pageInfo,stateTaskQuery); //// //转换类 //// List<ProcessTaskListVO> processTaskListVOS = BeanUtil.copyToList(taskCenters.getRecords(), ProcessTaskListVO.class); //// // 查询合同信息 //// for (ProcessTaskListVO processTaskListVO : processTaskListVOS) { //// // 查询合同信息 //// TContract contract = contractService.getById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); //// processTaskListVO.setContract(contract); //// } //// pageInfo.setRecords(processTaskListVOS); // // PageInfo<ProcessTaskListVO> processTaskListVOS = stateTaskCenterService.pageList(processTaskListBO); // // List<String> updateUserId = processTaskListVOS.getRecords().stream().map(ProcessTaskListVO::getCreateBy).collect(Collectors.toList()); // Map<Long, SysUser> sysUserMap; // if (!CollectionUtils.isEmpty(updateUserId)) { // //根据用户id查询更新人信息 // List<SysUser> sysUsers = sysUserService.selectUserByUserNameList(updateUserId); // // if (!CollectionUtils.isEmpty(sysUsers)) { // sysUserMap = sysUsers.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity())); // } else { // sysUserMap = new HashMap<>(); // } // } else { // sysUserMap = new HashMap<>(); // } // // Map<Long, List<FlwTask>> flwHisTaskMap = new HashMap<>(); // if(!CollectionUtils.isEmpty(flwTasks)){ // flwHisTaskMap = flwTasks.stream().collect(Collectors.groupingBy(FlwTask::getInstanceId)); // } // // for (ProcessTaskListVO processTaskListVO : processTaskListVOS.getRecords()) { // if(!CollectionUtils.isEmpty(flwHisTaskMap)){ // List<FlwTask> flwTask = flwHisTaskMap.get(NumberUtil.parseLong(processTaskListVO.getFlowId())); // if (!CollectionUtils.isEmpty(flwTask) && ObjectUtil.isNotEmpty(flwTask.get(0))) { // //待审核 // processTaskListVO.setStatus("0"); // processTaskListVO.setNodeName(flwTask.get(0).getTaskName()); // processTaskListVO.setTaskId(flwTask.get(0).getId().toString()); // processTaskListVO.setVariable(flwTask.get(0).getVariable()); // } // } // SysUser sysUser = sysUserMap.get(processTaskListVO.getCreateBy()); // if (Objects.nonNull(sysUser)) { // processTaskListVO.setCreateBy(sysUser.getNickName()); // } // } // return processTaskListVOS; // } @Override public ProcessDetailVO detail(String taskId) { ProcessDetailVO processDetailVO = new ProcessDetailVO(); FlwTask flwTask = flwTaskMapper.selectById(Long.valueOf(taskId)); // 查询合同信息 TContract contract = contractService.getById(JSONObject.parseObject(flwTask.getVariable()).getString("projectId")); TContract contract; Long instanceId; if(Objects.nonNull(flwTask)){ instanceId = flwTask.getInstanceId(); // 查询合同信息 contract = contractMapper.selectById(JSONObject.parseObject(flwTask.getVariable()).getString("projectId")); }else { FlwHisTask flwHisTask = flwHisTaskMapper.selectById(Long.valueOf(taskId)); if(Objects.isNull(flwHisTask)){ throw new GlobalException("流程不存在"); } instanceId = flwHisTask.getInstanceId(); contract = contractMapper.selectById(Objects.requireNonNull(JSONObject.parseObject(flwHisTask.getVariable())).getString("projectId")); } BeanUtil.copyProperties(contract, processDetailVO); List<StateProcessInstanceAction> list = stateProcessInstanceActionService.list(Wrappers.<StateProcessInstanceAction>lambdaQuery().eq(StateProcessInstanceAction::getInstanceId, flwTask.getInstanceId()) .orderByDesc(StateProcessInstanceAction::getCreateTime)); // 查询历史任务 List<FlwHisTask> flwHisTasks = flwHisTaskMapper.selectList(Wrappers.<FlwHisTask>lambdaQuery().eq(FlwHisTask::getInstanceId, instanceId)); processDetailVO.setFlwHisTasks(flwHisTasks); List<StateProcessInstanceAction> list = stateProcessInstanceActionService.list(Wrappers.<StateProcessInstanceAction>lambdaQuery().eq(StateProcessInstanceAction::getInstanceId, instanceId) .orderByAsc(StateProcessInstanceAction::getCreateTime)); for (StateProcessInstanceAction stateProcessInstanceAction : list) { SysUser sysUser = sysUserService.selectUserById(Long.valueOf(stateProcessInstanceAction.getAuditorId())); if(Objects.nonNull(sysUser)){ stateProcessInstanceAction.setNickName(sysUser.getNickName()); } } processDetailVO.setInstanceActions(list); return processDetailVO; } @Override public PageInfo<ProcessTaskListVO> initiateTaskPage(ProcessTaskListBO processTaskListBO) { String startTime = null; String endTime = null; if(Objects.nonNull(processTaskListBO.getTimeType())){ switch (processTaskListBO.getTimeType()){ case 1: startTime = DateUtil.format(DateUtil.offsetDay(new Date(), -1), "yyyy-MM-dd") + " 00:00:00"; endTime = DateUtil.format(DateUtil.offsetDay(new Date(), -1), "yyyy-MM-dd") + " 23:59:59"; break; case 2: startTime = DateUtil.format(DateUtil.offsetDay(new Date(), -7), "yyyy-MM-dd") + " 00:00:00"; endTime = DateUtil.format(DateUtil.offsetDay(new Date(), -1), "yyyy-MM-dd") + " 23:59:59"; break; case 3: startTime = DateUtil.format(DateUtil.offsetDay(new Date(), -30), "yyyy-MM-dd") + " 00:00:00"; endTime = DateUtil.format(DateUtil.offsetDay(new Date(), -1), "yyyy-MM-dd") + " 23:59:59"; break; } } //获取当前登录用户信息 Long userId = SecurityUtils.getLoginUser().getUserId(); //分页查询任务中心任务 LambdaQueryWrapper<FlwHisTask> stateTaskQuery = new LambdaQueryWrapper<>(); if (ObjectUtil.isNotEmpty(startTime) && ObjectUtil.isNotEmpty(endTime)) { stateTaskQuery.between(FlwHisTask::getCreateTime, startTime, endTime); } if(Objects.isNull(processTaskListBO.getSortBy())){ processTaskListBO.setSortBy(2); } if (processTaskListBO.getSortBy() == 1) { stateTaskQuery.orderByAsc(FlwHisTask::getCreateTime); } if (processTaskListBO.getSortBy() == 2) { stateTaskQuery.orderByDesc(FlwHisTask::getCreateTime); } stateTaskQuery.eq(FlwHisTask::getParentTaskId, 0L); stateTaskQuery.like(FlwHisTask::getCreateId, userId); PageInfo pageInfo = new PageInfo<>(processTaskListBO.getPageNum(), processTaskListBO.getPageSize()); PageInfo<FlwHisTask> taskCenters = flwHisTaskMapper.selectPage(pageInfo,stateTaskQuery); //转换类 List<ProcessTaskListVO> processTaskListVOS = BeanUtil.copyToList(taskCenters.getRecords(), ProcessTaskListVO.class); // 查询合同信息 for (ProcessTaskListVO processTaskListVO : processTaskListVOS) { // 查询合同信息 TContract contract = contractMapper.selectById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); processTaskListVO.setContract(contract); } if (ObjectUtil.isEmpty(processTaskListVOS)) { return pageInfo; } List<String> updateUserId = processTaskListVOS.stream().map(ProcessTaskListVO::getCreateBy).collect(Collectors.toList()); Map<Long, SysUser> sysUserMap; if (!CollectionUtils.isEmpty(updateUserId)) { List<SysUser> sysUsers = sysUserService.selectUserByUserNameList(updateUserId); if (!CollectionUtils.isEmpty(sysUsers)) { sysUserMap = sysUsers.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity())); } else { sysUserMap = new HashMap<>(); } } else { sysUserMap = new HashMap<>(); } for (ProcessTaskListVO processTaskListVO : processTaskListVOS) { processTaskListVO.setTaskId(processTaskListVO.getId()); SysUser sysUser = sysUserMap.get(processTaskListVO.getCreateBy()); if (Objects.nonNull(sysUser)) { processTaskListVO.setCreateBy(sysUser.getNickName()); } } pageInfo.setRecords(processTaskListVOS); return pageInfo; } private FlowCreator currentFlowCreator() { @@ -781,5 +1382,12 @@ } return FlowCreator.of(String.valueOf(loginUser.getUserId()), loginUser.getUser().getNickName()); } private FlowCreator currentFlowCreator(Long userId) { if (null == userId) { throw new GlobalException("非法用户"); } SysUser sysUser = sysUserService.selectUserById(userId); return FlowCreator.of(String.valueOf(sysUser.getUserId()), sysUser.getNickName()); } } ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -61,6 +61,8 @@ @Autowired private SysUserPostMapper userPostMapper; @Autowired private TDeptToUserService deptToUserService; @Autowired private TDeptToUserMapper deptToUserMapper; @Autowired @@ -495,7 +497,7 @@ deptToUser.setDeptId(deptId); deptToUserList.add(deptToUser); } userRoleMapper.insertBatchUserDept(deptToUserList); deptToUserService.saveBatch(deptToUserList); } } @@ -670,11 +672,12 @@ List<Long> userIds = list.stream().map(SysUserVO::getUserId).collect(Collectors.toList()); // 查询所有部门 List<TDept> depts = deptMapper.selectList(Wrappers.lambdaQuery(TDept.class)); List<TDeptToUser> tDeptToUsers = deptToUserMapper.selectList(Wrappers.lambdaQuery(TDeptToUser.class) List<TDeptToUser> tDeptToUsers = deptToUserService.list(Wrappers.lambdaQuery(TDeptToUser.class) .in(TDeptToUser::getUserId, userIds)); for (SysUserVO sysUserVO : list) { tDeptToUsers.stream().filter(tDeptToUser -> tDeptToUser.getUserId().equals(sysUserVO.getUserId())).forEach(tDeptToUser -> { sysUserVO.setDeptList(depts.stream().filter(tDept -> tDept.getId().equals(tDeptToUser.getDeptId())).map(TDept::getDeptName).collect(Collectors.toList())); sysUserVO.setDeptIds(depts.stream().map(TDept::getId).filter(id -> id.equals(tDeptToUser.getDeptId())).collect(Collectors.toList())); }); } pageInfo.setRecords(list); ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.config.SmsProperties; import com.ruoyi.common.constant.AmountConstant; import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.core.redis.RedisCache; ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TContractServiceImpl.java
@@ -1,12 +1,16 @@ package com.ruoyi.system.service.impl; import com.aizuda.bpm.engine.entity.FlwHisTask; import com.aizuda.bpm.mybatisplus.mapper.FlwHisTaskMapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.constant.DictConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.enums.ProcessCategoryEnum; import com.ruoyi.common.utils.DictUtils; import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.system.bo.ProcessStartBO; import com.ruoyi.system.dto.SignContractDTO; import com.ruoyi.system.dto.TerminateContractDTO; import com.ruoyi.system.mapper.TBillMapper; @@ -17,6 +21,7 @@ import com.ruoyi.system.query.TContractAppletQuery; import com.ruoyi.system.query.TContractBillQuery; import com.ruoyi.system.query.TContractQuery; import com.ruoyi.system.service.StateProcessTemplateService; import com.ruoyi.system.service.TBillService; import com.ruoyi.system.service.TContractRentTypeService; import com.ruoyi.system.service.TContractService; @@ -25,6 +30,7 @@ import com.ruoyi.system.vo.CheckAcceptRecordVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.math.BigDecimal; @@ -32,9 +38,8 @@ import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.time.temporal.TemporalAdjusters; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.*; import java.util.stream.Collectors; /** * <p> @@ -56,6 +61,10 @@ private TBillService billService; @Resource private TContractMapper contractMapper; @Autowired private StateProcessTemplateService stateProcessTemplateService; @Autowired private FlwHisTaskMapper flwHisTaskMapper; @Override public PageInfo<TContract> contractList(TContractQuery query) { @@ -77,6 +86,12 @@ for (TContract tContract : list) { tContract.setPayType(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_PAY_TYPE,tContract.getPayType())); tContract.setStatus(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_STATUS,tContract.getStatus())); FlwHisTask flwHisTask = flwHisTaskMapper.selectOne(new LambdaQueryWrapper<FlwHisTask>() .like(FlwHisTask::getVariable, tContract.getId()) .last("LIMIT 1")); if (Objects.nonNull(flwHisTask)){ tContract.setInstanceId(flwHisTask.getInstanceId()); } } pageInfo.setRecords(list); return pageInfo; @@ -101,6 +116,19 @@ contract.setTerminateRemark(dto.getTerminateRemark()); contract.setStatus("4"); this.baseMapper.updateById(contract); // 进入合同提前终止审批流程 ProcessStartBO processStartBO = new ProcessStartBO(); processStartBO.setCategory(ProcessCategoryEnum.CATEGORY3.getValue().toString()); processStartBO.setModuleName("合同提前终止审批"); processStartBO.setName(contract.getContractName()); processStartBO.setRemark(""); Map<String, Object> variable = new HashMap<>(); variable.put("projectId", dto.getId()); processStartBO.setVariable(variable); //开启工作流程 stateProcessTemplateService.start(processStartBO); // 生成验收记录 TCheckAcceptRecord tCheckAcceptRecord = new TCheckAcceptRecord(); tCheckAcceptRecord.setContractId(dto.getId()); @@ -158,8 +186,17 @@ contract.setFirstPayTime(contract.getStartTime().plusDays(10)); contractMapper.updateById(contract); // TODO 进入签订审批流程 // 进入签订审批流程 ProcessStartBO processStartBO = new ProcessStartBO(); processStartBO.setCategory(ProcessCategoryEnum.CATEGORY2.getValue().toString()); processStartBO.setModuleName("合同签订审批"); processStartBO.setName(contract.getContractName()); processStartBO.setRemark(""); Map<String, Object> variable = new HashMap<>(); variable.put("projectId", dto.getId()); processStartBO.setVariable(variable); //开启工作流程 stateProcessTemplateService.startApplet(processStartBO); List<TContractRentType> contractRentTypes = contractRentTypeService.list(); // 生成第一笔账单 @@ -169,11 +206,8 @@ rentBill.setContractId(contract.getId()); rentBill.setContractNumber(contract.getContractNumber()); rentBill.setPayableFeesTime(firstPayTime.toLocalDate()); if (firstPayTime.toLocalDate().equals(LocalDate.now())){ rentBill.setPayFeesStatus("1"); }else { rentBill.setPayFeesStatus("2"); } rentBill.setPayFeesStatus("1"); rentBill.setBillType("1"); rentBill.setStartTime(contract.getStartPayTime()); TContractRentType tContractRentType = contractRentTypes.stream().filter(e -> e.getContractId().equals(contract.getId())).findFirst().orElse(null); @@ -226,12 +260,15 @@ } }else{ if (contract.getFirstPayTime().plusMonths(contract.getPayType().equals("1")? 1:contract.getPayType().equals("2")? 3:12).isAfter(contract.getEndTime())){ rentBill.setEndTime(contract.getFirstPayTime().plusMonths(contract.getPayType().equals("1")? 1:contract.getPayType().equals("2")? 3:12)); }else{ rentBill.setEndTime(contract.getEndTime()); }else{ LocalDateTime firstPayTime1 = contract.getFirstPayTime(); // 将firstPayTime1的日设置为当月最后一天 rentBill.setEndTime(firstPayTime1.with(TemporalAdjusters.lastDayOfMonth())); } // 不走递增递减 long allDays = ChronoUnit.DAYS.between(contract.getFirstPayTime(), rentBill.getEndTime()); long allDays = ChronoUnit.DAYS.between(contract.getStartPayTime().minusDays(1), rentBill.getEndTime()); rentBill.setPayableFeesMoney(contract.getMonthRent().divide(new BigDecimal(30), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(allDays))); rentBill.setOutstandingMoney(rentBill.getPayableFeesMoney()); @@ -245,13 +282,10 @@ depositBill.setStartTime(contract.getStartPayTime()); depositBill.setEndTime(contract.getEndTime()); depositBill.setPayableFeesTime(firstPayTime.toLocalDate()); if (firstPayTime.toLocalDate().equals(LocalDate.now())){ depositBill.setPayFeesStatus("1"); }else { depositBill.setPayFeesStatus("2"); depositBill.setPayFeesStatus("1"); } depositBill.setBillType("2"); this.updateById(contract); billService.save(rentBill); @@ -264,7 +298,6 @@ while(beforeBill.getEndTime().plusMonths(contract.getPayType().equals("1")? 1:contract.getPayType().equals("2")? 3:12).isBefore(contract.getEndTime())){ TBill tBill = new TBill(); tBill.setContractId(contract.getId()); tBill.setContractNumber(contract.getContractNumber()); @@ -419,10 +452,8 @@ } }else{ long allDays = ChronoUnit.DAYS.between(beforeBill.getEndTime(), (contract.getPayType().equals("1")? beforeBill.getEndTime().plusMonths(1):contract.getPayType().equals("2")? beforeBill.getEndTime().plusMonths(3):beforeBill.getEndTime().plusMonths(12)).with(TemporalAdjusters.lastDayOfMonth())); tBill.setPayableFeesMoney(contract.getMonthRent().divide(new BigDecimal(30), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(allDays))); tBill.setPayableFeesMoney(contract.getMonthRent()); tBill.setOutstandingMoney(tBill.getPayableFeesMoney()); } @@ -434,27 +465,23 @@ beforeBill.getEndTime().plusMonths(1).withDayOfMonth(15).toLocalDate():contract.getPayType().equals("2")? beforeBill.getEndTime().plusMonths(3).withDayOfMonth(15).toLocalDate():beforeBill.getEndTime().withDayOfMonth(15).plusMonths(12).toLocalDate())); } tBill.setPayFeesStatus("2"); tBill.setPayFeesStatus("1"); tBill.setBillType("1"); tBill.setStartTime(beforeBill.getEndTime().plusDays(1)); tBill.setEndTime(contract.getEndTime()); tBill.setEndTime(beforeBill.getEndTime().plusMonths(contract.getPayType().equals("1")? 1:contract.getPayType().equals("2")? 3:12).with(TemporalAdjusters.lastDayOfMonth())); billMapper.insert(tBill); } billMapper.insert(tBill); } beforeBill.setEndTime(beforeBill.getEndTime().plusMonths(contract.getPayType().equals("1")? 1:contract.getPayType().equals("2")? 3:12).with(TemporalAdjusters.lastDayOfMonth())); } } } catch (Exception e) { e.printStackTrace(); } TBill beforeBill = billService.lambdaQuery().eq(TBill::getContractId, contract.getId()).eq(TBill::getBillType, 1).orderByDesc(TBill::getCreateTime) TBill beforeBill = billService.lambdaQuery().eq(TBill::getContractId, contract.getId()).eq(TBill::getBillType, 1).orderByDesc(TBill::getStartTime) .last("limit 1").one(); // 生成最后一笔账单 if (!(beforeBill.getEndTime().toLocalDate().equals(contract.getEndTime().toLocalDate())) && (contract.getPayType().equals("1")? beforeBill.getEndTime().plusMonths(1):contract.getPayType().equals("2")? beforeBill.getEndTime().plusMonths(3):beforeBill.getEndTime().plusMonths(12)) .with(TemporalAdjusters.lastDayOfMonth()).isAfter(contract.getEndTime()) && beforeBill.getEndTime().isBefore(contract.getEndTime()) ){ TBill tBill = new TBill(); @@ -614,7 +641,7 @@ } tBill.setContractNumber(contract.getContractNumber()); if (beforeBill.getEndTime().plusMonths(contract.getPayType().equals("1")? 1:contract.getPayType().equals("2")? 3:12).getDayOfMonth()<=15){ if (contract.getEndTime().getDayOfMonth()<=15){ tBill.setPayableFeesTime(contract.getEndTime().withHour(0).withMinute(0).withSecond(0).toLocalDate()); }else{ tBill.setPayableFeesTime((contract.getPayType().equals("1")? @@ -624,7 +651,7 @@ tBill.setPayFeesStatus("1"); tBill.setBillType("1"); tBill.setStartTime(beforeBill.getEndTime().plusDays(1)); tBill.setEndTime(beforeBill.getEndTime().plusMonths(contract.getPayType().equals("1")? 1:contract.getPayType().equals("2")? 3:12)); tBill.setEndTime(contract.getEndTime()); billService.save(tBill); } ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDeptServiceImpl.java
@@ -2,7 +2,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.mapper.SysMenuMapper; import com.ruoyi.system.model.TDept; import com.ruoyi.system.mapper.TDeptMapper; @@ -12,6 +11,7 @@ import com.ruoyi.system.vo.DeptVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import java.util.List; @@ -30,7 +30,7 @@ private SysMenuMapper sysMenuMapper; @Override public boolean isExit(TDept dto) { if(StringUtils.isNotEmpty(dto.getDeptId())){ if(StringUtils.hasLength(dto.getId())){ // 修改 return this.count(Wrappers.lambdaQuery(TDept.class).ne(TDept::getId, dto.getId()).eq(TDept::getDeptId, dto.getDeptId())) > 0; }else { ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTenantServiceImpl.java
@@ -7,11 +7,13 @@ import com.ruoyi.common.constant.DictConstants; import com.ruoyi.common.utils.DictUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.dto.TTenantDTO; import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.TContractMapper; import com.ruoyi.system.mapper.THouseMapper; import com.ruoyi.system.mapper.TTenantMapper; import com.ruoyi.system.model.TContract; import com.ruoyi.system.model.TDept; import com.ruoyi.system.model.THouse; import com.ruoyi.system.model.TTenant; import com.ruoyi.system.query.TBillAppletQuery; @@ -113,14 +115,20 @@ @Override public PageInfo<TBillVO> listBill(TBillAppletQuery query) { List<String> contractIds = contractMapper.selectList(new LambdaQueryWrapper<TContract>() .eq(TContract::getTenantId, query.getId())).stream().map(TContract::getId) List<TContract> tContracts = contractMapper.selectList(new LambdaQueryWrapper<TContract>() .eq(TContract::getTenantId, query.getId())); List<String> contractIds = tContracts.stream().map(TContract::getId) .collect(Collectors.toList()); if (contractIds.isEmpty())contractIds.add("0"); PageInfo<TBillVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); List<TBillVO> list = this.baseMapper.listBill(query,pageInfo); for (TBillVO tBillVO : list) { tBillVO.setPayFeesStatus(DictUtils.getDictLabel(DictConstants.DICT_TYPE_LEASE_STATUS,tBillVO.getPayFeesStatus())); TContract contract = tContracts.stream().filter(e -> e.getId().equals(tBillVO.getContractId())) .findFirst().orElse(null); if (contract!=null){ tBillVO.setHouse(houseMapper.selectById(contract.getHouseId())); } tBillVO.setPayFeesStatus(tBillVO.getPayFeesStatus()); } pageInfo.setRecords(list); return pageInfo; @@ -133,4 +141,15 @@ pageInfo.setRecords(list); return pageInfo; } @Override public boolean isExit(TTenantDTO dto) { if(StringUtils.isNotEmpty(dto.getId())){ // 修改 return this.count(Wrappers.lambdaQuery(TTenant.class).ne(TTenant::getId, dto.getId()).eq(TTenant::getPhone, dto.getPhone())) > 0; }else { // 新增 return this.count(Wrappers.lambdaQuery(TTenant.class).eq(TTenant::getPhone, dto.getPhone())) > 0; } } } ruoyi-system/src/main/java/com/ruoyi/system/task/base/AbstractJob.java
New file @@ -0,0 +1,37 @@ package com.ruoyi.system.task.base; import com.aizuda.bpm.mybatisplus.mapper.FlwTaskActorMapper; import com.aizuda.bpm.mybatisplus.mapper.FlwTaskMapper; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.utils.SmsUtil; import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.StateProcessTemplateService; import com.ruoyi.system.task.utils.SpringContextsUtil; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public abstract class AbstractJob implements Job{ protected Logger logger = LoggerFactory.getLogger(getClass()); @Override public abstract void execute(JobExecutionContext context) throws JobExecutionException; protected StateProcessTemplateService stateProcessTemplateService; protected FlwTaskMapper flwTaskMapper; protected FlwTaskActorMapper flwTaskActorMapper; protected SmsUtil smsUtil; protected ISysUserService sysUserService; public AbstractJob(){ this.stateProcessTemplateService = SpringContextsUtil.getBean(StateProcessTemplateService.class); this.flwTaskMapper = SpringContextsUtil.getBean(FlwTaskMapper.class); this.flwTaskActorMapper = SpringContextsUtil.getBean(FlwTaskActorMapper.class); this.smsUtil = SpringContextsUtil.getBean(SmsUtil.class); this.sysUserService = SpringContextsUtil.getBean(ISysUserService.class); } } ruoyi-system/src/main/java/com/ruoyi/system/task/base/QuartzManager.java
New file @@ -0,0 +1,128 @@ package com.ruoyi.system.task.base; import org.quartz.*; import org.quartz.impl.StdSchedulerFactory; import java.util.Date; import java.util.Map; public class QuartzManager { private static SchedulerFactory factory = new StdSchedulerFactory(); private static final String TRIGGER_NAME_PREFIX = "TRIGGER_PREFIX_"; private static final String JOB_NAME_PREFIX = "JOB_PREFIX_"; /** * 添加定时任务:具体某个时间点执行一次的任务,如:在某个2015-06-01 12:00发送一条消息 * * @param jobName * 具体的任务名+ID标识唯一 * @param jobType * @param date * @param jp */ public synchronized static void addJob(Class<? extends Job> jobClass, String jobName, TimeJobType jobType, Date date, Map<String, ? extends Object> jp) { //logger.debug("ADD JOB {},jobName={},jobTyep={},jobDate={},",jobClass.getName(),jobName,jobType,date); try { Scheduler sched = factory.getScheduler(); JobDetail job = JobBuilder.newJob(jobClass).withIdentity(JOB_NAME_PREFIX + jobName, jobType.getType()) .setJobData(new JobDataMap(jp)).build(); SimpleTrigger trigger = (SimpleTrigger) TriggerBuilder.newTrigger() .withIdentity(TRIGGER_NAME_PREFIX + jobName, jobType.getType()).startAt(date).build(); removeJob(jobName, jobType); sched.scheduleJob(job, trigger); if (!sched.isShutdown()) { sched.start(); } } catch (Exception e) { //logger.error("ADD JOB exception {},jobName={},jobTyep={},jobDate={},",jobClass.getName(),jobName,jobType,date); } } /** * 修改一个任务的触发时间(使用默认的任务组名,触发器名,触发器组名) * @param jobName * @param time */ public synchronized static void modifyJobTime(String jobName,TimeJobType jobType, Date time) { //logger.error("Update JOB exception,jobName={},jobTyep={},jobDate={}," ,jobName,jobType,time); try { JobKey jobKey = new JobKey(JOB_NAME_PREFIX + jobName, jobType.getType()); TriggerKey key = new TriggerKey(TRIGGER_NAME_PREFIX + jobName, jobType.getType()); Scheduler sched = factory.getScheduler(); SimpleTrigger trigger = (SimpleTrigger) sched.getTrigger(key); if(trigger == null) { return; } Date oldTime = trigger.getStartTime(); if (oldTime.getTime() != time.getTime()) { JobDetail jobDetail = sched.getJobDetail(jobKey); Class<? extends Job> objJobClass = jobDetail.getJobClass(); removeJob(jobName,jobType); Map<String, Object> jp = jobDetail.getJobDataMap(); addJob(objJobClass, jobName, jobType, time, jp); } } catch (Exception e) { // logger.error("Update JOB exception,jobName={},jobTyep={},jobDate={}," ,jobName,jobType,time); } } /** * 移除一个任务 * * @param jobName */ public synchronized static void removeJob(String jobName, TimeJobType jobType) { try { JobKey jobKey = new JobKey(JOB_NAME_PREFIX + jobName, jobType.getType()); TriggerKey key = new TriggerKey(TRIGGER_NAME_PREFIX + jobName, jobType.getType()); Scheduler sched = factory.getScheduler(); JobDetail detail = sched.getJobDetail(jobKey); if (detail != null) { sched.pauseJob(jobKey); sched.pauseTrigger(key);// 停止触发器 sched.unscheduleJob(key);// 移除触发器 sched.deleteJob(jobKey);// 删除任务 } } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } /** * 启动所有定时任务 */ public synchronized static void startJobs() { try { Scheduler sched = factory.getScheduler(); sched.start(); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } /** * 关闭所有定时任务 */ public synchronized static void shutdownJobs() { try { Scheduler sched = factory.getScheduler(); if (!sched.isShutdown()) { sched.shutdown(); } } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } } ruoyi-system/src/main/java/com/ruoyi/system/task/base/TimeJobType.java
New file @@ -0,0 +1,28 @@ package com.ruoyi.system.task.base; /** * @Description 按时间点发布的任务类型 * @date 2025年2月17日 下午7:22:28 */ public enum TimeJobType { AUTO_AUDIT("auto_audit","自动审核"); private String type; private String desc; private TimeJobType(String type, String desc) { this.type = type; this.desc = desc; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } } ruoyi-system/src/main/java/com/ruoyi/system/task/exceptions/TimeException.java
New file @@ -0,0 +1,37 @@ package com.ruoyi.system.task.exceptions; /** * @文件说明:定时器任务执行异常 * @版权所有:成都喜来达 * @项目名称: fengsheng * @创建者: Leeyns * @创建日期: 2016年5月18日 * @最近修改者:Leeyns * @最近修改日期:2016年5月18日 */ public class TimeException extends Exception { /** * TODO */ private static final long serialVersionUID = 5703430073981692250L; private String message; public TimeException() { super(); } public TimeException(String message) { super(message); this.message = message; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } } ruoyi-system/src/main/java/com/ruoyi/system/task/jobs/StateProcessJob.java
New file @@ -0,0 +1,49 @@ package com.ruoyi.system.task.jobs; import com.aizuda.bpm.engine.entity.FlwTaskActor; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.system.bo.ProcessAgreeBO; import com.ruoyi.system.task.base.AbstractJob; import org.quartz.JobDataMap; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import java.util.Objects; /** * 发票定时任务 * @author Administrator * */ public class StateProcessJob extends AbstractJob { public static final String name = "stateProcess_"; @Override public void execute(JobExecutionContext context) throws JobExecutionException { JobDataMap maps = context.getMergedJobDataMap(); Long taskId = maps.getLong("id"); try { System.err.println("执行定时任务"); ProcessAgreeBO processAgreeBO = new ProcessAgreeBO(); processAgreeBO.setTaskId(String.valueOf(taskId)); FlwTaskActor flwTaskActor = flwTaskActorMapper.selectOne(Wrappers.lambdaQuery(FlwTaskActor.class).eq(FlwTaskActor::getTaskId, taskId).last("LIMIT 1")); if(Objects.isNull(flwTaskActor)){ System.err.println("该任务不存在"); return; } processAgreeBO.setRemark("自动审批"); processAgreeBO.setUserId(Long.valueOf(flwTaskActor.getActorId())); stateProcessTemplateService.agree(processAgreeBO); // 短信发送 SysUser sysUser = sysUserService.selectUserById(Long.valueOf(flwTaskActor.getActorId())); smsUtil.sendSms(sysUser.getPhonenumber(), "2369951", new String[]{""}); }catch(Exception e){ e.printStackTrace(); } } } ruoyi-system/src/main/java/com/ruoyi/system/task/utils/SpringContextsUtil.java
New file @@ -0,0 +1,37 @@ package com.ruoyi.system.task.utils; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; @Component public class SpringContextsUtil implements ApplicationContextAware{ private static ApplicationContext applicationContext; @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { if (SpringContextsUtil.applicationContext == null) { SpringContextsUtil.applicationContext = applicationContext; } } // 获取applicationContext public static ApplicationContext getApplicationContext() { return applicationContext; } // 通过name获取 Bean. public static Object getBean(String name) { return getApplicationContext().getBean(name); } // 通过class获取Bean. public static <T> T getBean(Class<T> clazz) { return getApplicationContext().getBean(clazz); } // 通过name,以及Clazz返回指定的Bean public static <T> T getBean(String name, Class<T> clazz) { System.out.println(getApplicationContext().getBean(name, clazz)); return getApplicationContext().getBean(name, clazz); } } ruoyi-system/src/main/java/com/ruoyi/system/vo/ProcessDetailVO.java
@@ -1,5 +1,6 @@ package com.ruoyi.system.vo; import com.aizuda.bpm.engine.entity.FlwHisTask; import com.ruoyi.system.model.StateProcessInstanceAction; import com.ruoyi.system.model.TContract; import io.swagger.annotations.ApiModel; @@ -14,4 +15,7 @@ @ApiModelProperty(value = "操作记录集合") private List<StateProcessInstanceAction> instanceActions; @ApiModelProperty(value = "历史任务") private List<FlwHisTask> flwHisTasks; } ruoyi-system/src/main/java/com/ruoyi/system/vo/ProcessTaskListVO.java
@@ -19,6 +19,7 @@ public class ProcessTaskListVO { private String nodeName; private String id; private String flowId; ruoyi-system/src/main/java/com/ruoyi/system/vo/TBillVO.java
@@ -37,9 +37,9 @@ @ApiModelProperty(value = "甲方联系方式") private String partyOnePhone; @ApiModelProperty(value = "合同开始时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private LocalDateTime concatStartTime; @ApiModelProperty(value = "合同结束时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private LocalDateTime concatEndTime; } ruoyi-system/src/main/resources/mapper/system/StateProcessInstanceActionMapper.xml
New file @@ -0,0 +1,24 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ruoyi.system.mapper.StateProcessInstanceActionMapper"> <insert id="saveData"> insert into state_process_instance_action( id, instance_id, auditor_id, action_type, node_id, remark, pictures values (#{id}, #{instanceId}, #{auditorId}, #{actionType}, #{nodeId}, #{remark}, #{pictures}) </insert> </mapper> ruoyi-system/src/main/resources/mapper/system/StateTaskCenterMapper.xml
@@ -52,7 +52,7 @@ AND tc.contract_name like concat('%',#{query.contractName},'%') </if> <if test="query.status != null and query.status !=''"> AND tc.status like concat('%',#{query.status},'%') AND tc.status = #{query.status} </if> AND tc.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} </where> ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -221,21 +221,17 @@ select * from sys_user </select> <select id="pageList" resultType="com.ruoyi.system.vo.SysUserVO"> select u.user_id AS userId, u.dept_id AS deptId, u.user_name AS userName, u.nick_name AS nickName, u.email AS email, u.avatar AS avatar, u.phonenumber AS phonenumber, u.sex AS sex, u.status AS status, u.del_flag AS delFlag, u.login_ip AS loginIp, select u.user_id AS userId, u.dept_id AS deptId, u.user_name AS userName, u.nick_name AS nickName, u.email AS email, u.avatar AS avatar,u.disable_remark AS disableRemark, u.phonenumber AS phonenumber, u.sex AS sex, u.status AS status, u.del_flag AS delFlag, u.login_ip AS loginIp,u.operating_time AS operatingTime,u.operating_person AS operatingPerson, u.login_date AS loginDate, u.create_by AS createBy, u.create_time AS createTime, u.remark AS remark,u.ifBlack AS ifBlack, u.districtId AS districtId, r.role_id AS roleId, r.role_name AS roleName, r.role_key AS roleKey, r.role_sort AS roleSort, r.data_scope AS dataScope, r.status as role_status,u.deptName as deptName from sys_user u left join sys_user_role ur on u.user_id = ur.user_id left join sys_role r on r.role_id = ur.role_id left join t_dept_to_user tdtu on u.user_id = tdtu.user_id WHERE u.del_flag = 0 <if test="query.nickNameAndPhone != null and query.nickNameAndPhone != ''"> AND (u.nick_name LIKE concat('%',#{query.nickNameAndPhone},'%') OR u.phonenumber LIKE concat('%',#{query.nickNameAndPhone},'%')) </if> <if test="query.roleId != null"> AND r.role_id = #{query.roleId} <if test="query.nickNameOrPhone != null and query.nickNameOrPhone != ''"> AND (u.nick_name LIKE concat('%',#{query.nickNameOrPhone},'%') OR u.phonenumber LIKE concat('%',#{query.nickNameOrPhone},'%')) </if> <if test="query.status != null and query.status != ''"> AND u.status = #{query.status} @@ -245,6 +241,12 @@ <foreach collection="query.deptIds" close=")" open="(" item="deptId" separator=","> #{deptId} </foreach>) </if> <if test="query.roleIds != null and query.roleIds.size()>0"> AND r.role_id IN <foreach collection="query.roleIds" close=")" open="(" item="roleId" separator=","> #{roleId} </foreach> </if> ORDER BY u.create_time DESC </select> @@ -310,6 +312,9 @@ <if test="remark != null">remark = #{remark},</if> <if test="ifBlack != null">ifBlack = #{ifBlack},</if> <if test="districtId != null">districtId = #{districtId},</if> <if test="disableRemark != null">disable_remark = #{disableRemark},</if> <if test="operatingTime != null">operating_time = #{operatingTime},</if> <if test="operatingPerson != null">operating_person = #{operatingPerson},</if> update_time = sysdate() </set> where user_id = #{userId} ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
@@ -34,7 +34,7 @@ insert into sys_user_role(user_id, role_id) values (#{userRole.userId},#{userRole.roleId}) </insert> <insert id="insertBatchUserDept"> insert into sys_user_role(user_id, dept_id) values insert into t_dept_to_user(user_id, dept_id) values <foreach item="item" index="index" collection="deptToUserList" separator=","> (#{item.userId},#{item.deptId}) </foreach> ruoyi-system/src/main/resources/mapper/system/TBillMapper.xml
@@ -95,7 +95,7 @@ </if> and b.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} </where> order by b.payable_fees_time order by b.bill_type,b.payable_fees_time </select> <select id="invoiceList" resultType="com.ruoyi.system.dto.TBillDto"> SELECT ruoyi-system/src/main/resources/mapper/system/TCheckAcceptRecordMapper.xml
@@ -54,7 +54,7 @@ t.update_by, t.disabled, t.code, t.checkMoney, t.check_money, t.status, c.contract_number, h.house_name, ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml
@@ -59,9 +59,12 @@ <if test="query.status != null"> and t1.status = #{query.status} </if> <if test="query.tenantId != null"> and t1.tenant_id = #{query.tenantId} </if> AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} </where> order by t1.create_time desc </select> <select id="contractAppletList" resultType="com.ruoyi.system.model.TContract"> select t1.* from t_contract t1 @@ -96,7 +99,7 @@ #{item} </foreach> </if> <if test="query.ids != null and query.ids.size()=0"> <if test="query.ids == null or query.ids.size()==0"> <if test="query.partyTwoName != null and query.partyTwoName != ''"> and t1.party_two_name like concat('%',#{query.partyTwoName},'%') </if> ruoyi-system/src/main/resources/mapper/system/TDeptToUserMapper.xml
@@ -13,6 +13,12 @@ <sql id="Base_Column_List"> id, dept_id, user_id </sql> <insert id="insertBatchUserDept"> insert into t_dept_to_user (dept_id, user_id) values <foreach collection="deptToUserList" item="item" separator=","> (#{item.deptId},#{item.userId}) </foreach> </insert> <delete id="deleteUserDeptByUserId"> delete from t_dept_to_user where user_id=#{userId} </delete> ruoyi-system/src/main/resources/mapper/system/THouseMapper.xml
@@ -43,6 +43,7 @@ </if> AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} </where> order by t1.create_time desc </select> <select id="userHistoryList" resultType="com.ruoyi.system.vo.HouseVO"> select