fix(accountSales): 财务管理的销售出库和销售退货
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @Schema(name = "SalesOutboundDto", description = "è´¢å¡ç®¡ç--éå®åºåºå°è´¦(ä¼ å)") |
| | | public class SalesOutboundDto { |
| | | |
| | | @Schema(description = "åºåºåå·") |
| | | private String outboundBatches; |
| | | |
| | | @Schema(description = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @Schema(name = "SalesReturnDto", description = "è´¢å¡ç®¡ç--éå®éè´§å°è´¦(ä¼ å)") |
| | | public class SalesReturnDto { |
| | | |
| | | @Schema(description = "éè´§åå·") |
| | | private String returnNo; |
| | | |
| | | @Schema(description = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @Schema(name = "SalesOutboundVo", description = "è´¢å¡ç®¡ç--éå®åºåºå°è´¦(è¿å)") |
| | | @ExcelIgnoreUnannotated |
| | | public class SalesOutboundVo { |
| | | |
| | | @Schema(description = "åºåºåid") |
| | | private Long id; |
| | | |
| | | @Schema(description = "åºåºåå·") |
| | | @Excel(name = "åºåºåå·") |
| | | private String outboundBatches; |
| | | |
| | | @Schema(description = "客æ·åç§°") |
| | | @Excel(name = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "åºåºæ¥æ") |
| | | @Excel(name = "åºåºæ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date shippingDate; |
| | | |
| | | @Schema(description = "产ååç§°") |
| | | @Excel(name = "产ååç§°") |
| | | private String productName; |
| | | |
| | | @Schema(description = "产åè§æ ¼") |
| | | @Excel(name = "产åè§æ ¼") |
| | | private String specificationModel; |
| | | |
| | | @Schema(description = "åºåºæ°é") |
| | | @Excel(name = "åºåºæ°é") |
| | | private BigDecimal stockOutNum; |
| | | |
| | | @Schema(description = "åè´§ç¼å·") |
| | | @Excel(name = "åè´§ç¼å·") |
| | | private String shippingNo; |
| | | |
| | | @Schema(description = "éå®è®¢åå·") |
| | | @Excel(name = "éå®è®¢åå·") |
| | | private String salesContractNo; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @Schema(name = "SalesReturnVo", description = "è´¢å¡ç®¡ç--éå®éè´§å°è´¦(è¿å)") |
| | | @ExcelIgnoreUnannotated |
| | | public class SalesReturnVo { |
| | | |
| | | @Schema(description = "éè´§åid") |
| | | private Long id; |
| | | |
| | | @Excel(name = "éè´§åå·") |
| | | @Schema(description = "éè´§åå·") |
| | | private String returnNo; |
| | | |
| | | @Schema(description = "客æ·åç§°") |
| | | @Excel(name = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "å
³èåè´§åå·") |
| | | @Excel(name = "å
³èåè´§åå·") |
| | | private String shippingNo; |
| | | |
| | | @Schema(description = "éè´§æ¥æ") |
| | | @Excel(name = "éè´§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime makeTime; |
| | | |
| | | @Schema(description = "鿬¾æ»é¢") |
| | | @Excel(name = "鿬¾æ»é¢") |
| | | private BigDecimal refundAmount; |
| | | |
| | | @Schema(description = "éè´§åå ") |
| | | @Excel(name = "éè´§åå ") |
| | | private String returnReason; |
| | | |
| | | @Schema(description = "éå®è®¢åå·") |
| | | @Excel(name = "éå®è®¢åå·") |
| | | private String salesContractNo; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.SalesOutboundDto; |
| | | import com.ruoyi.account.bean.dto.SalesReturnDto; |
| | | import com.ruoyi.account.bean.vo.SalesOutboundVo; |
| | | import com.ruoyi.account.bean.vo.SalesReturnVo; |
| | | import com.ruoyi.account.service.AccountSalesService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ççéå®é¨å å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-07 04:45:30 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/accountSales") |
| | | @RequiredArgsConstructor |
| | | @Tag(name = "è´¢å¡ç®¡ççéå®é¨å") |
| | | public class AccountSalesController { |
| | | |
| | | private final AccountSalesService accountSalesService; |
| | | |
| | | @GetMapping("/listPageByOutbound") |
| | | @Log(title = "éå®åºåºå°è´¦", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--éå®åºåºå°è´¦") |
| | | public R<IPage<SalesOutboundVo>> listPageByOutbound(Page page, SalesOutboundDto salesOutboundDto) { |
| | | IPage<SalesOutboundVo> listPage = accountSalesService.listPageByOutbound(page,salesOutboundDto); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/exportAccountSalesOutbound") |
| | | @Operation(summary = "导åºéå®åºåºæä»¶") |
| | | @Log(title = "导åºéå®åºåºæä»¶", businessType = BusinessType.EXPORT) |
| | | public void exportAccountSalesOutbound(HttpServletResponse response,SalesOutboundDto salesOutboundDto) { |
| | | accountSalesService.exportAccountSalesOutbound(response,salesOutboundDto); |
| | | } |
| | | |
| | | @GetMapping("/listPageByReturn") |
| | | @Log(title = "éå®éè´§å°è´¦", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--éå®éè´§å°è´¦") |
| | | public R<IPage<SalesReturnVo>> listPageBySalesReturn(Page page, SalesReturnDto salesReturnDto) { |
| | | IPage<SalesReturnVo> listPage = accountSalesService.listPageBySalesReturn(page,salesReturnDto); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/exportAccountSalesReturn") |
| | | @Operation(summary = "导åºéå®éè´§æä»¶") |
| | | @Log(title = "导åºéå®éè´§æä»¶", businessType = BusinessType.EXPORT) |
| | | public void exportAccountSalesReturn(HttpServletResponse response,SalesReturnDto salesReturnDto) { |
| | | accountSalesService.exportAccountSalesReturn(response,salesReturnDto); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.SalesOutboundDto; |
| | | import com.ruoyi.account.bean.dto.SalesReturnDto; |
| | | import com.ruoyi.account.bean.vo.SalesOutboundVo; |
| | | import com.ruoyi.account.bean.vo.SalesReturnVo; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ççéå®é¨å æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-07 04:45:30 |
| | | */ |
| | | public interface AccountSalesService { |
| | | |
| | | IPage<SalesOutboundVo> listPageByOutbound(Page page, SalesOutboundDto salesOutboundDto); |
| | | |
| | | void exportAccountSalesOutbound(HttpServletResponse response, SalesOutboundDto salesOutboundDto); |
| | | |
| | | IPage<SalesReturnVo> listPageBySalesReturn(Page page, SalesReturnDto salesReturnDto); |
| | | |
| | | void exportAccountSalesReturn(HttpServletResponse response, SalesReturnDto salesReturnDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.SalesOutboundDto; |
| | | import com.ruoyi.account.bean.dto.SalesReturnDto; |
| | | import com.ruoyi.account.bean.vo.SalesOutboundVo; |
| | | import com.ruoyi.account.bean.vo.SalesReturnVo; |
| | | import com.ruoyi.account.service.AccountSalesService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ççéå®é¨å æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-07 04:45:30 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class AccountSalesServiceImpl implements AccountSalesService { |
| | | |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | |
| | | private final ReturnManagementMapper returnManagementMapper; |
| | | |
| | | @Override |
| | | public IPage<SalesOutboundVo> listPageByOutbound(Page page, SalesOutboundDto salesOutboundDto) { |
| | | return shippingInfoMapper.listPageByOutbound(page,salesOutboundDto); |
| | | } |
| | | |
| | | @Override |
| | | public void exportAccountSalesOutbound(HttpServletResponse response, SalesOutboundDto salesOutboundDto) { |
| | | List<SalesOutboundVo> list = shippingInfoMapper.listPageByOutbound(new Page(1,-1),salesOutboundDto).getRecords(); |
| | | ExcelUtil<SalesOutboundVo> util = new ExcelUtil<>(SalesOutboundVo.class); |
| | | util.exportExcel(response, list , "éå®åºåº"); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<SalesReturnVo> listPageBySalesReturn(Page page, SalesReturnDto salesReturnDto) { |
| | | return returnManagementMapper.listPageBySalesReturn(page,salesReturnDto); |
| | | } |
| | | |
| | | @Override |
| | | public void exportAccountSalesReturn(HttpServletResponse response, SalesReturnDto salesReturnDto) { |
| | | List<SalesReturnVo> list = returnManagementMapper.listPageBySalesReturn(new Page(1,-1),salesReturnDto).getRecords(); |
| | | ExcelUtil<SalesReturnVo> util = new ExcelUtil<>(SalesReturnVo.class); |
| | | util.exportExcel(response, list , "éå®éè´§"); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.SalesReturnDto; |
| | | import com.ruoyi.account.bean.vo.SalesReturnVo; |
| | | import com.ruoyi.procurementrecord.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | IPage<ReturnManagementDto> listPage(Page page, @Param("req") ReturnManagementDto returnManagement); |
| | | |
| | | ReturnManagementDto getReturnManagementDtoById(Long id); |
| | | |
| | | IPage<SalesReturnVo> listPageBySalesReturn(Page page, @Param("req") SalesReturnDto salesReturnDto); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.SalesOutboundDto; |
| | | import com.ruoyi.account.bean.vo.SalesOutboundVo; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.pojo.ShippingProductDetail; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | List<ShippingInfo> getShippingInfoByCustomerName(String customerName); |
| | | |
| | | List<ShippingProductDetail> getDateil(Long id); |
| | | IPage<SalesOutboundVo> listPageByOutbound(Page page, @Param("req") SalesOutboundDto salesOutboundDto); |
| | | } |
| | |
| | | left join sales_ledger sl on si.sales_ledger_id = sl.id |
| | | where rm.id = #{id} |
| | | </select> |
| | | <select id="listPageBySalesReturn" resultType="com.ruoyi.account.bean.vo.SalesReturnVo"> |
| | | select rm.id, |
| | | rm.return_no, |
| | | c.customer_name, |
| | | si.shipping_no, |
| | | rm.make_time, |
| | | rm.refund_amount, |
| | | rm.return_reason, |
| | | rm.make_time, |
| | | sl.sales_contract_no |
| | | from return_management rm |
| | | left join shipping_info si on rm.shipping_id = si.id |
| | | left join customer c on rm.customer_id = c.id |
| | | left join sales_ledger sl on si.sales_ledger_id = sl.id |
| | | where rm.status=1 |
| | | <if test="req.returnNo != null and req.returnNo != ''"> |
| | | and rm.return_no like concat('%',#{req.returnNo},'%') |
| | | </if> |
| | | <if test="req.customerName != null and req.customerName != ''"> |
| | | and c.customer_name like concat('%',#{req.customerName},'%') |
| | | </if> |
| | | <if test="req.startDate != null and req.endDate != null"> |
| | | AND DATE_FORMAT(rm.make_time, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate} |
| | | </if> |
| | | order by rm.id DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | left join sales_ledger sl on si.sales_ledger_id = sl.id |
| | | where si.status = 'å·²åè´§' and sl.customer_name = #{customerName} |
| | | </select> |
| | | <select id="listPageByOutbound" resultType="com.ruoyi.account.bean.vo.SalesOutboundVo"> |
| | | SELECT |
| | | sor.id, |
| | | sor.outbound_batches, |
| | | sl.customer_name, |
| | | s.shipping_date, |
| | | p.product_name, |
| | | slp.specification_model, |
| | | slp.stock_out_num, |
| | | s.shipping_no, |
| | | sl.sales_contract_no |
| | | FROM shipping_info s |
| | | LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id |
| | | LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id and slp.type = 1 |
| | | left join product_model pm on slp.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join stock_out_record sor on sor.record_id = s.id and sor.record_type='13' |
| | | WHERE s.status='å·²åè´§' |
| | | <if test="req.outboundBatches != null and req.outboundBatches != ''"> |
| | | AND sor.outbound_batches LIKE CONCAT('%',#{req.outboundBatches},'%') |
| | | </if> |
| | | <if test="req.customerName != null and req.customerName != ''"> |
| | | AND sl.customer_name LIKE CONCAT('%',#{req.customerName},'%') |
| | | </if> |
| | | <if test="req.startDate != null and req.endDate != null"> |
| | | AND s.shipping_date BETWEEN #{startDate} AND #{endDate} |
| | | </if> |
| | | order by sor.id DESC |
| | | </select> |
| | | </mapper> |