| | |
| | | FN_CONTRACT_BILL_FILE(8, "合同账单附件 ", "合同账单附件 "), |
| | | YW_CONTRACT_FILE(9, "合同附件 ", "合同附件 "), |
| | | FN_CONTRACT_REVENUE_FILE(10, "收支流水附件 ", "合同账单附件 "), |
| | | FN_PATROL_TASK_RECORD_FILE(11, "巡检任务点处理附件 ", "巡检任务点处理附件 "), |
| | | |
| | | ; |
| | | // 成员变量 |
| | |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.config.annotation.CloudRequiredPermission; |
| | | import com.doumee.config.annotation.LoginNoRequired; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.model.ApiResponse; |
| | |
| | | return ApiResponse.success(ywContractBillService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("可退款账单") |
| | | @PostMapping("/getCanBackBill") |
| | | @CloudRequiredPermission("business:ywcontractbill:query") |
| | | public ApiResponse<List<YwContractBill>> getCanBackBill (@RequestBody YwContractBill ywContractBill,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywContractBillService.getCanBackBill(ywContractBill)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation("导出Excel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:ywcontractbill:exportExcel") |
| | |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywContractBillService.getDetail(id)); |
| | | } |
| | | |
| | | |
| | | @LoginNoRequired |
| | | @ApiOperation("生成账单编号") |
| | | @GetMapping("/dealDayBillCode") |
| | | public ApiResponse dealDayBillCode() { |
| | | ywContractBillService.dealDayBillCode(); |
| | | return ApiResponse.success("生成成功"); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:ywpatroltaskrecord:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(ywPatrolTaskRecordService.findById(id)); |
| | | return ApiResponse.success(ywPatrolTaskRecordService.getDetail(id)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("巡检点任务数据处理") |
| | | @PostMapping("/patrolData") |
| | | @CloudRequiredPermission("business:ywpatroltaskrecord:update") |
| | | public ApiResponse patrolData(@RequestBody YwPatrolTaskRecord ywPatrolTaskRecord,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ywPatrolTaskRecord.setLoginUserInfo(getLoginUser(token)); |
| | | ywPatrolTaskRecordService.patrolData(ywPatrolTaskRecord); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date planPayDateStart; |
| | | |
| | | @ApiModelProperty(value = "创建人名称") |
| | | @ExcelColumn(name="创建人",index = 9,width = 10) |
| | | @TableField(exist = false) |
| | | private String realname; |
| | | |
| | | @ApiModelProperty(value = "计划付款日 - 结束") |
| | | @TableField(exist = false) |
| | |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @ExcelColumn(name="创建日期",index = 8,width = 10,dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createDate; |
| | | |
| | | @ApiModelProperty(value = "更新人编码", example = "1") |
| | |
| | | private String contractCode; |
| | | |
| | | |
| | | @ApiModelProperty(value = "客户名称") |
| | | @TableField(exist = false) |
| | | private String customerNme; |
| | | |
| | | @ApiModelProperty(value = "客户名称(付款方)", example = "1") |
| | | @ExcelColumn(name="客户名称",index = 0,width = 10) |
| | | @TableField(exist = false) |
| | | private String customerName; |
| | | |
| | | @ApiModelProperty(value = "流水账号") |
| | | @TableField(exist = false) |
| | | private String accountTitle; |
| | | |
| | | |
| | | @ApiModelProperty(value = "创建人名称") |
| | | @ExcelColumn(name="创建人",index = 9,width = 10) |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value = "房间名称") |
| | | @TableField(exist = false) |
| | | private String roomName; |
| | | @ApiModelProperty(value = "建筑面积(平方米)", example = "1") |
| | | @TableField(exist = false) |
| | | private BigDecimal area; |
| | | } |
| | |
| | | @TableField(exist = false) |
| | | private String planCode; |
| | | |
| | | @ApiModelProperty(value = "巡检点总数") |
| | | @TableField(exist = false) |
| | | private String patrolNum; |
| | | |
| | | @ApiModelProperty(value = "已巡检数量") |
| | | @TableField(exist = false) |
| | | private String finishNum; |
| | | |
| | | @ApiModelProperty(value = "序号" , hidden = true) |
| | | @TableField(exist = false) |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import com.doumee.core.model.LoginUserModel; |
| | | import com.doumee.dao.system.model.Multifile; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | |
| | | import lombok.Data; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 运维巡检任务 - 巡检点信息表 |
| | |
| | | @Data |
| | | @ApiModel("运维巡检任务 - 巡检点信息表") |
| | | @TableName("`yw_patrol_task_record`") |
| | | public class YwPatrolTaskRecord { |
| | | public class YwPatrolTaskRecord extends LoginUserModel { |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | | @ApiModelProperty(value = "主键", example = "1") |
| | |
| | | @TableField(exist = false) |
| | | private String pointName; |
| | | |
| | | @ApiModelProperty(value = "处理人") |
| | | @TableField(exist = false) |
| | | private String realname; |
| | | |
| | | @ApiModelProperty(value = "部门名称") |
| | | @TableField(exist = false) |
| | | private String companyName; |
| | | |
| | | @ApiModelProperty(value = "巡检内容") |
| | | @TableField(exist = false) |
| | | private String content; |
| | | |
| | | @ApiModelProperty(value = "附件列表") |
| | | @TableField(exist = false) |
| | | private List<Multifile> multifileList; |
| | | |
| | | } |
| | |
| | | * 处理账单编号 |
| | | */ |
| | | void dealDayBillCode(); |
| | | |
| | | List<YwContractBill> getCanBackBill(YwContractBill model); |
| | | } |
| | |
| | | * @return long |
| | | */ |
| | | long count(YwPatrolTaskRecord ywPatrolTaskRecord); |
| | | |
| | | |
| | | void patrolData(YwPatrolTaskRecord ywPatrolTaskRecord); |
| | | |
| | | YwPatrolTaskRecord getDetail(Integer id); |
| | | } |
| | |
| | | public YwContractBill getDetail(Integer id) { |
| | | YwContractBill ywContractBill = ywContractBillMapper.selectJoinOne(YwContractBill.class, |
| | | new MPJLambdaWrapper<YwContractBill>().selectAll(YwContractBill.class) |
| | | .select(" ( select ifnull(sum(yw.ACT_RECEIVABLE_FEE),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ") |
| | | .select(" ( select ifnull(sum(case when yw.REVENUE_TYPE = 0 then yw.ACT_RECEIVABLE_FEE else -yw.ACT_RECEIVABLE_FEE end),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ") |
| | | .selectAs(YwContract::getCode,YwContractBill::getContractCode) |
| | | .selectAs(YwCustomer::getName,YwContractBill::getCustomerName) |
| | | .selectAs(Company::getName,YwContractBill::getCompanyName) |
| | | .selectAs(SystemUser::getRealname,YwContractBill::getRealname) |
| | | .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId) |
| | | .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId) |
| | | .leftJoin(Company.class,Company::getId,YwContract::getCompanyId) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwContractBill::getCreator) |
| | | .eq(YwContractBill::getIsdeleted,Constants.ZERO) |
| | | .eq(YwContractBill::getId,id)); |
| | | if(Objects.isNull(ywContractBill)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | ywContractBill.setNeedReceivableFee( |
| | | ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee()) |
| | | ); |
| | | |
| | | //房源数据 |
| | | ywContractBill.setYwContractRoomList(ywContractRoomMapper.selectJoinList(YwContractRoom.class,new MPJLambdaWrapper<YwContractRoom>() |
| | |
| | | .selectAs(YwProject::getName,YwRoom::getProjectName) |
| | | .selectAs(YwFloor::getName,YwRoom::getFloorName) |
| | | .selectAs(YwBuilding::getName,YwRoom::getBuildingName) |
| | | .selectAs(YwRoom::getCode,YwContractRoom::getRoomName) |
| | | .selectAs(YwRoom::getArea,YwContractRoom::getArea) |
| | | .leftJoin(YwRoom.class,YwRoom::getId,YwContractRoom::getRoomId) |
| | | .leftJoin(YwFloor.class,YwFloor::getId,YwRoom::getFloor) |
| | | .leftJoin(YwProject.class,YwProject::getId,YwRoom::getProjectId) |
| | | .leftJoin(YwBuilding.class,YwBuilding::getId,YwRoom::getBuildingId) |
| | | .eq(YwContractRoom::getContractId,id) |
| | | .eq(YwContractRoom::getType,Constants.ONE) |
| | | .eq(Constants.equalsInteger(ywContractBill.getType(),Constants.ONE),YwContractRoom::getContractId,id) |
| | | .eq(Constants.equalsInteger(ywContractBill.getType(),Constants.ONE),YwContractRoom::getType,Constants.ONE) |
| | | .eq(Constants.equalsInteger(ywContractBill.getType(),Constants.ZERO),YwContractRoom::getContractId,ywContractBill.getContractId()) |
| | | .eq(Constants.equalsInteger(ywContractBill.getType(),Constants.ZERO),YwContractRoom::getType,Constants.ZERO) |
| | | )); |
| | | |
| | | //收支记录 |
| | | ywContractBill.setYwContractRevenueList( |
| | | ywContractRevenueMapper.selectJoinList(YwContractRevenue.class,new MPJLambdaWrapper<YwContractRevenue>() |
| | | .selectAll(YwContractRevenue.class) |
| | | .selectAs(YwCustomer::getName,YwContractRevenue::getCustomerName) |
| | | .leftJoin(YwContract.class,YwContract::getId,YwContractRevenue::getContractId) |
| | | .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId) |
| | | .eq(YwContractRevenue::getStatus,Constants.ZERO) |
| | | .eq(YwContractRevenue::getBillId,ywContractBill.getId()) |
| | | .orderByDesc(YwContractRevenue::getId) |
| | | ) |
| | | ); |
| | | |
| | | //附件数据 |
| | | List<Multifile> multifileList = multifileMapper.selectJoinList(Multifile.class,new MPJLambdaWrapper<Multifile>() |
| | |
| | | YwContractBill model = pageWrap.getModel(); |
| | | IPage<YwContractBill> iPage = ywContractBillMapper.selectJoinPage(page,YwContractBill.class, |
| | | queryWrapper.selectAll(YwContractBill.class) |
| | | .select(" ( select ifnull(sum(yw.ACT_RECEIVABLE_FEE),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ") |
| | | .select(" ( select ifnull(sum(case when yw.REVENUE_TYPE = 0 then yw.ACT_RECEIVABLE_FEE else -yw.ACT_RECEIVABLE_FEE end),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ") |
| | | .selectAs(YwContract::getCode,YwContractBill::getContractCode) |
| | | .selectAs(YwCustomer::getName,YwContractBill::getCustomerName) |
| | | .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId) |
| | |
| | | YwContractBill::getType,model.getType()) |
| | | .eq(Objects.nonNull(model)&&Objects.nonNull(model.getContractId()), |
| | | YwContractBill::getContractId,model.getContractId()) |
| | | .like(Objects.nonNull(model)&&StringUtils.isNotBlank(model.getContractCode()), |
| | | YwContract::getCode,model.getContractCode()) |
| | | .ge(Objects.nonNull(model)&&Objects.nonNull(model.getPlanPayDateStart()),YwContractBill::getPlanPayDate, Utils.Date.getStart(model.getPlanPayDateStart())) |
| | | .le(Objects.nonNull(model)&&Objects.nonNull(model.getPlanPayDateEnd()),YwContractBill::getPlanPayDate, Utils.Date.getEnd(model.getPlanPayDateEnd())) ) |
| | | ; |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<YwContractBill> getCanBackBill(YwContractBill model) { |
| | | List<YwContractBill> list = ywContractBillMapper.selectJoinList(YwContractBill.class, |
| | | new MPJLambdaWrapper<YwContractBill>().selectAll(YwContractBill.class) |
| | | .select(" ( select ifnull(sum(case when yw.REVENUE_TYPE = 0 then yw.ACT_RECEIVABLE_FEE else -yw.ACT_RECEIVABLE_FEE end),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ") |
| | | .selectAs(YwContract::getCode,YwContractBill::getContractCode) |
| | | .selectAs(YwCustomer::getName,YwContractBill::getCustomerName) |
| | | .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId) |
| | | .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId) |
| | | .eq(YwContractBill::getIsdeleted,Constants.ZERO) |
| | | .in(YwContractBill::getCostType,Constants.ZERO,Constants.ONE,Constants.FOUR,Constants.FIVE,7) |
| | | .eq(Objects.nonNull(model)&&Objects.nonNull(model.getContractId()), |
| | | YwContractBill::getContractId,model.getContractId()) |
| | | .le(Objects.nonNull(model)&&Objects.nonNull(model.getPlanPayDateEnd()),YwContractBill::getStartDate, Utils.Date.getEnd(model.getPlanPayDateEnd())) ) |
| | | ; |
| | | |
| | | for (YwContractBill ywContractBill:list) { |
| | | ywContractBill.setNeedReceivableFee(ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee())); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | } |
| | |
| | | .selectAs(YwContract::getCode,YwContractRevenue::getContractCode) |
| | | .selectAs(YwCustomer::getName,YwContractRevenue::getCustomerName) |
| | | .selectAs(SystemUser::getRealname,YwContractRevenue::getRealname) |
| | | .selectAs(YwAccount::getTitle,YwContractRevenue::getAccountTitle) |
| | | .leftJoin(YwContractBill.class,YwContractBill::getId,YwContractRevenue::getBillId) |
| | | .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId) |
| | | .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwContractRevenue::getCreator) |
| | | .leftJoin(YwAccount.class,YwAccount::getId,YwContractRevenue::getAccountId) |
| | | .eq(YwContractRevenue::getId,id) |
| | | ); |
| | | |
| | |
| | | public List<YwContractRevenue> findList(YwContractRevenue ywContractRevenue) { |
| | | List<YwContractRevenue> ywContractRevenueList = ywContractRevenueMapper.selectJoinList(YwContractRevenue.class,new MPJLambdaWrapper<YwContractRevenue>() |
| | | .selectAll(YwContractRevenue.class) |
| | | .selectAs(YwCustomer::getName,YwContractRevenue::getCustomerNme) |
| | | .selectAs(YwCustomer::getName,YwContractRevenue::getCustomerName) |
| | | .leftJoin(YwContract.class,YwContract::getId,YwContractRevenue::getContractId) |
| | | .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId) |
| | | .eq(YwContractRevenue::getStatus,Constants.ZERO) |
| | |
| | | .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwContractRevenue::getCreator) |
| | | .eq(YwContractRevenue::getIsdeleted,Constants.ZERO) |
| | | .like(Objects.nonNull(model)&&StringUtils.isNotBlank(model.getCustomerNme()), |
| | | YwCustomer::getName,model.getCustomerNme()) |
| | | .like(Objects.nonNull(model)&&StringUtils.isNotBlank(model.getCustomerName()), |
| | | YwCustomer::getName,model.getCustomerName()) |
| | | .eq(Objects.nonNull(model)&&Objects.nonNull(model.getPayType()), |
| | | YwContractRevenue::getPayType,model.getPayType()) |
| | | .eq(Objects.nonNull(model)&&Objects.nonNull(model.getRevenueType()), |
| | |
| | | for (YwContractRevenue ywContractRevenue:iPage.getRecords()) { |
| | | //楼宇名称 |
| | | List<YwContractRoom> ywContractRoomList = ywContractRevenue.getYwContractRoomList(); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractRoomList)){ |
| | | StringBuilder roomPathName = new StringBuilder(); |
| | | for (YwContractRoom ywContractRoom:ywContractRoomList) { |
| | | if(StringUtils.isNotBlank(ywContractRoom.getProjectName())){ |
| | |
| | | } |
| | | ywContractRevenue.setRoomPathName(roomPathName.toString()); |
| | | } |
| | | |
| | | } |
| | | return PageData.from(iPage); |
| | | } |
| | | |
| | |
| | | import java.math.BigDecimal; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 运维合同信息表Service实现 |
| | |
| | | update.setBtFee(param.getBtFee()); |
| | | update.setBtRemark(getbackRentRemarkByParam(param)); |
| | | ywContractMapper.updateById(update); |
| | | // if(1==1){ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED); |
| | | // } |
| | | dealLogBiz(param,Constants.YwLogType.CONTRACT_BACK, param.getLoginUserInfo().getRealname(),getbackRentLogByParam(param)); |
| | | return param.getId(); |
| | | } |
| | |
| | | List<YwContractBill> canBills = new ArrayList<>();//可退租修改数据 |
| | | List<YwContractBill> allBills = ywContractBillMapper.selectList(new QueryWrapper<YwContractBill>(). |
| | | select("*," + |
| | | "( select ifnull(sum(yw.ACT_RECEIVABLE_FEE),0) from yw_contract_revenue yw where yw.bill_id = yw_contract_bill.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee " ) |
| | | "( select ifnull(sum(case when yw.REVENUE_TYPE = 0 then yw.ACT_RECEIVABLE_FEE else -yw.ACT_RECEIVABLE_FEE end),0) from yw_contract_revenue yw where yw.bill_id = yw_contract_bill.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee " ) |
| | | .lambda(). |
| | | eq(YwContractBill::getIsdeleted,Constants.ZERO) |
| | | .eq(YwContractBill::getContractId,param.getId())); |
| | |
| | | } |
| | | if(Constants.equalsInteger(bill.getPayStatus(),Constants.ZERO) |
| | | ||Constants.equalsInteger(bill.getPayStatus(),Constants.THREE)){ |
| | | if(bill.getStartDate().getTime()>param.getEditDate().getTime()){ |
| | | if(bill.getStartDate().getTime()<param.getBtDate().getTime()){ |
| | | canBills.add(bill); |
| | | }else{ |
| | | //如果还没开始,账单直接关闭 |
| | | closeBills.add(bill); |
| | | noBills.add(bill); |
| | | }else{ |
| | | canBills.add(bill); |
| | | } |
| | | // if(bill.getStartDate().getTime()>param.getEditDate().getTime()){ |
| | | // //如果还没开始,账单直接关闭 |
| | | // closeBills.add(bill); |
| | | // noBills.add(bill); |
| | | // }else{ |
| | | // canBills.add(bill); |
| | | // } |
| | | }else if(Constants.equalsInteger(bill.getPayStatus(),Constants.ONE) ){ |
| | | if(bill.getEndDate().getTime()<param.getEditDate().getTime()){ |
| | | if(bill.getStartDate().getTime()>param.getBtDate().getTime()){ |
| | | // if(bill.getEndDate().getTime()<param.getEditDate().getTime()){ |
| | | //如果已结清,账单直接关闭 |
| | | noBills.add(bill); |
| | | }else{ |
| | |
| | | //如果账单还有款待收,则保持状态不变 |
| | | } |
| | | } |
| | | b.setReceivableFee(editBill.getReceivableFee()); |
| | | b.setEditDate(param.getEditDate()); |
| | | b.setEditor(param.getEditor()); |
| | | b.setBtActDate(param.getBtActDate()); |
| | |
| | | if(yjBills.size()>0){ |
| | | // 如果是押金或者保证金,不支持退款,保持原来的状态, 0=租赁费;1=物业费;2=租赁押金;3=物业押金;4=水电费;5=杂项费;6=其他;7=保证金 |
| | | for(YwContractBill bill : yjBills){ |
| | | if(!Constants.equalsInteger(bill.getPayStatus(),Constants.ONE) ){ |
| | | // YwContractBill b = new YwContractBill(); |
| | | // //付款状态:0=待收款;1=已结清;2=部分结清;3=待付款;4=待退款;5=已关闭 |
| | | // //如果账单信息做了编辑,金额计算 实收金额 和 修改后应收金额作对比,判断是否应该退款 |
| | | // BigDecimal fee = Constants.formatBigdecimal(bill.getActReceivableFee()).subtract(bill.getReceivableFee()); |
| | | // if(fee.compareTo(new BigDecimal(0))== 0){ |
| | | // //如果费用正好,则修改账单信息为已结清 |
| | | // b.setPayStatus(Constants.ONE); |
| | | // }else if(fee.compareTo(new BigDecimal(0))> 0){ |
| | | // //如果需要进行退款,更新账单信息为待退款 |
| | | // b.setPayStatus(Constants.FOUR); |
| | | // } |
| | | // b.setId(bill.getId()); |
| | | // b.setEditDate(param.getEditDate()); |
| | | // b.setEditor(param.getEditor()); |
| | | // b.setReceivableFee(BigDecimal.ZERO); |
| | | // ywContractBillMapper.updateById(b); |
| | | //如果是未结清押金 |
| | | yjNoBills ++; |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(param.getCanBackRentBills())){ |
| | | List<YwContractBill> optional = param.getCanBackRentBills().stream().filter(i->Constants.equalsInteger(bill.getId(),i.getId())).collect(Collectors.toList()); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(optional)){ |
| | | YwContractBill canBill = optional.get(Constants.ZERO); |
| | | YwContractBill yjBill = new YwContractBill(); |
| | | yjBill.setId(bill.getId()); |
| | | yjBill.setEditDate(param.getEditDate()); |
| | | yjBill.setEditor(param.getEditor()); |
| | | yjBill.setReceivableFee(BigDecimal.ZERO); |
| | | yjBill.setPayStatus(Constants.FOUR); |
| | | yjBill.setPlanPayDate(canBill.getPlanPayDate()); |
| | | ywContractBillMapper.updateById(yjBill); |
| | | } |
| | | } |
| | | yjNoBills ++; |
| | | } |
| | | } |
| | | param.setBtWaitBill(canBills.size() + newBills.size()+yjNoBills);//未清算的账单数量 |
| | |
| | | //查询账单集合 |
| | | model.setBillList(ywContractBillMapper.selectJoinList(YwContractBill.class,new MPJLambdaWrapper<YwContractBill>() |
| | | .selectAll(YwContractBill.class ) |
| | | .select(" ( select ifnull(sum(case when yw.REVENUE_TYPE = 0 then yw.ACT_RECEIVABLE_FEE else -yw.ACT_RECEIVABLE_FEE end),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ") |
| | | .eq( YwContractBill::getContractId,model.getId()) |
| | | .eq(YwContractBill::getIsdeleted,Constants.ZERO) |
| | | .orderByAsc(YwContractBill::getSortnum,YwContractBill::getCreateDate))); |
| | | |
| | | for (YwContractBill ywContractBill:model.getBillList()) { |
| | | ywContractBill.setNeedReceivableFee(ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee())); |
| | | } |
| | | |
| | | model.setCanBackRentBills(new ArrayList<>()); |
| | | long nowStart = Utils.Date.getStart(new Date()).getTime(); |
| | | long nowEnd = Utils.Date.getEnd(new Date()).getTime(); |
| | |
| | | .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId) |
| | | .leftJoin(YwDevice.class,YwDevice::getId,YwDeviceRecord::getDeviceId) |
| | | .eq(YwDeviceRecord::getIsdeleted,Constants.ZERO) |
| | | .eq(Objects.nonNull(model.getUserId()),YwDeviceRecord::getUserId,model.getUserId()) |
| | | .and(Objects.nonNull(model)&&StringUtils.isNotBlank(model.getDeviceName()),i->i.like(YwDevice::getName,model.getDeviceName()).or().like(YwDevice::getCode,model.getDeviceName())) |
| | | .ge(Objects.nonNull(model.getStartDate()),YwDeviceRecord::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getStartDate())) |
| | | .le(Objects.nonNull(model.getEndDate()),YwDeviceRecord::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getEndDate())) |
| | |
| | | @Override |
| | | public YwPatrolPoint getDetail(Integer id) { |
| | | YwPatrolPoint ywPatrolPoint = ywPatrolPointMapper.selectById(id); |
| | | if(Objects.isNull(ywPatrolPoint)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | Multifile multifile = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda().eq(Multifile::getObjId,id) |
| | | .eq(Multifile::getObjType,Constants.MultiFile.FN_PATROL_POINT_FILE).last(" limit 1")); |
| | | if(Objects.nonNull(multifile)){ |
| | | if(Objects.nonNull(multifile) && StringUtils.isNotBlank(multifile.getFileurl())){ |
| | | String path = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode() |
| | | +systemDictDataBiz.queryByCode(Constants.FTP,Constants.YW_PATROL).getCode(); |
| | | ywPatrolPoint.setFileFullUrl(path + multifile.getFileurl()); |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.YwContractRevenueMapper; |
| | | import com.doumee.dao.business.YwPatrolTaskRecordMapper; |
| | | import com.doumee.dao.business.model.YwDeviceRecord; |
| | | import com.doumee.dao.business.model.YwPatrolPoint; |
| | | import com.doumee.dao.business.model.YwPatrolScheme; |
| | | import com.doumee.dao.business.model.YwPatrolTaskRecord; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.system.MultifileMapper; |
| | | import com.doumee.dao.system.model.Multifile; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.service.business.YwPatrolTaskRecordService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private YwPatrolTaskRecordMapper ywPatrolTaskRecordMapper; |
| | | |
| | | @Autowired |
| | | private MultifileMapper multifileMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public Integer create(YwPatrolTaskRecord ywPatrolTaskRecord) { |
| | |
| | | YwPatrolTaskRecord model = pageWrap.getModel(); |
| | | queryWrapper.selectAll(YwPatrolTaskRecord.class) |
| | | .selectAs(YwPatrolPoint::getName,YwPatrolTaskRecord::getPointName) |
| | | .selectAs(YwPatrolPoint::getContent,YwPatrolTaskRecord::getContent) |
| | | .leftJoin(YwPatrolPoint.class,YwPatrolPoint::getId,YwPatrolTaskRecord::getPointId) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwPatrolTaskRecord::getDealUserId) |
| | | .eq(YwPatrolScheme::getIsdeleted, Constants.ZERO) |
| | |
| | | QueryWrapper<YwPatrolTaskRecord> wrapper = new QueryWrapper<>(ywPatrolTaskRecord); |
| | | return ywPatrolTaskRecordMapper.selectCount(wrapper); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | public void patrolData(YwPatrolTaskRecord ywPatrolTaskRecord) { |
| | | if(Objects.isNull(ywPatrolTaskRecord) |
| | | || Objects.isNull(ywPatrolTaskRecord.getId()) |
| | | || Objects.isNull(ywPatrolTaskRecord.getDealStatus())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | LoginUserInfo loginUserInfo = ywPatrolTaskRecord.getLoginUserInfo(); |
| | | YwPatrolTaskRecord model = ywPatrolTaskRecordMapper.selectById(ywPatrolTaskRecord.getId()); |
| | | if(Objects.isNull(model)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!Constants.equalsInteger(model.getStatus(),Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"数据状态已流转"); |
| | | } |
| | | |
| | | ywPatrolTaskRecordMapper.update(null,new UpdateWrapper<YwPatrolTaskRecord>().lambda() |
| | | .set(YwPatrolTaskRecord::getDealStatus,ywPatrolTaskRecord.getDealStatus()) |
| | | .set(YwPatrolTaskRecord::getEditor,loginUserInfo.getId()) |
| | | .set(YwPatrolTaskRecord::getEditDate, DateUtil.getCurrDateTime()) |
| | | .set(YwPatrolTaskRecord::getDealDate, DateUtil.getCurrDateTime()) |
| | | .set(YwPatrolTaskRecord::getDealUserId,loginUserInfo.getId()) |
| | | .set(YwPatrolTaskRecord::getStatus,Constants.ONE) |
| | | .set(YwPatrolTaskRecord::getDealInfo, ywPatrolTaskRecord.getDealInfo()) |
| | | .eq(YwPatrolTaskRecord::getId,ywPatrolTaskRecord.getId())); |
| | | |
| | | //附件数据 |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywPatrolTaskRecord.getMultifileList())){ |
| | | for (Multifile multifile:ywPatrolTaskRecord.getMultifileList()) { |
| | | if(Objects.isNull(multifile) |
| | | || StringUtils.isBlank(multifile.getFileurl()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"附件信息错误"); |
| | | } |
| | | multifile.setCreator(loginUserInfo.getId()); |
| | | multifile.setCreateDate(new Date()); |
| | | multifile.setIsdeleted(Constants.ZERO); |
| | | multifile.setObjType(Constants.MultiFile.FN_PATROL_TASK_RECORD_FILE.getKey()); |
| | | multifile.setObjId(ywPatrolTaskRecord.getId()); |
| | | } |
| | | multifileMapper.insert(ywPatrolTaskRecord.getMultifileList()); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public YwPatrolTaskRecord getDetail(Integer id) { |
| | | |
| | | YwPatrolTaskRecord ywPatrolTaskRecord = ywPatrolTaskRecordMapper.selectJoinOne(YwPatrolTaskRecord.class,new MPJLambdaWrapper<YwPatrolTaskRecord>() |
| | | .selectAll(YwPatrolTaskRecord.class) |
| | | .selectAs(YwPatrolPoint::getName,YwPatrolTaskRecord::getPointName) |
| | | .selectAs(YwPatrolPoint::getContent,YwPatrolTaskRecord::getContent) |
| | | .selectAs(SystemUser::getRealname,YwPatrolTaskRecord::getRealname) |
| | | .selectAs(Company::getName,YwPatrolTaskRecord::getCompanyName) |
| | | .leftJoin(YwPatrolPoint.class,YwPatrolPoint::getId,YwPatrolTaskRecord::getPointId) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwPatrolTaskRecord::getDealUserId) |
| | | .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId) |
| | | .eq(YwPatrolScheme::getIsdeleted, Constants.ZERO) |
| | | .eq(YwPatrolTaskRecord::getId,id) |
| | | .orderByDesc(YwPatrolScheme::getCreateDate) |
| | | ); |
| | | //附件数据 |
| | | List<Multifile> multifileList = multifileMapper.selectJoinList(Multifile.class,new MPJLambdaWrapper<Multifile>() |
| | | .selectAll(Multifile.class) |
| | | .selectAs(SystemUser::getRealname,Multifile::getUserName) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,Multifile::getCreator) |
| | | .eq(Multifile::getObjId,id) |
| | | .eq(Multifile::getIsdeleted,Constants.ZERO) |
| | | .eq(Multifile::getObjType,Constants.MultiFile.FN_PATROL_TASK_RECORD_FILE.getKey())); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(multifileList)){ |
| | | String path = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode() |
| | | +systemDictDataBiz.queryByCode(Constants.FTP,Constants.YW_PATROL).getCode(); |
| | | for (Multifile multifile:multifileList) { |
| | | if(StringUtils.isNotBlank(multifile.getFileurl())){ |
| | | multifile.setFileurlFull(path + multifile.getFileurl()); |
| | | } |
| | | } |
| | | ywPatrolTaskRecord.setMultifileList(multifileList); |
| | | } |
| | | return ywPatrolTaskRecord; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @Override |
| | | public YwPatrolTask findById(Integer id) { |
| | | return ywPatrolTaskMapper.selectById(id); |
| | | YwPatrolTask ywPatrolTask = ywPatrolTaskMapper.selectJoinOne(YwPatrolTask.class,new MPJLambdaWrapper<YwPatrolTask>() |
| | | .selectAll(YwPatrolTask.class) |
| | | .selectAs(YwPatrolScheme::getCode,YwPatrolTask::getPlanCode) |
| | | .selectAs(YwPatrolScheme::getTitle,YwPatrolTask::getPlanTitle) |
| | | .selectAs(SystemUser::getRealname,YwPatrolTask::getUserName) |
| | | .select(" ( select count(1) from yw_patrol_task_record ytr where ytr.TASK_ID = t.id and t.ISDELETED = 0 ) ",YwPatrolTask::getPatrolNum) |
| | | .select(" ( select count(1) from yw_patrol_task_record ytr where ytr.TASK_ID = t.id and t.STATUS = 1 and t.ISDELETED = 0) ",YwPatrolTask::getPatrolNum) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwPatrolTask::getDealUserId) |
| | | .leftJoin(YwPatrolScheme.class,YwPatrolScheme::getId,YwPatrolTask::getSchemeId) |
| | | .eq(YwPatrolTask::getIsdeleted, Constants.ZERO) |
| | | .eq(YwPatrolTask::getId,id) |
| | | .last(" limit 1 ")) |
| | | ; |
| | | return ywPatrolTask; |
| | | } |
| | | |
| | | @Override |
| | |
| | | .selectAs(YwPatrolScheme::getCode,YwPatrolTask::getPlanCode) |
| | | .selectAs(YwPatrolScheme::getTitle,YwPatrolTask::getPlanTitle) |
| | | .selectAs(SystemUser::getRealname,YwPatrolTask::getUserName) |
| | | .select(" ( select count(1) from yw_patrol_task_record ytr where ytr.TASK_ID = t.id and t.ISDELETED = 0 ) ",YwPatrolTask::getPatrolNum) |
| | | .select(" ( select count(1) from yw_patrol_task_record ytr where ytr.TASK_ID = t.id and t.STATUS = 1 and t.ISDELETED = 0) ",YwPatrolTask::getPatrolNum) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwPatrolTask::getDealUserId) |
| | | .leftJoin(YwPatrolScheme.class,YwPatrolScheme::getId,YwPatrolTask::getSchemeId) |
| | | .eq(YwPatrolTask::getIsdeleted, Constants.ZERO) |
| | | .like(StringUtils.isNotBlank(model.getPlanTitle()),YwPatrolScheme::getTitle,model.getPlanTitle()) |
| | | |
| | | .ge(Objects.nonNull(model.getStartDate()), YwPatrolTask::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getStartDate())) |
| | | .le(Objects.nonNull(model.getEndDate()),YwPatrolTask::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getEndDate())) |
| | | |
| | | .orderByDesc(YwPatrolTask::getId) |
| | | ; |
| | | IPage<YwPatrolTask> iPage = ywPatrolTaskMapper.selectJoinPage(page,YwPatrolTask.class,queryWrapper); |
| | |
| | | .selectAs(YwRoom::getRoomNum,YwWorkorder::getRoomNum) |
| | | .selectAs(YwFloor::getName,YwWorkorder::getFloorName) |
| | | .selectAs(YwBuilding::getName,YwWorkorder::getBuildingName) |
| | | .selectAs(YwProject::getName,YwWorkorder::getProjectName) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwWorkorder::getDealUserId) |
| | | .leftJoin(Category.class,Category::getId,YwWorkorder::getCateId) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwWorkorder::getCreator) |
| | | .leftJoin(YwRoom.class,YwRoom::getId,YwWorkorder::getRoomId) |
| | | .leftJoin(YwFloor.class,YwFloor::getId,YwWorkorder::getFloorId) |
| | | .leftJoin(YwBuilding.class,YwBuilding::getId,YwWorkorder::getBuildingId); |
| | | .leftJoin(YwBuilding.class,YwBuilding::getId,YwWorkorder::getBuildingId) |
| | | .leftJoin(YwProject.class,YwProject::getId,YwBuilding::getProjectId); |
| | | pageWrap.getModel().setIsdeleted(Constants.ZERO); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.eq(YwWorkorder::getId, pageWrap.getModel().getId()); |
| | | } |
| | | if(Objects.nonNull(pageWrap.getModel().getRoomName())){ |
| | | queryWrapper.and(i->i.like(YwFloor::getName,pageWrap.getModel().getRoomName()).or() |
| | | .like(YwRoom::getRoomNum,pageWrap.getModel().getRoomName()) |
| | | ); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.eq(YwWorkorder::getCreator, pageWrap.getModel().getCreator()); |
| | | } |