| | |
| | | private Date approveOverTime; |
| | | |
| | | /** |
| | | * 审批状态:0待审核,1审核中,2审核完成 3审核未通过 |
| | | * 审批状态:0待审核,1审核中,2审核完成 3审核未通过 4已重新提交 |
| | | */ |
| | | private Integer approveStatus; |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.approve.mapper.ApproveNodeMapper; |
| | | import com.ruoyi.approve.mapper.ApproveProcessMapper; |
| | | import com.ruoyi.approve.pojo.ApproveNode; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | |
| | | .collect(Collectors.toList()) |
| | | .get(0) |
| | | .getNickName()); |
| | | // 设置状态为重新提交 |
| | | if(approveProcessVO.getId() != null){ |
| | | ApproveProcess approveProcess1 = approveProcessMapper.selectById(approveProcessVO.getId()); |
| | | approveProcess1.setApproveStatus(4); |
| | | approveProcessMapper.updateById(approveProcess1); |
| | | } |
| | | save(approveProcess); |
| | | //初始化审批节点 |
| | | approveNodeService.initApproveNodes(approveProcessVO.getApproveUserIds(),approveID,approveProcessVO.getApproveDeptId()); |
| | |
| | | return one; |
| | | } |
| | | |
| | | private final ApproveNodeMapper approveNodeMapper; |
| | | |
| | | @Override |
| | | public void updateApproveProcessStatus(ApproveNode approveNode,Integer status) { |
| | | LambdaQueryWrapper<ApproveProcess> approveProcessLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | .last("limit 1"); |
| | | ApproveProcess approveProcess = approveProcessMapper.selectOne(approveProcessLambdaQueryWrapper); |
| | | if(approveProcess == null) throw new RuntimeException("审批不存在"); |
| | | LambdaQueryWrapper<ApproveNode> approveNodeLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | approveNodeLambdaQueryWrapper.eq(ApproveNode::getApproveProcessId, approveNode.getApproveProcessId()) |
| | | .eq(ApproveNode::getApproveNodeOrder, approveNode.getApproveNodeOrder() + 1) |
| | | .eq(ApproveNode::getDeleteFlag, 0) |
| | | .eq(ApproveNode::getTenantId, SecurityUtils.getLoginUser().getTenantId()) |
| | | .last("limit 1"); |
| | | ApproveNode approveNode1 = approveNodeMapper.selectOne(approveNodeLambdaQueryWrapper); |
| | | approveProcess.setApproveStatus(status); |
| | | if(approveNode1 != null){ |
| | | approveProcess.setApproveUserCurrentId(approveNode.getApproveNodeUserId()); |
| | | approveProcess.setApproveUserCurrentName(approveNode1.getApproveNodeUser()); |
| | | } |
| | | updateById(approveProcess); |
| | | } |
| | | |
| | | @Override |
| | | public void updateByApproveId(ApproveGetAndUpdateVo approveGetAndUpdateVo) { |
| | | ApproveProcess approve = getApproveById(approveGetAndUpdateVo.getId()); |
| | | ApproveProcess approve = approveProcessMapper.selectById(approveGetAndUpdateVo.getId()); |
| | | approve.setApproveReason(approveGetAndUpdateVo.getApproveReason()); |
| | | updateById(approve); |
| | | } |
| | |
| | | @Data |
| | | public class ApproveProcessVO { |
| | | |
| | | private Long id; |
| | | |
| | | |
| | | private Long approveDeptId; |
| | | |
| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.project.system.mapper.SysUserMapper;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.authentication.AuthenticationManager;
|
| | | import org.springframework.security.authentication.BadCredentialsException;
|
| | |
| | | return loginUser.getUserId();
|
| | | }
|
| | |
|
| | | @Autowired
|
| | | private SysUserMapper sysUserMapper;
|
| | |
|
| | | /**
|
| | | * 登录验证
|
| | | *
|
| | |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
| | | LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
| | | recordLoginInfo(loginUser.getUserId());
|
| | | // 更新用户信息,修改当前选中公司
|
| | | SysUser user = loginUser.getUser();
|
| | | if(factoryId != null){
|
| | | user.setTenantId(factoryId);
|
| | | }else{
|
| | | user.setTenantId(tokenService.getDeptIdsByUserId(user.getUserId())[0]);
|
| | | }
|
| | | sysUserMapper.updateUser(user);
|
| | | // 生成token
|
| | | return tokenService.createToken(loginUser);
|
| | | }
|
| | |
| | | {
|
| | | loginUser.setLoginTime(System.currentTimeMillis());
|
| | | loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE);
|
| | | LambdaQueryWrapper<SysUserDept> sysUserDeptLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
| | | sysUserDeptLambdaQueryWrapper.eq(SysUserDept::getUserId, loginUser.getUserId());
|
| | | List<SysUserDept> sysUserDept = sysUserDeptMapper.selectList(sysUserDeptLambdaQueryWrapper);
|
| | | if(!CollectionUtils.isEmpty(sysUserDept)){
|
| | | List<Long> collect = sysUserDept.stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
|
| | | loginUser.setDeptId(collect.toArray(new Long[0]));
|
| | | }
|
| | | loginUser.setDeptIds(getDeptIdsByUserId(loginUser.getUserId()));
|
| | | // 根据uuid将loginUser缓存
|
| | | String userKey = getTokenKey(loginUser.getToken());
|
| | | redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
|
| | | }
|
| | |
|
| | | public Long[] getDeptIdsByUserId(Long userId){
|
| | | LambdaQueryWrapper<SysUserDept> sysUserDeptLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
| | | sysUserDeptLambdaQueryWrapper.eq(SysUserDept::getUserId, userId);
|
| | | List<SysUserDept> sysUserDept = sysUserDeptMapper.selectList(sysUserDeptLambdaQueryWrapper);
|
| | | if(CollectionUtils.isEmpty(sysUserDept)){
|
| | | return null;
|
| | | }
|
| | | return sysUserDept.stream().map(SysUserDept::getDeptId).toArray(Long[]::new);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 设置用户代理信息
|
| | | *
|
| | |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.purchase.dto.PaymentRegistrationDto; |
| | | import com.ruoyi.purchase.dto.ProductRecordDto; |
| | | import com.ruoyi.purchase.dto.TicketRegistrationDto; |
| | | import com.ruoyi.purchase.pojo.PaymentRegistration; |
| | | import com.ruoyi.purchase.pojo.ProductRecord; |
| | | import com.ruoyi.purchase.pojo.TicketRegistration; |
| | | import com.ruoyi.purchase.service.IPaymentRegistrationService; |
| | | import com.ruoyi.purchase.service.IProductRecordService; |
| | | import com.ruoyi.purchase.service.ITicketRegistrationService; |
| | | import com.ruoyi.purchase.service.impl.PaymentRegistrationServiceImpl; |
| | | import com.ruoyi.sales.service.ICommonFileService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.core.parameters.P; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @Api(tags = "来票登记") |
| | | public class TicketRegistrationController extends BaseController { |
| | | |
| | | private final PaymentRegistrationServiceImpl paymentRegistrationServiceImpl; |
| | | private ITicketRegistrationService ticketRegistrationService; |
| | | |
| | | private ICommonFileService commonFileService; |
| | | |
| | | private IProductRecordService productRecordService; |
| | | |
| | | @Autowired |
| | | private IPaymentRegistrationService paymentRegistrationService; |
| | | |
| | | /** |
| | | * 查询来票登记列表 |
| | |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @ApiOperation("根据id查询付款流水信息") |
| | | @GetMapping("/getById") |
| | | public List<PaymentRegistrationDto> getById( Long id ) { |
| | | return ticketRegistrationService.getPaymentRegistrationDtoById(id); |
| | | } |
| | | |
| | | @ApiOperation("根据id查询付款流水") |
| | | @GetMapping("/getPaymentRegistrationById") |
| | | public AjaxResult getPaymentRegistrationById(Long id) { |
| | | PaymentRegistration byId = paymentRegistrationService.getById(id); |
| | | return AjaxResult.success(byId); |
| | | } |
| | | |
| | | @ApiOperation("修改付款流水") |
| | | @PutMapping("/updatePaymentRegistration") |
| | | @Log(title = "修改付款流水", businessType = BusinessType.UPDATE) |
| | | public AjaxResult updatePaymentRegistration(@RequestBody PaymentRegistration paymentRegistratio) { |
| | | return AjaxResult.success(paymentRegistrationService.updatePaymentRegistration(paymentRegistratio)); |
| | | } |
| | | |
| | | @ApiOperation("删除付款流水") |
| | | @DeleteMapping("/delPaymentRegistration") |
| | | public AjaxResult delPaymentRegistration(@RequestBody Long id) { |
| | | return toAjax(paymentRegistrationService.delPaymentRegistration(id)); |
| | | } |
| | | |
| | | /** |
| | | * 导出来票登记列表 |
| | | */ |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.purchase.dto.PaymentRegistrationDto; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 采购台账Mapper接口 |
| | |
| | | int updateContractAmountById(@Param("id") Long id, @Param("totalTaxInclusiveAmount") BigDecimal totalTaxInclusiveAmount); |
| | | |
| | | IPage<PurchaseLedgerDto> selectPurchaseLedgerListPage(IPage ipage, @Param("c") PurchaseLedgerDto purchaseLedger); |
| | | |
| | | List<PaymentRegistrationDto> getPaymentRegistrationDtoById(Long id); |
| | | } |
| | |
| | | IPage<PaymentRegistrationDto> paymentHistoryListPage(Page page, PaymentRegistrationDto paymentRegistrationDto); |
| | | |
| | | Boolean delete(Long[] ids); |
| | | |
| | | int delPaymentRegistration(Long ids); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.purchase.dto.PaymentRegistrationDto; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.dto.TicketRegistrationDto; |
| | | import com.ruoyi.purchase.pojo.TicketRegistration; |
| | |
| | | IPage<TicketRegistration> selectTicketRegistrationListPage(Page page, TicketRegistration ticketRegistration); |
| | | |
| | | PurchaseLedgerDto getPuargeById(Long id); |
| | | |
| | | List<PaymentRegistrationDto> getPaymentRegistrationDtoById(Long id); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public int updatePaymentRegistration(PaymentRegistration paymentRegistration) { |
| | | TicketRegistration ticketRegistration = ticketRegistrationMapper.selectById(paymentRegistration.getTicketRegistrationId()); |
| | | PaymentRegistration paymentRegistration1 = paymentRegistrationMapper.selectById(paymentRegistration.getId()); |
| | | |
| | | TicketRegistration ticketRegistration = ticketRegistrationMapper.selectById(paymentRegistration.getTicketRegistrationId()==null?paymentRegistration1.getTicketRegistrationId():paymentRegistration.getTicketRegistrationId()); |
| | | |
| | | List<PaymentRegistration> paymentRegistrations = paymentRegistrationMapper.selectList(new QueryWrapper<PaymentRegistration>() |
| | | .eq("ticket_registration_id", paymentRegistration.getTicketRegistrationId()).ne("id", paymentRegistration.getId())); |
| | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public int delPaymentRegistration(Long id) { |
| | | // PaymentRegistration paymentRegistration = paymentRegistrationMapper.selectById(id); |
| | | // TicketRegistration ticketRegistration = ticketRegistrationMapper.selectById(paymentRegistration.getTicketRegistrationId()); |
| | | // if (ticketRegistration != null) { |
| | | // ticketRegistration.setPaymentAmountTotal(ticketRegistration.getPaymentAmountTotal().subtract(paymentRegistration.getCurrentPaymentAmount())); |
| | | // ticketRegistration.setUnPaymentAmountTotal(ticketRegistration.getUnPaymentAmountTotal().add(paymentRegistration.getCurrentPaymentAmount())); |
| | | // ticketRegistrationMapper.updateById(ticketRegistration); |
| | | // } |
| | | |
| | | return paymentRegistrationMapper.deleteById(id); |
| | | } |
| | | |
| | | // 批量查询采购台账(当月) |
| | | private Map<Long, List<PurchaseLedger>> batchQueryPurchaseLedgers(List<Long> supplierIds, LocalDate startDate, LocalDate endDate) { |
| | | LambdaQueryWrapper<PurchaseLedger> query = new LambdaQueryWrapper<>(); |
| | |
| | | if (salesLedgerProduct != null) { |
| | | salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getFutureTicketsAmount().add(productRecord.getTicketsAmount()).subtract(productRecordDto.getTicketsAmount())); |
| | | salesLedgerProduct.setFutureTickets(salesLedgerProduct.getFutureTickets().add(productRecord.getTicketsNum().subtract(productRecordDto.getTicketsNum()))); |
| | | salesLedgerProduct.setTicketsAmount(productRecordDto.getTicketsAmount()); |
| | | salesLedgerProduct.setTicketsNum(productRecordDto.getTicketsNum()); |
| | | salesLedgerProductMapper.updateById(salesLedgerProduct); |
| | | |
| | | } |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(productRecord.getPurchaseLedgerId()); |
| | | if (purchaseLedger != null) { |
| | | purchaseLedger.setReceiptPaymentAmount(purchaseLedger.getReceiptPaymentAmount()); |
| | | } |
| | | BeanUtils.copyProperties(productRecordDto,productRecord); |
| | | productRecord.setFutureTicketsAmount(productRecord.getFutureTickets().multiply(productRecord.getTaxInclusiveUnitPrice())); |
| | | productRecordMapper.updateById(productRecord); |
| | | |
| | | return AjaxResult.success("修改成功"); |
| | |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | | import com.ruoyi.sales.service.impl.SalesLedgerProductServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.FilenameUtils; |
| | |
| | | |
| | | // 修改产品信息 |
| | | for (ProductRecord productRecord : productRecords) { |
| | | ticketRegistrations.get(0).setInvoiceAmount(ticketRegistrations.get(0).getInvoiceAmount().subtract(productRecords.get(0).getTicketsAmount())); |
| | | ticketRegistrationMapper.updateById(ticketRegistrations.get(0)); |
| | | BigDecimal subtract = ticketRegistrations.get(0).getInvoiceAmount().subtract(productRecords.get(0).getTicketsAmount()); |
| | | // 小于等于0删除 ,大于0修改 |
| | | if(subtract.compareTo(BigDecimal.ZERO) <= 0){ |
| | | ticketRegistrationMapper.deleteById(ticketRegistrations.get(0)); |
| | | }else if(subtract.compareTo(BigDecimal.ZERO) > 0){ |
| | | ticketRegistrations.get(0).setInvoiceAmount(subtract); |
| | | ticketRegistrationMapper.updateById(ticketRegistrations.get(0)); |
| | | } |
| | | LambdaQueryWrapper<SalesLedgerProduct> salesLedgerProductLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | salesLedgerProductLambdaQueryWrapper.eq(SalesLedgerProduct::getId, productRecord.getSaleLedgerProjectId()) |
| | | .eq(SalesLedgerProduct::getType, 2); |
| | |
| | | |
| | | if (ticketRegistration.getStatus()) { |
| | | ticketRegistrationIPage.getRecords().removeIf(receiptPaymentDto1 -> new BigDecimal("0.00").equals(receiptPaymentDto1.getUnPaymentAmountTotal())); |
| | | ticketRegistrationIPage.setTotal(ticketRegistrationIPage.getRecords().size()); |
| | | } |
| | | } |
| | | return ticketRegistrationIPage; |
| | |
| | | return purchaseLedgerDto; |
| | | } |
| | | |
| | | @Override |
| | | public List<PaymentRegistrationDto> getPaymentRegistrationDtoById(Long id) { |
| | | List<PaymentRegistrationDto> paymentRegistrationDtos =purchaseLedgerMapper.getPaymentRegistrationDtoById(id); |
| | | return paymentRegistrationDtos; |
| | | } |
| | | |
| | | private void handleSalesLedgerProducts(Long salesLedgerId, List<SalesLedgerProduct> products, Integer type) { |
| | | if (products == null || products.isEmpty()) { |
| | | return; |
| | |
| | | for (SalesLedgerProduct productDatum : productData) { |
| | | // 如果开票数为0 跳过 |
| | | BigDecimal currentInvoiceNum = productDatum.getCurrentInvoiceNum(); |
| | | if (null == currentInvoiceNum) { |
| | | continue; |
| | | } |
| | | if(BigDecimal.ZERO.compareTo(currentInvoiceNum) == 0){ |
| | | if(null == currentInvoiceNum || BigDecimal.ZERO.compareTo(currentInvoiceNum) == 0){ |
| | | continue; |
| | | } |
| | | invoiceAmountTotal = invoiceAmountTotal.add(currentInvoiceNum); |
| | |
| | | import com.ruoyi.sales.dto.InvoiceLedgerDto; |
| | | import com.ruoyi.sales.dto.ReceiptPaymentDto; |
| | | import com.ruoyi.sales.dto.ReceiptPaymentExeclDto; |
| | | import com.ruoyi.sales.mapper.InvoiceLedgerMapper; |
| | | import com.ruoyi.sales.mapper.ReceiptPaymentMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.pojo.InvoiceLedger; |
| | | import com.ruoyi.sales.pojo.ReceiptPayment; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.service.ReceiptPaymentService; |
| | |
| | | |
| | | @Autowired |
| | | private SalesLedgerMapper salesLedgerMapper; |
| | | @Autowired |
| | | private InvoiceLedgerMapper invoiceLedgerMapper; |
| | | |
| | | /** |
| | | * 回款登记新增 |
| | |
| | | */ |
| | | @Override |
| | | public int receiptPaymentSaveOrUpdate(ReceiptPayment receiptPayment) { |
| | | ReceiptPayment byId = receiptPayment; |
| | | if (!ObjectUtils.isEmpty(receiptPayment.getId())){ |
| | | byId = this.getById(receiptPayment.getId()); |
| | | } |
| | | InvoiceLedger invoiceLedger = invoiceLedgerMapper.selectById(byId.getInvoiceLedgerId()); |
| | | Page<ReceiptPaymentDto> objectPage = new Page<>(); |
| | | ReceiptPaymentDto receiptPaymentDto = new ReceiptPaymentDto(); |
| | | receiptPaymentDto.setInvoiceLedgerId(invoiceLedger.getId()); |
| | | IPage<ReceiptPaymentDto> receiptPaymentDtoIPage = receiptPaymentMapper.bindInvoiceNoRegPage(objectPage, receiptPaymentDto); |
| | | ReceiptPaymentDto receiptPaymentDto1 = receiptPaymentDtoIPage.getRecords().get(0); |
| | | if (!ObjectUtils.isEmpty(byId.getId())){ |
| | | receiptPaymentDto1.setNoReceiptAmount(receiptPaymentDto1.getNoReceiptAmount().add(byId.getReceiptPaymentAmount())); |
| | | } |
| | | if (receiptPaymentDto1.getNoReceiptAmount().compareTo(receiptPayment.getReceiptPaymentAmount())<0){ |
| | | throw new RuntimeException("本次回款金额不能大于待回款金额"); |
| | | } |
| | | if(null==receiptPayment.getId()){ |
| | | |
| | | return receiptPaymentMapper.insert(receiptPayment); |
| | | }else { |
| | | |
| | | return receiptPaymentMapper.updateById(receiptPayment); |
| | | } |
| | | } |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int addOrUpdateSalesLedgerProduct(SalesLedgerProduct salesLedgerProduct) { |
| | | //未开票数量+金额 |
| | | salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getQuantity()); |
| | | salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | int result; |
| | | Long salesLedgerId = salesLedgerProduct.getSalesLedgerId(); |
| | | if (salesLedgerProduct.getId() == null) { |
| | |
| | | IPage<StaffJoinLeaveRecord> staffJoinLeaveRecordListPage(Page page, @Param("staffJoinLeaveRecord") StaffJoinLeaveRecord staffJoinLeaveRecord); |
| | | |
| | | List<StaffJoinLeaveRecord> staffJoinLeaveRecordList(@Param("staffJoinLeaveRecord") StaffJoinLeaveRecord staffJoinLeaveRecord); |
| | | |
| | | List<StaffJoinLeaveRecord> staffOnJobList(); |
| | | |
| | | } |
| | |
| | | |
| | | void staffOnJobExport(HttpServletResponse response, StaffOnJob staffOnJob); |
| | | |
| | | List<StaffOnJob> staffOnJobList(); |
| | | List<StaffJoinLeaveRecord> staffOnJobList(); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<StaffOnJob> staffOnJobList() { |
| | | return staffOnJobMapper.selectList(Wrappers.<StaffOnJob>lambdaQuery().eq(StaffOnJob::getStaffState,1)); |
| | | public List<StaffJoinLeaveRecord> staffOnJobList() { |
| | | return staffJoinLeaveRecordMapper.staffOnJobList(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | <select id="selectPurchaseReport" resultType="com.ruoyi.purchase.dto.InvoicePurchaseReportDto"> |
| | | select sl.customer_contract_no, |
| | | sl.customer_name, |
| | | sl.project_name, |
| | | sl.contract_amount, |
| | | pl.contract_amount as purchase_amount, |
| | | sum(slp.tax_exclusive_total_price) as sale_tax_exclusive_total_price, |
| | | sum(pr.tax_exclusive_total_price) as tax_exclusive_total_price, |
| | | (sl.contract_amount-pl.contract_amount) as balance, |
| | | CONCAT(FORMAT((sl.contract_amount - pl.contract_amount) / sl.contract_amount * 100, 2), '%') AS balance_ratio, |
| | | sl.contract_amount-sum(slp.tax_exclusive_total_price)-(pl.contract_amount-sum(pr.tax_exclusive_total_price)) as balance_amount |
| | | select A.*, |
| | | FORMAT(A.contract_amount-A.sale_tax_exclusive_total_price-A.purchase_amount+A.tax_exclusive_total_price,2) as balance_amount |
| | | from (select sl.customer_contract_no, |
| | | sl.id, |
| | | pl.id as pl_id, |
| | | sl.customer_name, |
| | | sl.project_name, |
| | | sl.contract_amount, |
| | | pl.contract_amount as purchase_amount, |
| | | sum(slp.tax_exclusive_total_price) /count(slp.id) as sale_tax_exclusive_total_price, |
| | | sum(slp1.tax_exclusive_total_price) as tax_exclusive_total_price, |
| | | (sl.contract_amount - pl.contract_amount) as balance, |
| | | CONCAT(FORMAT((sl.contract_amount - pl.contract_amount) / sl.contract_amount * 100, 2), |
| | | '%') AS balance_ratio |
| | | from purchase_ledger pl |
| | | left join sales_ledger sl on pl.sales_ledger_id = sl.id |
| | | left join product_record pr on pr.purchase_ledger_id = pl.id |
| | | left join sales_ledger_product slp on slp.sales_ledger_id = sl.id |
| | | |
| | | group by sl.customer_contract_no, sl.customer_name, sl.project_name, sl.contract_amount, pl.contract_amount |
| | | having sl.customer_contract_no is not null |
| | | left join sales_ledger sl on pl.sales_ledger_id = sl.id |
| | | left join sales_ledger_product slp on slp.sales_ledger_id = sl.id and slp.type = 1 |
| | | left join sales_ledger_product slp1 on slp1.sales_ledger_id = pl.id and slp1.type = 2 |
| | | group by sl.customer_contract_no, sl.customer_name, sl.project_name, sl.contract_amount, pl.contract_amount,sl.id,pl.id |
| | | having sl.customer_contract_no is not null) A |
| | | <where> |
| | | <if test="c.customerName != null and c.customerName != ''"> |
| | | and sl.customer_name like concat('%',#{c.customerName},'%') |
| | |
| | | )as a |
| | | <where> |
| | | <if test="month != null"> |
| | | and a.month = date_format(#{month}) |
| | | and a.month = #{month} |
| | | </if> |
| | | </where> |
| | | |
| | |
| | | # GROUP BY DATE_FORMAT(a.issue_date, '%Y-%m') |
| | | </select> |
| | | |
| | | </mapper> |
| | | </mapper> |
| | |
| | | pl.contract_amount |
| | | |
| | | </select> |
| | | <select id="getPaymentRegistrationDtoById" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto"> |
| | | SELECT |
| | | T1.id, |
| | | T1.payment_date, |
| | | T2.supplier_name, |
| | | T1.current_payment_amount, |
| | | T1.payment_method, |
| | | T3.nick_name AS registrant, |
| | | T1.registrationt_date |
| | | FROM |
| | | payment_registration T1 |
| | | LEFT JOIN |
| | | supplier_manage T2 ON T1.supplier_id = T2.id |
| | | LEFT JOIN |
| | | sys_user T3 ON T3.user_id = T1.registrant_id |
| | | left join ticket_registration T4 on T1.ticket_registration_id = T4.id |
| | | WHERE |
| | | T4.id = #{id} |
| | | </select> |
| | | </mapper> |
| | |
| | | <if test="c.customerName != null and c.customerName !=''"> |
| | | AND T3.customer_name LIKE CONCAT('%',#{c.customerName},'%') |
| | | </if> |
| | | <if test="c.invoiceLedgerId != null"> |
| | | AND T1.id = #{c.invoiceLedgerId} |
| | | </if> |
| | | <if test="c.customerContractNo != null and c.customerContractNo !=''"> |
| | | AND T3.customer_contract_no LIKE CONCAT('%',#{c.customerContractNo},'%') |
| | | </if> |
| | |
| | | AND staff_name LIKE CONCAT('%',#{staffJoinLeaveRecord.staffName},'%') |
| | | </if> |
| | | </select> |
| | | <select id="staffOnJobList" resultType="com.ruoyi.staff.pojo.StaffJoinLeaveRecord"> |
| | | select * |
| | | from (select *, |
| | | ROW_NUMBER() over (PARTITION BY staff_no ORDER BY create_time DESC ) as rn |
| | | from staff_join_leave_record |
| | | where staff_state = 1) t |
| | | where rn = 1 |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | <if test="loginDate != null">login_date = #{loginDate},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="tenantId != null">tenant_id = #{tenantId},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | | where user_id = #{userId} |