| | |
| | | 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<>(); |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | |
| | | <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},'%') |
| | |
| | | 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> |